itemdelegate ignores stylesheet
-
Hi,
I want to give the tablewidget items a nice padding.
But as soon as i use QTableWidget::setItemDelegate the following stylesheet won't apply anymore:QTableView::item { border-left: 4px solid white; border-right: 4px solid white; }
Why could this be happening?
-
@Megamouse said in itemdelegate ignores stylesheet:
But as soon as i use QTableWidget::setItemDelegate
what type of item delegate?
-
I use a subclass of QItemDelegate with a drawFocus override that I use to prevent the ugly dotted selection rectangles around the items.
But even if I simply use a default QItemDelegate it won't apply the style.So I'm looking for either a way to apply those styles to the items WITH the delegate applied,
or
for a way to remove the selection rectangles without using a delegate. -
@Megamouse said in itemdelegate ignores stylesheet:
I use a subclass of QItemDelegate
k, then you need to subclass
QStyledItemDelegate
instead.
For obvious reasons ;) -
@Megamouse
either in the initStyleOption() or in the paint() method do:option->state &= ~QStyle::State_HasFocus
and draw the desired focus rect yourself
-
@raven-worx worked like a charm. Thank you.
Only the selection-background-color seems to be useless in the TableWidget stylesheet, so I simply styled QTableView::item:selected instead.
The selection-color works though