From 80716610c5f4deb32af15f1189363bf2ebffa41e Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 23 Jul 2019 13:44:11 +0200 Subject: [PATCH] ProjectExplorer: Add tool tip to ExecutableAspect Because our project mode uses a fixed width for some reason, the file path of an executable often does not fit on its label. Add a tool tip to work around this. Fixes: QTCREATORBUG-18991 Change-Id: I4ab7cd8812ae15bcef95c16a862361e24a28c259 Reviewed-by: hjk --- .../projectexplorer/projectconfigurationaspects.cpp | 11 ++++++++++- .../projectexplorer/projectconfigurationaspects.h | 1 + .../projectexplorer/runconfigurationaspects.cpp | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/projectconfigurationaspects.cpp b/src/plugins/projectexplorer/projectconfigurationaspects.cpp index 3372278780d..792a9ae3c0a 100644 --- a/src/plugins/projectexplorer/projectconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/projectconfigurationaspects.cpp @@ -94,6 +94,7 @@ public: QPixmap m_labelPixmap; Utils::FilePath m_baseFileName; bool m_readOnly = false; + bool m_showToolTipOnLabel = false; }; class BaseIntegerAspectPrivate @@ -176,6 +177,12 @@ void BaseStringAspect::setLabelPixmap(const QPixmap &labelPixmap) d->m_label->setPixmap(labelPixmap); } +void BaseStringAspect::setShowToolTipOnLabel(bool show) +{ + d->m_showToolTipOnLabel = show; + update(); +} + QString BaseStringAspect::labelText() const { return d->m_labelText; @@ -334,8 +341,10 @@ void BaseStringAspect::update() d->m_textEditDisplay->setEnabled(enabled); } - if (d->m_labelDisplay) + if (d->m_labelDisplay) { d->m_labelDisplay->setText(displayedString); + d->m_labelDisplay->setToolTip(d->m_showToolTipOnLabel ? displayedString : QString()); + } if (d->m_label) { d->m_label->setText(d->m_labelText); diff --git a/src/plugins/projectexplorer/projectconfigurationaspects.h b/src/plugins/projectexplorer/projectconfigurationaspects.h index 603043ff2c1..b1a4a06c539 100644 --- a/src/plugins/projectexplorer/projectconfigurationaspects.h +++ b/src/plugins/projectexplorer/projectconfigurationaspects.h @@ -109,6 +109,7 @@ public: QString labelText() const; void setLabelText(const QString &labelText); void setLabelPixmap(const QPixmap &labelPixmap); + void setShowToolTipOnLabel(bool show); void setDisplayFilter(const std::function &displayFilter); void setPlaceHolderText(const QString &placeHolderText); diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index 1b41c3246fa..e5a8f54337e 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -470,6 +470,7 @@ void ExecutableAspect::setPlaceHolderText(const QString &placeHolderText) void ExecutableAspect::setExecutable(const FilePath &executable) { m_executable.setValue(executable.toString()); + m_executable.setShowToolTipOnLabel(true); } void ExecutableAspect::setSettingsKey(const QString &key)