ManhattanStyle: Fix themed drawing of toolbar extension

The extension image gets queried via QStyle::standardIcon() instead of
QStyle::standardPixmap(). That's why so far our extension was never
drawn with our own icon.

The icon .png needed to be resized in order not to be resampled in @2x
mode.

Change-Id: I27ae4e5872c18421e5d40271b01cb9daf8adc8bc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Alessandro Portale
2019-12-10 14:01:15 +01:00
parent 0e49f11ca3
commit 27a5d50125
4 changed files with 15 additions and 21 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 164 B

View File

@@ -122,13 +122,13 @@ public:
void init();
public:
const QPixmap extButtonPixmap;
const QIcon extButtonIcon;
const QPixmap closeButtonPixmap;
StyleAnimator animator;
};
ManhattanStylePrivate::ManhattanStylePrivate() :
extButtonPixmap(Utils::Icons::TOOLBAR_EXTENSION.pixmap()),
extButtonIcon(Utils::Icons::TOOLBAR_EXTENSION.icon()),
closeButtonPixmap(Utils::Icons::CLOSE_FOREGROUND.pixmap())
{
}
@@ -321,9 +321,6 @@ QPixmap ManhattanStyle::standardPixmap(StandardPixmap standardPixmap, const QSty
QPixmap pixmap;
switch (standardPixmap) {
case QStyle::SP_ToolBarHorizontalExtensionButton:
pixmap = d->extButtonPixmap;
break;
case QStyle::SP_TitleBarCloseButton:
pixmap = d->closeButtonPixmap;
break;
@@ -336,7 +333,16 @@ QPixmap ManhattanStyle::standardPixmap(StandardPixmap standardPixmap, const QSty
QIcon ManhattanStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
QIcon icon = QProxyStyle::standardIcon(standardIcon, option, widget);
QIcon icon;
switch (standardIcon) {
case QStyle::SP_ToolBarHorizontalExtensionButton:
icon = d->extButtonIcon;
break;
default:
icon = QProxyStyle::standardIcon(standardIcon, option, widget);
break;
}
if (standardIcon == QStyle::SP_ComputerIcon) {
// Ubuntu has in some versions a 16x16 icon, see QTCREATORBUG-12832
const QList<QSize> &sizes = icon.availableSizes();

View File

@@ -156,17 +156,6 @@
x2="160.5"
y2="588"
gradientUnits="userSpaceOnUse" />
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath4754">
<rect
style="fill:none;stroke:none"
id="rect4756"
width="9"
height="9"
x="187"
y="592" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath4845">
@@ -4191,15 +4180,14 @@
</g>
<g
id="src/libs/utils/images/extension"
style="display:inline;"
clip-path="url(#clipPath4754)"
style="display:inline"
transform="translate(-171,-20)">
<rect
id="use4527"
width="9"
height="9"
height="16"
x="187"
y="592"
y="588"
style="fill:#ffffff" />
<path
sodipodi:nodetypes="ccc"

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 384 KiB