Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release-3_0] Search bar's filters list improvement #4763

Merged
merged 2 commits into from Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/locator/activelayerfeatureslocatorfilter.cpp
Expand Up @@ -416,7 +416,7 @@ void ActiveLayerFeaturesLocatorFilter::triggerResultFromAction( const QgsLocator
}
else if ( !r.isEmpty() )
{
r.scale( 5 );
r.scale( 1.25 );
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/locator/featureslocatorfilter.cpp
Expand Up @@ -228,7 +228,7 @@ void FeaturesLocatorFilter::triggerResultFromAction( const QgsLocatorResult &res
}
else if ( !r.isEmpty() )
{
r.scale( 5 );
r.scale( 1.25 );
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/core/projectinfo.cpp
Expand Up @@ -310,6 +310,8 @@ void ProjectInfo::setActiveLayer( QgsMapLayer *layer )
mSettings.beginGroup( QStringLiteral( "/qgis/projectInfo/%1" ).arg( mFilePath ) );
mSettings.setValue( QStringLiteral( "activeLayer" ), layer->id() );
mSettings.endGroup();

emit activeLayerChanged();
}

QgsMapLayer *ProjectInfo::activeLayer() const
Expand Down
14 changes: 9 additions & 5 deletions src/qml/LocatorItem.qml
Expand Up @@ -275,7 +275,7 @@ Item {
anchors.topMargin: 24
model: searchField.displayText !== '' ? locator.proxyModel() : locatorFilters
width: parent.width
height: resultsList.count > 0 ? Math.min( childrenRect.height, mainWindow.height / 2 - searchFieldRect.height - 10 ) : 0
height: resultsList.count > 0 ? Math.min( contentHeight, mainWindow.height / 2 - searchFieldRect.height - 10 ) : 0
clip: true

delegate: searchField.displayText !== '' ? resultsComponent : filtersComponent
Expand All @@ -288,10 +288,10 @@ Item {
id: delegateRect

anchors.margins: 10
height: textArea.childrenRect.height + textArea.topPadding + textArea.bottomPadding
width: resultsList.width
height: textArea.childrenRect.height + textArea.topPadding + textArea.bottomPadding
color: "transparent"
opacity: 0.95
opacity: (Prefix === 'f' && dashBoard.activeLayer == undefined) ? 0.35 : 0.95

Ripple {
clip: true
Expand All @@ -316,7 +316,7 @@ Item {
id: nameCell
anchors.left: parent.left
anchors.right: parent.right
text: Name + ' (' + Prefix + ')'
text: Name + ' (' + Prefix + ')' + (Prefix === 'f' && dashBoard.activeLayer ? '' + dashBoard.activeLayer.name : '')
leftPadding: 5
font.bold: false
font.pointSize: Theme.resultFont.pointSize
Expand Down Expand Up @@ -352,7 +352,11 @@ Item {
anchors.fill: parent

onClicked: {
searchField.text = Prefix + ' ';
if (Prefix === 'f' && dashBoard.activeLayer == undefined) {
displayToast(qsTr('Activate a vector layer in the legend first to use this functionality'), 'warning')
} else {
searchField.text = Prefix + ' '
}
}
}
}
Expand Down