void KPAOS4Checker::check() { QString inPort(Settings::get().getMidiInPort()); QString outPort(Settings::get().getMidiOutPort()); if(inPort.isEmpty() || outPort.isEmpty()) { SettingsDialog settingsDialog(nullptr); settingsDialog.exec(); inPort = Settings::get().getMidiInPort(); outPort = Settings::get().getMidiOutPort(); } if(Midi::get().openPorts(inPort, outPort)) { QEventLoop el; el.connect(this, &KPAOS4Checker::stopLoop, &el, &QEventLoop::quit); el.connect(&stompDelayObj, &Stomp::onOffReceived, this, &KPAOS4Checker::onOfReceived); el.connect(mTimer, &QTimer::timeout, this, &KPAOS4Checker::timerTimeout); mTimer->start(500); stompDelayObj.requestOnOff(); el.exec(); el.disconnect(this, &KPAOS4Checker::stopLoop, &el, &QEventLoop::quit); el.disconnect(&stompDelayObj, &Stomp::onOffReceived, this, &KPAOS4Checker::onOfReceived); el.disconnect(mTimer, &QTimer::timeout, this, &KPAOS4Checker::timerTimeout); } }
// Wait for request to complete bool QOrganizerItemRequestQueue::waitForRequestFinished( QOrganizerAbstractRequest* req, int msecs) { // Verify that request exists in this manager if (!m_abstractRequestMap.keys().contains(req)) return false; // Verify that request is active if (req->state() != QOrganizerAbstractRequest::ActiveState) return false; // Create an event loop QEventLoop *loop = new QEventLoop(this); // If request state changes quit the loop QObject::connect(req, SIGNAL(stateChanged(QOrganizerAbstractRequest::State)), loop, SLOT(quit())); // Set a timeout for the request // NOTE: zero means wait forever if (msecs > 0) QTimer::singleShot(msecs, loop, SLOT(quit())); // Start the loop loop->exec(); loop->disconnect(); loop->deleteLater(); return (req->state() == QOrganizerAbstractRequest::FinishedState); }
void Vkeybord::slotEnter() { m_lbWaitKeyIn->setText(ui->lineEdit->text()); qDebug()<<"parent name : "<<m_lbWaitKeyIn->parent()->objectName()<<" ,lb objname : "<<m_lbWaitKeyIn->objectName()<<" lbText: "<<m_lbWaitKeyIn->text(); ui->lineEdit->setText(""); m_ani->setStartValue(QPoint(0,0)); m_ani->setEndValue(QPoint(0,height())); QEventLoop loop; loop.connect(m_ani,SIGNAL(finished()),&loop,SLOT(quit())); m_ani->start(); loop.exec(); hide(); loop.disconnect(); }