Skip to content

Commit

Permalink
GUI: RegEx in SearchListView
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Apr 2, 2015
1 parent 3c13484 commit 7d806c6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
29 changes: 24 additions & 5 deletions x64_dbg_gui/Project/Src/BasicView/SearchListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down Expand Up @@ -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)
Expand All @@ -175,3 +188,9 @@ void SearchListView::doubleClickedSlot()
{
emit enterPressedSignal();
}

void SearchListView::on_checkBoxRegex_toggled(bool checked)
{
Q_UNUSED(checked);
searchTextChanged(ui->searchBox->text());
}
1 change: 1 addition & 0 deletions x64_dbg_gui/Project/Src/BasicView/SearchListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
7 changes: 7 additions & 0 deletions x64_dbg_gui/Project/Src/BasicView/SearchListView.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 7d806c6

Please sign in to comment.