diff options
-rw-r--r-- | src/plugins/styles/modernwindows/qwindowsvistastyle.cpp | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp b/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp index 0967ffadaa3..36333373732 100644 --- a/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp +++ b/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp @@ -4600,9 +4600,6 @@ int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *opti void QWindowsVistaStyle::polish(QWidget *widget) { QWindowsStyle::polish(widget); - if (!QWindowsVistaStylePrivate::useVista()) - return; - if (false #if QT_CONFIG(abstractbutton) || qobject_cast<QAbstractButton*>(widget) @@ -4623,35 +4620,39 @@ void QWindowsVistaStyle::polish(QWidget *widget) || qobject_cast<QAbstractSpinBox*>(widget) || qobject_cast<QSpinBox*>(widget) #endif // QT_CONFIG(spinbox) +#if QT_CONFIG(lineedit) + || qobject_cast<QLineEdit*>(widget) +#endif // QT_CONFIG(lineedit) + || qobject_cast<QGroupBox*>(widget) ) { widget->setAttribute(Qt::WA_Hover); + } else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) { + tree->viewport()->setAttribute(Qt::WA_Hover); + } else if (QListView *list = qobject_cast<QListView *> (widget)) { + list->viewport()->setAttribute(Qt::WA_Hover); } + if (!QWindowsVistaStylePrivate::useVista()) + return; + #if QT_CONFIG(rubberband) if (qobject_cast<QRubberBand*>(widget)) widget->setWindowOpacity(0.6); -#endif - -#if QT_CONFIG(lineedit) - if (qobject_cast<QLineEdit*>(widget)) - widget->setAttribute(Qt::WA_Hover); else -#endif // QT_CONFIG(lineedit) - if (qobject_cast<QGroupBox*>(widget)) - widget->setAttribute(Qt::WA_Hover); +#endif #if QT_CONFIG(commandlinkbutton) - else if (qobject_cast<QCommandLinkButton*>(widget)) { - widget->setProperty("_qt_usingVistaStyle", true); - QFont buttonFont = widget->font(); - buttonFont.setFamilies(QStringList{QLatin1String("Segoe UI")}); - widget->setFont(buttonFont); - QPalette pal = widget->palette(); - pal.setColor(QPalette::Active, QPalette::ButtonText, QColor(21, 28, 85)); - pal.setColor(QPalette::Active, QPalette::BrightText, QColor(7, 64, 229)); - widget->setPalette(pal); - } + if (qobject_cast<QCommandLinkButton*>(widget)) { + widget->setProperty("_qt_usingVistaStyle", true); + QFont buttonFont = widget->font(); + buttonFont.setFamilies(QStringList{QLatin1String("Segoe UI")}); + widget->setFont(buttonFont); + QPalette pal = widget->palette(); + pal.setColor(QPalette::Active, QPalette::ButtonText, QColor(21, 28, 85)); + pal.setColor(QPalette::Active, QPalette::BrightText, QColor(7, 64, 229)); + widget->setPalette(pal); + } else #endif // QT_CONFIG(commandlinkbutton) - else if (widget->inherits("QTipLabel")) { + if (widget->inherits("QTipLabel")) { //note that since tooltips are not reused //we do not have to care about unpolishing widget->setContentsMargins(3, 0, 4, 0); @@ -4682,12 +4683,6 @@ void QWindowsVistaStyle::polish(QWidget *widget) #endif } #endif // QT_CONFIG(inputdialog) - else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) { - tree->viewport()->setAttribute(Qt::WA_Hover); - } - else if (QListView *list = qobject_cast<QListView *> (widget)) { - list->viewport()->setAttribute(Qt::WA_Hover); - } } /*! |