QWindowsVistaStyle: Fix build with no dockwidget & commandlinkbutton features

Change-Id: I0f7465cbe80e305680df37b2bf5e2f50874e6fe3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Nodir Temirkhodjaev 2019-12-19 17:24:24 +05:00
parent f1e5c5575c
commit 9a112bebe5
2 changed files with 10 additions and 1 deletions

View File

@ -1365,6 +1365,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
QWindowsStyle::drawControl(element, &copyOpt, painter, widget); QWindowsStyle::drawControl(element, &copyOpt, painter, widget);
} }
break; break;
#if QT_CONFIG(dockwidget)
case CE_DockWidgetTitle: case CE_DockWidgetTitle:
if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) { if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
const QDockWidget *dockWidget = qobject_cast<const QDockWidget *>(widget); const QDockWidget *dockWidget = qobject_cast<const QDockWidget *>(widget);
@ -1431,6 +1432,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
} }
} }
break; break;
#endif // QT_CONFIG(dockwidget)
#if QT_CONFIG(itemviews) #if QT_CONFIG(itemviews)
case CE_ItemViewItem: case CE_ItemViewItem:
{ {
@ -2311,11 +2313,13 @@ void QWindowsVistaStyle::polish(QWidget *widget)
#endif // QT_CONFIG(lineedit) #endif // QT_CONFIG(lineedit)
if (qobject_cast<QGroupBox*>(widget)) if (qobject_cast<QGroupBox*>(widget))
widget->setAttribute(Qt::WA_Hover); widget->setAttribute(Qt::WA_Hover);
#if QT_CONFIG(commandlinkbutton)
else if (qobject_cast<QCommandLinkButton*>(widget)) { else if (qobject_cast<QCommandLinkButton*>(widget)) {
QFont buttonFont = widget->font(); QFont buttonFont = widget->font();
buttonFont.setFamily(QLatin1String("Segoe UI")); buttonFont.setFamily(QLatin1String("Segoe UI"));
widget->setFont(buttonFont); widget->setFont(buttonFont);
} }
#endif // QT_CONFIG(commandlinkbutton)
else if (widget->inherits("QTipLabel")){ else if (widget->inherits("QTipLabel")){
//note that since tooltips are not reused //note that since tooltips are not reused
//we do not have to care about unpolishing //we do not have to care about unpolishing
@ -2392,12 +2396,15 @@ void QWindowsVistaStyle::unpolish(QWidget *widget)
#endif // QT_CONFIG(inputdialog) #endif // QT_CONFIG(inputdialog)
else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) { else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) {
tree->viewport()->setAttribute(Qt::WA_Hover, false); tree->viewport()->setAttribute(Qt::WA_Hover, false);
} else if (qobject_cast<QCommandLinkButton*>(widget)) { }
#if QT_CONFIG(commandlinkbutton)
else if (qobject_cast<QCommandLinkButton*>(widget)) {
QFont font = QApplication::font("QCommandLinkButton"); QFont font = QApplication::font("QCommandLinkButton");
QFont widgetFont = widget->font(); QFont widgetFont = widget->font();
widgetFont.setFamily(font.family()); //Only family set by polish widgetFont.setFamily(font.family()); //Only family set by polish
widget->setFont(widgetFont); widget->setFont(widgetFont);
} }
#endif // QT_CONFIG(commandlinkbutton)
} }

View File

@ -106,7 +106,9 @@
#include <qtableview.h> #include <qtableview.h>
#endif #endif
#include <qdatetime.h> #include <qdatetime.h>
#if QT_CONFIG(commandlinkbutton)
#include <qcommandlinkbutton.h> #include <qcommandlinkbutton.h>
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE