Add 'Lock' checkbox right after 'mSearchBox' (and before 'Regex' checkbox) in 'SearchListView' class. At interface point of view, it's just a simple checkbox, which locks search textbox if checked. So, the main apply of this option is lay down at implementation POV. At that time it's used only in 'SymbolView' UI, for purpose - now you can search for, for exmaple, 'Nt' functions in one module, check 'Lock' checkbox, and then go through another modules without tedious retyping of the same search query again and again. Simple, but useful. (#1003)
This commit is contained in:
parent
ff2baa5a03
commit
d8328965fd
|
@ -5,16 +5,16 @@
|
||||||
#include "SearchListView.h"
|
#include "SearchListView.h"
|
||||||
#include "FlickerThread.h"
|
#include "FlickerThread.h"
|
||||||
|
|
||||||
SearchListView::SearchListView(bool EnableRegex, QWidget* parent) : QWidget(parent)
|
SearchListView::SearchListView(bool EnableRegex, QWidget* parent, bool EnableLock) : QWidget(parent)
|
||||||
{
|
{
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
||||||
// Create the main button/bar view with QSplitter
|
// Create the main button/bar view with QSplitter
|
||||||
//
|
//
|
||||||
// |- Splitter ----------------------------|
|
// |- Splitter --------------------------------------------|
|
||||||
// | LISTVIEW |
|
// | LISTVIEW |
|
||||||
// | SEARCH: | SEARCH BOX | REGEX CHECKBOX |
|
// | SEARCH: | SEARCH BOX | LOCK CHECKBOX | REGEX CHECKBOX |
|
||||||
// |---------------------------------------|
|
// |-------------------------------------------------------|
|
||||||
QSplitter* barSplitter = new QSplitter(Qt::Vertical);
|
QSplitter* barSplitter = new QSplitter(Qt::Vertical);
|
||||||
{
|
{
|
||||||
// Create list layout (contains both ListViews)
|
// Create list layout (contains both ListViews)
|
||||||
|
@ -47,15 +47,22 @@ SearchListView::SearchListView(bool EnableRegex, QWidget* parent) : QWidget(pare
|
||||||
// Regex parsing checkbox
|
// Regex parsing checkbox
|
||||||
mRegexCheckbox = new QCheckBox(tr("Regex"));
|
mRegexCheckbox = new QCheckBox(tr("Regex"));
|
||||||
|
|
||||||
|
// Lock checkbox
|
||||||
|
mLockCheckbox = new QCheckBox(tr("Lock"));
|
||||||
|
|
||||||
if(!EnableRegex)
|
if(!EnableRegex)
|
||||||
mRegexCheckbox->hide();
|
mRegexCheckbox->hide();
|
||||||
|
|
||||||
|
if(!EnableLock)
|
||||||
|
mLockCheckbox->hide();
|
||||||
|
|
||||||
// Horizontal layout
|
// Horizontal layout
|
||||||
QHBoxLayout* horzLayout = new QHBoxLayout();
|
QHBoxLayout* horzLayout = new QHBoxLayout();
|
||||||
horzLayout->setContentsMargins(4, 0, (EnableRegex) ? 0 : 4, 0);
|
horzLayout->setContentsMargins(4, 0, (EnableRegex || EnableLock) ? 0 : 4, 0);
|
||||||
horzLayout->setSpacing(2);
|
horzLayout->setSpacing(2);
|
||||||
horzLayout->addWidget(new QLabel(tr("Search: ")));
|
horzLayout->addWidget(new QLabel(tr("Search: ")));
|
||||||
horzLayout->addWidget(mSearchBox);
|
horzLayout->addWidget(mSearchBox);
|
||||||
|
horzLayout->addWidget(mLockCheckbox);
|
||||||
horzLayout->addWidget(mRegexCheckbox);
|
horzLayout->addWidget(mRegexCheckbox);
|
||||||
|
|
||||||
// Add searchbar placeholder
|
// Add searchbar placeholder
|
||||||
|
@ -98,6 +105,7 @@ SearchListView::SearchListView(bool EnableRegex, QWidget* parent) : QWidget(pare
|
||||||
connect(mSearchList, SIGNAL(doubleClickedSignal()), this, SLOT(doubleClickedSlot()));
|
connect(mSearchList, SIGNAL(doubleClickedSignal()), this, SLOT(doubleClickedSlot()));
|
||||||
connect(mSearchBox, SIGNAL(textChanged(QString)), this, SLOT(searchTextChanged(QString)));
|
connect(mSearchBox, SIGNAL(textChanged(QString)), this, SLOT(searchTextChanged(QString)));
|
||||||
connect(mRegexCheckbox, SIGNAL(toggled(bool)), this, SLOT(on_checkBoxRegex_toggled(bool)));
|
connect(mRegexCheckbox, SIGNAL(toggled(bool)), this, SLOT(on_checkBoxRegex_toggled(bool)));
|
||||||
|
connect(mLockCheckbox, SIGNAL(toggled(bool)), this, SLOT(on_checkBoxLock_toggled(bool)));
|
||||||
|
|
||||||
// List input should always be forwarded to the filter edit
|
// List input should always be forwarded to the filter edit
|
||||||
mSearchList->setFocusProxy(mSearchBox);
|
mSearchList->setFocusProxy(mSearchBox);
|
||||||
|
@ -225,6 +233,16 @@ void SearchListView::on_checkBoxRegex_toggled(bool checked)
|
||||||
refreshSearchList();
|
refreshSearchList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchListView::on_checkBoxLock_toggled(bool checked)
|
||||||
|
{
|
||||||
|
mSearchBox->setDisabled(checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SearchListView::isSearchBoxLocked()
|
||||||
|
{
|
||||||
|
return mLockCheckbox->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
bool SearchListView::eventFilter(QObject* obj, QEvent* event)
|
bool SearchListView::eventFilter(QObject* obj, QEvent* event)
|
||||||
{
|
{
|
||||||
// Keyboard button press being sent to the QLineEdit
|
// Keyboard button press being sent to the QLineEdit
|
||||||
|
|
|
@ -16,7 +16,7 @@ class SearchListView : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SearchListView(bool EnableRegex = true, QWidget* parent = 0);
|
explicit SearchListView(bool EnableRegex = true, QWidget* parent = 0, bool EnableLock = false);
|
||||||
~SearchListView();
|
~SearchListView();
|
||||||
|
|
||||||
SearchListViewTable* mList;
|
SearchListViewTable* mList;
|
||||||
|
@ -28,12 +28,15 @@ public:
|
||||||
bool findTextInList(SearchListViewTable* list, QString text, int row, int startcol, bool startswith);
|
bool findTextInList(SearchListViewTable* list, QString text, int row, int startcol, bool startswith);
|
||||||
void refreshSearchList();
|
void refreshSearchList();
|
||||||
|
|
||||||
|
bool isSearchBoxLocked();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void searchTextChanged(const QString & arg1);
|
void searchTextChanged(const QString & arg1);
|
||||||
void listContextMenu(const QPoint & pos);
|
void listContextMenu(const QPoint & pos);
|
||||||
void doubleClickedSlot();
|
void doubleClickedSlot();
|
||||||
void searchSlot();
|
void searchSlot();
|
||||||
void on_checkBoxRegex_toggled(bool checked);
|
void on_checkBoxRegex_toggled(bool checked);
|
||||||
|
void on_checkBoxLock_toggled(bool checked);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void enterPressedSignal();
|
void enterPressedSignal();
|
||||||
|
@ -45,6 +48,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QCheckBox* mRegexCheckbox;
|
QCheckBox* mRegexCheckbox;
|
||||||
|
QCheckBox* mLockCheckbox;
|
||||||
QAction* mSearchAction;
|
QAction* mSearchAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ SymbolView::SymbolView(QWidget* parent) : QWidget(parent), ui(new Ui::SymbolView
|
||||||
setLayout(mMainLayout);
|
setLayout(mMainLayout);
|
||||||
|
|
||||||
// Create reference view
|
// Create reference view
|
||||||
mSearchListView = new SearchListView();
|
mSearchListView = new SearchListView(true, 0, true);
|
||||||
mSearchListView->mSearchStartCol = 1;
|
mSearchListView->mSearchStartCol = 1;
|
||||||
|
|
||||||
// Create module list
|
// Create module list
|
||||||
|
@ -245,7 +245,10 @@ void SymbolView::moduleSelectionChanged(int index)
|
||||||
mSearchListView->mList->reloadData();
|
mSearchListView->mList->reloadData();
|
||||||
mSearchListView->mList->setSingleSelection(0);
|
mSearchListView->mList->setSingleSelection(0);
|
||||||
mSearchListView->mList->setTableOffset(0);
|
mSearchListView->mList->setTableOffset(0);
|
||||||
mSearchListView->mSearchBox->setText("");
|
if(!mSearchListView->isSearchBoxLocked())
|
||||||
|
mSearchListView->mSearchBox->setText("");
|
||||||
|
else
|
||||||
|
mSearchListView->refreshSearchList();
|
||||||
|
|
||||||
setUpdatesEnabled(true);
|
setUpdatesEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue