Skip to content

Commit efff97f

Browse files
author
timlinux
committed
[FEATURE] show active crs in status bar. Closes #3590
git-svn-id: http://svn.osgeo.org/qgis/trunk@15447 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d877f7c commit efff97f

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

src/app/qgisapp.cpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,18 @@ void QgisApp::createStatusBar()
12501250
"to add a large number of layers and symbolize them before rendering." ) );
12511251
mRenderSuppressionCBox->setToolTip( tr( "Toggle map rendering" ) );
12521252
statusBar()->addPermanentWidget( mRenderSuppressionCBox, 0 );
1253+
// On the fly projection active CRS label
1254+
mOnTheFlyProjectionStatusLabel = new QLabel( QString(), statusBar() );
1255+
mOnTheFlyProjectionStatusLabel->setFont( myFont );
1256+
mOnTheFlyProjectionStatusLabel->setMinimumWidth( 10 );
1257+
mOnTheFlyProjectionStatusLabel->setMaximumHeight( 20 );
1258+
mOnTheFlyProjectionStatusLabel->setMargin( 3 );
1259+
mOnTheFlyProjectionStatusLabel->setAlignment( Qt::AlignCenter );
1260+
mOnTheFlyProjectionStatusLabel->setFrameStyle( QFrame::NoFrame );
1261+
QString myCrs = mMapCanvas->mapRenderer()->destinationCrs().authid();
1262+
mOnTheFlyProjectionStatusLabel->setText( myCrs );
1263+
mOnTheFlyProjectionStatusLabel->setToolTip( tr( "Current CRS" ) );
1264+
statusBar()->addPermanentWidget( mOnTheFlyProjectionStatusLabel, 0 );
12531265
// On the fly projection status bar icon
12541266
// Changed this to a tool button since a QPushButton is
12551267
// sculpted on OS X and the icon is never displayed [gsherman]
@@ -1258,15 +1270,7 @@ void QgisApp::createStatusBar()
12581270
// Maintain uniform widget height in status bar by setting button height same as labels
12591271
// For Qt/Mac 3.3, the default toolbutton height is 30 and labels were expanding to match
12601272
mOnTheFlyProjectionStatusButton->setMaximumHeight( mScaleLabel->height() );
1261-
mOnTheFlyProjectionStatusButton->setIcon( getThemeIcon( "mIconProjectionDisabled.png" ) );
1262-
if ( !QFile::exists( QgsApplication::defaultThemePath() + "/mIconProjectionDisabled.png" ) )
1263-
{
1264-
QMessageBox::critical( this, tr( "Resource Location Error" ),
1265-
tr( "Error reading icon resources from: \n %1\n Quitting..." ).arg(
1266-
QgsApplication::defaultThemePath() + "/mIconProjectionDisabled.png"
1267-
) );
1268-
exit( 0 );
1269-
}
1273+
mOnTheFlyProjectionStatusButton->setIcon( getThemeIcon( "mIconProjectionEnabled.png" ) );
12701274
mOnTheFlyProjectionStatusButton->setWhatsThis( tr( "This icon shows whether "
12711275
"on the fly coordinate reference system transformation is enabled or not. "
12721276
"Click the icon to bring up "
@@ -2512,11 +2516,14 @@ void QgisApp::fileNew( bool thePromptToSaveFlag )
25122516
// enable OTF CRS transformation if necessary
25132517
if ( settings.value( "/Projections/otfTransformEnabled", 0 ).toBool() )
25142518
{
2519+
QString myCrs = mMapCanvas->mapRenderer()->destinationCrs().authid();
2520+
mOnTheFlyProjectionStatusLabel->setText( myCrs );
25152521
myRenderer->setProjectionsEnabled( true );
25162522
mOnTheFlyProjectionStatusButton->setIcon( getThemeIcon( "mIconProjectionEnabled.png" ) );
25172523
}
25182524
else
25192525
{
2526+
mOnTheFlyProjectionStatusLabel->setText( "---" );
25202527
myRenderer->setProjectionsEnabled( false );
25212528
}
25222529

@@ -5372,11 +5379,14 @@ void QgisApp::hasCrsTransformEnabled( bool theFlag )
53725379
// update icon
53735380
if ( theFlag )
53745381
{
5382+
QString myCrs = mMapCanvas->mapRenderer()->destinationCrs().authid();
5383+
mOnTheFlyProjectionStatusLabel->setText( myCrs );
53755384
mOnTheFlyProjectionStatusButton->setIcon(
5376-
getThemeIcon( "mIconProjectionEnabled.png" ) );
5385+
getThemeIcon( "mIconProjectionEnabled.png" ) );
53775386
}
53785387
else
53795388
{
5389+
mOnTheFlyProjectionStatusLabel->setText( "---" );
53805390
mOnTheFlyProjectionStatusButton->setIcon(
53815391
getThemeIcon( "mIconProjectionDisabled.png" ) );
53825392
}

src/app/qgisapp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
963963
QToolButton * mToggleExtentsViewButton;
964964
//! Button used to stop rendering
965965
QToolButton* mStopRenderButton;
966+
//! Widget in status bar used to show current project CRS
967+
QLabel * mOnTheFlyProjectionStatusLabel;
966968
//! Widget in status bar used to show status of on the fly projection
967969
QToolButton * mOnTheFlyProjectionStatusButton;
968970
//! Popup menu

0 commit comments

Comments
 (0)