QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgsanimatedicon.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsanimatedicon.h - QgsAnimatedIcon
3
4
---------------------
5
begin : 13.3.2017
6
copyright : (C) 2017 by Matthias Kuhn
7
email : matthias@opengis.ch
8
***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16
#ifndef QGSANIMATEDICON_H
17
#define QGSANIMATEDICON_H
18
19
#include "qgis_core.h"
20
21
#include <QIcon>
22
#include <QMetaMethod>
23
#include <QMovie>
24
#include <QObject>
25
30
class
CORE_EXPORT
QgsAnimatedIcon
:
public
QObject
31
{
32
Q_OBJECT
33
public
:
37
QgsAnimatedIcon
(
const
QString &
iconPath
= QString(), QObject *parent =
nullptr
);
38
42
QString
iconPath
()
const
;
43
47
void
setIconPath
(
const
QString &
iconPath
);
48
54
QIcon
icon
()
const
;
55
56
#ifndef SIP_RUN
57
68
template
<
typename
Func1>
bool
connectFrameChanged
(
const
typename
QtPrivate::FunctionPointer<Func1>::Object *receiver, Func1 slot )
69
{
70
if
( connect(
this
, &
QgsAnimatedIcon::frameChanged
, receiver, slot ) )
71
{
72
mMovie->setPaused(
false
);
73
return
true
;
74
}
75
else
76
return
false
;
77
}
78
85
template
<
typename
Func1>
bool
disconnectFrameChanged
(
const
typename
QtPrivate::FunctionPointer<Func1>::Object *receiver, Func1 slot )
86
{
87
return
disconnect(
this
, &
QgsAnimatedIcon::frameChanged
, receiver, slot );
88
}
89
90
#endif
91
100
bool
connectFrameChanged(
const
QObject *receiver,
const
char
*method );
101
106
bool
disconnectFrameChanged(
const
QObject *receiver,
const
char
*method );
107
108
113
int
width()
const
;
114
119
int
height()
const
;
120
121
signals:
122
130
void
frameChanged
();
131
132
private
slots:
133
void
onFrameChanged();
134
135
private
:
136
QMovie *mMovie =
nullptr
;
137
QIcon mIcon;
138
};
139
140
#endif
// QGSANIMATEDICON_H
QgsAnimatedIcon::disconnectFrameChanged
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.
Definition
qgsanimatedicon.h:85
QgsAnimatedIcon::frameChanged
void frameChanged()
Emitted when the icon changed.
QgsAnimatedIcon::QgsAnimatedIcon
QgsAnimatedIcon(const QString &iconPath=QString(), QObject *parent=nullptr)
Create a new animated icon.
Definition
qgsanimatedicon.cpp:21
QgsAnimatedIcon::connectFrameChanged
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...
Definition
qgsanimatedicon.h:68
QgsAnimatedIcon::setIconPath
void setIconPath(const QString &iconPath)
Path to a movie, e.g.
Definition
qgsanimatedicon.cpp:38
QgsAnimatedIcon::icon
QIcon icon() const
Gets the icons representation in the current frame.
Definition
qgsanimatedicon.cpp:43
QgsAnimatedIcon::iconPath
QString iconPath() const
Path to a movie, e.g.
Definition
qgsanimatedicon.cpp:33
Generated on
for QGIS API Documentation by
1.17.0