Skip to content

Commit

Permalink
Merge pull request #60762 from qgis/backport-60689-to-release-3_42
Browse files Browse the repository at this point in the history
[Backport release-3_42] improve locator titles and groups visibility
  • Loading branch information
alexbruy authored Feb 26, 2025
2 parents 1f5debe + 117737a commit 9d6b3b4
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/core/locator/qgslocatormodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
***************************************************************************/

#include <QFont>
#include <QPalette>

#include "qgslocatormodel.h"
#include "moc_qgslocatormodel.cpp"
Expand Down Expand Up @@ -115,17 +116,31 @@ 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.setBold( entry.type == EntryType::Filter );
font.setItalic( entry.type == EntryType::Group );
return font;
}
else
{
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<Column>( index.column() ) )
Expand Down

0 comments on commit 9d6b3b4

Please sign in to comment.