QGIS API Documentation 3.39.0-Master (3aed037ce22)
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 "qgis_gui.h"
24#include "ui_qgslayoutscalebarwidgetbase.h"
25#include "qgslayoutitemwidget.h"
26
27#include <QButtonGroup>
28
30
38class GUI_EXPORT QgsLayoutScaleBarWidget: public QgsLayoutItemBaseWidget, public QgsExpressionContextGenerator, private Ui::QgsLayoutScaleBarWidgetBase
39{
40 Q_OBJECT
41
42 public:
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 mDistanceLabelPlacementComboBox_currentIndexChanged( int index );
70 void alignmentChanged();
71 void mUnitsComboBox_currentIndexChanged( int index );
72 void mMinWidthSpinBox_valueChanged( double d );
73 void mMaxWidthSpinBox_valueChanged( double d );
74
75 private slots:
76 void setGuiElements();
77 void segmentSizeRadioChanged( QAbstractButton *radio );
78 void mapChanged( QgsLayoutItem *item );
79 void textFormatChanged();
80 void changeNumberFormat();
81
82 private:
83 enum class DistanceLabelPlacement : int
84 {
85 CenteredAboveSegmentEdges,
86 CenteredAboveSegmentCenters,
87 CenteredBelowSegmentEdges,
88 CenteredBelowSegmentCenters,
89 };
90 static DistanceLabelPlacement distanceLabelPlacement( Qgis::ScaleBarDistanceLabelHorizontalPlacement horizontalPlacement, Qgis::ScaleBarDistanceLabelVerticalPlacement verticalPlacement );
91
92 QPointer< QgsLayoutItemScaleBar > mScalebar;
93 QgsLayoutItemPropertiesWidget *mItemPropertiesWidget = nullptr;
94
95 QButtonGroup mSegmentSizeRadioGroup;
96
98 void blockMemberSignals( bool enable );
99
101 void toggleStyleSpecificControls( const QString &style );
102
103 void connectUpdateSignal();
104 void disconnectUpdateSignal();
105 void populateDataDefinedButtons();
106
107};
108
109#endif //QGSLAYOUTSCALEBARWIDGET_H
ScaleBarDistanceLabelHorizontalPlacement
Scale bar distance label horizontal placement.
Definition qgis.h:4706
ScaleBarDistanceLabelVerticalPlacement
Scale bar distance label vertical placement.
Definition qgis.h:4692
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.