[Qt-interest] QTableView - drawing decoration to right of text

David Boosalis david.boosalis at gmail.com
Wed Jul 29 15:59:15 CEST 2009


Hi.  For a particular column of a QTableView I want to have the icon
(decoration) to the right of the text.  I tried to do this in the Delegate's
drawDecoration() method but it did not work.  Any suggestions as to how to
do this ?

void MyDelegate::drawDecoration( QPainter * painter,
                     const QStyleOptionViewItem & option,
                     const QRect & rect,
                     const QPixmap & pixmap ) const
{
  qDebug() << "Draw decoration........";
  QStyleOptionViewItem option2 = option;
  option2.decorationPosition = QStyleOptionViewItem::Right;
  option2.decorationAlignment = Qt::AlignRight;
  QItemDelegate::drawDecoration(painter,option2,rect,pixmap); // still ends
up left of text
}

Thanks in advance for any help
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090729/85332614/attachment.html 


More information about the Qt-interest-old mailing list