Skip to content

Commit 100a609

Browse files
committedAug 26, 2015
Use tab widget for welcome page. Move init to start of app
1 parent 686fb71 commit 100a609

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,16 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
582582
int myBlue = settings.value( "/qgis/default_canvas_color_blue", 255 ).toInt();
583583
mMapCanvas->setCanvasColor( QColor( myRed, myGreen, myBlue ) );
584584

585-
centralLayout->addWidget( mMapCanvas, 0, 0, 2, 1 );
585+
mWelcomePage = new QgsWelcomePage;
586+
587+
mCentralContainer = new QStackedWidget;
588+
mCentralContainer->insertWidget( 0, mMapCanvas );
589+
mCentralContainer->insertWidget( 1, mWelcomePage );
590+
591+
qobject_cast<QGridLayout *>( centralWidget->layout() )->addWidget( mCentralContainer, 0, 0, 2, 1 );
592+
593+
mCentralContainer->setCurrentIndex( 1 );
594+
586595

587596
// a bar to warn the user with non-blocking messages
588597
mInfoBar = new QgsMessageBar( centralWidget );
@@ -3913,19 +3922,8 @@ void QgisApp::fileOpenAfterLaunch()
39133922
QString projPath = QString();
39143923
if ( projOpen == 0 ) // welcome page
39153924
{
3916-
mWelcomePage = new QgsWelcomePage;
3917-
3918-
mCentralContainer = new QStackedWidget;
3919-
mCentralContainer->insertWidget( 0, mMapCanvas );
3920-
mCentralContainer->insertWidget( 1, mWelcomePage );
3921-
39223925
connect( mMapCanvas, SIGNAL( layersChanged() ), this, SLOT( showMapCanvas() ) );
39233926
connect( this, SIGNAL( newProject() ), this, SLOT( showMapCanvas() ) );
3924-
3925-
qobject_cast<QGridLayout *>( centralWidget()->layout() )->addWidget( mCentralContainer, 0, 0, 2, 1 );
3926-
3927-
mCentralContainer->setCurrentIndex( 1 );
3928-
39293927
return;
39303928
}
39313929
if ( projOpen == 1 && mRecentProjects.size() > 0 ) // most recent project

‎src/app/qgswelcomepage.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <QDesktopServices>
2727

2828
QgsWelcomePage::QgsWelcomePage( QWidget* parent )
29-
: QWidget( parent )
29+
: QTabWidget( parent )
3030
{
3131
QVBoxLayout* mainLayout = new QVBoxLayout;
3232
mainLayout->setMargin( 0 );
@@ -62,7 +62,7 @@ QgsWelcomePage::QgsWelcomePage( QWidget* parent )
6262

6363
recentProjctsContainer->layout()->addWidget( recentProjectsListView );
6464

65-
layout->addWidget( recentProjctsContainer );
65+
addTab( recentProjctsContainer, "Recent Projects" );
6666

6767
QWidget* whatsNewContainer = new QWidget;
6868
whatsNewContainer->setLayout( new QVBoxLayout );
@@ -73,14 +73,14 @@ QgsWelcomePage::QgsWelcomePage( QWidget* parent )
7373
whatsNewPage->setUrl( QUrl::fromLocalFile( QgsApplication::whatsNewFilePath() ) );
7474
whatsNewPage->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
7575
whatsNewPage->setContextMenuPolicy( Qt::NoContextMenu );
76-
whatsNewPage->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
76+
whatsNewPage->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
7777
whatsNewPage->setStyleSheet( "background:transparent" );
7878
whatsNewPage->setAttribute( Qt::WA_TranslucentBackground );
7979

8080
whatsNewContainer->layout()->addWidget( whatsNewPage );
81-
whatsNewContainer->setMaximumWidth( 250 );
82-
whatsNewContainer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
83-
layout->addWidget( whatsNewContainer );
81+
// whatsNewContainer->setMaximumWidth( 250 );
82+
// whatsNewContainer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
83+
addTab( whatsNewContainer, "News" );
8484

8585
connect( whatsNewPage, SIGNAL( linkClicked( QUrl ) ), this, SLOT( whatsNewLinkClicked( QUrl ) ) );
8686

‎src/app/qgswelcomepage.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
#ifndef QGSWELCOMEDIALOG_H
1717
#define QGSWELCOMEDIALOG_H
1818

19+
#include <QTabWidget>
1920
#include <QWidget>
2021
#include <QLabel>
2122

2223
#include "qgswelcomepageitemsmodel.h"
2324

24-
class QgsWelcomePage : public QWidget
25+
class QgsWelcomePage : public QTabWidget
2526
{
2627
Q_OBJECT
2728

0 commit comments

Comments
 (0)
Failed to load comments.