diff --git a/src/plugins/qmldesigner/components/componentcore/zoomaction.cpp b/src/plugins/qmldesigner/components/componentcore/zoomaction.cpp index 11fcad983ff..9a1529414a9 100644 --- a/src/plugins/qmldesigner/components/componentcore/zoomaction.cpp +++ b/src/plugins/qmldesigner/components/componentcore/zoomaction.cpp @@ -99,13 +99,24 @@ QWidget *ZoomAction::createWidget(QWidget *parent) } comboBox->setCurrentIndex(m_currentComboBoxIndex); + comboBox->setToolTip(comboBox->currentText()); connect(this, &ZoomAction::reseted, comboBox, [this, comboBox]() { blockSignals(true); comboBox->setCurrentIndex(m_currentComboBoxIndex); blockSignals(false); }); connect(comboBox, static_cast(&QComboBox::currentIndexChanged), - this, &ZoomAction::emitZoomLevelChanged); + [this, comboBox](int index) { + m_currentComboBoxIndex = index; + + if (index == -1) + return; + + const QModelIndex modelIndex(m_comboBoxModel.data()->index(index, 0)); + setZoomLevel(m_comboBoxModel.data()->data(modelIndex, Qt::UserRole).toFloat()); + comboBox->setToolTip(modelIndex.data().toString()); + }); + connect(this, &ZoomAction::indexChanged, comboBox, &QComboBox::setCurrentIndex); comboBox->setProperty("hideborder", true); @@ -113,15 +124,4 @@ QWidget *ZoomAction::createWidget(QWidget *parent) return comboBox; } -void ZoomAction::emitZoomLevelChanged(int index) -{ - m_currentComboBoxIndex = index; - - if (index == -1) - return; - - const QModelIndex modelIndex(m_comboBoxModel.data()->index(index, 0)); - setZoomLevel(m_comboBoxModel.data()->data(modelIndex, Qt::UserRole).toFloat()); -} - } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/componentcore/zoomaction.h b/src/plugins/qmldesigner/components/componentcore/zoomaction.h index 2bf02191240..e93298d137a 100644 --- a/src/plugins/qmldesigner/components/componentcore/zoomaction.h +++ b/src/plugins/qmldesigner/components/componentcore/zoomaction.h @@ -56,9 +56,6 @@ signals: void indexChanged(int); void reseted(); -private: - void emitZoomLevelChanged(int index); - private: QPointer m_comboBoxModel; float m_zoomLevel;