summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qcombobox.cpp
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-03-18 07:57:42 (GMT)
committeraxis <qt-info@nokia.com>2010-03-18 07:57:42 (GMT)
commitd3cba714adb35098d515f7c4f8e90a4e38527d76 (patch)
tree60018e4f20fc6b58017081b5e9e043d36a7ee3a9 /src/gui/widgets/qcombobox.cpp
parent09c2a804b700ec51f44bda567b806181d00bc161 (diff)
parente483886bcfcf7252af9ac7cc89de15f912bf69da (diff)
downloadQt-d3cba714adb35098d515f7c4f8e90a4e38527d76.zip
Qt-d3cba714adb35098d515f7c4f8e90a4e38527d76.tar.gz
Qt-d3cba714adb35098d515f7c4f8e90a4e38527d76.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-s60
Conflicts: qmake/generators/symbian/symmake_abld.cpp
Diffstat (limited to 'src/gui/widgets/qcombobox.cpp')
-rw-r--r--src/gui/widgets/qcombobox.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index f71d250..c16f18a 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -532,9 +532,11 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
QStyleOptionComboBox opt = comboStyleOption();
const bool usePopup = combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo);
#ifndef QT_NO_SCROLLBAR
+#ifndef Q_WS_S60
if (usePopup)
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#endif
+#endif
if (combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) ||
usePopup) {
view->setMouseTracking(true);
@@ -2417,24 +2419,44 @@ void QComboBox::showPopup()
// Position horizontally.
listRect.moveLeft(above.x());
+#ifndef Q_WS_S60
// Position vertically so the curently selected item lines up
// with the combo box.
const QRect currentItemRect = view()->visualRect(view()->currentIndex());
const int offset = listRect.top() - currentItemRect.top();
listRect.moveTop(above.y() + offset - listRect.top());
+#endif
// Clamp the listRect height and vertical position so we don't expand outside the
// available screen geometry.This may override the vertical position, but it is more
// important to show as much as possible of the popup.
const int height = !boundToScreen ? listRect.height() : qMin(listRect.height(), screen.height());
+#ifdef Q_WS_S60
+ //popup needs to be stretched with screen minimum dimension
+ listRect.setHeight(qMin(screen.height(), screen.width()));
+#else
listRect.setHeight(height);
+#endif
+
if (boundToScreen) {
if (listRect.top() < screen.top())
listRect.moveTop(screen.top());
if (listRect.bottom() > screen.bottom())
listRect.moveBottom(screen.bottom());
}
+#ifdef Q_WS_S60
+ if (screen.width() < screen.height()) {
+ // in portait, menu should be positioned above softkeys
+ listRect.moveBottom(screen.bottom());
+ } else {
+ // landscape, menu should be at the right and horizontally centered
+ listRect.setWidth(listRect.height());
+ listRect.moveCenter(screen.center());
+ (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) :
+ listRect.setLeft(screen.left());
+ }
+#endif
} else if (!boundToScreen || listRect.height() <= belowHeight) {
listRect.moveTopLeft(below);
} else if (listRect.height() <= aboveHeight) {
@@ -2643,6 +2665,34 @@ void QComboBox::changeEvent(QEvent *e)
if (d->lineEdit)
d->updateLineEditGeometry();
d->setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem);
+
+#ifdef Q_WS_S60
+ if (d->container) {
+ QStyleOptionComboBox opt;
+ initStyleOption(&opt);
+
+ if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) {
+ const QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this));
+
+ QRect listRect(style()->subControlRect(QStyle::CC_ComboBox, &opt,
+ QStyle::SC_ComboBoxListBoxPopup, this));
+ listRect.setHeight(qMin(screen.height(), screen.width()));
+
+ if (screen.width() < screen.height()) {
+ // in portait, menu should be positioned above softkeys
+ listRect.moveBottom(screen.bottom());
+ } else {
+ // landscape, menu should be at the right and horizontally centered
+ listRect.setWidth(listRect.height());
+ listRect.moveCenter(screen.center());
+ (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) :
+ listRect.setLeft(screen.left());
+ }
+ d->container->setGeometry(listRect);
+ }
+ }
+#endif
+
// ### need to update scrollers etc. as well here
break;
case QEvent::EnabledChange: