[Qt] Problems with OwnerDraw ListWidget and friends

Den Jean Den.Jean at telenet.be
Fri Jul 27 22:09:11 CEST 2007


On Friday 27 July 2007 10:37:45 Paul Ishenin wrote:
> We need something about the same. We need to subclass QItemDelegate and
> provide 2 our own event. Measure event will be passed on
> QItemDelegate.sizeHint call and paint event on paint.

for Zeljko too: 

i just read this in
src/gui/itemviews/qitemdelegate.h.
The HMargin may be of interest. 


/*!
    Returns the size needed by the delegate to display the item
    specified by \a index, taking into account the style information
    provided by \a option.

    When reimplementing this function, note that in case of text
    items, QItemDelegate adds a margin (i.e. 2 *
    QStyle::PM_FocusFrameHMargin) to the length of the text.
*/

QSize QItemDelegate::sizeHint(const QStyleOptionViewItem &option,
                              const QModelIndex &index) const



More information about the Qt mailing list