From 8262b5533d7295b37355484f9a7fa96b7db76dee Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 18 Mar 2008 08:15:24 +0000 Subject: [PATCH] IPAL19251 fixed --- src/Qtx/QtxSearchTool.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Qtx/QtxSearchTool.cxx b/src/Qtx/QtxSearchTool.cxx index b825d0338..db08a54be 100644 --- a/src/Qtx/QtxSearchTool.cxx +++ b/src/Qtx/QtxSearchTool.cxx @@ -1306,16 +1306,27 @@ bool QtxTreeViewSearcher::findLast( const QString& text, QtxSearchTool* st ) */ QModelIndexList QtxTreeViewSearcher::findItems( const QString& text, QtxSearchTool* st ) { + QString s = text; + Qt::MatchFlags fl = Qt::MatchRecursive; if ( st->isCaseSensitive() ) fl = fl | Qt::MatchCaseSensitive; - fl = fl | ( st->isRegExpSearch() ? Qt::MatchRegExp : Qt::MatchContains ); + if ( st->isRegExpSearch() ) { + fl = fl | Qt::MatchRegExp; + if ( !s.startsWith( "^" ) && !s.startsWith( ".*" ) ) + s.prepend( ".*" ); + if ( !s.endsWith( "$" ) && !s.endsWith( ".*" ) ) + s.append( ".*" ); + } + else { + fl = fl | Qt::MatchContains; + } if ( myView->model() ) return myView->model()->match( myView->model()->index( 0, myColumn ), Qt::DisplayRole, - text, -1, fl ); + s, -1, fl ); return QModelIndexList(); } -- 2.39.2