diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-28 11:51:35 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-28 11:51:35 +0200 |
commit | e918334045612ec2c7c6203845ad05c4a1972e87 (patch) | |
tree | b59bf3a173c6bfa58c3ba9b5bb80df4a093247dc /src/widgets/kernel | |
parent | e3cbf0f1962958457f6e09fcfdc92d8cac4b6511 (diff) | |
parent | cf0119bb69592d58ca7e6a75753799ebae61e4b5 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/widgets/dialogs/qcolordialog.cpp
src/widgets/dialogs/qfiledialog.cpp
tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
Change-Id: I34bc8a990f8f526889a95a5c7099ef557b9681ad
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qlayout.cpp | 7 | ||||
-rw-r--r-- | src/widgets/kernel/qstackedlayout.cpp | 12 | ||||
-rw-r--r-- | src/widgets/kernel/qstandardgestures.cpp | 24 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 4 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 1 |
6 files changed, 26 insertions, 24 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 4dc04c5fa1..1b77d74cd0 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3174,11 +3174,11 @@ bool QApplication::notify(QObject *receiver, QEvent *e) key->accept(); else key->ignore(); - res = d->notify_helper(receiver, e); QWidget *w = isWidget ? static_cast<QWidget *>(receiver) : 0; #ifndef QT_NO_GRAPHICSVIEW QGraphicsWidget *gw = isGraphicsWidget ? static_cast<QGraphicsWidget *>(receiver) : 0; #endif + res = d->notify_helper(receiver, e); if ((res && key->isAccepted()) /* diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 240f525722..7f30a78848 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -546,7 +546,7 @@ void QLayout::invalidate() update(); } -static bool removeWidgetRecursively(QLayoutItem *li, QWidget *w) +static bool removeWidgetRecursively(QLayoutItem *li, QObject *w) { QLayout *lay = li->layout(); if (!lay) @@ -609,12 +609,11 @@ void QLayout::widgetEvent(QEvent *e) { QChildEvent *c = (QChildEvent *)e; if (c->child()->isWidgetType()) { - QWidget *w = (QWidget *)c->child(); #ifndef QT_NO_MENUBAR - if (w == d->menubar) + if (c->child() == d->menubar) d->menubar = 0; #endif - removeWidgetRecursively(this, w); + removeWidgetRecursively(this, c->child()); } } break; diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp index 006b3e8588..d9c1c524d7 100644 --- a/src/widgets/kernel/qstackedlayout.cpp +++ b/src/widgets/kernel/qstackedlayout.cpp @@ -41,7 +41,7 @@ #include "qlayout_p.h" #include <qlist.h> -#include <qwidget.h> +#include "private/qwidget_p.h" #include "private/qlayoutengine_p.h" QT_BEGIN_NAMESPACE @@ -251,14 +251,10 @@ QLayoutItem *QStackedLayout::itemAt(int index) const // Code that enables proper handling of the case that takeAt() is // called somewhere inside QObject destructor (can't call hide() // on the object then) - -class QtFriendlyLayoutWidget : public QWidget +static bool qt_wasDeleted(const QWidget *w) { -public: - inline bool wasDeleted() const { return d_ptr->wasDeleted; } -}; - -static bool qt_wasDeleted(const QWidget *w) { return static_cast<const QtFriendlyLayoutWidget*>(w)->wasDeleted(); } + return QWidgetPrivate::get(w)->wasDeleted; +} /*! diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp index 68ac874b59..759c9864a6 100644 --- a/src/widgets/kernel/qstandardgestures.cpp +++ b/src/widgets/kernel/qstandardgestures.cpp @@ -508,45 +508,46 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object, return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint; } - const QTouchEvent *ev = static_cast<const QTouchEvent *>(event); - const QMouseEvent *me = static_cast<const QMouseEvent *>(event); -#ifndef QT_NO_GRAPHICSVIEW - const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event); -#endif - enum { TapRadius = 40 }; switch (event->type()) { #ifndef QT_NO_GRAPHICSVIEW - case QEvent::GraphicsSceneMousePress: + case QEvent::GraphicsSceneMousePress: { + const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event); d->position = gsme->screenPos(); q->setHotSpot(d->position); if (d->timerId) q->killTimer(d->timerId); d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout); return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout + } #endif - case QEvent::MouseButtonPress: + case QEvent::MouseButtonPress: { + const QMouseEvent *me = static_cast<const QMouseEvent *>(event); d->position = me->globalPos(); q->setHotSpot(d->position); if (d->timerId) q->killTimer(d->timerId); d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout); return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout - case QEvent::TouchBegin: + } + case QEvent::TouchBegin: { + const QTouchEvent *ev = static_cast<const QTouchEvent *>(event); d->position = ev->touchPoints().at(0).startScreenPos(); q->setHotSpot(d->position); if (d->timerId) q->killTimer(d->timerId); d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout); return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout + } #ifndef QT_NO_GRAPHICSVIEW case QEvent::GraphicsSceneMouseRelease: #endif case QEvent::MouseButtonRelease: case QEvent::TouchEnd: return QGestureRecognizer::CancelGesture; // get out of the MayBeGesture state - case QEvent::TouchUpdate: + case QEvent::TouchUpdate: { + const QTouchEvent *ev = static_cast<const QTouchEvent *>(event); if (d->timerId && ev->touchPoints().size() == 1) { QTouchEvent::TouchPoint p = ev->touchPoints().at(0); QPoint delta = p.pos().toPoint() - p.startPos().toPoint(); @@ -554,7 +555,9 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object, return QGestureRecognizer::MayBeGesture; } return QGestureRecognizer::CancelGesture; + } case QEvent::MouseMove: { + const QMouseEvent *me = static_cast<const QMouseEvent *>(event); QPoint delta = me->globalPos() - d->position.toPoint(); if (d->timerId && delta.manhattanLength() <= TapRadius) return QGestureRecognizer::MayBeGesture; @@ -562,6 +565,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object, } #ifndef QT_NO_GRAPHICSVIEW case QEvent::GraphicsSceneMouseMove: { + const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event); QPoint delta = gsme->screenPos() - d->position.toPoint(); if (d->timerId && delta.manhattanLength() <= TapRadius) return QGestureRecognizer::MayBeGesture; diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 293dafd932..b2973349e5 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5231,8 +5231,10 @@ static void sendResizeEvents(QWidget *target) const QObjectList children = target->children(); for (int i = 0; i < children.size(); ++i) { + if (!children.at(i)->isWidgetType()) + continue; QWidget *child = static_cast<QWidget*>(children.at(i)); - if (child->isWidgetType() && !child->isWindow() && child->testAttribute(Qt::WA_PendingResizeEvent)) + if (!child->isWindow() && child->testAttribute(Qt::WA_PendingResizeEvent)) sendResizeEvents(child); } } diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index f44c0aff21..19b7238a70 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -329,6 +329,7 @@ public: ~QWidgetPrivate(); static QWidgetPrivate *get(QWidget *w) { return w->d_func(); } + static const QWidgetPrivate *get(const QWidget *w) { return w->d_func(); } QWExtra *extraData() const; QTLWExtra *topData() const; |