diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2019-10-09 23:29:28 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2019-10-11 09:07:09 +0000 |
commit | 734b9097c7d40161b5a19bded7e22418bb7afcb7 (patch) | |
tree | 2d2ad05cd890555c8460295cc8d8f286e3e04fe5 | |
parent | 28e4ed61af30c5ac1e776185c8e28d25a4145aee (diff) |
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 <tobias.hunger@qt.io>
-rw-r--r-- | src/libs/utils/fancylineedit.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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) { |