From 75285b64ada65748f1fee3942a95b46a3f0b9d7e Mon Sep 17 00:00:00 2001 From: Wang Chuan Date: Sun, 26 Jan 2020 14:21:42 +0800 Subject: QComboBox: send font change event to popup menu when font changed The font change in QComboBox might cause incorrect appearance of popup menu since it doesn't notify popup menu to relayout itself Fixes the issue by send font change event to the item view of popup menu when received a font change event in QComboBox Fixes: QTBUG-75846 Change-Id: I4821015cca95a7e233a22262596a6fbf27f10aef Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qcombobox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/widgets/widgets/qcombobox.cpp') diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 9a0e969e1c..fdf1a87bba 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -3045,12 +3045,14 @@ void QComboBox::changeEvent(QEvent *e) d->updateViewContainerPaletteAndOpacity(); break; } - case QEvent::FontChange: + case QEvent::FontChange: { d->sizeHint = QSize(); // invalidate size hint d->viewContainer()->setFont(font()); + d->viewContainer()->itemView()->doItemsLayout(); if (d->lineEdit) d->updateLineEditGeometry(); break; + } default: break; } -- cgit v1.2.3 From 11dc7b35c8c3957bd19087a5e3ae7cfc4f1a3343 Mon Sep 17 00:00:00 2001 From: Vitaly Fanaskov Date: Wed, 5 Feb 2020 10:53:19 +0100 Subject: QComboBox: deprecate currentIndexChanged(const QString&) Task-number: QTBUG-81845 Change-Id: Ia0ff5321423a5d3d4853bd425dd7236926f16047 Reviewed-by: Christian Ehrlicher Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qcombobox.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/widgets/widgets/qcombobox.cpp') diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index bc9d01ac38..8c05c6de7a 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -959,6 +959,8 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const changes either through user interaction or programmatically. The item's \a index is passed or -1 if the combobox becomes empty or the currentIndex was reset. + + \obsolete Use currentIndexChanged(int index, const QString &text) instead */ /*! @@ -968,6 +970,18 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const This signal is sent whenever the currentIndex in the combobox changes either through user interaction or programmatically. The item's \a text is passed. + + \obsolete Use currentIndexChanged(int index, const QString &text) instead +*/ + +/*! + \fn void QComboBox::currentIndexChanged(int index, const QString &text) + \since 5.15 + + This signal is sent whenever the currentIndex in the combobox + changes either through user interaction or programmatically. The + item's \a index is passed or -1 if the combobox becomes empty or + the currentIndex was reset. The item's \a text is also passed. */ /*! @@ -1452,13 +1466,14 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index) { Q_Q(QComboBox); const QString text = itemText(index); - emit q->currentIndexChanged(index.row()); -#if QT_DEPRECATED_SINCE(5, 13) +#if QT_DEPRECATED_SINCE(5, 15) QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED + emit q->currentIndexChanged(index.row()); emit q->currentIndexChanged(text); QT_WARNING_POP #endif + emit q->currentIndexChanged(index.row(), text); // signal lineEdit.textChanged already connected to signal currentTextChanged, so don't emit double here if (!lineEdit) emit q->currentTextChanged(text); -- cgit v1.2.3