Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qcalendarwidget.cpp

    r2 r561  
    22**
    33** 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])
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    199199    QString str;
    200200    if (m_day / 10 == 0)
    201         str += QLatin1String("0");
     201        str += QLatin1);
    202202    str += QString::number(m_day);
    203203    return highlightString(str, m_pos);
     
    211211        QString str;
    212212        if (date.day() / 10 == 0)
    213             str += QLatin1String("0");
     213            str += QLatin1);
    214214        return str + QString::number(date.day());
    215215    } else if (repeat == 3) {
     
    317317    QString str;
    318318    if (m_month / 10 == 0)
    319         str += QLatin1String("0");
     319        str += QLatin1);
    320320    str += QString::number(m_month);
    321321    return highlightString(str, m_pos);
     
    329329        QString str;
    330330        if (date.month() / 10 == 0)
    331             str += QLatin1String("0");
     331            str += QLatin1);
    332332        return str + QString::number(date.month());
    333333    } else if (repeat == 3) {
    334334        return m_locale.standaloneMonthName(date.month(), QLocale::ShortFormat);
    335     } else if (repeat >= 4) {
     335    } else {
    336336        return m_locale.standaloneMonthName(date.month(), QLocale::LongFormat);
    337337    }
    338     return QString();
    339338}
    340339
     
    433432    for (int i = 0; i < 3; i++) {
    434433        if (m_year / pow == 0)
    435             str += QLatin1String("0");
     434            str += QLatin1);
    436435        pow *= 10;
    437436    }
     
    446445        int year = date.year() % 100;
    447446        if (year / 10 == 0)
    448             str = QLatin1String("0");
     447            str = QLatin1);
    449448        return str + QString::number(year);
    450449    }
     
    578577
    579578    int pos = 0;
    580     const QLatin1String quote("'");
     579    const QLatin1);
    581580    bool quoting = false;
    582581    QString separator;
     
    19621961    calendar widget allowing the user to select a date.
    19631962    \since 4.2
    1964     \mainclass
     1963
    19651964    \ingroup advanced
    19661965
     
    19691968    The widget is initialized with the current month and year, but
    19701969    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.
    19741971
    19751972    By default, today's date is selected, and the user can select a
     
    19831980    all. Note that a date also can be selected programmatically using
    19841981    the setSelectedDate() slot.
     1982
     1983
     1984
    19851985
    19861986    A newly created calendar widget uses abbreviated day names, and
     
    21432143    int rows = 7;
    21442144    int cols = 8;
    2145     int startRow = 0;
    2146     int startCol = 0;
    21472145
    21482146    const int marginH = (style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1) * 2;
     
    21502148    if (horizontalHeaderFormat() == QCalendarWidget::NoHorizontalHeader) {
    21512149        rows = 6;
    2152         startRow = 1;
    21532150    } else {
    21542151        for (int i = 1; i <= 7; i++) {
     
    21612158    if (verticalHeaderFormat() == QCalendarWidget::NoVerticalHeader) {
    21622159        cols = 7;
    2163         startCol = 1;
    21642160    } else {
    21652161        for (int i = 1; i <= 6; i++) {
     
    22932289
    22942290    The currently displayed month and year can be retrieved using the
    2295     currentPageMonth() and currentPageYear() functions respectively.
     2291    () functions respectively.
    22962292
    22972293    \sa yearShown(), monthShown(), showPreviousMonth(), showNextMonth(),
     
    23022298{
    23032299    Q_D(QCalendarWidget);
     2300
     2301
     2302
     2303
     2304
     2305
    23042306    d->showMonth(year, month);
     2307
     2308
     2309
     2310
     2311
     2312
     2313
     2314
    23052315}
    23062316
     
    25272537    if (!min.isValid() || !max.isValid())
    25282538        return;
    2529 
    2530     QDate minimum = min;
    2531     QDate maximum = max;
    2532     if (min > max) {
    2533         minimum = max;
    2534         maximum = min;
    2535     }
    25362539
    25372540    QDate oldDate = d->m_model->m_date;
     
    27922795{
    27932796    Q_D(QCalendarWidget);
    2794     if ( date.isNull() && !format.isValid() )
     2797    if ()
    27952798        d->m_model->m_dateFormats.clear();
    27962799    else
     
    30343037{
    30353038    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        }
    30413054    }
    30423055    return QWidget::eventFilter(watched, event);
Note: See TracChangeset for help on using the changeset viewer.