17
17
#include < QHBoxLayout>
18
18
#include < QLabel>
19
19
#include < QLineEdit>
20
- #include < QToolButton>
21
20
#include < QValidator>
22
21
23
22
#include " qgsstatusbarscalewidget.h"
@@ -49,28 +48,17 @@ QgsStatusBarScaleWidget::QgsStatusBarScaleWidget( QgsMapCanvas *canvas, QWidget
49
48
mScale ->setWhatsThis ( tr ( " Displays the current map scale" ) );
50
49
mScale ->setToolTip ( tr ( " Current map scale (formatted as x:y)" ) );
51
50
52
- mLockButton = new QToolButton ();
53
- mLockButton ->setIcon ( QIcon ( QgsApplication::getThemeIcon ( " /lockedGray.svg" ) ) );
54
- mLockButton ->setToolTip ( tr ( " Lock the scale to use magnifier to zoom in or out." ) );
55
- mLockButton ->setCheckable ( true );
56
- mLockButton ->setChecked ( false );
57
- mLockButton ->setAutoRaise ( true );
58
-
59
51
// layout
60
52
mLayout = new QHBoxLayout ( this );
61
53
mLayout ->addWidget ( mLabel );
62
54
mLayout ->addWidget ( mScale );
63
- mLayout ->addWidget ( mLockButton );
64
55
mLayout ->setContentsMargins ( 0 , 0 , 0 , 0 );
65
56
mLayout ->setAlignment ( Qt::AlignRight );
66
57
mLayout ->setSpacing ( 0 );
67
58
68
59
setLayout ( mLayout );
69
60
70
61
connect ( mScale , &QgsScaleComboBox::scaleChanged, this , &QgsStatusBarScaleWidget::userScale );
71
-
72
- connect ( mLockButton , &QAbstractButton::toggled, this , &QgsStatusBarScaleWidget::scaleLockChanged );
73
- connect ( mLockButton , &QAbstractButton::toggled, mScale , &QWidget::setDisabled );
74
62
}
75
63
76
64
void QgsStatusBarScaleWidget::setScale ( double scale )
@@ -87,7 +75,12 @@ void QgsStatusBarScaleWidget::setScale( double scale )
87
75
88
76
bool QgsStatusBarScaleWidget::isLocked () const
89
77
{
90
- return mLockButton ->isChecked ();
78
+ return !mScale ->isEnabled ();
79
+ }
80
+
81
+ void QgsStatusBarScaleWidget::setLocked ( bool state )
82
+ {
83
+ mScale ->setDisabled ( state );
91
84
}
92
85
93
86
void QgsStatusBarScaleWidget::setFont ( const QFont &font )
0 commit comments