Update RingQt - extensions/ringqt/cpp/src/mscompleter.cpp - Better Code!
@@ -19,24 +19,10 @@ MultiSelectCompleter::~MultiSelectCompleter()
{
}
-QString MultiSelectCompleter::pathFromIndex( const QModelIndex& index ) const
-{
- QString path = QCompleter::pathFromIndex( index );
-
- QString text = static_cast<QLineEdit*>( widget() )->text();
-
- char cSplitOperartor = this->getsplitOperator(text) ;
- int pos = text.lastIndexOf( cSplitOperartor );
- if ( pos >= 0 )
- path = text.left( pos ) + cSplitOperartor + ' ' + QCompleter::pathFromIndex( index );
-
- return path;
-}
-
char MultiSelectCompleter::getsplitOperator( const QString& path ) const
{
int nLastPos = 0;
- char cOperators[8] = ",+-*/%(";
+ const char *cOperators = ",+-*/%(<>=&|!^";
char cSplitOperator = ',' ;
for (int t = 0 ; t < strlen(cOperators) ; t++ ) {
@@ -49,6 +35,20 @@ char MultiSelectCompleter::getsplitOperator( const QString& path ) const
return cSplitOperator;
}
+QString MultiSelectCompleter::pathFromIndex( const QModelIndex& index ) const
+{
+ QString path = QCompleter::pathFromIndex( index );
+
+ QString text = static_cast<QLineEdit*>( widget() )->text();
+
+ char cSplitOperartor = this->getsplitOperator(text) ;
+ int pos = text.lastIndexOf( cSplitOperartor );
+ if ( pos >= 0 )
+ path = text.left( pos ) + cSplitOperartor + ' ' + QCompleter::pathFromIndex( index );
+
+ return path;
+}
+
QStringList MultiSelectCompleter::splitPath( const QString& path ) const
{
