summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-03-10 09:22:38 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-03-10 09:22:39 +0100
commitffdacff6b0cf068c935e63c0238cbe509f14445c (patch)
tree67a3c43d755cf11a88620314b61e52353cbd696a /src
parentb1945604a78626ed25ad8afe70a64c2eac76a2b4 (diff)
parent1e27219968f760501c99f9f744f172d475a57162 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qmetatype.h26
-rw-r--r--src/corelib/tools/qscopedpointer.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp2
-rw-r--r--src/widgets/widgets/qlabel.cpp19
-rw-r--r--src/widgets/widgets/qlabel.h3
-rw-r--r--src/widgets/widgets/qlabel_p.h1
7 files changed, 44 insertions, 14 deletions
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 455d0350e0..4674efe568 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -1381,7 +1381,7 @@ namespace QtPrivate
};
template<typename T, typename Enable = void>
- struct IsGadgetHelper { enum { Value = false }; };
+ struct IsGadgetHelper { enum { IsRealGadget = false, IsGadgetOrDerivedFrom = false }; };
template<typename T>
struct IsGadgetHelper<T, typename T::QtGadgetHelper>
@@ -1389,11 +1389,14 @@ namespace QtPrivate
template <typename X>
static char checkType(void (X::*)());
static void *checkType(void (T::*)());
- enum { Value = sizeof(checkType(&T::qt_check_for_QGADGET_macro)) == sizeof(void *) };
+ enum {
+ IsRealGadget = sizeof(checkType(&T::qt_check_for_QGADGET_macro)) == sizeof(void *),
+ IsGadgetOrDerivedFrom = true
+ };
};
template<typename T, typename Enable = void>
- struct IsPointerToGadgetHelper { enum { Value = false }; };
+ struct IsPointerToGadgetHelper { enum { IsRealGadget = false, IsGadgetOrDerivedFrom = false }; };
template<typename T>
struct IsPointerToGadgetHelper<T*, typename T::QtGadgetHelper>
@@ -1402,7 +1405,10 @@ namespace QtPrivate
template <typename X>
static char checkType(void (X::*)());
static void *checkType(void (T::*)());
- enum { Value = sizeof(checkType(&T::qt_check_for_QGADGET_macro)) == sizeof(void *) };
+ enum {
+ IsRealGadget = sizeof(checkType(&T::qt_check_for_QGADGET_macro)) == sizeof(void *),
+ IsGadgetOrDerivedFrom = true
+ };
};
@@ -1435,12 +1441,12 @@ namespace QtPrivate
static inline const QMetaObject *value() { return &T::staticMetaObject; }
};
template<typename T>
- struct MetaObjectForType<T, typename std::enable_if<IsGadgetHelper<T>::Value>::type>
+ struct MetaObjectForType<T, typename std::enable_if<IsGadgetHelper<T>::IsGadgetOrDerivedFrom>::type>
{
static inline const QMetaObject *value() { return &T::staticMetaObject; }
};
template<typename T>
- struct MetaObjectForType<T, typename QEnableIf<IsPointerToGadgetHelper<T>::Value>::Type>
+ struct MetaObjectForType<T, typename std::enable_if<IsPointerToGadgetHelper<T>::IsGadgetOrDerivedFrom>::type>
{
static inline const QMetaObject *value() { return &IsPointerToGadgetHelper<T>::BaseType::staticMetaObject; }
};
@@ -1599,8 +1605,8 @@ namespace QtPrivate
template <typename T, int =
QtPrivate::IsPointerToTypeDerivedFromQObject<T>::Value ? QMetaType::PointerToQObject :
- QtPrivate::IsGadgetHelper<T>::Value ? QMetaType::IsGadget :
- QtPrivate::IsPointerToGadgetHelper<T>::Value ? QMetaType::PointerToGadget :
+ QtPrivate::IsGadgetHelper<T>::IsRealGadget ? QMetaType::IsGadget :
+ QtPrivate::IsPointerToGadgetHelper<T>::IsRealGadget ? QMetaType::PointerToGadget :
QtPrivate::IsQEnumHelper<T>::Value ? QMetaType::IsEnumeration : 0>
struct QMetaTypeIdQObject
{
@@ -1653,8 +1659,8 @@ namespace QtPrivate {
| (IsWeakPointerToTypeDerivedFromQObject<T>::Value ? QMetaType::WeakPointerToQObject : 0)
| (IsTrackingPointerToTypeDerivedFromQObject<T>::Value ? QMetaType::TrackingPointerToQObject : 0)
| (std::is_enum<T>::value ? QMetaType::IsEnumeration : 0)
- | (IsGadgetHelper<T>::Value ? QMetaType::IsGadget : 0)
- | (IsPointerToGadgetHelper<T>::Value ? QMetaType::PointerToGadget : 0)
+ | (IsGadgetHelper<T>::IsGadgetOrDerivedFrom ? QMetaType::IsGadget : 0)
+ | (IsPointerToGadgetHelper<T>::IsGadgetOrDerivedFrom ? QMetaType::PointerToGadget : 0)
};
};
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index 6c24e19bfa..769a18f9e0 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -250,9 +250,12 @@ QT_BEGIN_NAMESPACE
/*!
\fn template <typename T, typename Cleanup> void QScopedPointer<T, Cleanup>::reset(T *other = 0)
- Deletes the existing object it is pointing to if any, and sets its pointer to
+ Deletes the existing object it is pointing to (if any), and sets its pointer to
\a other. QScopedPointer now owns \a other and will delete it in its
destructor.
+
+ To clear the pointer held without deleting the object it points to (and hence take ownership
+ of the object), use \l take() instead.
*/
/*!
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 39d2857212..0302d585b5 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -956,7 +956,7 @@ void QXcbConnection::xi2UpdateScrollingDevice(ScrollingDevice &scrollingDevice)
return;
}
QPointF lastScrollPosition;
- if (lcQpaXInput().isDebugEnabled())
+ if (lcQpaXInputEvents().isDebugEnabled())
lastScrollPosition = scrollingDevice.lastScrollPosition;
for (int c = 0; c < deviceInfo->num_classes; ++c) {
XIAnyClassInfo *classInfo = deviceInfo->classes[c];
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index e9a6e536a7..fed096f311 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2333,7 +2333,7 @@ void QXcbWindow::handleMotionNotifyEvent(const xcb_motion_notify_event_t *event)
#if QT_CONFIG(xinput2)
static inline int fixed1616ToInt(FP1616 val)
{
- return int((qreal(val >> 16)) + (val & 0xFFFF) / (qreal)0xFFFF);
+ return int(qreal(val) / 0x10000);
}
void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource source)
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index 511db1a72c..a6ae61545b 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -963,7 +963,9 @@ bool QLabel::event(QEvent *e)
if (type == QEvent::Shortcut) {
QShortcutEvent *se = static_cast<QShortcutEvent *>(e);
if (se->shortcutId() == d->shortcutId) {
- QWidget * w = d->buddy;
+ QWidget *w = d->buddy;
+ if (!w)
+ return QFrame::event(e);
if (w->focusPolicy() != Qt::NoFocus)
w->setFocus(Qt::ShortcutFocusReason);
#if QT_CONFIG(abstractbutton)
@@ -1162,7 +1164,15 @@ void QLabelPrivate::updateLabel()
void QLabel::setBuddy(QWidget *buddy)
{
Q_D(QLabel);
+
+ if (d->buddy)
+ disconnect(d->buddy, SIGNAL(destroyed()), this, SLOT(_q_buddyDeleted()));
+
d->buddy = buddy;
+
+ if (buddy)
+ connect(buddy, SIGNAL(destroyed()), this, SLOT(_q_buddyDeleted()));
+
if (d->isTextLabel) {
if (d->shortcutId)
releaseShortcut(d->shortcutId);
@@ -1203,6 +1213,13 @@ void QLabelPrivate::updateShortcut()
shortcutId = q->grabShortcut(QKeySequence::mnemonic(text));
}
+
+void QLabelPrivate::_q_buddyDeleted()
+{
+ Q_Q(QLabel);
+ q->setBuddy(nullptr);
+}
+
#endif // QT_NO_SHORTCUT
#if QT_CONFIG(movie)
diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h
index e1cc333a1c..2f5db5a7d3 100644
--- a/src/widgets/widgets/qlabel.h
+++ b/src/widgets/widgets/qlabel.h
@@ -158,6 +158,9 @@ private:
#endif
Q_PRIVATE_SLOT(d_func(), void _q_linkHovered(const QString &))
+#ifndef QT_NO_SHORTCUT
+ Q_PRIVATE_SLOT(d_func(), void _q_buddyDeleted())
+#endif
friend class QTipLabel;
friend class QMessageBoxPrivate;
friend class QBalloonTip;
diff --git a/src/widgets/widgets/qlabel_p.h b/src/widgets/widgets/qlabel_p.h
index e05a5b5c35..59188563a9 100644
--- a/src/widgets/widgets/qlabel_p.h
+++ b/src/widgets/widgets/qlabel_p.h
@@ -89,6 +89,7 @@ public:
#endif
#ifndef QT_NO_SHORTCUT
void updateShortcut();
+ void _q_buddyDeleted();
#endif
inline bool needTextControl() const {
return isTextLabel