/
qgslayoutscalebarwidget.h
91 lines (74 loc) · 3.69 KB
/
qgslayoutscalebarwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/***************************************************************************
qgslayoutscalebarwidget.h
---------------------------
begin : 11 June 2008
copyright : (C) 2008 by Marco Hugentobler
email : marco dot hugentobler at karto dot baug dot ethz dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSLAYOUTSCALEBARWIDGET_H
#define QGSLAYOUTSCALEBARWIDGET_H
#include "ui_qgslayoutscalebarwidgetbase.h"
#include "qgslayoutitemwidget.h"
#include <QButtonGroup>
class QgsLayoutItemScaleBar;
/**
* \ingroup app
* A widget to define the properties of a QgsLayoutItemScaleBar.
*/
class QgsLayoutScaleBarWidget: public QgsLayoutItemBaseWidget, public QgsExpressionContextGenerator, private Ui::QgsLayoutScaleBarWidgetBase
{
Q_OBJECT
public:
explicit QgsLayoutScaleBarWidget( QgsLayoutItemScaleBar *scaleBar );
void setMasterLayout( QgsMasterLayoutInterface *masterLayout ) override;
QgsExpressionContext createExpressionContext() const override;
protected:
bool setNewItem( QgsLayoutItem *item ) override;
public slots:
void mHeightSpinBox_valueChanged( double d );
void mLineWidthSpinBox_valueChanged( double d );
void mSegmentSizeSpinBox_valueChanged( double d );
void mSegmentsLeftSpinBox_valueChanged( int i );
void mNumberOfSegmentsSpinBox_valueChanged( int i );
void mUnitLabelLineEdit_textChanged( const QString &text );
void mMapUnitsPerBarUnitSpinBox_valueChanged( double d );
void mFillColorButton_colorChanged( const QColor &newColor );
void mFillColor2Button_colorChanged( const QColor &newColor );
void mStrokeColorButton_colorChanged( const QColor &newColor );
void mStyleComboBox_currentIndexChanged( const QString &text );
void mLabelBarSpaceSpinBox_valueChanged( double d );
void mBoxSizeSpinBox_valueChanged( double d );
void mLabelVerticalPlacementComboBox_currentIndexChanged( int index );
void mLabelHorizontalPlacementComboBox_currentIndexChanged( int index );
void alignmentChanged();
void mUnitsComboBox_currentIndexChanged( int index );
void mLineJoinStyleCombo_currentIndexChanged( int index );
void mLineCapStyleCombo_currentIndexChanged( int index );
void mMinWidthSpinBox_valueChanged( double d );
void mMaxWidthSpinBox_valueChanged( double d );
private slots:
void setGuiElements();
void segmentSizeRadioChanged( QAbstractButton *radio );
void mapChanged( QgsLayoutItem *item );
void textFormatChanged();
void changeNumberFormat();
private:
QPointer< QgsLayoutItemScaleBar > mScalebar;
QgsLayoutItemPropertiesWidget *mItemPropertiesWidget = nullptr;
QButtonGroup mSegmentSizeRadioGroup;
//! Enables/disables the signals of the input gui elements
void blockMemberSignals( bool enable );
//! Enables/disables controls based on scale bar style
void toggleStyleSpecificControls( const QString &style );
void connectUpdateSignal();
void disconnectUpdateSignal();
};
#endif //QGSLAYOUTSCALEBARWIDGET_H