当前位置: 首页>>代码示例>>C++>>正文


C++ QEventLoop::processEvents方法代码示例

本文整理汇总了C++中QEventLoop::processEvents方法的典型用法代码示例。如果您正苦于以下问题:C++ QEventLoop::processEvents方法的具体用法?C++ QEventLoop::processEvents怎么用?C++ QEventLoop::processEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QEventLoop的用法示例。


在下文中一共展示了QEventLoop::processEvents方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: run

void Thread::run()
{
  m_commandQueue = new CommandQueue(this);
  m_settings = new Settings();
  setCurrentProtocol("ftp");
  m_startupSem.release();
  
  // Enter the event loop
  QEventLoop eventLoop;
  while (!m_exit) {
    if (m_commandsDeferred)
      eventLoop.processEvents(QEventLoop::ProcessEventsFlag(QEventLoop::DeferredDeletion));
    else
      eventLoop.processEvents(QEventLoop::WaitForMoreEvents | QEventLoop::ProcessEventsFlag(QEventLoop::DeferredDeletion));
    
    if (m_commandsDeferred) {
      m_socket->nextCommand();
      m_commandsDeferred--;
    }
  }
  
  // Cleanup before exiting
  delete m_settings;
  delete m_commandQueue;
  
  foreach (Socket *socket, m_sockets) {
    delete socket;
  }

  // Schedule our deletion
  deleteLater();
}
开发者ID:netrunner-debian-kde-extras,项目名称:kftpgrabber,代码行数:32,代码来源:thread.cpp

示例2: run

void GeneratorDaemon::run()
{
  qDebug() << "thread started";
  QEventLoop eventLoop;
  m_loginQuery = new LoginQuery("DemoUser", "test", this);
  connect(m_loginQuery, SIGNAL(connected()), SLOT(onConnected()));
  connect(m_loginQuery, SIGNAL(errorOccured(QString)), SLOT(onError(QString)));
  m_loginQuery->doRequest();
  for (;;)
  {
    if (m_isConnected)
    {
      qDebug() << "connected: auth_token=" << m_loginQuery->getUser()->getToken();
      qDebug() << "tagQuery " << m_tagQuery;
      if (m_tagQuery)
      {
        for (int i=0;i<m_marks.size();i++)
        {
          m_tagQuery->getTag()->setTime(QDateTime::currentDateTime());
          m_tagQuery->getTag()->setLatitude(m_marks.at(i).x());
          m_tagQuery->getTag()->setLongitude(m_marks.at(i).y());
          m_tagQuery->doRequest();
          qDebug() << "adding mark";
          eventLoop.processEvents(QEventLoop::ExcludeUserInputEvents, 1000);
          QThread::msleep(5000);
        }
      }
    }
    eventLoop.processEvents(QEventLoop::ExcludeUserInputEvents, 1000);
    QThread::msleep(5000);
  }
}
开发者ID:4ukuta,项目名称:core,代码行数:32,代码来源:GeneratorDaemon.cpp

示例3: eventLoop

void eventLoop(QApplication& a, Engine& engine) {
    QEventLoop loop;

    while(running()) {
        a.sendPostedEvents();
        loop.processEvents(QEventLoop::WaitForMoreEvents);
        while (engine.isRunnable()) {
            engine.interpret();
            a.sendPostedEvents();
            loop.processEvents(QEventLoop::AllEvents);
        }
    }
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例4: app_aboutToQuit

void NDnsManager::app_aboutToQuit()
{
	while(man) {
		QEventLoop *e = qApp->eventLoop();
		e->processEvents(QEventLoop::WaitForMore);
	}
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:7,代码来源:ndns.cpp

示例5: eraseRoad

bool DirtyListExecutor::eraseRoad(Way *R)
{
    Progress->setValue(++Done);

    qDebug() << QString("REMOVE road %1").arg(R->id().numId);

    Progress->setLabelText(tr("REMOVE road %1").arg(R->id().numId) + userName(R));
    QEventLoop L; L.processEvents(QEventLoop::ExcludeUserInputEvents);
//	QString URL("/api/0.3/way/%1");
//	URL = URL.arg(stripToOSMId(R->id()));
    QString URL = theDownloader->getURLToDelete("way",stripToOSMId(R->id()));
    QString DataIn, DataOut;
    DataIn = wrapOSM(exportOSM(*R, ChangeSetId), ChangeSetId);
    if (sendRequest("DELETE",URL,DataIn,DataOut))
    {
        R->setLastUpdated(Feature::OSMServer);
        if (!g_Merk_Frisius) {
            R->layer()->remove(R);
            document()->getUploadedLayer()->add(R);
        }
        R->setUploaded(true);
        R->setDirtyLevel(0);
        return EraseFromHistory;
    }
    return false;
}
开发者ID:4x4falcon,项目名称:fosm-merkaartor,代码行数:26,代码来源:DirtyList.cpp

示例6: updatePoint

bool DirtyListExecutor::updatePoint(Node* Pt)
{
    Progress->setValue(++Done);

    qDebug() << QString("UPDATE trackpoint %1").arg(Pt->id().numId);

    Progress->setLabelText(tr("UPDATE trackpoint %1").arg(Pt->id().numId) + userName(Pt));
    QEventLoop L; L.processEvents(QEventLoop::ExcludeUserInputEvents);
//	QString URL("/api/0.3/node/%1");
//	URL = URL.arg(stripToOSMId(Pt->id()));
    QString URL = theDownloader->getURLToUpdate("node",stripToOSMId(Pt->id()));
    QString DataIn, DataOut;
    DataIn = wrapOSM(exportOSM(*Pt, ChangeSetId), ChangeSetId);
    if (sendRequest("PUT",URL,DataIn,DataOut))
    {
        Pt->setLastUpdated(Feature::OSMServer);

        int NewVersion = DataOut.toInt();
        if (NewVersion <= Pt->versionNumber())
            NewVersion = Pt->versionNumber()+1;
        Pt->setVersionNumber(NewVersion);

        if (!g_Merk_Frisius) {
            Pt->layer()->remove(Pt);
            document()->getUploadedLayer()->add(Pt);
        }
        Pt->setUploaded(true);
        Pt->setDirtyLevel(0);
        return EraseFromHistory;
    }
    return false;
}
开发者ID:4x4falcon,项目名称:fosm-merkaartor,代码行数:32,代码来源:DirtyList.cpp

示例7: updateRoad

bool DirtyListExecutor::updateRoad(Way* R)
{
    Progress->setValue(++Done);

    qDebug() << QString("UPDATE road %1").arg(R->id().numId);

    Progress->setLabelText(tr("UPDATE road %1").arg(R->id().numId) + userName(R));
    QEventLoop L; L.processEvents(QEventLoop::ExcludeUserInputEvents);
    QString URL = theDownloader->getURLToUpdate("way",stripToOSMId(R->id()));
    QString DataIn, DataOut;
    DataIn = wrapOSM(exportOSM(*R, ChangeSetId), ChangeSetId);
    if (sendRequest("PUT",URL,DataIn,DataOut))
    {
        R->setLastUpdated(Feature::OSMServer);

        int NewVersion = DataOut.toInt();
        if (NewVersion <= R->versionNumber())
            NewVersion = R->versionNumber()+1;
        R->setVersionNumber(NewVersion);

        if (!g_Merk_Frisius) {
            R->layer()->remove(R);
            document()->getUploadedLayer()->add(R);
        }
        R->setUploaded(true);
        R->setDirtyLevel(0);
        return EraseFromHistory;
    }
    return true;
}
开发者ID:4x4falcon,项目名称:fosm-merkaartor,代码行数:30,代码来源:DirtyList.cpp

示例8: addPoint

bool DirtyListExecutor::addPoint(Node* Pt)
{
    Progress->setValue(++Done);

    qDebug() << QString("ADD trackpoint %1").arg(Pt->id().numId);

    Progress->setLabelText(tr("ADD trackpoint %1").arg(Pt->id().numId) + userName(Pt));
    QEventLoop L; L.processEvents(QEventLoop::ExcludeUserInputEvents);

    QString DataIn, DataOut;
    IFeature::FId OldId;
    OldId = Pt->id();
    Pt->setId(IFeature::FId(IFeature::Point, 0));
    DataIn = wrapOSM(exportOSM(*Pt, ChangeSetId), ChangeSetId);
    Pt->setId(OldId);
    QString URL=theDownloader->getURLToCreate("node");
    if (sendRequest("PUT",URL,DataIn,DataOut))
    {
        // chop off extra spaces, newlines etc
        Pt->setId(IFeature::FId(IFeature::Point, DataOut.toInt()));
        Pt->setLastUpdated(Feature::OSMServer);
        Pt->setVersionNumber(1);
        if (!g_Merk_Frisius) {
            Pt->layer()->remove(Pt);
            document()->getUploadedLayer()->add(Pt);
        }
        Pt->setUploaded(true);
        Pt->setDirtyLevel(0);
        return EraseFromHistory;
    }
    return false;
}
开发者ID:4x4falcon,项目名称:fosm-merkaartor,代码行数:32,代码来源:DirtyList.cpp

示例9: SLOT

int PhpWebView::click2(QWebElement elem, bool samewnd)
{
	if (elem.isNull())
		return 0;

	if (samewnd)
		elem.removeAttribute("target");

	QEventLoop loop;
	isNewViewCreated = false;
	isNewViewBegin = false;
	
	QString js = "var e = document.createEvent('MouseEvents');";
	//js += "e.initEvent( 'click', true, true );";
    js += "e.initMouseEvent( 'click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);";
    js += "this.dispatchEvent(e);";
	elem.evaluateJavaScript(js);
	
	QTimer::singleShot(1000, &loop, SLOT(quit()));
	loop.exec();
	
	while (browser && isNewViewBegin && !isNewViewCreated)
		loop.processEvents();

	return 1;
}
开发者ID:scraperlab,项目名称:browserext,代码行数:26,代码来源:phpwebview.cpp

示例10: QProcess

/**
  * @brief Fetch the raw list of DNS resolvers and return them as strings.
  */
QStringList OpenNICSystem::getBootstrapT2List()
{
    QStringList outputList;
    QStringList ips;
    QEventLoop loop;
    QString program = "dig";
    QStringList arguments;
    QString output;
    arguments << "dns.opennic.glue" << "+short";
    QProcess* process = new QProcess();
    process->start(program, arguments);
    while (process->waitForFinished(15000))
    {
        loop.processEvents();
    }
    output = process->readAllStandardOutput();
    outputList = output.trimmed().split('\n');
    for(int n=0; n < outputList.count(); n++)
    {
        QString ip = outputList.at(n).trimmed();
        if ( ip.length() )
        {
            if (ip.at(0) >= '0' && ip.at(0) <= '9')
            {
                ips.append(ip);
            }
        }
    }
    delete process;
    return ips;
}
开发者ID:8bitgeek,项目名称:OpenNIC-Wizard,代码行数:34,代码来源:opennicsystem.cpp

示例11: updateResolver

/**
  * @brief Add a dns entry to the system's list of DNS resolvers.
  * @param resolver The IP address of teh resolver to add to the system
  * @param index resolver sequence (1..n)
  */
int OpenNICSystem::updateResolver(QHostAddress& resolver,int index,QString& output)
{
    int rc;
    QEventLoop loop;
    QString program = "netsh";
    QStringList arguments;
    if ( ++index == 1 ) /* on windows(tm) index starts at 1 */
    {
        arguments << "interface" << "ip" << "set" << "dns" << "Local Area Connection" << "static" << resolver.toString();
    }
    else
    {
        arguments << "interface" << "ip" << "add" << "dns" << "Local Area Connection" << resolver.toString() << "index="+QString::number(index);
    }
    QProcess* process = new QProcess();
    process->start(program, arguments);
    while (process->waitForFinished(10000))
    {
        loop.processEvents();
    }
    output = process->readAllStandardOutput().trimmed() + "\n";
    rc = process->exitCode();
    delete process;
    return rc;
}
开发者ID:8bitgeek,项目名称:OpenNIC-Wizard,代码行数:30,代码来源:opennicsystem.cpp

示例12: start

bool DirtyListExecutor::start()
{
    ChangeSetId = "";
    Progress->setValue(++Done);

    qDebug() << QString("OPEN changeset");

    Progress->setLabelText(tr("OPEN changeset"));
    QEventLoop L; L.processEvents(QEventLoop::ExcludeUserInputEvents);

    QString DataIn(
        "<osm>"
        "<changeset>"
        "<tag k=\"created_by\" v=\"Merkaartor %1 (%2)\"/>"
        "<tag k=\"comment\" v=\"%3\"/>"
        "</changeset>"
        "</osm>");
    DataIn = DataIn.arg(STRINGIFY(VERSION)).arg(QLocale::system().name().split("_")[0]).arg(Utils::encodeAttributes(glbChangeSetComment));
    QString DataOut;
    QString URL = theDownloader->getURLToOpenChangeSet();
    if (sendRequest("PUT",URL,DataIn, DataOut))
    {
        ChangeSetId = DataOut;
        return true;
    }
    return false;
}
开发者ID:4x4falcon,项目名称:fosm-merkaartor,代码行数:27,代码来源:DirtyList.cpp

示例13: run

void RenderThread::run()
{
	qRegisterMetaType<FramePtr>("FramePtr");
	qRegisterMetaType<FrameList>("FrameList");
	qRegisterMetaType<FrameListPtr>("FrameListPtr");

	WARNING_LOG("Render run start");

	QEventLoop eventLoop;
	while (!m_Exit)
	{
		eventLoop.processEvents();
		Render();
	}

	WARNING_LOG("Render run cleaning up");

	for (int i = 0; i < m_RenderFrames.size(); i++) 
	{
		FramePtr renderFrame = m_RenderFrames.at(i);
		if (renderFrame)
		{
			m_Renderer->Deallocate(renderFrame);
		}
	}
	m_RenderFrames.clear();

	WARNING_LOG("Render run finish");
}
开发者ID:Gamaru,项目名称:yuvtoolkit,代码行数:29,代码来源:RenderThread.cpp

示例14: run

void ClientManage::run(void)
{
    auto o = connect(qApp, &QCoreApplication::aboutToQuit, [&]()
    {
        m_exitByApplication = true;
        this->quit();
    });

    m_start = new ClientStart(this);
    m_isRun = true;

    this->exec();

    delete m_start;
    m_start = NULL;

    for(auto now = m_sockets.begin(); now != m_sockets.end(); now++)
    {
        now.key()->deleteLater();
    }

    if(!m_exitByApplication)
    {
        QEventLoop eventLoop;
        while(eventLoop.processEvents(QEventLoop::ExcludeUserInputEvents));
    }

    disconnect(o);
}
开发者ID:188080501,项目名称:LanMeetingWhiteboard,代码行数:29,代码来源:JasonQt_TcpClient.cpp

示例15: run

void DataThread::run()
{
  qDebug() << "thread started";
  QEventLoop eventLoop;
  QString login = m_settings.value("user").toString();
  QString password = m_settings.value("password").toString();
  if(login.isEmpty())
    login = "Mark";
  if(password.isEmpty())
    password = "test";

  m_loginQuery = new LoginQuery(login, password, parent());
  connect(m_loginQuery, SIGNAL(connected()), SLOT(onConnected()));
  connect(m_loginQuery, SIGNAL(errorOccured(QString)), SLOT(onError(QString)));
  m_loginQuery->doRequest();
  for(;;)
  {
    if(m_isConnected)
    {
      qDebug() << "connected: auth_token=" << m_loginQuery->getSession()->getUser()->getToken();
      emit(getFeed());
      //ToDo query RSS

    }
    else
    {
      m_loginQuery->doRequest();
    }

    eventLoop.processEvents(QEventLoop::ExcludeUserInputEvents, 1000);
    QThread::msleep(5000);
  }
}
开发者ID:h0st,项目名称:core,代码行数:33,代码来源:DataThread.cpp


注:本文中的QEventLoop::processEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。