]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
IPAL19251 fixed
authorvsr <vsr@opencascade.com>
Tue, 18 Mar 2008 08:15:24 +0000 (08:15 +0000)
committervsr <vsr@opencascade.com>
Tue, 18 Mar 2008 08:15:24 +0000 (08:15 +0000)
src/Qtx/QtxSearchTool.cxx

index b825d0338e327752a739ccf4e6079e67aed11dba..db08a54be690b68a61b843270a107cbd131a9407 100644 (file)
@@ -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();
 }