1 Attachment(s)
absolutely center text alignment in qtablewidgetitem that has an icon
I have a QTableWidget which contains cells which may or may not contain QIcons in them. When I align the texts of cells with icons in them, they are centered more right than cells without icons in them.
Attachment 6190
How do I make the text in cells with icons center so that they align with the entire cell, and not the text portion of the QTableWidgetItem?
I tried:
I have read into similar threads describing the use of QItemDelegates when considering icon alignment, but does this method work for QTableWidgetItems via medelling with the Qt::DisplayRole portion of QItemDelegate or am I completely off?
Re: absolutely center text alignment in qtablewidgetitem that has an icon
Yes, you need a custom delegate. Compute the positions yourself and render the items (semi-)manually.