From c9210d392ca720028a4a2be427ba13100418c5b7 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 9 Mar 2016 20:55:00 +0100 Subject: Add argument names to the function signatures in headers Sometimes, in the .cpp, the declaration has the argument name in comments because it is not used (instead of using Q_UNUSED). The old qdoc could parse that, but once clang is used, these comments are not seen anymore. So add the argument names to the headers. This is also good for things like auto completion, which uses only the header to know what the argument name is. I grepped for " */)" and made sure all the functions that are documented have the right arguments. I also added the name to all the function around for consistency. Change-Id: I1aaa37e25a1985f7f51653f047a1ac2633242b56 Reviewed-by: Marc Mutz Reviewed-by: Martin Smith --- src/widgets/kernel/qwidget.h | 52 ++++++++++++++++++++++---------------------- src/widgets/styles/qstyle.h | 10 ++++----- 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index a56f6e1133..2af1550ad1 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -605,43 +605,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/styles/qstyle.h b/src/widgets/styles/qstyle.h index 1e9d15c993..26d1c63195 100644 --- a/src/widgets/styles/qstyle.h +++ b/src/widgets/styles/qstyle.h @@ -66,13 +66,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, -- cgit v1.2.3 From 11836be1274196bca5883973b3c8f31dc07c34f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Thu, 10 Mar 2016 23:18:43 +0100 Subject: Remove Qt::WA_OutsideWSRange flag even if the widget is not yet visible. Show the widget when its initial size is 0 and the layout changes the size during showing. Task-number: QTBUG-51788 Change-Id: I3251ac27328f9715ff13d96e1b82fbf824d9e79d Reviewed-by: Dmitry Shachnev Reviewed-by: Shawn Rutledge --- src/widgets/kernel/qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 7bd4920ff1..7529f5b344 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -7216,7 +7216,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; } -- cgit v1.2.3 From b4fa18a996bc29bbb04e7358ef57b287076b0aae Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 12 Mar 2016 00:58:52 +0100 Subject: Revert "Handle the QWidgetPrivate::mapper structure" This reverts commit 90de48493be283b9afb249f6a0fd8dbd8958517d. The call isn't necessary, but invokes undefined behavior. It invokes undefined behavior because deleteTLSysExtra() is called from deleteExtra(), which is called from ~QWidgetPrivate(), which is called from ~QObject(). Thus, by the time we call q->windowType() within setWinId(), q is no longer a QWidget, but only a QObject, and calling a QWidget member function then is UB. UBSan confirms: qwidget_p.h:300:5: runtime error: downcast of address 0x2afdd4053620 which does not point to an object of type 'QWidget' (the Q_Q macro) 0x2afdd4053620: note: object is of type 'QObject' qwidget.cpp:1712:93: runtime error: member call on address 0x2afdd4053620 which does not point to an object of type 'QWidget' 0x2afdd4053620: note: object is of type 'QObject' It is also unnecessary: deleteTLSysExtra() is called from two places: QWidget::destroy() and deleteExtra(). deleteExtra() is only called from ~QWidgetPrivate() which is only called from ~QObject() called by ~QWidget(), which, however, already calls QWidget::destroy(). QWidget::destroy(), in turn, unconditionally (for non-desktop widgets, at least) calls setWinId(0) itself. So fix the UB by removing the call without replacement. Conflicts: src/gui/kernel/qwidget_qpa.cpp Change-Id: Ib3a8cc9d28a096183f1d3dfd1941ea5fdc6a4aac Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qwidget.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 7529f5b344..6fdd5d3d0e 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1880,7 +1880,6 @@ void QWidgetPrivate::deleteTLSysExtra() if (extra->topextra->window) { extra->topextra->window->destroy(); } - setWinId(0); delete extra->topextra->window; extra->topextra->window = 0; -- cgit v1.2.3 From 35dce99b5664e47b2210c2dfe36300376e837f1d Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 27 Jan 2016 13:45:55 +0100 Subject: Fix QAbstractItemView dragged item pixmaps to be HighDPI aware. When an item is rendered into a QPixmap sent to the QDrag implementation, make sure it's size is scaled with the current window's devicePixelRatio, so it does not appear blurry on high-dpi screens. Change-Id: Idf38c0993e8529aff7107ff1ac412de9cf10f311 Task-number: QTBUG-46068 Reviewed-by: Shawn Rutledge --- src/widgets/itemviews/qabstractitemview.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index ad7be840d0..a126fef65e 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -4353,7 +4353,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(); -- cgit v1.2.3 From 7c7ece94429d6e12e0543c275d26fd90501193ff Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 24 Feb 2016 17:19:37 -0800 Subject: QMacStyle: Ensure proper focus ring clipping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By rendering the focus ring directly on the backing NSView, we would ignore the painter's clipping information. It would also require creating a custom CGContext and attached NSGraphicsContext every time. The first step is to render the focus ring on a pixmap and then use the painter to render that pixamp. This ensures the clipping is done properly. The second step is to cache said pixmap and render it as a nine-patch image. Change-Id: I1df1baf7dc490023319f025a16306d4f04e5264c Task-number: QTBUG-50645 Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qmacstyle_mac.mm | 90 +++++++++++++++++++++++++--------- src/widgets/styles/qmacstyle_mac_p_p.h | 2 + 2 files changed, 70 insertions(+), 22 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 4f688f6f28..092cf4d543 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1097,17 +1097,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::aquaSizeConstrain(const QStyleOption *option, const QWidget *widg, @@ -3947,12 +3997,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)) { @@ -4391,12 +4440,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: diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index 33818568ec..b2c76c2d76 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -209,6 +209,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 pressedButton; mutable QPointer defaultButton; -- cgit v1.2.3 From 5655f3413151beb0abaeb847942f7bf29a114d7d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 18 Mar 2016 10:25:08 +0100 Subject: QWindows(XP)Style: fix build with Clang after includemocs run Clang doesn't like the unused member variable: qwindowsstyle_p.h:100:11: error: private field 'reserved' is not used [-Werror,-Wunused-private-field] Remove. It's private API. Triggered by Clang seeing all methods of the classes in one TU by the following includemocs commit. Change-Id: I84e92d63af573c090ef89c1d8ee19af30f90b171 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/styles/qwindowsstyle_p.h | 1 - src/widgets/styles/qwindowsxpstyle_p.h | 1 - 2 files changed, 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h index da36d2af1b..2724222652 100644 --- a/src/widgets/styles/qwindowsstyle_p.h +++ b/src/widgets/styles/qwindowsstyle_p.h @@ -97,7 +97,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 1706a1abe6..4dcb75716e 100644 --- a/src/widgets/styles/qwindowsxpstyle_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p.h @@ -93,7 +93,6 @@ private: Q_DISABLE_COPY(QWindowsXPStyle) Q_DECLARE_PRIVATE(QWindowsXPStyle) friend class QStyleFactory; - void *reserved; }; #endif // QT_NO_STYLE_WINDOWSXP -- cgit v1.2.3 From 55878865db64bd2fa1d7fa158c56fe460ef939eb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 18 Mar 2016 10:34:19 +0100 Subject: QToolBarExtension: remove unused member 'orientation' The orientation is implicitly stored by which icon is used. Found by Clang: qtoolbarextension_p.h:57:21: error: private field 'orientation' is not used [-Werror,-Wunused-private-field] Change-Id: I82f8b8009b48d41fd2beb95d6107e505f9d4e835 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qtoolbarextension_p.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qtoolbarextension_p.h b/src/widgets/widgets/qtoolbarextension_p.h index f72dfbd597..cbb4eb5c98 100644 --- a/src/widgets/widgets/qtoolbarextension_p.h +++ b/src/widgets/widgets/qtoolbarextension_p.h @@ -54,7 +54,6 @@ QT_BEGIN_NAMESPACE class Q_AUTOTEST_EXPORT QToolBarExtension : public QToolButton { Q_OBJECT - Qt::Orientation orientation; public: explicit QToolBarExtension(QWidget *parent); -- cgit v1.2.3 From 0e6ad275498dc8cc60a7d163bac9ed0add8e48d5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 16 Mar 2016 00:47:08 +0100 Subject: QtWidgets: includemocs A very simple way to save ~3KiB in test size and 440b in data size on GCC 5.3 Linux AMD64 release builds. Change-Id: I6619148cc497116b9772a00e1bc30d573a2b2534 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/dialogs/qerrormessage.cpp | 2 ++ src/widgets/dialogs/qfileinfogatherer.cpp | 2 ++ src/widgets/dialogs/qsidebar.cpp | 2 ++ src/widgets/effects/qgraphicseffect.cpp | 3 +++ src/widgets/effects/qpixmapfilter.cpp | 2 ++ src/widgets/graphicsview/qgraphicsanchorlayout.cpp | 3 +++ src/widgets/graphicsview/qgraphicsitemanimation.cpp | 2 ++ src/widgets/graphicsview/qgraphicsscenelinearindex.cpp | 1 + src/widgets/graphicsview/qgraphicswidget.cpp | 2 ++ src/widgets/itemviews/qcolumnviewgrip.cpp | 2 ++ src/widgets/itemviews/qitemeditorfactory.cpp | 2 ++ src/widgets/itemviews/qlistview.cpp | 2 ++ src/widgets/itemviews/qlistwidget.cpp | 1 + src/widgets/itemviews/qtablewidget.cpp | 1 + src/widgets/itemviews/qtreewidget.cpp | 1 + src/widgets/kernel/qboxlayout.cpp | 2 ++ src/widgets/kernel/qdesktopwidget.cpp | 1 + src/widgets/kernel/qformlayout.cpp | 2 ++ src/widgets/kernel/qgridlayout.cpp | 2 ++ src/widgets/kernel/qlayout.cpp | 2 ++ src/widgets/kernel/qopenglwidget.cpp | 2 ++ src/widgets/kernel/qshortcut.cpp | 2 ++ src/widgets/kernel/qsizepolicy.cpp | 2 ++ src/widgets/kernel/qstackedlayout.cpp | 2 ++ src/widgets/kernel/qwidgetbackingstore.cpp | 2 ++ src/widgets/kernel/qwidgetwindow.cpp | 2 ++ src/widgets/kernel/qwindowcontainer.cpp | 2 ++ src/widgets/statemachine/qbasickeyeventtransition.cpp | 2 ++ src/widgets/statemachine/qbasicmouseeventtransition.cpp | 2 ++ src/widgets/statemachine/qkeyeventtransition.cpp | 2 ++ src/widgets/statemachine/qmouseeventtransition.cpp | 2 ++ src/widgets/styles/qfusionstyle.cpp | 2 ++ src/widgets/styles/qgtkstyle_p.cpp | 3 +++ src/widgets/styles/qproxystyle.cpp | 2 ++ src/widgets/styles/qstyle.cpp | 2 ++ src/widgets/styles/qstyleanimation.cpp | 2 ++ src/widgets/styles/qstyleplugin.cpp | 2 ++ src/widgets/styles/qwindowsstyle.cpp | 2 ++ src/widgets/util/qcompleter.cpp | 2 ++ src/widgets/util/qflickgesture.cpp | 2 ++ src/widgets/util/qscroller.cpp | 3 +++ src/widgets/util/qsystemtrayicon.cpp | 1 + src/widgets/util/qundogroup.cpp | 2 ++ src/widgets/util/qundostack.cpp | 3 +++ src/widgets/util/qundoview.cpp | 1 + src/widgets/widgets/qabstractbutton.cpp | 2 ++ src/widgets/widgets/qabstractslider.cpp | 2 ++ src/widgets/widgets/qbuttongroup.cpp | 1 + src/widgets/widgets/qcheckbox.cpp | 2 ++ src/widgets/widgets/qcombobox.cpp | 1 + src/widgets/widgets/qcommandlinkbutton.cpp | 1 + src/widgets/widgets/qdatetimeedit.cpp | 1 + src/widgets/widgets/qdial.cpp | 2 ++ src/widgets/widgets/qdockwidget.cpp | 1 + src/widgets/widgets/qfocusframe.cpp | 2 ++ src/widgets/widgets/qframe.cpp | 2 ++ src/widgets/widgets/qkeysequenceedit.cpp | 2 ++ src/widgets/widgets/qlcdnumber.cpp | 2 ++ src/widgets/widgets/qlineedit_p.cpp | 2 ++ src/widgets/widgets/qmainwindow.cpp | 2 ++ src/widgets/widgets/qmainwindowlayout.cpp | 2 ++ src/widgets/widgets/qprogressbar.cpp | 2 ++ src/widgets/widgets/qradiobutton.cpp | 2 ++ src/widgets/widgets/qrubberband.cpp | 2 ++ src/widgets/widgets/qscrollarea.cpp | 2 ++ src/widgets/widgets/qscrollbar.cpp | 2 ++ src/widgets/widgets/qslider.cpp | 2 ++ src/widgets/widgets/qspinbox.cpp | 2 ++ src/widgets/widgets/qsplashscreen.cpp | 2 ++ src/widgets/widgets/qsplitter.cpp | 2 ++ src/widgets/widgets/qstackedwidget.cpp | 2 ++ src/widgets/widgets/qstatusbar.cpp | 2 ++ src/widgets/widgets/qtabbar.cpp | 2 +- src/widgets/widgets/qtoolbarextension.cpp | 2 ++ src/widgets/widgets/qtoolbarlayout.cpp | 2 ++ src/widgets/widgets/qtoolbarseparator.cpp | 2 ++ src/widgets/widgets/qwidgetanimator.cpp | 2 ++ src/widgets/widgets/qwidgetlinecontrol.cpp | 2 ++ src/widgets/widgets/qwidgetresizehandler.cpp | 2 ++ src/widgets/widgets/widgets.pri | 1 + 80 files changed, 151 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp index 855bae3c9f..efa344d04c 100644 --- a/src/widgets/dialogs/qerrormessage.cpp +++ b/src/widgets/dialogs/qerrormessage.cpp @@ -396,4 +396,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 92d6b8f3be..be96b4ce68 100644 --- a/src/widgets/dialogs/qfileinfogatherer.cpp +++ b/src/widgets/dialogs/qfileinfogatherer.cpp @@ -339,3 +339,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 645f418c4e..bb61135cbc 100644 --- a/src/widgets/dialogs/qsidebar.cpp +++ b/src/widgets/dialogs/qsidebar.cpp @@ -509,4 +509,6 @@ bool QSidebar::event(QEvent * event) QT_END_NAMESPACE +#include "moc_qsidebar_p.cpp" + #endif diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp index 5a97be3d96..e845a33e0b 100644 --- a/src/widgets/effects/qgraphicseffect.cpp +++ b/src/widgets/effects/qgraphicseffect.cpp @@ -1229,4 +1229,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 b21726400f..d091502b5d 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -1330,4 +1330,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 3e29d29c14..c11aa92053 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp @@ -523,4 +523,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 585539de94..ec48beec6c 100644 --- a/src/widgets/graphicsview/qgraphicsitemanimation.cpp +++ b/src/widgets/graphicsview/qgraphicsitemanimation.cpp @@ -588,4 +588,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 b0cb2fe374..32bb8d17ac 100644 --- a/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp +++ b/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp @@ -85,3 +85,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 cd651e2897..2700605a71 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -2421,4 +2421,6 @@ void QGraphicsWidget::dumpFocusChain() QT_END_NAMESPACE +#include "moc_qgraphicswidget.cpp" + #endif //QT_NO_GRAPHICSVIEW diff --git a/src/widgets/itemviews/qcolumnviewgrip.cpp b/src/widgets/itemviews/qcolumnviewgrip.cpp index a1630a14a2..7810e707e8 100644 --- a/src/widgets/itemviews/qcolumnviewgrip.cpp +++ b/src/widgets/itemviews/qcolumnviewgrip.cpp @@ -183,4 +183,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 e966c83fe7..70295d56f5 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -606,4 +606,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 18ea19c8b9..7cba60cd81 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -3291,4 +3291,6 @@ QSize QListView::viewportSizeHint() const QT_END_NAMESPACE +#include "moc_qlistview.cpp" + #endif // QT_NO_LISTVIEW diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index d4d22c8bef..eeb50c5741 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -1948,5 +1948,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 cd38f4b282..3ec6923b7f 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -2716,5 +2716,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 676893ebf0..f33dd6af17 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -3449,5 +3449,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/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp index 17eb8d98c4..7bde1e4eb2 100644 --- a/src/widgets/kernel/qboxlayout.cpp +++ b/src/widgets/kernel/qboxlayout.cpp @@ -1348,3 +1348,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 2ddd025239..d1b37bc03a 100644 --- a/src/widgets/kernel/qdesktopwidget.cpp +++ b/src/widgets/kernel/qdesktopwidget.cpp @@ -268,3 +268,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 a7f9021c42..124f6b301c 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -2108,3 +2108,5 @@ void QFormLayout::dump() const #endif QT_END_NAMESPACE + +#include "moc_qformlayout.cpp" diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp index 85898ae86c..eca865ce17 100644 --- a/src/widgets/kernel/qgridlayout.cpp +++ b/src/widgets/kernel/qgridlayout.cpp @@ -1686,3 +1686,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 e74f17b6f7..8631149f3d 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -1471,3 +1471,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 a80db3f60b..e5c5b1dbfd 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -1343,3 +1343,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 ce728e0330..2e7bc27536 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -652,3 +652,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 3c28f5ccf7..26d1733d26 100644 --- a/src/widgets/kernel/qsizepolicy.cpp +++ b/src/widgets/kernel/qsizepolicy.cpp @@ -506,3 +506,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 957b6f09b5..029c2bcec2 100644 --- a/src/widgets/kernel/qstackedlayout.cpp +++ b/src/widgets/kernel/qstackedlayout.cpp @@ -590,3 +590,5 @@ void QStackedLayout::setStackingMode(StackingMode stackingMode) } QT_END_NAMESPACE + +#include "moc_qstackedlayout.cpp" diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index bfa1d69fa8..8269bd13f6 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -1625,3 +1625,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 15c28d0913..01832a4f2b 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -997,3 +997,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 e8c4a763ee..ea73bcd2a6 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -397,3 +397,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 b83d4bf7e9..ef094172ab 100644 --- a/src/widgets/statemachine/qbasickeyeventtransition.cpp +++ b/src/widgets/statemachine/qbasickeyeventtransition.cpp @@ -197,4 +197,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 2a9b0a198c..12faf47b7f 100644 --- a/src/widgets/statemachine/qbasicmouseeventtransition.cpp +++ b/src/widgets/statemachine/qbasicmouseeventtransition.cpp @@ -202,4 +202,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 67af85dd27..5b7a60981c 100644 --- a/src/widgets/statemachine/qkeyeventtransition.cpp +++ b/src/widgets/statemachine/qkeyeventtransition.cpp @@ -168,4 +168,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 bf46e4b279..e587bfea2f 100644 --- a/src/widgets/statemachine/qmouseeventtransition.cpp +++ b/src/widgets/statemachine/qmouseeventtransition.cpp @@ -196,4 +196,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 2fc52e9a32..e4302247f5 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -3739,4 +3739,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/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index 00682c1c0f..a0fd8bf7db 100644 --- a/src/widgets/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -888,4 +888,7 @@ uint qHash(const QHashableLatin1Literal &key) QT_END_NAMESPACE +#include "moc_qgtkstyle_p.cpp" +#include "moc_qgtkstyle_p_p.cpp" + #endif // !defined(QT_NO_STYLE_GTK) diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp index 61f836b23c..2829d2db79 100644 --- a/src/widgets/styles/qproxystyle.cpp +++ b/src/widgets/styles/qproxystyle.cpp @@ -423,4 +423,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 02c420e55c..4a601ba871 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -2407,3 +2407,5 @@ void QStyle::setProxy(QStyle *style) } QT_END_NAMESPACE + +#include "moc_qstyle.cpp" diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp index 78d0297be2..922a1e5ffb 100644 --- a/src/widgets/styles/qstyleanimation.cpp +++ b/src/widgets/styles/qstyleanimation.cpp @@ -359,4 +359,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 2be37bd65a..e1b28c1491 100644 --- a/src/widgets/styles/qstyleplugin.cpp +++ b/src/widgets/styles/qstyleplugin.cpp @@ -99,3 +99,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 01b82424c8..5d02bc17ae 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -2397,4 +2397,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/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 4382abaf50..55bb51d0a3 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -1880,4 +1880,6 @@ QT_END_NAMESPACE #include "moc_qcompleter.cpp" +#include "moc_qcompleter_p.cpp" + #endif // QT_NO_COMPLETER diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp index c7e0861a0f..64009ca4b4 100644 --- a/src/widgets/util/qflickgesture.cpp +++ b/src/widgets/util/qflickgesture.cpp @@ -704,4 +704,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 38b104f9e9..92a9dd7202 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -2048,3 +2048,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 ebb29211a4..5589cda50a 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -766,3 +766,4 @@ QT_END_NAMESPACE #endif // QT_NO_SYSTEMTRAYICON #include "moc_qsystemtrayicon.cpp" +#include "moc_qsystemtrayicon_p.cpp" diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp index f4801b7470..91baec1040 100644 --- a/src/widgets/util/qundogroup.cpp +++ b/src/widgets/util/qundogroup.cpp @@ -495,4 +495,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 0272870537..5163783b0b 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -1168,4 +1168,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 cd29b46dc4..1f74ba8204 100644 --- a/src/widgets/util/qundoview.cpp +++ b/src/widgets/util/qundoview.cpp @@ -466,5 +466,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/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index a1707b9cab..fe09b0087c 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -1413,3 +1413,5 @@ void QAbstractButton::setIconSize(const QSize &size) QT_END_NAMESPACE + +#include "moc_qabstractbutton.cpp" diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index 8d8c3aa4bc..283cac80da 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -937,3 +937,5 @@ bool QAbstractSlider::event(QEvent *e) } QT_END_NAMESPACE + +#include "moc_qabstractslider.cpp" diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp index 73f0b19952..5a8dc5f3ef 100644 --- a/src/widgets/widgets/qbuttongroup.cpp +++ b/src/widgets/widgets/qbuttongroup.cpp @@ -261,3 +261,4 @@ \sa setId() */ +#include "moc_qbuttongroup.cpp" diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp index ef2405c72d..9775f46bd1 100644 --- a/src/widgets/widgets/qcheckbox.cpp +++ b/src/widgets/widgets/qcheckbox.cpp @@ -387,3 +387,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 ce30ca18c3..2abcd4d3c2 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -3429,5 +3429,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 91a4118c3c..619172d379 100644 --- a/src/widgets/widgets/qcommandlinkbutton.cpp +++ b/src/widgets/widgets/qcommandlinkbutton.cpp @@ -407,3 +407,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 7ed4564654..8ee32a2a8b 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -2686,5 +2686,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 3f081e3a83..f6a3d1d96b 100644 --- a/src/widgets/widgets/qdial.cpp +++ b/src/widgets/widgets/qdial.cpp @@ -481,4 +481,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 da6c3431ff..6e6812aa1e 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1676,5 +1676,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 bf8cb30ef7..99322821f4 100644 --- a/src/widgets/widgets/qfocusframe.cpp +++ b/src/widgets/widgets/qfocusframe.cpp @@ -333,3 +333,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 755b03a4ca..a2fdfc0c86 100644 --- a/src/widgets/widgets/qframe.cpp +++ b/src/widgets/widgets/qframe.cpp @@ -549,3 +549,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 35c7c187b7..2e418d0ea4 100644 --- a/src/widgets/widgets/qkeysequenceedit.cpp +++ b/src/widgets/widgets/qkeysequenceedit.cpp @@ -318,3 +318,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 d17e3e2470..17a6b2c941 100644 --- a/src/widgets/widgets/qlcdnumber.cpp +++ b/src/widgets/widgets/qlcdnumber.cpp @@ -1216,4 +1216,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 599ebce0ab..ff4d0fec47 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -520,4 +520,6 @@ void QLineEditPrivate::removeAction(QAction *action) QT_END_NAMESPACE +#include "moc_qlineedit_p.cpp" + #endif diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index ff4bb3cc98..1698ca1519 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 1bb8496505..8dc12d853e 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2590,4 +2590,6 @@ void QMainWindowLayout::timerEvent(QTimerEvent *e) QT_END_NAMESPACE +#include "moc_qmainwindowlayout_p.cpp" + #endif // QT_NO_MAINWINDOW diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp index 5b06e75abe..adb4d0369b 100644 --- a/src/widgets/widgets/qprogressbar.cpp +++ b/src/widgets/widgets/qprogressbar.cpp @@ -623,4 +623,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 150813da10..a71644bc2c 100644 --- a/src/widgets/widgets/qradiobutton.cpp +++ b/src/widgets/widgets/qradiobutton.cpp @@ -266,3 +266,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 3315e2703a..60082a8930 100644 --- a/src/widgets/widgets/qrubberband.cpp +++ b/src/widgets/widgets/qrubberband.cpp @@ -327,4 +327,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 90605358ee..c1b0db1d88 100644 --- a/src/widgets/widgets/qscrollarea.cpp +++ b/src/widgets/widgets/qscrollarea.cpp @@ -532,4 +532,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 46f903fa1e..8ae299cdf4 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -738,4 +738,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 dc5ec00650..7f34f8f9e0 100644 --- a/src/widgets/widgets/qslider.cpp +++ b/src/widgets/widgets/qslider.cpp @@ -553,3 +553,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 457e2e1e4c..262efc62e2 100644 --- a/src/widgets/widgets/qspinbox.cpp +++ b/src/widgets/widgets/qspinbox.cpp @@ -1322,4 +1322,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 b8c70f2f0f..9b6671ef6b 100644 --- a/src/widgets/widgets/qsplashscreen.cpp +++ b/src/widgets/widgets/qsplashscreen.cpp @@ -352,4 +352,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 c2081c15f8..20b6a029cd 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -1733,4 +1733,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 19a2edf0f2..dd9a95c556 100644 --- a/src/widgets/widgets/qstackedwidget.cpp +++ b/src/widgets/widgets/qstackedwidget.cpp @@ -287,4 +287,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 19361fc793..1adaa6e805 100644 --- a/src/widgets/widgets/qstatusbar.cpp +++ b/src/widgets/widgets/qstatusbar.cpp @@ -783,4 +783,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 7ea5455bf7..41019a1de6 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -2497,4 +2497,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 687871294a..30306542a6 100644 --- a/src/widgets/widgets/qtoolbarextension.cpp +++ b/src/widgets/widgets/qtoolbarextension.cpp @@ -81,4 +81,6 @@ QSize QToolBarExtension::sizeHint() const QT_END_NAMESPACE +#include "moc_qtoolbarextension_p.cpp" + #endif // QT_NO_TOOLBUTTON diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp index 42fd93fda2..a66bad15a7 100644 --- a/src/widgets/widgets/qtoolbarlayout.cpp +++ b/src/widgets/widgets/qtoolbarlayout.cpp @@ -742,4 +742,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 48b56dd6be..d9d0d8986a 100644 --- a/src/widgets/widgets/qtoolbarseparator.cpp +++ b/src/widgets/widgets/qtoolbarseparator.cpp @@ -80,4 +80,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 2bed11289f..a6aadddb98 100644 --- a/src/widgets/widgets/qwidgetanimator.cpp +++ b/src/widgets/widgets/qwidgetanimator.cpp @@ -114,3 +114,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 436937be72..0ff55f7c37 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1919,4 +1919,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 0fee399745..78d3a16bf3 100644 --- a/src/widgets/widgets/qwidgetresizehandler.cpp +++ b/src/widgets/widgets/qwidgetresizehandler.cpp @@ -535,4 +535,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..9a3fae09a2 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -84,6 +84,7 @@ HEADERS += \ widgets/qplaintextedit_p.h SOURCES += \ + widgets/qbuttongroup.cpp \ widgets/qabstractbutton.cpp \ widgets/qabstractslider.cpp \ widgets/qabstractspinbox.cpp \ -- cgit v1.2.3 From 69335920f724d2d4a49924f373c4fef57c942831 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 17 Mar 2016 16:24:26 +0100 Subject: Move QButtonGroup implementation from qabstractbutton.cpp to qbuttongroup.cpp Because it's the right thing to do. Needed to introduce qbuttongroup_p.h because QAbstractButton likes to poke around in QButtonGroup's private parts. Fixed includes of qabstractbutton_p.h so it compiles on it's own. Change-Id: Ic7725277d2419754de273b2abd4790476edd0eb4 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qabstractbutton.cpp | 135 +------------------------------- src/widgets/widgets/qabstractbutton_p.h | 2 + src/widgets/widgets/qbuttongroup.cpp | 128 ++++++++++++++++++++++++++---- src/widgets/widgets/qbuttongroup_p.h | 80 +++++++++++++++++++ src/widgets/widgets/widgets.pri | 1 + 5 files changed, 198 insertions(+), 148 deletions(-) create mode 100644 src/widgets/widgets/qbuttongroup_p.h (limited to 'src/widgets') diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index fe09b0087c..2a546ac0cd 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -31,7 +31,9 @@ ** ****************************************************************************/ -#include "qabstractbutton.h" +#include "private/qabstractbutton_p.h" + +#include "private/qbuttongroup_p.h" #include "qabstractitemview.h" #include "qbuttongroup.h" #include "qabstractbutton_p.h" @@ -171,137 +173,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 buttonList; - QPointer checkedButton; - void detectCheckedButton(); - void notifyChecked(QAbstractButton *button); - bool exclusive; - QHash 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::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 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 - QListQAbstractButtonPrivate::queryButtonList() const { #ifndef QT_NO_BUTTONGROUP diff --git a/src/widgets/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h index 0975012843..5a35b1b9cd 100644 --- a/src/widgets/widgets/qabstractbutton_p.h +++ b/src/widgets/widgets/qabstractbutton_p.h @@ -45,6 +45,8 @@ // We mean it. // +#include "qabstractbutton.h" + #include "QtCore/qbasictimer.h" #include "private/qwidget_p.h" diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp index 5a8dc5f3ef..e33f19297c 100644 --- a/src/widgets/widgets/qbuttongroup.cpp +++ b/src/widgets/widgets/qbuttongroup.cpp @@ -31,7 +31,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 @@ -78,18 +99,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 @@ -105,6 +132,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) @@ -187,8 +227,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, @@ -197,42 +235,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::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 QButtonGroup::buttons() const - Returns the button group's list of buttons. This may be empty. \sa addButton(), removeButton() */ +QList 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 @@ -240,9 +318,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 @@ -251,14 +334,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 + +#ifndef QT_NO_BUTTONGROUP + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QButtonGroupPrivate: public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QButtonGroup) + +public: + QButtonGroupPrivate() : exclusive(true) {} + + QList buttonList; + QPointer checkedButton; + void detectCheckedButton(); + void notifyChecked(QAbstractButton *button); + + bool exclusive; + QHash mapping; +}; + +QT_END_NAMESPACE + +#endif // QT_NO_BUTTONGROUP + +#endif // QBUTTONGROUP_P_H diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 9a3fae09a2..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 \ -- cgit v1.2.3 From a1d4e4c97efaa14d58cc2c01ceceb396ebd6d18c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 16 Mar 2016 08:39:12 +0100 Subject: QtWidgets: Change QTLWExtra::window from QWidgetWindow to QWindow. None of QWidgetWindow's API is used in the code. Task-number: QTBUG-33079 Change-Id: Iecb1e174645eff687ee0d8b29417c30a2c508311 Reviewed-by: Marc Mutz --- src/widgets/kernel/qwidget_p.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 7eb8d048b3..a5c7aa5815 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -68,7 +68,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; @@ -154,7 +153,7 @@ struct QTLWExtra { QWidgetBackingStoreTracker backingStoreTracker; QBackingStore *backingStore; QPainter *sharedPainter; - QWidgetWindow *window; + QWindow *window; QOpenGLContext *shareContext; // Implicit pointers (shared_null). -- cgit v1.2.3