From 92c8c282f5f3b9edfc93fe90f8c3fd2e934aef8d Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Mon, 4 Feb 2019 02:04:38 +0100 Subject: [PATCH] logic: Fixed qualifier locations not used in reference navigation and only highlighted on hovering --- src/lib/data/storage/PersistentStorage.cpp | 4 ++-- src/lib_gui/qt/element/QtCodeField.cpp | 15 +++++++++++++++ src/lib_gui/qt/element/QtCodeNavigator.cpp | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/lib/data/storage/PersistentStorage.cpp b/src/lib/data/storage/PersistentStorage.cpp index 6e7e33b8..877f7bf8 100644 --- a/src/lib/data/storage/PersistentStorage.cpp +++ b/src/lib/data/storage/PersistentStorage.cpp @@ -1365,7 +1365,7 @@ std::shared_ptr PersistentStorage::getSourceLocationsF for (const StorageSourceLocation& sourceLocation: m_sqliteIndexStorage.getAllByIds(locationIds)) { const LocationType type = intToLocationType(sourceLocation.type); - if (type != LOCATION_TOKEN && type != LOCATION_SCOPE && type != LOCATION_QUALIFIER && type != LOCATION_LOCAL_SYMBOL) + if (type != LOCATION_TOKEN && type != LOCATION_SCOPE && type != LOCATION_LOCAL_SYMBOL) { continue; } @@ -1429,7 +1429,7 @@ std::shared_ptr PersistentStorage::getSourceLocationsF } const LocationType type = intToLocationType(location.type); - if (type != LOCATION_TOKEN && type != LOCATION_SCOPE && type != LOCATION_QUALIFIER && type != LOCATION_LOCAL_SYMBOL) + if (type != LOCATION_TOKEN && type != LOCATION_SCOPE && type != LOCATION_LOCAL_SYMBOL) { continue; } diff --git a/src/lib_gui/qt/element/QtCodeField.cpp b/src/lib_gui/qt/element/QtCodeField.cpp index 97d19739..3c298a9b 100644 --- a/src/lib_gui/qt/element/QtCodeField.cpp +++ b/src/lib_gui/qt/element/QtCodeField.cpp @@ -337,7 +337,22 @@ bool QtCodeField::annotateText( if (annotation.locationType == LOCATION_QUALIFIER) { + // never show qualifier locations active annotation.isActive = false; + + // only show qualifiers focused when mouse over + if (annotation.isFocused) + { + bool isHovered = false; + for (const Annotation* a : m_hoveredAnnotations) + { + if (&annotation == a) + { + isHovered = true; + } + } + annotation.isFocused = isHovered; + } } if (wasFocused != annotation.isFocused || wasActive != annotation.isActive) diff --git a/src/lib_gui/qt/element/QtCodeNavigator.cpp b/src/lib_gui/qt/element/QtCodeNavigator.cpp index e57818e5..0a335243 100644 --- a/src/lib_gui/qt/element/QtCodeNavigator.cpp +++ b/src/lib_gui/qt/element/QtCodeNavigator.cpp @@ -230,7 +230,8 @@ void QtCodeNavigator::addFile(std::shared_ptr locationFile, locationFile->forEachStartSourceLocation( [&](SourceLocation* location) { - if (location->isScopeLocation() || location->getType() == LOCATION_SIGNATURE || location->getType() == LOCATION_COMMENT) + if (location->isScopeLocation() || location->getType() == LOCATION_SIGNATURE || + location->getType() == LOCATION_COMMENT || location->getType() == LOCATION_QUALIFIER) { return; }