Changeset 769 for trunk/src/gui/widgets/qcombobox.cpp
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/widgets/qcombobox.cpp
r651 r769 77 77 # include <private/qeffects_p.h> 78 78 #endif 79 #if defined(Q_WS_S60) 80 #include "private/qt_s60_p.h" 81 #endif 82 79 83 QT_BEGIN_NAMESPACE 80 84 … … 140 144 break; 141 145 } 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 } 143 150 menuOption.text = index.model()->data(index, Qt::DisplayRole).toString() 144 151 .replace(QLatin1Char('&'), QLatin1String("&&")); … … 533 540 const bool usePopup = combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo); 534 541 #ifndef QT_NO_SCROLLBAR 542 #ifndef Q_WS_S60 535 543 if (usePopup) 536 544 view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 545 #endif 537 546 #endif 538 547 if (combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) || … … 608 617 combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo)); 609 618 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 611 626 QWidget::changeEvent(e); 612 627 } … … 2411 2426 listRect.moveLeft(above.x()); 2412 2427 2428 #ifndef Q_WS_S60 2413 2429 // Position vertically so the curently selected item lines up 2414 2430 // with the combo box. … … 2416 2432 const int offset = listRect.top() - currentItemRect.top(); 2417 2433 listRect.moveTop(above.y() + offset - listRect.top()); 2434 #endif 2418 2435 2419 2436 … … 2422 2439 // important to show as much as possible of the popup. 2423 2440 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 2424 2445 listRect.setHeight(height); 2446 #endif 2447 2425 2448 if (boundToScreen) { 2426 2449 if (listRect.top() < screen.top()) … … 2429 2452 listRect.moveBottom(screen.bottom()); 2430 2453 } 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 2431 2471 } else if (!boundToScreen || listRect.height() <= belowHeight) { 2432 2472 listRect.moveTopLeft(below); … … 2637 2677 d->updateLineEditGeometry(); 2638 2678 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 2639 2712 // ### need to update scrollers etc. as well here 2640 2713 break;
Note:
See TracChangeset
for help on using the changeset viewer.