From 72b57a5dfa49b4d4dd3b88cca8cc97e7283dcdf0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 18 Jan 2016 18:19:21 +0100 Subject: Disintermediate QDateTimeParser::SectionNode operations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The name, format and maxChange of a Section depend only on the section, not on the details of the currently parsed text it matches; so we don't need the parser object's list of all sections to work them out. Move these methods to the SectionNode and act directly on that instead of going via the section list. Make the name take a Section enum instead of an int. Likewise, make stateName take a State enum instead of an int. Change-Id: Ie340d042ab95aec517013c4dcc30901d40305c78 Reviewed-by: Simon Hausmann Reviewed-by: Jędrzej Nowacki --- src/widgets/widgets/qdatetimeedit.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index abee788a46..7ed4564654 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -873,7 +873,7 @@ void QDateTimeEdit::setDisplayFormat(const QString &format) d->displayFormat.clear(); for (int i=d->sectionNodes.size() - 1; i>=0; --i) { d->displayFormat += d->separators.at(i + 1); - d->displayFormat += d->sectionFormat(i); + d->displayFormat += d->sectionNode(i).format(); } d->displayFormat += d->separators.at(0); d->separators = reverse(d->separators); @@ -2214,9 +2214,9 @@ void QDateTimeEditPrivate::_q_editorCursorPositionChanged(int oldpos, int newpos } } - QDTEDEBUG << "currentSectionIndex is set to" << sectionName(sectionType(s)) + QDTEDEBUG << "currentSectionIndex is set to" << sectionNode(s).name() << oldpos << newpos - << "was" << sectionName(sectionType(currentSectionIndex)); + << "was" << sectionNode(currentSectionIndex).name(); currentSectionIndex = s; Q_ASSERT_X(currentSectionIndex < sectionNodes.size(), -- cgit v1.2.3 From 00266882855233591d98b7a200afba4f216a978b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 3 Feb 2016 17:21:59 +0100 Subject: QWizard/Windows: Add missing override. Task-number: QTBUG-50804 Change-Id: Ia1c73b40d96ddea01e440e0e3e010ff3fcb88793 Reviewed-by: Giuseppe D'Angelo --- src/widgets/dialogs/qwizard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h index 9193f0b659..e0bb1459d5 100644 --- a/src/widgets/dialogs/qwizard.h +++ b/src/widgets/dialogs/qwizard.h @@ -182,7 +182,7 @@ protected: void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; #ifdef Q_OS_WIN - bool nativeEvent(const QByteArray &eventType, void * message, long * result); + bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; #endif void done(int result) Q_DECL_OVERRIDE; virtual void initializePage(int id); -- cgit v1.2.3 From 75b705fec8e9517047d7dfa98203edff69f2bf8a Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 3 Feb 2016 15:36:12 +0100 Subject: End the drag if the dockwidget is being hidden When the window flags are changed for the widget then it is possible to minimize the dockwidget via the titlebar. This will cause it to be ready to start a drag internally but since the dockwidget never gets a mouse release event it doesn't end it. Therefore it ends up being in an invalid state later on when restored, so the endDrag() needs to happen in the hide event to ensure this is not an issue later on. Change-Id: Ia84bee96b9eed49896869e6a15d4de6d01964264 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qdockwidget.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 67eb466ba8..481fcdac12 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1445,6 +1445,8 @@ bool QDockWidget::event(QEvent *event) switch (event->type()) { #ifndef QT_NO_ACTION case QEvent::Hide: + if (d->state) + d->endDrag(true); if (layout != 0) layout->keepSize(this); d->toggleViewAction->setChecked(false); -- cgit v1.2.3 From 798e0064e9be78f8320ff25a9af50d1b5e5badb1 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 5 Feb 2016 00:06:48 +0100 Subject: Fix crash introduced by 75b705fec8e9517047d7dfa98203edff69f2bf8a This fixes the crash introduced by 75b705fec8e9517047d7dfa98203edff69f2bf8a. The drag only needs to be ended on the hide if it is actually in the middle of dragging. This enables the case of dragging the dock widget out with the mouse to continue to work. Task-number: QTBUG-50890 Change-Id: I72309dd40ee670319f2ff607ae201c46f8de4652 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qdockwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 481fcdac12..da6c3431ff 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1445,7 +1445,7 @@ bool QDockWidget::event(QEvent *event) switch (event->type()) { #ifndef QT_NO_ACTION case QEvent::Hide: - if (d->state) + if (d->state && d->state->dragging) d->endDrag(true); if (layout != 0) layout->keepSize(this); -- cgit v1.2.3 From 918b8d4e9e051e9b5882b7a7ada9ec3b390fc5a9 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 3 Feb 2016 14:57:29 +0100 Subject: Doc: corrected minor link issues Task-number: QTBUG-43810 Change-Id: I98eafe0c7ed55f309640e8495c83ffcef355aa08 Reviewed-by: Martin Smith --- src/widgets/graphicsview/qgraphicswidget.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/widgets') diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 8ffb60411c..cd651e2897 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -306,6 +306,7 @@ void QGraphicsWidget::resize(const QSizeF &size) \fn void QGraphicsWidget::resize(qreal w, qreal h) \overload + Constructs a resize with the given \c width (\a w) and \c height (\a h). This convenience function is equivalent to calling resize(QSizeF(w, h)). \sa setGeometry(), setTransform() -- cgit v1.2.3 From c4a53f647f4ba7cb6898a38fd1056f81fdcfe371 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 5 Feb 2016 14:03:39 +0100 Subject: QtWidgets: Fix build & warnings with QT_NO_GRAPHICSVIEW. kernel\qapplication.cpp(3157,18) : warning: unused variable 'isGraphicsWidget' [-Wunused-variable] bool isGraphicsWidget = false; ^ kernel\qwidget.cpp(6446,18) : warning: unused variable 'window' [-Wunused-variable] if (QWidget *window = w->window()) { ^ kernel\qwidget.cpp(7949,50) : error: no member named 'proxyWidget' in 'QWExtra' if ((q->isWindow() && (!extra || !extra->proxyWidget)) ~~~~~ ^ kernel\qwidget.cpp(8084,50) : error: no member named 'proxyWidget' in 'QWExtra' if ((q->isWindow() && (!extra || !extra->proxyWidget)) Change-Id: I8474ab0ab4617c6588707ce0c2f7a97e4d0e54da Reviewed-by: Marc Mutz --- src/widgets/kernel/qapplication.cpp | 3 +-- src/widgets/kernel/qwidget.cpp | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 91302d9e62..3ab477ccfb 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3161,9 +3161,8 @@ bool QApplication::notify(QObject *receiver, QEvent *e) case QEvent::KeyRelease: { bool isWidget = receiver->isWidgetType(); - bool isGraphicsWidget = false; #ifndef QT_NO_GRAPHICSVIEW - isGraphicsWidget = !isWidget && qobject_cast(receiver); + const bool isGraphicsWidget = !isWidget && qobject_cast(receiver); #endif QKeyEvent* key = static_cast(e); bool def = key->isAccepted(); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 5bff30524a..58bda5cfb2 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -6415,13 +6415,13 @@ bool QWidget::hasFocus() const const QWidget* w = this; while (w->d_func()->extra && w->d_func()->extra->focus_proxy) w = w->d_func()->extra->focus_proxy; - if (QWidget *window = w->window()) { #ifndef QT_NO_GRAPHICSVIEW + if (QWidget *window = w->window()) { QWExtra *e = window->d_func()->extra; if (e && e->proxyWidget && e->proxyWidget->hasFocus() && window->focusWidget() == w) return true; -#endif } +#endif // !QT_NO_GRAPHICSVIEW return (QApplication::focusWidget() == w); } @@ -7918,8 +7918,11 @@ void QWidgetPrivate::show_sys() invalidateBuffer(q->rect()); q->setAttribute(Qt::WA_Mapped); // add our window the modal window list (native dialogs) - if ((q->isWindow() && (!extra || !extra->proxyWidget)) - && q->windowModality() != Qt::NonModal && window) { + if (window && q->isWindow() +#ifndef QT_NO_GRAPHICSVIEW + && (!extra || !extra->proxyWidget) +#endif + && q->windowModality() != Qt::NonModal) { QGuiApplicationPrivate::showModalWindow(window); } return; @@ -8053,8 +8056,11 @@ void QWidgetPrivate::hide_sys() if (q->testAttribute(Qt::WA_DontShowOnScreen)) { q->setAttribute(Qt::WA_Mapped, false); // remove our window from the modal window list (native dialogs) - if ((q->isWindow() && (!extra || !extra->proxyWidget)) - && q->windowModality() != Qt::NonModal && window) { + if (window && q->isWindow() +#ifndef QT_NO_GRAPHICSVIEW + && (!extra || !extra->proxyWidget) +#endif + && q->windowModality() != Qt::NonModal) { QGuiApplicationPrivate::hideModalWindow(window); } // do not return here, if window non-zero, we must hide it -- cgit v1.2.3 From 01859cc12126b7205f5b54d383a9aa88db756f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Sat, 16 Jan 2016 00:24:54 +0000 Subject: Reduce allocations by using reserve() Change-Id: If34fa53402985f6b3c5e7217bce4a1177af835b6 Reviewed-by: Marc Mutz --- src/widgets/dialogs/qsidebar.cpp | 1 + src/widgets/kernel/qwidgetbackingstore.cpp | 6 ++++-- src/widgets/widgets/qdockarealayout.cpp | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp index f883705cc3..645f418c4e 100644 --- a/src/widgets/dialogs/qsidebar.cpp +++ b/src/widgets/dialogs/qsidebar.cpp @@ -460,6 +460,7 @@ void QSidebar::removeEntry() QList idxs = selectionModel()->selectedIndexes(); QList indexes; const int numIndexes = idxs.count(); + indexes.reserve(numIndexes); for (int i = 0; i < numIndexes; i++) indexes.append(idxs.at(i)); diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index d9d1c887c1..5e6563b0be 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -1242,13 +1242,15 @@ void QWidgetBackingStore::doSync() // OpenGL content changes. Check if we have such widgets in the special // dirty list. QVarLengthArray paintPending; - for (int i = 0; i < dirtyRenderToTextureWidgets.count(); ++i) { + const int numPaintPending = dirtyRenderToTextureWidgets.count(); + paintPending.reserve(numPaintPending); + for (int i = 0; i < numPaintPending; ++i) { QWidget *w = dirtyRenderToTextureWidgets.at(i); paintPending << w; resetWidget(w); } dirtyRenderToTextureWidgets.clear(); - for (int i = 0; i < paintPending.count(); ++i) { + for (int i = 0; i < numPaintPending; ++i) { QWidget *w = paintPending[i]; w->d_func()->sendPaintEvent(w->rect()); if (w != tlw) { diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index df26db57ae..2823bd6f2f 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -3350,8 +3350,9 @@ QSet QDockAreaLayout::usedTabBars() const QSet QDockAreaLayout::usedSeparatorWidgets() const { QSet result; - - for (int i = 0; i < separatorWidgets.count(); ++i) + const int numSeparators = separatorWidgets.count(); + result.reserve(numSeparators); + for (int i = 0; i < numSeparators; ++i) result << separatorWidgets.at(i); for (int i = 0; i < QInternal::DockCount; ++i) { const QDockAreaLayoutInfo &dock = docks[i]; -- cgit v1.2.3 From 42f788ffe26d67864d569c3a3044619d49fc693a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 9 Feb 2016 13:36:17 +0100 Subject: QWindow::setMask(): Apply High DPI scaling. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move code from QWidget::setMask() and reimplement QWidget::setMask() using QWindow::setMask(). Task-number: QTBUG-50938 Change-Id: I040688d6b18df91368fa6ab6392a3b4cd80f2683 Reviewed-by: Błażej Szczygieł Reviewed-by: Paul Olav Tvete --- src/widgets/kernel/qwidget.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 58bda5cfb2..7bd4920ff1 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -12848,9 +12848,8 @@ void QWidget::setMask(const QRegion &newMask) void QWidgetPrivate::setMask_sys(const QRegion ®ion) { Q_Q(QWidget); - if (const QWindow *window = q->windowHandle()) - if (QPlatformWindow *platformWindow = window->handle()) - platformWindow->setMask(QHighDpi::toNativeLocalRegion(region, window)); + if (QWindow *window = q->windowHandle()) + window->setMask(region); } /*! -- cgit v1.2.3 From 6cb462d7aa063e5d7bcf3877fa7e7e1c4cacf3ff Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 8 Feb 2016 12:07:56 +0100 Subject: QWindowsXPStyle: Introduce utility function for QLineEdit's palette. Introduce QWindowsXPStylePrivate::isLineEditBaseColorSet() checking whether the base color has been set in the widget's palette taking into account the QSpinBox special case and simplify the code accordingly. Task-number: QTBUG-40634 Change-Id: I0e7527031b333d71727fbd30db6dd80aa715c9ab Reviewed-by: Andy Shaw --- src/widgets/styles/qwindowsvistastyle.cpp | 21 ++--------------- src/widgets/styles/qwindowsxpstyle.cpp | 38 +++++++++++++++---------------- src/widgets/styles/qwindowsxpstyle_p_p.h | 1 + 3 files changed, 21 insertions(+), 39 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 3fa0fc899d..52fc2e4af2 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -498,26 +498,9 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt case PE_PanelLineEdit: if (const QStyleOptionFrame *panel = qstyleoption_cast(option)) { - QBrush bg; - bool usePalette = false; bool isEnabled = option->state & State_Enabled; - uint resolve_mask = panel->palette.resolve(); - if (widget) { - // Since spin box includes a line edit we need to resolve the palette mask also from - // the parent, as while the color is always correct on the palette supplied by panel, - // the mask can still be empty. If either mask specifies custom base color, use that. -#ifndef QT_NO_SPINBOX - if (QAbstractSpinBox *spinbox = qobject_cast(widget->parentWidget())) - resolve_mask |= spinbox->palette().resolve(); -#endif // QT_NO_SPINBOX - } - if (resolve_mask & (1 << QPalette::Base)) { - // Base color is set for this widget, so use it - bg = panel->palette.brush(QPalette::Base); - usePalette = true; - } - if (usePalette) { - painter->fillRect(panel->rect, bg); + if (QWindowsXPStylePrivate::isLineEditBaseColorSet(option, widget)) { + painter->fillRect(panel->rect, panel->palette.brush(QPalette::Base)); } else { int partId = EP_BACKGROUND; int stateId = EBS_NORMAL; diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index c350e82c69..5b01312dfb 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -371,6 +371,22 @@ bool QWindowsXPStylePrivate::isItemViewDelegateLineEdit(const QWidget *widget) && parent2->inherits("QAbstractItemView"); } +// Returns whether base color is set for this widget +bool QWindowsXPStylePrivate::isLineEditBaseColorSet(const QStyleOption *option, const QWidget *widget) +{ + uint resolveMask = option->palette.resolve(); + if (widget) { + // Since spin box includes a line edit we need to resolve the palette mask also from + // the parent, as while the color is always correct on the palette supplied by panel, + // the mask can still be empty. If either mask specifies custom base color, use that. +#ifndef QT_NO_SPINBOX + if (const QAbstractSpinBox *spinbox = qobject_cast(widget->parentWidget())) + resolveMask |= spinbox->palette().resolve(); +#endif // QT_NO_SPINBOX + } + return (resolveMask & (1 << QPalette::Base)) != 0; +} + /*! \internal This function will always return a valid window handle, and might create a limbo widget to do so. @@ -1600,30 +1616,12 @@ case PE_Frame: themeNumber = QWindowsXPStylePrivate::EditTheme; partId = EP_EDITTEXT; noBorder = true; - QBrush bg; - bool usePalette = false; bool isEnabled = flags & State_Enabled; - uint resolve_mask = panel->palette.resolve(); - -#ifndef QT_NO_SPINBOX - // Since spin box includes a line edit we need to resolve the palette mask also from - // the parent, as while the color is always correct on the palette supplied by panel, - // the mask can still be empty. If either mask specifies custom base color, use that. - if (widget) { - if (QAbstractSpinBox *spinbox = qobject_cast(widget->parentWidget())) - resolve_mask |= spinbox->palette().resolve(); - } -#endif // QT_NO_SPINBOX - if (resolve_mask & (1 << QPalette::Base)) { - // Base color is set for this widget, so use it - bg = panel->palette.brush(QPalette::Base); - usePalette = true; - } stateId = isEnabled ? ETS_NORMAL : ETS_DISABLED; - if (usePalette) { - p->fillRect(panel->rect, bg); + if (QWindowsXPStylePrivate::isLineEditBaseColorSet(option, widget)) { + p->fillRect(panel->rect, panel->palette.brush(QPalette::Base)); } else { XPThemeData theme(0, p, themeNumber, partId, stateId, rect); if (!theme.isValid()) { diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index 5ee418f278..5a0abc1d78 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -415,6 +415,7 @@ public: static QString themeName(int theme); static inline bool hasTheme(int theme) { return theme >= 0 && theme < NThemes && m_themes[theme]; } static bool isItemViewDelegateLineEdit(const QWidget *widget); + static bool isLineEditBaseColorSet(const QStyleOption *option, const QWidget *widget); QIcon dockFloat, dockClose; -- cgit v1.2.3 From 5cf6a8a50cc9777a5d571882c59608508022630b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 8 Feb 2016 12:08:56 +0100 Subject: QWindowsVistaStyle: Suppress animation when QLineEdit's base color is set. Introduce utility function to check using QWindowsXPStylePrivate::isLineEditBaseColorSet(). Task-number: QTBUG-40634 Change-Id: Iaa6962a17217352aa59d0c54421b764ad47d3bf8 Reviewed-by: Andy Shaw --- src/widgets/styles/qwindowsvistastyle.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 52fc2e4af2..d900e4d181 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -213,6 +213,26 @@ void QWindowsVistaAnimation::paint(QPainter *painter, const QStyleOption *option painter->drawImage(option->rect, currentImage()); } +static inline bool supportsStateTransition(QStyle::PrimitiveElement element, + const QStyleOption *option, + const QWidget *widget) +{ + bool result = false; + switch (element) { + case QStyle::PE_IndicatorRadioButton: + case QStyle::PE_IndicatorCheckBox: + result = true; + break; + // QTBUG-40634, do not animate when color is set in palette for PE_PanelLineEdit. + case QStyle::PE_FrameLineEdit: + result = !QWindowsXPStylePrivate::isLineEditBaseColorSet(option, widget); + break; + default: + break; + } + return result; +} + /*! \internal @@ -243,6 +263,7 @@ void QWindowsVistaAnimation::paint(QPainter *painter, const QStyleOption *option starting image for the hover transition. */ + void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { @@ -259,11 +280,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt QRect oldRect; QRect newRect; - /* widgets that support state transitions : */ - if ( element == PE_FrameLineEdit - || element == PE_IndicatorRadioButton - || element == PE_IndicatorCheckBox) - { + if (supportsStateTransition(element, option, widget)) { // Retrieve and update the dynamic properties tracking // the previous state of the widget: QObject *styleObject = option->styleObject; -- cgit v1.2.3