本文整理汇总了C++中QDateTime函数的典型用法代码示例。如果您正苦于以下问题:C++ QDateTime函数的具体用法?C++ QDateTime怎么用?C++ QDateTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QDateTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MetadataFactory
DTC::VideoLookupList* Video::LookupVideo( const QString &Title,
const QString &Subtitle,
const QString &Inetref,
int Season,
int Episode,
const QString &GrabberType )
{
DTC::VideoLookupList *pVideoLookups = new DTC::VideoLookupList();
MetadataLookupList list;
MetadataFactory *factory = new MetadataFactory(NULL);
if (factory)
list = factory->SynchronousLookup(Title, Subtitle,
Inetref, Season, Episode, GrabberType);
if ( !list.size() )
return pVideoLookups;
for( int n = 0; n < list.size(); n++ )
{
DTC::VideoLookup *pVideoLookup = pVideoLookups->AddNewVideoLookup();
MetadataLookup *lookup = list[n];
if (lookup)
{
pVideoLookup->setTitle(lookup->GetTitle());
pVideoLookup->setSubTitle(lookup->GetSubtitle());
pVideoLookup->setSeason(lookup->GetSeason());
pVideoLookup->setEpisode(lookup->GetEpisode());
pVideoLookup->setYear(lookup->GetYear());
pVideoLookup->setTagline(lookup->GetTagline());
pVideoLookup->setDescription(lookup->GetDescription());
pVideoLookup->setCertification(lookup->GetCertification());
pVideoLookup->setInetref(lookup->GetInetref());
pVideoLookup->setHomePage(lookup->GetHomepage());
pVideoLookup->setReleaseDate(QDateTime(lookup->GetReleaseDate()));
pVideoLookup->setUserRating(lookup->GetUserRating());
pVideoLookup->setLength(lookup->GetRuntime());
pVideoLookup->setLanguage(lookup->GetLanguage());
pVideoLookup->setCountries(lookup->GetCountries());
pVideoLookup->setPopularity(lookup->GetPopularity());
pVideoLookup->setBudget(lookup->GetBudget());
pVideoLookup->setRevenue(lookup->GetRevenue());
pVideoLookup->setIMDB(lookup->GetIMDB());
pVideoLookup->setTMSRef(lookup->GetTMSref());
ArtworkList coverartlist = lookup->GetArtwork(kArtworkCoverart);
ArtworkList::iterator c;
for (c = coverartlist.begin(); c != coverartlist.end(); ++c)
{
DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
art->setType("coverart");
art->setUrl((*c).url);
art->setThumbnail((*c).thumbnail);
art->setWidth((*c).width);
art->setHeight((*c).height);
}
ArtworkList fanartlist = lookup->GetArtwork(kArtworkFanart);
ArtworkList::iterator f;
for (f = fanartlist.begin(); f != fanartlist.end(); ++f)
{
DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
art->setType("fanart");
art->setUrl((*f).url);
art->setThumbnail((*f).thumbnail);
art->setWidth((*f).width);
art->setHeight((*f).height);
}
ArtworkList bannerlist = lookup->GetArtwork(kArtworkBanner);
ArtworkList::iterator b;
for (b = bannerlist.begin(); b != bannerlist.end(); ++b)
{
DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
art->setType("banner");
art->setUrl((*b).url);
art->setThumbnail((*b).thumbnail);
art->setWidth((*b).width);
art->setHeight((*b).height);
}
ArtworkList screenshotlist = lookup->GetArtwork(kArtworkScreenshot);
ArtworkList::iterator s;
for (s = screenshotlist.begin(); s != screenshotlist.end(); ++s)
{
DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
art->setType("screenshot");
art->setUrl((*s).url);
art->setThumbnail((*s).thumbnail);
art->setWidth((*s).width);
art->setHeight((*s).height);
}
delete lookup;
}
}
pVideoLookups->setCount ( list.count() );
pVideoLookups->setAsOf ( QDateTime::currentDateTime() );
//.........这里部分代码省略.........
示例2: refreshMetrics
// Refresh not up to date metrics
void MetricAggregator::refreshMetrics()
{
refreshMetrics(QDateTime());
}
示例3: QDateTime
QDateTime InfoTimeDestination::dateTime() const
{
return QDateTime( QDate( m_year, m_month, m_day ),
QTime( m_hour, m_minute, 0 ) );
}
示例4: Q_D
/*!
Sets minimum \a minTime and maximum \a maxTime in QTime format. This will allow the user to set a time range on datetime picker.
\param minTime minimum time in QTime format.
\param maxTime maximum time in QTime format.
\sa setMinimumTime \sa setMaximumTime
*/
void HbDateTimePicker::setTimeRange(const QTime &minTime, const QTime &maxTime)
{
Q_D(HbDateTimePicker);
setDateTimeRange(QDateTime(d->mMinimumDate.date(), minTime),
QDateTime(d->mMinimumDate.date(), maxTime));
}
示例5: qDebug
qDebug() << "Failed to save the recurrent event; error:" << defaultManager.error();
//! [Creating a recurrent event]
//! [Retrieving occurrences of a particular recurrent event within a time period]
QList<QOrganizerItem> instances = defaultManager.itemOccurrences(marshmallowMeeting, startDateTime, endDateTime);
//! [Retrieving occurrences of a particular recurrent event within a time period]
qDebug() << "dumping retrieved instances:";
foreach(const QOrganizerItem& currInst, instances)
{
dumpItem(currInst);
qDebug() << "....................";
}
//! [Retrieving the next 5 occurrences of a particular recurrent event]
instances = defaultManager.itemOccurrences(marshmallowMeeting, QDateTime::currentDateTime(), QDateTime(), 5);
//! [Retrieving the next 5 occurrences of a particular recurrent event]
//! [Retrieving the next 10 occurrences of any item (Agenda View)]
instances = defaultManager.items(QDateTime::currentDateTime(), QDateTime());
instances = instances.mid(0, 10);
//! [Retrieving the next 10 occurrences of any item (Agenda View)]
//! [Creating a non-recurrent entry]
// a default constructed journal will have it's date/time set to the current date/time.
QOrganizerJournal journal;
journal.setDescription("The conference went well. We all agree that marshmallows are awesome, "\
"but we were unable to reach any agreement as to how we could possibly "\
"increase our intake of marshmallows. Several action points were assigned "\
"to various members of the group; I have been tasked with finding a good "\
"recipe that combines both marshmallows and chocolate, by next Wednesday.");
示例6: QDateTime
void PublicationType::clearDate()
{
m_date = QDateTime();
}
示例7: hasScaleBasedVisibility
//.........这里部分代码省略.........
layerElement.appendChild( layerName );
layerElement.appendChild( layerTitle );
layerElement.appendChild( layerAbstract );
// layer keyword list
QStringList keywordStringList = keywordList().split( "," );
if ( keywordStringList.size() > 0 )
{
QDomElement layerKeywordList = document.createElement( "keywordList" );
for ( int i = 0; i < keywordStringList.size(); ++i )
{
QDomElement layerKeywordValue = document.createElement( "value" );
QDomText layerKeywordText = document.createTextNode( keywordStringList.at( i ).trimmed() );
layerKeywordValue.appendChild( layerKeywordText );
layerKeywordList.appendChild( layerKeywordValue );
}
layerElement.appendChild( layerKeywordList );
}
// layer metadataUrl
QString aDataUrl = dataUrl();
if ( !aDataUrl.isEmpty() )
{
QDomElement layerDataUrl = document.createElement( "dataUrl" );
QDomText layerDataUrlText = document.createTextNode( aDataUrl );
layerDataUrl.appendChild( layerDataUrlText );
layerDataUrl.setAttribute( "format", dataUrlFormat() );
layerElement.appendChild( layerDataUrl );
}
// layer legendUrl
QString aLegendUrl = legendUrl();
if ( !aLegendUrl.isEmpty() )
{
QDomElement layerLegendUrl = document.createElement( "legendUrl" );
QDomText layerLegendUrlText = document.createTextNode( aLegendUrl );
layerLegendUrl.appendChild( layerLegendUrlText );
layerLegendUrl.setAttribute( "format", legendUrlFormat() );
layerElement.appendChild( layerLegendUrl );
}
// layer attribution
QString aAttribution = attribution();
if ( !aAttribution.isEmpty() )
{
QDomElement layerAttribution = document.createElement( "attribution" );
QDomText layerAttributionText = document.createTextNode( aAttribution );
layerAttribution.appendChild( layerAttributionText );
layerAttribution.setAttribute( "href", attributionUrl() );
layerElement.appendChild( layerAttribution );
}
// layer metadataUrl
QString aMetadataUrl = metadataUrl();
if ( !aMetadataUrl.isEmpty() )
{
QDomElement layerMetadataUrl = document.createElement( "metadataUrl" );
QDomText layerMetadataUrlText = document.createTextNode( aMetadataUrl );
layerMetadataUrl.appendChild( layerMetadataUrlText );
layerMetadataUrl.setAttribute( "type", metadataUrlType() );
layerMetadataUrl.setAttribute( "format", metadataUrlFormat() );
layerElement.appendChild( layerMetadataUrl );
}
// timestamp if supported
if ( timestamp() > QDateTime() )
{
QDomElement stamp = document.createElement( "timestamp" );
QDomText stampText = document.createTextNode( timestamp().toString( Qt::ISODate ) );
stamp.appendChild( stampText );
layerElement.appendChild( stamp );
}
layerElement.appendChild( layerName );
// zorder
// This is no longer stored in the project file. It is superfluous since the layers
// are written and read in the proper order.
// spatial reference system id
QDomElement mySrsElement = document.createElement( "srs" );
mCRS->writeXML( mySrsElement, document );
layerElement.appendChild( mySrsElement );
#if 0
// <transparencyLevelInt>
QDomElement transparencyLevelIntElement = document.createElement( "transparencyLevelInt" );
QDomText transparencyLevelIntText = document.createTextNode( QString::number( getTransparency() ) );
transparencyLevelIntElement.appendChild( transparencyLevelIntText );
maplayer.appendChild( transparencyLevelIntElement );
#endif
// now append layer node to map layer node
writeCustomProperties( layerElement, document );
return writeXml( layerElement, document );
} // bool QgsMapLayer::writeXML
示例8: Q_ASSERT_X
void DailyRollingFileAppender::computeRollOverTime()
{
// Q_ASSERT_X(, "DailyRollingFileAppender::computeRollOverTime()", "Lock must be held by caller")
Q_ASSERT_X(!mActiveDatePattern.isEmpty(), "DailyRollingFileAppender::computeRollOverTime()", "No active date pattern");
QDateTime now = QDateTime::currentDateTime();
QDate now_date = now.date();
QTime now_time = now.time();
QDateTime start;
switch (mFrequency)
{
case MINUTELY_ROLLOVER:
{
start = QDateTime(now_date,
QTime(now_time.hour(),
now_time.minute(),
0, 0));
mRollOverTime = start.addSecs(60);
}
break;
case HOURLY_ROLLOVER:
{
start = QDateTime(now_date,
QTime(now_time.hour(),
0, 0, 0));
mRollOverTime = start.addSecs(60*60);
}
break;
case HALFDAILY_ROLLOVER:
{
int hour = now_time.hour();
if (hour >= 12)
hour = 12;
else
hour = 0;
start = QDateTime(now_date,
QTime(hour, 0, 0, 0));
mRollOverTime = start.addSecs(60*60*12);
}
break;
case DAILY_ROLLOVER:
{
start = QDateTime(now_date,
QTime(0, 0, 0, 0));
mRollOverTime = start.addDays(1);
}
break;
case WEEKLY_ROLLOVER:
{
// QT numbers the week days 1..7. The week starts on Monday.
// Change it to being numbered 0..6, starting with Sunday.
int day = now_date.dayOfWeek();
if (day == Qt::Sunday)
day = 0;
start = QDateTime(now_date,
QTime(0, 0, 0, 0)).addDays(-1 * day);
mRollOverTime = start.addDays(7);
}
break;
case MONTHLY_ROLLOVER:
{
start = QDateTime(QDate(now_date.year(),
now_date.month(),
1),
QTime(0, 0, 0, 0));
mRollOverTime = start.addMonths(1);
}
break;
default:
Q_ASSERT_X(false, "DailyRollingFileAppender::computeInterval()", "Invalid datePattern constant");
mRollOverTime = QDateTime::fromTime_t(0);
}
mRollOverSuffix = static_cast<DateTime>(start).toString(mActiveDatePattern);
Q_ASSERT_X(static_cast<DateTime>(now).toString(mActiveDatePattern) == mRollOverSuffix,
"DailyRollingFileAppender::computeRollOverTime()", "File name changes within interval");
Q_ASSERT_X(mRollOverSuffix != static_cast<DateTime>(mRollOverTime).toString(mActiveDatePattern),
"DailyRollingFileAppender::computeRollOverTime()", "File name does not change with rollover");
logger()->trace("Computing roll over time from %1: The interval start time is %2. The roll over time is %3",
now,
start,
mRollOverTime);
}
示例9: checkVariant
void tst_QXmppRpcIq::testDateTime()
{
checkVariant(QDateTime(QDate(1998, 7, 17), QTime(14, 8, 55)),
QByteArray("<value><dateTime.iso8601>1998-07-17T14:08:55</dateTime.iso8601></value>"));
}
示例10: QDate
void ClearPrivateData::dialogAccepted()
{
QApplication::setOverrideCursor(Qt::WaitCursor);
if (ui->history->isChecked()) {
qint64 start = QDateTime::currentMSecsSinceEpoch();
qint64 end = 0;
const QDate today = QDate::currentDate();
const QDate week = today.addDays(1 - today.dayOfWeek());
const QDate month = QDate(today.year(), today.month(), 1);
switch (ui->historyLength->currentIndex()) {
case 0: //Later Today
end = QDateTime(today).toMSecsSinceEpoch();
break;
case 1: //Week
end = QDateTime(week).toMSecsSinceEpoch();
break;
case 2: //Month
end = QDateTime(month).toMSecsSinceEpoch();
break;
case 3: //All
break;
}
if (end == 0) {
mApp->history()->clearHistory();
}
else {
const QList<int> &indexes = mApp->history()->indexesFromTimeRange(start, end);
mApp->history()->deleteHistoryEntry(indexes);
}
}
if (ui->cookies->isChecked()) {
mApp->cookieJar()->setAllCookies(QList<QNetworkCookie>());
}
if (ui->cache->isChecked()) {
clearCache();
}
if (ui->databases->isChecked()) {
clearWebDatabases();
}
if (ui->localStorage->isChecked()) {
clearLocalStorage();
}
if (ui->icons->isChecked()) {
clearIcons();
}
QApplication::restoreOverrideCursor();
ui->clear->setEnabled(false);
ui->clear->setText(tr("Done"));
QTimer::singleShot(1000, this, SLOT(close()));
}
示例11: QDateTime
HUrl::HUrl()
{
this->_set(QString(), QDateTime()); // Null QDateTime is not valid()
}
示例12: accessed
/*!
If \a time is \c CreationTime, return when the file was created.
If \a time is \c ModificationTime, return when the file was most
recently modified. If \a time is \c AccessTime, return when the
file was most recently accessed (e.g. read or written).
If the time cannot be determined return QDateTime() (an invalid
date time).
This virtual function must be reimplemented by all subclasses.
\sa setFileName(), QDateTime, QDateTime::isValid(), FileTime
*/
QDateTime QAbstractFileEngine::fileTime(FileTime time) const
{
Q_UNUSED(time);
return QDateTime();
}
示例13: QDateTime
QDateTime EPGItem::end() const
{
return QDateTime( m_start ).addSecs( m_duration );
}
示例14: CodecPlugin
soundkonverter_codec_ffmpeg::soundkonverter_codec_ffmpeg( QObject *parent, const QStringList& args )
: CodecPlugin( parent )
{
Q_UNUSED(args)
binaries["ffmpeg"] = "";
KSharedConfig::Ptr conf = KGlobal::config();
KConfigGroup group;
group = conf->group( "Plugin-"+name() );
configVersion = group.readEntry( "configVersion", 0 );
experimentalCodecsEnabled = group.readEntry( "experimentalCodecsEnabled", false );
ffmpegVersionMajor = group.readEntry( "ffmpegVersionMajor", 0 );
ffmpegVersionMinor = group.readEntry( "ffmpegVersionMinor", 0 );
ffmpegLastModified = group.readEntry( "ffmpegLastModified", QDateTime() );
ffmpegCodecList = group.readEntry( "codecList", QStringList() ).toSet();
CodecData data;
FFmpegCodecData ffmpegData;
// WARNING enabled codecs need to be rescanned everytime new codecs are added here -> increase plugin version
data.ffmpegCodecList.clear();
data.codecName = "wav";
ffmpegData.name = "wav";
ffmpegData.external = false;
ffmpegData.experimental = false;
data.ffmpegCodecList.append( ffmpegData );
codecList.append( data );
data.ffmpegCodecList.clear();
data.codecName = "ogg vorbis";
ffmpegData.name = "libvorbis";
ffmpegData.external = true;
ffmpegData.experimental = false;
data.ffmpegCodecList.append( ffmpegData );
ffmpegData.name = "vorbis";
ffmpegData.external = true; // ?
ffmpegData.experimental = true;
data.ffmpegCodecList.append( ffmpegData );
codecList.append( data );
// data.ffmpegCodecList.clear();
// data.codecName = "opus";
// ffmpegData.name = "opus";
// ffmpegData.external = true;
// ffmpegData.experimental = false;
// data.ffmpegCodecList.append( ffmpegData );
// codecList.append( data );
data.ffmpegCodecList.clear();
data.codecName = "mp3";
ffmpegData.name = "libmp3lame";
ffmpegData.external = true;
ffmpegData.experimental = false;
data.ffmpegCodecList.append( ffmpegData );
codecList.append( data );
data.ffmpegCodecList.clear();
data.codecName = "flac";
ffmpegData.name = "flac";
ffmpegData.external = false;
ffmpegData.experimental = false;
data.ffmpegCodecList.append( ffmpegData );
codecList.append( data );
data.ffmpegCodecList.clear();
data.codecName = "wma";
ffmpegData.name = "wmav2";
ffmpegData.external = false;
ffmpegData.experimental = false;
data.ffmpegCodecList.append( ffmpegData );
ffmpegData.name = "wmav1";
ffmpegData.external = false;
ffmpegData.experimental = false;
data.ffmpegCodecList.append( ffmpegData );
codecList.append( data );
data.ffmpegCodecList.clear();
data.codecName = "aac";
ffmpegData.name = "libfaac";
ffmpegData.external = true;
ffmpegData.experimental = false;
data.ffmpegCodecList.append( ffmpegData );
ffmpegData.name = "aac";
ffmpegData.external = false;
ffmpegData.experimental = true;
data.ffmpegCodecList.append( ffmpegData );
codecList.append( data );
data.ffmpegCodecList.clear();
data.codecName = "m4a/aac";
ffmpegData.name = "libfaac";
ffmpegData.external = true;
ffmpegData.experimental = false;
data.ffmpegCodecList.append( ffmpegData );
ffmpegData.name = "aac";
ffmpegData.external = false;
ffmpegData.experimental = true;
//.........这里部分代码省略.........
示例15: toInt
int n;
if((n=RDGetSqlValue("CUTS","CUT_NAME",cut_name,"END_POINT",cut_db).
toInt())!=-1) {
return n;
}
return (int)length();
}
void RDCut::logPlayout() const
{
QString sql=
QString().sprintf("update CUTS set LAST_PLAY_DATETIME=\"%s\",\
PLAY_COUNTER=%d,LOCAL_COUNTER=%d where CUT_NAME=\"%s\"",
(const char *)QDateTime(QDate::currentDate(),
QTime::currentTime()).toString("yyyy-MM-dd hh:mm:ss"),
playCounter()+1,localCounter()+1,(const char *)cut_name);
RDSqlQuery *q=new RDSqlQuery(sql);
delete q;
}
bool RDCut::copyTo(RDStation *station,RDUser *user,
const QString &cutname,RDConfig *config) const
{
#ifdef WIN32
return false;
#else
QString sql;
RDSqlQuery *q;
bool ret=true;