diff options
| author | Linus Jahn <lnj@kaidan.im> | 2020-03-29 00:39:44 +0100 |
|---|---|---|
| committer | LNJ <lnj@kaidan.im> | 2020-03-29 18:50:01 +0200 |
| commit | 1476fa153260487a6ddbc742ca6fdc4054ffd88a (patch) | |
| tree | 6a6e881cfb2d6a9bc12543910768241e7fea30a8 /src/base/QXmppDataForm.cpp | |
| parent | 380eb5cfe23daecc0d1dcd871dbecbc2bbe62aec (diff) | |
QXmppDataForm: Add ctor with all attributes
This makes creating forms manually a lot easier.
Diffstat (limited to 'src/base/QXmppDataForm.cpp')
| -rw-r--r-- | src/base/QXmppDataForm.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/base/QXmppDataForm.cpp b/src/base/QXmppDataForm.cpp index 8239b86a..99848deb 100644 --- a/src/base/QXmppDataForm.cpp +++ b/src/base/QXmppDataForm.cpp @@ -245,6 +245,29 @@ QXmppDataForm::Field::Field(QXmppDataForm::Field::Type type) d->type = type; } +/// +/// Constructs a QXmppDataForm::Field with the specified attributes. +/// +/// \since QXmpp 1.3 +/// +QXmppDataForm::Field::Field(QXmppDataForm::Field::Type type, + const QString &key, + const QVariant &value, + bool isRequired, + const QString &label, + const QString &description, + const QList<QPair<QString, QString>> &options) + : d(new QXmppDataFormFieldPrivate) +{ + d->type = type; + d->key = key; + d->value = value; + d->required = isRequired; + d->label = label; + d->description = description; + d->options = options; +} + /// Constructs a copy of \a other. QXmppDataForm::Field::Field(const QXmppDataForm::Field &other) @@ -526,6 +549,23 @@ QXmppDataForm::QXmppDataForm(QXmppDataForm::Type type) d->type = type; } +/// +/// Constructs a QXmppDataForm with the specified attributes. +/// +/// \since QXmpp 1.3 +/// +QXmppDataForm::QXmppDataForm(QXmppDataForm::Type type, + const QList<QXmppDataForm::Field> &fields, + const QString &title, + const QString &instructions) + : d(new QXmppDataFormPrivate) +{ + d->type = type; + d->fields = fields; + d->title = title; + d->instructions = instructions; +} + /// Constructs a copy of \a other. QXmppDataForm::QXmppDataForm(const QXmppDataForm &other) |
