From 734b9097c7d40161b5a19bded7e22418bb7afcb7 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 9 Oct 2019 23:29:28 +0300 Subject: FancyLineEdit: Do not set empty tooltip for no reason If the tooltip was previously set, it is overridden on validate() even if there's no reason to change it (e.g. there is no QValidator nor a validation function). Change-Id: I854f2cd4b1a8b52c8fc1ae579876aec8d10c0b8a Reviewed-by: Tobias Hunger --- src/libs/utils/fancylineedit.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp index d67c336544..0f96122a94 100644 --- a/src/libs/utils/fancylineedit.cpp +++ b/src/libs/utils/fancylineedit.cpp @@ -129,6 +129,7 @@ public: bool m_isFiltering = false; bool m_firstChange = true; + bool m_toolTipSet = false; QString m_lastFilterText; @@ -520,7 +521,10 @@ void FancyLineEdit::validate() const bool validates = d->m_validationFunction(this, &d->m_errorMessage); const State newState = isDisplayingPlaceholderText ? DisplayingPlaceholderText : (validates ? Valid : Invalid); - setToolTip(d->m_errorMessage); + if (!validates || d->m_toolTipSet) { + setToolTip(d->m_errorMessage); + d->m_toolTipSet = true; + } // Changed..figure out if valid changed. DisplayingPlaceholderText is not valid, // but should not show error color. Also trigger on the first change. if (newState != d->m_state || d->m_firstChange) { -- cgit v1.2.3