Commit 790f1757 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner: Handle missing icons

In the complex model we will not always have icons.
We keep 4 pixels for indentation.

Change-Id: I07b66d3846a36a73a2dcbe4910f2da895756ef07
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent e510ede1
......@@ -107,9 +107,11 @@ NameItemDelegate::NameItemDelegate(QObject *parent, NavigatorTreeModel *treeMode
static int drawIcon(QPainter *painter, const QStyleOptionViewItem &styleOption, const QModelIndex &modelIndex)
{
QIcon icon = modelIndex.data(Qt::DecorationRole).value<QIcon>();
int pixmapSize = 16;
const int pixmapSize = icon.isNull() ? 4 : 16;
QPixmap pixmap = icon.pixmap(pixmapSize, pixmapSize);
painter->drawPixmap(styleOption.rect.x() + 1 , styleOption.rect.y() + 2, pixmap);
return pixmapSize;
......
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