QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
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 "qgssymbol.h"
18
19#include <QDialogButtonBox>
20
22 : QgsPanelWidget( parent )
23{
24 setupUi( this );
25
26 mFrameRateSpin->setClearValue( 10 );
27 mFrameRateSpin->setShowClearButton( true );
28
29 connect( mFrameRateSpin, qOverload< double >( &QDoubleSpinBox::valueChanged ), this, [ this ]
30 {
31 if ( !mBlockUpdates )
32 emit widgetChanged();
33 } );
34 connect( mIsAnimatedGroup, &QGroupBox::toggled, this, [ this ]
35 {
36 if ( !mBlockUpdates )
37 emit widgetChanged();
38 } );
39}
40
42{
43 mBlockUpdates = true;
44 mIsAnimatedGroup->setChecked( settings.isAnimated() );
45 mFrameRateSpin->setValue( settings.frameRate() );
46 mBlockUpdates = false;
47}
48
50{
52 settings.setIsAnimated( mIsAnimatedGroup->isChecked() );
53 settings.setFrameRate( mFrameRateSpin->value() );
54 return settings;
55}
56
57
58//
59// QgsSymbolAnimationSettingsDialog
60//
61
63 : QDialog( parent, f )
64{
65 QVBoxLayout *vLayout = new QVBoxLayout();
66 mWidget = new QgsSymbolAnimationSettingsWidget( );
67 vLayout->addWidget( mWidget );
68 QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal );
69 connect( bbox, &QDialogButtonBox::accepted, this, &QgsSymbolAnimationSettingsDialog::accept );
70 connect( bbox, &QDialogButtonBox::rejected, this, &QgsSymbolAnimationSettingsDialog::reject );
71 vLayout->addWidget( bbox );
72 setLayout( vLayout );
73 setWindowTitle( tr( "Animation Settings" ) );
74}
75
80
85
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