[LyX/2.3.x] Fix TOC filtering with slashes (#12359)

Richard Kimberly Heck rikiheck at lyx.org
Wed Nov 23 01:19:10 UTC 2022


commit cfd3abbdb0d76641f12f0704ec1f0a0c17090ac1
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Wed Dec 29 14:43:52 2021 +0100

    Fix TOC filtering with slashes (#12359)
    
    Seems the * wildcard does not match these.
---
 src/frontends/qt4/TocWidget.cpp |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/frontends/qt4/TocWidget.cpp b/src/frontends/qt4/TocWidget.cpp
index 2cf7c35..56f89ad 100644
--- a/src/frontends/qt4/TocWidget.cpp
+++ b/src/frontends/qt4/TocWidget.cpp
@@ -485,8 +485,13 @@ void TocWidget::filterContents()
 
 	QModelIndexList indices = tocTV->model()->match(
 		tocTV->model()->index(0, 0),
-		Qt::DisplayRole, "*", -1,
-		Qt::MatchFlags(Qt::MatchWildcard|Qt::MatchRecursive));
+		Qt::DisplayRole, ".*", -1,
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+		Qt::MatchFlags(Qt::MatchRegularExpression|Qt::MatchRecursive));
+#else
+		// deprecated in Qt 5.15.
+		Qt::MatchFlags(Qt::MatchRegExp|Qt::MatchRecursive));
+#endif
 
 	int size = indices.size();
 	for (int i = 0; i < size; i++) {


More information about the lyx-cvs mailing list