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/dialogs/qprogressdialog.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5858#include <limits.h>
    5959
     60#if defined(QT_SOFTKEYS_ENABLED)
     61#include <qaction.h>
     62#endif
     63#ifdef Q_WS_S60
     64#include <QtGui/qdesktopwidget.h>
     65#endif
     66
     67
    6068QT_BEGIN_NAMESPACE
    6169
     
    7785#ifndef QT_NO_SHORTCUT
    7886        escapeShortcut(0),
     87#endif
     88#ifdef QT_SOFTKEYS_ENABLED
     89        cancelAction(0),
    7990#endif
    8091        useDefaultCancelText(false)
     
    103114#ifndef QT_NO_SHORTCUT
    104115    QShortcut *escapeShortcut;
     116#endif
     117#ifdef QT_SOFTKEYS_ENABLED
     118    QAction *cancelAction;
    105119#endif
    106120    bool useDefaultCancelText;
     
    197211  \class QProgressDialog
    198212  \brief The QProgressDialog class provides feedback on the progress of a slow operation.
    199   \ingroup dialogs
    200   \mainclass
     213  \ingroup standard-dialogs
     214
    201215
    202216  A progress dialog is used to give the user an indication of how long
     
    432446    resize(w, h);
    433447    if (cancelButton)
     448#if !defined(QT_SOFTKEYS_ENABLED)
    434449        cancelButton->show();
     450#else
     451    {
     452        d->cancelAction = new QAction(cancelButton->text(), cancelButton);
     453        d->cancelAction->setSoftKeyRole(QAction::NegativeSoftKey);
     454        connect(d->cancelAction, SIGNAL(triggered()), this, SIGNAL(canceled()));
     455        addAction(d->cancelAction);
     456    }
     457#endif
    435458}
    436459
     
    449472
    450473    if (!cancelButtonText.isNull()) {
    451         if (d->cancel)
     474        if (d->cancel) {
    452475            d->cancel->setText(cancelButtonText);
    453         else
     476#ifdef QT_SOFTKEYS_ENABLED
     477            d->cancelAction->setText(cancelButtonText);
     478#endif
     479        } else {
    454480            setCancelButton(new QPushButton(cancelButtonText, this));
     481        }
    455482    } else {
    456483        setCancelButton(0);
     
    627654  \warning If the progress dialog is modal
    628655    (see QProgressDialog::QProgressDialog()),
    629     this function calls QApplication::processEvents(), so take care that
     656    setValue() calls QApplication::processEvents(), so take care that
    630657    this does not cause undesirable re-entrancy in your code. For example,
    631658    don't use a QProgressDialog inside a paintEvent()!
     
    644671    if (d->shown_once) {
    645672        if (isModal())
    646             qApp->processEvents();
     673            QApplication::processEvents();
    647674    } else {
    648675        if (progress == 0) {
     
    702729    if (d->cancel)
    703730        h += d->cancel->sizeHint().height() + spacing;
     731#ifdef Q_WS_S60
     732    if (QApplication::desktop()->size().height() > QApplication::desktop()->size().width())
     733        return QSize(qMax(QApplication::desktop()->size().width(), sh.width() + 2 * margin), h);
     734    else
     735        return QSize(qMax(QApplication::desktop()->size().height(), sh.width() + 2 * margin), h);
     736#else
    704737    return QSize(qMax(200, sh.width() + 2 * margin), h);
     738#endif
    705739}
    706740
     
    719753{
    720754    Q_D(QProgressDialog);
    721     if (ev->type() == QEvent::StyleChange)
     755    if (ev->type() == QEvent::StyleChange) {
    722756        d->layout();
    723     else if (ev->type() == QEvent::LanguageChange)
     757    } else if (ev->type() == QEvent::LanguageChange) {
    724758        d->retranslateStrings();
     759    }
    725760    QDialog::changeEvent(ev);
    726761}
Note: See TracChangeset for help on using the changeset viewer.