[Interest] QListView

Igor Mironchik igor.mironchik at gmail.com
Thu Aug 27 22:05:00 CEST 2015


Hi,

i've found the solution. It was simple. The problem was in the next line

setViewMode( QListView::IconMode );

On 27.08.2015 20:39, Igor Mironchik wrote:
> 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