mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-31 06:02:27 +02:00
* Re-center play/pause buttons when resizing GridView.
This commit is contained in:
parent
7fb6701e3e
commit
b453d80808
@ -56,7 +56,8 @@ GridItemDelegate::GridItemDelegate( QAbstractItemView* parent, PlayableProxyMode
|
||||
if ( m_view && m_view->metaObject()->indexOfSignal( "modelChanged()" ) > -1 )
|
||||
connect( m_view, SIGNAL( modelChanged() ), this, SLOT( modelChanged() ) );
|
||||
|
||||
connect( m_view, SIGNAL( scrolledContents( int, int ) ), SLOT( onScrolled( int, int ) ) );
|
||||
connect( m_view, SIGNAL( scrolledContents( int, int ) ), SLOT( onViewChanged() ) );
|
||||
connect( m_view, SIGNAL( resized() ), SLOT( onViewChanged() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -421,19 +422,22 @@ GridItemDelegate::doUpdateIndex( const QPersistentModelIndex& idx )
|
||||
|
||||
|
||||
void
|
||||
GridItemDelegate::onScrolled( int dx, int dy )
|
||||
GridItemDelegate::onViewChanged()
|
||||
{
|
||||
foreach ( QWidget* widget, m_spinner.values() )
|
||||
foreach ( const QPersistentModelIndex& index, m_spinner.keys() )
|
||||
{
|
||||
widget->move( widget->pos() + QPoint( dx, dy ) );
|
||||
QRect rect = m_view->visualRect( index );
|
||||
m_spinner.value( index )->move( rect.center() - QPoint( 23, 23 ) );
|
||||
}
|
||||
foreach ( ImageButton* button, m_playButton.values() )
|
||||
foreach ( const QPersistentModelIndex& index, m_playButton.keys() )
|
||||
{
|
||||
button->move( button->pos() + QPoint( dx, dy ) );
|
||||
QRect rect = m_view->visualRect( index );
|
||||
m_playButton.value( index )->move( rect.center() - QPoint( 23, 23 ) );
|
||||
}
|
||||
foreach ( ImageButton* button, m_pauseButton.values() )
|
||||
foreach ( const QPersistentModelIndex& index, m_pauseButton.keys() )
|
||||
{
|
||||
button->move( button->pos() + QPoint( dx, dy ) );
|
||||
QRect rect = m_view->visualRect( index );
|
||||
m_pauseButton.value( index )->move( rect.center() - QPoint( 23, 23 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ private slots:
|
||||
void modelChanged();
|
||||
void doUpdateIndex( const QPersistentModelIndex& idx );
|
||||
|
||||
void onScrolled( int dx, int dy );
|
||||
void onViewChanged();
|
||||
void onPlaybackStarted( const QPersistentModelIndex& index );
|
||||
void onPlaybackFinished();
|
||||
|
||||
@ -64,6 +64,7 @@ private slots:
|
||||
|
||||
void fadingFrameChanged( const QPersistentModelIndex& );
|
||||
void fadingFrameFinished( const QPersistentModelIndex& );
|
||||
|
||||
private:
|
||||
QTimeLine* createTimeline( QTimeLine::Direction direction );
|
||||
|
||||
|
@ -208,6 +208,8 @@ GridView::resizeEvent( QResizeEvent* event )
|
||||
{
|
||||
QListView::resizeEvent( event );
|
||||
layoutItems();
|
||||
|
||||
emit resized();
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,6 +78,7 @@ public slots:
|
||||
signals:
|
||||
void modelChanged();
|
||||
void scrolledContents( int dx, int dy );
|
||||
void resized();
|
||||
|
||||
protected:
|
||||
virtual void startDrag( Qt::DropActions supportedActions );
|
||||
|
Loading…
x
Reference in New Issue
Block a user