QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgslayoutscalebarwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutscalebarwidget.h
3  ---------------------------
4  begin : 11 June 2008
5  copyright : (C) 2008 by Marco Hugentobler
6  email : marco dot hugentobler at karto dot baug dot ethz dot ch
7  ***************************************************************************/
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 
17 #ifndef QGSLAYOUTSCALEBARWIDGET_H
18 #define QGSLAYOUTSCALEBARWIDGET_H
19 
20 // We don't want to expose this in the public API
21 #define SIP_NO_FILE
22 
23 #include "qgis_gui.h"
24 #include "ui_qgslayoutscalebarwidgetbase.h"
25 #include "qgslayoutitemwidget.h"
26 
27 #include <QButtonGroup>
28 
30 
38 class GUI_EXPORT QgsLayoutScaleBarWidget: public QgsLayoutItemBaseWidget, public QgsExpressionContextGenerator, private Ui::QgsLayoutScaleBarWidgetBase
39 {
40  Q_OBJECT
41 
42  public:
44  explicit QgsLayoutScaleBarWidget( QgsLayoutItemScaleBar *scaleBar );
45  void setMasterLayout( QgsMasterLayoutInterface *masterLayout ) override;
46 
48 
49  protected:
50  bool setNewItem( QgsLayoutItem *item ) override;
51 
52  private slots:
53  void lineSymbolChanged();
54  void divisionSymbolChanged();
55  void subdivisionSymbolChanged();
56  void fillSymbol1Changed();
57  void fillSymbol2Changed();
58  void mHeightSpinBox_valueChanged( double d );
59  void mSegmentSizeSpinBox_valueChanged( double d );
60  void mSegmentsLeftSpinBox_valueChanged( int i );
61  void mNumberOfSegmentsSpinBox_valueChanged( int i );
62  void mNumberOfSubdivisionsSpinBox_valueChanged( int i );
63  void mSubdivisionsHeightSpinBox_valueChanged( double d );
64  void mUnitLabelLineEdit_textChanged( const QString &text );
65  void mMapUnitsPerBarUnitSpinBox_valueChanged( double d );
66  void mStyleComboBox_currentIndexChanged( const QString &text );
67  void mLabelBarSpaceSpinBox_valueChanged( double d );
68  void mBoxSizeSpinBox_valueChanged( double d );
69  void mLabelVerticalPlacementComboBox_currentIndexChanged( int index );
70  void mLabelHorizontalPlacementComboBox_currentIndexChanged( int index );
71  void alignmentChanged();
72  void mUnitsComboBox_currentIndexChanged( int index );
73  void mMinWidthSpinBox_valueChanged( double d );
74  void mMaxWidthSpinBox_valueChanged( double d );
75 
76  private slots:
77  void setGuiElements();
78  void segmentSizeRadioChanged( QAbstractButton *radio );
79  void mapChanged( QgsLayoutItem *item );
80  void textFormatChanged();
81  void changeNumberFormat();
82 
83  private:
84  QPointer< QgsLayoutItemScaleBar > mScalebar;
85  QgsLayoutItemPropertiesWidget *mItemPropertiesWidget = nullptr;
86 
87  QButtonGroup mSegmentSizeRadioGroup;
88 
90  void blockMemberSignals( bool enable );
91 
93  void toggleStyleSpecificControls( const QString &style );
94 
95  void connectUpdateSignal();
96  void disconnectUpdateSignal();
97 };
98 
99 #endif //QGSLAYOUTSCALEBARWIDGET_H
Abstract interface for generating an expression context.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A base class for property widgets for layout items.
virtual bool setNewItem(QgsLayoutItem *item)
Attempts to update the widget to show the properties for the specified item.
virtual void setMasterLayout(QgsMasterLayoutInterface *masterLayout)
Sets the master layout associated with the item.
A widget for controlling the common properties of layout items (e.g.
A layout item subclass for scale bars.
Base class for graphical items within a QgsLayout.
A widget to define the properties of a QgsLayoutItemScaleBar.
Interface for master layout type objects, such as print layouts and reports.