Changeset 561 for trunk/src/gui/widgets/qcalendarwidget.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/src/gui/widgets/qcalendarwidget.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 QtGui module 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 ** … … 199 199 QString str; 200 200 if (m_day / 10 == 0) 201 str += QLatin1 String("0");201 str += QLatin1); 202 202 str += QString::number(m_day); 203 203 return highlightString(str, m_pos); … … 211 211 QString str; 212 212 if (date.day() / 10 == 0) 213 str += QLatin1 String("0");213 str += QLatin1); 214 214 return str + QString::number(date.day()); 215 215 } else if (repeat == 3) { … … 317 317 QString str; 318 318 if (m_month / 10 == 0) 319 str += QLatin1 String("0");319 str += QLatin1); 320 320 str += QString::number(m_month); 321 321 return highlightString(str, m_pos); … … 329 329 QString str; 330 330 if (date.month() / 10 == 0) 331 str += QLatin1 String("0");331 str += QLatin1); 332 332 return str + QString::number(date.month()); 333 333 } else if (repeat == 3) { 334 334 return m_locale.standaloneMonthName(date.month(), QLocale::ShortFormat); 335 } else if (repeat >= 4){335 } else { 336 336 return m_locale.standaloneMonthName(date.month(), QLocale::LongFormat); 337 337 } 338 return QString();339 338 } 340 339 … … 433 432 for (int i = 0; i < 3; i++) { 434 433 if (m_year / pow == 0) 435 str += QLatin1 String("0");434 str += QLatin1); 436 435 pow *= 10; 437 436 } … … 446 445 int year = date.year() % 100; 447 446 if (year / 10 == 0) 448 str = QLatin1 String("0");447 str = QLatin1); 449 448 return str + QString::number(year); 450 449 } … … 578 577 579 578 int pos = 0; 580 const QLatin1 String quote("'");579 const QLatin1); 581 580 bool quoting = false; 582 581 QString separator; … … 1962 1961 calendar widget allowing the user to select a date. 1963 1962 \since 4.2 1964 \mainclass 1963 1965 1964 \ingroup advanced 1966 1965 … … 1969 1968 The widget is initialized with the current month and year, but 1970 1969 QCalendarWidget provides several public slots to change the year 1971 and month that is shown. The currently displayed month and year 1972 can be retrieved using the currentPageMonth() and currentPageYear() 1973 functions, respectively. 1970 and month that is shown. 1974 1971 1975 1972 By default, today's date is selected, and the user can select a … … 1983 1980 all. Note that a date also can be selected programmatically using 1984 1981 the setSelectedDate() slot. 1982 1983 1984 1985 1985 1986 1986 A newly created calendar widget uses abbreviated day names, and … … 2143 2143 int rows = 7; 2144 2144 int cols = 8; 2145 int startRow = 0;2146 int startCol = 0;2147 2145 2148 2146 const int marginH = (style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1) * 2; … … 2150 2148 if (horizontalHeaderFormat() == QCalendarWidget::NoHorizontalHeader) { 2151 2149 rows = 6; 2152 startRow = 1;2153 2150 } else { 2154 2151 for (int i = 1; i <= 7; i++) { … … 2161 2158 if (verticalHeaderFormat() == QCalendarWidget::NoVerticalHeader) { 2162 2159 cols = 7; 2163 startCol = 1;2164 2160 } else { 2165 2161 for (int i = 1; i <= 6; i++) { … … 2293 2289 2294 2290 The currently displayed month and year can be retrieved using the 2295 currentPageMonth() and currentPageYear() functions respectively.2291 () functions respectively. 2296 2292 2297 2293 \sa yearShown(), monthShown(), showPreviousMonth(), showNextMonth(), … … 2302 2298 { 2303 2299 Q_D(QCalendarWidget); 2300 2301 2302 2303 2304 2305 2304 2306 d->showMonth(year, month); 2307 2308 2309 2310 2311 2312 2313 2314 2305 2315 } 2306 2316 … … 2527 2537 if (!min.isValid() || !max.isValid()) 2528 2538 return; 2529 2530 QDate minimum = min;2531 QDate maximum = max;2532 if (min > max) {2533 minimum = max;2534 maximum = min;2535 }2536 2539 2537 2540 QDate oldDate = d->m_model->m_date; … … 2792 2795 { 2793 2796 Q_D(QCalendarWidget); 2794 if ( date.isNull() && !format.isValid())2797 if () 2795 2798 d->m_model->m_dateFormats.clear(); 2796 2799 else … … 3034 3037 { 3035 3038 Q_D(QCalendarWidget); 3036 if (event->type() == QEvent::MouseButtonPress && d->yearEdit->hasFocus() && !QRect(d->yearEdit->mapToGlobal(QPoint(0, 0)), d->yearEdit->size()).contains(static_cast<QMouseEvent *>(event)->globalPos())) { 3037 event->accept(); 3038 d->_q_yearEditingFinished(); 3039 setFocus(); 3040 return true; 3039 if (event->type() == QEvent::MouseButtonPress && d->yearEdit->hasFocus()) { 3040 QWidget *tlw = window(); 3041 QWidget *widget = static_cast<QWidget*>(watched); 3042 //as we have a event filter on the whole application we first make sure that the top level widget 3043 //of both this and the watched widget are the same to decide if we should finish the year edition. 3044 if (widget->window() == tlw) { 3045 QPoint mousePos = widget->mapTo(tlw, static_cast<QMouseEvent *>(event)->pos()); 3046 QRect geom = QRect(d->yearEdit->mapTo(tlw, QPoint(0, 0)), d->yearEdit->size()); 3047 if (!geom.contains(mousePos)) { 3048 event->accept(); 3049 d->_q_yearEditingFinished(); 3050 setFocus(); 3051 return true; 3052 } 3053 } 3041 3054 } 3042 3055 return QWidget::eventFilter(watched, event);
Note:
See TracChangeset
for help on using the changeset viewer.