mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-22 16:59:58 +01:00
* Lazy init for AlbumView.
This commit is contained in:
parent
fd7f1fe422
commit
4c04feb529
@ -57,11 +57,13 @@ AlbumView::AlbumView( QWidget* parent )
|
||||
setSpacing( 0 );
|
||||
setContentsMargins( 0, 0, 0, 0 );
|
||||
setMouseTracking( true );
|
||||
|
||||
setStyleSheet( "QListView { background-color: #323435; }" );
|
||||
|
||||
setResizeMode( Adjust );
|
||||
setViewMode( IconMode );
|
||||
setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
|
||||
setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
|
||||
|
||||
setAutoFitItems( true );
|
||||
setProxyModel( new AlbumProxyModel( this ) );
|
||||
@ -179,10 +181,13 @@ AlbumView::paintEvent( QPaintEvent* event )
|
||||
void
|
||||
AlbumView::resizeEvent( QResizeEvent* event )
|
||||
{
|
||||
QListView::resizeEvent( event );
|
||||
|
||||
if ( autoFitItems() )
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
int scrollbar = verticalScrollBar()->isVisible() ? verticalScrollBar()->width() + 16 : 0;
|
||||
// int scrollbar = verticalScrollBar()->isVisible() ? verticalScrollBar()->width() + 16 : 0;
|
||||
int scrollbar = 0; verticalScrollBar()->rect().width();
|
||||
#else
|
||||
int scrollbar = verticalScrollBar()->rect().width();
|
||||
#endif
|
||||
@ -205,8 +210,6 @@ AlbumView::resizeEvent( QResizeEvent* event )
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
QListView::resizeEvent( event );
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,6 +84,8 @@ private slots:
|
||||
void onFilterChanged( const QString& filter );
|
||||
|
||||
private:
|
||||
void adjustItemSize( const QRect& rect );
|
||||
|
||||
AlbumModel* m_model;
|
||||
AlbumProxyModel* m_proxyModel;
|
||||
AlbumItemDelegate* m_delegate;
|
||||
@ -92,6 +94,8 @@ private:
|
||||
|
||||
bool m_inited;
|
||||
bool m_autoFitItems;
|
||||
|
||||
QRect m_paintRect;
|
||||
};
|
||||
|
||||
#endif // ALBUMVIEW_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user