File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ QgsStatusBarCoordinatesWidget::QgsStatusBarCoordinatesWidget( QWidget *parent )
35
35
{
36
36
// calculate the size of two chars
37
37
mTwoCharSize = fontMetrics ().width ( QStringLiteral ( " OO" ) );
38
+ mMinimumWidth = mTwoCharSize * 4 ;
38
39
39
40
// add a label to show current position
40
41
mLabel = new QLabel ( QString (), this );
@@ -251,7 +252,7 @@ void QgsStatusBarCoordinatesWidget::ensureCoordinatesVisible()
251
252
{
252
253
253
254
// ensure the label is big (and small) enough
254
- int width = mLineEdit ->fontMetrics ().width ( mLineEdit ->text () ) + 10 ;
255
+ int width = std::max ( mLineEdit ->fontMetrics ().width ( mLineEdit ->text () ) + 10 , mMinimumWidth ) ;
255
256
if ( mLineEdit ->minimumWidth () < width || ( mLineEdit ->minimumWidth () - width ) > mTwoCharSize )
256
257
{
257
258
mLineEdit ->setMinimumWidth ( width );
Original file line number Diff line number Diff line change @@ -72,7 +72,8 @@ class APP_EXPORT QgsStatusBarCoordinatesWidget : public QWidget
72
72
QValidator *mCoordsEditValidator = nullptr ;
73
73
QTimer *mDizzyTimer = nullptr ;
74
74
QgsMapCanvas *mMapCanvas = nullptr ;
75
- int mTwoCharSize ;
75
+ int mTwoCharSize = 0 ;
76
+ int mMinimumWidth = 0 ;
76
77
77
78
// ! The number of decimal places to use if not automatic
78
79
unsigned int mMousePrecisionDecimalPlaces ;
You can’t perform that action at this time.
0 commit comments