Fix icon-only delegate
The delegate was still rendering display text. But we didn't realize because the only place where this delegate was used was returning a QVariant() for DisplayText role earlier. Once we started returning a valid QString (for copy-paste purposes), this bug showed up. This didn't work because we further delegate the actual painting to the base QStyledItemDelegate which re-initializes option.features from the item index values, so removing HasDisplay does not work. The fix is to override the displayText() to return a null string.
This commit is contained in:
parent
1e8486991d
commit
ebe6aef62d
@ -31,9 +31,13 @@ class IconOnlyDelegate : public QStyledItemDelegate
|
|||||||
{
|
{
|
||||||
QStyleOptionViewItem opt = option;
|
QStyleOptionViewItem opt = option;
|
||||||
opt.decorationPosition = QStyleOptionViewItem::Top;
|
opt.decorationPosition = QStyleOptionViewItem::Top;
|
||||||
opt.features &= ~QStyleOptionViewItem::HasDisplay;
|
|
||||||
QStyledItemDelegate::paint(painter, opt, index);
|
QStyledItemDelegate::paint(painter, opt, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString displayText(const QVariant&, const QLocale&) const
|
||||||
|
{
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user