Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -265,7 +265,11 @@ QScriptValue WindowScriptingInterface::doPeekNonBlockingFormResult(QScriptValue · 264 unmodified lines | ||
| 265 | 265 | _form.setProperty(i, item); |
| 266 | 266 | } else if (item.property("options").isArray()) { |
| 267 | 267 | c += 1; |
| 268 | − item.setProperty("value", _combos.at(c)->currentText()); | |
| 268 | + item.setProperty("value", | |
| 269 | + _combos.at(c)->currentIndex() < item.property("options").property("length").toInt32() ? | |
| 270 | + item.property("options").property(_combos.at(c)->currentIndex()) : | |
| 271 | + array.engine()->undefinedValue() | |
| 272 | + ); | |
| 269 | 273 | _form.setProperty(i, item); |
| 270 | 274 | } else { |
| 271 | 275 | e += 1; |
| @@ -318,7 +322,11 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 46 unmodified lines | ||
| 318 | 322 | _form.setProperty(i, item); |
| 319 | 323 | } else if (item.property("options").isArray()) { |
| 320 | 324 | c += 1; |
| 321 | − item.setProperty("value", _combos.at(c)->currentText()); | |
| 325 | + item.setProperty("value", | |
| 326 | + _combos.at(c)->currentIndex() < item.property("options").property("length").toInt32() ? | |
| 327 | + item.property("options").property(_combos.at(c)->currentIndex()) : | |
| 328 | + array.engine()->undefinedValue() | |
| 329 | + ); | |
| 322 | 330 | _form.setProperty(i, item); |
| 323 | 331 | } else { |
| 324 | 332 | e += 1; |
| @@ -349,6 +357,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 24 unmodified lines | ||
| 349 | 357 | _form = QScriptValue(); |
| 350 | 358 | _edits.clear(); |
| 351 | 359 | _directories.clear(); |
| 360 | + _combos.clear(); | |
| 352 | 361 | |
| 353 | 362 | array = _form; |
| 354 | 363 | return (_formResult == QDialog::Accepted); |
| @@ -391,8 +400,12 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 36 unmodified lines | ||
| 391 | 400 | form.setProperty(i, item); |
| 392 | 401 | } else if (item.property("options").isArray()) { |
| 393 | 402 | c += 1; |
| 394 | − item.setProperty("value", _combos.at(c)->currentText()); | |
| 395 | − _form.setProperty(i, item); | |
| 403 | + item.setProperty("value", | |
| 404 | + _combos.at(c)->currentIndex() < item.property("options").property("length").toInt32() ? | |
| 405 | + item.property("options").property(_combos.at(c)->currentIndex()) : | |
| 406 | + form.engine()->undefinedValue() | |
| 407 | + ); | |
| 408 | + form.setProperty(i, item); | |
| 396 | 409 | } else { |
| 397 | 410 | e += 1; |
| 398 | 411 | bool ok = true; |
| @@ -418,6 +431,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 19 unmodified lines | ||
| 418 | 431 | } |
| 419 | 432 | |
| 420 | 433 | delete editDialog; |
| 434 | + _combos.clear(); | |
| 421 | 435 | _edits.clear(); |
| 422 | 436 | _directories.clear(); |
| 423 | 437 | return (result == QDialog::Accepted); |
| @@ -498,9 +512,9 @@ QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue · 74 unmodified lines | ||
| 498 | 512 | } else if (item.property("options").isArray()) { |
| 499 | 513 | QComboBox* combo = new QComboBox(); |
| 500 | 514 | combo->setMinimumWidth(200); |
| 501 | − QStringList options = item.property("options").toVariant().toStringList(); | |
| 502 | − for (QStringList::const_iterator it = options.begin(); it != options.end(); it += 1) { | |
| 503 | − combo->addItem(*it); | |
| 515 | + qint32 options_count = item.property("options").property("length").toInt32();// .toJsonArray(); | |
| 516 | + for (qint32 i = 0; i < options_count; i++) { | |
| 517 | + combo->addItem(item.property("options").property(i).toString()); | |
| 504 | 518 | } |
| 505 | 519 | _combos.push_back(combo); |
| 506 | 520 | formLayout->addRow(new QLabel(item.property("label").toString()), combo); |