summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs/qmessagebox.cpp
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2010-03-25 10:50:48 (GMT)
committerSami Merila <sami.merila@nokia.com>2010-03-25 10:50:48 (GMT)
commit80cf88a395d61c2dee83d484c91f24437be0c0e0 (patch)
tree92f972c268f34fafb3251d4e0d7e207d6f18e9f9 /src/gui/dialogs/qmessagebox.cpp
parent126849067d3c9d126606afaacecfef5559c2e657 (diff)
downloadQt-80cf88a395d61c2dee83d484c91f24437be0c0e0.zip
Qt-80cf88a395d61c2dee83d484c91f24437be0c0e0.tar.gz
Qt-80cf88a395d61c2dee83d484c91f24437be0c0e0.tar.bz2
QMessageBox is smaller than native MessageBox
Messageboxes are smaller than native ones. This is due to that native ones have a lot of empty space. To fix this, we define a new custom pixel metrics that is the minimum height of one text line messagebox (aka AknPopUp) on the native side. Then we ensure that the QMessageBox is at least of this height. Additionally we do some minor styling for QMessageBox: - the corners graphics are now as rounded as on native side - the font is set to match the native side - the top margin space is doubled for dialogs, which is rather good approximation of native side Task-number: QTBUG-4875 Reviewed-by: Janne Anttila
Diffstat (limited to 'src/gui/dialogs/qmessagebox.cpp')
-rw-r--r--src/gui/dialogs/qmessagebox.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp
index bd2df9c..ccc925c 100644
--- a/src/gui/dialogs/qmessagebox.cpp
+++ b/src/gui/dialogs/qmessagebox.cpp
@@ -65,6 +65,10 @@
#include <QtGui/qfontmetrics.h>
#include <QtGui/qclipboard.h>
+#ifndef QT_NO_STYLE_S60
+#include <qs60style.h>
+#endif
+
#ifdef Q_WS_WINCE
extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp
extern bool qt_wince_is_smartphone();//defined in qguifunctions_wince.cpp
@@ -353,6 +357,16 @@ void QMessageBoxPrivate::updateSize()
int height = (layout->hasHeightForWidth())
? layout->totalHeightForWidth(width)
: layout->totalMinimumSize().height();
+
+#ifndef QT_NO_STYLE_S60
+ QS60Style *s60Style = 0;
+ s60Style = qobject_cast<QS60Style *>(QApplication::style());
+
+ //use custom pixel metric to deduce the minimum height of the messagebox
+ if (s60Style)
+ height = qMax(height, s60Style->pixelMetric((QStyle::PixelMetric)PM_MessageBoxHeight));
+#endif
+
q->setFixedSize(width, height);
QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest);
}