Skip to content

Commit

Permalink
[FEATURE] show active crs in status bar. Closes #3590
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@15447 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Mar 12, 2011
1 parent d877f7c commit efff97f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/app/qgisapp.cpp
Expand Up @@ -1250,6 +1250,18 @@ void QgisApp::createStatusBar()
"to add a large number of layers and symbolize them before rendering." ) );
mRenderSuppressionCBox->setToolTip( tr( "Toggle map rendering" ) );
statusBar()->addPermanentWidget( mRenderSuppressionCBox, 0 );
// On the fly projection active CRS label
mOnTheFlyProjectionStatusLabel = new QLabel( QString(), statusBar() );
mOnTheFlyProjectionStatusLabel->setFont( myFont );
mOnTheFlyProjectionStatusLabel->setMinimumWidth( 10 );
mOnTheFlyProjectionStatusLabel->setMaximumHeight( 20 );
mOnTheFlyProjectionStatusLabel->setMargin( 3 );
mOnTheFlyProjectionStatusLabel->setAlignment( Qt::AlignCenter );
mOnTheFlyProjectionStatusLabel->setFrameStyle( QFrame::NoFrame );
QString myCrs = mMapCanvas->mapRenderer()->destinationCrs().authid();
mOnTheFlyProjectionStatusLabel->setText( myCrs );
mOnTheFlyProjectionStatusLabel->setToolTip( tr( "Current CRS" ) );
statusBar()->addPermanentWidget( mOnTheFlyProjectionStatusLabel, 0 );
// On the fly projection status bar icon
// Changed this to a tool button since a QPushButton is
// sculpted on OS X and the icon is never displayed [gsherman]
Expand All @@ -1258,15 +1270,7 @@ void QgisApp::createStatusBar()
// Maintain uniform widget height in status bar by setting button height same as labels
// For Qt/Mac 3.3, the default toolbutton height is 30 and labels were expanding to match
mOnTheFlyProjectionStatusButton->setMaximumHeight( mScaleLabel->height() );
mOnTheFlyProjectionStatusButton->setIcon( getThemeIcon( "mIconProjectionDisabled.png" ) );
if ( !QFile::exists( QgsApplication::defaultThemePath() + "/mIconProjectionDisabled.png" ) )
{
QMessageBox::critical( this, tr( "Resource Location Error" ),
tr( "Error reading icon resources from: \n %1\n Quitting..." ).arg(
QgsApplication::defaultThemePath() + "/mIconProjectionDisabled.png"
) );
exit( 0 );
}
mOnTheFlyProjectionStatusButton->setIcon( getThemeIcon( "mIconProjectionEnabled.png" ) );
mOnTheFlyProjectionStatusButton->setWhatsThis( tr( "This icon shows whether "
"on the fly coordinate reference system transformation is enabled or not. "
"Click the icon to bring up "
Expand Down Expand Up @@ -2512,11 +2516,14 @@ void QgisApp::fileNew( bool thePromptToSaveFlag )
// enable OTF CRS transformation if necessary
if ( settings.value( "/Projections/otfTransformEnabled", 0 ).toBool() )
{
QString myCrs = mMapCanvas->mapRenderer()->destinationCrs().authid();
mOnTheFlyProjectionStatusLabel->setText( myCrs );
myRenderer->setProjectionsEnabled( true );
mOnTheFlyProjectionStatusButton->setIcon( getThemeIcon( "mIconProjectionEnabled.png" ) );
}
else
{
mOnTheFlyProjectionStatusLabel->setText( "---" );
myRenderer->setProjectionsEnabled( false );
}

Expand Down Expand Up @@ -5372,11 +5379,14 @@ void QgisApp::hasCrsTransformEnabled( bool theFlag )
// update icon
if ( theFlag )
{
QString myCrs = mMapCanvas->mapRenderer()->destinationCrs().authid();
mOnTheFlyProjectionStatusLabel->setText( myCrs );
mOnTheFlyProjectionStatusButton->setIcon(
getThemeIcon( "mIconProjectionEnabled.png" ) );
getThemeIcon( "mIconProjectionEnabled.png" ) );
}
else
{
mOnTheFlyProjectionStatusLabel->setText( "---" );
mOnTheFlyProjectionStatusButton->setIcon(
getThemeIcon( "mIconProjectionDisabled.png" ) );
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgisapp.h
Expand Up @@ -963,6 +963,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QToolButton * mToggleExtentsViewButton;
//! Button used to stop rendering
QToolButton* mStopRenderButton;
//! Widget in status bar used to show current project CRS
QLabel * mOnTheFlyProjectionStatusLabel;
//! Widget in status bar used to show status of on the fly projection
QToolButton * mOnTheFlyProjectionStatusButton;
//! Popup menu
Expand Down

0 comments on commit efff97f

Please sign in to comment.