From 631920e25ba1fc6fd0329824dd56496eaf3c2819 Mon Sep 17 00:00:00 2001 From: HerrKermet Date: Mon, 25 Sep 2023 16:59:07 +0200 Subject: [PATCH] Added getter for the searchString from searchoptions_dialog.h Removed Proxy member from searchoptions_dialog Cleanup --- .../include/gui/searchbar/searchoptions_dialog.h | 4 ++-- plugins/gui/src/searchbar/searchbar.cpp | 2 +- .../gui/src/searchbar/searchoptions_dialog.cpp | 16 ++++++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/gui/include/gui/searchbar/searchoptions_dialog.h b/plugins/gui/include/gui/searchbar/searchoptions_dialog.h index 65a3be855f3..94743eea969 100644 --- a/plugins/gui/include/gui/searchbar/searchoptions_dialog.h +++ b/plugins/gui/include/gui/searchbar/searchoptions_dialog.h @@ -47,6 +47,7 @@ namespace hal SearchOptionsDialog(QWidget *parent = nullptr); void emitOptions(); SearchOptions getOptions() const; + QString getText() const; Q_SIGNALS: void emitOptions(QString text, int options); @@ -57,8 +58,7 @@ namespace hal void emitStartSearch(); private: - SearchProxyModel* searchProxy; - QString searchText; + QString mSearchText; QGridLayout* mLayout; QComboBox* mInputBox; diff --git a/plugins/gui/src/searchbar/searchbar.cpp b/plugins/gui/src/searchbar/searchbar.cpp index c99b34d9eef..c6fbbec11dd 100644 --- a/plugins/gui/src/searchbar/searchbar.cpp +++ b/plugins/gui/src/searchbar/searchbar.cpp @@ -285,7 +285,7 @@ namespace hal { mCurrentOptions = sd.getOptions(); - QString txt ; // TODO : get modified text from sd + QString txt = sd.getText(); // TODO : get modified text from sd Q_EMIT triggerNewSearch(txt,mCurrentOptions.toInt()); } } diff --git a/plugins/gui/src/searchbar/searchoptions_dialog.cpp b/plugins/gui/src/searchbar/searchoptions_dialog.cpp index 604c7e7711d..142d98b9bae 100644 --- a/plugins/gui/src/searchbar/searchoptions_dialog.cpp +++ b/plugins/gui/src/searchbar/searchoptions_dialog.cpp @@ -6,7 +6,6 @@ namespace hal SearchOptionsDialog::SearchOptionsDialog(QWidget* parent): QDialog(parent) { setWindowTitle("Search"); - searchProxy = new SearchProxyModel(); //TODO fix layout size to prevent overlapping mLayout = new QGridLayout(this); mLayout->setRowMinimumHeight(0,35); @@ -41,10 +40,10 @@ namespace hal connect(mCloseBtn, &QPushButton::clicked, this, &SearchOptionsDialog::close); - //TODO get corresponding proxy + //TODO add signal logic from searchbutton / enter pressed within mInputBox connect(mInputBox, &QComboBox::currentTextChanged, this, &SearchOptionsDialog::textEdited); connect(mSearchBtn, &QPushButton::clicked, this, &SearchOptionsDialog::emitStartSearch); - connect(this, SIGNAL(emitOptions(QString, int)), searchProxy, SLOT(startSearch(QString, int))); + //connect(this, SIGNAL(emitOptions(QString, int)), searchProxy, SLOT(startSearch(QString, int))); connect(mIncrementalSearchBox, &QCheckBox::stateChanged, this, &SearchOptionsDialog::optionsChanged); connect(mExactMatchBox, &QCheckBox::stateChanged, this, &SearchOptionsDialog::optionsChanged); @@ -73,11 +72,11 @@ namespace hal } void SearchOptionsDialog::emitOptions(){ - searchText = mInputBox->currentText(); + mSearchText = mInputBox->currentText(); int options = SearchOptions::toInt(mExactMatchBox->isChecked(), mCaseSensitiveBox->isChecked(), mRegExBox->isChecked(), {}); - qInfo() << "Emit search with string: " << searchText << " and options: " << options; + qInfo() << "Emit search with string: " << mSearchText << " and options: " << options; - Q_EMIT emitOptions(searchText, options); + Q_EMIT emitOptions(mSearchText, options); } SearchOptions SearchOptionsDialog::getOptions() const @@ -87,4 +86,9 @@ namespace hal return retval; } + QString SearchOptionsDialog::getText() const + { + return mSearchText; + } + }