QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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
17#include "moc_qgssymbolanimationsettingswidget.cpp"
18#include "qgssymbol.h"
19
20#include <QDialogButtonBox>
21
23 : QgsPanelWidget( parent )
24{
25 setupUi( this );
26
27 mFrameRateSpin->setClearValue( 10 );
28 mFrameRateSpin->setShowClearButton( true );
29
30 connect( mFrameRateSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [this] {
31 if ( !mBlockUpdates )
32 emit widgetChanged();
33 } );
34 connect( mIsAnimatedGroup, &QGroupBox::toggled, this, [this] {
35 if ( !mBlockUpdates )
36 emit widgetChanged();
37 } );
38}
39
41{
42 mBlockUpdates = true;
43 mIsAnimatedGroup->setChecked( settings.isAnimated() );
44 mFrameRateSpin->setValue( settings.frameRate() );
45 mBlockUpdates = false;
46}
47
49{
51 settings.setIsAnimated( mIsAnimatedGroup->isChecked() );
52 settings.setFrameRate( mFrameRateSpin->value() );
53 return settings;
54}
55
56
57//
58// QgsSymbolAnimationSettingsDialog
59//
60
62 : QDialog( parent, f )
63{
64 QVBoxLayout *vLayout = new QVBoxLayout();
66 vLayout->addWidget( mWidget );
67 QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal );
68 connect( bbox, &QDialogButtonBox::accepted, this, &QgsSymbolAnimationSettingsDialog::accept );
69 connect( bbox, &QDialogButtonBox::rejected, this, &QgsSymbolAnimationSettingsDialog::reject );
70 vLayout->addWidget( bbox );
71 setLayout( vLayout );
72 setWindowTitle( tr( "Animation Settings" ) );
73}
74
79
Base class for any widget that can be shown as a inline panel.
void widgetChanged()
Emitted when the widget state changes.
void setAnimationSettings(const QgsSymbolAnimationSettings &settings)
Sets the animation settings to show in the dialog.
QgsSymbolAnimationSettingsDialog(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
Constructor for QgsSymbolAnimationSettingsDialog.
QgsSymbolAnimationSettings animationSettings() const
Returns the animation settings as defined in the dialog.
A widget for customising animation settings for a symbol.
void setAnimationSettings(const QgsSymbolAnimationSettings &settings)
Sets the animation settings to show in the widget.
QgsSymbolAnimationSettings animationSettings() const
Returns the animation settings as defined in the widget.
QgsSymbolAnimationSettingsWidget(QWidget *parent=nullptr)
Constructor for QgsSymbolAnimationSettingsWidget.
Contains settings relating to symbol animation.
Definition qgssymbol.h:41
bool isAnimated() const
Returns true if the symbol is animated.
Definition qgssymbol.h:64
void setIsAnimated(bool animated)
Sets whether the symbol is animated.
Definition qgssymbol.h:53
void setFrameRate(double rate)
Sets the symbol animation frame rate (in frames per second).
Definition qgssymbol.h:71
double frameRate() const
Returns the symbol animation frame rate (in frames per second).
Definition qgssymbol.h:78