本文整理汇总了C++中QDateTime::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QDateTime::isNull方法的具体用法?C++ QDateTime::isNull怎么用?C++ QDateTime::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDateTime
的用法示例。
在下文中一共展示了QDateTime::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setReregistrationTimer
void KInetD::setReregistrationTimer() {
QDateTime d;
PortListener *pl = m_portListeners.first();
while (pl) {
QDateTime d2 = pl->serviceLifetimeEnd();
if (!d2.isNull()) {
if (d2 < QDateTime::currentDateTime()) {
m_reregistrationTimer.start(0, true);
return;
}
else if (d.isNull() || (d2 < d))
d = d2;
}
pl = m_portListeners.next();
}
if (!d.isNull()) {
int s = QDateTime::currentDateTime().secsTo(d);
if (s < 30)
s = 30; // max frequency 30s
m_reregistrationTimer.start(s*1000, true);
}
else
m_reregistrationTimer.stop();
}
示例2: convertCEventToQEventOccurrence
QOrganizerEventOccurrence OrganizerItemTransform::convertCEventToQEventOccurrence(CEvent* cevent, const QDateTime& instanceStartDate, const QDateTime &instanceEndDate)
{
QOrganizerEventOccurrence retn;
// Priority
int tempint = cevent->getPriority();
if (tempint != -1)
retn.setPriority(static_cast<QOrganizerItemPriority::Priority>(tempint)); // assume that the saved priority is vCal compliant.
// Location geo coordinates
QOrganizerItemLocation loc = retn.detail<QOrganizerItemLocation>();
if(addGeoToQOIL(QString::fromStdString(cevent->getGeo()), &loc))
retn.saveDetail(&loc);
// Start time
if (!instanceStartDate.isNull())
retn.setStartDateTime(instanceStartDate);
// End time
if (!instanceEndDate.isNull())
retn.setEndDateTime(instanceEndDate);
// Set parent local id
QString idString = QString::fromStdString(cevent->getId());
retn.setParentId(QOrganizerItemId(new QOrganizerItemMaemo5EngineId(idString.toUInt())));
// Set original event date
retn.setOriginalDate(instanceStartDate.date());
return retn;
}
示例3: qDebug
void
RuleWatch::refreshWatch(const QDateTime &now) {
qDebug("RuleWatch::refreshWatch(%s)", qPrintable(now.toString()));
_timer.stop();
QDateTime nextNearestDateTime;
qDebug("RuleWatch::refreshWatch size of rules: %d", _rules->size());
for (Rules::const_iterator i = _rules->constBegin(); i != _rules->constEnd(); ++i) {
const RuleItem &item = *i;
if (item.ruleActive) {
QDateTime nearestFromRule = _nextDateTimeFromRule(now, item);
if (!nearestFromRule.isNull() && (nextNearestDateTime.isNull() || nearestFromRule < nextNearestDateTime)) {
qDebug("Setting nearest to %s, was %s",
qPrintable(nearestFromRule.toString()),
qPrintable(nextNearestDateTime.toString()));
nextNearestDateTime = nearestFromRule;
_targetRuleItem = &item;
}
}
}
if (!nextNearestDateTime.isNull()) {
quint64 interval = now.msecsTo(nextNearestDateTime);
qDebug("Now %s", qPrintable(now.toString()));
qDebug("Scheduling a timer to %s, interval %dms", qPrintable(nextNearestDateTime.toString()), (int)interval);
_timer.start(interval);
} else {
_targetRuleItem = NULL;
qDebug("No nearest time based rule found");
}
}
示例4: purchaseResponse
void CMyMainWindow::purchaseResponse(){
bb::platform::PurchaseReply *reply = qobject_cast<bb::platform::PurchaseReply*>(sender());
Q_ASSERT(reply);
if (reply->isError()){
qDebug() << "CMyMainWindow::purchaseResponse(): Purchase response error. Code(" << reply->errorCode() << ") Text(" << reply->errorText() << ")";
QMessageBox msgBox;
msgBox.setText(QString("An error occured:\nCode(") + QString::number(reply->errorCode()) + QString(") Text(") + reply->errorText() + QString(")"));
msgBox.setStandardButtons(QMessageBox::Close);
msgBox.exec();
}else{
bb::platform::PurchaseReceipt r = reply->receipt();
const QString initialPeriod = QString::number(r.initialPeriod());
const QDateTime startDate = r.startDate();
const QString startDateStr = startDate.isNull() ? "N/A" : startDate.toString();
const QDateTime endDate = r.endDate();
const QString endDateStr = endDate.isNull() ? "N/A" : endDate.toString();
const QString isSubscr = r.isSubscription() ? "true" : "false";
const QString itemStateStr = QString::number(static_cast<int>(r.state()));
const QString displayString = "Date: " + r.date().toString() +
"\nID/SKU: " + r.digitalGoodId() + "/" + r.digitalGoodSku() +
"\nPurchaseID/licenseKey: " + r.purchaseId() + "/" + r.licenseKey() +
"\nMetadata: " + r.purchaseMetadata() +
"\nItemState/isSubscription?: " + itemStateStr + "/" + isSubscr +
"\nStart/End: " + startDateStr + "/" + endDateStr +
"\nInitialPeriod: " + initialPeriod + "\n";
qDebug() << "Purchase response success. " << displayString;
QMessageBox msgBox;
msgBox.setText("Thank you!");
msgBox.setStandardButtons(QMessageBox::Close);
msgBox.exec();
}
}
示例5: convertCEventToQEvent
QOrganizerEvent OrganizerItemTransform::convertCEventToQEvent(CEvent *cevent)
{
QOrganizerEvent retn;
// Priority
int tempint = cevent->getPriority();
if (tempint != -1)
retn.setPriority(static_cast<QOrganizerItemPriority::Priority>(tempint)); // assume that the saved priority is vCal compliant.
// Location geo coordinates
QOrganizerItemLocation loc = retn.detail<QOrganizerItemLocation>();
if(addGeoToQOIL(QString::fromStdString(cevent->getGeo()), &loc))
retn.saveDetail(&loc);
// Start time
QDateTime tempdt = QDateTime::fromTime_t(cevent->getDateStart());
if (!tempdt.isNull())
retn.setStartDateTime(tempdt);
// End time
tempdt = QDateTime::fromTime_t(cevent->getDateEnd());
if (!tempdt.isNull())
retn.setEndDateTime(tempdt);
// Recurrence information
m_recTransformer.transformToQrecurrence(cevent->getRecurrence());
retn.setRecurrenceRules(m_recTransformer.recurrenceRules());
retn.setExceptionRules(m_recTransformer.exceptionRules());
retn.setRecurrenceDates(m_recTransformer.recurrenceDates());
retn.setExceptionDates(m_recTransformer.exceptionDates());
return retn;
}
示例6: QString
QString
aDocJournal::selectionFilter( QDateTime from, QDateTime to, const QString & mdName, bool full )
{
QString fltr="", docType = "", journ="";
if ( full ) journ="a_journ.";
if ( mdName != "" )
{
aCfgItem item = md->find( "Document." + mdName );
if ( item.isNull() )
return "";
int type = md->id( item );
docType = " AND " + journ + QString("typed=%1").arg(type);
}
if ( from.isNull() )
if ( !to.isNull() )
fltr = journ + "ddate<='" + to.toString("yyyy-MM-dd hh:mm:ss") + "'";
else
return "";
else
if ( !to.isNull() )
fltr = journ + "ddate>='" + from.toString("yyyy-MM-dd hh:mm:ss") + "' AND " + journ + "ddate<='" + to.toString("yyyy-MM-dd hh:mm:ss") + "'";
else
fltr = journ + "ddate>='" + from.toString("yyyy-MM-dd hh:mm:ss") + "'";
return fltr + docType;
}
示例7: table
/*!
*\~english
* Select documents at some period.
*\~russian
* Выбирает документы определенного типа за некоторый период.
*\~
*\param from - \~english begin date \~russian дата начала периода \~
*\param to - \~english end date \~russian дата окончания периода \~
*\param nmName - \~english document type \~russian тип документа \~
*\return \~english error code
* \~russian код ошибки \~
*/
ERR_Code
aDocJournal::Select( QDateTime from, QDateTime to, const QString & mdName )
{
aSQLTable * t = table();
if ( !t )
return err_notable;
QString fltr, docType = "";
if ( mdName != "" )
{
aCfgItem item = md->find( "Document." + mdName );
if ( item.isNull() )
return err_objnotfound;
int type = md->id( item );
docType = QString(" AND typed=%1").arg(type);
}
if ( from.isNull() )
if ( !to.isNull() )
fltr = "ddate<='" + to.toString("yyyy-MM-dd hh:mm:ss") + "'";
else
return err_condition;
else
if ( !to.isNull() )
fltr = "ddate>='" + from.toString("yyyy-MM-dd hh:mm:ss") + "' AND ddate<='" +\
to.toString("yyyy-MM-dd hh:mm:ss") + "'";
else
fltr = "ddate>='" + from.toString("yyyy-MM-dd hh:mm:ss") + "'";
if ( t->select( fltr + docType ) )
if ( t->first() )
{
setSelected(true);
return err_noerror;
}
else return err_notselected;
return err_selecterror;
}
示例8: showShop
void ShopViewer::showShop(const Shop* shop) {
_currentShop = (Shop*)shop;
if (shop == nullptr) {
ui->viewWidget->hide();
return;
}
ui->plot->setVisible(shop->hasHistory());
ui->tableWidget->clearContents();
while (ui->tableWidget->rowCount() > 0) {
ui->tableWidget->removeRow(0);
}
for (const QString &thread : shop->threads()) {
int row = ui->tableWidget->rowCount();
ui->tableWidget->insertRow(row);
ui->tableWidget->setItem(row, 0, new QTableWidgetItem(thread));
ui->tableWidget->setItem(row, 1, new QTableWidgetItem("Idle"));
QDateTime updated = shop->threadUpdated(thread);
QDateTime bumped = shop->threadBumped(thread);
ui->tableWidget->setItem(row, 2, new QTableWidgetItem(updated.isNull() ? "Never" : updated.toString()));
ui->tableWidget->setItem(row, 3, new QTableWidgetItem(bumped.isNull() ? "Never" : bumped.toString()));
}
updateShopListItem(shop);
ui->viewWidget->show();
}
示例9: if
QDateTime
QWebdavUrlInfo::parseDateTime( const QString& input, const QString& type )
{
QDateTime datetime;
if ( type == "dateTime.tz" )
datetime = QDateTime::fromString( input, Qt::ISODate );
else if ( type == "dateTime.rfc1123" )
datetime = QDateTime::fromString( input );
if (!datetime.isNull())
return datetime;
datetime = QDateTime::fromString(input.left(19), "yyyy-MM-dd'T'hh:mm:ss");
if (!datetime.isNull())
return datetime;
datetime = QDateTime::fromString(input.mid(5, 20) , "d MMM yyyy hh:mm:ss");
if (!datetime.isNull())
return datetime;
QDate date;
QTime time;
date = QDate::fromString(input.mid(5, 11) , "d MMM yyyy");
time = QTime::fromString(input.mid(17, 8) , "hh:mm:ss");
return QDateTime(date, time);
}
示例10: checkSearchPathTimestamps
static bool checkSearchPathTimestamps( const QStringList &paths, const QStringList ×tamps )
{
QStringList currentTimestamps;
bool changed = false;
QStringList::ConstIterator t = timestamps.constBegin();
for( QStringList::ConstIterator it = paths.constBegin();
it != paths.constEnd();
++it, ++t )
{
QDateTime current = lastChanged( *it );
// store non-existent directory as "N" string rather than empty string, KConfig
// has a bug with storing a list of empty items
if( *t == "N" ? !current.isNull() : current != QDateTime::fromString( *t, Qt::ISODate ))
changed = true;
currentTimestamps.append( current.isNull() ? "N" : current.toString( Qt::ISODate ));
}
if( changed )
{
KConfig config("kcmnspluginrc");
KConfigGroup cg(&config, "Misc");
cg.writeEntry( "lastSearchPaths", paths );
cg.writeEntry( "lastSearchTimestamps", currentTimestamps );
return true;
}
return false;
}
示例11: addTodoPostSaveDetails
void OrganizerItemTransform::addTodoPostSaveDetails(QOrganizerItem *item, CTodo *ctodo)
{
// Priority
int tempint = ctodo->getPriority();
if (tempint != -1) {
QOrganizerItemPriority priority = item->detail<QOrganizerItemPriority>();
priority.setPriority(static_cast<QOrganizerItemPriority::Priority>(tempint)); // assume that the saved priority is vCal compliant.
item->saveDetail(&priority);
}
// Date start
QDateTime tempdt = QDateTime::fromTime_t(ctodo->getDateStart());
if (!tempdt.isNull()) {
QOrganizerTodoTime todoTime = item->detail<QOrganizerTodoTime>();
todoTime.setStartDateTime(tempdt);
item->saveDetail(&todoTime);
}
// Due
tempdt = QDateTime::fromTime_t(ctodo->getDue());
if (!tempdt.isNull()) {
QOrganizerTodoTime todoTime = item->detail<QOrganizerTodoTime>();
todoTime.setDueDateTime(tempdt);
item->saveDetail(&todoTime);
}
// Completed time
tempdt = QDateTime::fromTime_t(ctodo->getCompleted());
if (!tempdt.isNull()) {
QOrganizerTodoProgress todoProgress = item->detail<QOrganizerTodoProgress>();
todoProgress.setFinishedDateTime(tempdt);
item->saveDetail(&todoProgress);
}
// Percent complete
tempint = ctodo->getPercentComplete();
if (!tempdt.isNull()) {
QOrganizerTodoProgress todoProgress = item->detail<QOrganizerTodoProgress>();
todoProgress.setPercentageComplete(tempint);
item->saveDetail(&todoProgress);
}
// Status
QOrganizerTodoProgress todoProgress = item->detail<QOrganizerTodoProgress>();
todoProgress.setStatus(static_cast<QOrganizerTodoProgress::Status>(ctodo->getStatus()));
item->saveDetail(&todoProgress);
// Timestamps
time_t createdTime = ctodo->getCreatedTime();
time_t lastModifiedTime = ctodo->getLastModified();
if (createdTime || lastModifiedTime) {
QOrganizerItemTimestamp timeStamps = item->detail<QOrganizerItemTimestamp>();
timeStamps.setCreated(QDateTime::fromTime_t(createdTime));
timeStamps.setLastModified(QDateTime::fromTime_t(lastModifiedTime));
item->saveDetail(&timeStamps);
}
}
示例12: convertCTodoToQTodoOccurrence
QOrganizerTodoOccurrence OrganizerItemTransform::convertCTodoToQTodoOccurrence(CTodo *ctodo)
{
QOrganizerTodoOccurrence retn;
// Keep the following details same as in convertCTodoToQTodo:
// Priority
int tempint = ctodo->getPriority();
if (tempint != -1)
retn.setPriority(static_cast<QOrganizerItemPriority::Priority>(tempint));
// Date start
QDateTime tempdt = QDateTime::fromTime_t(ctodo->getDateStart());
if (!tempdt.isNull())
retn.setStartDateTime(tempdt);
// Due
tempdt = QDateTime::fromTime_t(ctodo->getDue());
if (!tempdt.isNull())
retn.setDueDateTime(tempdt);
// Completed time
tempdt = QDateTime::fromTime_t(ctodo->getCompleted());
if (!tempdt.isNull())
retn.setFinishedDateTime(tempdt);
// Percent complete
tempint = ctodo->getPercentComplete();
if (tempint != -1)
retn.setProgressPercentage(tempint);
// Status
retn.setStatus(static_cast<QOrganizerTodoProgress::Status>(ctodo->getStatus()));
// Location geo coordinates
QOrganizerItemLocation loc = retn.detail<QOrganizerItemLocation>();
if(addGeoToQOIL(QString::fromStdString(ctodo->getGeo()), &loc))
retn.saveDetail(&loc);
// Only the following are occurrence specific details:
// In maemo, the parent id is the same as this id (todo's only have one occurrence)
retn.setParentId(makeItemLocalId(QString::fromStdString(ctodo->getId()).toUInt()));
// Original date
retn.setOriginalDate(retn.startDateTime().date());
return retn;
}
示例13: autoUpdate
void Updates::autoUpdate()
{
QSettings settings;
if (!settings.value("auto_update", true).toBool())
return;
QDateTime dt = settings.value("last_update_check", QDateTime()).toDateTime();
QDateTime dtNow = QDateTime::currentDateTimeUtc();
if (dt.isNull() || dt.daysTo(dtNow) > 0) {
settings.setValue("last_update_check", dtNow);
if (!dt.isNull()) {
QProcess process;
runUpdateExe(&process, UpdateDetached);
}
}
}
示例14: contextDelete
void ResultsWidget::contextDelete ()
{
if(selectedIndexes().size() <= 0)
return;
int row = selectedIndexes().first().row();
QList<BenchmarkingResult*> resultsVector = pipeline->getResultsVector();
if(row < 0 || row >= (int)resultsVector.size())
return;
QDateTime benchmarkingResultTime = resultsVector[row]->time;
if(benchmarkingResultTime.isNull() || (benchmarkingResultTime == pipeline->startTime && pipeline->processing))
{
QMessageBox::warning(
this,
"Cannot delete benchmarking evaluation",
"Impossible to delete this benchmarking evaluation, either it is currently running or it has not been found"
);
return;
}
if(QMessageBox::question(
this,
"Delete benchmark evaluation ?",
"Do you really want to delete this benchmark evaluation results ?",
QMessageBox::Ok | QMessageBox::Cancel,
QMessageBox::Cancel
) == QMessageBox::Ok)
{
pipeline->results.remove(benchmarkingResultTime);
emit resultsChanged();
}
}
示例15: setScheduledWakeupTime
static int setScheduledWakeupTime()
{
if (!gCoreContext->IsConnectedToMaster())
{
VERBOSE(VB_IMPORTANT, "setScheduledWakeupTime: "
"Attempting to connect to master server...");
if (!gCoreContext->ConnectToMasterServer(false))
{
VERBOSE(VB_IMPORTANT, "setScheduledWakeupTime: "
"Could not connect to master server!");
return 1;
}
}
QDateTime nextRecordingStart;
GetProgramDetailList(nextRecordingStart);
// set the wakeup time for the next scheduled recording
if (!nextRecordingStart.isNull())
{
int m_preRollSeconds = gCoreContext->GetNumSetting("RecordPreRoll");
QDateTime restarttime = nextRecordingStart
.addSecs((-1) * m_preRollSeconds);
int add = gCoreContext->GetNumSetting("StartupSecsBeforeRecording", 240);
if (add)
restarttime = restarttime.addSecs((-1) * add);
setWakeupTime(restarttime.toString(Qt::ISODate));
return 0;
}
return 1;
}