Changeset 561 for trunk/examples/widgets/calendarwidget/window.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/examples/widgets/calendarwidget/window.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the examples of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 168 168 void Window::reformatCalendarPage() 169 169 { 170 QTextCharFormat mayFirstFormat; 171 if (mayFirstCheckBox->isChecked()) 170 if (firstFridayCheckBox->isChecked()) { 171 QDate firstFriday(calendar->yearShown(), calendar->monthShown(), 1); 172 while (firstFriday.dayOfWeek() != Qt::Friday) 173 firstFriday = firstFriday.addDays(1); 174 QTextCharFormat firstFridayFormat; 175 firstFridayFormat.setForeground(Qt::blue); 176 calendar->setDateTextFormat(firstFriday, firstFridayFormat); 177 } 178 179 //May First in Red takes precedence 180 if (mayFirstCheckBox->isChecked()) { 181 const QDate mayFirst(calendar->yearShown(), 5, 1); 182 QTextCharFormat mayFirstFormat; 172 183 mayFirstFormat.setForeground(Qt::red); 173 174 QTextCharFormat firstFridayFormat; 175 if (firstFridayCheckBox->isChecked()) 176 firstFridayFormat.setForeground(Qt::blue); 177 178 QDate date(calendar->yearShown(), calendar->monthShown(), 1); 179 180 calendar->setDateTextFormat(QDate(date.year(), 5, 1), mayFirstFormat); 181 182 date.setDate(date.year(), date.month(), 1); 183 while (date.dayOfWeek() != Qt::Friday) 184 date = date.addDays(1); 185 calendar->setDateTextFormat(date, firstFridayFormat); 184 calendar->setDateTextFormat(mayFirst, mayFirstFormat); 185 } 186 186 } 187 187 //! [8] … … 197 197 calendar->setGridVisible(true); 198 198 199 connect(calendar, SIGNAL(currentPageChanged(int, 199 connect(calendar, SIGNAL(currentPageChanged(int,int)), 200 200 this, SLOT(reformatCalendarPage())); 201 201 … … 358 358 359 359 //! [13] //! [14] 360 connect(currentDateEdit, SIGNAL(dateChanged( const QDate &)),361 calendar, SLOT(setSelectedDate( const QDate &)));360 connect(currentDateEdit, SIGNAL(dateChanged()), 361 calendar, SLOT(setSelectedDate())); 362 362 connect(calendar, SIGNAL(selectionChanged()), 363 363 this, SLOT(selectedDateChanged())); 364 connect(minimumDateEdit, SIGNAL(dateChanged( const QDate &)),365 this, SLOT(minimumDateChanged( const QDate &)));366 connect(maximumDateEdit, SIGNAL(dateChanged( const QDate &)),367 this, SLOT(maximumDateChanged( const QDate &)));364 connect(minimumDateEdit, SIGNAL(dateChanged()), 365 this, SLOT(minimumDateChanged())); 366 connect(maximumDateEdit, SIGNAL(dateChanged()), 367 this, SLOT(maximumDateChanged())); 368 368 369 369 //! [14] … … 419 419 connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)), 420 420 this, SLOT(weekendFormatChanged())); 421 connect(headerTextFormatCombo, SIGNAL(currentIndexChanged( const QString &)),421 connect(headerTextFormatCombo, SIGNAL(currentIndexChanged()), 422 422 this, SLOT(reformatHeaders())); 423 423 connect(firstFridayCheckBox, SIGNAL(toggled(bool)),
Note:
See TracChangeset
for help on using the changeset viewer.