Skip to content
Permalink
Browse files

only change size when difference > 4

to avoid the flickering
  • Loading branch information
signedav committed Feb 21, 2018
1 parent ee1f408 commit 77be1ceebe42d08b36d76c16d38f27f206e6432f
Showing with 13 additions and 4 deletions.
  1. +13 −4 src/app/qgsstatusbarcoordinateswidget.cpp
@@ -226,8 +226,12 @@ void QgsStatusBarCoordinatesWidget::showMouseCoordinates( const QgsPointXY &p )
mMousePrecisionDecimalPlaces ) );

//ensure the label is big (and small) enough
mLineEdit->setMinimumWidth( mLineEdit->fontMetrics().width( mLineEdit->text() ) + 10 );
mLineEdit->setMaximumWidth( mLineEdit->fontMetrics().width( mLineEdit->text() ) + 10 );
int width = mLineEdit->fontMetrics().width( mLineEdit->text() ) + 10;
if( mLineEdit->minimumWidth()+4 < width || mLineEdit->minimumWidth()-4 > width )
{
mLineEdit->setMinimumWidth( width );
mLineEdit->setMaximumWidth( width );
}
}


@@ -242,7 +246,12 @@ void QgsStatusBarCoordinatesWidget::showExtent()
QgsRectangle myExtents = mMapCanvas->extent();
mLabel->setText( tr( "Extents:" ) );
mLineEdit->setText( myExtents.toString( true ) );

//ensure the label is big (and small) enough
mLineEdit->setMinimumWidth( mLineEdit->fontMetrics().width( mLineEdit->text() ) + 10 );
mLineEdit->setMaximumWidth( mLineEdit->fontMetrics().width( mLineEdit->text() ) + 10 );
int width = mLineEdit->fontMetrics().width( mLineEdit->text() ) + 10;
if( mLineEdit->minimumWidth()+4 < width || mLineEdit->minimumWidth()-4 > width )
{
mLineEdit->setMinimumWidth( width );
mLineEdit->setMaximumWidth( width );
}
}

0 comments on commit 77be1ce

Please sign in to comment.
You can’t perform that action at this time.