Commit 52d6c091 authored by Tobias Hunger (external)'s avatar Tobias Hunger (external) Committed by Tobias Hunger
Browse files

JsonWizard: Allow to delegate accept/reject to the current page



Change-Id: I1d2826159ce1cd4f531a576720b9ba6f204d15fb
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent bbf2d599
......@@ -70,4 +70,14 @@ void WizardPage::registerFieldWithName(const QString &name, QWidget *widget,
registerField(name, widget, property, changedSignal);
}
bool WizardPage::handleReject()
{
return false;
}
bool WizardPage::handleAccept()
{
return false;
}
} // namespace Utils
......@@ -52,6 +52,9 @@ public:
void registerFieldWithName(const QString &name, QWidget *widget,
const char *property = 0, const char *changedSignal = 0);
virtual bool handleReject();
virtual bool handleAccept();
signals:
// Emitted when there is something that the developer using this page should be aware of.
void reportError(const QString &errorMessage);
......
......@@ -176,6 +176,10 @@ void JsonWizard::removeAttributeFromAllFiles(Core::GeneratedFile::Attribute a)
void JsonWizard::accept()
{
auto page = qobject_cast<Utils::WizardPage *>(currentPage());
if (page && page->handleAccept())
return;
Utils::Wizard::accept();
QString errorMessage;
......@@ -231,6 +235,15 @@ void JsonWizard::accept()
openFiles(m_files);
}
void JsonWizard::reject()
{
auto page = qobject_cast<Utils::WizardPage *>(currentPage());
if (page && page->handleReject())
return;
Utils::Wizard::reject();
}
void JsonWizard::handleNewPages(int pageId)
{
Utils::WizardPage *wp = qobject_cast<Utils::WizardPage *>(page(pageId));
......
......@@ -95,6 +95,7 @@ signals:
public slots:
void accept();
void reject();
private slots:
void handleNewPages(int pageId);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment