GH-1731 Do not show screenshots model if it can't be set up properly

Otherwise it would show all system drives instead of screenshots.
This commit is contained in:
Petr Mrázek 2016-11-21 09:17:01 +01:00
parent ad25c89ac4
commit 95f961fb61

View File

@ -223,7 +223,6 @@ ScreenshotsPage::ScreenshotsPage(QString path, QWidget *parent)
ui->setupUi(this); ui->setupUi(this);
ui->tabWidget->tabBar()->hide(); ui->tabWidget->tabBar()->hide();
ui->listView->setModel(m_filterModel.get());
ui->listView->setIconSize(QSize(128, 128)); ui->listView->setIconSize(QSize(128, 128));
ui->listView->setGridSize(QSize(192, 160)); ui->listView->setGridSize(QSize(192, 160));
ui->listView->setSpacing(9); ui->listView->setSpacing(9);
@ -354,6 +353,7 @@ void ScreenshotsPage::opened()
{ {
if (m_valid) if (m_valid)
{ {
ui->listView->setModel(m_filterModel.get());
QString path = QDir(m_folder).absolutePath(); QString path = QDir(m_folder).absolutePath();
m_model->setRootPath(path); m_model->setRootPath(path);
ui->listView->setRootIndex(m_filterModel->mapFromSource(m_model->index(path))); ui->listView->setRootIndex(m_filterModel->mapFromSource(m_model->index(path)));