diff --git a/src/QmlControls/ParameterEditor.qml b/src/QmlControls/ParameterEditor.qml index 25c00004aba11f4dab52e538ce33e31b6527793a..2159e6435cd0732962d90baa658cf9de1bb08ab3 100644 --- a/src/QmlControls/ParameterEditor.qml +++ b/src/QmlControls/ParameterEditor.qml @@ -32,7 +32,7 @@ QGCView { property Fact _editorDialogFact: Fact { } property int _rowHeight: ScreenTools.defaultFontPixelHeight * 2 property int _rowWidth: 10 // Dynamic adjusted at runtime - property bool _searchFilter: searchText.text != "" ///< true: showing results of search + property bool _searchFilter: searchText.text.trim() != "" ///< true: showing results of search property var _searchResults ///< List of parameter names from search results property bool _showRCToParam: !ScreenTools.isMobile && QGroundControl.multiVehicleManager.activeVehicle.px4Firmware diff --git a/src/QmlControls/ParameterEditorController.cc b/src/QmlControls/ParameterEditorController.cc index 9520b9eb9783753b6169195b1f52ea104132d274..00ca6d27a29e46dfe3a969a472033315ba1f6ccf 100644 --- a/src/QmlControls/ParameterEditorController.cc +++ b/src/QmlControls/ParameterEditorController.cc @@ -158,8 +158,9 @@ void ParameterEditorController::setRCToParam(const QString& paramName) void ParameterEditorController::_updateParameters(void) { QObjectList newParameterList; + QStringList searchItems = _searchText.split(' ', QString::SkipEmptyParts); - if (_searchText.isEmpty()) { + if (searchItems.isEmpty()) { const QMap<int, QMap<QString, QStringList> >& groupMap = _vehicle->parameterManager()->getGroupMap(); foreach (const QString& parameter, groupMap[_currentComponentId][_currentGroup]) { newParameterList.append(_vehicle->parameterManager()->getParameter(_currentComponentId, parameter)); @@ -167,9 +168,17 @@ void ParameterEditorController::_updateParameters(void) } else { foreach(const QString ¶meter, _vehicle->parameterManager()->parameterNames(_vehicle->defaultComponentId())) { Fact* fact = _vehicle->parameterManager()->getParameter(_vehicle->defaultComponentId(), parameter); - if (fact->name().contains(_searchText, Qt::CaseInsensitive) || - fact->shortDescription().contains(_searchText, Qt::CaseInsensitive) || - fact->longDescription().contains(_searchText, Qt::CaseInsensitive)) { + bool matched = true; + + // all of the search items must match in order for the parameter to be added to the list + for (const auto& searchItem : searchItems) { + if (!fact->name().contains(searchItem, Qt::CaseInsensitive) && + !fact->shortDescription().contains(searchItem, Qt::CaseInsensitive) && + !fact->longDescription().contains(searchItem, Qt::CaseInsensitive)) { + matched = false; + } + } + if (matched) { newParameterList.append(fact); } }