feat: add PageContainer::getPage

This allows us to directly access a page from outside. This will be
useful for telling the ManagedPackPage who is the window it's on, so
that we can close it when updating :^)

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-10-14 14:09:41 -03:00
parent 1c567232e3
commit 9e17ff884f
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469
3 changed files with 9 additions and 0 deletions

View File

@ -1,10 +1,13 @@
#pragma once #pragma once
class BasePage;
class BasePageContainer class BasePageContainer
{ {
public: public:
virtual ~BasePageContainer(){}; virtual ~BasePageContainer(){};
virtual bool selectPage(QString pageId) = 0; virtual bool selectPage(QString pageId) = 0;
virtual BasePage* getPage(QString pageId) { return nullptr; };
virtual void refreshContainer() = 0; virtual void refreshContainer() = 0;
virtual bool requestClose() = 0; virtual bool requestClose() = 0;
}; };

View File

@ -130,6 +130,11 @@ bool PageContainer::selectPage(QString pageId)
return false; return false;
} }
BasePage* PageContainer::getPage(QString pageId)
{
return m_model->findPageEntryById(pageId);
}
void PageContainer::refreshContainer() void PageContainer::refreshContainer()
{ {
m_proxyModel->invalidate(); m_proxyModel->invalidate();

View File

@ -79,6 +79,7 @@ public:
} }
virtual bool selectPage(QString pageId) override; virtual bool selectPage(QString pageId) override;
BasePage* getPage(QString pageId) override;
void refreshContainer() override; void refreshContainer() override;
virtual void setParentContainer(BasePageContainer * container) virtual void setParentContainer(BasePageContainer * container)