From 39b598cbf387e3939d7a9e72b5e69b59839ae473 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 4 Jul 2011 15:50:14 +0300 Subject: On symbian QMessageBox icon is on different side than in native dialog In Symbian dialogs have layout (on LeftToRight UIs) where icon is on the right and text on left. Whereas, Qt by default has icon on the left and text on the right. Fix Qt dialogs to behave like native ones on Symbian. Task-number: QTBUG-9924 Reviewed-by: Tomi Vihria --- src/gui/dialogs/qerrormessage.cpp | 16 ++++++++++++---- src/gui/dialogs/qmessagebox.cpp | 11 +++++++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/gui/dialogs/qerrormessage.cpp b/src/gui/dialogs/qerrormessage.cpp index 890e6ca..0a6580a 100644 --- a/src/gui/dialogs/qerrormessage.cpp +++ b/src/gui/dialogs/qerrormessage.cpp @@ -249,12 +249,20 @@ QErrorMessage::QErrorMessage(QWidget * parent) d->icon->setPixmap(QMessageBox::standardIcon(QMessageBox::Information)); d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop); #endif - grid->addWidget(d->icon, 0, 0, Qt::AlignTop); +#ifdef Q_WS_S60 + //In Symbian, messagebox icons are in LtR UIs on right. Thus, layout needs to switch icon and text columns. + const int preferredIconColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 1 : 0; + const int preferredTextColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 0 : 1; +#else + const int preferredIconColumn = 0; + const int preferredTextColumn = 1; +#endif + grid->addWidget(d->icon, 0, preferredIconColumn, Qt::AlignTop); d->errors = new QErrorMessageTextView(this); - grid->addWidget(d->errors, 0, 1); + grid->addWidget(d->errors, 0, preferredTextColumn); d->again = new QCheckBox(this); d->again->setChecked(true); - grid->addWidget(d->again, 1, 1, Qt::AlignTop); + grid->addWidget(d->again, 1, preferredTextColumn, Qt::AlignTop); d->ok = new QPushButton(this); #ifdef QT_SOFTKEYS_ENABLED d->okAction = new QAction(d->ok); @@ -270,7 +278,7 @@ QErrorMessage::QErrorMessage(QWidget * parent) connect(d->ok, SIGNAL(clicked()), this, SLOT(accept())); d->ok->setFocus(); grid->addWidget(d->ok, 2, 0, 1, 2, Qt::AlignCenter); - grid->setColumnStretch(1, 42); + grid->setColumnStretch(preferredTextColumn, 42); grid->setRowStretch(0, 42); d->retranslateStrings(); } diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index 7d209fb..6a1c04a 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -259,8 +259,15 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text) QGridLayout *grid = new QGridLayout; #ifndef Q_WS_MAC - grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop); - grid->addWidget(label, 0, 1, 1, 1); +#ifdef Q_WS_S60 + const int preferredIconColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 1 : 0; + const int preferredTextColumn = (QApplication::layoutDirection() == Qt::LeftToRight) ? 0 : 1; +#else + const int preferredIconColumn = 0; + const int preferredTextColumn = 1; +#endif + grid->addWidget(iconLabel, 0, preferredIconColumn, 2, 1, Qt::AlignTop); + grid->addWidget(label, 0, preferredTextColumn, 1, 1); // -- leave space for information label -- grid->addWidget(buttonBox, 2, 0, 1, 2); #else -- cgit v0.12