QTabBar/Windows: Fix close button icons being too small on high-res screens

Add 32x32 versions. Move the icon creation to a helper function.

Fixes: QTBUG-88230
Pick-to: 6.0
Pick-to: 5.15
Change-Id: I6dda2084e0122234eacea17ac191a19f6855f466
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Friedemann Kleint 2021-01-13 10:34:37 +01:00
parent dafd26acbe
commit f3251bcb87
6 changed files with 32 additions and 11 deletions

View File

@ -172,8 +172,11 @@ set(qstyle_resource_files
"images/standardbutton-close-128.png"
"images/standardbutton-close-16.png"
"images/standardbutton-close-32.png"
"images/standardbutton-closetab-32.png"
"images/standardbutton-closetab-16.png"
"images/standardbutton-closetab-down-32.png"
"images/standardbutton-closetab-down-16.png"
"images/standardbutton-closetab-hover-32.png"
"images/standardbutton-closetab-hover-16.png"
"images/standardbutton-delete-128.png"
"images/standardbutton-delete-16.png"

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

View File

@ -126,6 +126,30 @@ static qreal qt_getDevicePixelRatio(const QWidget *widget)
return widget ? widget->devicePixelRatio() : qApp->devicePixelRatio();
}
static QIcon tabBarCloseButtonIcon()
{
QIcon result;
result.addPixmap(QPixmap(
QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-16.png")),
QIcon::Normal, QIcon::Off);
result.addPixmap(QPixmap(
QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-32.png")),
QIcon::Normal, QIcon::Off);
result.addPixmap(QPixmap(
QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-down-16.png")),
QIcon::Normal, QIcon::On);
result.addPixmap(QPixmap(
QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-down-32.png")),
QIcon::Normal, QIcon::On);
result.addPixmap(QPixmap(
QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-hover-16.png")),
QIcon::Active, QIcon::Off);
result.addPixmap(QPixmap(
QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-hover-32.png")),
QIcon::Active, QIcon::Off);
return result;
}
/*!
\class QCommonStyle
\brief The QCommonStyle class encapsulates the common Look and Feel of a GUI.
@ -416,17 +440,8 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
}
break;
case PE_IndicatorTabClose: {
if (d->tabBarcloseButtonIcon.isNull()) {
d->tabBarcloseButtonIcon.addPixmap(QPixmap(
QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-16.png")),
QIcon::Normal, QIcon::Off);
d->tabBarcloseButtonIcon.addPixmap(QPixmap(
QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-down-16.png")),
QIcon::Normal, QIcon::On);
d->tabBarcloseButtonIcon.addPixmap(QPixmap(
QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-hover-16.png")),
QIcon::Active, QIcon::Off);
}
if (d->tabBarcloseButtonIcon.isNull())
d->tabBarcloseButtonIcon = tabBarCloseButtonIcon();
const int size = proxy()->pixelMetric(QStyle::PM_SmallIconSize, opt);
QIcon::Mode mode = opt->state & State_Enabled ?

View File

@ -104,8 +104,11 @@
<file>images/standardbutton-yes-128.png</file>
<file>images/standardbutton-yes-16.png</file>
<file>images/standardbutton-yes-32.png</file>
<file>images/standardbutton-closetab-32.png</file>
<file>images/standardbutton-closetab-16.png</file>
<file>images/standardbutton-closetab-down-32.png</file>
<file>images/standardbutton-closetab-down-16.png</file>
<file>images/standardbutton-closetab-hover-32.png</file>
<file>images/standardbutton-closetab-hover-16.png</file>
<file>images/refresh-24.png</file>
<file>images/refresh-32.png</file>