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


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

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


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

示例1: processCache

void PendingFileQueue::processCache()
{
    QTime currentTime = QTime::currentTime();

    for (const PendingFile& file : qAsConst(m_cache)) {
        if (file.shouldRemoveIndex()) {
            Q_EMIT removeFileIndex(file.path());

            m_recentlyEmitted.remove(file.path());
            m_pendingFiles.remove(file.path());
        }
        else if (file.shouldIndexXAttrOnly()) {
            Q_EMIT indexXAttr(file.path());
        }
        else if (file.shouldIndexContents()) {
            if (m_pendingFiles.contains(file.path())) {
                QTime time = m_pendingFiles[file.path()];

                int secondsLeft = currentTime.secsTo(time);
                secondsLeft = qBound(m_minTimeout, secondsLeft * 2, m_maxTimeout);

                time = currentTime.addSecs(secondsLeft);
                m_pendingFiles[file.path()] = time;
            }
            else if (m_recentlyEmitted.contains(file.path())) {
                QTime time = currentTime.addSecs(m_minTimeout);
                m_pendingFiles[file.path()] = time;
            }
            else {
                if (file.isNewFile()) {
                    Q_EMIT indexNewFile(file.path());
                } else {
                    Q_EMIT indexModifiedFile(file.path());
                }
                m_recentlyEmitted.insert(file.path(), currentTime);
            }
        } else {
            Q_ASSERT_X(false, "FileWatch", "The PendingFile should always have some flags set");
        }
    }

    m_cache.clear();

    if (!m_pendingFiles.isEmpty() && !m_pendingFilesTimer.isActive()) {
        m_pendingFilesTimer.setInterval(m_minTimeout * 1000);
        m_pendingFilesTimer.start();
    }

    if (!m_recentlyEmitted.isEmpty() && !m_clearRecentlyEmittedTimer.isActive()) {
        m_clearRecentlyEmittedTimer.setInterval(m_trackingTime * 1000);
        m_clearRecentlyEmittedTimer.start();
    }
}
开发者ID:stream009,项目名称:baloo,代码行数:53,代码来源:pendingfilequeue.cpp

示例2: updateMetrics

void WorkoutMetricsSummary::updateMetrics(QStringList &order, QHash<QString,RideMetricPtr>  &metrics)
{
    int row = 0;

    foreach(QString name, order)
    {
        RideMetricPtr rmp = metrics[name];
        if(!metricMap.contains(name))
        {
            QLabel *label = new QLabel((rmp->name()) + ":");
			label->setTextFormat(Qt::RichText);
            QLabel *lcd = new QLabel();
            metricMap[name] = QPair<QLabel*,QLabel*>(label,lcd);
            layout->addWidget(label,metricMap.size(),0);
            layout->addWidget(lcd,metricMap.size(),1);
        }
        QLabel *lcd = metricMap[name].second;
        if(name == "time_riding")
        {
            QTime start (0,0,0);
            QTime time = start.addSecs(rmp->value(true));
            QString s = time.toString("HH:mm:ss");
            //qDebug() << s << " " << time.second();
            lcd->setText(s);
        }
        else
        {
            lcd->setText(QString::number(rmp->value(true),'f',rmp->precision()) + " " + (rmp->units(true)) );
        }
        //qDebug() << name << ":" << (int)rmp->value(true);
        row++;
    }
开发者ID:GoldenCheetah,项目名称:GoldenCheetah,代码行数:32,代码来源:WorkoutWizard.cpp

示例3:

void frmtimer1::on_spinBoxPeriod_valueChanged(int arg1)
{
    QTime dtS;
    dtS = ui->timeEditStart->time();
    dtS.addSecs(arg1*60);
    ui->timeEditEnd->setTime(dtS);
}
开发者ID:eploentham,项目名称:TimerWater,代码行数:7,代码来源:frmtimer1.cpp

示例4: updatePlaylistWidgetEndsInTimer

void PlaylistDetailsWidget::updatePlaylistWidgetEndsInTimer()
{
    ecart-=1;
    QTime t = QTime(0,0);
    t = t.addSecs(ecart);
    _playlistEndsInValue->setText(t.toString("hh:mm:ss"));
}
开发者ID:cinemaouvert,项目名称:OPP,代码行数:7,代码来源:PlaylistDetailsWidget.cpp

示例5: verificationParties

void DialogProgTache::verificationParties()
{
    int min = 0;
    //on parcours toutes les parties
    for(int i = 0; i < vec_duree.size(); ++i)
    {
        //on faite la somme des durée pour vérifier que la somme == durée de la tache
        min += vec_duree.at(i).getHeure()*60;
        min += vec_duree.at(i).getMinute();
        if(i < vec_duree.size() -1)
        {
            QDate d = vec_date.at(i);
            QDate dd = vec_date.at(i+1);
            QTime deb = vec_debut.at(i);
            QTime debdeb = vec_debut.at(i+1);
            //on vérifie l'ordre des parties
            if((d > dd) || (d==dd && deb > debdeb))
                throw CalendarException("Ordre des parties incohérentes");
            //date et horaire différents
            if(d==dd && deb == debdeb)
                throw CalendarException("Les parties ne peuvent pas avoir la même programmation");
            QTime fin = deb.addSecs(vec_duree.at(i).getDureeEnMinutes()*60);
            //chevauchements
            if(d==dd && fin > debdeb)
                throw CalendarException("Les parties se chevauchent");
        }
        //vérifie la cohérence avec disponibilité et échéance
        if(vec_date.at(i) < tache->getDispo() || vec_date.at(i) > tache->getEcheance())
            throw CalendarException("Parties non conforme avec la disponibilité et échéance de la tache");
    }
    Duree d(min);
    if(!(tache->getDuree() == d)) throw CalendarException("Somme des durées des parties non cohérentes");
}
开发者ID:zinspierre,项目名称:ProjectCalendar_LO21,代码行数:33,代码来源:dialogprogtache.cpp

示例6: addTime

void KTimeEdit::addTime(QTime qt)
{
    // Calculate the new time.
    mTime = qt.addSecs(mTime.minute() * 60 + mTime.hour() * 3600);
    updateText();
    emit timeChanged(mTime);
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:7,代码来源:ktimeedit.cpp

示例7: updateDownloadInfo

void DownloadItem::updateDownloadInfo(double currSpeed, qint64 received, qint64 total)
{
#ifdef DOWNMANAGER_DEBUG
    qDebug() << __FUNCTION__ << currSpeed << received << total;
#endif
    //            QString          QString       QString     QString
    //          | m_remTime |   |m_currSize|  |m_fileSize|  |m_speed|
    // Remaining 26 minutes -     339MB of      693 MB        (350kB/s)

    int estimatedTime = ((total - received) / 1024) / (currSpeed / 1024);
    QString speed = currentSpeedToString(currSpeed);
    // We have QString speed now

    QTime time;
    time = time.addSecs(estimatedTime);
    QString remTime = remaingTimeToString(time);
    m_remTime = time;

    QString currSize = QzTools::fileSizeToString(received);
    QString fileSize = QzTools::fileSizeToString(total);

    if (fileSize == tr("Unknown size")) {
        ui->downloadInfo->setText(tr("%2 - unknown size (%3)").arg(currSize, speed));
    }
    else {
        ui->downloadInfo->setText(tr("Remaining %1 - %2 of %3 (%4)").arg(remTime, currSize, fileSize, speed));
    }
}
开发者ID:DmitriK,项目名称:qupzilla,代码行数:28,代码来源:downloaditem.cpp

示例8: removeTrainsOlderThan

void TrainModel::removeTrainsOlderThan(const QTime& since)
{
    qDebug() << "remove trains older than:" << since;

    for (int i=0; i < trains_.size();) {
        const QTime& departureTime = trains_.at(i).departureTime;

        // If we're removing trains before 11:45 PM and we are displaying a
        // train at 12:30 AM, that train will be removed.  So we don't want to
        // remove trains that are much earlier than 11:45 PM, say 12 hours.
        bool notTooOldCheck = true;
        if (since.hour() > 12) {
            QTime after = since.addSecs(-60 * 60 * 12);
            notTooOldCheck = departureTime >= after;
            qDebug() << "but don't remove trains newer than" << after << notTooOldCheck;
        }

        if (departureTime <= since && notTooOldCheck) {
            qDebug() << "removing:" << trains_.size() << i << trains_.at(i);

            beginRemoveRows(QModelIndex(), i, i);
            trains_.removeAt(i);
            endRemoveRows();

            qDebug() << "trains size" << trains_.size();
        }
        else {
            ++i;
        }
    }
}
开发者ID:kenrobbins,项目名称:caltrain_runner,代码行数:31,代码来源:TrainModel.cpp

示例9: getTempsTotal

QTime Profil::getTempsTotal()
{
	QTime total;
	foreach(QTime v, _resultatsNiveaux)
		total.addSecs(v.hour() * 3600 + v.minute() * 60 + v.second());
	return total;
}
开发者ID:gregaou,项目名称:QWhereIsTheKeys,代码行数:7,代码来源:profil.cpp

示例10: wrapInFunction

void wrapInFunction()
{

//! [0]
Q3DateEdit *dateEdit = new Q3DateEdit(QDate::currentDate(), this);
dateEdit->setRange(QDate::currentDate().addDays(-365),
                    QDate::currentDate().addDays( 365));
dateEdit->setOrder(Q3DateEdit::MDY);
dateEdit->setAutoAdvance(true);
//! [0]


//! [1]
QTime timeNow = QTime::currentTime();
Q3TimeEdit *timeEdit = new Q3TimeEdit(timeNow, this);
timeEdit->setRange(timeNow, timeNow.addSecs(60 * 60));
//! [1]


//! [2]
Q3DateTimeEdit *dateTimeEdit = new Q3DateTimeEdit(QDateTime::currentDateTime(), this);
dateTimeEdit->dateEdit()->setRange(QDateTime::currentDate(),
                                    QDateTime::currentDate().addDays(7));
//! [2]

}
开发者ID:RobertoMalatesta,项目名称:emscripten-qt,代码行数:26,代码来源:src_qt3support_widgets_q3datetimeedit.cpp

示例11: getRevisionString

QString DateChooserWidget::getRevisionString() const {
  QString timeString;
  QString dateString;

  QDate today = QDate::currentDate();

  if (m_selectedRadioIndex == 0)  // Time
  {
    QTime currentTime = QTime::currentTime();
    QTime t           = m_timeEdit->time();
    int seconds       = t.hour() * 60 * 60 + t.minute() * 60;
    currentTime       = currentTime.addSecs(-seconds);
    timeString        = currentTime.toString("hh:mm");
    dateString        = today.toString("yyyy-MM-dd");
  } else if (m_selectedRadioIndex == 1)  // Days
  {
    timeString = "00:00";
    today      = today.addDays(-(m_dayEdit->value()));
    dateString = today.toString("yyyy-MM-dd");
  } else if (m_selectedRadioIndex == 2)  // Weeks
  {
    timeString = "00:00";
    today      = today.addDays(-(m_weekEdit->value() * 7));
    dateString = today.toString("yyyy-MM-dd");
  } else  // Custom date
  {
    QTime time = m_dateTimeEdit->time();
    timeString = time.toString("hh:mm");

    QDate date = m_dateTimeEdit->date();
    dateString = date.toString("yyyy-MM-dd");
  }

  return "{" + dateString + " " + timeString + "}";
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:35,代码来源:versioncontrolwidget.cpp

示例12: 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

示例13: upTime

QTime CpuStat::upTime() const
{
    QTime t;
    for ( int i = 0; i < NValues; i++ )
        t = t.addSecs(int(procValues[i] / 100));

    return t;
}
开发者ID:BackupTheBerlios,项目名称:liveplayer0-svn,代码行数:8,代码来源:cpustat.cpp

示例14: getCurrentTime

QTime ACARSAirport::getCurrentTime(QTime UTCTime)
{
	QTime LCL = QTime(0,0,0,0);
	LCL = LCL.fromString(UTCTime.toString());
	LCL = LCL.addSecs(m_iTimezone);

	return LCL;
}
开发者ID:mjoppich,项目名称:ACARSv4.0,代码行数:8,代码来源:ACARSAirport.cpp

示例15: updateComboItems

/*! \brief Fills the combo box with a list of time slices, per default 30 minutes intervals.
 *
 * The interval can be set with setInterval(). Each time the user changes the combo value, the signal
 * \e timeChanged() is emitted. The current selected time can be retrieved anytime with time().
 */
void TimeComboBox::updateComboItems()
{
    // save current displayed time for restoring later
    QTime oldTime = this->time();

//    d->combo->clear();

    for (QTime time = QTime(0, 0); time < QTime(23, 59); time = time.addSecs(d->interval * 60)) {
        // Each combo item is filled with the current locale's time string, and the item data is set to the QTime,
        d->combo->addItem(time.toString(QLocale::system().timeFormat(QLocale::ShortFormat)), time);

        // prevent wrapping of time to next day -> infinite loop
        if (time.addSecs(d->interval * 60) < time)
            break;
    }
    setTime(oldTime);
}
开发者ID:eads77m,项目名称:freemedforms,代码行数:22,代码来源:timecombobox.cpp


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