本文整理汇总了C++中QLocale::standaloneMonthName方法的典型用法代码示例。如果您正苦于以下问题:C++ QLocale::standaloneMonthName方法的具体用法?C++ QLocale::standaloneMonthName怎么用?C++ QLocale::standaloneMonthName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLocale
的用法示例。
在下文中一共展示了QLocale::standaloneMonthName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: standaloneLongMonthName
void tst_QDate::standaloneLongMonthName() const
{
if (QLocale::system().language() == QLocale::C) {
QCOMPARE(QDate::longMonthName(1, QDate::StandaloneFormat), QLatin1String("January"));
QCOMPARE(QDate::longMonthName(8, QDate::StandaloneFormat), QLatin1String("August"));
}
QLocale locale = QLocale::system();
for(int i = 1; i <= 12; ++i) {
QCOMPARE(QDate::longMonthName(i, QDate::StandaloneFormat), locale.standaloneMonthName(i, QLocale::LongFormat));
}
}
示例2: populate
bool QQuickMonthModelPrivate::populate(int m, int y, const QLocale &l, bool force)
{
Q_Q(QQuickMonthModel);
if (!force && m == month && y == year && l.firstDayOfWeek() == locale.firstDayOfWeek())
return false;
// The actual first (1st) day of the month.
QDate firstDayOfMonthDate(y, m, 1);
int difference = ((firstDayOfMonthDate.dayOfWeek() - l.firstDayOfWeek()) + 7) % 7;
// The first day to display should never be the 1st of the month, as we want some days from
// the previous month to be visible.
if (difference == 0)
difference += 7;
QDate firstDateToDisplay = firstDayOfMonthDate.addDays(-difference);
today = QDate::currentDate();
for (int i = 0; i < daysOnACalendarMonth; ++i)
dates[i] = firstDateToDisplay.addDays(i);
q->setTitle(l.standaloneMonthName(m) + QStringLiteral(" ") + QString::number(y));
return true;
}
示例3: journeyResult
void Parser131500ComAu::parseSearchJourney(QNetworkReply *networkReply)
{
lastJourneyResultList = new JourneyResultList();
QBuffer *filebuffer = new QBuffer();
filebuffer->setData(networkReply->readAll());
QRegExp regexp = QRegExp("<div class=\"midcolumn3\">(.*)</div>(.*)</div>(.*)<div id=\"righttools\">");
regexp.setMinimal(true);
regexp.indexIn(filebuffer->buffer());
QString element = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><html xmlns=\"http://www.w3.org/1999/xhtml\">\n<body>\n" + regexp.cap(0) + "\n</div></body>\n</html>\n";
QRegExp imgReg = QRegExp("icon_(.*)_s.gif\" />");
imgReg.setMinimal(true);
element.replace(imgReg, "icon_" + QString("\\1") + "_s.gif\" />" + QString("\\1"));
element.replace("am+", "am");
element.replace("pm+", "pm");
//qDebug()<<element;
QBuffer readBuffer;
readBuffer.setData(element.toAscii());
readBuffer.open(QIODevice::ReadOnly);
QXmlQuery query;
query.bindVariable("path", &readBuffer);
query.setQuery("declare default element namespace \"http://www.w3.org/1999/xhtml\"; declare variable $path external; doc($path)/html/body/div/div/table/tbody/tr/td[@id='header2']/string()");
QStringList departResult;
if (!query.evaluateTo(&departResult))
{
qDebug() << "parser131500ComAu::getJourneyData - Query 1 Failed";
}
query.setQuery("declare default element namespace \"http://www.w3.org/1999/xhtml\"; declare variable $path external; doc($path)/html/body/div/div/table/tbody/tr/td[@id='header3']/string()");
QStringList arriveResult;
if (!query.evaluateTo(&arriveResult))
{
qDebug() << "parser131500ComAu::getJourneyData - Query 2 Failed";
}
query.setQuery("declare default element namespace \"http://www.w3.org/1999/xhtml\"; declare variable $path external; doc($path)/html/body/div/div/table/tbody/tr/td[@id='header4']/string()");
QStringList timeResult;
if (!query.evaluateTo(&timeResult))
{
qDebug() << "parser131500ComAu::getJourneyData - Query 3 Failed";
}
query.setQuery("declare default element namespace \"http://www.w3.org/1999/xhtml\"; declare variable $path external; doc($path)/html/body/div/div/table/tbody/tr/td[@id='header5']/string()");
QStringList trainResult;
if (!query.evaluateTo(&trainResult))
{
qDebug() << "parser131500ComAu::getJourneyData - Query 4 Failed";
}
query.setQuery("declare default element namespace \"http://www.w3.org/1999/xhtml\"; declare variable $path external; doc($path)/html/body/div/div/div/string()");
QStringList headerResult;
if (!query.evaluateTo(&headerResult))
{
qDebug() << "parser131500ComAu::getJourneyData - Query 5 Failed";
}
for (int i = 0; i < headerResult.count(); i++) {
QRegExp regexp = QRegExp("(From:|To:|When:)(.*)$");
regexp.setMinimal(true);
regexp.indexIn(headerResult[i].trimmed());
if (regexp.cap(1) == "From:") {
lastJourneyResultList->setDepartureStation(regexp.cap(2).trimmed());
}
if (regexp.cap(1) == "To:") {
lastJourneyResultList->setArrivalStation(regexp.cap(2).trimmed());
}
if (regexp.cap(1) == "When:") {
lastJourneyResultList->setTimeInfo(regexp.cap(2).trimmed());
}
}
QRegExp regexp2 = QRegExp("(.*), (\\d\\d) (.*) (\\d\\d\\d\\d)");
regexp2.setMinimal(true);
regexp2.indexIn(lastJourneyResultList->timeInfo().trimmed());
QLocale enLocale = QLocale(QLocale::English, QLocale::UnitedStates);
int month = 1;
for (month = 1; month < 10; month++) {
if (regexp2.cap(3).trimmed() == enLocale.standaloneMonthName(month)) {
break;
}
}
QDate journeydate = QDate::fromString(regexp2.cap(2).trimmed() + " " + QString::number(month) + " " + regexp2.cap(4).trimmed(), "dd M yyyy");
//Generate Details search results
QStringList detailsResult;
//.........这里部分代码省略.........
示例4: localeChanged
void DateFormatsWidget::localeChanged(QLocale locale)
{
setLocale(locale);
QDateTime now = QDateTime::currentDateTime();
shortDateFormat->setText(locale.toString(now.date(), QLocale::ShortFormat));
shortDateFormat->setToolTip(locale.dateFormat(QLocale::ShortFormat));
longDateFormat->setText(locale.toString(now.date(), QLocale::LongFormat));
longDateFormat->setToolTip(locale.dateFormat(QLocale::LongFormat));
shortTimeFormat->setText(locale.toString(now.time(), QLocale::ShortFormat));
shortTimeFormat->setToolTip(locale.timeFormat(QLocale::ShortFormat));
longTimeFormat->setText(locale.toString(now.time(), QLocale::LongFormat));
longTimeFormat->setToolTip(locale.timeFormat(QLocale::LongFormat));
shortDateTimeFormat->setText(locale.toString(now, QLocale::ShortFormat));
shortDateTimeFormat->setToolTip(locale.dateTimeFormat(QLocale::ShortFormat));
longDateTimeFormat->setText(locale.toString(now, QLocale::LongFormat));
longDateTimeFormat->setToolTip(locale.dateTimeFormat(QLocale::LongFormat));
amText->setText(locale.amText());
pmText->setText(locale.pmText());
firstDayOfWeek->setText(toString(locale.firstDayOfWeek()));
int mns = monthNamesShort->currentIndex();
int mnl = monthNamesLong->currentIndex();
int smns = standaloneMonthNamesShort->currentIndex();
int smnl = standaloneMonthNamesLong->currentIndex();
int dnl = dayNamesLong->currentIndex();
int dns = dayNamesShort->currentIndex();
int sdnl = standaloneDayNamesLong->currentIndex();
int sdns = standaloneDayNamesShort->currentIndex();
monthNamesShort->clear();
monthNamesLong->clear();
standaloneMonthNamesShort->clear();
standaloneMonthNamesLong->clear();
dayNamesLong->clear();
dayNamesShort->clear();
standaloneDayNamesLong->clear();
standaloneDayNamesShort->clear();
for (int i = 1; i <= 12; ++i)
monthNamesShort->addItem(locale.monthName(i, QLocale::ShortFormat));
monthNamesShort->setCurrentIndex(mns >= 0 ? mns : 0);
for (int i = 1; i <= 12; ++i)
monthNamesLong->addItem(locale.monthName(i, QLocale::LongFormat));
monthNamesLong->setCurrentIndex(mnl >= 0 ? mnl : 0);
for (int i = 1; i <= 12; ++i)
standaloneMonthNamesShort->addItem(locale.standaloneMonthName(i, QLocale::ShortFormat));
standaloneMonthNamesShort->setCurrentIndex(smns >= 0 ? smns : 0);
for (int i = 1; i <= 12; ++i)
standaloneMonthNamesLong->addItem(locale.standaloneMonthName(i, QLocale::LongFormat));
standaloneMonthNamesLong->setCurrentIndex(smnl >= 0 ? smnl : 0);
for (int i = 1; i <= 7; ++i)
dayNamesLong->addItem(locale.dayName(i, QLocale::LongFormat));
dayNamesLong->setCurrentIndex(dnl >= 0 ? dnl : 0);
for (int i = 1; i <= 7; ++i)
dayNamesShort->addItem(locale.dayName(i, QLocale::ShortFormat));
dayNamesShort->setCurrentIndex(dns >= 0 ? dns : 0);
for (int i = 1; i <= 7; ++i)
standaloneDayNamesLong->addItem(locale.standaloneDayName(i, QLocale::LongFormat));
standaloneDayNamesLong->setCurrentIndex(sdnl >= 0 ? sdnl : 0);
for (int i = 1; i <= 7; ++i)
standaloneDayNamesShort->addItem(locale.standaloneDayName(i, QLocale::ShortFormat));
standaloneDayNamesShort->setCurrentIndex(sdns >= 0 ? sdns : 0);
}