From 2724f3074749b7f5ea180578ffc0e1107af1f99a Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Thu, 20 Feb 2025 16:29:22 +0100 Subject: [PATCH 1/2] improve locator titles and groups visibility --- src/core/locator/qgslocatormodel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/locator/qgslocatormodel.cpp b/src/core/locator/qgslocatormodel.cpp index a77a8fea01b3..d110b76d2260 100644 --- a/src/core/locator/qgslocatormodel.cpp +++ b/src/core/locator/qgslocatormodel.cpp @@ -115,10 +115,11 @@ QVariant QgsLocatorModel::data( const QModelIndex &index, int role ) const } case Qt::FontRole: - if ( index.column() == Name && !entry.groupTitle.isEmpty() ) + if ( index.column() == Name ) { QFont font; - font.setItalic( true ); + font.setItalic( entry.type == EntryType::Group ); + font.setBold( entry.type != EntryType::Result ); return font; } else From 117737a45921e86c34e20266a5193e6e3b67893e Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Fri, 21 Feb 2025 09:31:14 +0100 Subject: [PATCH 2/2] Update qgslocatormodel.cpp --- src/core/locator/qgslocatormodel.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/core/locator/qgslocatormodel.cpp b/src/core/locator/qgslocatormodel.cpp index d110b76d2260..688a5b165266 100644 --- a/src/core/locator/qgslocatormodel.cpp +++ b/src/core/locator/qgslocatormodel.cpp @@ -16,6 +16,7 @@ ***************************************************************************/ #include +#include #include "qgslocatormodel.h" #include "moc_qgslocatormodel.cpp" @@ -115,11 +116,12 @@ QVariant QgsLocatorModel::data( const QModelIndex &index, int role ) const } case Qt::FontRole: + { if ( index.column() == Name ) { QFont font; + font.setBold( entry.type == EntryType::Filter ); font.setItalic( entry.type == EntryType::Group ); - font.setBold( entry.type != EntryType::Result ); return font; } else @@ -127,6 +129,18 @@ QVariant QgsLocatorModel::data( const QModelIndex &index, int role ) const return QVariant(); } break; + } + + case Qt::BackgroundRole: + { + return entry.type == EntryType::Result ? QPalette().base() : QPalette().alternateBase(); + } + + case Qt::ForegroundRole: + { + return QPalette().text(); + } + case Qt::DecorationRole: switch ( static_cast( index.column() ) )