File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -226,8 +226,12 @@ void QgsStatusBarCoordinatesWidget::showMouseCoordinates( const QgsPointXY &p )
226
226
mMousePrecisionDecimalPlaces ) );
227
227
228
228
// ensure the label is big (and small) enough
229
- mLineEdit ->setMinimumWidth ( mLineEdit ->fontMetrics ().width ( mLineEdit ->text () ) + 10 );
230
- mLineEdit ->setMaximumWidth ( mLineEdit ->fontMetrics ().width ( mLineEdit ->text () ) + 10 );
229
+ int width = mLineEdit ->fontMetrics ().width ( mLineEdit ->text () ) + 10 ;
230
+ if ( mLineEdit ->minimumWidth ()+4 < width || mLineEdit ->minimumWidth ()-4 > width )
231
+ {
232
+ mLineEdit ->setMinimumWidth ( width );
233
+ mLineEdit ->setMaximumWidth ( width );
234
+ }
231
235
}
232
236
233
237
@@ -242,7 +246,12 @@ void QgsStatusBarCoordinatesWidget::showExtent()
242
246
QgsRectangle myExtents = mMapCanvas ->extent ();
243
247
mLabel ->setText ( tr ( " Extents:" ) );
244
248
mLineEdit ->setText ( myExtents.toString ( true ) );
249
+
245
250
// ensure the label is big (and small) enough
246
- mLineEdit ->setMinimumWidth ( mLineEdit ->fontMetrics ().width ( mLineEdit ->text () ) + 10 );
247
- mLineEdit ->setMaximumWidth ( mLineEdit ->fontMetrics ().width ( mLineEdit ->text () ) + 10 );
251
+ int width = mLineEdit ->fontMetrics ().width ( mLineEdit ->text () ) + 10 ;
252
+ if ( mLineEdit ->minimumWidth ()+4 < width || mLineEdit ->minimumWidth ()-4 > width )
253
+ {
254
+ mLineEdit ->setMinimumWidth ( width );
255
+ mLineEdit ->setMaximumWidth ( width );
256
+ }
248
257
}
You can’t perform that action at this time.
0 commit comments