QgsAnimatedIcon class

Animated icon is keeping an animation running if there are listeners connected to frameChanged.

Constructors, destructors, conversion operators

QgsAnimatedIcon(const QString& iconPath = QString(), QObject* parent = nullptr)
Create a new animated icon.

Public functions

template<typename Func1>
auto connectFrameChanged(const typename QtPrivate::FunctionPointer<Func1>::Object* receiver, Func1 slot) -> bool
Connect a slot that will be notified repeatedly whenever a frame changes and which should request the current icon and trigger UI updates.
auto connectFrameChanged(const QObject* receiver, const char* method) -> bool
Connect a slot that will be notified repeatedly whenever a frame changes and which should request the current icon and trigger UI updates.
template<typename Func1>
auto disconnectFrameChanged(const typename QtPrivate::FunctionPointer<Func1>::Object* receiver, Func1 slot) -> bool
Convenience function to disconnect the same style that the frame change connection was established.
auto disconnectFrameChanged(const QObject* receiver, const char* method) -> bool
Convenience function to disconnect the same style that the frame change connection was established.
auto height() const -> int
The native height of the icon.
auto icon() const -> QIcon
Gets the icons representation in the current frame.
auto iconPath() const -> QString
Path to a movie, e.g.
void setIconPath(const QString& iconPath)
Path to a movie, e.g.
auto width() const -> int
The native width of the icon.

Signals

void frameChanged()
Emitted when the icon changed.

Function documentation

QgsAnimatedIcon::QgsAnimatedIcon(const QString& iconPath = QString(), QObject* parent = nullptr)

Create a new animated icon.

Optionally, the iconPath can already be specified.

template<typename Func1>
bool QgsAnimatedIcon::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 current icon and trigger UI updates.

Connect to the frame changed signal with this method and not directly. This method makes sure the annimation is started.

bool QgsAnimatedIcon::connectFrameChanged(const QObject* receiver, const char* method)

Connect a slot that will be notified repeatedly whenever a frame changes and which should request the current icon and trigger UI updates.

Connect to the frame changed signal with this method and not directly. This method makes sure the annimation is started.

template<typename Func1>
bool QgsAnimatedIcon::disconnectFrameChanged(const typename QtPrivate::FunctionPointer<Func1>::Object* receiver, Func1 slot)

Convenience function to disconnect the same style that the frame change connection was established.

bool QgsAnimatedIcon::disconnectFrameChanged(const QObject* receiver, const char* method)

Convenience function to disconnect the same style that the frame change connection was established.

int QgsAnimatedIcon::height() const

The native height of the icon.

QIcon QgsAnimatedIcon::icon() const

Gets the icons representation in the current frame.

This will need to be called repeatedly, whenever a frameChanged() signal is emitted.

QString QgsAnimatedIcon::iconPath() const

Path to a movie, e.g.

animated GIF

void QgsAnimatedIcon::setIconPath(const QString& iconPath)

Path to a movie, e.g.

animated GIF

int QgsAnimatedIcon::width() const

The native width of the icon.

void QgsAnimatedIcon::frameChanged() signal

Emitted when the icon changed.

You should use connectFrameChanged instead of connecting to this signal directly. Connecting to this signal directly will cause the animation not to be started.