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


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

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


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

示例1: time

RenderStatus& RenderThread::getStatus()
{
	status.Name = rtype;

	if (rendering)
	{
		QTime zero;
		const QTime time(zero.addMSecs((int)_est_remain));

		status.State = RenderStatus::Busy;
		status.Type = current_request->type();
		status.EstRemain = time;
		status.Percent = _percent_finished;
	}
	else if (kill_all_jobs || _stop_current_job)
	{
		status.State = RenderStatus::Killed;
	}
	else
	{
		QTime zero;
		const QTime timer(zero.addMSecs(millis));
		status.State = RenderStatus::Idle;
		status.Runtime = timer;
	}
	return status;
}
开发者ID:ShadowKyogre,项目名称:qosmic,代码行数:27,代码来源:renderthread.cpp

示例2: updateInfo

void DVDPanel::updateInfo()
{
  if (!mediaPlayer->isDVD())
    return;

  int title, ch;
  long pos, len;
  mediaPlayer->dvdGetLocation(&title, &ch, &pos, &len);
  if (mediaPlayer->isPlaying()) {
    appState->dvdPos = pos;
    appState->dvdTitle = title;
    appState->dvdChapter = ch;
  }
  QTime zero;
  if (title == 0)
    labels[TRACKNAME]->setText(QString("DVD: Menu"));
  else
    labels[TRACKNAME]->setText(QString("DVD: Title %1, Chapter %2")
			       .arg(title)
			       .arg(ch));
  labels[CURRENTTRACKTIME]->setText(zero.addMSecs(pos).toString("hh:mm"));
  labels[TRACKTIME]->setText(zero.addMSecs(len).toString("hh:mm"));
  labels[TIME]->setText(QTime::currentTime().toString("hh:mm:ss"));
  labels[DATE]->setText(QDate::currentDate().toString("d/M/yyyy"));
  if (mediaPlayer->isPlaying())
    labels[STATUS]->setText("PLAY");
  else if (mediaPlayer->isPaused())
    labels[STATUS]->setText("PAUSE");
  else if (mediaPlayer->isStopped())
    labels[STATUS]->setText("STOP");
  labels[VOLUME]->setText(QString::number(mediaPlayer->getVolume()) + "%");
  //  if (mediaPlayer->isPlaying() && len > 0 && pos > len - 2*UPDATE_DELAY)
  //    next();
}
开发者ID:vpulim,项目名称:headunit,代码行数:34,代码来源:DVDPanel.cpp

示例3: showNumberImages

void MainDialog::showNumberImages()
{
    int numberOfImages = m_ImagesFilesListBox->imageUrls().count();
    QTime totalDuration (0, 0, 0);

    int transitionDuration = 2000;

    if ( m_openglCheckBox->isChecked() )
        transitionDuration += 500;

    if (numberOfImages != 0)
    {
        if ( m_sharedData->useMilliseconds )
            totalDuration = totalDuration.addMSecs(numberOfImages * m_delaySpinBox->text().toInt());
        else
            totalDuration = totalDuration.addSecs(numberOfImages * m_delaySpinBox->text().toInt());

        totalDuration = totalDuration.addMSecs((numberOfImages - 1) * transitionDuration);
    }

    m_totalTime = totalDuration;

    // Notify total time is changed
    emit signalTotalTimeChanged(m_totalTime);

    m_label6->setText(i18np("%1 image [%2]", "%1 images [%2]", numberOfImages, totalDuration.toString()));
}
开发者ID:UIKit0,项目名称:digikam-2012-kipi-plugins,代码行数:27,代码来源:maindialog.cpp

示例4: run

void CassetteWorker::run()
{
    /* Open serial port */
    if (!mPort->open()) {
        return;
    }

    int lastBaud = 0;
    int block = 1;
    int remainingTime = mTotalDuration;

    QTime tm = QTime::currentTime();

    foreach (CassetteRecord record, mRecords) {
        if (lastBaud != record.baudRate) {
            lastBaud = record.baudRate;
            if (!mPort->setSpeed(lastBaud)) {
                return;
            }
        }
        emit statusChanged(remainingTime);
        qDebug() << "!n" << tr("[Cassette] Playing record %1 of %2 (%3 ms of gap + %4 bytes of data)")
                .arg(block)
                .arg(mRecords.count())
                .arg(record.gapDuration)
                .arg(record.data.length());
        tm = tm.addMSecs(record.gapDuration);
        int w = QTime::currentTime().msecsTo(tm);
        if (w < 0) {
            w = 0;
        }
        if (mustTerminate.tryLock(w)) {
            return;
        }
        tm = QTime::currentTime();
        tm = tm.addMSecs((record.data.length() * 10000 + (lastBaud/2))/lastBaud);
        for (int i=0; i < record.data.length(); i+=10) {
            mPort->writeRawFrame(record.data.mid(i, 10));
            if (mustTerminate.tryLock()) {
                return;
            }
        }
        block++;
        remainingTime -= record.totalDuration;
    }
    // Wait until last written bytes are transferred and then some (FTDI bug)
    int w = QTime::currentTime().msecsTo(tm);
    if (w < 0) {
        w = 0;
    }
    msleep(w + 500);
    mPort->close();
}
开发者ID:jzatarski,项目名称:RespeQt,代码行数:53,代码来源:sioworker.cpp

示例5: durationChanged

void RundownGroupWidget::durationChanged(int duration)
{
    Q_UNUSED(duration);

    QTime time = QTime::fromString(QString("00:00:00").append((this->useDropFrameNotation == true) ? ".00" : ":00"));
    this->labelDuration->setText(QString("Duration: %1").arg(Timecode::fromTime(time.addMSecs(this->command.getDuration()), this->useDropFrameNotation)));
}
开发者ID:CasparCG,项目名称:Client,代码行数:7,代码来源:RundownGroupWidget.cpp

示例6: QAbstractTableModel

TableModel::TableModel(QObject *parent) :
    QAbstractTableModel(parent)
{
    headerNames.append(tr("Server name"));
    headerNames.append(tr("Status"));
    headerNames.append(tr("Server port"));
    headerNames.append(tr("Start time"));
    headerNames.append(tr("Running time"));
    mRowCount = GameServerFactory::registeredServer().size();
    mColCount = headerNames.size();
    table = new QVariant* [mRowCount];
    for (int i = 0; i < mRowCount; i++)
        table[i] = new QVariant [mColCount];
    for (int i = 0; i < mRowCount; i++)
        for (int j = 0; j < mColCount; j++) {
            AbstractGameServer* server = GameServerFactory::registeredServer().at(i);
            QString str = "";
            switch(j) {
            case 0 : str = server->serverName(); break;
            case 1 : str = !server->serverState() ? tr("Running") : tr("Not running"); break;
            case 2 : str = QString::number(server->serverPort()); break;
            case 3 : str = server->startTime().toString("dd.MM.yyyy hh:mm:ss"); break;
            case 4 : {
                QTime time;
                time = time.addMSecs(server->runningTime());
                str = time.toString("hh:mm:ss");
                break;
            }
            }
            table[i][j] = str;
        }

}
开发者ID:chapayGhub,项目名称:1000_Game,代码行数:33,代码来源:tablemodel.cpp

示例7: mythCurrentDateTime

/** \fn mythCurrentDateTime()
 *  \brief Returns the current QDateTime object, stripped of its msec component
 */
QDateTime mythCurrentDateTime()
{
    QDateTime rettime = QDateTime::currentDateTime();
    QTime orig = rettime.time();
    rettime.setTime(orig.addMSecs(-orig.msec()));
    return rettime;
}
开发者ID:microe,项目名称:mythtv,代码行数:10,代码来源:util.cpp

示例8: setPosition

/**
 * called when the user changes the slider position 
 * @param value
 */
void MediaApp::setPosition(int value) {
    uint length = -m_player->getLength().msecsTo(QTime());
    if (length != 0 && value > 0) {
        QTime pos;
        pos = pos.addMSecs(length * (value / 1000.0));
        m_player->setPosition(pos);
    }
}
开发者ID:helcl42,项目名称:Streaming,代码行数:12,代码来源:MediaApp.cpp

示例9: gotoNext

bool QTDSResult::gotoNext(QSqlCachedResult::ValueCache &values, int index)
{
    STATUS stat = dbnextrow(d->dbproc);
    if (stat == NO_MORE_ROWS) {
        setAt(QSql::AfterLastRow);
        return false;
    }
    if ((stat == FAIL) || (stat == BUF_FULL)) {
        setLastError(d->lastError);
        return false;
    }

    if (index < 0)
        return true;

    for (int i = 0; i < d->rec.count(); ++i) {
        int idx = index + i;
        switch (d->rec.field(i).type()) {
            case QVariant::DateTime:
                if (qIsNull(d->buffer.at(i * 2 + 1))) {
                    values[idx] = QVariant(QVariant::DateTime);
                } else {
                    DBDATETIME *bdt = (DBDATETIME*) d->buffer.at(i * 2);
                    QDate date = QDate::fromString(QLatin1String("1900-01-01"), Qt::ISODate);
                    QTime time = QTime::fromString(QLatin1String("00:00:00"), Qt::ISODate);
                    values[idx] = QDateTime(date.addDays(bdt->dtdays), time.addMSecs(int(bdt->dttime / 0.3)));
                }
                break;
            case QVariant::Int:
                if (qIsNull(d->buffer.at(i * 2 + 1)))
                    values[idx] = QVariant(QVariant::Int);
                else
                    values[idx] = *((int*)d->buffer.at(i * 2));
                break;
            case QVariant::Double:
            case QVariant::String:
                if (qIsNull(d->buffer.at(i * 2 + 1)))
                    values[idx] = QVariant(QVariant::String);
                else
                    values[idx] = QString::fromLocal8Bit((const char*)d->buffer.at(i * 2)).trimmed();
                break;
            case QVariant::ByteArray: {
                if (qIsNull(d->buffer.at(i * 2 + 1)))
                    values[idx] = QVariant(QVariant::ByteArray);
                else
                    values[idx] = QByteArray((const char*)d->buffer.at(i * 2));
                break;
            }
            default:
                // should never happen, and we already fired
                // a warning while binding.
                values[idx] = QVariant();
                break;
        }
    }

    return true;
}
开发者ID:Suneal,项目名称:qt,代码行数:58,代码来源:qsql_tds.cpp

示例10:

void k9ChapterEdit::sliderChanged(int _value) {
   if (m_aviDecode->opened()) {
        //m_aviDecode->seek((double)slider->value() / 100);
        m_aviDecode->readFrame((double)_value / 1000);
        QTime t;
        t=t.addMSecs((double)_value);
        Ui_chapterEdit.lPosition->setText(t.toString("hh:mm:ss"));
    }
}
开发者ID:netrunner-debian-attic,项目名称:k9copy,代码行数:9,代码来源:k9chapteredit.cpp

示例11: foreach

QVector<AlarmTask> AlarmRepository::match(const QTime &currentTime) const
{
    QVector<AlarmTask> result;
    foreach (AlarmTask alarmTask, alarmTaskList) {
        QTime begin = alarmTask.getTime();
        QTime end = begin.addMSecs(alarmTask.getDurationMs());
        if (currentTime >= begin  && currentTime <= end) {
            result.push_back(alarmTask);
        }
    }
开发者ID:yunushkin,项目名称:Alarm,代码行数:10,代码来源:alarmrepository.cpp

示例12: prepareTime

QString SomeUtils::prepareTime(const float ms)
{
    QTime dt = QTime::fromString("0", "z");
    dt = dt.addMSecs(ms);
    QString timeStr;
    timeStr = QString(tr("%1h %2m %3s %4ms")).arg(dt.toString("hh"))
                                             .arg(dt.toString("mm"))
                                             .arg(dt.toString("ss"))
                                             .arg(dt.toString("zzz"));
    return timeStr.remove(QRegExp("^(00. )*"));
}
开发者ID:Anthony-Gaudino,项目名称:SVGCleaner,代码行数:11,代码来源:someutils.cpp

示例13: asTime

// get the value as time
QTime KCValue::asTime(const KCCalculationSettings* settings) const
{
    Q_UNUSED(settings);
    QTime dt;

    const int days = asInteger();
    const int msecs = qRound(numToDouble(asFloat() - double(days)) * 86400000.0);      // 24*60*60*1000
    dt = dt.addMSecs(msecs);

    return dt;
}
开发者ID:KDE,项目名称:koffice,代码行数:12,代码来源:KCValue.cpp

示例14: seek

void Player::seek(qint64 value)
{
    uint length = -m_GstPlayer->length().msecsTo(QTime());
    if (length != 0 && value > -1) {
        QTime pos;
        pos = pos.addMSecs(length * (value / 1000.0));
        m_GstPlayer->setPosition(pos);

        Q_EMIT seeked(length * (value / 1000.0) * 1000);
    }
}
开发者ID:Nerobrain,项目名称:pulsar,代码行数:11,代码来源:player.cpp

示例15: complete

void FingerPrintsGenerator::complete()
{
    QTime t;
    t = t.addMSecs(d->duration.elapsed());
    setLabel(i18n("<b>Update of fingerprint database complete.</b>"));
    setTitle(i18n("Duration: %1", t.toString()));
    setButtonGuiItem(KStandardGuiItem::ok());
    setButtonText(i18n("&Close"));
    // Pop-up a message to bring user when all is done.
    KNotificationWrapper("fingerprintscompleted", i18n("Update of fingerprint database complete."),
                         this, windowTitle());
    emit signalRebuildAllFingerPrintsDone();
}
开发者ID:UIKit0,项目名称:digikam,代码行数:13,代码来源:fingerprintsgenerator.cpp


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