QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
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 {
32 if ( !mBlockUpdates )
33 emit widgetChanged();
34 } );
35 connect( mIsAnimatedGroup, &QGroupBox::toggled, this, [ this ]
36 {
37 if ( !mBlockUpdates )
38 emit widgetChanged();
39 } );
40}
41
43{
44 mBlockUpdates = true;
45 mIsAnimatedGroup->setChecked( settings.isAnimated() );
46 mFrameRateSpin->setValue( settings.frameRate() );
47 mBlockUpdates = false;
48}
49
51{
53 settings.setIsAnimated( mIsAnimatedGroup->isChecked() );
54 settings.setFrameRate( mFrameRateSpin->value() );
55 return settings;
56}
57
58
59//
60// QgsSymbolAnimationSettingsDialog
61//
62
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
81
86
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