summaryrefslogtreecommitdiff
path: root/src/libs/utils/wizard.cpp
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@digia.com>2014-08-25 17:21:49 +0200
committerTobias Hunger <tobias.hunger@digia.com>2014-09-10 14:07:15 +0200
commit8e18fd08a294116287289ed6039a964872d55395 (patch)
tree52027aa4a486ec2f6df1840275fb312d29b3105e /src/libs/utils/wizard.cpp
parentbe9e4d71b3c81edf974f3aaf48d72b33ba9177b7 (diff)
downloadqt-creator-8e18fd08a294116287289ed6039a964872d55395.tar.gz
Utils: Make wizard pages derive from Utils::WizardPage
Utils::WizardPage has a bit of helper code to the Utils::Wizard to query registered fields later on. Without this code it will print warnings whenever something tries to read a field that does not exist. Make the wizard pages defined in Utils export some fields. Change-Id: I907be327a8b1b8691f90773470630582503d294a Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/libs/utils/wizard.cpp')
-rw-r--r--src/libs/utils/wizard.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/libs/utils/wizard.cpp b/src/libs/utils/wizard.cpp
index ed534716d4..95ecbb8a4d 100644
--- a/src/libs/utils/wizard.cpp
+++ b/src/libs/utils/wizard.cpp
@@ -28,13 +28,16 @@
****************************************************************************/
#include "wizard.h"
+
#include "hostosinfo.h"
+#include "qtcassert.h"
+#include "wizardpage.h"
#include <QHash>
+#include <QIcon>
#include <QKeyEvent>
#include <QLabel>
#include <QMap>
-#include <QStyle>
#include <QVBoxLayout>
#include <QVariant>
@@ -310,6 +313,7 @@ public:
}
bool m_automaticProgressCreation;
WizardProgress *m_wizardProgress;
+ QSet<QString> m_fieldNames;
};
Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags) :
@@ -377,6 +381,17 @@ bool Wizard::validateCurrentPage()
return QWizard::validateCurrentPage();
}
+bool Wizard::hasField(const QString &name) const
+{
+ return d_ptr->m_fieldNames.contains(name);
+}
+
+void Wizard::registerFieldName(const QString &name)
+{
+ QTC_ASSERT(!hasField(name), return);
+ d_ptr->m_fieldNames.insert(name);
+}
+
bool Wizard::event(QEvent *event)
{
if (event->type() == QEvent::ShortcutOverride) {
@@ -400,10 +415,14 @@ void Wizard::_q_pageAdded(int pageId)
{
Q_D(Wizard);
+ QWizardPage *p = page(pageId);
+ WizardPage *wp = qobject_cast<WizardPage *>(p);
+ if (wp)
+ wp->pageWasAdded();
+
if (!d->m_automaticProgressCreation)
return;
- QWizardPage *p = page(pageId);
QVariant property = p->property(SHORT_TITLE_PROPERTY);
const QString title = property.isNull() ? p->title() : property.toString();
WizardProgressItem *item = d->m_wizardProgress->addItem(title);