Skip to content
This repository was archived by the owner on Apr 14, 2024. It is now read-only.

Commit ebe6aef

Browse files
committed
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.
1 parent 1e84869 commit ebe6aef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

client/icononlydelegate.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ class IconOnlyDelegate : public QStyledItemDelegate
3131
{
3232
QStyleOptionViewItem opt = option;
3333
opt.decorationPosition = QStyleOptionViewItem::Top;
34-
opt.features &= ~QStyleOptionViewItem::HasDisplay;
3534
QStyledItemDelegate::paint(painter, opt, index);
3635
}
36+
37+
QString displayText(const QVariant&, const QLocale&) const
38+
{
39+
return QString();
40+
}
3741
};
3842

3943
#endif

0 commit comments

Comments
 (0)