21 , mMovie( new QMovie( this ) )
23 if ( !iconPath.isEmpty() )
25 mMovie->setFileName( iconPath );
27 mMovie->setCacheMode( QMovie::CacheAll );
28 connect( mMovie, &QMovie::frameChanged,
this, &QgsAnimatedIcon::onFrameChanged );
33 return mMovie->fileName();
38 mMovie->setFileName( iconPath );
48 if ( connect(
this, SIGNAL(
frameChanged() ), receiver, method ) )
50 mMovie->setPaused(
false );
59 return disconnect(
this, SIGNAL(
frameChanged() ), receiver, method );
64 return mMovie->currentPixmap().width();
69 return mMovie->currentPixmap().height();
71 void QgsAnimatedIcon::onFrameChanged()
74 mMovie->setPaused(
true );
76 mIcon = QIcon( mMovie->currentPixmap() );
QString iconPath() const
Path to a movie, e.g.
bool disconnectFrameChanged(const typename QtPrivate::FunctionPointer< Func1 >::Object *receiver, Func1 slot)
Convenience function to disconnect the same style that the frame change connection was established...
QgsAnimatedIcon(const QString &iconPath=QString(), QObject *parent=nullptr)
Create a new animated icon.
int width() const
The native width of the icon.
QIcon icon() const
Gets the icons representation in the current frame.
int height() const
The native height of the icon.
void setIconPath(const QString &iconPath)
Path to a movie, e.g.
bool connectFrameChanged(const typename QtPrivate::FunctionPointer< Func1 >::Object *receiver, Func1 slot)
Connect a slot that will be notified repeatedly whenever a frame changes and which should request the...
void frameChanged()
Emitted when the icon changed.