diff --git a/src/ExtendedTableWidget.cpp b/src/ExtendedTableWidget.cpp index 21698afb..b3d3eb3d 100644 --- a/src/ExtendedTableWidget.cpp +++ b/src/ExtendedTableWidget.cpp @@ -612,6 +612,11 @@ void ExtendedTableWidget::useAsFilter(const QString& filterOperator, bool binary else value = data.toString(); + // When Containing filter is requested (empty operator) and the value starts with + // an operator character, the character is escaped. + if (filterOperator.isEmpty()) + value.replace(QRegExp("^(<|>|=)"), Settings::getValue("databrowser", "filter_escape").toString() + QString("\\1")); + // If binary operator, the cell data is used as first value and // the second value must be added by the user. if (binary) diff --git a/src/sqlitetablemodel.cpp b/src/sqlitetablemodel.cpp index 483a12df..842030dc 100644 --- a/src/sqlitetablemodel.cpp +++ b/src/sqlitetablemodel.cpp @@ -739,24 +739,14 @@ void SqliteTableModel::updateFilter(int column, const QString& value) numeric = true; val = "''"; } else { - bool ok; - value.mid(2).toFloat(&ok); - if(ok) - { - op = value.left(2); - val = value.mid(2); - numeric = true; - } + value.mid(2).toFloat(&numeric); + op = value.left(2); + val = value.mid(2); } } else if(value.left(1) == ">" || value.left(1) == "<") { - bool ok; - value.mid(1).toFloat(&ok); - if(ok) - { - op = value.left(1); - val = value.mid(1); - numeric = true; - } + value.mid(1).toFloat(&numeric); + op = value.left(1); + val = value.mid(1); } else if(value.left(1) == "=") { val = value.mid(1);