summaryrefslogtreecommitdiffstats
path: root/application/widgets/PageContainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'application/widgets/PageContainer.cpp')
-rw-r--r--application/widgets/PageContainer.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/application/widgets/PageContainer.cpp b/application/widgets/PageContainer.cpp
index 90aad26e..04da5c8b 100644
--- a/application/widgets/PageContainer.cpp
+++ b/application/widgets/PageContainer.cpp
@@ -60,7 +60,6 @@ PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId
createUI();
m_model = new PageModel(this);
m_proxyModel = new PageEntryFilterModel(this);
- int firstIndex = -1;
int counter = 0;
auto pages = pageProvider->getPages();
for (auto page : pages)
@@ -69,10 +68,6 @@ PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId
page->listIndex = counter;
page->setParentContainer(this);
counter++;
- if (firstIndex == -1)
- {
- firstIndex = page->stackIndex;
- }
}
m_model->setPages(pages);
@@ -111,6 +106,23 @@ bool PageContainer::selectPage(QString pageId)
return false;
}
+void PageContainer::refresh()
+{
+ m_proxyModel->invalidate();
+ if(!m_currentPage->shouldDisplay())
+ {
+ auto index = m_proxyModel->index(0, 0);
+ if(index.isValid())
+ {
+ m_pageList->setCurrentIndex(index);
+ }
+ else
+ {
+ // FIXME: unhandled corner case: what to do when there's no page to select?
+ }
+ }
+}
+
void PageContainer::createUI()
{
m_pageStack = new QStackedLayout;