QGIS API Documentation 3.99.0-Master (7d2ca374f2d)
Loading...
Searching...
No Matches
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
22#include "ui_qgslayoutscalebarwidgetbase.h"
23
24#include "qgis_gui.h"
25#include "qgslayoutitemwidget.h"
26
27#include <QButtonGroup>
28
29#define SIP_NO_FILE
30
32
40class GUI_EXPORT QgsLayoutScaleBarWidget : public QgsLayoutItemBaseWidget, public QgsExpressionContextGenerator, private Ui::QgsLayoutScaleBarWidgetBase
41{
42 Q_OBJECT
43
44 public:
47 void setMasterLayout( QgsMasterLayoutInterface *masterLayout ) override;
48
50
51 protected:
52 bool setNewItem( QgsLayoutItem *item ) override;
53
54 private slots:
55 void lineSymbolChanged();
56 void divisionSymbolChanged();
57 void subdivisionSymbolChanged();
58 void fillSymbol1Changed();
59 void fillSymbol2Changed();
60 void mHeightSpinBox_valueChanged( double d );
61 void mSegmentSizeSpinBox_valueChanged( double d );
62 void mSegmentsLeftSpinBox_valueChanged( int i );
63 void mNumberOfSegmentsSpinBox_valueChanged( int i );
64 void mNumberOfSubdivisionsSpinBox_valueChanged( int i );
65 void mSubdivisionsHeightSpinBox_valueChanged( double d );
66 void mUnitLabelLineEdit_textChanged( const QString &text );
67 void mMapUnitsPerBarUnitSpinBox_valueChanged( double d );
68 void mStyleComboBox_currentIndexChanged( const QString &text );
69 void mLabelBarSpaceSpinBox_valueChanged( double d );
70 void mBoxSizeSpinBox_valueChanged( double d );
71 void mDistanceLabelPlacementComboBox_currentIndexChanged( int index );
72 void alignmentChanged();
73 void mUnitsComboBox_currentIndexChanged( int index );
74 void mMinWidthSpinBox_valueChanged( double d );
75 void mMaxWidthSpinBox_valueChanged( double d );
76
77 private slots:
78 void setGuiElements();
79 void segmentSizeRadioChanged( QAbstractButton *radio );
80 void mapChanged( QgsLayoutItem *item );
81 void textFormatChanged();
82 void changeNumberFormat();
83
84 private:
85 enum class DistanceLabelPlacement : int
86 {
87 CenteredAboveSegmentEdges,
88 CenteredAboveSegmentCenters,
89 CenteredBelowSegmentEdges,
90 CenteredBelowSegmentCenters,
91 };
92 static DistanceLabelPlacement distanceLabelPlacement( Qgis::ScaleBarDistanceLabelHorizontalPlacement horizontalPlacement, Qgis::ScaleBarDistanceLabelVerticalPlacement verticalPlacement );
93
94 QPointer<QgsLayoutItemScaleBar> mScalebar;
95 QgsLayoutItemPropertiesWidget *mItemPropertiesWidget = nullptr;
96
97 QButtonGroup mSegmentSizeRadioGroup;
98
100 void blockMemberSignals( bool enable );
101
103 void toggleStyleSpecificControls( const QString &style );
104
105 void connectUpdateSignal();
106 void disconnectUpdateSignal();
107 void populateDataDefinedButtons();
108
109 static QString linkedMapUnitsString( QgsLayoutItemScaleBar *scalebar );
110};
111
112#endif //QGSLAYOUTSCALEBARWIDGET_H
ScaleBarDistanceLabelHorizontalPlacement
Scale bar distance label horizontal placement.
Definition qgis.h:5467
ScaleBarDistanceLabelVerticalPlacement
Scale bar distance label vertical placement.
Definition qgis.h:5453
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...
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.
QgsLayoutItemBaseWidget(QWidget *parent SIP_TRANSFERTHIS, QgsLayoutObject *layoutObject)
Constructor for QgsLayoutItemBaseWidget, linked with the specified layoutObject.
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.
QgsLayoutScaleBarWidget(QgsLayoutItemScaleBar *scaleBar)
constructor
Interface for master layout type objects, such as print layouts and reports.