How to change Qtreeview expand or collapse icon position
Unsolved
General and Desktop
-
@abdullahzubair109
ok, but what was wrong ? it didnt move text ? -
@abdullahzubair109
well the style+delegate works fine but selection starts at text.
If you really want seletion to start at icon, you have to dig into
drawControl and implement the part you want.
you can use
https://code.woboq.org/qt5/qtbase/src/widgets/styles/qcommonstyle.cpp.html
to easy dig around source. -
@abdullahzubair109
well you call both
painter->drawText( pt, qs); and
QStyledItemDelegate::paint
so maybe it just overrode your text. -
@abdullahzubair109
hi
using else it does move text for me. ( to the center )if (index.column() == 0) { QString qs = index.data().toString(); QPoint pt = option.rect.center(); pt += QPoint(0, 0); painter->drawText( pt, qs); } else QStyledItemDelegate::paint(painter, option, index);
but it kills the selection drawing.