QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
symbology
qgssymbolanimationsettingswidget.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgssymbolanimationsettingswidget.cpp
3
---------------------
4
begin : April 2022
5
copyright : (C) 2022 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#include "
qgssymbolanimationsettingswidget.h
"
17
18
#include "
qgssymbol.h
"
19
20
#include <QDialogButtonBox>
21
22
#include "moc_qgssymbolanimationsettingswidget.cpp"
23
24
QgsSymbolAnimationSettingsWidget::QgsSymbolAnimationSettingsWidget
( QWidget *parent )
25
:
QgsPanelWidget
( parent )
26
{
27
setupUi(
this
);
28
29
mFrameRateSpin->setClearValue( 10 );
30
mFrameRateSpin->setShowClearButton(
true
);
31
32
connect( mFrameRateSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this
, [
this
] {
33
if
( !mBlockUpdates )
34
emit
changed
();
35
} );
36
connect( mIsAnimatedGroup, &QGroupBox::toggled,
this
, [
this
] {
37
if
( !mBlockUpdates )
38
emit
changed
();
39
} );
40
}
41
42
void
QgsSymbolAnimationSettingsWidget::setAnimationSettings
(
const
QgsSymbolAnimationSettings
&settings )
43
{
44
mBlockUpdates =
true
;
45
mIsAnimatedGroup->setChecked( settings.
isAnimated
() );
46
mFrameRateSpin->setValue( settings.
frameRate
() );
47
mBlockUpdates =
false
;
48
}
49
50
QgsSymbolAnimationSettings
QgsSymbolAnimationSettingsWidget::animationSettings
()
const
51
{
52
QgsSymbolAnimationSettings
settings;
53
settings.
setIsAnimated
( mIsAnimatedGroup->isChecked() );
54
settings.
setFrameRate
( mFrameRateSpin->value() );
55
return
settings;
56
}
57
58
59
//
60
// QgsSymbolAnimationSettingsDialog
61
//
62
63
QgsSymbolAnimationSettingsDialog::QgsSymbolAnimationSettingsDialog
( QWidget *parent, Qt::WindowFlags f )
64
: QDialog( parent, f )
65
{
66
QVBoxLayout *vLayout =
new
QVBoxLayout();
67
mWidget =
new
QgsSymbolAnimationSettingsWidget
();
68
vLayout->addWidget( mWidget );
69
QDialogButtonBox *bbox =
new
QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal );
70
connect( bbox, &QDialogButtonBox::accepted,
this
, &QgsSymbolAnimationSettingsDialog::accept );
71
connect( bbox, &QDialogButtonBox::rejected,
this
, &QgsSymbolAnimationSettingsDialog::reject );
72
vLayout->addWidget( bbox );
73
setLayout( vLayout );
74
setWindowTitle( tr(
"Animation Settings"
) );
75
}
76
77
void
QgsSymbolAnimationSettingsDialog::setAnimationSettings
(
const
QgsSymbolAnimationSettings
&settings )
78
{
79
mWidget->setAnimationSettings( settings );
80
}
81
82
QgsSymbolAnimationSettings
QgsSymbolAnimationSettingsDialog::animationSettings
()
const
83
{
84
return
mWidget->animationSettings();
85
}
QgsPanelWidget::changed
void changed()
Emitted when the widget state changes.
QgsPanelWidget::QgsPanelWidget
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
Definition
qgspanelwidget.cpp:30
QgsSymbolAnimationSettingsDialog::setAnimationSettings
void setAnimationSettings(const QgsSymbolAnimationSettings &settings)
Sets the animation settings to show in the dialog.
Definition
qgssymbolanimationsettingswidget.cpp:77
QgsSymbolAnimationSettingsDialog::QgsSymbolAnimationSettingsDialog
QgsSymbolAnimationSettingsDialog(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
Constructor for QgsSymbolAnimationSettingsDialog.
Definition
qgssymbolanimationsettingswidget.cpp:63
QgsSymbolAnimationSettingsDialog::animationSettings
QgsSymbolAnimationSettings animationSettings() const
Returns the animation settings as defined in the dialog.
Definition
qgssymbolanimationsettingswidget.cpp:82
QgsSymbolAnimationSettingsWidget
A widget for customising animation settings for a symbol.
Definition
qgssymbolanimationsettingswidget.h:36
QgsSymbolAnimationSettingsWidget::setAnimationSettings
void setAnimationSettings(const QgsSymbolAnimationSettings &settings)
Sets the animation settings to show in the widget.
Definition
qgssymbolanimationsettingswidget.cpp:42
QgsSymbolAnimationSettingsWidget::animationSettings
QgsSymbolAnimationSettings animationSettings() const
Returns the animation settings as defined in the widget.
Definition
qgssymbolanimationsettingswidget.cpp:50
QgsSymbolAnimationSettingsWidget::QgsSymbolAnimationSettingsWidget
QgsSymbolAnimationSettingsWidget(QWidget *parent=nullptr)
Constructor for QgsSymbolAnimationSettingsWidget.
Definition
qgssymbolanimationsettingswidget.cpp:24
QgsSymbolAnimationSettings
Contains settings relating to symbol animation.
Definition
qgssymbol.h:41
QgsSymbolAnimationSettings::isAnimated
bool isAnimated() const
Returns true if the symbol is animated.
Definition
qgssymbol.h:63
QgsSymbolAnimationSettings::setIsAnimated
void setIsAnimated(bool animated)
Sets whether the symbol is animated.
Definition
qgssymbol.h:52
QgsSymbolAnimationSettings::setFrameRate
void setFrameRate(double rate)
Sets the symbol animation frame rate (in frames per second).
Definition
qgssymbol.h:70
QgsSymbolAnimationSettings::frameRate
double frameRate() const
Returns the symbol animation frame rate (in frames per second).
Definition
qgssymbol.h:77
qgssymbol.h
qgssymbolanimationsettingswidget.h
Generated on
for QGIS API Documentation by
1.17.0