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


C++ QTime::msecsTo方法代码示例

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


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

示例1: end

void k9ChapterEdit::urlSelected(const KUrl& _url) {
  bool fileChanged=_url.toLocalFile() !=m_aviFile->getFileName();
  if (!m_aviDecode) {
     m_aviDecode =new k9AviDecode(0,0);
     connect(m_aviDecode,SIGNAL(drawFrame(QImage)),this,SLOT(drawImage(QImage)));
  }
  m_aviDecode->open(_url.toLocalFile());
  if (!m_noUpdate) {
    m_aviFile->setFileName(_url.toLocalFile());
    if (fileChanged) {
        m_aviDecode->readFrame(0);
	m_aviFile->setStart(QTime(0,0,0));
	m_aviFile->setImage(m_image);
	QTime end(0,0,0);
	end=end.addSecs((int)(m_aviDecode->getDuration()));
	m_aviFile->setEnd(end);
	m_aviFile->setNext(NULL);
	m_aviFile->setPrevious(NULL);
        Ui_chapterEdit.ckBreakEnd->setChecked(false);
        Ui_chapterEdit.ckBreakStart->setChecked(false);
        ckBreakEndClick();
        ckBreakStartClick();
	setAviFile(m_aviFile);
    } 
  }

  QTime t;
  int sec=t.msecsTo(m_aviFile->getStart());
  Ui_chapterEdit.slider->setMaximum((int)(m_aviDecode->getDuration()*1000));

  Ui_chapterEdit.slider->setValue(sec);
  
}
开发者ID:netrunner-debian-attic,项目名称:k9copy,代码行数:33,代码来源:k9chapteredit.cpp

示例2: timerEvent

void ossimQtScrollingImageWidget::timerEvent(QTimerEvent* /* evt */)
{
   QTime start = QTime::currentTime();
   eraseCursor();
   viewport()->setCursor(Qt::WaitCursor);
   
   while(theReqMap.size() > 0)
   {
      ossimQtScrollingImageWidgetReqQueueItem item = theReqQueue.top();
      std::map<ossim_int32, ossimIrect>::iterator currentIter = theReqMap.find(item.theId);
      theReqQueue.pop();
      
      ossimIrect currentTileRect = (*currentIter).second;
      
      theReqMap.erase(currentIter);
      convertRequest(currentTileRect);
      QTime end = QTime::currentTime();
      if(start.msecsTo(end) >= maxProcessingTime)
      {
         return;
      }
   }
   if(theReqMap.size() == 0)
   {
      while(!theReqQueue.empty())
      {
         theReqQueue.pop();
      }
   }
   killTimer(theTimerId);
   theTimerId = -1;
   viewport()->setCursor(Qt::CrossCursor);
}
开发者ID:star-labs,项目名称:star_ossim,代码行数:33,代码来源:ossimQtScrollingImageWidget.cpp

示例3: GC

void StringTable::GC()
{
    QMutexLocker locker(&m_lock);

    int initialSize = 0;
    QTime startTime;
    if (DebugStringTable) {
        initialSize = m_strings.size();
        startTime = QTime::currentTime();
    }

    // Collect all QStrings which have refcount 1. (One reference in m_strings and nowhere else.)
    for (QSet<QString>::iterator i = m_strings.begin(); i != m_strings.end();) {
        if (m_stopGCRequested.testAndSetRelease(true, false))
            return;

        if (!isQStringInUse(*i))
            i = m_strings.erase(i);
        else
            ++i;
    }

    if (DebugStringTable) {
        const int currentSize = m_strings.size();
        qDebug() << "StringTable::GC removed" << initialSize - currentSize
                 << "strings in" << startTime.msecsTo(QTime::currentTime())
                 << "ms, size is now" << currentSize;
    }
}
开发者ID:OnlineCop,项目名称:qt-creator,代码行数:29,代码来源:stringtable.cpp

示例4: processQueryResults

QList<CachedRowEntry> EventQuery::updateQueryNepomuk(const QUrl &uri)
{
    QTime startTime = QTime::currentTime();

    // first fetch all publications
    // this will lead to duplicates as we fetch for author names and types too
    // for each rdf:type and each connected author/publisher/editor we get the resource as result

    //If you update this, also update initialQueryNepomuk and processQueryResults and the enum ColumnList and the EventModel
    QString query = QString::fromLatin1("select distinct ?title ?star ?date ?publication where { {"
                                        "%1 nbib:eventpublication ?pub ."
                                        "OPTIONAL { ?pub nie:title ?publication . }"

                                        "OPTIONAL { %1 nie:title ?title . }"
                                        "OPTIONAL { %1 nao:numericRating ?star . }"
                                        "OPTIONAL { %1 ncal:date ?date . }"
                                        "}").arg( Soprano::Node::resourceToN3( uri ) );

    QList<CachedRowEntry> newCache = processQueryResults(query, uri);

    QTime endTime = QTime::currentTime();
    kDebug() << "update" << newCache.size() << "entries after" << startTime.msecsTo(endTime) << "msec";

    return newCache;
}
开发者ID:KDE,项目名称:conquirere,代码行数:25,代码来源:eventquery.cpp

示例5: startAuditTimer

void Server::startAuditTimer()
{
    //Read configured time from flat file database
    QFile auditFile(AUDITCONFIG_DATABASE_FILE);
    if(!auditFile.open(QIODevice::ReadOnly)) {
        qDebug() << "error" << auditFile.errorString();
    }

    QTextStream auditFileIn(&auditFile);

    QString line;
    while(!auditFileIn.atEnd()) {
        line = auditFileIn.readLine();
        QStringList split = line.split(PIPE_DELIMETER);
        if(QString::fromLocal8Bit(split.at(0).toLocal8Bit()) == "configurabletime"){
            auditTime = QTime::fromString(QString::fromLocal8Bit(split.at(1).toLocal8Bit()),"hh:mm:ss");
            break;
        }
    }
    auditFile.close();

    //Set timer to wait till that time and then trigger the audit
    QTime currentTime = QTime::currentTime();
    int interval = currentTime.msecsTo(auditTime);
    if(interval < 0){
        interval = 86400000 + interval;
    }

    qDebug() << "Milliseconds till next audit: " << interval;

    connect(auditTimer, SIGNAL(timeout()), this, SLOT(runAudit()));
    auditTimer->start(interval);
}
开发者ID:chrispwright,项目名称:comp3004cuCarePrivate,代码行数:33,代码来源:server.cpp

示例6: sendPing

void Client::sendPing()
{
    //On stocke le nombre de millisecondes jusqu'à minuit.
    QTime time;
    Paquet out;
    out << SMSG_PING;
    out << quint32(time.msecsTo(QTime::currentTime()));
    out >> m_socket;

    m_pingsPending++;

    if (m_pingsPending > m_parent->getMaxPingsPending())
    {
        console(m_pseudo + " a été kické pour ping timeout.");

        //On avertit les connectés.
        if (!m_pseudo.isEmpty())
        {
            Paquet out;
            out << SMSG_USER_KICKED;
            out << QString("le serveur");    //Par qui on a été kické
            out << m_pseudo;                 //Qui a été kické
            out << QString("ping timeout");  //Raison
            m_parent->envoyerAuChannel(out, m_channel);
        }

        //Déconnexion.
        m_socket->abort();
    }
}
开发者ID:Zxb12,项目名称:Chat,代码行数:30,代码来源:client.cpp

示例7: SetWidgetSettings

			void BrowserWidget::SetWidgetSettings (const BrowserWidgetSettings& settings)
			{
				if (settings.ZoomFactor_ != 1)
				{
					qDebug () << Q_FUNC_INFO
						<< "setting zoomfactor to"
						<< settings.ZoomFactor_;
					Ui_.WebView_->setZoomFactor (settings.ZoomFactor_);
				}

				NotifyWhenFinished_->setChecked (settings.NotifyWhenFinished_);
				QTime interval = settings.ReloadInterval_;
				QTime null (0, 0, 0);
				int msecs = null.msecsTo (interval);
				if (msecs >= 1000)
				{
					ReloadPeriodically_->setChecked (true);
					SetActualReloadInterval (interval);
				}

				if (settings.WebHistorySerialized_.size ())
				{
					QDataStream str (settings.WebHistorySerialized_);
					str >> *Ui_.WebView_->page ()->history ();
				}
开发者ID:grio,项目名称:leechcraft,代码行数:25,代码来源:browserwidget.cpp

示例8: CheckTimers

// Fire any timers that have passed.
int MHGroup::CheckTimers(MHEngine *engine)
{
    QTime currentTime = QTime::currentTime(); // Get current time
    QList<MHTimer *>::iterator it = m_Timers.begin();
    MHTimer *pTimer;
    int nMSecs = 0;

    while (it != m_Timers.end())
    {
        pTimer = *it;

        if (pTimer->m_Time <= currentTime)   // Use <= rather than < here so we fire timers with zero time immediately.
        {
            // If the time has passed trigger the event and remove the timer from the queue.
            engine->EventTriggered(this, EventTimerFired, pTimer->m_nTimerId);
            delete pTimer;
            it = m_Timers.erase(it);
        }
        else
        {
            // This has not yet expired.  Set "nMSecs" to the earliest time we have.
            int nMSecsToGo = currentTime.msecsTo(pTimer->m_Time);

            if (nMSecs == 0 || nMSecsToGo < nMSecs)
            {
                nMSecs = nMSecsToGo;
            }

            ++it;
        }
    }

    return nMSecs;
}
开发者ID:DragonStalker,项目名称:mythtv,代码行数:35,代码来源:Groups.cpp

示例9: incomingData

	void incomingData(Stream *stream)
	{
		Message *message = Message::receive(stream);
		UserMessage *userMessage = dynamic_cast<UserMessage *>(message);
		if (userMessage)
		{
			if (userMessage->type == eventId)
			{
				double elapsedTime = (double)startingTime.msecsTo(QTime::currentTime()) / 1000.;
				if (outputFile.is_open())
					outputFile << elapsedTime;
				timeStamps.push_back(elapsedTime);
				for (size_t i = 0; i < values.size(); i++)
				{
					if (i < userMessage->data.size())
					{
						if (outputFile.is_open())
							outputFile << " " << userMessage->data[i];
						values[i].push_back(userMessage->data[i]);
					}
					else
					{
						if (outputFile.is_open())
							outputFile << " " << 0;
						values[i].push_back(0);
					}
				}
				if (outputFile.is_open())
					outputFile << endl;
				replot();
			}
		}
		delete message;
	}
开发者ID:davidjsherman,项目名称:aseba,代码行数:34,代码来源:eventlogger.cpp

示例10: QString

QList<CachedRowEntry> EventQuery::initialQueryNepomuk()
{
    QTime startTime = QTime::currentTime();

    // helping string to filter for all documents that are related to the current project
    QString projectRelated;
    QString projectTag;
    if(m_library->libraryType() == BibGlobals::Library_Project) {
        projectRelated = QString("?r nao:isRelated  <%1> .").arg(m_library->settings()->projectThing().uri().toString());
        projectTag = QString("UNION { ?r nao:hasTag  <%1> . }").arg(m_library->settings()->projectTag().uri().toString() );
    }

    // first fetch all series
    // this will lead to duplicates as we fetch for nbib:eventpublication names
    // each connected publicaion we get the resource as result
    QString query = QString::fromLatin1("select distinct ?r ?title ?star ?date ?publication where { {"
                                        "?r a ncal:Event . "
                                        "?r nbib:eventpublication ?pub ."

                                        "OPTIONAL { ?pub nie:title ?publication . }"

                                        "OPTIONAL { ?r nie:title ?title . }"
                                        "OPTIONAL { ?r nao:numericRating ?star . }"
                                        "OPTIONAL { ?r ncal:date ?date . }"
                                        + projectRelated.toLatin1() + " }" + projectTag.toLatin1() +

                                        "}");

    QList<CachedRowEntry> newCache = processQueryResults(query);

    QTime endTime = QTime::currentTime();
    kDebug() << "add" << newCache.size() << "entries after" << startTime.msecsTo(endTime) << "msec";

    return newCache;
}
开发者ID:KDE,项目名称:conquirere,代码行数:35,代码来源:eventquery.cpp

示例11: test_textedit_add

float MainWindow::test_textedit_add(int count) {
    ui->tabMain->setCurrentIndex(3);
    QTime start = QTime::currentTime();
    for (int i=0; i<count; ++i) {
        ui->testTextEdit->insertPlainText("Future is open. ");
        ui->testTextEdit->repaint();
    }
    return (float)start.msecsTo(QTime::currentTime())/1000.0f;
}
开发者ID:isoft-linux,项目名称:qtperf,代码行数:9,代码来源:mainwindow.cpp

示例12: test_checkbox

float MainWindow::test_checkbox(int count) {
    ui->tabMain->setCurrentIndex(2);
    QTime start = QTime::currentTime();
    for (int i=0; i<count; ++i) {
        ui->testCheckBox->setChecked(!ui->testCheckBox->isChecked());
        ui->testCheckBox->repaint();
    }
    return (float)start.msecsTo(QTime::currentTime())/1000.0f;
}
开发者ID:isoft-linux,项目名称:qtperf,代码行数:9,代码来源:mainwindow.cpp

示例13: test_pushbutton

float MainWindow::test_pushbutton(int count) {
    ui->tabMain->setCurrentIndex(2);
    QTime start = QTime::currentTime();
    for (int i=0; i<count; ++i) {
        ui->testButton->setDown(!ui->testButton->isDown());
        ui->testButton->repaint();
    }
    return (float)start.msecsTo(QTime::currentTime())/1000.0f;
}
开发者ID:isoft-linux,项目名称:qtperf,代码行数:9,代码来源:mainwindow.cpp

示例14: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    on_generateButton_clicked();
    QTime time;
    qsrand(time.msecsTo(QTime::currentTime())); // srand init
}
开发者ID:Nicknixer,项目名称:passgen-qt,代码行数:9,代码来源:mainwindow.cpp

示例15: sleep

void Phantom::sleep(int ms)
{
    QTime startTime = QTime::currentTime();
    while (true) {
        QApplication::processEvents(QEventLoop::AllEvents, 25);
        if (startTime.msecsTo(QTime::currentTime()) > ms)
            break;
    }
}
开发者ID:10git,项目名称:TheObserver,代码行数:9,代码来源:phantom.cpp


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