Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -220,6 +220,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 219 unmodified lines | ||
| 220 | 220 | if (_formResult == QDialog::Accepted) { |
| 221 | 221 | int e = -1; |
| 222 | 222 | int d = -1; |
| 223 | + int c = -1; | |
| 223 | 224 | for (int i = 0; i < _form.property("length").toInt32(); ++i) { |
| 224 | 225 | QScriptValue item = _form.property(i); |
| 225 | 226 | QScriptValue value = item.property("value"); |
| @@ -235,6 +236,10 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 9 unmodified lines | ||
| 235 | 236 | value = _directories.at(d)->property("path").toString(); |
| 236 | 237 | item.setProperty("directory", value); |
| 237 | 238 | _form.setProperty(i, item); |
| 239 | + } else if (item.property("options").isArray()) { | |
| 240 | + c += 1; | |
| 241 | + item.setProperty("value", _combos.at(c)->currentText()); | |
| 242 | + _form.setProperty(i, item); | |
| 238 | 243 | } else { |
| 239 | 244 | e += 1; |
| 240 | 245 | bool ok = true; |
| @@ -288,6 +293,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 47 unmodified lines | ||
| 288 | 293 | if (result == QDialog::Accepted) { |
| 289 | 294 | int e = -1; |
| 290 | 295 | int d = -1; |
| 296 | + int c = -1; | |
| 291 | 297 | for (int i = 0; i < form.property("length").toInt32(); ++i) { |
| 292 | 298 | QScriptValue item = form.property(i); |
| 293 | 299 | QScriptValue value = item.property("value"); |
| @@ -303,6 +309,10 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 9 unmodified lines | ||
| 303 | 309 | value = _directories.at(d)->property("path").toString(); |
| 304 | 310 | item.setProperty("directory", value); |
| 305 | 311 | form.setProperty(i, item); |
| 312 | + } else if (item.property("options").isArray()) { | |
| 313 | + c += 1; | |
| 314 | + item.setProperty("value", _combos.at(c)->currentText()); | |
| 315 | + _form.setProperty(i, item); | |
| 306 | 316 | } else { |
| 307 | 317 | e += 1; |
| 308 | 318 | bool ok = true; |
| @@ -405,6 +415,15 @@ QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue · 96 unmodified lines | ||
| 405 | 415 | |
| 406 | 416 | } else if (item.property("type").toString() == "header") { |
| 407 | 417 | formLayout->addRow(new QLabel(item.property("label").toString())); |
| 418 | + } else if (item.property("options").isArray()) { | |
| 419 | + QComboBox* combo = new QComboBox(); | |
| 420 | + combo->setMinimumWidth(200); | |
| 421 | + QStringList options = item.property("options").toVariant().toStringList(); | |
| 422 | + for (QStringList::const_iterator it = options.begin(); it != options.end(); it += 1) { | |
| 423 | + combo->addItem(*it); | |
| 424 | + } | |
| 425 | + _combos.push_back(combo); | |
| 426 | + formLayout->addRow(new QLabel(item.property("label").toString()), combo); | |
| 408 | 427 | } else { |
| 409 | 428 | QLineEdit* edit = new QLineEdit(item.property("value").toString()); |
| 410 | 429 | edit->setMinimumWidth(200); |