From: vsr Date: Tue, 18 Mar 2008 08:15:24 +0000 (+0000) Subject: IPAL19251 fixed X-Git-Tag: V5_0_0a1~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8262b5533d7295b37355484f9a7fa96b7db76dee;p=modules%2Fgui.git IPAL19251 fixed --- 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(); }