From 6da6a0abe1ccff65e9506000ea3bdda388e016fc Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 4 Dec 2017 12:58:10 +0100 Subject: [PATCH] #2212 AppFwk : Allow '[' and ']' in filter field text --- .../cafUserInterface/cafPdmUiTreeSelectionEditor.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp index 72a630718b..39460272be 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp @@ -453,7 +453,14 @@ void PdmUiTreeSelectionEditor::slotTextFilterChanged() QString searchString = m_textFilterLineEdit->text(); searchString += "*"; - m_proxyModel->setFilterWildcard(searchString); + // Escape the characters '[' and ']' as these have special meaning for a search string + // To be able to search for vector names in brackets, these must be escaped + // See "Wildcard Matching" in Qt documentation + searchString.replace("[", "\\["); + searchString.replace("]", "\\]"); + + QRegExp searcher(searchString, Qt::CaseInsensitive, QRegExp::WildcardUnix); + m_proxyModel->setFilterRegExp(searcher); updateUi(); }