Skip to content

Commit 77be1ce

Browse files
committedFeb 21, 2018
only change size when difference > 4
to avoid the flickering
1 parent ee1f408 commit 77be1ce

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed
 

‎src/app/qgsstatusbarcoordinateswidget.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,12 @@ void QgsStatusBarCoordinatesWidget::showMouseCoordinates( const QgsPointXY &p )
226226
mMousePrecisionDecimalPlaces ) );
227227

228228
//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+
}
231235
}
232236

233237

@@ -242,7 +246,12 @@ void QgsStatusBarCoordinatesWidget::showExtent()
242246
QgsRectangle myExtents = mMapCanvas->extent();
243247
mLabel->setText( tr( "Extents:" ) );
244248
mLineEdit->setText( myExtents.toString( true ) );
249+
245250
//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+
}
248257
}

0 commit comments

Comments
 (0)