Mac: Bring back proper layout in QMessageBox

Resolved by s/Q_WS_MAC/Q_OS_MAC where appropriate.

Task-number: QTBUG-28738
Change-Id: I8f1239839bffb092387d527af78e9dbe1628ef67
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
Gabriel de Dietrich 2012-12-21 12:51:37 +01:00 committed by The Qt Project
parent 3adbcb58d5
commit f59163e79b
2 changed files with 16 additions and 16 deletions

View File

@ -240,7 +240,7 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text)
label->setTextInteractionFlags(Qt::TextInteractionFlags(q->style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, q)));
label->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
label->setOpenExternalLinks(true);
#if defined(Q_WS_MAC)
#if defined(Q_OS_MAC)
label->setContentsMargins(16, 0, 0, 0);
#else
label->setContentsMargins(2, 0, 0, 0);
@ -258,7 +258,7 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text)
q, SLOT(_q_buttonClicked(QAbstractButton*)));
QGridLayout *grid = new QGridLayout;
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop);
grid->addWidget(label, 0, 1, 1, 1);
// -- leave space for information label --
@ -285,7 +285,7 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text)
}
q->setModal(true);
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
QFont f = q->font();
f.setBold(true);
label->setFont(f);
@ -316,7 +316,7 @@ void QMessageBoxPrivate::updateSize()
if (screenSize.width() <= 1024)
hardLimit = screenSize.width();
#endif
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
int softLimit = qMin(screenSize.width()/2, 420);
#else
// note: ideally on windows, hard and soft limits but it breaks compat
@ -1304,7 +1304,7 @@ void QMessageBox::changeEvent(QEvent *ev)
}
case QEvent::FontChange:
case QEvent::ApplicationFontChange:
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
{
QFont f = font();
f.setBold(true);
@ -1324,12 +1324,12 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
{
Q_D(QMessageBox);
if (e->key() == Qt::Key_Escape
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
|| (e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Period)
#endif
) {
if (d->detectedEscapeButton) {
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
d->detectedEscapeButton->animateClick();
#else
d->detectedEscapeButton->click();
@ -1663,7 +1663,7 @@ QMessageBox::StandardButton QMessageBox::critical(QWidget *parent, const QString
*/
void QMessageBox::about(QWidget *parent, const QString &title, const QString &text)
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
static QPointer<QMessageBox> oldMsgBox;
if (oldMsgBox && oldMsgBox->text() == text) {
@ -1675,7 +1675,7 @@ void QMessageBox::about(QWidget *parent, const QString &title, const QString &te
#endif
QMessageBox *msgBox = new QMessageBox(title, text, Information, 0, 0, 0, parent
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
, Qt::WindowTitleHint | Qt::WindowSystemMenuHint
#endif
);
@ -1685,7 +1685,7 @@ void QMessageBox::about(QWidget *parent, const QString &title, const QString &te
msgBox->setIconPixmap(icon.pixmap(size));
// should perhaps be a style hint
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
oldMsgBox = msgBox;
#if 0
// ### doesn't work until close button is enabled in title bar
@ -1716,7 +1716,7 @@ void QMessageBox::about(QWidget *parent, const QString &title, const QString &te
*/
void QMessageBox::aboutQt(QWidget *parent, const QString &title)
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
static QPointer<QMessageBox> oldMsgBox;
if (oldMsgBox) {
@ -1778,7 +1778,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title)
#endif
// should perhaps be a style hint
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
oldMsgBox = msgBox;
#if 0
// ### doesn't work until close button is enabled in title bar
@ -2443,7 +2443,7 @@ void QMessageBox::setInformativeText(const QString &text)
layout()->removeWidget(d->informativeLabel);
delete d->informativeLabel;
d->informativeLabel = 0;
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
d->label->setContentsMargins(2, 0, 0, 0);
#endif
d->updateSize();
@ -2457,7 +2457,7 @@ void QMessageBox::setInformativeText(const QString &text)
label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
label->setOpenExternalLinks(true);
label->setWordWrap(true);
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
d->label->setContentsMargins(2, 0, 0, 0);
label->setContentsMargins(2, 0, 0, 6);
label->setIndent(9);
@ -2487,7 +2487,7 @@ void QMessageBox::setInformativeText(const QString &text)
void QMessageBox::setWindowTitle(const QString &title)
{
// Message boxes on the mac do not have a title
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
QDialog::setWindowTitle(title);
#else
Q_UNUSED(title);

View File

@ -4636,7 +4636,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = int(QStyleHelper::dpiScaled(13.));
break;
case PM_MessageBoxIconSize:
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
if (QApplication::desktopSettingsAware()) {
ret = 64; // No DPI scaling, it's handled elsewhere.
} else