diff options
Diffstat (limited to 'src/widgets/dialogs/qmessagebox.cpp')
-rw-r--r-- | src/widgets/dialogs/qmessagebox.cpp | 77 |
1 files changed, 3 insertions, 74 deletions
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 3d52cb206a..57b3f47863 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -200,7 +200,7 @@ public: #endif compatMode(false), autoAddOkButton(true), detectedEscapeButton(0), informativeLabel(0), - options(new QMessageDialogOptions) { } + options(QMessageDialogOptions::create()) { } void init(const QString &title = QString(), const QString &text = QString()); void setupLayout(); @@ -218,9 +218,6 @@ public: int layoutMinimumWidth(); void retranslateStrings(); -#ifdef Q_OS_WINCE - void hideSpecial(); -#endif static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, int button0, int button1, int button2); @@ -362,24 +359,15 @@ void QMessageBoxPrivate::updateSize() return; QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); -#if defined(Q_OS_WINCE) - // the width of the screen, less the window border. - int hardLimit = screenSize.width() - (q->frameGeometry().width() - q->geometry().width()); -#else int hardLimit = qMin(screenSize.width() - 480, 1000); // can never get bigger than this // on small screens allows the messagebox be the same size as the screen if (screenSize.width() <= 1024) hardLimit = screenSize.width(); -#endif #ifdef Q_OS_MAC int softLimit = qMin(screenSize.width()/2, 420); #else // note: ideally on windows, hard and soft limits but it breaks compat -#ifndef Q_OS_WINCE int softLimit = qMin(screenSize.width()/2, 500); -#else - int softLimit = qMin(screenSize.width() * 3 / 4, 500); -#endif //Q_OS_WINCE #endif if (informativeLabel) @@ -436,28 +424,6 @@ void QMessageBoxPrivate::updateSize() QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest); } - -#ifdef Q_OS_WINCE -/*! - \internal - Hides special buttons which are rather shown in the title bar - on WinCE, to conserve screen space. -*/ - -void QMessageBoxPrivate::hideSpecial() -{ - Q_Q(QMessageBox); - QList<QPushButton*> list = q->findChildren<QPushButton*>(); - for (int i=0; i<list.size(); ++i) { - QPushButton *pb = list.at(i); - QString text = pb->text(); - text.remove(QChar::fromLatin1('&')); - if (text == QApplication::translate("QMessageBox", "OK" )) - pb->setFixedSize(0,0); - } -} -#endif - static int oldButton(int button) { switch (button & QMessageBox::ButtonMask) { @@ -1368,24 +1334,6 @@ bool QMessageBox::event(QEvent *e) case QEvent::LanguageChange: d_func()->retranslateStrings(); break; -#ifdef Q_OS_WINCE - case QEvent::OkRequest: - case QEvent::HelpRequest: { - QString bName = - (e->type() == QEvent::OkRequest) - ? QApplication::translate("QMessageBox", "OK") - : QApplication::translate("QMessageBox", "Help"); - QList<QPushButton*> list = findChildren<QPushButton*>(); - for (int i=0; i<list.size(); ++i) { - QPushButton *pb = list.at(i); - if (pb->text() == bName) { - if (pb->isEnabled()) - pb->click(); - return pb->isEnabled(); - } - } - } -#endif default: break; } @@ -1431,7 +1379,7 @@ void QMessageBox::changeEvent(QEvent *ev) d->buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this)); if (d->informativeLabel) d->informativeLabel->setTextInteractionFlags(flags); - // intentional fall through + Q_FALLTHROUGH(); } case QEvent::FontChange: case QEvent::ApplicationFontChange: @@ -1442,6 +1390,7 @@ void QMessageBox::changeEvent(QEvent *ev) d->label->setFont(f); } #endif + Q_FALLTHROUGH(); default: break; } @@ -1525,20 +1474,6 @@ void QMessageBox::keyPressEvent(QKeyEvent *e) QDialog::keyPressEvent(e); } -#ifdef Q_OS_WINCE -/*! - \reimp -*/ -void QMessageBox::setVisible(bool visible) -{ - Q_D(QMessageBox); - if (visible) - d->hideSpecial(); - QDialog::setVisible(visible); -} -#endif - - /*! \overload @@ -1596,9 +1531,6 @@ void QMessageBox::showEvent(QShowEvent *e) Q_D(QMessageBox); if (d->autoAddOkButton) { addButton(Ok); -#if defined(Q_OS_WINCE) - d->hideSpecial(); -#endif } if (d->detailsButton) addButton(d->detailsButton, QMessageBox::ActionRole); @@ -1912,9 +1844,6 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) QPixmap pm(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png")); if (!pm.isNull()) msgBox->setIconPixmap(pm); -#if defined(Q_OS_WINCE) - msgBox->setDefaultButton(msgBox->addButton(QMessageBox::Ok)); -#endif // should perhaps be a style hint #ifdef Q_OS_MAC |