diff --git a/src/plugins/coreplugin/basefilewizard.cpp b/src/plugins/coreplugin/basefilewizard.cpp
index d65503436aea165dbc5928ca454d7ba4c863df04..9fbf83b7e84ee4733d7af2a67a623849ed8fbfaf 100644
--- a/src/plugins/coreplugin/basefilewizard.cpp
+++ b/src/plugins/coreplugin/basefilewizard.cpp
@@ -30,6 +30,136 @@
 
 #include "basefilewizard.h"
 
-Core::BaseFileWizard::BaseFileWizard(QWidget *parent) :
-    Utils::Wizard(parent)
-{ }
+#include "basefilewizardfactory.h"
+#include "ifilewizardextension.h"
+
+#include <extensionsystem/pluginmanager.h>
+
+#include <QMessageBox>
+
+using namespace Utils;
+
+namespace Core {
+
+BaseFileWizard::BaseFileWizard(const BaseFileWizardFactory *factory,
+                               const QVariantMap &extraValues,
+                               QWidget *parent) :
+    Wizard(parent),
+    m_extraValues(extraValues),
+    m_factory(factory)
+{
+    // Compile extension pages, purge out unused ones
+    QList<IFileWizardExtension *> extensionList
+            = ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>();
+
+    for (auto it = extensionList.begin(); it != extensionList.end(); ) {
+        const QList<QWizardPage *> extensionPages = (*it)->extensionPages(factory);
+        if (extensionPages.empty()) {
+            it = extensionList.erase(it);
+        } else {
+            m_extensionPages += extensionPages;
+            ++it;
+        }
+    }
+
+    if (!m_extensionPages.empty())
+        m_firstExtensionPage = m_extensionPages.front();
+}
+
+void BaseFileWizard::initializePage(int id)
+{
+    if (page(id) == m_firstExtensionPage) {
+        generateFileList();
+
+        QList<IFileWizardExtension *> extensionList
+                = ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>();
+        foreach (IFileWizardExtension *ex, extensionList)
+            ex->firstExtensionPageShown(m_files, m_extraValues);
+    }
+}
+
+QList<QWizardPage *> BaseFileWizard::extensionPages()
+{
+    return m_extensionPages;
+}
+
+void BaseFileWizard::accept()
+{
+    if (m_files.isEmpty())
+        generateFileList();
+
+    QString errorMessage;
+
+    // Compile result list and prompt for overwrite
+    switch (m_factory->promptOverwrite(&m_files, &errorMessage)) {
+    case BaseFileWizardFactory::OverwriteCanceled:
+        reject();
+        return;
+    case BaseFileWizardFactory::OverwriteError:
+        QMessageBox::critical(0, tr("Existing files"), errorMessage);
+        reject();
+        return;
+    case BaseFileWizardFactory::OverwriteOk:
+        break;
+    }
+
+    QList<IFileWizardExtension *> extensionList
+            = ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>();
+    foreach (IFileWizardExtension *ex, extensionList) {
+        for (int i = 0; i < m_files.count(); i++) {
+            ex->applyCodeStyle(&m_files[i]);
+        }
+    }
+
+    // Write
+    if (!m_factory->writeFiles(m_files, &errorMessage)) {
+        QMessageBox::critical(parentWidget(), tr("File Generation Failure"), errorMessage);
+        reject();
+        return;
+    }
+
+    bool removeOpenProjectAttribute = false;
+    // Run the extensions
+    foreach (IFileWizardExtension *ex, extensionList) {
+        bool remove;
+        if (!ex->processFiles(m_files, &remove, &errorMessage)) {
+            if (!errorMessage.isEmpty())
+                QMessageBox::critical(parentWidget(), tr("File Generation Failure"), errorMessage);
+            reject();
+            return;
+        }
+        removeOpenProjectAttribute |= remove;
+    }
+
+    if (removeOpenProjectAttribute) {
+        for (int i = 0; i < m_files.count(); i++) {
+            if (m_files[i].attributes() & GeneratedFile::OpenProjectAttribute)
+                m_files[i].setAttributes(GeneratedFile::OpenEditorAttribute);
+        }
+    }
+
+    // Post generation handler
+    if (!m_factory->postGenerateFiles(this, m_files, &errorMessage))
+        if (!errorMessage.isEmpty())
+            QMessageBox::critical(0, tr("File Generation Failure"), errorMessage);
+
+    Wizard::accept();
+}
+
+void BaseFileWizard::reject()
+{
+    m_files.clear();
+    Wizard::reject();
+}
+
+void BaseFileWizard::generateFileList()
+{
+    QString errorMessage;
+    m_files = m_factory->generateFiles(this, &errorMessage);
+    if (m_files.empty()) {
+        QMessageBox::critical(parentWidget(), tr("File Generation Failure"), errorMessage);
+        reject();
+    }
+}
+
+} // namespace Core
diff --git a/src/plugins/coreplugin/basefilewizard.h b/src/plugins/coreplugin/basefilewizard.h
index dfdc13e35701afc5606f636740d06a74c5d76ca0..846750fd34ed24bd0599cbbb016c3f60a2faef31 100644
--- a/src/plugins/coreplugin/basefilewizard.h
+++ b/src/plugins/coreplugin/basefilewizard.h
@@ -33,16 +33,39 @@
 
 #include "core_global.h"
 
+#include "generatedfile.h"
+
 #include <utils/wizard.h>
 
+#include <QVariantMap>
+
 namespace Core {
 
+class BaseFileWizardFactory;
+
 class CORE_EXPORT BaseFileWizard : public Utils::Wizard
 {
     Q_OBJECT
 
 public:
-    explicit BaseFileWizard(QWidget *parent = 0);
+    explicit BaseFileWizard(const BaseFileWizardFactory *factory, const QVariantMap &extraValues,
+                            QWidget *parent = 0);
+
+    void initializePage(int id);
+
+    QList<QWizardPage *> extensionPages();
+
+    void accept();
+    void reject();
+
+private:
+    void generateFileList();
+
+    QVariantMap m_extraValues;
+    const BaseFileWizardFactory *m_factory;
+    QList<QWizardPage *> m_extensionPages;
+    QWizardPage *m_firstExtensionPage = 0;
+    GeneratedFiles m_files;
 };
 
 } // namespace Core
diff --git a/src/plugins/coreplugin/basefilewizardfactory.cpp b/src/plugins/coreplugin/basefilewizardfactory.cpp
index 9234113dab9b5968799fc527fca14b02c8533e06..0da221b12bc63a85d4a8cd51c5e55c84d6ded263 100644
--- a/src/plugins/coreplugin/basefilewizardfactory.cpp
+++ b/src/plugins/coreplugin/basefilewizardfactory.cpp
@@ -46,12 +46,6 @@
 #include <QDir>
 #include <QFileInfo>
 #include <QDebug>
-#include <QSharedData>
-#include <QEventLoop>
-#include <QScopedPointer>
-
-#include <QMessageBox>
-#include <QWizard>
 #include <QIcon>
 
 enum { debugWizard = 0 };
@@ -67,101 +61,6 @@ static int indexOfFile(const GeneratedFiles &f, const QString &path)
     return -1;
 }
 
-/*!
-    \class Core::Internal::WizardEventLoop
-    \brief The WizardEventLoop class implements a special event
-    loop that runs a QWizard and terminates if the page changes.
-
-    Used by Core::BaseFileWizard to intercept the change from the standard wizard pages
-    to the extension pages (as the latter require the list of Core::GeneratedFile generated).
-
-    Synopsis:
-    \code
-    Wizard wizard(parent);
-    WizardEventLoop::WizardResult wr;
-    do {
-        wr = WizardEventLoop::execWizardPage(wizard);
-    } while (wr == WizardEventLoop::PageChanged);
-    \endcode
-
-    \sa Core::GeneratedFile, Core::BaseFileWizardParameters, Core::BaseFileWizard, Core::StandardFileWizard
-*/
-
-class WizardEventLoop : public QEventLoop
-{
-    Q_OBJECT
-    WizardEventLoop(QObject *parent);
-
-public:
-    enum WizardResult { Accepted, Rejected , PageChanged };
-
-    static WizardResult execWizardPage(QWizard &w);
-
-private slots:
-    void pageChanged(int);
-    void accepted();
-    void rejected();
-
-private:
-    WizardResult execWizardPageI();
-
-    WizardResult m_result;
-};
-
-WizardEventLoop::WizardEventLoop(QObject *parent) :
-    QEventLoop(parent),
-    m_result(Rejected)
-{
-}
-
-WizardEventLoop::WizardResult WizardEventLoop::execWizardPage(QWizard &wizard)
-{
-    /* Install ourselves on the wizard. Main trick is here to connect
-     * to the page changed signal and quit() on it. */
-    WizardEventLoop *eventLoop = wizard.findChild<WizardEventLoop *>();
-    if (!eventLoop) {
-        eventLoop = new WizardEventLoop(&wizard);
-        connect(&wizard, SIGNAL(currentIdChanged(int)), eventLoop, SLOT(pageChanged(int)));
-        connect(&wizard, SIGNAL(accepted()), eventLoop, SLOT(accepted()));
-        connect(&wizard, SIGNAL(rejected()), eventLoop, SLOT(rejected()));
-        wizard.setWindowFlags(wizard.windowFlags());
-        wizard.show();
-    }
-    const WizardResult result = eventLoop->execWizardPageI();
-    // Quitting?
-    if (result != PageChanged)
-        delete eventLoop;
-    if (debugWizard)
-        qDebug() << "WizardEventLoop::runWizard" << wizard.pageIds() << " returns " << result;
-
-    return result;
-}
-
-WizardEventLoop::WizardResult WizardEventLoop::execWizardPageI()
-{
-    m_result = Rejected;
-    exec();
-    return m_result;
-}
-
-void WizardEventLoop::pageChanged(int /*page*/)
-{
-    m_result = PageChanged;
-    quit(); // !
-}
-
-void WizardEventLoop::accepted()
-{
-    m_result = Accepted;
-    quit();
-}
-
-void WizardEventLoop::rejected()
-{
-    m_result = Rejected;
-    quit();
-}
-
 /*!
     \class Core::BaseFileWizard
     \brief The BaseFileWizard class implements a generic wizard for
@@ -186,27 +85,6 @@ Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const QString &path, QWidget
 {
     QTC_ASSERT(!path.isEmpty(), return 0);
 
-    QString errorMessage;
-    // Compile extension pages, purge out unused ones
-    QList<IFileWizardExtension *> extensionList = ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>();
-    WizardPageList  allExtensionPages;
-    for (auto it = extensionList.begin(); it !=  extensionList.end(); ) {
-        const WizardPageList extensionPages = (*it)->extensionPages(this);
-        if (extensionPages.empty()) {
-            it = extensionList.erase(it);
-        } else {
-            allExtensionPages += extensionPages;
-            ++it;
-        }
-    }
-
-    if (debugWizard)
-        qDebug() << Q_FUNC_INFO <<  path << parent << "exs" <<  extensionList.size() << allExtensionPages.size();
-
-    QWizardPage *firstExtensionPage = 0;
-    if (!allExtensionPages.empty())
-        firstExtensionPage = allExtensionPages.front();
-
     // Create dialog and run it. Ensure that the dialog is deleted when
     // leaving the func, but not before the IFileWizardExtension::process
     // has been called
@@ -216,92 +94,12 @@ Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const QString &path, QWidget
     if (flags().testFlag(ForceCapitalLetterForFileName))
         dialogParameterFlags |= WizardDialogParameters::ForceCapitalLetterForFileName;
 
-    const QScopedPointer<QWizard> wizard(create(parent, WizardDialogParameters(path,
-                                                                               allExtensionPages,
-                                                                               platform,
-                                                                               requiredFeatures(),
-                                                                               dialogParameterFlags,
-                                                                               extraValues)));
-    QTC_ASSERT(!wizard.isNull(), return 0);
-    ICore::registerWindow(wizard.data(), Context("Core.NewWizard"));
-
-    GeneratedFiles files;
-    // Run the wizard: Call generate files on switching to the first extension
-    // page is OR after 'Accepted' if there are no extension pages
-    while (true) {
-        const WizardEventLoop::WizardResult wr = WizardEventLoop::execWizardPage(*wizard);
-        if (wr == WizardEventLoop::Rejected) {
-            files.clear();
-            break;
-        }
-        const bool accepted = wr == WizardEventLoop::Accepted;
-        const bool firstExtensionPageHit = wr == WizardEventLoop::PageChanged
-                                           && wizard->page(wizard->currentId()) == firstExtensionPage;
-        const bool needGenerateFiles = firstExtensionPageHit || (accepted && allExtensionPages.empty());
-        if (needGenerateFiles) {
-            QString errorMessage;
-            files = generateFiles(wizard.data(), &errorMessage);
-            if (files.empty()) {
-                QMessageBox::critical(0, tr("File Generation Failure"), errorMessage);
-                break;
-            }
-        }
-        if (firstExtensionPageHit)
-            foreach (IFileWizardExtension *ex, extensionList)
-                ex->firstExtensionPageShown(files, extraValues);
-        if (accepted)
-            break;
-    }
-    if (files.empty())
-        return 0;
-    // Compile result list and prompt for overwrite
-    switch (promptOverwrite(&files, &errorMessage)) {
-    case OverwriteCanceled:
-        return 0;
-    case OverwriteError:
-        QMessageBox::critical(0, tr("Existing files"), errorMessage);
-        return 0;
-    case OverwriteOk:
-        break;
-    }
-
-    foreach (IFileWizardExtension *ex, extensionList) {
-        for (int i = 0; i < files.count(); i++) {
-            ex->applyCodeStyle(&files[i]);
-        }
-    }
-
-    // Write
-    if (!writeFiles(files, &errorMessage)) {
-        QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage);
-        return 0;
-    }
-
-    bool removeOpenProjectAttribute = false;
-    // Run the extensions
-    foreach (IFileWizardExtension *ex, extensionList) {
-        bool remove;
-        if (!ex->processFiles(files, &remove, &errorMessage)) {
-            if (!errorMessage.isEmpty())
-                QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage);
-            return 0;
-        }
-        removeOpenProjectAttribute |= remove;
-    }
-
-    if (removeOpenProjectAttribute) {
-        for (int i = 0; i < files.count(); i++) {
-            if (files[i].attributes() & GeneratedFile::OpenProjectAttribute)
-                files[i].setAttributes(GeneratedFile::OpenEditorAttribute);
-        }
-    }
-
-    // Post generation handler
-    if (!postGenerateFiles(wizard.data(), files, &errorMessage))
-        if (!errorMessage.isEmpty())
-            QMessageBox::critical(0, tr("File Generation Failure"), errorMessage);
-
-    return 0;
+    Utils::Wizard *wizard = create(parent, WizardDialogParameters(path, platform,
+                                                                  requiredFeatures(),
+                                                                  dialogParameterFlags,
+                                                                  extraValues));
+    QTC_CHECK(wizard);
+    return wizard;
 }
 
 /*!
@@ -326,7 +124,7 @@ Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const QString &path, QWidget
     Re-implement (calling the base implementation) to create files with CustomGeneratorAttribute set.
 */
 
-bool BaseFileWizardFactory::writeFiles(const GeneratedFiles &files, QString *errorMessage)
+bool BaseFileWizardFactory::writeFiles(const GeneratedFiles &files, QString *errorMessage) const
 {
     const GeneratedFile::Attributes noWriteAttributes
         = GeneratedFile::CustomGeneratorAttribute|GeneratedFile::KeepExistingFileAttribute;
@@ -343,7 +141,8 @@ bool BaseFileWizardFactory::writeFiles(const GeneratedFiles &files, QString *err
     The default implementation opens editors with the newly generated files.
 */
 
-bool BaseFileWizardFactory::postGenerateFiles(const QWizard *, const GeneratedFiles &l, QString *errorMessage)
+bool BaseFileWizardFactory::postGenerateFiles(const QWizard *, const GeneratedFiles &l,
+                                              QString *errorMessage) const
 {
     return BaseFileWizardFactory::postGenerateOpenEditors(l, errorMessage);
 }
@@ -500,9 +299,6 @@ QString BaseFileWizardFactory::preferredSuffix(const QString &mimeType)
     files from path and name.
 
     \sa Core::GeneratedFile, Core::BaseFileWizardParameters, Core::BaseFileWizard
-    \sa Core::Internal::WizardEventLoop
 */
 
 } // namespace Core
-
-#include "basefilewizardfactory.moc"
diff --git a/src/plugins/coreplugin/basefilewizardfactory.h b/src/plugins/coreplugin/basefilewizardfactory.h
index 4ec9a2f213a55f5ddcff8a5c74760de2e0e6f6f1..ed6ce69b12b1975f3feadb824c52c110cfabfd2f 100644
--- a/src/plugins/coreplugin/basefilewizardfactory.h
+++ b/src/plugins/coreplugin/basefilewizardfactory.h
@@ -62,12 +62,10 @@ public:
     };
     Q_DECLARE_FLAGS(DialogParameterFlags, DialogParameterEnum)
 
-    explicit WizardDialogParameters(const QString &defaultPath, const WizardPageList &extensionPages,
-                                    const QString &platform, const FeatureSet &requiredFeatures,
-                                    DialogParameterFlags flags,
+    explicit WizardDialogParameters(const QString &defaultPath, const QString &platform,
+                                    const FeatureSet &requiredFeatures, DialogParameterFlags flags,
                                     QVariantMap extraValues)
         : m_defaultPath(defaultPath),
-          m_extensionPages(extensionPages),
           m_selectedPlatform(platform),
           m_requiredFeatures(requiredFeatures),
           m_parameterFlags(flags),
@@ -77,9 +75,6 @@ public:
     QString defaultPath() const
     { return m_defaultPath; }
 
-    WizardPageList extensionPages() const
-    { return m_extensionPages; }
-
     QString selectedPlatform() const
     { return m_selectedPlatform; }
 
@@ -94,7 +89,6 @@ public:
 
 private:
     QString m_defaultPath;
-    WizardPageList m_extensionPages;
     QString m_selectedPlatform;
     FeatureSet m_requiredFeatures;
     DialogParameterFlags m_parameterFlags;
@@ -105,20 +99,20 @@ class CORE_EXPORT BaseFileWizardFactory : public IWizardFactory
 {
     Q_OBJECT
 
+    friend class BaseFileWizard;
+
 public:
     static QString buildFileName(const QString &path, const QString &baseName, const QString &extension);
 
 protected:
-    typedef QList<QWizardPage *> WizardPageList;
-
     virtual BaseFileWizard *create(QWidget *parent, const WizardDialogParameters ¶meters) const = 0;
 
     virtual GeneratedFiles generateFiles(const QWizard *w,
                                          QString *errorMessage) const = 0;
 
-    virtual bool writeFiles(const GeneratedFiles &files, QString *errorMessage);
+    virtual bool writeFiles(const GeneratedFiles &files, QString *errorMessage) const;
 
-    virtual bool postGenerateFiles(const QWizard *w, const GeneratedFiles &l, QString *errorMessage);
+    virtual bool postGenerateFiles(const QWizard *w, const GeneratedFiles &l, QString *errorMessage) const;
 
     static QString preferredSuffix(const QString &mimeType);
 
diff --git a/src/plugins/coreplugin/iwizardfactory.cpp b/src/plugins/coreplugin/iwizardfactory.cpp
index 93526fc9c62c124ab8bc00c06de8ff6905a5386f..1345bddfe1f7a76134559034bee1cad649609896 100644
--- a/src/plugins/coreplugin/iwizardfactory.cpp
+++ b/src/plugins/coreplugin/iwizardfactory.cpp
@@ -257,6 +257,7 @@ Utils::Wizard *IWizardFactory::runWizard(const QString &path, QWidget *parent, c
             ICore::validateNewDialogIsRunning();
             wizard->deleteLater();
         });
+        wizard->show();
         Core::ICore::registerWindow(wizard, Core::Context("Core.NewWizard"));
     } else {
         s_isWizardRunning = false;
diff --git a/src/plugins/designer/cpp/formclasswizard.cpp b/src/plugins/designer/cpp/formclasswizard.cpp
index 320c9d2860cb1e8aed4c03a26ed21ecbde5ac534..e728b4c2caa74c2a52a41c8e68462ff61a4bb4ae 100644
--- a/src/plugins/designer/cpp/formclasswizard.cpp
+++ b/src/plugins/designer/cpp/formclasswizard.cpp
@@ -63,8 +63,7 @@ QString FormClassWizard::formSuffix() const
 
 Core::BaseFileWizard *FormClassWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
 {
-    FormClassWizardDialog *wizardDialog = new FormClassWizardDialog(parameters.extensionPages(),
-                                                                    parent);
+    FormClassWizardDialog *wizardDialog = new FormClassWizardDialog(this, parent);
     wizardDialog->setPath(parameters.defaultPath());
     return wizardDialog;
 }
diff --git a/src/plugins/designer/cpp/formclasswizarddialog.cpp b/src/plugins/designer/cpp/formclasswizarddialog.cpp
index 874e331e2e08d6bc023883e137b1fda8f03f00dd..afd5a3ebc50780f62d49f9ca57d8568ffd0d9c60 100644
--- a/src/plugins/designer/cpp/formclasswizarddialog.cpp
+++ b/src/plugins/designer/cpp/formclasswizarddialog.cpp
@@ -40,9 +40,9 @@ namespace Designer {
 namespace Internal {
 
 // ----------------- FormClassWizardDialog
-FormClassWizardDialog::FormClassWizardDialog(const WizardPageList &extensionPages,
+FormClassWizardDialog::FormClassWizardDialog(const Core::BaseFileWizardFactory *factory,
                                              QWidget *parent) :
-    Core::BaseFileWizard(parent),
+    Core::BaseFileWizard(factory, QVariantMap(), parent),
     m_formPage(new FormTemplateWizardPage),
     m_classPage(new FormClassWizardPage)
 {
@@ -51,7 +51,7 @@ FormClassWizardDialog::FormClassWizardDialog(const WizardPageList &extensionPage
     setPage(FormPageId, m_formPage);
     setPage(ClassPageId, m_classPage);
 
-    foreach (QWizardPage *p, extensionPages)
+    foreach (QWizardPage *p, extensionPages())
         addPage(p);
 }
 
diff --git a/src/plugins/designer/cpp/formclasswizarddialog.h b/src/plugins/designer/cpp/formclasswizarddialog.h
index b25b95bc12cd2a0a3000725f64e29e171eaefa8f..352cf80e6b335a122ad3ba876eca1daf8b5c6bb6 100644
--- a/src/plugins/designer/cpp/formclasswizarddialog.h
+++ b/src/plugins/designer/cpp/formclasswizarddialog.h
@@ -49,8 +49,7 @@ class FormClassWizardDialog : public Core::BaseFileWizard
 public:
     typedef QList<QWizardPage *> WizardPageList;
 
-    explicit FormClassWizardDialog(const WizardPageList &extensionPages,
-                                   QWidget *parent = 0);
+    explicit FormClassWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = 0);
 
     QString path() const;
 
diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.cpp b/src/plugins/genericprojectmanager/genericprojectwizard.cpp
index 944eb030ba7ef7e68ed30795a0532316df248c9d..647757ab7d641cc38b90f385ffe08c81ae05f93c 100644
--- a/src/plugins/genericprojectmanager/genericprojectwizard.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectwizard.cpp
@@ -60,8 +60,9 @@ static const char *const ConfigFileTemplate =
 //
 //////////////////////////////////////////////////////////////////////////////
 
-GenericProjectWizardDialog::GenericProjectWizardDialog(QWidget *parent) :
-    Core::BaseFileWizard(parent)
+GenericProjectWizardDialog::GenericProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                                       QWidget *parent) :
+    Core::BaseFileWizard(factory, QVariantMap(), parent)
 {
     setWindowTitle(tr("Import Existing Project"));
 
@@ -129,13 +130,14 @@ GenericProjectWizard::GenericProjectWizard()
     setFlags(Core::IWizardFactory::PlatformIndependent);
 }
 
-Core::BaseFileWizard *GenericProjectWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
+Core::BaseFileWizard *GenericProjectWizard::create(QWidget *parent,
+                                                   const Core::WizardDialogParameters ¶meters) const
 {
-    GenericProjectWizardDialog *wizard = new GenericProjectWizardDialog(parent);
+    GenericProjectWizardDialog *wizard = new GenericProjectWizardDialog(this, parent);
 
     wizard->setPath(parameters.defaultPath());
 
-    foreach (QWizardPage *p, parameters.extensionPages())
+    foreach (QWizardPage *p, wizard->extensionPages())
         wizard->addPage(p);
 
     return wizard;
@@ -200,7 +202,8 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
     return files;
 }
 
-bool GenericProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
+bool GenericProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l,
+                                             QString *errorMessage) const
 {
     Q_UNUSED(w);
     return ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.h b/src/plugins/genericprojectmanager/genericprojectwizard.h
index 357f566a3b5f4b0468cdc38a8587aa283e15a1fd..ce8c2b5889b406cecd59eec2ac777bd67edd8d4f 100644
--- a/src/plugins/genericprojectmanager/genericprojectwizard.h
+++ b/src/plugins/genericprojectmanager/genericprojectwizard.h
@@ -47,7 +47,7 @@ class GenericProjectWizardDialog : public Core::BaseFileWizard
     Q_OBJECT
 
 public:
-    explicit GenericProjectWizardDialog(QWidget *parent = 0);
+    explicit GenericProjectWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = 0);
 
     QString path() const;
     void setPath(const QString &path);
@@ -69,8 +69,9 @@ public:
 
 protected:
     Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
-    Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
-    bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
+    Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;
+    bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l,
+                           QString *errorMessage) const override;
 };
 
 } // namespace Internal
diff --git a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp
index 4090cb9c6643e1d59bd0e0e1209938f829a0d641..2ec2c0b6a4c35aad024a3dd081bf8a4342d1438c 100644
--- a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp
+++ b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp
@@ -64,9 +64,10 @@ BaseProjectWizardDialogPrivate::BaseProjectWizardDialogPrivate(Utils::ProjectInt
 {
 }
 
-BaseProjectWizardDialog::BaseProjectWizardDialog(QWidget *parent,
+BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                                 QWidget *parent,
                                                  const Core::WizardDialogParameters ¶meters) :
-    Core::BaseFileWizard(parent),
+    Core::BaseFileWizard(factory, parameters.extraValues(), parent),
     d(new BaseProjectWizardDialogPrivate(new Utils::ProjectIntroPage))
 {
     setPath(parameters.defaultPath());
@@ -75,10 +76,11 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(QWidget *parent,
     init();
 }
 
-BaseProjectWizardDialog::BaseProjectWizardDialog(Utils::ProjectIntroPage *introPage, int introId,
+BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                                 Utils::ProjectIntroPage *introPage, int introId,
                                                  QWidget *parent,
                                                  const Core::WizardDialogParameters ¶meters) :
-    Core::BaseFileWizard(parent),
+    Core::BaseFileWizard(factory, parameters.extraValues(), parent),
     d(new BaseProjectWizardDialogPrivate(introPage, introId))
 {
     setPath(parameters.defaultPath());
diff --git a/src/plugins/projectexplorer/baseprojectwizarddialog.h b/src/plugins/projectexplorer/baseprojectwizarddialog.h
index 642691008e6dac16e2c6b4d2d5d540794d228f39..7695314677c58b4b0aa1de23349f8252a692d5d9 100644
--- a/src/plugins/projectexplorer/baseprojectwizarddialog.h
+++ b/src/plugins/projectexplorer/baseprojectwizarddialog.h
@@ -48,11 +48,13 @@ class PROJECTEXPLORER_EXPORT BaseProjectWizardDialog : public Core::BaseFileWiza
     Q_OBJECT
 
 protected:
-    explicit BaseProjectWizardDialog(Utils::ProjectIntroPage *introPage, int introId,
+    explicit BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                     Utils::ProjectIntroPage *introPage, int introId,
                                      QWidget *parent, const Core::WizardDialogParameters ¶meters);
 
 public:
-    explicit BaseProjectWizardDialog(QWidget *parent, const Core::WizardDialogParameters ¶meters);
+    explicit BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent,
+                                     const Core::WizardDialogParameters ¶meters);
 
     virtual ~BaseProjectWizardDialog();
 
diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp
index 2336f57f923ee812ebf0abbe559e6f927b916399..69d24364b82a09610d832c2475b18bc1b2fd3498 100644
--- a/src/plugins/projectexplorer/customwizard/customwizard.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp
@@ -138,7 +138,7 @@ void CustomWizard::setParameters(const CustomWizardParametersPtr &p)
 Core::BaseFileWizard *CustomWizard::create(QWidget *parent, const Core::WizardDialogParameters &p) const
 {
     QTC_ASSERT(!d->m_parameters.isNull(), return 0);
-    Core::BaseFileWizard *wizard = new Core::BaseFileWizard(parent);
+    Core::BaseFileWizard *wizard = new Core::BaseFileWizard(this, p.extraValues(), parent);
 
     d->m_context->reset();
     CustomWizardPage *customPage = new CustomWizardPage(d->m_context, parameters());
@@ -147,7 +147,7 @@ Core::BaseFileWizard *CustomWizard::create(QWidget *parent, const Core::WizardDi
         wizard->setPage(parameters()->firstPageId, customPage);
     else
         wizard->addPage(customPage);
-    foreach (QWizardPage *ep, p.extensionPages())
+    foreach (QWizardPage *ep, wizard->extensionPages())
         wizard->addPage(ep);
     if (CustomWizardPrivate::verbose)
         qDebug() << "initWizardDialog" << wizard << wizard->pageIds();
@@ -243,7 +243,7 @@ Core::GeneratedFiles CustomWizard::generateFiles(const QWizard *dialog, QString
     return generateWizardFiles(errorMessage);
 }
 
-bool CustomWizard::writeFiles(const Core::GeneratedFiles &files, QString *errorMessage)
+bool CustomWizard::writeFiles(const Core::GeneratedFiles &files, QString *errorMessage) const
 {
     if (!Core::BaseFileWizardFactory::writeFiles(files, errorMessage))
         return false;
@@ -461,16 +461,16 @@ CustomProjectWizard::CustomProjectWizard()
 Core::BaseFileWizard *CustomProjectWizard::create(QWidget *parent,
                                      const Core::WizardDialogParameters ¶meters) const
 {
-    BaseProjectWizardDialog *projectDialog = new BaseProjectWizardDialog(parent, parameters);
+    BaseProjectWizardDialog *projectDialog = new BaseProjectWizardDialog(this, parent, parameters);
     initProjectWizardDialog(projectDialog,
                             parameters.defaultPath(),
-                            parameters.extensionPages());
+                            projectDialog->extensionPages());
     return projectDialog;
 }
 
 void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
                                                   const QString &defaultPath,
-                                                  const WizardPageList &extensionPages) const
+                                                  const QList<QWizardPage *> &extensionPages) const
 {
     const CustomWizardParametersPtr pa = parameters();
     QTC_ASSERT(!pa.isNull(), return);
@@ -532,7 +532,7 @@ bool CustomProjectWizard::postGenerateOpen(const Core::GeneratedFiles &l, QStrin
     return BaseFileWizardFactory::postGenerateOpenEditors(l, errorMessage);
 }
 
-bool CustomProjectWizard::postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage)
+bool CustomProjectWizard::postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage) const
 {
     if (CustomWizardPrivate::verbose)
         qDebug() << "CustomProjectWizard::postGenerateFiles()";
diff --git a/src/plugins/projectexplorer/customwizard/customwizard.h b/src/plugins/projectexplorer/customwizard/customwizard.h
index 6974ad9be2228a79a8349693e14265973b4e364b..a4e6df36bf1a16119e53f949797eb239db983338 100644
--- a/src/plugins/projectexplorer/customwizard/customwizard.h
+++ b/src/plugins/projectexplorer/customwizard/customwizard.h
@@ -115,7 +115,7 @@ protected:
     Core::GeneratedFiles generateWizardFiles(QString *errorMessage) const;
     // Create replacement map as static base fields + QWizard fields
     FieldReplacementMap replacementMap(const QWizard *w) const;
-    bool writeFiles(const Core::GeneratedFiles &files, QString *errorMessage);
+    bool writeFiles(const Core::GeneratedFiles &files, QString *errorMessage) const override;
 
     CustomWizardParametersPtr parameters() const;
     CustomWizardContextPtr context() const;
@@ -147,10 +147,10 @@ signals:
     void projectLocationChanged(const QString &path);
 
 protected:
-    bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
+    bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage) const override;
 
     void initProjectWizardDialog(BaseProjectWizardDialog *w, const QString &defaultPath,
-                                 const WizardPageList &extensionPages) const;
+                                 const QList<QWizardPage *> &extensionPages) const;
 
 private slots:
     void projectParametersChanged(const QString &project, const QString &path);
diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizard.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizard.cpp
index 5f268063e86a7844fccdce05f52cdad1360478de..d0308aff001f6ba70cae132d2da8e102a11d82b2 100644
--- a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizard.cpp
+++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizard.cpp
@@ -57,10 +57,8 @@ CustomWidgetWizard::CustomWidgetWizard()
 
 Core::BaseFileWizard *CustomWidgetWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
 {
-    CustomWidgetWizardDialog *rc = new CustomWidgetWizardDialog(displayName(),
-                                                                icon(),
-                                                                parent,
-                                                                parameters);
+    CustomWidgetWizardDialog *rc = new CustomWidgetWizardDialog(this, displayName(),
+                                                                icon(), parent, parameters);
     rc->setProjectName(CustomWidgetWizardDialog::uniqueProjectName(parameters.defaultPath()));
     rc->setFileNamingParameters(FileNamingParameters(headerSuffix(), sourceSuffix(), QtWizard::lowerCaseFiles()));
     return rc;
diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.cpp
index 8928dc35fedebd7a2dbcb20f9e0bf866bc288cec..6952537f1284c698282abfda4e54c968d04ba735 100644
--- a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.cpp
+++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.cpp
@@ -42,11 +42,11 @@ namespace Internal {
 
 enum { IntroPageId = 0};
 
-CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName,
-                                                   const QIcon &icon,
-                                                   QWidget *parent,
+CustomWidgetWizardDialog::CustomWidgetWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                                   const QString &templateName,
+                                                   const QIcon &icon, QWidget *parent,
                                                    const Core::WizardDialogParameters ¶meters) :
-    BaseQmakeProjectWizardDialog(false, parent, parameters),
+    BaseQmakeProjectWizardDialog(factory, false, parent, parameters),
     m_widgetsPage(new CustomWidgetWidgetsWizardPage),
     m_pluginPage(new CustomWidgetPluginWizardPage)
 {
@@ -61,7 +61,7 @@ CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName,
     addPage(m_widgetsPage);
     m_pluginPageId = addPage(m_pluginPage);
 
-    addExtensionPages(parameters.extensionPages());
+    addExtensionPages(extensionPages());
     connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
 }
 
diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.h b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.h
index 8b145831bcb2f31585d2096e6d5d7faf976d0228..868d0b9193c6ba721bb3c51c4f9f29e209f5f59f 100644
--- a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.h
+++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizarddialog.h
@@ -47,8 +47,8 @@ class CustomWidgetWizardDialog : public BaseQmakeProjectWizardDialog
 {
     Q_OBJECT
 public:
-    explicit CustomWidgetWizardDialog(const QString &templateName,
-                                      const QIcon &icon,
+    explicit CustomWidgetWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                      const QString &templateName, const QIcon &icon,
                                       QWidget *parent,
                                       const Core::WizardDialogParameters ¶meters);
 
diff --git a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp
index 8ed61a1adb54971093cc721446e67c72662f3df5..f0092950ad63e853f95757e9a752af3d7eb066c4 100644
--- a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp
@@ -88,7 +88,7 @@ GuiAppWizard::GuiAppWizard()
 
 Core::BaseFileWizard *GuiAppWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
 {
-    GuiAppWizardDialog *dialog = new GuiAppWizardDialog(displayName(), icon(), parent, parameters);
+    GuiAppWizardDialog *dialog = new GuiAppWizardDialog(this, displayName(), icon(), parent, parameters);
     dialog->setProjectName(GuiAppWizardDialog::uniqueProjectName(parameters.defaultPath()));
     // Order! suffixes first to generate files correctly
     dialog->setLowerCaseFiles(QtWizard::lowerCaseFiles());
diff --git a/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp b/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp
index dffa670f969aacf518b51602f0fbfd270951424a..3d6830d4aea87f1ca9953bde91861c1d37e99236 100644
--- a/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.cpp
@@ -45,11 +45,11 @@ GuiAppParameters::GuiAppParameters()
 {
 }
 
-GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
-                                       const QIcon &icon,
-                                       QWidget *parent,
+GuiAppWizardDialog::GuiAppWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                       const QString &templateName,
+                                       const QIcon &icon, QWidget *parent,
                                        const Core::WizardDialogParameters ¶meters) :
-    BaseQmakeProjectWizardDialog(false, parent, parameters),
+    BaseQmakeProjectWizardDialog(factory, false, parent, parameters),
     m_filesPage(new FilesPage)
 {
     setWindowIcon(icon);
@@ -68,7 +68,7 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
     m_filesPage->setClassTypeComboVisible(false);
     addPage(m_filesPage);
 
-    addExtensionPages(parameters.extensionPages());
+    addExtensionPages(extensionPages());
 }
 
 void GuiAppWizardDialog::setBaseClasses(const QStringList &baseClasses)
diff --git a/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.h b/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.h
index ea6bf0e0f252e9f1b33d549708d55d9662ffb8d9..b0f42072756df545bca8decf932513471a97de51 100644
--- a/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.h
+++ b/src/plugins/qmakeprojectmanager/wizards/guiappwizarddialog.h
@@ -59,7 +59,7 @@ class GuiAppWizardDialog : public BaseQmakeProjectWizardDialog
     Q_OBJECT
 
 public:
-    explicit GuiAppWizardDialog(const QString &templateName,
+    explicit GuiAppWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
                                 const QIcon &icon,
                                 QWidget *parent,
                                 const Core::WizardDialogParameters ¶meters);
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp b/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp
index 196e95d38d2214ed573110647a9c14ec6d006d24..3e10554ba5911a924537fba8dbe8e32bc1be42a8 100644
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp
@@ -61,7 +61,7 @@ LibraryWizard::LibraryWizard()
 
 Core::BaseFileWizard *LibraryWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
 {
-    LibraryWizardDialog *dialog = new LibraryWizardDialog(displayName(), icon(), parent, parameters);
+    LibraryWizardDialog *dialog = new LibraryWizardDialog(this, displayName(), icon(), parent, parameters);
     dialog->setLowerCaseFiles(QtWizard::lowerCaseFiles());
     dialog->setProjectName(LibraryWizardDialog::uniqueProjectName(parameters.defaultPath()));
     dialog->setSuffixes(headerSuffix(), sourceSuffix(), formSuffix());
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp b/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp
index 7923da3788d160a09c07e7b8cb6a358453cddef7..c34ea7bb54a066f54aa9bda8c28e21b5edc8fca2 100644
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp
@@ -129,11 +129,12 @@ QtProjectParameters::Type LibraryIntroPage::type() const
 }
 
 // ------------------- LibraryWizardDialog
-LibraryWizardDialog::LibraryWizardDialog(const QString &templateName,
+LibraryWizardDialog::LibraryWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                         const QString &templateName,
                                          const QIcon &icon,
                                          QWidget *parent,
                                          const Core::WizardDialogParameters ¶meters) :
-    BaseQmakeProjectWizardDialog(true, new LibraryIntroPage, -1, parent, parameters),
+    BaseQmakeProjectWizardDialog(factory, true, new LibraryIntroPage, -1, parent, parameters),
     m_filesPage(new FilesPage),
     m_pluginBaseClassesInitialized(false),
     m_filesPageId(-1), m_modulesPageId(-1), m_targetPageId(-1)
@@ -179,7 +180,7 @@ LibraryWizardDialog::LibraryWizardDialog(const QString &templateName,
 
     connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
 
-    addExtensionPages(parameters.extensionPages());
+    addExtensionPages(extensionPages());
 }
 
 void LibraryWizardDialog::setSuffixes(const QString &header, const QString &source,  const QString &form)
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h b/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h
index dbccaa1ee801442922ec554b9eef34876ee01307..4d434fbda9638663e309a44f4010d242c2a94a2f 100644
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h
+++ b/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h
@@ -46,7 +46,7 @@ class LibraryWizardDialog : public BaseQmakeProjectWizardDialog
     Q_OBJECT
 
 public:
-    LibraryWizardDialog(const QString &templateName,
+    LibraryWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
                         const QIcon &icon,
                         QWidget *parent,
                         const Core::WizardDialogParameters ¶meters);
diff --git a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp
index 738846c127e69a6ad5a88afbed2fb1f287120b06..705c5fae4ad0ee8255a4949f1ce1b648dee4752c 100644
--- a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp
@@ -83,7 +83,7 @@ QString QtWizard::profileSuffix()
     return preferredSuffix(QLatin1String(Constants::PROFILE_MIMETYPE));
 }
 
-bool QtWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
+bool QtWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage) const
 {
     return QtWizard::qt4ProjectPostGenerateFiles(w, l, errorMessage);
 }
@@ -129,24 +129,27 @@ CustomQmakeProjectWizard::CustomQmakeProjectWizard()
 Core::BaseFileWizard *CustomQmakeProjectWizard::create(QWidget *parent,
                                           const Core::WizardDialogParameters ¶meters) const
 {
-    BaseQmakeProjectWizardDialog *wizard = new BaseQmakeProjectWizardDialog(false, parent, parameters);
+    BaseQmakeProjectWizardDialog *wizard = new BaseQmakeProjectWizardDialog(this, false, parent,
+                                                                            parameters);
 
     if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
         wizard->addTargetSetupPage(targetPageId);
 
-    initProjectWizardDialog(wizard, parameters.defaultPath(), parameters.extensionPages());
+    initProjectWizardDialog(wizard, parameters.defaultPath(), wizard->extensionPages());
     return wizard;
 }
 
-bool CustomQmakeProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
+bool CustomQmakeProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l,
+                                                 QString *errorMessage) const
 {
     return QtWizard::qt4ProjectPostGenerateFiles(w, l, errorMessage);
 }
 
 // ----------------- BaseQmakeProjectWizardDialog
-BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(bool showModulesPage, QWidget *parent,
-                                                       const Core::WizardDialogParameters ¶meters) :
-    ProjectExplorer::BaseProjectWizardDialog(parent, parameters),
+BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                                           bool showModulesPage, QWidget *parent,
+                                                           const Core::WizardDialogParameters ¶meters) :
+    ProjectExplorer::BaseProjectWizardDialog(factory, parent, parameters),
     m_modulesPage(0),
     m_targetSetupPage(0),
     m_profileIds(parameters.extraValues().value(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))
@@ -155,11 +158,12 @@ BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(bool showModulesPage,
     init(showModulesPage);
 }
 
-BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(bool showModulesPage,
-                                                       Utils::ProjectIntroPage *introPage,
-                                                       int introId, QWidget *parent,
-                                                       const Core::WizardDialogParameters ¶meters) :
-    ProjectExplorer::BaseProjectWizardDialog(introPage, introId, parent, parameters),
+BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                                           bool showModulesPage,
+                                                           Utils::ProjectIntroPage *introPage,
+                                                           int introId, QWidget *parent,
+                                                           const Core::WizardDialogParameters ¶meters) :
+    ProjectExplorer::BaseProjectWizardDialog(factory, introPage, introId, parent, parameters),
     m_modulesPage(0),
     m_targetSetupPage(0),
     m_profileIds(parameters.extraValues().value(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))
diff --git a/src/plugins/qmakeprojectmanager/wizards/qtwizard.h b/src/plugins/qmakeprojectmanager/wizards/qtwizard.h
index bc6aa35327be54d356e17a4b87a360ebde6716d4..c3d656992a9d5044668dae57535381b316781756 100644
--- a/src/plugins/qmakeprojectmanager/wizards/qtwizard.h
+++ b/src/plugins/qmakeprojectmanager/wizards/qtwizard.h
@@ -77,7 +77,8 @@ public:
     static bool qt4ProjectPostGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
 
 private:
-    bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
+    bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l,
+                           QString *errorMessage) const override;
 };
 
 // A custom wizard with an additional Qt 4 target page
@@ -89,8 +90,10 @@ public:
     CustomQmakeProjectWizard();
 
 private:
-    Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
-    bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage);
+    Core::BaseFileWizard *create(QWidget *parent,
+                                 const Core::WizardDialogParameters ¶meters) const override;
+    bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l,
+                           QString *errorMessage) const override;
 
 private:
     enum { targetPageId = 1 };
@@ -106,14 +109,15 @@ class BaseQmakeProjectWizardDialog : public ProjectExplorer::BaseProjectWizardDi
 {
     Q_OBJECT
 protected:
-    explicit BaseQmakeProjectWizardDialog(bool showModulesPage,
-                                        Utils::ProjectIntroPage *introPage,
-                                        int introId,
-                                        QWidget *parent,
-                                        const Core::WizardDialogParameters ¶meters);
+    explicit BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                          bool showModulesPage,
+                                          Utils::ProjectIntroPage *introPage,
+                                          int introId, QWidget *parent,
+                                          const Core::WizardDialogParameters ¶meters);
 public:
-    explicit BaseQmakeProjectWizardDialog(bool showModulesPage, QWidget *parent,
-                                        const Core::WizardDialogParameters ¶meters);
+    explicit BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                          bool showModulesPage, QWidget *parent,
+                                          const Core::WizardDialogParameters ¶meters);
     ~BaseQmakeProjectWizardDialog();
 
     int addModulesPage(int id = -1);
diff --git a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp
index 1fba31814ae7c95b0c3f50e1346e57f14ea85886..07c46b2d0ddf78fc7f0d08a2445682d1a42097f3 100644
--- a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp
@@ -54,9 +54,11 @@ SubdirsProjectWizard::SubdirsProjectWizard()
     setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT));
 }
 
-Core::BaseFileWizard *SubdirsProjectWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
+Core::BaseFileWizard *SubdirsProjectWizard::create(QWidget *parent,
+                                                   const Core::WizardDialogParameters ¶meters) const
 {
-    SubdirsProjectWizardDialog *dialog = new SubdirsProjectWizardDialog(displayName(), icon(), parent, parameters);
+    SubdirsProjectWizardDialog *dialog = new SubdirsProjectWizardDialog(this, displayName(), icon(),
+                                                                        parent, parameters);
 
     dialog->setProjectName(SubdirsProjectWizardDialog::uniqueProjectName(parameters.defaultPath()));
     const QString buttonText = dialog->wizardStyle() == QWizard::MacStyle
@@ -79,7 +81,8 @@ Core::GeneratedFiles SubdirsProjectWizard::generateFiles(const QWizard *w,
     return Core::GeneratedFiles() << profile;
 }
 
-bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &files, QString *errorMessage)
+bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &files,
+                                             QString *errorMessage) const
 {
     const SubdirsProjectWizardDialog *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
     if (QtWizard::qt4ProjectPostGenerateFiles(wizard, files, errorMessage)) {
diff --git a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.h b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.h
index 06fd014ef617b6113ffd4b393f8789e903a746a7..a27e5e7bc759c29616f96d87cc85c5a422ccda05 100644
--- a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.h
+++ b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.h
@@ -44,10 +44,12 @@ public:
     SubdirsProjectWizard();
 
 private:
-    Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
+    Core::BaseFileWizard *create(QWidget *parent,
+                                 const Core::WizardDialogParameters ¶meters) const override;
 
-    Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
-    bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage);
+    Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;
+    bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l,
+                           QString *errorMessage) const override;
 };
 
 } // namespace Internal
diff --git a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizarddialog.cpp b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizarddialog.cpp
index c38b65d75cfc752be819841e80decc4e4a71fa42..1d4d8cd308f72c15db5fae56f770f77339db19bf 100644
--- a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizarddialog.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizarddialog.cpp
@@ -34,11 +34,11 @@
 namespace QmakeProjectManager {
 namespace Internal {
 
-SubdirsProjectWizardDialog::SubdirsProjectWizardDialog(const QString &templateName,
-                                               const QIcon &icon,
-                                               QWidget *parent,
-                                               const Core::WizardDialogParameters ¶meters) :
-    BaseQmakeProjectWizardDialog(false, parent, parameters)
+SubdirsProjectWizardDialog::SubdirsProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                                       const QString &templateName,
+                                                       const QIcon &icon, QWidget *parent,
+                                                       const Core::WizardDialogParameters ¶meters) :
+    BaseQmakeProjectWizardDialog(factory, false, parent, parameters)
 {
     setWindowIcon(icon);
     setWindowTitle(templateName);
@@ -49,7 +49,7 @@ SubdirsProjectWizardDialog::SubdirsProjectWizardDialog(const QString &templateNa
     if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
         addTargetSetupPage();
 
-    addExtensionPages(parameters.extensionPages());
+    addExtensionPages(extensionPages());
 }
 
 QtProjectParameters SubdirsProjectWizardDialog::parameters() const
diff --git a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizarddialog.h b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizarddialog.h
index f15b9a04d1999c38777db9fe1a28822889376bc7..d9f04b3f2357cae1b12b1d5e760433d27650bb28 100644
--- a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizarddialog.h
+++ b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizarddialog.h
@@ -42,7 +42,7 @@ class SubdirsProjectWizardDialog : public BaseQmakeProjectWizardDialog
 {
     Q_OBJECT
 public:
-    explicit SubdirsProjectWizardDialog(const QString &templateName,
+    explicit SubdirsProjectWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
                                     const QIcon &icon,
                                     QWidget *parent,
                                     const Core::WizardDialogParameters ¶meters);
diff --git a/src/plugins/qmakeprojectmanager/wizards/testwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/testwizard.cpp
index a64fc7d99c526bc259ec7b0bed9d55ea80616196..579f7f98caf8f60634129215947e540d0545892c 100644
--- a/src/plugins/qmakeprojectmanager/wizards/testwizard.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/testwizard.cpp
@@ -62,7 +62,7 @@ TestWizard::TestWizard()
 
 Core::BaseFileWizard *TestWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
 {
-    TestWizardDialog *dialog = new TestWizardDialog(displayName(), icon(), parent, parameters);
+    TestWizardDialog *dialog = new TestWizardDialog(this, displayName(), icon(), parent, parameters);
     dialog->setProjectName(TestWizardDialog::uniqueProjectName(parameters.defaultPath()));
     return dialog;
 }
diff --git a/src/plugins/qmakeprojectmanager/wizards/testwizarddialog.cpp b/src/plugins/qmakeprojectmanager/wizards/testwizarddialog.cpp
index e175db9200daeb62aaabd30a0f07854f37d564ac..54abe0fa193fa2cad06b71a152f681bec2f87bfd 100644
--- a/src/plugins/qmakeprojectmanager/wizards/testwizarddialog.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/testwizarddialog.cpp
@@ -49,11 +49,12 @@ TestWizardParameters::TestWizardParameters() :
 {
 }
 
-TestWizardDialog::TestWizardDialog(const QString &templateName,
+TestWizardDialog::TestWizardDialog(const Core::BaseFileWizardFactory *factory,
+                                   const QString &templateName,
                                    const QIcon &icon,
                                    QWidget *parent,
                                    const Core::WizardDialogParameters ¶meters)  :
-    BaseQmakeProjectWizardDialog(true, parent, parameters),
+    BaseQmakeProjectWizardDialog(factory, true, parent, parameters),
     m_testPage(new TestWizardPage)
 {
     setIntroDescription(tr("This wizard generates a Qt Unit Test "
@@ -65,7 +66,7 @@ TestWizardDialog::TestWizardDialog(const QString &templateName,
         addTargetSetupPage();
     addModulesPage();
     m_testPageId = addPage(m_testPage);
-    addExtensionPages(parameters.extensionPages());
+    addExtensionPages(extensionPages());
     connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
 }
 
diff --git a/src/plugins/qmakeprojectmanager/wizards/testwizarddialog.h b/src/plugins/qmakeprojectmanager/wizards/testwizarddialog.h
index 3a6590fa5da730a64108facefbc33aff273fef1c..1467d4badbbdff3fd1880e79356892ae1bad20ed 100644
--- a/src/plugins/qmakeprojectmanager/wizards/testwizarddialog.h
+++ b/src/plugins/qmakeprojectmanager/wizards/testwizarddialog.h
@@ -63,7 +63,7 @@ class TestWizardDialog : public BaseQmakeProjectWizardDialog
 {
     Q_OBJECT
 public:
-    explicit TestWizardDialog(const QString &templateName,
+    explicit TestWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
                               const QIcon &icon,
                               QWidget *parent,
                               const Core::WizardDialogParameters ¶meters);