本文整理汇总了C++中QDate::daysInYear方法的典型用法代码示例。如果您正苦于以下问题:C++ QDate::daysInYear方法的具体用法?C++ QDate::daysInYear怎么用?C++ QDate::daysInYear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDate
的用法示例。
在下文中一共展示了QDate::daysInYear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createDayElements
Element::List Datenums::createDayElements(const QDate &date)
{
Element::List result;
int dayOfYear = date.dayOfYear();
int remainingDays = date.daysInYear() - dayOfYear;
StoredElement *e;
switch (mDisplayedInfo) {
case DayOfYear: // only day of year
e = new StoredElement(QStringLiteral("main element"), QString::number(dayOfYear));
break;
case DaysRemaining: // only days until end of year
e = new StoredElement(QStringLiteral("main element"), QString::number(remainingDays),
i18np("1 day before the end of the year",
"%1 days before the end of the year",
remainingDays));
break;
case DayOfYear + DaysRemaining: // both day of year and days till end of year
default:
e = new StoredElement(QStringLiteral("main element"), QString::number(dayOfYear),
i18nc("dayOfYear / daysTillEndOfYear", "%1 / %2",
dayOfYear, remainingDays),
i18np("1 day since the beginning of the year,\n",
"%1 days since the beginning of the year,\n",
dayOfYear) +
i18np("1 day until the end of the year",
"%1 days until the end of the year",
remainingDays));
break;
}
result.append(e);
return result;
}