QGIS API Documentation 3.99.0-Master (752b475928d)
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#define SIP_NO_FILE
22
23#include "ui_qgslayoutscalebarwidgetbase.h"
24
25#include "qgis_gui.h"
26#include "qgslayoutitemwidget.h"
27
28#include <QButtonGroup>
29
31
39class GUI_EXPORT QgsLayoutScaleBarWidget : public QgsLayoutItemBaseWidget, public QgsExpressionContextGenerator, private Ui::QgsLayoutScaleBarWidgetBase
40{
41 Q_OBJECT
42
43 public:
46 void setMasterLayout( QgsMasterLayoutInterface *masterLayout ) override;
47
49
50 protected:
51 bool setNewItem( QgsLayoutItem *item ) override;
52
53 private slots:
54 void lineSymbolChanged();
55 void divisionSymbolChanged();
56 void subdivisionSymbolChanged();
57 void fillSymbol1Changed();
58 void fillSymbol2Changed();
59 void mHeightSpinBox_valueChanged( double d );
60 void mSegmentSizeSpinBox_valueChanged( double d );
61 void mSegmentsLeftSpinBox_valueChanged( int i );
62 void mNumberOfSegmentsSpinBox_valueChanged( int i );
63 void mNumberOfSubdivisionsSpinBox_valueChanged( int i );
64 void mSubdivisionsHeightSpinBox_valueChanged( double d );
65 void mUnitLabelLineEdit_textChanged( const QString &text );
66 void mMapUnitsPerBarUnitSpinBox_valueChanged( double d );
67 void mStyleComboBox_currentIndexChanged( const QString &text );
68 void mLabelBarSpaceSpinBox_valueChanged( double d );
69 void mBoxSizeSpinBox_valueChanged( double d );
70 void mDistanceLabelPlacementComboBox_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 enum class DistanceLabelPlacement : int
85 {
86 CenteredAboveSegmentEdges,
87 CenteredAboveSegmentCenters,
88 CenteredBelowSegmentEdges,
89 CenteredBelowSegmentCenters,
90 };
91 static DistanceLabelPlacement distanceLabelPlacement( Qgis::ScaleBarDistanceLabelHorizontalPlacement horizontalPlacement, Qgis::ScaleBarDistanceLabelVerticalPlacement verticalPlacement );
92
93 QPointer<QgsLayoutItemScaleBar> mScalebar;
94 QgsLayoutItemPropertiesWidget *mItemPropertiesWidget = nullptr;
95
96 QButtonGroup mSegmentSizeRadioGroup;
97
99 void blockMemberSignals( bool enable );
100
102 void toggleStyleSpecificControls( const QString &style );
103
104 void connectUpdateSignal();
105 void disconnectUpdateSignal();
106 void populateDataDefinedButtons();
107
108 static QString linkedMapUnitsString( QgsLayoutItemScaleBar *scalebar );
109};
110
111#endif //QGSLAYOUTSCALEBARWIDGET_H
ScaleBarDistanceLabelHorizontalPlacement
Scale bar distance label horizontal placement.
Definition qgis.h:5345
ScaleBarDistanceLabelVerticalPlacement
Scale bar distance label vertical placement.
Definition qgis.h:5331
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.