本文整理汇总了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);
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}
示例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();
}
}
示例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 ();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
}
示例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;
}
}