@@ -56,9 +56,9 @@ QgsWelcomePage::QgsWelcomePage( bool skipVersionCheck, QWidget *parent )
56
56
centerLayout->setMargin ( 0 );
57
57
58
58
int titleSize = static_cast <int >( QApplication::fontMetrics ().height () * 1.4 );
59
- QLabel *recentProjectsTitle = new QLabel ( QStringLiteral ( " <div style='font-size:%1px;font-weight:bold'>%2</div>" ).arg ( QString::number ( titleSize ), tr ( " Recent Projects" ) ) );
60
- recentProjectsTitle ->setContentsMargins ( titleSize / 2 , titleSize / 6 , 0 , 0 );
61
- centerLayout->addWidget ( recentProjectsTitle , 0 , 0 );
59
+ mRecentProjectsTitle = new QLabel ( QStringLiteral ( " <div style='font-size:%1px;font-weight:bold'>%2</div>" ).arg ( QString::number ( titleSize ), tr ( " Recent Projects" ) ) );
60
+ mRecentProjectsTitle ->setContentsMargins ( titleSize / 2 , titleSize / 6 , 0 , 0 );
61
+ centerLayout->addWidget ( mRecentProjectsTitle , 0 , 0 );
62
62
63
63
mRecentProjectsListView = new QListView ();
64
64
mRecentProjectsListView ->setResizeMode ( QListView::Adjust );
@@ -121,6 +121,7 @@ QgsWelcomePage::~QgsWelcomePage()
121
121
void QgsWelcomePage::setRecentProjects ( const QList<QgsRecentProjectItemsModel::RecentProjectData> &recentProjects )
122
122
{
123
123
mRecentProjectsModel ->setRecentProjects ( recentProjects );
124
+ updateRecentProjectsVisibility ();
124
125
}
125
126
126
127
void QgsWelcomePage::recentProjectItemActivated ( const QModelIndex &index )
@@ -255,3 +256,10 @@ void QgsWelcomePage::showContextMenuForTemplates( QPoint point )
255
256
256
257
menu->popup ( mTemplateProjectsListView ->mapToGlobal ( point ) );
257
258
}
259
+
260
+ void QgsWelcomePage::updateRecentProjectsVisibility ()
261
+ {
262
+ bool visible = mRecentProjectsModel ->rowCount () > 0 ;
263
+ mRecentProjectsListView ->setVisible ( visible );
264
+ mRecentProjectsTitle ->setVisible ( visible );
265
+ }
0 commit comments