summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-03-24 19:12:58 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-03-25 09:02:52 (GMT)
commitc3776865dd3731917adf9a8ec8cdffb79a579bae (patch)
tree241a89f684101e8e98026f34e49850dd37f968a4 /src
parentb409dab4a97acdbc2c89a43f25d57be1277aea1d (diff)
downloadQt-c3776865dd3731917adf9a8ec8cdffb79a579bae.zip
Qt-c3776865dd3731917adf9a8ec8cdffb79a579bae.tar.gz
Qt-c3776865dd3731917adf9a8ec8cdffb79a579bae.tar.bz2
Fix scrollbar appearing on QComboBox
aefadefae655972287b196e6c0f0563c4fb4666c was not good enough Task-number: 248094 Reviewed-by: Jens Bache-Wiig <jbache@trolltech.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qcombobox.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 9a0c404..c7e2590 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -61,6 +61,7 @@
#endif
#include <private/qcombobox_p.h>
#include <private/qabstractitemmodel_p.h>
+#include <private/qabstractscrollarea_p.h>
#include <qdebug.h>
#ifdef Q_WS_X11
@@ -2273,7 +2274,6 @@ void QComboBox::showPopup()
bool boundToScreen = !window()->testAttribute(Qt::WA_DontShowOnScreen);
const bool usePopup = style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this);
-
{
int listHeight = 0;
int count = 0;
@@ -2305,11 +2305,23 @@ void QComboBox::showPopup()
listRect.setHeight(listHeight);
}
- // add the frame size to the height. (+the spacing for the top and the bottom item)
- int marginTop, marginBottom;
- view()->getContentsMargins(0, &marginTop, 0, &marginBottom);
- listRect.setHeight(listRect.height() + 2*container->spacing()
- + marginTop + marginBottom);
+ {
+ // add the spacing for the grid on the top and the bottom;
+ int heightMargin = 2*container->spacing();
+
+ // add the frame of the container
+ int marginTop, marginBottom;
+ container->getContentsMargins(0, &marginTop, 0, &marginBottom);
+ heightMargin += marginTop + marginBottom;
+
+ //add the frame of the view
+ view()->getContentsMargins(0, &marginTop, 0, &marginBottom);
+ marginTop += static_cast<QAbstractScrollAreaPrivate *>(QObjectPrivate::get(view()))->top;
+ marginBottom += static_cast<QAbstractScrollAreaPrivate *>(QObjectPrivate::get(view()))->bottom;
+ heightMargin += marginTop + marginBottom;
+
+ listRect.setHeight(listRect.height() + heightMargin);
+ }
// Add space for margin at top and bottom if the style wants it.
if (usePopup)