Originally Posted by
jpn
Thanks jpn. I did search for this but evidently I need better search terms. I'll try harder next time.
Anyway, I implemented the QAbstractItemDelegate::paint() method in my delegate with the following code...
{
styleOption.displayAlignment = Qt::AlignCenter;
}
void TreeViewDelegate::paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
QStyleOptionViewItem styleOption = option;
styleOption.displayAlignment = Qt::AlignCenter;
QItemDelegate::paint( painter, styleOption, index );
}
To copy to clipboard, switch view to plain text mode
(TreeViewDelegate is a subclass of QItemDelegate if that makes any difference)
but it didn't work. Am I doing anything wrong that you can see?
-Mic
Bookmarks