qt - Hidden sort indicator on column in QTreeView -
qt - Hidden sort indicator on column in QTreeView -
i have qtreeview , setsortenable = true it, , of column show sort indicator, want lastly column not show sort indicator, lastly column.
have thought or solution issue..:(
please help thanks
qheaderview draws sorting indicator on column when info sorted column (if setsortindicatorshown true).
that why way prohibit drawing of indicator prohibit sorting of column left-click.
to prohibit sorting column need: 1. create new class inherited qheaderview (or utilize event filter) 2. reimplement mousereleaseevent , mousepressevent 3. utilize logicalindexat indicate user clicked on column 4. phone call setsectionsclickable(false) before calling base of operations method , setsectionsclickable(true) after it.
example:
void headerview::mousereleaseevent(qmouseevent* e) { const int index = logicalindexat(e->pos()); if (index == 3) setsectionsclickable(false); qheaderview::mousereleaseevent(e); setsectionsclickable(true); } do same mousepressevent.
thus prohibit sorting of column
qt
Comments
Post a Comment