Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-13177

QStyleOptionViewItem.decorationAlignment in does not work for icons

XMLWordPrintable

      Setting decorationAlignment to center on QStyleOptionViewItem in item delegate does not work for an icon (it's still aligned left)
      Does not matter if text is shown or not.

      Example is below. All other properties (e.g. decorationPosition, decorationSize work properly)

      class LabelEditDelegate : public QStyledItemDelegate
      ...

      void LabelEditDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
      {
      QStyleOptionViewItem option2(option);
      option2.decorationAlignment = Qt::AlignHCenter | Qt::AlignVCenter;
      QStyledItemDelegate::paint(painter, option2, index);
      }

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            arysin Andriy Rysin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes