mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 08:18:56 +02:00
combo boxes ported to new form code
This commit is contained in:
parent
dd47b7afc6
commit
63e6839142
2 changed files with 20 additions and 0 deletions
|
@ -220,6 +220,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a
|
||||||
if (_formResult == QDialog::Accepted) {
|
if (_formResult == QDialog::Accepted) {
|
||||||
int e = -1;
|
int e = -1;
|
||||||
int d = -1;
|
int d = -1;
|
||||||
|
int c = -1;
|
||||||
for (int i = 0; i < _form.property("length").toInt32(); ++i) {
|
for (int i = 0; i < _form.property("length").toInt32(); ++i) {
|
||||||
QScriptValue item = _form.property(i);
|
QScriptValue item = _form.property(i);
|
||||||
QScriptValue value = item.property("value");
|
QScriptValue value = item.property("value");
|
||||||
|
@ -235,6 +236,10 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a
|
||||||
value = _directories.at(d)->property("path").toString();
|
value = _directories.at(d)->property("path").toString();
|
||||||
item.setProperty("directory", value);
|
item.setProperty("directory", value);
|
||||||
_form.setProperty(i, item);
|
_form.setProperty(i, item);
|
||||||
|
} else if (item.property("options").isArray()) {
|
||||||
|
c += 1;
|
||||||
|
item.setProperty("value", _combos.at(c)->currentText());
|
||||||
|
_form.setProperty(i, item);
|
||||||
} else {
|
} else {
|
||||||
e += 1;
|
e += 1;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
@ -288,6 +293,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal
|
||||||
if (result == QDialog::Accepted) {
|
if (result == QDialog::Accepted) {
|
||||||
int e = -1;
|
int e = -1;
|
||||||
int d = -1;
|
int d = -1;
|
||||||
|
int c = -1;
|
||||||
for (int i = 0; i < form.property("length").toInt32(); ++i) {
|
for (int i = 0; i < form.property("length").toInt32(); ++i) {
|
||||||
QScriptValue item = form.property(i);
|
QScriptValue item = form.property(i);
|
||||||
QScriptValue value = item.property("value");
|
QScriptValue value = item.property("value");
|
||||||
|
@ -303,6 +309,10 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal
|
||||||
value = _directories.at(d)->property("path").toString();
|
value = _directories.at(d)->property("path").toString();
|
||||||
item.setProperty("directory", value);
|
item.setProperty("directory", value);
|
||||||
form.setProperty(i, item);
|
form.setProperty(i, item);
|
||||||
|
} else if (item.property("options").isArray()) {
|
||||||
|
c += 1;
|
||||||
|
item.setProperty("value", _combos.at(c)->currentText());
|
||||||
|
_form.setProperty(i, item);
|
||||||
} else {
|
} else {
|
||||||
e += 1;
|
e += 1;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
@ -405,6 +415,15 @@ QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue
|
||||||
|
|
||||||
} else if (item.property("type").toString() == "header") {
|
} else if (item.property("type").toString() == "header") {
|
||||||
formLayout->addRow(new QLabel(item.property("label").toString()));
|
formLayout->addRow(new QLabel(item.property("label").toString()));
|
||||||
|
} else if (item.property("options").isArray()) {
|
||||||
|
QComboBox* combo = new QComboBox();
|
||||||
|
combo->setMinimumWidth(200);
|
||||||
|
QStringList options = item.property("options").toVariant().toStringList();
|
||||||
|
for (QStringList::const_iterator it = options.begin(); it != options.end(); it += 1) {
|
||||||
|
combo->addItem(*it);
|
||||||
|
}
|
||||||
|
_combos.push_back(combo);
|
||||||
|
formLayout->addRow(new QLabel(item.property("label").toString()), combo);
|
||||||
} else {
|
} else {
|
||||||
QLineEdit* edit = new QLineEdit(item.property("value").toString());
|
QLineEdit* edit = new QLineEdit(item.property("value").toString());
|
||||||
edit->setMinimumWidth(200);
|
edit->setMinimumWidth(200);
|
||||||
|
|
|
@ -71,6 +71,7 @@ private:
|
||||||
QScriptValue _form;
|
QScriptValue _form;
|
||||||
bool _nonBlockingFormActive;
|
bool _nonBlockingFormActive;
|
||||||
int _formResult;
|
int _formResult;
|
||||||
|
QVector<QComboBox*> _combos;
|
||||||
QVector<QLineEdit*> _edits;
|
QVector<QLineEdit*> _edits;
|
||||||
QVector<QPushButton*> _directories;
|
QVector<QPushButton*> _directories;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue