diff options
Diffstat (limited to 'src/widgets/widgets/qcombobox.cpp')
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 483cfd8c55..90d55f9688 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -691,7 +691,7 @@ void QComboBoxPrivateContainer::changeEvent(QEvent *e) setFrameStyle(combo->style()->styleHint(QStyle::SH_ComboBox_PopupFrameStyle, &opt, combo)); } - QWidget::changeEvent(e); + QFrame::changeEvent(e); } @@ -1355,7 +1355,13 @@ void QComboBoxPrivate::emitActivated(const QModelIndex &index) return; QString text(itemText(index)); emit q->activated(index.row()); + emit q->textActivated(text); +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED emit q->activated(text); +QT_WARNING_POP +#endif } void QComboBoxPrivate::_q_emitHighlighted(const QModelIndex &index) @@ -1365,7 +1371,13 @@ void QComboBoxPrivate::_q_emitHighlighted(const QModelIndex &index) return; QString text(itemText(index)); emit q->highlighted(index.row()); + emit q->textHighlighted(text); +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED emit q->highlighted(text); +QT_WARNING_POP +#endif } void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index) @@ -1864,12 +1876,11 @@ void QComboBox::setLineEdit(QLineEdit *edit) d->updateFocusPolicy(); d->lineEdit->setFocusProxy(this); d->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false); +#if QT_DEPRECATED_SINCE(5, 13) #if QT_CONFIG(completer) setAutoCompletion(d->autoCompletion); -#endif #ifdef QT_KEYPAD_NAVIGATION -#if QT_CONFIG(completer) if (QApplication::keypadNavigationEnabled()) { // Editable combo boxes will have a completer that is set to UnfilteredPopupCompletion. // This means that when the user enters edit mode they are immediately presented with a @@ -1882,6 +1893,7 @@ void QComboBox::setLineEdit(QLineEdit *edit) } #endif #endif +#endif setAttribute(Qt::WA_InputMethodEnabled); d->updateLayoutDirection(); @@ -2601,7 +2613,7 @@ bool QComboBoxPrivate::showNativePopup() // We need to fake one here to un-press the button. QMouseEvent mouseReleased(QEvent::MouseButtonRelease, q->pos(), Qt::LeftButton, Qt::MouseButtons(Qt::LeftButton), Qt::KeyboardModifiers()); - qApp->sendEvent(q, &mouseReleased); + QCoreApplication::sendEvent(q, &mouseReleased); #endif return true; @@ -2821,19 +2833,15 @@ void QComboBox::showPopup() bool startTimer = !container->isVisible(); container->raise(); container->create(); - QWindow *containerWindow = container->window()->windowHandle(); - if (containerWindow) { - QWindow *win = window()->windowHandle(); - if (win) { - QScreen *currentScreen = win->screen(); - if (currentScreen && !currentScreen->virtualSiblings().contains(containerWindow->screen())) { - containerWindow->setScreen(currentScreen); - - // This seems to workaround an issue in xcb+multi GPU+multiscreen - // environment where the window might not always show up when screen - // is changed. - container->hide(); - } + if (QWindow *containerWindow = qt_widget_private(container)->windowHandle(QWidgetPrivate::WindowHandleMode::TopLevel)) { + QScreen *currentScreen = d->associatedScreen(); + if (currentScreen && !currentScreen->virtualSiblings().contains(containerWindow->screen())) { + containerWindow->setScreen(currentScreen); + + // This seems to workaround an issue in xcb+multi GPU+multiscreen + // environment where the window might not always show up when screen + // is changed. + container->hide(); } } container->show(); @@ -2902,7 +2910,7 @@ void QComboBox::hidePopup() bool didFade = false; if (needFade) { #if defined(Q_OS_MAC) - QPlatformNativeInterface *platformNativeInterface = qApp->platformNativeInterface(); + QPlatformNativeInterface *platformNativeInterface = QGuiApplication::platformNativeInterface(); int at = platformNativeInterface->metaObject()->indexOfMethod("fadeWindow()"); if (at != -1) { QMetaMethod windowFade = platformNativeInterface->metaObject()->method(at); |