From 59627760763d04a9fea732f5b065b06972aa9a5d Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sat, 20 Sep 2014 06:58:29 +0200 Subject: [PATCH] * LoadingSpinner requires a parent and should install an event-filter on its parent. --- src/libtomahawk/utils/AnimatedSpinner.cpp | 3 +++ src/libtomahawk/utils/AnimatedSpinner.h | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/utils/AnimatedSpinner.cpp b/src/libtomahawk/utils/AnimatedSpinner.cpp index dc6e145e3..6ae67704b 100644 --- a/src/libtomahawk/utils/AnimatedSpinner.cpp +++ b/src/libtomahawk/utils/AnimatedSpinner.cpp @@ -39,6 +39,7 @@ AnimatedSpinner::AnimatedSpinner( QWidget* parent ) init(); } + AnimatedSpinner::AnimatedSpinner( const QSize& size, QWidget *parent ) : QWidget( parent ) , m_showHide( new QTimeLine ) @@ -275,6 +276,8 @@ LoadingSpinner::LoadingSpinner( QAbstractItemView* parent ) : AnimatedSpinner( parent ) , m_parent( parent ) { + installEventFilter( m_parent ); + if ( m_parent->model() ) { connect( m_parent->model(), SIGNAL( loadingStarted() ), SLOT( fadeIn() ), Qt::UniqueConnection ); diff --git a/src/libtomahawk/utils/AnimatedSpinner.h b/src/libtomahawk/utils/AnimatedSpinner.h index c163a62fa..2cc5e00dd 100644 --- a/src/libtomahawk/utils/AnimatedSpinner.h +++ b/src/libtomahawk/utils/AnimatedSpinner.h @@ -52,7 +52,7 @@ public: QSize sizeHint() const; QPixmap pixmap() const { return m_pixmap; } - + void setAutoCenter( bool enabled ) { m_autoCenter = enabled; } public slots: @@ -98,8 +98,8 @@ class DLLEXPORT LoadingSpinner : public AnimatedSpinner Q_OBJECT public: - explicit LoadingSpinner( QAbstractItemView* parent = 0 ); // widget mode - + explicit LoadingSpinner( QAbstractItemView* parent ); // widget mode + private slots: void onViewModelChanged();