Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qcombobox.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    5757#include <qtreeview.h>
    5858#include <qheaderview.h>
     59#include <qmath.h>
    5960#ifndef QT_NO_IM
    6061#include "qinputcontext.h"
     
    113114{
    114115    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;
    116125    menuOption.state = QStyle::State_None;
    117126    if (mCombo->window()->isActiveWindow())
     
    324333
    325334        // height
    326         sh.setHeight(qMax(fm.height(), 14) + 2);
     335        sh.setHeight(qMax(qCeil(QFontMetricsF(fm).height()), 14) + 2);
    327336        if (hasIcon) {
    328337            sh.setHeight(qMax(sh.height(), iconSize.height() + 2));
     
    390399    QStyleOptionComboBox opt = comboStyleOption();
    391400    if (combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo))
    392         view->clearSelection();
     401        view->setCurrentIndex(QModelIndex());
    393402#endif
    394403}
     
    696705    emit resetButton();
    697706    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();
    698712}
    699713
     
    897911    highlights an item in the combobox popup list. All three signals
    898912    exist in two versions, one with a QString argument and one with an
    899     \c int argument. If the user selectes or highlights a pixmap, only
     913    \c int argument. If the user selects or highlights a pixmap, only
    900914    the \c int signals are emitted. Whenever the text of an editable
    901915    combobox is changed the editTextChanged() signal is emitted.
     
    12841298    By default, this property has a value of 10.
    12851299
    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.
    12871302*/
    12881303int QComboBox::maxVisibleItems() const
     
    23642379#endif
    23652380                ++count;
    2366                 if (!usePopup && count > d->maxVisibleItems) {
     2381                if (!usePopup && count >= d->maxVisibleItems) {
    23672382                    toCheck.clear();
    23682383                    break;
     
    24622477            //by default popup is centered on screen in landscape
    24632478            listRect.moveCenter(screen.center());
    2464             if (staConTopRect.IsEmpty()) {
     2479            if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) {
    24652480                // landscape without stacon, menu should be at the right
    24662481                (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) :
     
    28352850            d->updateArrow(QStyle::State_Sunken);
    28362851#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) {
    28382854#endif
    28392855            // We've restricted the next couple of lines, because by not calling
Note: See TracChangeset for help on using the changeset viewer.