So far the only solution I have found is to subclass QItemDelegate and implement my alignment rule in the paint() function. Is it really the simplest way?
I am using the C++ API.
So far the only solution I have found is to subclass QItemDelegate and implement my alignment rule in the paint() function. Is it really the simplest way?
I am using the C++ API.
Following works for me:
http://doc.qt.io/qt-5/qstandarditem.html#setTextAlignment
where:
Credit goes to this comment: How to set text alignment on a column of QTableView programmatically?
The alternative to subclussing
QItemDelegate
is to subclass your model and overridedata()
method.