Permalink
Browse files

GUI: RegEx in SearchListView

  • Loading branch information...
mrexodia committed Apr 2, 2015
1 parent 3c13484 commit 7d806c6d598293db9308219704a15c80e92eacc0
@@ -99,8 +99,18 @@ bool SearchListView::findTextInList(SearchListViewTable* list, QString text, int
else
{
for(int i = startcol; i < count; i++)
if(list->getCellContent(row, i).contains(text, Qt::CaseInsensitive))
return true;
{
if(ui->checkBoxRegex->checkState() == Qt::Checked)
{
if(list->getCellContent(row, i).contains(QRegExp(text)))
return true;
}
else
{
if(list->getCellContent(row, i).contains(text, Qt::CaseInsensitive))
return true;
}
}
}
return false;
}
@@ -117,7 +127,8 @@ void SearchListView::searchTextChanged(const QString & arg1)
{
mSearchList->hide();
mList->show();
mList->setFocus();
if(ui->checkBoxRegex->checkState() != Qt::Checked)
mList->setFocus();
mCurList = mList;
}
mSearchList->setRowCount(0);
@@ -150,9 +161,11 @@ void SearchListView::searchTextChanged(const QString & arg1)
break;
}
}
mSearchList->highlightText = arg1;
if(ui->checkBoxRegex->checkState() != Qt::Checked) //do not highlight with regex
mSearchList->highlightText = arg1;
mSearchList->reloadData();
mSearchList->setFocus();
if(ui->checkBoxRegex->checkState() != Qt::Checked)
mSearchList->setFocus();
}
void SearchListView::listContextMenu(const QPoint & pos)
@@ -175,3 +188,9 @@ void SearchListView::doubleClickedSlot()
{
emit enterPressedSignal();
}
void SearchListView::on_checkBoxRegex_toggled(bool checked)
{
Q_UNUSED(checked);
searchTextChanged(ui->searchBox->text());
}
@@ -34,6 +34,7 @@ private slots:
void listKeyPressed(QKeyEvent* event);
void listContextMenu(const QPoint & pos);
void doubleClickedSlot();
void on_checkBoxRegex_toggled(bool checked);
signals:
void enterPressedSignal();
@@ -61,6 +61,13 @@
<item>
<widget class="QLineEdit" name="searchBox"/>
</item>
<item>
<widget class="QCheckBox" name="checkBoxRegex">
<property name="text">
<string>Re&amp;gEx</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

0 comments on commit 7d806c6

Please sign in to comment.