Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r651 r769  
    7777# include <private/qeffects_p.h>
    7878#endif
     79#if defined(Q_WS_S60)
     80#include "private/qt_s60_p.h"
     81#endif
     82
    7983QT_BEGIN_NAMESPACE
    8084
     
    140144        break;
    141145    }
    142 
     146    if (qVariantCanConvert<QBrush>(index.data(Qt::BackgroundRole))) {
     147        menuOption.palette.setBrush(QPalette::All, QPalette::Background,
     148                                    qvariant_cast<QBrush>(index.data(Qt::BackgroundRole)));
     149    }
    143150    menuOption.text = index.model()->data(index, Qt::DisplayRole).toString()
    144151                           .replace(QLatin1Char('&'), QLatin1String("&&"));
     
    533540    const bool usePopup = combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo);
    534541#ifndef QT_NO_SCROLLBAR
     542#ifndef Q_WS_S60
    535543    if (usePopup)
    536544        view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     545#endif
    537546#endif
    538547    if (combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) ||
     
    608617                               combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo));
    609618        setFrameStyle(combo->style()->styleHint(QStyle::SH_ComboBox_PopupFrameStyle, &opt, combo));
    610     }
     619#ifdef QT_SOFTKEYS_ENABLED
     620    } else if (e->type() == QEvent::LanguageChange) {
     621        selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey));
     622        cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey));
     623#endif
     624    }
     625
    611626    QWidget::changeEvent(e);
    612627}
     
    24112426        listRect.moveLeft(above.x());
    24122427
     2428#ifndef Q_WS_S60
    24132429        // Position vertically so the curently selected item lines up
    24142430        // with the combo box.
     
    24162432        const int offset = listRect.top() - currentItemRect.top();
    24172433        listRect.moveTop(above.y() + offset - listRect.top());
     2434#endif
    24182435
    24192436
     
    24222439        // important to show as much as possible of the popup.
    24232440        const int height = !boundToScreen ? listRect.height() : qMin(listRect.height(), screen.height());
     2441#ifdef Q_WS_S60
     2442        //popup needs to be stretched with screen minimum dimension
     2443        listRect.setHeight(qMin(screen.height(), screen.width()));
     2444#else
    24242445        listRect.setHeight(height);
     2446#endif
     2447
    24252448        if (boundToScreen) {
    24262449            if (listRect.top() < screen.top())
     
    24292452                listRect.moveBottom(screen.bottom());
    24302453        }
     2454#ifdef Q_WS_S60
     2455        if (screen.width() < screen.height()) {
     2456            // in portait, menu should be positioned above softkeys
     2457            listRect.moveBottom(screen.bottom());
     2458        } else {
     2459            TRect staConTopRect = TRect();
     2460            AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect);
     2461            listRect.setWidth(listRect.height());
     2462            //by default popup is centered on screen in landscape
     2463            listRect.moveCenter(screen.center());
     2464            if (staConTopRect.IsEmpty()) {
     2465                // landscape without stacon, menu should be at the right
     2466                (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) :
     2467                                                     listRect.setLeft(screen.left());
     2468            }
     2469        }
     2470#endif
    24312471    } else if (!boundToScreen || listRect.height() <= belowHeight) {
    24322472        listRect.moveTopLeft(below);
     
    26372677            d->updateLineEditGeometry();
    26382678        d->setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem);
     2679
     2680#ifdef Q_WS_S60
     2681        if (d->container) {
     2682            QStyleOptionComboBox opt;
     2683            initStyleOption(&opt);
     2684
     2685            if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) {
     2686                const QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this));
     2687
     2688                QRect listRect(style()->subControlRect(QStyle::CC_ComboBox, &opt,
     2689                    QStyle::SC_ComboBoxListBoxPopup, this));
     2690                listRect.setHeight(qMin(screen.height(), screen.width()));
     2691
     2692                if (screen.width() < screen.height()) {
     2693                    // in portait, menu should be positioned above softkeys
     2694                    listRect.moveBottom(screen.bottom());
     2695                } else {
     2696                    TRect staConTopRect = TRect();
     2697                    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect);
     2698                    listRect.setWidth(listRect.height());
     2699                    //by default popup is centered on screen in landscape
     2700                    listRect.moveCenter(screen.center());
     2701                    if (staConTopRect.IsEmpty()) {
     2702                        // landscape without stacon, menu should be at the right
     2703                        (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) :
     2704                                                             listRect.setLeft(screen.left());
     2705                    }
     2706                    d->container->setGeometry(listRect);
     2707                }
     2708            }
     2709        }
     2710#endif
     2711
    26392712        // ### need to update scrollers etc. as well here
    26402713        break;
Note: See TracChangeset for help on using the changeset viewer.