forked from qt-creator/qt-creator
JsonWizard: Allow to delegate accept/reject to the current page
Change-Id: I1d2826159ce1cd4f531a576720b9ba6f204d15fb Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
Tobias Hunger
parent
bbf2d59981
commit
52d6c09183
@@ -70,4 +70,14 @@ void WizardPage::registerFieldWithName(const QString &name, QWidget *widget,
|
|||||||
registerField(name, widget, property, changedSignal);
|
registerField(name, widget, property, changedSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WizardPage::handleReject()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WizardPage::handleAccept()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ public:
|
|||||||
void registerFieldWithName(const QString &name, QWidget *widget,
|
void registerFieldWithName(const QString &name, QWidget *widget,
|
||||||
const char *property = 0, const char *changedSignal = 0);
|
const char *property = 0, const char *changedSignal = 0);
|
||||||
|
|
||||||
|
virtual bool handleReject();
|
||||||
|
virtual bool handleAccept();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// Emitted when there is something that the developer using this page should be aware of.
|
// Emitted when there is something that the developer using this page should be aware of.
|
||||||
void reportError(const QString &errorMessage);
|
void reportError(const QString &errorMessage);
|
||||||
|
|||||||
@@ -176,6 +176,10 @@ void JsonWizard::removeAttributeFromAllFiles(Core::GeneratedFile::Attribute a)
|
|||||||
|
|
||||||
void JsonWizard::accept()
|
void JsonWizard::accept()
|
||||||
{
|
{
|
||||||
|
auto page = qobject_cast<Utils::WizardPage *>(currentPage());
|
||||||
|
if (page && page->handleAccept())
|
||||||
|
return;
|
||||||
|
|
||||||
Utils::Wizard::accept();
|
Utils::Wizard::accept();
|
||||||
|
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
@@ -231,6 +235,15 @@ void JsonWizard::accept()
|
|||||||
openFiles(m_files);
|
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)
|
void JsonWizard::handleNewPages(int pageId)
|
||||||
{
|
{
|
||||||
Utils::WizardPage *wp = qobject_cast<Utils::WizardPage *>(page(pageId));
|
Utils::WizardPage *wp = qobject_cast<Utils::WizardPage *>(page(pageId));
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ signals:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void accept();
|
void accept();
|
||||||
|
void reject();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleNewPages(int pageId);
|
void handleNewPages(int pageId);
|
||||||
|
|||||||
Reference in New Issue
Block a user