[Interest] QListView

Igor Mironchik igor.mironchik at gmail.com
Thu Aug 27 19:39:38 CEST 2015


Hi guys,

I implemented model derived from QAbstractListModel. In data() method 
for Qt::DecorationRole it returns QPixmap. This pixmap may be with 
different width, but always with the same height.

In QListView I do:

setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
setMinimumSize( 100, 100 );
setFrameShape( QFrame::NoFrame );
setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
setSizeAdjustPolicy( QAbstractScrollArea::AdjustToContents );
setSelectionMode( QAbstractItemView::NoSelection );
setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
setMovement( QListView::Static );
setFlow( QListView::LeftToRight );
setSpacing( 5 );
setViewMode( QListView::IconMode );
setUniformItemSizes( false );

And for this view I installed custom delegate that draws pixmap and 
something else.

So my problem is that if second item has width more then icon size in 
list view the third item draws on top of second... Spacing ignores.

So my question is it possible to implement list view that will draw 
pixmaps with different width?

-- 
Best Regards,
Igor Mironchik.




More information about the Interest mailing list