WindowsVistaStyle: misc cleanup of QWindowsVistaStyle::standardIcon()
Clean up QWindowsVistaStyle::standardIcon a little bit by using separate icons for SP_TitleBarMaxButton and SP_TitleBarNormalButton Change-Id: I876d41f0373268a0a8888f00392a8e32d0f413a1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit aed4307a1f3e0bea9aac6013e3ba6ef32a47a989) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
e4e88d9137
commit
51b75d520f
@ -4901,7 +4901,7 @@ QIcon QWindowsVistaStyle::standardIcon(StandardPixmap standardIcon,
|
||||
switch (standardIcon) {
|
||||
case SP_TitleBarMaxButton:
|
||||
if (qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
|
||||
if (d->dockFloat.isNull()) {
|
||||
if (d->m_titleBarMaxIcon.isNull()) {
|
||||
QWindowsThemeData themeSize(nullptr, nullptr, QWindowsVistaStylePrivate::WindowTheme,
|
||||
WP_SMALLCLOSEBUTTON, CBS_NORMAL);
|
||||
QWindowsThemeData theme(nullptr, nullptr, QWindowsVistaStylePrivate::WindowTheme,
|
||||
@ -4914,29 +4914,29 @@ QIcon QWindowsVistaStyle::standardIcon(StandardPixmap standardIcon,
|
||||
theme.painter = &p;
|
||||
theme.rect = QRect(QPoint(0, 0), size);
|
||||
d->drawBackground(theme);
|
||||
d->dockFloat.addPixmap(pm, QIcon::Normal, QIcon::Off); // Normal
|
||||
d->m_titleBarMaxIcon.addPixmap(pm, QIcon::Normal, QIcon::Off); // Normal
|
||||
pm.fill(Qt::transparent);
|
||||
theme.stateId = MAXBS_PUSHED;
|
||||
d->drawBackground(theme);
|
||||
d->dockFloat.addPixmap(pm, QIcon::Normal, QIcon::On); // Pressed
|
||||
d->m_titleBarMaxIcon.addPixmap(pm, QIcon::Normal, QIcon::On); // Pressed
|
||||
pm.fill(Qt::transparent);
|
||||
theme.stateId = MAXBS_HOT;
|
||||
d->drawBackground(theme);
|
||||
d->dockFloat.addPixmap(pm, QIcon::Active, QIcon::Off); // Hover
|
||||
d->m_titleBarMaxIcon.addPixmap(pm, QIcon::Active, QIcon::Off); // Hover
|
||||
pm.fill(Qt::transparent);
|
||||
theme.stateId = MAXBS_INACTIVE;
|
||||
d->drawBackground(theme);
|
||||
d->dockFloat.addPixmap(pm, QIcon::Disabled, QIcon::Off); // Disabled
|
||||
d->m_titleBarMaxIcon.addPixmap(pm, QIcon::Disabled, QIcon::Off); // Disabled
|
||||
}
|
||||
}
|
||||
if (widget && widget->isWindow())
|
||||
return d->dockFloat;
|
||||
return d->m_titleBarMaxIcon;
|
||||
}
|
||||
break;
|
||||
|
||||
case SP_TitleBarCloseButton:
|
||||
if (qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
|
||||
if (d->dockClose.isNull()) {
|
||||
if (d->m_titleBarCloseIcon.isNull()) {
|
||||
QWindowsThemeData theme(nullptr, nullptr, QWindowsVistaStylePrivate::WindowTheme,
|
||||
WP_SMALLCLOSEBUTTON, CBS_NORMAL);
|
||||
if (theme.isValid()) {
|
||||
@ -4948,29 +4948,29 @@ QIcon QWindowsVistaStyle::standardIcon(StandardPixmap standardIcon,
|
||||
theme.partId = WP_CLOSEBUTTON; // ####
|
||||
theme.rect = QRect(QPoint(0, 0), size);
|
||||
d->drawBackground(theme);
|
||||
d->dockClose.addPixmap(pm, QIcon::Normal, QIcon::Off); // Normal
|
||||
d->m_titleBarCloseIcon.addPixmap(pm, QIcon::Normal, QIcon::Off); // Normal
|
||||
pm.fill(Qt::transparent);
|
||||
theme.stateId = CBS_PUSHED;
|
||||
d->drawBackground(theme);
|
||||
d->dockClose.addPixmap(pm, QIcon::Normal, QIcon::On); // Pressed
|
||||
d->m_titleBarCloseIcon.addPixmap(pm, QIcon::Normal, QIcon::On); // Pressed
|
||||
pm.fill(Qt::transparent);
|
||||
theme.stateId = CBS_HOT;
|
||||
d->drawBackground(theme);
|
||||
d->dockClose.addPixmap(pm, QIcon::Active, QIcon::Off); // Hover
|
||||
d->m_titleBarCloseIcon.addPixmap(pm, QIcon::Active, QIcon::Off); // Hover
|
||||
pm.fill(Qt::transparent);
|
||||
theme.stateId = CBS_INACTIVE;
|
||||
d->drawBackground(theme);
|
||||
d->dockClose.addPixmap(pm, QIcon::Disabled, QIcon::Off); // Disabled
|
||||
d->m_titleBarCloseIcon.addPixmap(pm, QIcon::Disabled, QIcon::Off); // Disabled
|
||||
}
|
||||
}
|
||||
if (widget && widget->isWindow())
|
||||
return d->dockClose;
|
||||
return d->m_titleBarCloseIcon;
|
||||
}
|
||||
break;
|
||||
|
||||
case SP_TitleBarNormalButton:
|
||||
if (qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
|
||||
if (d->dockFloat.isNull()) {
|
||||
if (d->m_titleBarNormalIcon.isNull()) {
|
||||
QWindowsThemeData themeSize(nullptr, nullptr, QWindowsVistaStylePrivate::WindowTheme,
|
||||
WP_SMALLCLOSEBUTTON, CBS_NORMAL);
|
||||
QWindowsThemeData theme(nullptr, nullptr, QWindowsVistaStylePrivate::WindowTheme,
|
||||
@ -4983,23 +4983,23 @@ QIcon QWindowsVistaStyle::standardIcon(StandardPixmap standardIcon,
|
||||
theme.painter = &p;
|
||||
theme.rect = QRect(QPoint(0, 0), size);
|
||||
d->drawBackground(theme);
|
||||
d->dockFloat.addPixmap(pm, QIcon::Normal, QIcon::Off); // Normal
|
||||
d->m_titleBarNormalIcon.addPixmap(pm, QIcon::Normal, QIcon::Off); // Normal
|
||||
pm.fill(Qt::transparent);
|
||||
theme.stateId = RBS_PUSHED;
|
||||
d->drawBackground(theme);
|
||||
d->dockFloat.addPixmap(pm, QIcon::Normal, QIcon::On); // Pressed
|
||||
d->m_titleBarNormalIcon.addPixmap(pm, QIcon::Normal, QIcon::On); // Pressed
|
||||
pm.fill(Qt::transparent);
|
||||
theme.stateId = RBS_HOT;
|
||||
d->drawBackground(theme);
|
||||
d->dockFloat.addPixmap(pm, QIcon::Active, QIcon::Off); // Hover
|
||||
d->m_titleBarNormalIcon.addPixmap(pm, QIcon::Active, QIcon::Off); // Hover
|
||||
pm.fill(Qt::transparent);
|
||||
theme.stateId = RBS_INACTIVE;
|
||||
d->drawBackground(theme);
|
||||
d->dockFloat.addPixmap(pm, QIcon::Disabled, QIcon::Off); // Disabled
|
||||
d->m_titleBarNormalIcon.addPixmap(pm, QIcon::Disabled, QIcon::Off); // Disabled
|
||||
}
|
||||
}
|
||||
if (widget && widget->isWindow())
|
||||
return d->dockFloat;
|
||||
return d->m_titleBarNormalIcon;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -148,11 +148,15 @@ public:
|
||||
QRgb groupBoxTextColorDisabled = 0;
|
||||
QRgb sliderTickColor = 0;
|
||||
bool hasInitColors = false;
|
||||
QIcon dockFloat, dockClose;
|
||||
|
||||
QTime animationTime() const;
|
||||
bool transitionsEnabled() const;
|
||||
|
||||
protected:
|
||||
QIcon m_titleBarMaxIcon;
|
||||
QIcon m_titleBarCloseIcon;
|
||||
QIcon m_titleBarNormalIcon;
|
||||
|
||||
private:
|
||||
static bool initVistaTreeViewTheming(const QScreen *screen);
|
||||
static void cleanupVistaTreeViewTheming();
|
||||
|
Loading…
x
Reference in New Issue
Block a user