Skip to content
Permalink
Browse files

only decrease when larger than two signs

and increase always. but decrease again only when more than the size of "00" difference.
  • Loading branch information
signedav committed Feb 21, 2018
1 parent ffd1e4b commit f17ba6bc29ff52e51e33f2733fa1573809fa8a3b
Showing with 9 additions and 8 deletions.
  1. +8 −8 src/app/qgsstatusbarcoordinateswidget.cpp
  2. +1 −0 src/app/qgsstatusbarcoordinateswidget.h
@@ -225,13 +225,7 @@ void QgsStatusBarCoordinatesWidget::showMouseCoordinates( const QgsPointXY &p )
mLineEdit->setText( QgsCoordinateUtils::formatCoordinateForProject( p, mMapCanvas->mapSettings().destinationCrs(),
mMousePrecisionDecimalPlaces ) );

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


@@ -247,11 +241,17 @@ void QgsStatusBarCoordinatesWidget::showExtent()
mLabel->setText( tr( "Extents:" ) );
mLineEdit->setText( myExtents.toString( true ) );

ensureCoordinatesVisible();
}

void QgsStatusBarCoordinatesWidget::ensureCoordinatesVisible(){

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

@@ -59,6 +59,7 @@ class APP_EXPORT QgsStatusBarCoordinatesWidget : public QWidget
void validateCoordinates();
void dizzy();
void showExtent();
void ensureCoordinatesVisible();

private:
void refreshMapCanvas();

0 comments on commit f17ba6b

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