Commit 661c68ff authored by Robert Loehning's avatar Robert Loehning Committed by Daniel Teske

Target Selector: Fall back to built-in Desktop icon

If the style doesn't offer any icons that have at least 32 pixels

Change-Id: I840d73a0b4bdee695bb68df1c3973ee419db012e
Task-number: QTCREATORBUG-12832
Reviewed-by: default avatarRobert Loehning <robert.loehning@theqtcompany.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent a19f9f68
......@@ -112,5 +112,6 @@
<file>images/info@2x.png</file>
<file>images/dark_fileicon.png</file>
<file>images/dark_foldericon.png</file>
<file>images/Desktop.png</file>
</qresource>
</RCC>
......@@ -34,6 +34,7 @@
#include <coreplugin/coreconstants.h>
#include <utils/algorithm.h>
#include <utils/hostosinfo.h>
#include <utils/stylehelper.h>
......@@ -336,6 +337,19 @@ QPixmap ManhattanStyle::standardPixmap(StandardPixmap standardPixmap, const QSty
return pixmap;
}
QIcon ManhattanStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
QIcon icon = QProxyStyle::standardIcon(standardIcon, option, widget);
if (standardIcon == QStyle::SP_ComputerIcon) {
// Ubuntu has in some versions a 16x16 icon, see QTCREATORBUG-12832
const QList<QSize> &sizes = icon.availableSizes();
if (Utils::allOf(sizes, [](const QSize &size) { return size.width() < 32;})) {
icon = QIcon(QLatin1String(":/core/images/Desktop.png"));
}
}
return icon;
}
int ManhattanStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget,
QStyleHintReturn *returnData) const
{
......
......@@ -56,6 +56,7 @@ public:
SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = 0) const;
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0, const QWidget *widget = 0) const;
int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const;
QRect itemRect(QPainter *p, const QRect &r, int flags, bool enabled, const QPixmap *pixmap, const QString &text, int len = -1) const;
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment