summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qcombobox.cpp
diff options
context:
space:
mode:
authorIan Walters <ian.walters@nokia.com>2009-04-06 22:47:32 (GMT)
committerIan Walters <ian.walters@nokia.com>2009-04-06 22:47:32 (GMT)
commitbccb7b178c0255c74d648c3972895f66a70fd87b (patch)
treeead94cee89e2ffda4127201b734f1660f1389585 /src/gui/widgets/qcombobox.cpp
parent423d6052844b2026c8acc8826d6546d3afc494d3 (diff)
parentcf42b485ebc1ab3e1f0a804b8c4e404fa99f1f6f (diff)
downloadQt-bccb7b178c0255c74d648c3972895f66a70fd87b.zip
Qt-bccb7b178c0255c74d648c3972895f66a70fd87b.tar.gz
Qt-bccb7b178c0255c74d648c3972895f66a70fd87b.tar.bz2
Merge branch 'master' into contiguouscache
Diffstat (limited to 'src/gui/widgets/qcombobox.cpp')
-rw-r--r--src/gui/widgets/qcombobox.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 9a0c404..09a51fe 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
@@ -108,7 +109,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt
const QModelIndex &index) const
{
QStyleOptionMenuItem menuOption;
- menuOption.palette = QComboBoxPrivate::viewContainerPalette(mCombo).resolve(QApplication::palette("QMenu"));
+ menuOption.palette = option.palette.resolve(QApplication::palette("QMenu"));
menuOption.state = QStyle::State_None;
if (mCombo->window()->isActiveWindow())
menuOption.state = QStyle::State_Active;
@@ -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)