本文整理汇总了C++中Duration::asDays方法的典型用法代码示例。如果您正苦于以下问题:C++ Duration::asDays方法的具体用法?C++ Duration::asDays怎么用?C++ Duration::asDays使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Duration
的用法示例。
在下文中一共展示了Duration::asDays方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDateOnly
/******************************************************************************
* Enable/disable hours/minutes units (if hours/minutes were permitted in the
* constructor).
*/
TimePeriod::Units TimePeriod::setDateOnly(const Duration& perod, bool dateOnly, bool signal)
{
Duration oldinterval = 0;
if (signal)
oldinterval = period();
int index = mUnitsCombo->currentIndex();
Units units = static_cast<Units>(index + mDateOnlyOffset);
if (!mNoHourMinute)
{
if (!dateOnly && mDateOnlyOffset)
{
// Change from date-only to allow hours/minutes
mUnitsCombo->insertItem(0, i18n_minutes());
mUnitsCombo->insertItem(1, i18n_hours_mins());
mDateOnlyOffset = 0;
adjustDayWeekShown();
mUnitsCombo->setCurrentIndex(index += 2);
}
else if (dateOnly && !mDateOnlyOffset)
{
// Change from allowing hours/minutes to date-only
mUnitsCombo->removeItem(0);
mUnitsCombo->removeItem(0);
mDateOnlyOffset = 2;
if (index > 2)
index -= 2;
else
index = 0;
adjustDayWeekShown();
mUnitsCombo->setCurrentIndex(index);
if (units == HoursMinutes || units == Minutes)
{
// Set units to days and round up the warning period
units = Days;
mUnitsCombo->setCurrentIndex(Days - mDateOnlyOffset);
mSpinBox->setValue(perod.asDays());
}
showHourMin(false);
}
}
if (signal)
{
Duration newinterval = period();
if (newinterval != oldinterval)
emit valueChanged(newinterval);
}
return units;
}