Skip to content

Commit

Permalink
only change size when difference > 4
Browse files Browse the repository at this point in the history
to avoid the flickering
  • Loading branch information
signedav committed Feb 21, 2018
1 parent ee1f408 commit 77be1ce
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/app/qgsstatusbarcoordinateswidget.cpp
Expand Up @@ -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 );
}
}


Expand All @@ -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.