本文整理汇总了C++中QDate::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QDate::isNull方法的具体用法?C++ QDate::isNull怎么用?C++ QDate::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDate
的用法示例。
在下文中一共展示了QDate::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: query
QList<Message> HistorySqlStorage::sms(const QString &recipient, const QDate &date, int limit)
{
kdebugf();
DatabaseMutex.lock();
QSqlQuery query(Database);
QString queryString = "SELECT content, send_time FROM kadu_sms WHERE receipient = :receipient";
if (!date.isNull())
queryString += " AND date(send_time) = date(:date)";
queryString += " ORDER BY send_time ASC";
if (0 != limit)
queryString += " LIMIT :limit";
query.prepare(queryString);
query.bindValue(":receipient", recipient);
if (!date.isNull())
query.bindValue(":date", date.toString(Qt::ISODate));
if (limit != 0)
query.bindValue(":limit", limit);
executeQuery(query);
QList<Message> result = smsFromQuery(query);
DatabaseMutex.unlock();
return result;
}
示例2: setDateRangeFilter
void MultipleFilterProxy::setDateRangeFilter(qint32 col, const QDate& minDate, const QDate& maxDate, qint32 role)
{
if (col < 0 || col >= m_dateRangeFilter.size())
return;
if (minDate.isNull() && maxDate.isNull())
return removeFilterFromColumn(col, role);
m_regExpFilter[col].remove(role);
m_boolFilter[col].remove(role);
m_dateRangeFilter[col][role] = std::make_pair(minDate, maxDate);
invalidateFilter();
}
示例3: DateRangeUpdated
void MainWindow::DateRangeUpdated(QDate s, QDate e)
{
Range<QDate> r( m_sdr->GetDateRange() );
lbl_dateStart->setText(QString("Start Date: %1").arg(r.LowerBound().Value().toString("ddd MMMM d yyyy")));
lbl_dateEnd->setText(QString("End Date: %1").arg(r.UpperBound().Value().toString("ddd MMMM d yyyy")));
lbl_updateCount->setText(QString("Update Count: %1").arg(++m_updateCount));
GASSERT(s.isNull() || s == r.LowerBound().Value());
GASSERT(e.isNull() || e == r.UpperBound().Value());
}
示例4: QDateTimeToDATE
static DATE QDateTimeToDATE(const QDateTime &dt)
{
if (!dt.isValid() || dt.isNull())
return 949998;
SYSTEMTIME stime;
memset(&stime, 0, sizeof(stime));
QDate date = dt.date();
QTime time = dt.time();
if (date.isValid() && !date.isNull()) {
stime.wDay = date.day();
stime.wMonth = date.month();
stime.wYear = date.year();
}
if (time.isValid() && !time.isNull()) {
stime.wMilliseconds = time.msec();
stime.wSecond = time.second();
stime.wMinute = time.minute();
stime.wHour = time.hour();
}
double vtime;
SystemTimeToVariantTime(&stime, &vtime);
return vtime;
}
示例5: populate
void itemPricingSchedule::populate()
{
XSqlQuery itempopulate;
XSqlQuery pop;
pop.prepare( "SELECT ipshead_name, ipshead_descrip,"
" ipshead_effective, ipshead_expires, "
" ipshead_curr_id, ipshead_updated "
"FROM ipshead "
"WHERE (ipshead_id=:ipshead_id);" );
pop.bindValue(":ipshead_id", _ipsheadid);
pop.exec();
if (pop.first())
{
_name->setText(pop.value("ipshead_name").toString());
_descrip->setText(pop.value("ipshead_descrip").toString());
_dates->setStartDate(pop.value("ipshead_effective").toDate());
_dates->setEndDate(pop.value("ipshead_expires").toDate());
_currency->setId(pop.value("ipshead_curr_id").toInt());
_currency->setEnabled(FALSE);
QDate tmpDate = pop.value("ipshead_updated").toDate();
if (tmpDate.isValid() && ! tmpDate.isNull())
_updated = tmpDate;
sFillList(-1);
}
else if (itempopulate.lastError().type() != QSqlError::NoError)
{
systemError(this, _rejectedMsg.arg(itempopulate.lastError().databaseText()),
__FILE__, __LINE__);
reject();
}
}
示例6: SetFlow
void GenericCashFlow::SetFlow(QDate Dte, double Amt, qint32 FlowTpe) {
Q_D(GenericCashFlow);
if (Dte.isNull()) return;
if (d->m_AdjustHolidays) {
while (IsHoliday(Dte))
Dte = Dte.addDays(1);
}
if (qAbs(Amt) < 0.01) Amt = 0.0;
auto index = d->m_CashFlows.begin();
for (; index != d->m_CashFlows.end(); ++index) {
if (d->SamePeriod(Dte, index.key(), d->m_AggregationLevel))
break;
}
if (index != d->m_CashFlows.end()) {
if (index.value()->contains(FlowTpe)) {
if (Amt == 0.0 && !d->m_Stocks.contains(FlowTpe))
index.value()->remove(FlowTpe);
else
index.value()->operator[](FlowTpe) = Amt;
}
else {
if (qAbs(Amt) > 0.0 || d->m_Stocks.contains(FlowTpe)) {
index.value()->insert(FlowTpe, Amt);
}
}
}
else {
d->m_CashFlows.insert(Dte, std::make_shared<QHash<qint32, double> >());
if (qAbs(Amt) > 0.0 || d->m_Stocks.contains(FlowTpe)) {
d->m_CashFlows[Dte]->insert(FlowTpe, Amt);
}
}
}
示例7:
int CalendarBox::Context::daysShiftForMonth(QDate month) {
Assert(!month.isNull());
constexpr auto kMaxRows = 6;
auto inMonthIndex = month.day() - 1;
auto inWeekIndex = month.dayOfWeek() - 1;
return ((kMaxRows * kDaysInWeek) + inWeekIndex - inMonthIndex) % kDaysInWeek;
}
示例8: isValid
bool KCalendarSystem::isValid( const QDate &date ) const
{
if ( date.isNull() || date < earliestValidDate() || date > latestValidDate() ) {
return false;
}
return true;
}
示例9: removeFile
void LogTraceListener::removeFile(QDir& dir, const string& fileName, int days)
{
string name = fileName;
if (strcmp(_fullFileName.c_str(), name.c_str()) != 0)
{
const QDateTime now = QDateTime::currentDateTime();
if (!_prefix.empty())
{
Convert::replaceStr(name, _prefix, "");
}
if (!_suffix.empty())
{
Convert::replaceStr(name, _suffix, "");
}
Convert::replaceStr(name, ".log", "");
QDate date = Convert::parseDate(name);
int sec = now.secsTo(date);
if (!date.isNull() && date.isValid() &&
sec < 0 && (-sec > days * 24 * 3600))
{
bool result = dir.remove(fileName.c_str());
if(result)
{
Trace::WriteFormatLine(Resources::RemoveLogFilesSuccessfullyStr, fileName.c_str());
}
else
{
Trace::WriteFormatLine(Resources::FailedtoRemoveLogFilesStr, fileName.c_str());
}
}
}
}
示例10:
void
TenderAdjustment::setDate(QDate date)
{
if (date.isNull())
date = QDate::currentDate();
_gltxFrame->date->setDate(date);
}
示例11: insertRangeAtDate
// insert a new range starting at the given date extending to the end of the zone currently
// containing that date. If the start date of that zone is prior to the specified start
// date, then that zone range is shorted.
int Zones::insertRangeAtDate(QDate date, int cp) {
assert(date.isValid());
int rnum;
if (ranges.empty()) {
addZoneRange(cp);
fprintf(
stderr,
"Generating first range with CP = %d\n",
cp
);
rnum = 0;
}
else {
rnum = whichRange(date);
assert(rnum >= 0);
QDate date1 = getStartDate(rnum);
fprintf(stderr, "insertRangeAtDate(%s, %d):\n", date.toString().toAscii().constData(), cp);
// if the old range has dates before the specified, then truncate the old range
// and shift up the existing ranges
if (date > date1) {
QDate endDate = getEndDate(rnum);
setEndDate(rnum, date);
fprintf(
stderr,
"Inserting range\n"
"old range %d: from %s to %s\n"
"new range %d: from %s to %s\n"
"added range %d: from %s to %s\n",
rnum + 1, getStartDateString(rnum).toAscii().constData(), getEndDateString(rnum).toAscii().constData(),
rnum + 1, getStartDateString(rnum).toAscii().constData(), (date.isNull() ? "END" : date.toString().toAscii().constData()),
rnum + 2, (date.isNull() ? "BEGIN" : date.toString().toAscii().constData()), getEndDateString(rnum).toAscii().constData()
);
ranges.insert(++ rnum, new ZoneRange(date, endDate));
}
}
if (cp > 0) {
setCP(rnum, cp);
setZonesFromCP(rnum);
}
return rnum;
}
示例12: locale
QString Settings::BirthdayPage::textForDate(const QDate& date) const
{
if (date.isNull()) {
return m_noDateString;
} else {
return KGlobal::locale()->formatDate(date, KLocale::ShortDate);
}
}
示例13: daysShiftForMonth
int CalendarBox::Context::rowsCountForMonth(QDate month) {
Assert(!month.isNull());
auto daysShift = daysShiftForMonth(month);
auto daysCount = month.daysInMonth();
auto cellsCount = daysShift + daysCount;
auto result = (cellsCount / kDaysInWeek);
if (cellsCount % kDaysInWeek) ++result;
return result;
}
示例14: clearChatHistory
void HistorySqlStorage::clearChatHistory(const Chat &chat, const QDate &date)
{
DatabaseMutex.lock();
QSqlQuery query(Database);
QString queryString = "DELETE FROM kadu_messages WHERE " + chatWhere(chat);
if (!date.isNull())
queryString += " AND date(receive_time) = date(:date)";
query.prepare(queryString);
if (!date.isNull())
query.bindValue(":date", date.toString(Qt::ISODate));
executeQuery(query);
DatabaseMutex.unlock();
}
示例15: clearStatusHistory
void HistorySqlStorage::clearStatusHistory(const Buddy &buddy, const QDate &date)
{
DatabaseMutex.lock();
QSqlQuery query(Database);
QString queryString = "DELETE FROM kadu_statuses WHERE " + buddyContactsWhere(buddy);
if (!date.isNull())
queryString += " AND date(set_time) = date(:date)";
query.prepare(queryString);
if (!date.isNull())
query.bindValue(":date", date.toString(Qt::ISODate));
executeQuery(query);
DatabaseMutex.unlock();
}