summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp9
-rw-r--r--src/widgets/accessible/widgets.pro10
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp15
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp2
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp2
-rw-r--r--src/widgets/dialogs/qsidebar.cpp2
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp12
-rw-r--r--src/widgets/effects/qgraphicseffect.cpp3
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.cpp3
-rw-r--r--src/widgets/graphicsview/qgraphicsitemanimation.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscenelinearindex.cpp1
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp2
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp15
-rw-r--r--src/widgets/itemviews/qcolumnviewgrip.cpp2
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp2
-rw-r--r--src/widgets/itemviews/qlistview.cpp11
-rw-r--r--src/widgets/itemviews/qlistview_p.h2
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp1
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp1
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp1
-rw-r--r--src/widgets/kernel/qapplication.cpp139
-rw-r--r--src/widgets/kernel/qapplication_p.h5
-rw-r--r--src/widgets/kernel/qboxlayout.cpp2
-rw-r--r--src/widgets/kernel/qdesktopwidget.cpp1
-rw-r--r--src/widgets/kernel/qformlayout.cpp2
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp4
-rw-r--r--src/widgets/kernel/qgridlayout.cpp2
-rw-r--r--src/widgets/kernel/qlayout.cpp2
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp2
-rw-r--r--src/widgets/kernel/qshortcut.cpp2
-rw-r--r--src/widgets/kernel/qsizepolicy.cpp2
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp3
-rw-r--r--src/widgets/kernel/qwidget.h52
-rw-r--r--src/widgets/kernel/qwidget_p.h3
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp2
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp4
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp2
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition.cpp2
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition.cpp2
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.cpp2
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.cpp2
-rw-r--r--src/widgets/styles/qfusionstyle.cpp2
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm95
-rw-r--r--src/widgets/styles/qmacstyle_mac_p_p.h2
-rw-r--r--src/widgets/styles/qproxystyle.cpp2
-rw-r--r--src/widgets/styles/qstyle.cpp2
-rw-r--r--src/widgets/styles/qstyle.h10
-rw-r--r--src/widgets/styles/qstyleanimation.cpp2
-rw-r--r--src/widgets/styles/qstyleplugin.cpp2
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsstyle_p.h1
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p.h1
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p_p.h12
-rw-r--r--src/widgets/util/qcompleter.cpp2
-rw-r--r--src/widgets/util/qcompleter_p.h2
-rw-r--r--src/widgets/util/qflickgesture.cpp2
-rw-r--r--src/widgets/util/qscroller.cpp3
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp1
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp7
-rw-r--r--src/widgets/util/qundogroup.cpp2
-rw-r--r--src/widgets/util/qundostack.cpp3
-rw-r--r--src/widgets/util/qundoview.cpp1
-rw-r--r--src/widgets/widgets.pro9
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp137
-rw-r--r--src/widgets/widgets/qabstractbutton_p.h2
-rw-r--r--src/widgets/widgets/qabstractslider.cpp4
-rw-r--r--src/widgets/widgets/qbuttongroup.cpp129
-rw-r--r--src/widgets/widgets/qbuttongroup_p.h80
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp6
-rw-r--r--src/widgets/widgets/qcheckbox.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp1
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.cpp1
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp1
-rw-r--r--src/widgets/widgets/qdial.cpp2
-rw-r--r--src/widgets/widgets/qdockwidget.cpp1
-rw-r--r--src/widgets/widgets/qfocusframe.cpp2
-rw-r--r--src/widgets/widgets/qframe.cpp2
-rw-r--r--src/widgets/widgets/qkeysequenceedit.cpp2
-rw-r--r--src/widgets/widgets/qlcdnumber.cpp2
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp2
-rw-r--r--src/widgets/widgets/qmainwindow.cpp2
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp37
-rw-r--r--src/widgets/widgets/qmenu.cpp49
-rw-r--r--src/widgets/widgets/qmenu.h2
-rw-r--r--src/widgets/widgets/qmenubar.cpp24
-rw-r--r--src/widgets/widgets/qmenubar_p.h1
-rw-r--r--src/widgets/widgets/qprogressbar.cpp2
-rw-r--r--src/widgets/widgets/qradiobutton.cpp2
-rw-r--r--src/widgets/widgets/qrubberband.cpp2
-rw-r--r--src/widgets/widgets/qscrollarea.cpp2
-rw-r--r--src/widgets/widgets/qscrollbar.cpp2
-rw-r--r--src/widgets/widgets/qslider.cpp2
-rw-r--r--src/widgets/widgets/qspinbox.cpp2
-rw-r--r--src/widgets/widgets/qsplashscreen.cpp2
-rw-r--r--src/widgets/widgets/qsplitter.cpp2
-rw-r--r--src/widgets/widgets/qstackedwidget.cpp2
-rw-r--r--src/widgets/widgets/qstatusbar.cpp2
-rw-r--r--src/widgets/widgets/qtabbar.cpp2
-rw-r--r--src/widgets/widgets/qtoolbarextension.cpp2
-rw-r--r--src/widgets/widgets/qtoolbarextension_p.h1
-rw-r--r--src/widgets/widgets/qtoolbarlayout.cpp2
-rw-r--r--src/widgets/widgets/qtoolbarseparator.cpp2
-rw-r--r--src/widgets/widgets/qwidgetanimator.cpp2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp2
-rw-r--r--src/widgets/widgets/qwidgetresizehandler.cpp2
-rw-r--r--src/widgets/widgets/widgets.pri2
108 files changed, 690 insertions, 344 deletions
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index d0627f31a7..3bfef49965 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -39,6 +39,7 @@
#include "qaccessiblewidgets_p.h"
#include "qaccessiblemenu_p.h"
+#include "private/qwidget_p.h"
#include "simplewidgets_p.h"
#include "rangecontrols_p.h"
#include "complexwidgets_p.h"
@@ -59,7 +60,15 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
QAccessibleInterface *iface = 0;
if (!object || !object->isWidgetType())
return iface;
+
QWidget *widget = static_cast<QWidget*>(object);
+ // QWidget emits destroyed() from its destructor instead of letting the QObject
+ // destructor do it, which means the QWidget is unregistered from the accessibillity
+ // cache. But QWidget destruction also emits enter and leave events, which may end
+ // up here, so we have to ensure that we don't fill the cache with an entry of
+ // a widget that is going away.
+ if (QWidgetPrivate::get(widget)->data.in_destructor)
+ return iface;
if (false) {
#ifndef QT_NO_LINEEDIT
diff --git a/src/widgets/accessible/widgets.pro b/src/widgets/accessible/widgets.pro
index c6af6d3f71..da8607c637 100644
--- a/src/widgets/accessible/widgets.pro
+++ b/src/widgets/accessible/widgets.pro
@@ -1,10 +1,5 @@
TARGET = qtaccessiblewidgets
-PLUGIN_TYPE = accessible
-PLUGIN_EXTENDS = widgets
-PLUGIN_CLASS_NAME = AccessibleFactory
-load(qt_plugin)
-
QT += core-private gui-private widgets-private
QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)"
@@ -24,4 +19,7 @@ HEADERS += qaccessiblewidgets.h \
qaccessiblemenu.h \
itemviews.h
-
+PLUGIN_TYPE = accessible
+PLUGIN_EXTENDS = widgets
+PLUGIN_CLASS_NAME = AccessibleFactory
+load(qt_plugin)
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index beeef75fb5..ad13deb044 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -196,7 +196,6 @@ public:
QSize sizeHint() const Q_DECL_OVERRIDE;
virtual void setCellBrush(int row, int col, const QBrush &);
- QBrush cellBrush(int row, int col);
inline int cellWidth() const
{ return cellw; }
@@ -465,20 +464,6 @@ void QWellArray::setCellBrush(int row, int col, const QBrush &b)
d->brush[row*numCols()+col] = b;
}
-/*
- Returns the brush set for the cell at \a row, \a column. If no brush is
- set, Qt::NoBrush is returned.
-*/
-
-QBrush QWellArray::cellBrush(int row, int col)
-{
- if (d && row >= 0 && row < numRows() && col >= 0 && col < numCols())
- return d->brush[row*numCols()+col];
- return Qt::NoBrush;
-}
-
-
-
/*!\reimp
*/
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index c5e764236a..77d9eb29ac 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -402,4 +402,6 @@ void QErrorMessagePrivate::retranslateStrings()
QT_END_NAMESPACE
+#include "moc_qerrormessage.cpp"
+
#endif // QT_NO_ERRORMESSAGE
diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp
index b20db8fc7c..014792ea93 100644
--- a/src/widgets/dialogs/qfileinfogatherer.cpp
+++ b/src/widgets/dialogs/qfileinfogatherer.cpp
@@ -345,3 +345,5 @@ void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bo
#endif // QT_NO_FILESYSTEMMODEL
QT_END_NAMESPACE
+
+#include "moc_qfileinfogatherer_p.cpp"
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp
index 1b1eb6472e..d86cddab61 100644
--- a/src/widgets/dialogs/qsidebar.cpp
+++ b/src/widgets/dialogs/qsidebar.cpp
@@ -515,4 +515,6 @@ bool QSidebar::event(QEvent * event)
QT_END_NAMESPACE
+#include "moc_qsidebar_p.cpp"
+
#endif
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 93381ce7b0..8bc5ba7f56 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -53,18 +53,6 @@
#include <QtGui/QWindow>
#include <QtWidgets/QDesktopWidget>
-// Note, these tests are duplicates in qwindowsxpstyle_p.h.
-#ifdef Q_CC_GNU
-# include <w32api.h>
-# if (__W32API_MAJOR_VERSION >= 3 || (__W32API_MAJOR_VERSION == 2 && __W32API_MINOR_VERSION >= 5))
-# ifdef _WIN32_WINNT
-# undef _WIN32_WINNT
-# endif
-# define _WIN32_WINNT 0x0501
-# include <commctrl.h>
-# endif
-#endif
-
#include <uxtheme.h>
Q_DECLARE_METATYPE(QMargins)
diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp
index abeb153e53..4d1d1e9896 100644
--- a/src/widgets/effects/qgraphicseffect.cpp
+++ b/src/widgets/effects/qgraphicseffect.cpp
@@ -1235,4 +1235,7 @@ void QGraphicsOpacityEffect::draw(QPainter *painter)
QT_END_NAMESPACE
+#include "moc_qgraphicseffect.cpp"
+#include "moc_qgraphicseffect_p.cpp"
+
#endif //QT_NO_GRAPHICSEFFECT
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index 1d4014cbae..1ff4f8e88a 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -1345,4 +1345,6 @@ void QPixmapDropShadowFilter::draw(QPainter *p,
QT_END_NAMESPACE
+#include "moc_qpixmapfilter_p.cpp"
+
#endif //QT_NO_GRAPHICSEFFECT
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
index f20203cd80..176ce694a0 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
@@ -529,4 +529,7 @@ QSizeF QGraphicsAnchorLayout::sizeHint(Qt::SizeHint which, const QSizeF &constra
}
QT_END_NAMESPACE
+
+#include "moc_qgraphicsanchorlayout.cpp"
+
#endif //QT_NO_GRAPHICSVIEW
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.cpp b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
index 5e12e67a86..c5687ee9b3 100644
--- a/src/widgets/graphicsview/qgraphicsitemanimation.cpp
+++ b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
@@ -594,4 +594,6 @@ void QGraphicsItemAnimation::afterAnimationStep(qreal step)
QT_END_NAMESPACE
+#include "moc_qgraphicsitemanimation.cpp"
+
#endif // QT_NO_GRAPHICSVIEW
diff --git a/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp b/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
index bd09570c4a..06f9125612 100644
--- a/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
+++ b/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
@@ -91,3 +91,4 @@
Add the \a item from the index.
*/
+#include "moc_qgraphicsscenelinearindex_p.cpp"
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index e7fca55550..d52aff5131 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -2417,4 +2417,6 @@ void QGraphicsWidget::dumpFocusChain()
QT_END_NAMESPACE
+#include "moc_qgraphicswidget.cpp"
+
#endif //QT_NO_GRAPHICSVIEW
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 9135d1a23c..da4492a684 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -4401,7 +4401,20 @@ QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes,
QItemViewPaintPairs paintPairs = draggablePaintPairs(indexes, r);
if (paintPairs.isEmpty())
return QPixmap();
- QPixmap pixmap(r->size());
+
+ qreal scale = 1.0f;
+
+ Q_Q(const QAbstractItemView);
+ QWidget *window = q->window();
+ if (window) {
+ QWindow *windowHandle = window->windowHandle();
+ if (windowHandle)
+ scale = windowHandle->devicePixelRatio();
+ }
+
+ QPixmap pixmap(r->size() * scale);
+ pixmap.setDevicePixelRatio(scale);
+
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
QStyleOptionViewItem option = viewOptionsV1();
diff --git a/src/widgets/itemviews/qcolumnviewgrip.cpp b/src/widgets/itemviews/qcolumnviewgrip.cpp
index d2d1819cf7..f7d6e6d2b0 100644
--- a/src/widgets/itemviews/qcolumnviewgrip.cpp
+++ b/src/widgets/itemviews/qcolumnviewgrip.cpp
@@ -189,4 +189,6 @@ originalXLocation(-1)
QT_END_NAMESPACE
+#include "moc_qcolumnviewgrip_p.cpp"
+
#endif // QT_NO_QCOLUMNVIEW
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 9b7de87e32..5356ce3ad0 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -613,4 +613,6 @@ QT_END_NAMESPACE
#include "qitemeditorfactory.moc"
#endif
+#include "moc_qitemeditorfactory_p.cpp"
+
#endif // QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 646ab58e3d..3303aac6ed 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -822,7 +822,7 @@ void QListView::wheelEvent(QWheelEvent *e)
QPoint pixelDelta(e->pixelDelta().y(), e->pixelDelta().x());
QPoint angleDelta(e->angleDelta().y(), e->angleDelta().x());
QWheelEvent hwe(e->pos(), e->globalPos(), pixelDelta, angleDelta, e->delta(),
- Qt::Horizontal, e->buttons(), e->modifiers(), e->phase());
+ Qt::Horizontal, e->buttons(), e->modifiers(), e->phase(), e->source(), e->inverted());
if (e->spontaneous())
qt_sendSpontaneousEvent(d->hbar, &hwe);
else
@@ -1989,6 +1989,11 @@ int QCommonListViewBase::horizontalScrollToValue(const int /*index*/, QListView:
/*
* ListMode ListView Implementation
*/
+QListModeViewBase::QListModeViewBase(QListView *q, QListViewPrivate *d)
+ : QCommonListViewBase(q, d)
+{
+ dd->defaultDropAction = Qt::CopyAction;
+}
#ifndef QT_NO_DRAGANDDROP
QAbstractItemView::DropIndicatorPosition QListModeViewBase::position(const QPoint &pos, const QRect &rect, const QModelIndex &index) const
@@ -2755,7 +2760,7 @@ bool QIconModeViewBase::filterStartDrag(Qt::DropActions supportedActions)
drag->setMimeData(dd->model->mimeData(indexes));
drag->setPixmap(pixmap);
drag->setHotSpot(dd->pressedPosition - rect.topLeft());
- Qt::DropAction action = drag->exec(supportedActions, Qt::CopyAction);
+ Qt::DropAction action = drag->exec(supportedActions, dd->defaultDropAction);
draggedItems.clear();
if (action == Qt::MoveAction)
dd->clearOrRemove();
@@ -3296,4 +3301,6 @@ QSize QListView::viewportSizeHint() const
QT_END_NAMESPACE
+#include "moc_qlistview.cpp"
+
#endif // QT_NO_LISTVIEW
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 2e6f69713f..90fb9e1407 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -196,7 +196,7 @@ public:
class QListModeViewBase : public QCommonListViewBase
{
public:
- QListModeViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d) {}
+ QListModeViewBase(QListView *q, QListViewPrivate *d);
QVector<int> flowPositions;
QVector<int> segmentPositions;
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index 434e819d9c..9b34e89ef0 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -1975,5 +1975,6 @@ bool QListWidget::event(QEvent *e)
QT_END_NAMESPACE
#include "moc_qlistwidget.cpp"
+#include "moc_qlistwidget_p.cpp"
#endif // QT_NO_LISTWIDGET
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index 9c2db0e0e4..ed83ef7b85 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -2721,5 +2721,6 @@ void QTableWidget::dropEvent(QDropEvent *event) {
QT_END_NAMESPACE
#include "moc_qtablewidget.cpp"
+#include "moc_qtablewidget_p.cpp"
#endif // QT_NO_TABLEWIDGET
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 9e65879f32..74ca7d2827 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -3466,5 +3466,6 @@ bool QTreeWidget::event(QEvent *e)
QT_END_NAMESPACE
#include "moc_qtreewidget.cpp"
+#include "moc_qtreewidget_p.cpp"
#endif // QT_NO_TREEWIDGET
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 2d23bb61a2..2e68c7888f 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -424,7 +424,7 @@ QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard inpu
QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus
#ifndef QT_NO_WHEELEVENT
int QApplicationPrivate::wheel_scroll_lines; // number of lines to scroll
-QWidget *QApplicationPrivate::wheel_widget = Q_NULLPTR;
+QPointer<QWidget> QApplicationPrivate::wheel_widget;
#endif
bool qt_in_tab_key_event = false;
int qt_antialiasing_threshold = -1;
@@ -569,13 +569,18 @@ QApplication::QApplication(int &argc, char **argv)
QApplication::QApplication(int &argc, char **argv, int _internal)
#endif
: QGuiApplication(*new QApplicationPrivate(argc, argv, _internal))
-{ Q_D(QApplication); d->construct(); }
+{
+ Q_D(QApplication);
+ d->init();
+}
/*!
\internal
*/
-void QApplicationPrivate::construct()
+void QApplicationPrivate::init()
{
+ QGuiApplicationPrivate::init();
+
initResources();
qt_is_gui_used = (application_type != QApplicationPrivate::Tty);
@@ -3319,9 +3324,32 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
const bool spontaneous = wheel->spontaneous();
const Qt::ScrollPhase phase = wheel->phase();
- if (phase == Qt::NoScrollPhase || phase == Qt::ScrollBegin
- || (phase == Qt::ScrollUpdate && !QApplicationPrivate::wheel_widget)) {
-
+ // Ideally, we should lock on a widget when it starts receiving wheel
+ // events. This avoids other widgets to start receiving those events
+ // as the mouse cursor hovers them. However, given the way common
+ // wheeled mice work, there's no certain way of connecting different
+ // wheel events as a stream. This results in the NoScrollPhase case,
+ // where we just send the event from the original receiver and up its
+ // hierarchy until the event gets accepted.
+ //
+ // In the case of more evolved input devices, like Apple's trackpad or
+ // Magic Mouse, we receive the scroll phase information. This helps us
+ // connect wheel events as a stream and therefore makes it easier to
+ // lock on the widget onto which the scrolling was initiated.
+ //
+ // We assume that, when supported, the phase cycle follows the pattern:
+ //
+ // ScrollBegin (ScrollUpdate* ScrollEnd)+
+ //
+ // This means that we can have scrolling sequences (starting with ScrollBegin)
+ // or partial sequences (after a ScrollEnd and starting with ScrollUpdate).
+ // If wheel_widget is null because it was deleted, we also take the same
+ // code path as an initial sequence.
+ if (phase == Qt::NoScrollPhase || phase == Qt::ScrollBegin || !QApplicationPrivate::wheel_widget) {
+
+ // A system-generated ScrollBegin event starts a new user scrolling
+ // sequence, so we reset wheel_widget in case no one accepts the event
+ // or if we didn't get (or missed) a ScrollEnd previously.
if (spontaneous && phase == Qt::ScrollBegin)
QApplicationPrivate::wheel_widget = Q_NULLPTR;
@@ -3331,7 +3359,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, e, relpos);
QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(),
- wheel->modifiers(), phase, wheel->source());
+ wheel->modifiers(), phase, wheel->source(), wheel->inverted());
bool eventAccepted;
while (w) {
we.spont = spontaneous && w == receiver;
@@ -3339,7 +3367,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
res = d->notify_helper(w, &we);
eventAccepted = we.isAccepted();
if (res && eventAccepted) {
- if (spontaneous && phase != Qt::NoScrollPhase)
+ // A new scrolling sequence or partial sequence starts and w has accepted
+ // the event. Therefore, we can set wheel_widget, but only if it's not
+ // the end of a sequence.
+ if (spontaneous && (phase == Qt::ScrollBegin || phase == Qt::ScrollUpdate))
QApplicationPrivate::wheel_widget = w;
break;
}
@@ -3350,25 +3381,27 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
w = w->parentWidget();
}
wheel->setAccepted(eventAccepted);
- } else if (QApplicationPrivate::wheel_widget) {
- if (!spontaneous) {
- // wheel_widget may forward the wheel event to a delegate widget,
- // either directly or indirectly (e.g. QAbstractScrollArea will
- // forward to its QScrollBars through viewportEvent()). In that
- // case, the event will not be spontaneous but synthesized, so
- // we can send it straigth to the receiver.
- d->notify_helper(w, wheel);
- } else {
- const QPoint &relpos = QApplicationPrivate::wheel_widget->mapFromGlobal(wheel->globalPos());
- QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(),
- wheel->modifiers(), wheel->phase(), wheel->source());
- we.spont = true;
- we.ignore();
- d->notify_helper(QApplicationPrivate::wheel_widget, &we);
- wheel->setAccepted(we.isAccepted());
- if (phase == Qt::ScrollEnd)
- QApplicationPrivate::wheel_widget = Q_NULLPTR;
- }
+ } else if (!spontaneous) {
+ // wheel_widget may forward the wheel event to a delegate widget,
+ // either directly or indirectly (e.g. QAbstractScrollArea will
+ // forward to its QScrollBars through viewportEvent()). In that
+ // case, the event will not be spontaneous but synthesized, so
+ // we can send it straight to the receiver.
+ d->notify_helper(w, wheel);
+ } else {
+ // The phase is either ScrollUpdate or ScrollEnd, and wheel_widget
+ // is set. Since it accepted the wheel event previously, we continue
+ // sending those events until we get a ScrollEnd, which signifies
+ // the end of the natural scrolling sequence.
+ const QPoint &relpos = QApplicationPrivate::wheel_widget->mapFromGlobal(wheel->globalPos());
+ QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(),
+ wheel->modifiers(), wheel->phase(), wheel->source());
+ we.spont = true;
+ we.ignore();
+ d->notify_helper(QApplicationPrivate::wheel_widget, &we);
+ wheel->setAccepted(we.isAccepted());
+ if (phase == Qt::ScrollEnd)
+ QApplicationPrivate::wheel_widget = Q_NULLPTR;
}
}
break;
@@ -3546,6 +3579,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
QApplicationPrivate::giveFocusAccordingToFocusPolicy(widget, e, localPos);
}
+#ifndef QT_NO_GESTURES
+ QPointer<QWidget> gesturePendingWidget;
+#endif
+
while (widget) {
// first, try to deliver the touch event
acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents);
@@ -3563,14 +3600,16 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
touchEvent->spont = false;
if (res && eventAccepted) {
// the first widget to accept the TouchBegin gets an implicit grab.
- for (int i = 0; i < touchEvent->touchPoints().count(); ++i) {
- const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i);
- d->activeTouchPoints[QGuiApplicationPrivate::ActiveTouchPointsKey(touchEvent->device(), touchPoint.id())].target = widget;
- }
- break;
- } else if (p.isNull() || widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation)) {
+ d->activateImplicitTouchGrab(widget, touchEvent);
break;
}
+#ifndef QT_NO_GESTURES
+ if (gesturePendingWidget.isNull() && widget && QGestureManager::gesturePending(widget))
+ gesturePendingWidget = widget;
+#endif
+ if (p.isNull() || widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation))
+ break;
+
QPoint offset = widget->pos();
widget = widget->parentWidget();
touchEvent->setTarget(widget);
@@ -3584,9 +3623,27 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
}
+#ifndef QT_NO_GESTURES
+ if (!eventAccepted && !gesturePendingWidget.isNull()) {
+ // the first widget subscribed to a gesture gets an implicit grab
+ d->activateImplicitTouchGrab(gesturePendingWidget, touchEvent);
+ }
+#endif
+
touchEvent->setAccepted(eventAccepted);
break;
}
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
+ {
+ QWidget *widget = static_cast<QWidget *>(receiver);
+ // We may get here if the widget is subscribed to a gesture,
+ // but has not accepted TouchBegin. Propagate touch events
+ // only if TouchBegin has been accepted.
+ if (widget && widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent))
+ res = d->notify_helper(widget, e);
+ break;
+ }
case QEvent::RequestSoftwareInputPanel:
inputMethod()->show();
break;
@@ -4327,6 +4384,17 @@ QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device,
return static_cast<QWidget *>(closestTarget);
}
+void QApplicationPrivate::activateImplicitTouchGrab(QWidget *widget, QTouchEvent *touchEvent)
+{
+ if (touchEvent->type() != QEvent::TouchBegin)
+ return;
+
+ for (int i = 0, tc = touchEvent->touchPoints().count(); i < tc; ++i) {
+ const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i);
+ activeTouchPoints[QGuiApplicationPrivate::ActiveTouchPointsKey(touchEvent->device(), touchPoint.id())].target = widget;
+ }
+}
+
bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
QTouchDevice *device,
const QList<QTouchEvent::TouchPoint> &touchPoints,
@@ -4457,10 +4525,11 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
|| QGestureManager::gesturePending(widget)
#endif
) {
- if (touchEvent.type() == QEvent::TouchEnd)
- widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false);
if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted())
accepted = true;
+ // widget can be deleted on TouchEnd
+ if (touchEvent.type() == QEvent::TouchEnd && !widget.isNull())
+ widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false);
}
break;
}
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 0482f83a8a..3358cce744 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -156,7 +156,7 @@ public:
bool notify_helper(QObject *receiver, QEvent * e);
- void construct(
+ void init(
#ifdef Q_DEAD_CODE_FROM_QT4_X11
Display *dpy = 0, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0
#endif
@@ -208,7 +208,7 @@ public:
static QWidget *active_window;
#ifndef QT_NO_WHEELEVENT
static int wheel_scroll_lines;
- static QWidget *wheel_widget;
+ static QPointer<QWidget> wheel_widget;
#endif
static int enabledAnimations; // Combination of QPlatformTheme::UiEffect
@@ -288,6 +288,7 @@ public:
QWidget *findClosestTouchPointTarget(QTouchDevice *device, const QTouchEvent::TouchPoint &touchPoint);
void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint);
void removeTouchPoint(int touchPointId);
+ void activateImplicitTouchGrab(QWidget *widget, QTouchEvent *touchBeginEvent);
static bool translateRawTouchEvent(QWidget *widget,
QTouchDevice *device,
const QList<QTouchEvent::TouchPoint> &touchPoints,
diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp
index d167690468..f2e3df5314 100644
--- a/src/widgets/kernel/qboxlayout.cpp
+++ b/src/widgets/kernel/qboxlayout.cpp
@@ -1354,3 +1354,5 @@ QVBoxLayout::~QVBoxLayout()
}
QT_END_NAMESPACE
+
+#include "moc_qboxlayout.cpp"
diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
index 488665ff5f..fceb061867 100644
--- a/src/widgets/kernel/qdesktopwidget.cpp
+++ b/src/widgets/kernel/qdesktopwidget.cpp
@@ -274,3 +274,4 @@ void QDesktopWidget::resizeEvent(QResizeEvent *)
QT_END_NAMESPACE
#include "moc_qdesktopwidget.cpp"
+#include "moc_qdesktopwidget_p.cpp"
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 2ee7716ac3..9b346a2c50 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -2114,3 +2114,5 @@ void QFormLayout::dump() const
#endif
QT_END_NAMESPACE
+
+#include "moc_qformlayout.cpp"
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index 9a3e9291bf..8af3516d4b 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -555,9 +555,9 @@ bool QGestureManager::filterEvent(QObject *receiver, QEvent *event)
if (widgetWindow)
return filterEvent(widgetWindow->widget(), event);
- if (!m_gestureToRecognizer.contains(static_cast<QGesture *>(receiver)))
+ QGesture *state = qobject_cast<QGesture *>(receiver);
+ if (!state || !m_gestureToRecognizer.contains(state))
return false;
- QGesture *state = static_cast<QGesture *>(receiver);
QMultiMap<QObject *, Qt::GestureType> contexts;
contexts.insert(state, state->gestureType());
return filterEventThroughContexts(contexts, event);
diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp
index f3d294bd77..b58e7fdc9e 100644
--- a/src/widgets/kernel/qgridlayout.cpp
+++ b/src/widgets/kernel/qgridlayout.cpp
@@ -1692,3 +1692,5 @@ void QGridLayout::invalidate()
}
QT_END_NAMESPACE
+
+#include "moc_qgridlayout.cpp"
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 6c94d81e43..240f525722 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -1477,3 +1477,5 @@ QSize QLayout::closestAcceptableSize(const QWidget *widget, const QSize &size)
}
QT_END_NAMESPACE
+
+#include "moc_qlayout.cpp"
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index f3c86ea306..5071c56763 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -1349,3 +1349,5 @@ bool QOpenGLWidget::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#include "moc_qopenglwidget.cpp"
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index 77efaf1632..bf162249d0 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -658,3 +658,5 @@ bool QShortcut::event(QEvent *e)
#endif // QT_NO_SHORTCUT
QT_END_NAMESPACE
+
+#include "moc_qshortcut.cpp"
diff --git a/src/widgets/kernel/qsizepolicy.cpp b/src/widgets/kernel/qsizepolicy.cpp
index 63024fcf42..66fa350f81 100644
--- a/src/widgets/kernel/qsizepolicy.cpp
+++ b/src/widgets/kernel/qsizepolicy.cpp
@@ -512,3 +512,5 @@ QDebug operator<<(QDebug dbg, const QSizePolicy &p)
#endif
QT_END_NAMESPACE
+
+#include "moc_qsizepolicy.cpp"
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index 05f7f39f0f..006b3e8588 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -596,3 +596,5 @@ void QStackedLayout::setStackingMode(StackingMode stackingMode)
}
QT_END_NAMESPACE
+
+#include "moc_qstackedlayout.cpp"
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index a5b64e5bfc..598991bd98 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1892,7 +1892,6 @@ void QWidgetPrivate::deleteTLSysExtra()
if (extra->topextra->window) {
extra->topextra->window->destroy();
}
- setWinId(0);
delete extra->topextra->window;
extra->topextra->window = 0;
@@ -7244,7 +7243,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
if (q->isVisible())
hide_sys();
data.crect = QRect(x, y, w, h);
- } else if (q->isVisible() && q->testAttribute(Qt::WA_OutsideWSRange)) {
+ } else if (q->testAttribute(Qt::WA_OutsideWSRange)) {
q->setAttribute(Qt::WA_OutsideWSRange, false);
needsShow = true;
}
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index cce31e4011..43ca76ac7c 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -612,43 +612,43 @@ Q_SIGNALS:
protected:
// Event handlers
- bool event(QEvent *) Q_DECL_OVERRIDE;
- virtual void mousePressEvent(QMouseEvent *);
- virtual void mouseReleaseEvent(QMouseEvent *);
- virtual void mouseDoubleClickEvent(QMouseEvent *);
- virtual void mouseMoveEvent(QMouseEvent *);
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ virtual void mousePressEvent(QMouseEvent *event);
+ virtual void mouseReleaseEvent(QMouseEvent *event);
+ virtual void mouseDoubleClickEvent(QMouseEvent *event);
+ virtual void mouseMoveEvent(QMouseEvent *event);
#ifndef QT_NO_WHEELEVENT
- virtual void wheelEvent(QWheelEvent *);
-#endif
- virtual void keyPressEvent(QKeyEvent *);
- virtual void keyReleaseEvent(QKeyEvent *);
- virtual void focusInEvent(QFocusEvent *);
- virtual void focusOutEvent(QFocusEvent *);
- virtual void enterEvent(QEvent *);
- virtual void leaveEvent(QEvent *);
- virtual void paintEvent(QPaintEvent *);
- virtual void moveEvent(QMoveEvent *);
- virtual void resizeEvent(QResizeEvent *);
- virtual void closeEvent(QCloseEvent *);
+ virtual void wheelEvent(QWheelEvent *event);
+#endif
+ virtual void keyPressEvent(QKeyEvent *event);
+ virtual void keyReleaseEvent(QKeyEvent *event);
+ virtual void focusInEvent(QFocusEvent *event);
+ virtual void focusOutEvent(QFocusEvent *event);
+ virtual void enterEvent(QEvent *event);
+ virtual void leaveEvent(QEvent *event);
+ virtual void paintEvent(QPaintEvent *event);
+ virtual void moveEvent(QMoveEvent *event);
+ virtual void resizeEvent(QResizeEvent *event);
+ virtual void closeEvent(QCloseEvent *event);
#ifndef QT_NO_CONTEXTMENU
- virtual void contextMenuEvent(QContextMenuEvent *);
+ virtual void contextMenuEvent(QContextMenuEvent *event);
#endif
#ifndef QT_NO_TABLETEVENT
- virtual void tabletEvent(QTabletEvent *);
+ virtual void tabletEvent(QTabletEvent *event);
#endif
#ifndef QT_NO_ACTION
- virtual void actionEvent(QActionEvent *);
+ virtual void actionEvent(QActionEvent *event);
#endif
#ifndef QT_NO_DRAGANDDROP
- virtual void dragEnterEvent(QDragEnterEvent *);
- virtual void dragMoveEvent(QDragMoveEvent *);
- virtual void dragLeaveEvent(QDragLeaveEvent *);
- virtual void dropEvent(QDropEvent *);
+ virtual void dragEnterEvent(QDragEnterEvent *event);
+ virtual void dragMoveEvent(QDragMoveEvent *event);
+ virtual void dragLeaveEvent(QDragLeaveEvent *event);
+ virtual void dropEvent(QDropEvent *event);
#endif
- virtual void showEvent(QShowEvent *);
- virtual void hideEvent(QHideEvent *);
+ virtual void showEvent(QShowEvent *event);
+ virtual void hideEvent(QHideEvent *event);
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result);
// Misc. protected functions
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index fe5b3cc85d..91af7a4cb0 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -74,7 +74,6 @@ QT_BEGIN_NAMESPACE
// Extra QWidget data
// - to minimize memory usage for members that are seldom used.
// - top-level widgets have extra extra data to reduce cost further
-class QWidgetWindow;
class QPaintEngine;
class QPixmap;
class QWidgetBackingStore;
@@ -160,7 +159,7 @@ struct QTLWExtra {
QWidgetBackingStoreTracker backingStoreTracker;
QBackingStore *backingStore;
QPainter *sharedPainter;
- QWidgetWindow *window;
+ QWindow *window;
QOpenGLContext *shareContext;
// Implicit pointers (shared_null).
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index e925475b79..7a4a6d862d 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -1630,3 +1630,5 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn)
QT_END_NAMESPACE
+
+#include "moc_qwidgetbackingstore_p.cpp"
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 6a3785ea03..c22841dd56 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -776,7 +776,7 @@ void QWidgetWindow::handleWheelEvent(QWheelEvent *event)
QPoint mapped = widget->mapFrom(rootWidget, pos);
- QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source());
+ QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source(), event->inverted());
QGuiApplication::sendSpontaneousEvent(widget, &translated);
}
@@ -1007,3 +1007,5 @@ void QWidgetWindow::updateObjectName()
}
QT_END_NAMESPACE
+
+#include "moc_qwidgetwindow_p.cpp"
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index 462a41ce5d..d7f4b1f989 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -403,3 +403,5 @@ void QWindowContainer::parentWasLowered(QWidget *parent)
}
QT_END_NAMESPACE
+
+#include "moc_qwindowcontainer_p.cpp"
diff --git a/src/widgets/statemachine/qbasickeyeventtransition.cpp b/src/widgets/statemachine/qbasickeyeventtransition.cpp
index e1b4e262e8..fe2edca613 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition.cpp
+++ b/src/widgets/statemachine/qbasickeyeventtransition.cpp
@@ -203,4 +203,6 @@ void QBasicKeyEventTransition::onTransition(QEvent *)
QT_END_NAMESPACE
+#include "moc_qbasickeyeventtransition_p.cpp"
+
#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition.cpp b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
index 6ca76ce1b1..39c69b95f5 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
@@ -208,4 +208,6 @@ void QBasicMouseEventTransition::onTransition(QEvent *)
QT_END_NAMESPACE
+#include "moc_qbasicmouseeventtransition_p.cpp"
+
#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qkeyeventtransition.cpp b/src/widgets/statemachine/qkeyeventtransition.cpp
index ef5151d1eb..0e9f8458c2 100644
--- a/src/widgets/statemachine/qkeyeventtransition.cpp
+++ b/src/widgets/statemachine/qkeyeventtransition.cpp
@@ -174,4 +174,6 @@ void QKeyEventTransition::onTransition(QEvent *event)
QT_END_NAMESPACE
+#include "moc_qkeyeventtransition.cpp"
+
#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qmouseeventtransition.cpp b/src/widgets/statemachine/qmouseeventtransition.cpp
index d287bb23aa..047a9779fe 100644
--- a/src/widgets/statemachine/qmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qmouseeventtransition.cpp
@@ -202,4 +202,6 @@ void QMouseEventTransition::onTransition(QEvent *event)
QT_END_NAMESPACE
+#include "moc_qmouseeventtransition.cpp"
+
#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 1cd91a26ee..3bab2f5dbe 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -3741,4 +3741,6 @@ QPixmap QFusionStyle::standardPixmap(StandardPixmap standardPixmap, const QStyle
QT_END_NAMESPACE
+#include "moc_qfusionstyle_p.cpp"
+
#endif // QT_NO_STYLE_FUSION || QT_PLUGIN
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index ef1b9432cd..3d03ed5323 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1102,17 +1102,67 @@ static QAquaWidgetSize qt_aqua_guess_size(const QWidget *widg, QSize large, QSiz
}
#endif
-static void qt_drawFocusRingOnPath(CGContextRef cg, NSBezierPath *focusRingPath)
+void QMacStylePrivate::drawFocusRing(QPainter *p, const QRect &targetRect, int hMargin, int vMargin, qreal radius) const
{
- CGContextSaveGState(cg);
- [NSGraphicsContext saveGraphicsState];
- [NSGraphicsContext setCurrentContext:[NSGraphicsContext
- graphicsContextWithGraphicsPort:(CGContextRef)cg flipped:NO]];
- NSSetFocusRingStyle(NSFocusRingOnly);
- [focusRingPath setClip]; // Clear clip path to avoid artifacts when rendering the cursor at zero pos
- [focusRingPath fill];
- [NSGraphicsContext restoreGraphicsState];
- CGContextRestoreGState(cg);
+ qreal pixelRatio = p->device()->devicePixelRatioF();
+ static const QString keyFormat = QLatin1String("$qt_focusring%1-%2-%3-%4");
+ const QString &key = keyFormat.arg(hMargin).arg(vMargin).arg(radius).arg(pixelRatio);
+ QPixmap focusRingPixmap;
+ const qreal size = radius * 2 + 5;
+
+ if (!QPixmapCache::find(key, focusRingPixmap)) {
+ focusRingPixmap = QPixmap((QSize(size, size) + 2 * QSize(hMargin, vMargin)) * pixelRatio);
+ focusRingPixmap.fill(Qt::transparent);
+ focusRingPixmap.setDevicePixelRatio(pixelRatio);
+ {
+ QMacAutoReleasePool pool;
+ NSBezierPath *focusRingPath;
+ if (radius > 0)
+ focusRingPath = [NSBezierPath bezierPathWithRoundedRect:NSMakeRect(hMargin, vMargin, size, size)
+ xRadius:radius
+ yRadius:radius];
+ else
+ focusRingPath = [NSBezierPath bezierPathWithRect:NSMakeRect(hMargin, vMargin, size, size)];
+ [NSGraphicsContext saveGraphicsState];
+ QMacCGContext gc(&focusRingPixmap);
+ [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:(CGContextRef)gc
+ flipped:NO]];
+ NSSetFocusRingStyle(NSFocusRingOnly);
+ [focusRingPath fill];
+ [NSGraphicsContext restoreGraphicsState];
+ }
+ QPixmapCache::insert(key, focusRingPixmap);
+ }
+
+ // Add 2 for the actual ring tickness going inwards
+ const qreal hCornerSize = 2 + hMargin + radius;
+ const qreal vCornerSize = 2 + vMargin + radius;
+ const qreal shCornerSize = hCornerSize * pixelRatio;
+ const qreal svCornerSize = vCornerSize * pixelRatio;
+ // top-left corner
+ p->drawPixmap(QPointF(targetRect.left(), targetRect.top()), focusRingPixmap,
+ QRectF(0, 0, shCornerSize, svCornerSize));
+ // top-right corner
+ p->drawPixmap(QPointF(targetRect.right() - hCornerSize + 1, targetRect.top()), focusRingPixmap,
+ QRectF(focusRingPixmap.width() - shCornerSize, 0, shCornerSize, svCornerSize));
+ // bottom-left corner
+ p->drawPixmap(QPointF(targetRect.left(), targetRect.bottom() - vCornerSize + 1), focusRingPixmap,
+ QRectF(0, focusRingPixmap.height() - svCornerSize, shCornerSize, svCornerSize));
+ // bottom-right corner
+ p->drawPixmap(QPointF(targetRect.right() - hCornerSize + 1, targetRect.bottom() - vCornerSize + 1), focusRingPixmap,
+ QRect(focusRingPixmap.width() - shCornerSize, focusRingPixmap.height() - svCornerSize, shCornerSize, svCornerSize));
+ // top edge
+ p->drawPixmap(QRectF(targetRect.left() + hCornerSize, targetRect.top(), targetRect.width() - 2 * hCornerSize, vCornerSize), focusRingPixmap,
+ QRect(shCornerSize, 0, focusRingPixmap.width() - 2 * shCornerSize, svCornerSize));
+ // bottom edge
+ p->drawPixmap(QRectF(targetRect.left() + hCornerSize, targetRect.bottom() - vCornerSize + 1, targetRect.width() - 2 * hCornerSize, vCornerSize), focusRingPixmap,
+ QRect(shCornerSize, focusRingPixmap.height() - svCornerSize, focusRingPixmap.width() - 2 * shCornerSize, svCornerSize));
+ // left edge
+ p->drawPixmap(QRectF(targetRect.left(), targetRect.top() + vCornerSize, hCornerSize, targetRect.height() - 2 * vCornerSize), focusRingPixmap,
+ QRect(0, svCornerSize, shCornerSize, focusRingPixmap.width() - 2 * svCornerSize));
+ // right edge
+ p->drawPixmap(QRectF(targetRect.right() - hCornerSize + 1, targetRect.top() + vCornerSize, hCornerSize, targetRect.height() - 2 * vCornerSize), focusRingPixmap,
+ QRect(focusRingPixmap.width() - shCornerSize, svCornerSize, shCornerSize, focusRingPixmap.width() - 2 * svCornerSize));
}
QAquaWidgetSize QMacStylePrivate::effectiveAquaSizeConstrain(const QStyleOption *option,
@@ -3922,12 +3972,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
}
- NSBezierPath *pushButtonFocusRingPath;
- if (bdi.kind == kThemeBevelButton)
- pushButtonFocusRingPath = [NSBezierPath bezierPathWithRect:NSRectFromCGRect(focusRect)];
- else
- pushButtonFocusRingPath = [NSBezierPath bezierPathWithRoundedRect:NSRectFromCGRect(focusRect) xRadius:4 yRadius:4];
- qt_drawFocusRingOnPath(cg, pushButtonFocusRingPath);
+ const qreal radius = bdi.kind == kThemeBevelButton ? 0 : 4;
+ const int hMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, btn, w);
+ const int vMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, btn, w);
+ const QRect focusTargetRect(focusRect.origin.x, focusRect.origin.y, focusRect.size.width, focusRect.size.height);
+ d->drawFocusRing(p, focusTargetRect.adjusted(-hMargin, -vMargin, hMargin, vMargin), hMargin, vMargin, radius);
}
if (hasMenu && (!usingYosemiteOrLater || bdi.kind == kThemeBevelButton)) {
@@ -4365,12 +4414,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
break;
case CE_FocusFrame: {
- int xOff = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, w);
- int yOff = proxy()->pixelMetric(PM_FocusFrameVMargin, opt, w);
- NSRect rect = NSMakeRect(xOff+opt->rect.x(), yOff+opt->rect.y(), opt->rect.width() - 2 * xOff,
- opt->rect.height() - 2 * yOff);
- NSBezierPath *focusFramePath = [NSBezierPath bezierPathWithRect:rect];
- qt_drawFocusRingOnPath(cg, focusFramePath);
+ const int hMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, w);
+ const int vMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, opt, w);
+ d->drawFocusRing(p, opt->rect, hMargin, vMargin);
break; }
case CE_MenuItem:
case CE_MenuEmptyArea:
@@ -4582,7 +4628,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
HIRect menuRect = qt_hirectForQRect(mi->menuRect);
HIRect itemRect = qt_hirectForQRect(mi->rect);
- if ((opt->state & State_Selected) && (opt->state & State_Enabled) && (opt->state & State_Sunken)){
+ const bool selected = (opt->state & State_Selected) && (opt->state & State_Enabled) && (opt->state & State_Sunken);
+ if (selected) {
// Draw a selected menu item background:
HIThemeMenuItemDrawInfo mdi;
mdi.version = qt_mac_hitheme_version;
@@ -4610,7 +4657,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
Qt::AlignCenter | Qt::TextHideMnemonic | Qt::TextDontClip
| Qt::TextSingleLine,
mi->palette, mi->state & State_Enabled,
- mi->text, QPalette::ButtonText);
+ mi->text, selected ? QPalette::HighlightedText : QPalette::ButtonText);
}
}
break;
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h
index 53dd2b7a23..31ba8c3464 100644
--- a/src/widgets/styles/qmacstyle_mac_p_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p_p.h
@@ -218,6 +218,8 @@ public:
void drawNSViewInRect(QCocoaWidget widget, NSView *view, const QRect &rect, QPainter *p, bool isQWidget = true, QCocoaDrawRectBlock drawRectBlock = nil) const;
void resolveCurrentNSView(QWindow *window);
+ void drawFocusRing(QPainter *p, const QRect &targetRect, int hMargin, int vMargin, qreal radius = 0) const;
+
public:
mutable QPointer<QObject> pressedButton;
mutable QPointer<QObject> defaultButton;
diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp
index df152d1f39..182c974729 100644
--- a/src/widgets/styles/qproxystyle.cpp
+++ b/src/widgets/styles/qproxystyle.cpp
@@ -429,4 +429,6 @@ int QProxyStyle::layoutSpacing(QSizePolicy::ControlType control1,
QT_END_NAMESPACE
+#include "moc_qproxystyle.cpp"
+
#endif // QT_NO_STYLE_PROXY
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 26bb227e29..103c49496e 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -2424,3 +2424,5 @@ void QStyle::setProxy(QStyle *style)
}
QT_END_NAMESPACE
+
+#include "moc_qstyle.cpp"
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index 0f9c9379f5..0f1259160e 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -72,13 +72,13 @@ public:
QStyle();
virtual ~QStyle();
- virtual void polish(QWidget *);
- virtual void unpolish(QWidget *);
+ virtual void polish(QWidget *widget);
+ virtual void unpolish(QWidget *widget);
- virtual void polish(QApplication *);
- virtual void unpolish(QApplication *);
+ virtual void polish(QApplication *application);
+ virtual void unpolish(QApplication *application);
- virtual void polish(QPalette &);
+ virtual void polish(QPalette &palette);
virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r,
int flags, bool enabled,
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp
index 53af663dcd..67e2ee3225 100644
--- a/src/widgets/styles/qstyleanimation.cpp
+++ b/src/widgets/styles/qstyleanimation.cpp
@@ -365,4 +365,6 @@ void QScrollbarStyleAnimation::updateCurrentTime(int time)
QT_END_NAMESPACE
+#include "moc_qstyleanimation_p.cpp"
+
#endif //QT_NO_ANIMATION
diff --git a/src/widgets/styles/qstyleplugin.cpp b/src/widgets/styles/qstyleplugin.cpp
index 464cc95827..b29ff0b9a1 100644
--- a/src/widgets/styles/qstyleplugin.cpp
+++ b/src/widgets/styles/qstyleplugin.cpp
@@ -105,3 +105,5 @@ QStylePlugin::~QStylePlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qstyleplugin.cpp"
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index d8af8c5de8..36aa312ce8 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -2403,4 +2403,6 @@ QIcon QWindowsStyle::standardIcon(StandardPixmap standardIcon, const QStyleOptio
QT_END_NAMESPACE
+#include "moc_qwindowsstyle_p.cpp"
+
#endif // QT_NO_STYLE_WINDOWS
diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h
index 37b78c9523..f9d174d3c6 100644
--- a/src/widgets/styles/qwindowsstyle_p.h
+++ b/src/widgets/styles/qwindowsstyle_p.h
@@ -103,7 +103,6 @@ protected:
private:
Q_DISABLE_COPY(QWindowsStyle)
Q_DECLARE_PRIVATE(QWindowsStyle)
- void *reserved;
};
#endif // QT_NO_STYLE_WINDOWS
diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h
index a3981ad104..61bb508511 100644
--- a/src/widgets/styles/qwindowsxpstyle_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p.h
@@ -99,7 +99,6 @@ private:
Q_DISABLE_COPY(QWindowsXPStyle)
Q_DECLARE_PRIVATE(QWindowsXPStyle)
friend class QStyleFactory;
- void *reserved;
};
#endif // QT_NO_STYLE_WINDOWSXP
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index 7daef62ce0..31977304fe 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -56,18 +56,6 @@
#include <qmap.h>
#include <qt_windows.h>
-// Note, these tests are duplicated in qwizard_win.cpp.
-#ifdef Q_CC_GNU
-# include <w32api.h>
-# if (__W32API_MAJOR_VERSION >= 3 || (__W32API_MAJOR_VERSION == 2 && __W32API_MINOR_VERSION >= 5))
-# ifdef _WIN32_WINNT
-# undef _WIN32_WINNT
-# endif
-# define _WIN32_WINNT 0x0501
-# include <commctrl.h>
-# endif
-#endif
-
#include <uxtheme.h>
#if WINVER >= 0x0600
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 9f167f5924..083a4a4f27 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1886,4 +1886,6 @@ QT_END_NAMESPACE
#include "moc_qcompleter.cpp"
+#include "moc_qcompleter_p.cpp"
+
#endif // QT_NO_COMPLETER
diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h
index e2b65ba211..10dde975c0 100644
--- a/src/widgets/util/qcompleter_p.h
+++ b/src/widgets/util/qcompleter_p.h
@@ -128,7 +128,7 @@ private:
};
struct QMatchData {
- QMatchData() : exactMatchIndex(-1) { }
+ QMatchData() : exactMatchIndex(-1), partial(false) { }
QMatchData(const QIndexMapper& indices, int em, bool p) :
indices(indices), exactMatchIndex(em), partial(p) { }
QIndexMapper indices;
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 933db1711b..4f08664784 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -715,4 +715,6 @@ void QFlickGestureRecognizer::reset(QGesture *state)
QT_END_NAMESPACE
+#include "moc_qflickgesture_p.cpp"
+
#endif // QT_NO_GESTURES
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index 02e3c2b82a..2e48208402 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -2063,3 +2063,6 @@ qreal QScrollerPrivate::nextSnapPos(qreal p, int dir, Qt::Orientation orientatio
*/
QT_END_NAMESPACE
+
+#include "moc_qscroller.cpp"
+#include "moc_qscroller_p.cpp"
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 59f7fae28e..3606b7c773 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -772,3 +772,4 @@ QT_END_NAMESPACE
#endif // QT_NO_SYSTEMTRAYICON
#include "moc_qsystemtrayicon.cpp"
+#include "moc_qsystemtrayicon_p.cpp"
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index adf193bb66..f34714c016 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -40,13 +40,6 @@
#include "qsystemtrayicon_p.h"
#ifndef QT_NO_SYSTEMTRAYICON
-#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
-# undef _WIN32_WINNT
-#endif
-#if !defined(_WIN32_WINNT)
-# define _WIN32_WINNT 0x0600
-#endif
-
#if defined(_WIN32_IE) && _WIN32_IE < 0x0600
# undef _WIN32_IE
#endif
diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp
index c8623f44fe..ec4fc2788a 100644
--- a/src/widgets/util/qundogroup.cpp
+++ b/src/widgets/util/qundogroup.cpp
@@ -501,4 +501,6 @@ QAction *QUndoGroup::createRedoAction(QObject *parent, const QString &prefix) co
QT_END_NAMESPACE
+#include "moc_qundogroup.cpp"
+
#endif // QT_NO_UNDOGROUP
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 6f733f99d5..7f6a56e0ec 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -1174,4 +1174,7 @@ bool QUndoStack::isActive() const
QT_END_NAMESPACE
+#include "moc_qundostack.cpp"
+#include "moc_qundostack_p.cpp"
+
#endif // QT_NO_UNDOSTACK
diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp
index 9a89c42a3e..93c1778ea2 100644
--- a/src/widgets/util/qundoview.cpp
+++ b/src/widgets/util/qundoview.cpp
@@ -472,5 +472,6 @@ QIcon QUndoView::cleanIcon() const
QT_END_NAMESPACE
#include "qundoview.moc"
+#include "moc_qundoview.cpp"
#endif // QT_NO_UNDOVIEW
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
index ceb6f96f7c..b609e4c434 100644
--- a/src/widgets/widgets.pro
+++ b/src/widgets/widgets.pro
@@ -8,13 +8,8 @@ DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
-MODULE_PLUGIN_TYPES += \
- styles
-
QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf
-load(qt_module)
-
#platforms
mac:include(kernel/mac.pri)
win32:include(kernel/win.pri)
@@ -45,3 +40,7 @@ QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtWidgets.dynlist
testcocoon {
load(testcocoon)
}
+
+MODULE_PLUGIN_TYPES += \
+ styles
+load(qt_module)
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 9133664d77..44123d4dda 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -37,7 +37,9 @@
**
****************************************************************************/
-#include "qabstractbutton.h"
+#include "private/qabstractbutton_p.h"
+
+#include "private/qbuttongroup_p.h"
#include "qabstractitemview.h"
#include "qbuttongroup.h"
#include "qabstractbutton_p.h"
@@ -177,137 +179,6 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type)
controlType(type)
{}
-#ifndef QT_NO_BUTTONGROUP
-
-class QButtonGroupPrivate: public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QButtonGroup)
-
-public:
- QButtonGroupPrivate():exclusive(true){}
- QList<QAbstractButton *> buttonList;
- QPointer<QAbstractButton> checkedButton;
- void detectCheckedButton();
- void notifyChecked(QAbstractButton *button);
- bool exclusive;
- QHash<QAbstractButton*, int> mapping;
-};
-
-QButtonGroup::QButtonGroup(QObject *parent)
- : QObject(*new QButtonGroupPrivate, parent)
-{
-}
-
-QButtonGroup::~QButtonGroup()
-{
- Q_D(QButtonGroup);
- for (int i = 0; i < d->buttonList.count(); ++i)
- d->buttonList.at(i)->d_func()->group = 0;
-}
-
-
-bool QButtonGroup::exclusive() const
-{
- Q_D(const QButtonGroup);
- return d->exclusive;
-}
-
-void QButtonGroup::setExclusive(bool exclusive)
-{
- Q_D(QButtonGroup);
- d->exclusive = exclusive;
-}
-
-
-void QButtonGroup::addButton(QAbstractButton *button, int id)
-{
- Q_D(QButtonGroup);
- if (QButtonGroup *previous = button->d_func()->group)
- previous->removeButton(button);
- button->d_func()->group = this;
- d->buttonList.append(button);
- if (id == -1) {
- const QHash<QAbstractButton*, int>::const_iterator it
- = std::min_element(d->mapping.cbegin(), d->mapping.cend());
- if (it == d->mapping.cend())
- d->mapping[button] = -2;
- else
- d->mapping[button] = *it - 1;
- } else {
- d->mapping[button] = id;
- }
-
- if (d->exclusive && button->isChecked())
- button->d_func()->notifyChecked();
-}
-
-void QButtonGroup::removeButton(QAbstractButton *button)
-{
- Q_D(QButtonGroup);
- if (d->checkedButton == button) {
- d->detectCheckedButton();
- }
- if (button->d_func()->group == this) {
- button->d_func()->group = 0;
- d->buttonList.removeAll(button);
- d->mapping.remove(button);
- }
-}
-
-QList<QAbstractButton*> QButtonGroup::buttons() const
-{
- Q_D(const QButtonGroup);
- return d->buttonList;
-}
-
-QAbstractButton *QButtonGroup::checkedButton() const
-{
- Q_D(const QButtonGroup);
- return d->checkedButton;
-}
-
-QAbstractButton *QButtonGroup::button(int id) const
-{
- Q_D(const QButtonGroup);
- return d->mapping.key(id);
-}
-
-void QButtonGroup::setId(QAbstractButton *button, int id)
-{
- Q_D(QButtonGroup);
- if (button && id != -1)
- d->mapping[button] = id;
-}
-
-int QButtonGroup::id(QAbstractButton *button) const
-{
- Q_D(const QButtonGroup);
- return d->mapping.value(button, -1);
-}
-
-int QButtonGroup::checkedId() const
-{
- Q_D(const QButtonGroup);
- return d->mapping.value(d->checkedButton, -1);
-}
-
-// detect a checked button other than the current one
-void QButtonGroupPrivate::detectCheckedButton()
-{
- QAbstractButton *previous = checkedButton;
- checkedButton = 0;
- if (exclusive)
- return;
- for (int i = 0; i < buttonList.count(); i++) {
- if (buttonList.at(i) != previous && buttonList.at(i)->isChecked()) {
- checkedButton = buttonList.at(i);
- return;
- }
- }
-}
-
-#endif // QT_NO_BUTTONGROUP
-
QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const
{
#ifndef QT_NO_BUTTONGROUP
@@ -1419,3 +1290,5 @@ void QAbstractButton::setIconSize(const QSize &size)
QT_END_NAMESPACE
+
+#include "moc_qabstractbutton.cpp"
diff --git a/src/widgets/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h
index 416a9c4c83..f65a0527fc 100644
--- a/src/widgets/widgets/qabstractbutton_p.h
+++ b/src/widgets/widgets/qabstractbutton_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include "qabstractbutton.h"
+
#include "QtCore/qbasictimer.h"
#include "private/qwidget_p.h"
diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp
index d7d83c7821..8cd35495e9 100644
--- a/src/widgets/widgets/qabstractslider.cpp
+++ b/src/widgets/widgets/qabstractslider.cpp
@@ -758,6 +758,8 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e)
Q_D(QAbstractSlider);
e->ignore();
int delta = e->delta();
+ if (e->inverted())
+ delta = -delta;
if (d->scrollByDelta(e->orientation(), e->modifiers(), delta))
e->accept();
}
@@ -960,3 +962,5 @@ void QAbstractSliderPrivate::itemviewChangeSingleStep(int step)
}
QT_END_NAMESPACE
+
+#include "moc_qabstractslider.cpp"
diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp
index 7cc260a6f0..ef73fd1b67 100644
--- a/src/widgets/widgets/qbuttongroup.cpp
+++ b/src/widgets/widgets/qbuttongroup.cpp
@@ -37,7 +37,28 @@
**
****************************************************************************/
+#include "private/qbuttongroup_p.h"
+#ifndef QT_NO_BUTTONGROUP
+
+#include "private/qabstractbutton_p.h"
+
+QT_BEGIN_NAMESPACE
+
+// detect a checked button other than the current one
+void QButtonGroupPrivate::detectCheckedButton()
+{
+ QAbstractButton *previous = checkedButton;
+ checkedButton = 0;
+ if (exclusive)
+ return;
+ for (int i = 0; i < buttonList.count(); i++) {
+ if (buttonList.at(i) != previous && buttonList.at(i)->isChecked()) {
+ checkedButton = buttonList.at(i);
+ return;
+ }
+ }
+}
/*!
\class QButtonGroup
@@ -84,18 +105,24 @@
*/
/*!
- \fn QButtonGroup::QButtonGroup(QObject *parent)
-
Constructs a new, empty button group with the given \a parent.
\sa addButton(), setExclusive()
*/
+QButtonGroup::QButtonGroup(QObject *parent)
+ : QObject(*new QButtonGroupPrivate, parent)
+{
+}
/*!
- \fn QButtonGroup::~QButtonGroup()
-
Destroys the button group.
*/
+QButtonGroup::~QButtonGroup()
+{
+ Q_D(QButtonGroup);
+ for (int i = 0; i < d->buttonList.count(); ++i)
+ d->buttonList.at(i)->d_func()->group = 0;
+}
/*!
\property QButtonGroup::exclusive
@@ -111,6 +138,19 @@
By default, this property is \c true.
*/
+bool QButtonGroup::exclusive() const
+{
+ Q_D(const QButtonGroup);
+ return d->exclusive;
+}
+
+void QButtonGroup::setExclusive(bool exclusive)
+{
+ Q_D(QButtonGroup);
+ d->exclusive = exclusive;
+}
+
+
/*!
\fn void QButtonGroup::buttonClicked(QAbstractButton *button)
@@ -193,8 +233,6 @@
/*!
- \fn void QButtonGroup::addButton(QAbstractButton *button, int id = -1);
-
Adds the given \a button to the button group. If \a id is -1,
an id will be assigned to the button.
Automatically assigned ids are guaranteed to be negative,
@@ -203,42 +241,82 @@
\sa removeButton(), buttons()
*/
+void QButtonGroup::addButton(QAbstractButton *button, int id)
+{
+ Q_D(QButtonGroup);
+ if (QButtonGroup *previous = button->d_func()->group)
+ previous->removeButton(button);
+ button->d_func()->group = this;
+ d->buttonList.append(button);
+ if (id == -1) {
+ const QHash<QAbstractButton*, int>::const_iterator it
+ = std::min_element(d->mapping.cbegin(), d->mapping.cend());
+ if (it == d->mapping.cend())
+ d->mapping[button] = -2;
+ else
+ d->mapping[button] = *it - 1;
+ } else {
+ d->mapping[button] = id;
+ }
+
+ if (d->exclusive && button->isChecked())
+ button->d_func()->notifyChecked();
+}
/*!
- \fn void QButtonGroup::removeButton(QAbstractButton *button);
-
Removes the given \a button from the button group.
\sa addButton(), buttons()
*/
+void QButtonGroup::removeButton(QAbstractButton *button)
+{
+ Q_D(QButtonGroup);
+ if (d->checkedButton == button) {
+ d->detectCheckedButton();
+ }
+ if (button->d_func()->group == this) {
+ button->d_func()->group = 0;
+ d->buttonList.removeAll(button);
+ d->mapping.remove(button);
+ }
+}
/*!
- \fn QList<QAbstractButton*> QButtonGroup::buttons() const
-
Returns the button group's list of buttons. This may be empty.
\sa addButton(), removeButton()
*/
+QList<QAbstractButton*> QButtonGroup::buttons() const
+{
+ Q_D(const QButtonGroup);
+ return d->buttonList;
+}
/*!
- \fn QAbstractButton *QButtonGroup::checkedButton() const;
-
Returns the button group's checked button, or 0 if no buttons are
checked.
\sa buttonClicked()
*/
+QAbstractButton *QButtonGroup::checkedButton() const
+{
+ Q_D(const QButtonGroup);
+ return d->checkedButton;
+}
/*!
- \fn QAbstractButton *QButtonGroup::button(int id) const;
\since 4.1
Returns the button with the specified \a id, or 0 if no such button
exists.
*/
+QAbstractButton *QButtonGroup::button(int id) const
+{
+ Q_D(const QButtonGroup);
+ return d->mapping.key(id);
+}
/*!
- \fn void QButtonGroup::setId(QAbstractButton *button, int id)
\since 4.1
Sets the \a id for the specified \a button. Note that \a id cannot
@@ -246,9 +324,14 @@
\sa id()
*/
+void QButtonGroup::setId(QAbstractButton *button, int id)
+{
+ Q_D(QButtonGroup);
+ if (button && id != -1)
+ d->mapping[button] = id;
+}
/*!
- \fn int QButtonGroup::id(QAbstractButton *button) const;
\since 4.1
Returns the id for the specified \a button, or -1 if no such button
@@ -257,13 +340,27 @@
\sa setId()
*/
+int QButtonGroup::id(QAbstractButton *button) const
+{
+ Q_D(const QButtonGroup);
+ return d->mapping.value(button, -1);
+}
/*!
- \fn int QButtonGroup::checkedId() const;
\since 4.1
Returns the id of the checkedButton(), or -1 if no button is checked.
\sa setId()
*/
+int QButtonGroup::checkedId() const
+{
+ Q_D(const QButtonGroup);
+ return d->mapping.value(d->checkedButton, -1);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qbuttongroup.cpp"
+#endif // QT_NO_BUTTONGROUP
diff --git a/src/widgets/widgets/qbuttongroup_p.h b/src/widgets/widgets/qbuttongroup_p.h
new file mode 100644
index 0000000000..01c0367876
--- /dev/null
+++ b/src/widgets/widgets/qbuttongroup_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtWidgets module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBUTTONGROUP_P_H
+#define QBUTTONGROUP_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWidgets/qbuttongroup.h>
+
+#ifndef QT_NO_BUTTONGROUP
+
+#include <QtCore/private/qobject_p.h>
+
+#include <QtCore/qlist.h>
+#include <QtCore/qpointer.h>
+#include <QtCore/qhash.h>
+
+QT_BEGIN_NAMESPACE
+
+class QButtonGroupPrivate: public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QButtonGroup)
+
+public:
+ QButtonGroupPrivate() : exclusive(true) {}
+
+ QList<QAbstractButton *> buttonList;
+ QPointer<QAbstractButton> checkedButton;
+ void detectCheckedButton();
+ void notifyChecked(QAbstractButton *button);
+
+ bool exclusive;
+ QHash<QAbstractButton*, int> mapping;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_BUTTONGROUP
+
+#endif // QBUTTONGROUP_P_H
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 913f104287..66e4a89fe9 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -655,7 +655,6 @@ public:
int dateEditAcceptDelay() const;
void setDateEditAcceptDelay(int delay);
- QDate date() const;
void setDate(const QDate &date);
bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
@@ -691,11 +690,6 @@ void QCalendarTextNavigator::setWidget(QWidget *widget)
m_widget = widget;
}
-QDate QCalendarTextNavigator::date() const
-{
- return m_date;
-}
-
void QCalendarTextNavigator::setDate(const QDate &date)
{
m_date = date;
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp
index ad2d019c4a..19369d6cb1 100644
--- a/src/widgets/widgets/qcheckbox.cpp
+++ b/src/widgets/widgets/qcheckbox.cpp
@@ -390,3 +390,5 @@ bool QCheckBox::event(QEvent *e)
QT_END_NAMESPACE
+
+#include "moc_qcheckbox.cpp"
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 1cf7591302..08c8117e0b 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -3440,5 +3440,6 @@ void QComboBox::setModelColumn(int visibleColumn)
QT_END_NAMESPACE
#include "moc_qcombobox.cpp"
+#include "moc_qcombobox_p.cpp"
#endif // QT_NO_COMBOBOX
diff --git a/src/widgets/widgets/qcommandlinkbutton.cpp b/src/widgets/widgets/qcommandlinkbutton.cpp
index 4d43c999bf..2ec8b1c41a 100644
--- a/src/widgets/widgets/qcommandlinkbutton.cpp
+++ b/src/widgets/widgets/qcommandlinkbutton.cpp
@@ -413,3 +413,4 @@ QString QCommandLinkButton::description() const
QT_END_NAMESPACE
+#include "moc_qcommandlinkbutton.cpp"
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index c3f9198598..f72dc088da 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -2692,5 +2692,6 @@ void QCalendarPopup::hideEvent(QHideEvent *)
QT_END_NAMESPACE
#include "moc_qdatetimeedit.cpp"
+#include "moc_qdatetimeedit_p.cpp"
#endif // QT_NO_DATETIMEEDIT
diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp
index 40c7e98726..cee39e2ae3 100644
--- a/src/widgets/widgets/qdial.cpp
+++ b/src/widgets/widgets/qdial.cpp
@@ -487,4 +487,6 @@ bool QDial::event(QEvent *e)
QT_END_NAMESPACE
+#include "moc_qdial.cpp"
+
#endif // QT_NO_DIAL
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 03faca157f..293a04ef88 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1682,5 +1682,6 @@ QT_END_NAMESPACE
#include "qdockwidget.moc"
#include "moc_qdockwidget.cpp"
+#include "moc_qdockwidget_p.cpp"
#endif // QT_NO_DOCKWIDGET
diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp
index 6704631afc..8b8f4db86e 100644
--- a/src/widgets/widgets/qfocusframe.cpp
+++ b/src/widgets/widgets/qfocusframe.cpp
@@ -339,3 +339,5 @@ bool QFocusFrame::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#include "moc_qfocusframe.cpp"
diff --git a/src/widgets/widgets/qframe.cpp b/src/widgets/widgets/qframe.cpp
index 96a2e76713..1661c5c881 100644
--- a/src/widgets/widgets/qframe.cpp
+++ b/src/widgets/widgets/qframe.cpp
@@ -555,3 +555,5 @@ bool QFrame::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#include "moc_qframe.cpp"
diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp
index a663c4f853..f8a3be366e 100644
--- a/src/widgets/widgets/qkeysequenceedit.cpp
+++ b/src/widgets/widgets/qkeysequenceedit.cpp
@@ -324,3 +324,5 @@ void QKeySequenceEdit::timerEvent(QTimerEvent *e)
#endif // QT_NO_KEYSEQUENCEEDIT
QT_END_NAMESPACE
+
+#include "moc_qkeysequenceedit.cpp"
diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp
index cc1fc20379..543a7aee11 100644
--- a/src/widgets/widgets/qlcdnumber.cpp
+++ b/src/widgets/widgets/qlcdnumber.cpp
@@ -1222,4 +1222,6 @@ bool QLCDNumber::event(QEvent *e)
QT_END_NAMESPACE
+#include "moc_qlcdnumber.cpp"
+
#endif // QT_NO_LCDNUMBER
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index b646e82209..b852b8991c 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -553,4 +553,6 @@ int QLineEditPrivate::effectiveRightTextMargin() const
QT_END_NAMESPACE
+#include "moc_qlineedit_p.cpp"
+
#endif
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 4ee22dc235..f86244172d 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -1746,4 +1746,6 @@ QMenu *QMainWindow::createPopupMenu()
QT_END_NAMESPACE
+#include "moc_qmainwindow.cpp"
+
#endif // QT_NO_MAINWINDOW
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 63a6c718bc..6c05887705 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -852,6 +852,25 @@ static QList<T> findChildrenHelper(const QObject *o)
return result;
}
+#ifndef QT_NO_DOCKWIDGET
+static QList<QDockWidget*> allMyDockWidgets(const QWidget *mainWindow)
+{
+ QList<QDockWidget*> result;
+ for (QObject *c : mainWindow->children()) {
+ if (auto *dw = qobject_cast<QDockWidget*>(c)) {
+ result.append(dw);
+ } else if (auto *gw = qobject_cast<QDockWidgetGroupWindow*>(c)) {
+ for (QObject *c : gw->children()) {
+ if (auto *dw = qobject_cast<QDockWidget*>(c))
+ result.append(dw);
+ }
+ }
+ }
+
+ return result;
+}
+#endif // QT_NO_DOCKWIDGET
+
//pre4.3 tests the format that was used before 4.3
bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
{
@@ -875,9 +894,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
#ifndef QT_NO_DOCKWIDGET
case QDockAreaLayout::DockWidgetStateMarker:
{
- QList<QDockWidget *> dockWidgets = findChildrenHelper<QDockWidget*>(mainWindow);
- foreach (QDockWidgetGroupWindow *floating, findChildrenHelper<QDockWidgetGroupWindow*>(mainWindow))
- dockWidgets += findChildrenHelper<QDockWidget*>(floating);
+ const auto dockWidgets = allMyDockWidgets(mainWindow);
if (!dockAreaLayout.restoreState(stream, dockWidgets, true /*testing*/)) {
return false;
}
@@ -889,9 +906,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
QRect geom;
stream >> geom;
QDockAreaLayoutInfo info;
- QList<QDockWidget *> dockWidgets = findChildrenHelper<QDockWidget*>(mainWindow);
- foreach (QDockWidgetGroupWindow *floating, findChildrenHelper<QDockWidgetGroupWindow*>(mainWindow))
- dockWidgets += findChildrenHelper<QDockWidget*>(floating);
+ auto dockWidgets = allMyDockWidgets(mainWindow);
if (!info.restoreState(stream, dockWidgets, true /* testing*/))
return false;
}
@@ -935,9 +950,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
#ifndef QT_NO_DOCKWIDGET
case QDockAreaLayout::DockWidgetStateMarker:
{
- QList<QDockWidget *> dockWidgets = findChildrenHelper<QDockWidget*>(mainWindow);
- foreach (QDockWidgetGroupWindow *floating, findChildrenHelper<QDockWidgetGroupWindow*>(mainWindow))
- dockWidgets += findChildrenHelper<QDockWidget*>(floating);
+ const auto dockWidgets = allMyDockWidgets(mainWindow);
if (!dockAreaLayout.restoreState(stream, dockWidgets))
return false;
@@ -961,9 +974,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
#ifndef QT_NO_TABBAR
case QDockAreaLayout::FloatingDockWidgetTabMarker:
{
- QList<QDockWidget *> dockWidgets = findChildrenHelper<QDockWidget*>(mainWindow);
- foreach (QDockWidgetGroupWindow *floating, findChildrenHelper<QDockWidgetGroupWindow*>(mainWindow))
- dockWidgets += findChildrenHelper<QDockWidget*>(floating);
+ auto dockWidgets = allMyDockWidgets(mainWindow);
QDockWidgetGroupWindow* floatingTab = qt_mainwindow_layout(mainWindow)->createTabbedDockWindow();
*floatingTab->layoutInfo() = QDockAreaLayoutInfo(&dockAreaLayout.sep, QInternal::LeftDock,
Qt::Horizontal, QTabBar::RoundedSouth, mainWindow);
@@ -2593,4 +2604,6 @@ void QMainWindowLayout::timerEvent(QTimerEvent *e)
QT_END_NAMESPACE
+#include "moc_qmainwindowlayout_p.cpp"
+
#endif // QT_NO_MAINWINDOW
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 1b9e31968a..274570b22a 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1948,7 +1948,7 @@ bool QMenu::isTearOffEnabled() const
contents in a new window. When the menu is in this mode and the menu
is visible returns \c true; otherwise false.
- \sa hideTearOffMenu(), isTearOffEnabled()
+ \sa showTearOffMenu(), hideTearOffMenu(), isTearOffEnabled()
*/
bool QMenu::isTearOffMenuVisible() const
{
@@ -1958,15 +1958,54 @@ bool QMenu::isTearOffMenuVisible() const
}
/*!
+ \since 5.7
+
+ This function will forcibly show the torn off menu making it
+ appear on the user's desktop at the specified \e global position \a pos.
+
+ \sa hideTearOffMenu(), isTearOffMenuVisible(), isTearOffEnabled()
+*/
+void QMenu::showTearOffMenu(const QPoint &pos)
+{
+ Q_D(QMenu);
+ if (!d->tornPopup)
+ d->tornPopup = new QTornOffMenu(this);
+ const QSize &s = sizeHint();
+ d->tornPopup->setGeometry(pos.x(), pos.y(), s.width(), s.height());
+ d->tornPopup->show();
+}
+
+/*!
+ \overload
+ \since 5.7
+
+ This function will forcibly show the torn off menu making it
+ appear on the user's desktop under the mouse currsor.
+
+ \sa hideTearOffMenu(), isTearOffMenuVisible(), isTearOffEnabled()
+*/
+void QMenu::showTearOffMenu()
+{
+ showTearOffMenu(QCursor::pos());
+}
+
+/*!
This function will forcibly hide the torn off menu making it
- disappear from the users desktop.
+ disappear from the user's desktop.
- \sa isTearOffMenuVisible(), isTearOffEnabled()
+ \sa showTearOffMenu(), isTearOffMenuVisible(), isTearOffEnabled()
*/
void QMenu::hideTearOffMenu()
{
- if (QWidget *w = d_func()->tornPopup)
- w->close();
+ Q_D(QMenu);
+ if (d->tornPopup) {
+ d->tornPopup->close();
+ // QTornOffMenu sets WA_DeleteOnClose, so we
+ // should consider the torn-off menu deleted.
+ // This way showTearOffMenu() will not try to
+ // reuse the dying torn-off menu.
+ d->tornPopup = Q_NULLPTR;
+ }
}
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index 6634082bda..7dda38456a 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -171,6 +171,8 @@ public:
bool isTearOffEnabled() const;
bool isTearOffMenuVisible() const;
+ void showTearOffMenu();
+ void showTearOffMenu(const QPoint &pos);
void hideTearOffMenu();
void setDefaultAction(QAction *);
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 261ff0bca3..85d0c54357 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -696,7 +696,8 @@ void QMenuBarPrivate::init()
q->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
q->setAttribute(Qt::WA_CustomWhatsThis);
- platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar();
+ if (!QApplication::instance()->testAttribute(Qt::AA_DontUseNativeMenuBar))
+ platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar();
if (platformMenuBar)
q->hide();
@@ -1209,12 +1210,19 @@ void QMenuBar::leaveEvent(QEvent *)
d->setCurrentAction(0);
}
-QPlatformMenu *getPlatformMenu(QAction *action)
+QPlatformMenu *QMenuBarPrivate::getPlatformMenu(QAction *action)
{
if (!action || !action->menu())
return 0;
- return action->menu()->platformMenu();
+ QPlatformMenu *platformMenu = action->menu()->platformMenu();
+ if (!platformMenu && platformMenuBar) {
+ platformMenu = platformMenuBar->createMenu();
+ if (platformMenu)
+ action->menu()->setPlatformMenu(platformMenu);
+ }
+
+ return platformMenu;
}
/*!
@@ -1235,14 +1243,14 @@ void QMenuBar::actionEvent(QActionEvent *e)
return;
if (e->type() == QEvent::ActionAdded) {
- QPlatformMenu *menu = getPlatformMenu(e->action());
+ QPlatformMenu *menu = d->getPlatformMenu(e->action());
if (menu) {
QPlatformMenu* beforeMenu = NULL;
for (int beforeIndex = d->indexOf(e->action()) + 1;
!beforeMenu && (beforeIndex < actions().size());
++beforeIndex)
{
- beforeMenu = getPlatformMenu(actions().at(beforeIndex));
+ beforeMenu = d->getPlatformMenu(actions().at(beforeIndex));
}
menu->setTag(reinterpret_cast<quintptr>(e->action()));
@@ -1250,12 +1258,12 @@ void QMenuBar::actionEvent(QActionEvent *e)
d->platformMenuBar->insertMenu(menu, beforeMenu);
}
} else if (e->type() == QEvent::ActionRemoved) {
- QPlatformMenu *menu = getPlatformMenu(e->action());
+ QPlatformMenu *menu = d->getPlatformMenu(e->action());
if (menu)
d->platformMenuBar->removeMenu(menu);
} else if (e->type() == QEvent::ActionChanged) {
QPlatformMenu* cur = d->platformMenuBar->menuForTag(reinterpret_cast<quintptr>(e->action()));
- QPlatformMenu *menu = getPlatformMenu(e->action());
+ QPlatformMenu *menu = d->getPlatformMenu(e->action());
// the menu associated with the action can change, need to
// remove and/or insert the new platform menu
@@ -1270,7 +1278,7 @@ void QMenuBar::actionEvent(QActionEvent *e)
!beforeMenu && (beforeIndex < actions().size());
++beforeIndex)
{
- beforeMenu = getPlatformMenu(actions().at(beforeIndex));
+ beforeMenu = d->getPlatformMenu(actions().at(beforeIndex));
}
d->platformMenuBar->insertMenu(menu, beforeMenu);
}
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index 04f608d22f..05b1878c20 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -143,6 +143,7 @@ public:
QBasicTimer autoReleaseTimer;
QPlatformMenuBar *platformMenuBar;
+ QPlatformMenu *getPlatformMenu(QAction *action);
inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); }
diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp
index 2897929a14..1ba0d78622 100644
--- a/src/widgets/widgets/qprogressbar.cpp
+++ b/src/widgets/widgets/qprogressbar.cpp
@@ -629,4 +629,6 @@ QString QProgressBar::format() const
QT_END_NAMESPACE
+#include "moc_qprogressbar.cpp"
+
#endif // QT_NO_PROGRESSBAR
diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp
index 125182f79f..55a584078a 100644
--- a/src/widgets/widgets/qradiobutton.cpp
+++ b/src/widgets/widgets/qradiobutton.cpp
@@ -269,3 +269,5 @@ bool QRadioButton::event(QEvent *e)
QT_END_NAMESPACE
+
+#include "moc_qradiobutton.cpp"
diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp
index 048817d07b..13aa66dec7 100644
--- a/src/widgets/widgets/qrubberband.cpp
+++ b/src/widgets/widgets/qrubberband.cpp
@@ -333,4 +333,6 @@ bool QRubberBand::event(QEvent *e)
QT_END_NAMESPACE
+#include "moc_qrubberband.cpp"
+
#endif // QT_NO_RUBBERBAND
diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp
index bd07040509..0868dcbd69 100644
--- a/src/widgets/widgets/qscrollarea.cpp
+++ b/src/widgets/widgets/qscrollarea.cpp
@@ -538,4 +538,6 @@ Qt::Alignment QScrollArea::alignment() const
QT_END_NAMESPACE
+#include "moc_qscrollarea.cpp"
+
#endif // QT_NO_SCROLLAREA
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp
index 7399601c2e..7dd41f6a0c 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -744,4 +744,6 @@ Q_WIDGETS_EXPORT QStyleOptionSlider qt_qscrollbarStyleOption(QScrollBar *scrollb
QT_END_NAMESPACE
+#include "moc_qscrollbar.cpp"
+
#endif // QT_NO_SCROLLBAR
diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp
index bf27b19940..7b675fccbd 100644
--- a/src/widgets/widgets/qslider.cpp
+++ b/src/widgets/widgets/qslider.cpp
@@ -559,3 +559,5 @@ Q_WIDGETS_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider)
#endif
QT_END_NAMESPACE
+
+#include "moc_qslider.cpp"
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index 68b405cc5e..a5c096c3a8 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -1328,4 +1328,6 @@ bool QSpinBox::event(QEvent *event)
QT_END_NAMESPACE
+#include "moc_qspinbox.cpp"
+
#endif // QT_NO_SPINBOX
diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp
index b379e01b0a..4ad2b83582 100644
--- a/src/widgets/widgets/qsplashscreen.cpp
+++ b/src/widgets/widgets/qsplashscreen.cpp
@@ -358,4 +358,6 @@ bool QSplashScreen::event(QEvent *e)
QT_END_NAMESPACE
+#include "moc_qsplashscreen.cpp"
+
#endif //QT_NO_SPLASHSCREEN
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index 9ebd232bef..e3ca6b0a79 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -1739,4 +1739,6 @@ QTextStream& operator>>(QTextStream& ts, QSplitter& splitter)
QT_END_NAMESPACE
+#include "moc_qsplitter.cpp"
+
#endif // QT_NO_SPLITTER
diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp
index 097f98fd71..38ce182fbf 100644
--- a/src/widgets/widgets/qstackedwidget.cpp
+++ b/src/widgets/widgets/qstackedwidget.cpp
@@ -293,4 +293,6 @@ bool QStackedWidget::event(QEvent *e)
QT_END_NAMESPACE
+#include "moc_qstackedwidget.cpp"
+
#endif // QT_NO_STACKEDWIDGET
diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp
index 2e1cd29839..7de1d92acf 100644
--- a/src/widgets/widgets/qstatusbar.cpp
+++ b/src/widgets/widgets/qstatusbar.cpp
@@ -789,4 +789,6 @@ bool QStatusBar::event(QEvent *e)
QT_END_NAMESPACE
+#include "moc_qstatusbar.cpp"
+
#endif
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index ba3fc2fcd7..f56830c14b 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -2583,4 +2583,4 @@ QT_END_NAMESPACE
#endif // QT_NO_TABBAR
-
+#include "moc_qtabbar_p.cpp"
diff --git a/src/widgets/widgets/qtoolbarextension.cpp b/src/widgets/widgets/qtoolbarextension.cpp
index 71061c8102..267e220b8f 100644
--- a/src/widgets/widgets/qtoolbarextension.cpp
+++ b/src/widgets/widgets/qtoolbarextension.cpp
@@ -87,4 +87,6 @@ QSize QToolBarExtension::sizeHint() const
QT_END_NAMESPACE
+#include "moc_qtoolbarextension_p.cpp"
+
#endif // QT_NO_TOOLBUTTON
diff --git a/src/widgets/widgets/qtoolbarextension_p.h b/src/widgets/widgets/qtoolbarextension_p.h
index e8725d77b8..ea159ce986 100644
--- a/src/widgets/widgets/qtoolbarextension_p.h
+++ b/src/widgets/widgets/qtoolbarextension_p.h
@@ -60,7 +60,6 @@ QT_BEGIN_NAMESPACE
class Q_AUTOTEST_EXPORT QToolBarExtension : public QToolButton
{
Q_OBJECT
- Qt::Orientation orientation;
public:
explicit QToolBarExtension(QWidget *parent);
diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp
index 2d7ab68dde..79174bdbff 100644
--- a/src/widgets/widgets/qtoolbarlayout.cpp
+++ b/src/widgets/widgets/qtoolbarlayout.cpp
@@ -748,4 +748,6 @@ QToolBarItem *QToolBarLayout::createItem(QAction *action)
QT_END_NAMESPACE
+#include "moc_qtoolbarlayout_p.cpp"
+
#endif // QT_NO_TOOLBAR
diff --git a/src/widgets/widgets/qtoolbarseparator.cpp b/src/widgets/widgets/qtoolbarseparator.cpp
index 57997556a5..c99a8bcc4c 100644
--- a/src/widgets/widgets/qtoolbarseparator.cpp
+++ b/src/widgets/widgets/qtoolbarseparator.cpp
@@ -86,4 +86,6 @@ void QToolBarSeparator::paintEvent(QPaintEvent *)
QT_END_NAMESPACE
+#include "moc_qtoolbarseparator_p.cpp"
+
#endif // QT_NO_TOOLBAR
diff --git a/src/widgets/widgets/qwidgetanimator.cpp b/src/widgets/widgets/qwidgetanimator.cpp
index edf0b32ba0..d46d65546c 100644
--- a/src/widgets/widgets/qwidgetanimator.cpp
+++ b/src/widgets/widgets/qwidgetanimator.cpp
@@ -120,3 +120,5 @@ bool QWidgetAnimator::animating() const
}
QT_END_NAMESPACE
+
+#include "moc_qwidgetanimator_p.cpp"
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index f9674668ec..a77794df8a 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -1924,4 +1924,6 @@ bool QWidgetLineControl::isRedoAvailable() const
QT_END_NAMESPACE
+#include "moc_qwidgetlinecontrol_p.cpp"
+
#endif
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp
index 11bfc38b0d..2a7b1eeecc 100644
--- a/src/widgets/widgets/qwidgetresizehandler.cpp
+++ b/src/widgets/widgets/qwidgetresizehandler.cpp
@@ -541,4 +541,6 @@ void QWidgetResizeHandler::doMove()
QT_END_NAMESPACE
+#include "moc_qwidgetresizehandler_p.cpp"
+
#endif //QT_NO_RESIZEHANDLER
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index c31a7f7682..784055ed62 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -2,6 +2,7 @@
HEADERS += \
widgets/qbuttongroup.h \
+ widgets/qbuttongroup_p.h \
widgets/qabstractbutton.h \
widgets/qabstractbutton_p.h \
widgets/qabstractslider.h \
@@ -84,6 +85,7 @@ HEADERS += \
widgets/qplaintextedit_p.h
SOURCES += \
+ widgets/qbuttongroup.cpp \
widgets/qabstractbutton.cpp \
widgets/qabstractslider.cpp \
widgets/qabstractspinbox.cpp \