ui: Fixed unhovering active error removes active highlight

This commit is contained in:
Eberhard Graether
2018-10-16 23:40:40 +02:00
parent cfdd332a18
commit d78e80b548
2 changed files with 6 additions and 12 deletions
+1 -1
View File
@@ -755,7 +755,7 @@ void QtCodeArea::defocusTokenIds(const std::vector<Id>& tokenIds)
{ {
if (m_navigator->hasErrors() && tokenIds.size() == 1) if (m_navigator->hasErrors() && tokenIds.size() == 1)
{ {
QtCodeField::defocusTokenIds(tokenIds); QtCodeField::defocusTokenIds(utility::toVector(m_navigator->getActiveLocalTokenIds()));
return; return;
} }
+5 -11
View File
@@ -293,14 +293,14 @@ void QtCodeField::mouseReleaseEvent(QMouseEvent* event)
activateAnnotations(annotations); activateAnnotations(annotations);
} }
void QtCodeField::focusTokenIds(const std::vector<Id>& tokenIds) void QtCodeField::focusTokenIds(const std::vector<Id>& focusedTokenIds)
{ {
annotateText(std::set<Id>(), std::set<Id>(), std::set<Id>(tokenIds.begin(), tokenIds.end())); annotateText(std::set<Id>(), std::set<Id>(), std::set<Id>(focusedTokenIds.begin(), focusedTokenIds.end()));
} }
void QtCodeField::defocusTokenIds(const std::vector<Id>& tokenIds) void QtCodeField::defocusTokenIds(const std::vector<Id>& activeTokenIds)
{ {
annotateText(std::set<Id>(), std::set<Id>(), std::set<Id>()); annotateText(std::set<Id>(activeTokenIds.begin(), activeTokenIds.end()), std::set<Id>(), std::set<Id>());
} }
bool QtCodeField::annotateText( bool QtCodeField::annotateText(
@@ -513,13 +513,7 @@ void QtCodeField::setHoveredAnnotations(const std::vector<const Annotation*>& an
{ {
if (m_hoveredAnnotations.size()) if (m_hoveredAnnotations.size())
{ {
std::vector<Id> tokenIds; defocusTokenIds({});
for (const Annotation* annotation : m_hoveredAnnotations)
{
tokenIds.insert(tokenIds.end(), annotation->tokenIds.begin(), annotation->tokenIds.end());
}
defocusTokenIds(tokenIds);
} }
m_hoveredAnnotations = annotations; m_hoveredAnnotations = annotations;