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

View File

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

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 384 KiB