void TestItem::setCheck(bool check){ if (check != m_check){ m_check = check; emit checkChanged(); emit dataChanged(); } }
void QFFrameRangeEdit::setRange(int minRange, int maxRange) { spinFirst->setRange(minRange, maxRange); spinLast->setRange(minRange, maxRange); if (chkFirst->isChecked()) spinFirst->setValue(0); if (chkLast->isChecked()) spinLast->setValue(maxRange); checkChanged(); }
void RolloutBox::setChecked(bool checked) { if (m_checked != checked) { m_checked = checked; m_checkBox->setChecked(checked); QList<QWidget*> L = findChildren<QWidget*>(); for (int i = 0; i < L.size(); ++i) { if ((L[i] != m_toolButton) && (L[i] != m_checkBox)) L[i]->setEnabled(checked); } checkChanged(m_checked); } }
void ModelEdit::closeEvent(QCloseEvent* e) { // Ask all children to close for (unsigned int i = 0; i < _objectEdits.size(); ++i) { ObjectEdit* edit = _objectEdits[i]; if (edit == NULL) continue; if (!edit->close()) return; } if (!checkChanged()) return; QWidget::closeEvent(e); }
void tst_QQuickAccessible::checkableTest() { QScopedPointer<QQuickView> window(new QQuickView()); window->setSource(testFileUrl("checkbuttons.qml")); window->show(); QQuickItem *contentItem = window->contentItem(); QVERIFY(contentItem); QQuickItem *rootItem = contentItem->childItems().first(); QVERIFY(rootItem); // the window becomes active QAccessible::State activatedChange; activatedChange.active = true; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window.data()); QVERIFY(iface); QAccessibleInterface *root = iface->child(0); QAccessibleInterface *button1 = root->child(0); QCOMPARE(button1->role(), QAccessible::Button); QVERIFY(!(button1->state().checked)); QVERIFY(!(button1->state().checkable)); QVERIFY(button1->state().focusable); QVERIFY(!button1->state().focused); QTestAccessibility::clearEvents(); // set properties QQuickItem *button1item = qobject_cast<QQuickItem*>(rootItem->childItems().at(0)); QVERIFY(button1item); QCOMPARE(button1item->objectName(), QLatin1String("button1")); button1item->forceActiveFocus(); QVERIFY(button1->state().focusable); QVERIFY(button1->state().focused); QAccessibleEvent focusEvent(button1item, QAccessible::Focus); QVERIFY_EVENT(&focusEvent); QAccessibleInterface *button2 = root->child(1); QVERIFY(!(button2->state().checked)); QVERIFY(button2->state().checkable); QQuickItem *button2item = qobject_cast<QQuickItem*>(rootItem->childItems().at(1)); QVERIFY(button2item); QCOMPARE(button2item->objectName(), QLatin1String("button2")); QAccessibleInterface *button3 = root->child(2); QVERIFY(button3->state().checked); QVERIFY(button3->state().checkable); QAccessibleInterface *checkBox1 = root->child(3); QCOMPARE(checkBox1->role(), QAccessible::CheckBox); QVERIFY(checkBox1->state().checked); QVERIFY(checkBox1->state().checkable); QQuickItem *checkbox1item = qobject_cast<QQuickItem*>(rootItem->childItems().at(3)); QVERIFY(checkbox1item); QCOMPARE(checkbox1item->objectName(), QLatin1String("checkbox1")); checkbox1item->setProperty("checked", false); QVERIFY(!checkBox1->state().checked); QAccessible::State checkState; checkState.checked = true; QAccessibleStateChangeEvent checkChanged(checkbox1item, checkState); QVERIFY_EVENT(&checkChanged); checkbox1item->setProperty("checked", true); QVERIFY(checkBox1->state().checked); QVERIFY_EVENT(&checkChanged); QAccessibleInterface *checkBox2 = root->child(4); QVERIFY(!(checkBox2->state().checked)); QVERIFY(checkBox2->state().checkable); QTestAccessibility::clearEvents(); }
//Load a (new) competition from the server. bool oEvent::readSynchronize(const CompetitionInfo &ci) { if (ci.Id<=0) throw std::exception("help:12290"); if (isThreadReconnecting()) return false; HasDBConnection=false; #ifdef BUILD_DB_DLL if (!msConnectToServer) return false; #endif MySQLServer=ci.Server; MySQLPassword=ci.ServerPassword; MySQLPort=ci.ServerPort; MySQLUser=ci.ServerUser; //Delete non-server competitions. list<CompetitionInfo> saved; list<CompetitionInfo>::iterator it; for (it=cinfo.begin(); it!=cinfo.end(); ++it) { if (it->Server.empty()) saved.push_back(*it); } cinfo=saved; if (!msConnectToServer(this)) { char bf[256]; msGetErrorState(bf); throw std::exception(bf); return false; } for (it=cinfo.begin(); it!=cinfo.end(); ++it) { if (it->Name.size() > 1 && it->Name[0] == '%') it->Name = lang.tl(it->Name.substr(1)); } newCompetition(""); Id=ci.Id; strcpy_s(CurrentNameId, ci.FullPath.c_str()); char file[260]; sprintf_s(file, "%s.dbmeos", CurrentNameId); getUserFile(CurrentFile, file); if ( !msOpenDatabase(this) ) { char bf[256]; msGetErrorState(bf); throw std::exception(bf); } updateFreeId(); HasDBConnection=false; openRunnerDatabase(CurrentNameId); int ret = msSynchronizeRead(this); if (ret == 0) { char bf[256]; msGetErrorState(bf); string err = string("Kunde inte öppna tävlingen (X)#") + bf; throw std::exception(err.c_str()); } else if (ret == 1) { // Warning char bf[256]; msGetErrorState(bf); string info = "Databasvarning: X#" + lang.tl(bf); gdibase.addInfoBox("sqlerror", info, 15000); } // Cache database locally saveRunnerDatabase(CurrentNameId, false); HasDBConnection=true; // Setup multirunner links for (oRunnerList::iterator it = Runners.begin(); it != Runners.end(); ++it) it->createMultiRunner(false,false); // Remove incorrect references for (oRunnerList::iterator it = Runners.begin(); it != Runners.end(); ++it) { if (it->multiRunner.size() > 0 ) { vector<pRunner> &pr = it->multiRunner; for (size_t k=0; k<pr.size(); k++) { if (pr[k]==0 || pr[k]->tParentRunner != &*it) { it->multiRunner.clear(); it->updateChanged(); it->synchronize(); break; } } } } // Check duplicates vector<bool> usedInTeam(qFreeRunnerId+1); bool teamCorrected = false; for (oTeamList::iterator it = Teams.begin(); it != Teams.end(); ++it) { if (it->correctionNeeded) { it->updateChanged(); teamCorrected = true; } for (size_t i = 0; i < it->Runners.size(); i++) { pRunner r = it->Runners[i]; if (r != 0) { int expectedIndex = -1; if (it->Class) expectedIndex = it->Class->getLegRunnerIndex(i); if (expectedIndex>=0 && expectedIndex != r->getMultiIndex()) { int baseLeg = it->Class->getLegRunner(i); it->setRunner(baseLeg, r->getMultiRunner(0), true); teamCorrected = true; } } } for (size_t i = 0; i < it->Runners.size(); i++) { pRunner r = it->Runners[i]; if (r != 0) { if (usedInTeam[r->Id]) { it->Runners[i] = 0; // Reset duplicate runners it->updateChanged(); teamCorrected = true; if (r->tInTeam == &*it) r->tInTeam = 0; } else usedInTeam[r->Id] = true; } } } usedInTeam.clear(); if (teamCorrected) { for (oTeamList::iterator it = Teams.begin(); it != Teams.end(); ++it) { it->apply(true, 0, false); } } reEvaluateAll(set<int>(), false); vector<string> out; checkChanged(out); assert(out.empty()); for (oRunnerList::iterator it = Runners.begin(); it != Runners.end(); ++it) { if (it->correctionNeeded) { it->createMultiRunner(true, true); if (it->tInTeam && it->Class) { pTeam t = it->tInTeam; int nr = min(int(it->Class->getNumStages())-1, int(it->multiRunner.size())); t->setRunner(0, &*it, true); for (int k=0; k<nr; k++) t->setRunner(k+1, it->multiRunner[k], true); t->updateChanged(); t->synchronize(); } it->synchronizeAll(); } } return true; }
void ChanWidgetLED::setChecked(bool i) { m_checked = i; updateWithBackground(); checkChanged( m_checked ); }
void ColumnEdit::closeEvent(QCloseEvent* e) { if (!checkChanged()) return; QWidget::closeEvent(e); }
void Led::setChecked(bool i) { m_checked = i; updateWithBackground(); checkChanged( m_checked ); }