JsonWizard: Allow for custom widgets in the Field page

... instead of having a hard-coded list of widgets you can use.

Change-Id: Iedf7016412ce9d619fea5cdffe6dbf86beda92b0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Benjamin Zeller <benjamin.zeller@canonical.com>
This commit is contained in:
Tobias Hunger
2015-09-21 16:28:48 +02:00
parent 443f133d3e
commit 4b77ae0718
3 changed files with 31 additions and 19 deletions

View File

@@ -31,6 +31,7 @@
#include "jsonwizardpagefactory_p.h"
#include "jsonfieldpage.h"
#include "jsonfieldpage_p.h"
#include "jsonfilepage.h"
#include "jsonkitspage.h"
#include "jsonprojectpage.h"
@@ -53,6 +54,14 @@ namespace Internal {
FieldPageFactory::FieldPageFactory()
{
setTypeIdsSuffix(QLatin1String("Fields"));
JsonFieldPage::registerFieldFactory(QLatin1String("Label"), []() { return new LabelField; });
JsonFieldPage::registerFieldFactory(QLatin1String("Spacer"), []() { return new SpacerField; });
JsonFieldPage::registerFieldFactory(QLatin1String("LineEdit"), []() { return new LineEditField; });
JsonFieldPage::registerFieldFactory(QLatin1String("TextEdit"), []() { return new TextEditField; });
JsonFieldPage::registerFieldFactory(QLatin1String("PathChooser"), []() { return new PathChooserField; });
JsonFieldPage::registerFieldFactory(QLatin1String("CheckBox"), []() { return new CheckBoxField; });
JsonFieldPage::registerFieldFactory(QLatin1String("ComboBox"), []() { return new ComboBoxField; });
}
Utils::WizardPage *FieldPageFactory::create(JsonWizard *wizard, Core::Id typeId, const QVariant &data)