Skip to content

Commit

Permalink
Hide panels and toolbars on welcome page
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed May 27, 2019
1 parent cdbf81b commit 573d5a0
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh

connect( mMapCanvas, &QgsMapCanvas::layersChanged, this, &QgisApp::showMapCanvas );

mCentralContainer->setCurrentIndex( mProjOpen ? 0 : 1 );

// a bar to warn the user with non-blocking messages
startProfile( QStringLiteral( "Message bar" ) );
mInfoBar = new QgsMessageBar( centralWidget );
Expand Down Expand Up @@ -1490,6 +1488,32 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
{
mCentralContainer->setCurrentIndex( 0 );
} );

// As the last thing set the welcome page and restore dock and panel visibility

connect( mCentralContainer, &QStackedWidget::currentChanged, this, [ this ]( int index )
{
QgsSettings settings;

if ( index == 1 ) // welcomepage
{
if ( settings.value( QStringLiteral( "UI/allWidgetsVisible" ), true ).toBool() )
{
toggleReducedView( false );
settings.setValue( QStringLiteral( "UI/widgetsHiddenForWelcomePage" ), true );
}
}
else
{
if ( settings.value( QStringLiteral( "UI/widgetsHiddenForWelcomePage" ), false ).toBool() && !QgsSettings().value( QStringLiteral( "UI/allWidgetsVisible" ), true ).toBool() )
{
toggleReducedView( true );
}
settings.setValue( QStringLiteral( "UI/widgetsHiddenForWelcomePage" ), false );
}
} );

mCentralContainer->setCurrentIndex( 1 );
} // QgisApp ctor

QgisApp::QgisApp()
Expand Down Expand Up @@ -6777,8 +6801,8 @@ void QgisApp::toggleReducedView( bool viewMapOnly )
}
}

this->menuBar()->setVisible( false );
this->statusBar()->setVisible( false );
menuBar()->setVisible( false );
statusBar()->setVisible( false );

settings.setValue( QStringLiteral( "UI/hiddenToolBarsActive" ), toolBarsActive );
}
Expand Down Expand Up @@ -6833,8 +6857,8 @@ void QgisApp::toggleReducedView( bool viewMapOnly )
toolBar->setVisible( true );
}
}
this->menuBar()->setVisible( true );
this->statusBar()->setVisible( true );
menuBar()->setVisible( true );
statusBar()->setVisible( true );

settings.remove( QStringLiteral( "UI/hiddenToolBarsActive" ) );
settings.remove( QStringLiteral( "UI/hiddenDocksTitle" ) );
Expand Down

0 comments on commit 573d5a0

Please sign in to comment.