diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-22 08:38:59 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-22 08:38:59 (GMT) |
commit | 252ea664604c85a5e993d28ee32d2aa0da7eca85 (patch) | |
tree | 0819bdd6e3614048faa8f2739299fb4be4301795 /examples | |
parent | 31ac8ea4a7a5360a01c2fc1f8f930ae8b236c94b (diff) | |
parent | fe48ca11f7da7200c052a7825ad4d46319b13cc5 (diff) | |
download | Qt-252ea664604c85a5e993d28ee32d2aa0da7eca85.zip Qt-252ea664604c85a5e993d28ee32d2aa0da7eca85.tar.gz Qt-252ea664604c85a5e993d28ee32d2aa0da7eca85.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
doc/src/qnamespace.qdoc
src/corelib/global/qnamespace.h
src/gui/graphicsview/qgraphicsscene.cpp
Diffstat (limited to 'examples')
-rw-r--r-- | examples/widgets/calendarwidget/window.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/examples/widgets/calendarwidget/window.cpp b/examples/widgets/calendarwidget/window.cpp index 7672a05..c31ea0c 100644 --- a/examples/widgets/calendarwidget/window.cpp +++ b/examples/widgets/calendarwidget/window.cpp @@ -167,22 +167,22 @@ void Window::reformatHeaders() //! [8] void Window::reformatCalendarPage() { - QTextCharFormat mayFirstFormat; - if (mayFirstCheckBox->isChecked()) - mayFirstFormat.setForeground(Qt::red); - - QTextCharFormat firstFridayFormat; - if (firstFridayCheckBox->isChecked()) + if (firstFridayCheckBox->isChecked()) { + QDate firstFriday(calendar->yearShown(), calendar->monthShown(), 1); + while (firstFriday.dayOfWeek() != Qt::Friday) + firstFriday = firstFriday.addDays(1); + QTextCharFormat firstFridayFormat; firstFridayFormat.setForeground(Qt::blue); + calendar->setDateTextFormat(firstFriday, firstFridayFormat); + } - QDate date(calendar->yearShown(), calendar->monthShown(), 1); - - calendar->setDateTextFormat(QDate(date.year(), 5, 1), mayFirstFormat); - - date.setDate(date.year(), date.month(), 1); - while (date.dayOfWeek() != Qt::Friday) - date = date.addDays(1); - calendar->setDateTextFormat(date, firstFridayFormat); + //May First in Red takes precedence + if (mayFirstCheckBox->isChecked()) { + const QDate mayFirst(calendar->yearShown(), 5, 1); + QTextCharFormat mayFirstFormat; + mayFirstFormat.setForeground(Qt::red); + calendar->setDateTextFormat(mayFirst, mayFirstFormat); + } } //! [8] |