From 68371f55599957fcc90497038a2b4ca78b19f2ce Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 4 Oct 2024 17:00:12 +0200 Subject: [PATCH] ProjectExplorer: Show tooltip for current item in kit aspect comboboxes Change-Id: I756cf2ec7057fd5d6f287372b6c8b41b9d419666 Reviewed-by: hjk --- src/plugins/projectexplorer/kitmanager.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index 89680adeed5..899acddae5e 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -813,11 +813,18 @@ void KitAspect::setListAspectSpec(ListAspectSpec &&listAspectSpec) m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy()); m_comboBox->setEnabled(true); m_comboBox->setModel(m_listAspectSpec->model); - m_comboBox->setToolTip(factory()->description()); // FIXME: We want the tooltip for the current item + refresh(); - connect(m_comboBox, &QComboBox::currentIndexChanged, this, [this] { + + const auto updateTooltip = [this] { + m_comboBox->setToolTip( + m_comboBox->itemData(m_comboBox->currentIndex(), Qt::ToolTipRole).toString()); + }; + updateTooltip(); + connect(m_comboBox, &QComboBox::currentIndexChanged, this, [this, updateTooltip] { if (m_ignoreChanges.isLocked()) return; + updateTooltip(); m_listAspectSpec->setter( *kit(), m_comboBox->itemData(m_comboBox->currentIndex(), m_listAspectSpec->itemRole)); });