diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-10-26 13:40:36 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-10-27 06:26:01 (GMT) |
commit | cb3a2633bb9d8a0e949c403d0f0631caef254599 (patch) | |
tree | d43172019aac733598c69b107457a433a9ad55d7 | |
parent | e4ea97959e1fbbc99e80023a6c3229ba0a1d7c8b (diff) | |
download | Qt-cb3a2633bb9d8a0e949c403d0f0631caef254599.zip Qt-cb3a2633bb9d8a0e949c403d0f0631caef254599.tar.gz Qt-cb3a2633bb9d8a0e949c403d0f0631caef254599.tar.bz2 |
Fixed select softkey for comboboxes (QTBUG-4702).
The created keyed actions are passed to wrong widget if this pointer
is passed insted of itemView. Also create softkey actions in
setItemView method instead of constructor in order that custom items
views are also working correctly.
Task-number:: QTBUG-4702
AutoTest: All QComboBox tests passed
Reviewed-by: Jason Barron
-rw-r--r-- | src/gui/widgets/qcombobox.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 0e888d6..4f2e91b 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -402,13 +402,6 @@ QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView layout->setSpacing(0); layout->setMargin(0); -#ifdef QT_SOFTKEYS_ENABLED - selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, this); - cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, this); - addAction(selectAction); - addAction(cancelAction); -#endif - // set item view setItemView(itemView); @@ -572,6 +565,13 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView) this, SLOT(setCurrentIndex(QModelIndex))); connect(view, SIGNAL(destroyed()), this, SLOT(viewDestroyed())); + +#ifdef QT_SOFTKEYS_ENABLED + selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, itemView); + cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, itemView); + addAction(selectAction); + addAction(cancelAction); +#endif } /*! @@ -2452,15 +2452,15 @@ void QComboBox::showPopup() #if defined(Q_WS_WIN) && !defined(QT_NO_EFFECTS) bool scrollDown = (listRect.topLeft() == below); - if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo) + if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo) && !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen)) qScrollEffect(container, scrollDown ? QEffects::DownScroll : QEffects::UpScroll, 150); #endif // Don't disable updates on Mac OS X. Windows are displayed immediately on this platform, // which means that the window will be visible before the call to container->show() returns. -// If updates are disabled at this point we'll miss our chance at painting the popup -// menu before it's shown, causing flicker since the window then displays the standard gray +// If updates are disabled at this point we'll miss our chance at painting the popup +// menu before it's shown, causing flicker since the window then displays the standard gray // background. #ifndef Q_WS_MAC container->setUpdatesEnabled(false); |