diff options
Diffstat (limited to 'src/widgets/styles/qwindowsstyle.cpp')
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 611de6991f..7b5da9bfa8 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -86,7 +86,9 @@ #include <private/qhighdpiscaling_p.h> #include <private/qstylehelper_p.h> +#if QT_CONFIG(animation) #include <private/qstyleanimation_p.h> +#endif #include <algorithm> @@ -246,7 +248,7 @@ void QWindowsStyle::polish(QApplication *app) d->activeGradientCaptionColor = app->palette().highlight() .color(); d->inactiveCaptionColor = app->palette().dark().color(); d->inactiveGradientCaptionColor = app->palette().dark().color(); - d->inactiveCaptionText = app->palette().background().color(); + d->inactiveCaptionText = app->palette().window().color(); #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //fetch native title bar colors if(app->desktopSettingsAware()){ @@ -552,7 +554,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid case SH_MenuBar_MouseTracking: case SH_Menu_MouseTracking: case SH_ComboBox_ListMouseTracking: - case SH_ScrollBar_StopMouseOverSlider: + case SH_Slider_StopMouseOverSlider: case SH_MainWindow_SpaceBelowMenuBar: ret = 1; @@ -800,8 +802,10 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPen oldPen = p->pen(); p->setPen(QPen(opt->palette.shadow().color(), 0)); QRectF rect = opt->rect; - rect.adjust(QStyleHelper::dpiScaled(0.5), QStyleHelper::dpiScaled(0.5), - QStyleHelper::dpiScaled(-1.5), QStyleHelper::dpiScaled(-1.5)); + const qreal topLevelAdjustment = QStyleHelper::dpiScaled(0.5); + const qreal bottomRightAdjustment = QStyleHelper::dpiScaled(-1.5); + rect.adjust(topLevelAdjustment, topLevelAdjustment, + bottomRightAdjustment, bottomRightAdjustment); p->drawRect(rect); p->setPen(oldPen); break; @@ -815,7 +819,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, else if (opt->state & State_Enabled) fill = opt->palette.base(); else - fill = opt->palette.background(); + fill = opt->palette.window(); p->save(); doRestore = true; qDrawWinPanel(p, opt->rect, opt->palette, true, &fill); @@ -825,13 +829,13 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, p->setPen(opt->palette.text().color()); } Q_FALLTHROUGH(); - case PE_IndicatorViewItemCheck: + case PE_IndicatorItemViewItemCheck: if (!doRestore) { p->save(); doRestore = true; } #if QT_CONFIG(itemviews) - if (pe == PE_IndicatorViewItemCheck) { + if (pe == PE_IndicatorItemViewItemCheck) { const QStyleOptionViewItem *itemViewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt); p->setPen(itemViewOpt && itemViewOpt->showDecorationSelected @@ -949,14 +953,14 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, if (frame->lineWidth == 2 || pe == PE_Frame) { QPalette popupPal = frame->palette; if (pe == PE_FrameMenu) { - popupPal.setColor(QPalette::Light, frame->palette.background().color()); + popupPal.setColor(QPalette::Light, frame->palette.window().color()); popupPal.setColor(QPalette::Midlight, frame->palette.light().color()); } if (pe == PE_Frame && (frame->state & State_Raised)) qDrawWinButton(p, frame->rect, popupPal, frame->state & State_Sunken); else if (pe == PE_Frame && (frame->state & State_Sunken)) { - popupPal.setColor(QPalette::Midlight, frame->palette.background().color()); + popupPal.setColor(QPalette::Midlight, frame->palette.window().color()); qDrawWinPanel(p, frame->rect, popupPal, frame->state & State_Sunken); } else @@ -966,7 +970,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, } } else { QPalette popupPal = opt->palette; - popupPal.setColor(QPalette::Light, opt->palette.background().color()); + popupPal.setColor(QPalette::Light, opt->palette.window().color()); popupPal.setColor(QPalette::Midlight, opt->palette.light().color()); qDrawWinPanel(p, opt->rect, popupPal, opt->state & State_Sunken); } @@ -994,7 +998,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, break; } case PE_FrameWindow: { QPalette popupPal = opt->palette; - popupPal.setColor(QPalette::Light, opt->palette.background().color()); + popupPal.setColor(QPalette::Light, opt->palette.window().color()); popupPal.setColor(QPalette::Midlight, opt->palette.light().color()); qDrawWinPanel(p, opt->rect, popupPal, opt->state & State_Sunken); break; } @@ -1313,12 +1317,12 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai x2 -= onlyOne || lastTab ? borderThinkness : 0; } - p->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 2), tab->palette.background()); + p->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 2), tab->palette.window()); // Delete border if (selected) { - p->fillRect(QRect(x1,y2-1,x2-x1,1), tab->palette.background()); - p->fillRect(QRect(x1,y2,x2-x1,1), tab->palette.background()); + p->fillRect(QRect(x1,y2-1,x2-x1,1), tab->palette.window()); + p->fillRect(QRect(x1,y2,x2-x1,1), tab->palette.window()); } // Left if (firstTab || selected || onlyOne || !previousSelected) { @@ -1349,12 +1353,12 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai x2 -= lastTab ? borderThinkness : 0; } - p->fillRect(QRect(x1 + 1, y1 + 2, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background()); + p->fillRect(QRect(x1 + 1, y1 + 2, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.window()); // Delete border if (selected) { - p->fillRect(QRect(x1, y1 + 1, (x2 - 1)-x1, 1), tab->palette.background()); - p->fillRect(QRect(x1, y1, (x2 - 1)-x1, 1), tab->palette.background()); + p->fillRect(QRect(x1, y1 + 1, (x2 - 1)-x1, 1), tab->palette.window()); + p->fillRect(QRect(x1, y1, (x2 - 1)-x1, 1), tab->palette.window()); } // Left if (firstTab || selected || onlyOne || !previousSelected) { @@ -1387,12 +1391,12 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai y2 -= lastTab ? borderThinkness : 0; } - p->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 2, (y2 - y1) - 1), tab->palette.background()); + p->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 2, (y2 - y1) - 1), tab->palette.window()); // Delete border if (selected) { - p->fillRect(QRect(x2 - 1, y1, 1, y2-y1), tab->palette.background()); - p->fillRect(QRect(x2, y1, 1, y2-y1), tab->palette.background()); + p->fillRect(QRect(x2 - 1, y1, 1, y2-y1), tab->palette.window()); + p->fillRect(QRect(x2, y1, 1, y2-y1), tab->palette.window()); } // Top if (firstTab || selected || onlyOne || !previousSelected) { @@ -1425,12 +1429,12 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai y2 -= lastTab ? borderThinkness : 0; } - p->fillRect(QRect(x1 + 2, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background()); + p->fillRect(QRect(x1 + 2, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.window()); // Delete border if (selected) { - p->fillRect(QRect(x1 + 1, y1, 1, (y2 - 1)-y1),tab->palette.background()); - p->fillRect(QRect(x1, y1, 1, (y2-1)-y1), tab->palette.background()); + p->fillRect(QRect(x1 + 1, y1, 1, (y2 - 1)-y1),tab->palette.window()); + p->fillRect(QRect(x1, y1, 1, (y2-1)-y1), tab->palette.window()); } // Top if (firstTab || selected || onlyOne || !previousSelected) { @@ -1524,7 +1528,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai br = QBrush(paletteBrush.textureImage()); } else br = QBrush(opt->palette.light().color(), Qt::Dense4Pattern); - p->setBackground(opt->palette.background().color()); + p->setBackground(opt->palette.window().color()); p->setBrush(br); } p->drawRect(opt->rect); @@ -1691,7 +1695,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai } QPalette pal2 = pb->palette; // Correct the highlight color if it is the same as the background - if (pal2.highlight() == pal2.background()) + if (pal2.highlight() == pal2.window()) pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active, QPalette::Highlight)); bool reverse = ((!vertical && (pb->direction == Qt::RightToLeft)) || vertical); @@ -1823,7 +1827,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai titleRect.height(), titleRect.width()); } proxy()->drawItemText(p, titleRect, - Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette, + Qt::AlignLeft | Qt::AlignVCenter, palette, dwOpt->state & State_Enabled, dwOpt->title, floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText); p->setFont(oldFont); @@ -1841,7 +1845,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->setBackground(cb->palette.highlight()); } else { p->setPen(cb->palette.text().color()); - p->setBackground(cb->palette.background()); + p->setBackground(cb->palette.window()); } } QCommonStyle::drawControl(ce, opt, p, widget); @@ -2183,7 +2187,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp } else { p->setPen(cmb->palette.text().color()); - p->setBackground(cmb->palette.background()); + p->setBackground(cmb->palette.window()); } if (cmb->state & State_HasFocus && !cmb->editable) { |