Changeset 846 for trunk/src/gui/widgets/qcombobox.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/widgets/qcombobox.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 57 57 #include <qtreeview.h> 58 58 #include <qheaderview.h> 59 #include <qmath.h> 59 60 #ifndef QT_NO_IM 60 61 #include "qinputcontext.h" … … 113 114 { 114 115 QStyleOptionMenuItem menuOption; 115 menuOption.palette = option.palette.resolve(QApplication::palette("QMenu")); 116 117 QPalette resolvedpalette = option.palette.resolve(QApplication::palette("QMenu")); 118 QVariant value = index.data(Qt::ForegroundRole); 119 if (qVariantCanConvert<QBrush>(value)) { 120 resolvedpalette.setBrush(QPalette::WindowText, qvariant_cast<QBrush>(value)); 121 resolvedpalette.setBrush(QPalette::ButtonText, qvariant_cast<QBrush>(value)); 122 resolvedpalette.setBrush(QPalette::Text, qvariant_cast<QBrush>(value)); 123 } 124 menuOption.palette = resolvedpalette; 116 125 menuOption.state = QStyle::State_None; 117 126 if (mCombo->window()->isActiveWindow()) … … 324 333 325 334 // height 326 sh.setHeight(qMax( fm.height(), 14) + 2);335 sh.setHeight(qMax(qCeil(QFontMetricsF(fm).height()), 14) + 2); 327 336 if (hasIcon) { 328 337 sh.setHeight(qMax(sh.height(), iconSize.height() + 2)); … … 390 399 QStyleOptionComboBox opt = comboStyleOption(); 391 400 if (combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo)) 392 view-> clearSelection();401 view->setCurrentIndex(QModelIndex()); 393 402 #endif 394 403 } … … 696 705 emit resetButton(); 697 706 combo->update(); 707 // QGraphicsScenePrivate::removePopup closes the combo box popup, it hides it non-explicitly. 708 // Hiding/showing the QComboBox after this will unexpectedly show the popup as well. 709 // Re-hiding the popup container makes sure it is explicitly hidden. 710 if (QGraphicsProxyWidget *proxy = graphicsProxyWidget()) 711 proxy->hide(); 698 712 } 699 713 … … 897 911 highlights an item in the combobox popup list. All three signals 898 912 exist in two versions, one with a QString argument and one with an 899 \c int argument. If the user select es or highlights a pixmap, only913 \c int argument. If the user selects or highlights a pixmap, only 900 914 the \c int signals are emitted. Whenever the text of an editable 901 915 combobox is changed the editTextChanged() signal is emitted. … … 1284 1298 By default, this property has a value of 10. 1285 1299 1286 \note This property is ignored for non-editable comboboxes in Mac style. 1300 \note This property is ignored for non-editable comboboxes in styles that returns 1301 false for QStyle::SH_ComboBox_Popup such as the Mac style or the Gtk+ Style. 1287 1302 */ 1288 1303 int QComboBox::maxVisibleItems() const … … 2364 2379 #endif 2365 2380 ++count; 2366 if (!usePopup && count > d->maxVisibleItems) {2381 if (!usePopup && count >= d->maxVisibleItems) { 2367 2382 toCheck.clear(); 2368 2383 break; … … 2462 2477 //by default popup is centered on screen in landscape 2463 2478 listRect.moveCenter(screen.center()); 2464 if (staConTopRect.IsEmpty() ) {2479 if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) { 2465 2480 // landscape without stacon, menu should be at the right 2466 2481 (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : … … 2835 2850 d->updateArrow(QStyle::State_Sunken); 2836 2851 #ifdef QT_KEYPAD_NAVIGATION 2837 if (!d->lineEdit) { 2852 //if the container already exists, then d->viewContainer() is safe to call 2853 if (d->container) { 2838 2854 #endif 2839 2855 // We've restricted the next couple of lines, because by not calling
Note:
See TracChangeset
for help on using the changeset viewer.