src/gui/dialogs/qmessagebox.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 30 5dc02b23752f
--- a/src/gui/dialogs/qmessagebox.cpp	Fri Apr 16 15:50:13 2010 +0300
+++ b/src/gui/dialogs/qmessagebox.cpp	Mon May 03 13:17:34 2010 +0300
@@ -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
@@ -314,6 +318,7 @@
             }
             width = hardLimit;
         }
+    }
 #ifdef Q_WS_S60
         // in S60 portait messageBoxes should always occupy maximum width
         if (QApplication::desktop()->size().height() > QApplication::desktop()->size().width()){
@@ -323,7 +328,6 @@
             width = qMin(QApplication::desktop()->size().height(), hardLimit);
         }
 #endif
-    }
 
     if (informativeLabel) {
         label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
@@ -353,6 +357,16 @@
     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);
 }