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

@@ -115,6 +115,9 @@ public:
JsonFieldPage(Utils::MacroExpander *expander, QWidget *parent = 0);
~JsonFieldPage();
typedef std::function<Field *()> FieldFactory;
static void registerFieldFactory(const QString &id, const FieldFactory &ff);
bool setup(const QVariant &data);
bool isComplete() const;
@@ -129,6 +132,10 @@ public:
Utils::MacroExpander *expander();
private:
static QHash<QString, FieldFactory> m_factories;
static Field *createFieldData(const QString &type);
QFormLayout *m_formLayout;
QLabel *m_errorLabel;