Unsolved How to left align or right align data in Qtreeview
-
How to left align or right align data in QTreeview
A B C D data1 data2 data3 dat4 data2 data22 data33 dat44
currently, it is coming as juggled
-
Hi,
From the top of my head: return the desired
Qt::Alignment
for theQt::TextAlignmentRole
in your custom model. -
A small example will help
-
Hi
he did make a small example :)https://forum.qt.io/topic/11625/solved-text-alignment-in-qtableview-cell/10
QVariant data(const QModelIndex &index, int role) { if (role == Qt::TextAlignmentRole) { return Qt::AlignRight; }
-
@mrjj
It is not working -
It's not a problem of the view, it's either the model or the delegate.
What model are you using? -
QAbstractitem model
-
@mrjj said in How to left align or right align data in Qtreeview:
he did make a small example
I want to upvote your post a million times!
-
@Qt-Enthusiast said in How to left align or right align data in Qtreeview:
QAbstractitem model