19#include "moc_qgsanimatedicon.cpp"
23 , mMovie( new QMovie( this ) )
27 mMovie->setFileName( iconPath );
29 mMovie->setCacheMode( QMovie::CacheAll );
30 connect( mMovie, &QMovie::frameChanged,
this, &QgsAnimatedIcon::onFrameChanged );
35 return mMovie->fileName();
50 if ( connect(
this, SIGNAL(
frameChanged() ), receiver, method ) )
52 mMovie->setPaused(
false );
61 return disconnect(
this, SIGNAL(
frameChanged() ), receiver, method );
66 return mMovie->currentPixmap().width();
71 return mMovie->currentPixmap().height();
73void QgsAnimatedIcon::onFrameChanged()
76 mMovie->setPaused(
true );
78 mIcon = QIcon( mMovie->currentPixmap() );
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.
void frameChanged()
Emitted when the icon changed.
QgsAnimatedIcon(const QString &iconPath=QString(), QObject *parent=nullptr)
Create a new animated icon.
int height() const
The native height of the icon.
int width() const
The native width of the icon.
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 setIconPath(const QString &iconPath)
Path to a movie, e.g.
QIcon icon() const
Gets the icons representation in the current frame.
QString iconPath() const
Path to a movie, e.g.