Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 4 files). Show all
Unified · Split
| @@ -248,6 +248,7 @@ QScriptValue WindowScriptingInterface::doPeekNonBlockingFormResult(QScriptValue · 247 unmodified lines | ||
| 248 | 248 | int e = -1; |
| 249 | 249 | int d = -1; |
| 250 | 250 | int c = -1; |
| 251 | + int h = -1; | |
| 251 | 252 | for (int i = 0; i < _form.property("length").toInt32(); ++i) { |
| 252 | 253 | QScriptValue item = _form.property(i); |
| 253 | 254 | QScriptValue value = item.property("value"); |
| @@ -271,6 +272,11 @@ QScriptValue WindowScriptingInterface::doPeekNonBlockingFormResult(QScriptValue · 17 unmodified lines | ||
| 271 | 272 | array.engine()->undefinedValue() |
| 272 | 273 | ); |
| 273 | 274 | _form.setProperty(i, item); |
| 275 | + } else if (item.property("type").toString() == "checkbox") { | |
| 276 | + h++; | |
| 277 | + value = _checks.at(h)->checkState() == Qt::Checked; | |
| 278 | + item.setProperty("value", value); | |
| 279 | + _form.setProperty(i, item); | |
| 274 | 280 | } else { |
| 275 | 281 | e += 1; |
| 276 | 282 | bool ok = true; |
| @@ -305,6 +311,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 28 unmodified lines | ||
| 305 | 311 | int e = -1; |
| 306 | 312 | int d = -1; |
| 307 | 313 | int c = -1; |
| 314 | + int h = -1; | |
| 308 | 315 | for (int i = 0; i < _form.property("length").toInt32(); ++i) { |
| 309 | 316 | QScriptValue item = _form.property(i); |
| 310 | 317 | QScriptValue value = item.property("value"); |
| @@ -328,6 +335,11 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 17 unmodified lines | ||
| 328 | 335 | array.engine()->undefinedValue() |
| 329 | 336 | ); |
| 330 | 337 | _form.setProperty(i, item); |
| 338 | + } else if (item.property("type").toString() == "checkbox") { | |
| 339 | + h++; | |
| 340 | + value = _checks.at(h)->checkState() == Qt::Checked; | |
| 341 | + item.setProperty("value", value); | |
| 342 | + _form.setProperty(i, item); | |
| 331 | 343 | } else { |
| 332 | 344 | e += 1; |
| 333 | 345 | bool ok = true; |
| @@ -358,6 +370,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 24 unmodified lines | ||
| 358 | 370 | _edits.clear(); |
| 359 | 371 | _directories.clear(); |
| 360 | 372 | _combos.clear(); |
| 373 | + _checks.clear(); | |
| 361 | 374 | |
| 362 | 375 | array = _form; |
| 363 | 376 | return (_formResult == QDialog::Accepted); |
| @@ -383,6 +396,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 19 unmodified lines | ||
| 383 | 396 | int e = -1; |
| 384 | 397 | int d = -1; |
| 385 | 398 | int c = -1; |
| 399 | + int h = -1; | |
| 386 | 400 | for (int i = 0; i < form.property("length").toInt32(); ++i) { |
| 387 | 401 | QScriptValue item = form.property(i); |
| 388 | 402 | QScriptValue value = item.property("value"); |
| @@ -406,6 +420,11 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 17 unmodified lines | ||
| 406 | 420 | form.engine()->undefinedValue() |
| 407 | 421 | ); |
| 408 | 422 | form.setProperty(i, item); |
| 423 | + } else if (item.property("type").toString() == "checkbox") { | |
| 424 | + h++; | |
| 425 | + value = _checks.at(h)->checkState() == Qt::Checked; | |
| 426 | + item.setProperty("value", value); | |
| 427 | + form.setProperty(i, item); | |
| 409 | 428 | } else { |
| 410 | 429 | e += 1; |
| 411 | 430 | bool ok = true; |
| @@ -432,6 +451,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 20 unmodified lines | ||
| 432 | 451 | |
| 433 | 452 | delete editDialog; |
| 434 | 453 | _combos.clear(); |
| 454 | + _checks.clear(); | |
| 435 | 455 | _edits.clear(); |
| 436 | 456 | _directories.clear(); |
| 437 | 457 | return (result == QDialog::Accepted); |
| @@ -518,6 +538,12 @@ QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue · 80 unmodified lines | ||
| 518 | 538 | } |
| 519 | 539 | _combos.push_back(combo); |
| 520 | 540 | formLayout->addRow(new QLabel(item.property("label").toString()), combo); |
| 541 | + } else if (item.property("type").toString() == "checkbox") { | |
| 542 | + QCheckBox* check = new QCheckBox(); | |
| 543 | + check->setTristate(false); | |
| 544 | + check->setCheckState(item.property("value").toString() == "true" ? Qt::Checked : Qt::Unchecked); | |
| 545 | + _checks.push_back(check); | |
| 546 | + formLayout->addRow(new QLabel(item.property("label").toString()), check); | |
| 521 | 547 | } else { |
| 522 | 548 | QLineEdit* edit = new QLineEdit(item.property("value").toString()); |
| 523 | 549 | edit->setMinimumWidth(200); |