From a26a6b33895ae772ac09160603df7a66cefc2748 Mon Sep 17 00:00:00 2001 From: tarapn79 Date: Mon, 18 Sep 2023 11:37:24 +0200 Subject: [PATCH] added SearchOptionsDialog class as a pop-up Window for search options --- plugins/gui/include/gui/searchbar/searchbar.h | 2 ++ plugins/gui/src/searchbar/searchbar.cpp | 22 ++++++++++++++----- .../searchoptions_dialog.cpp | 10 +++++++++ .../searchoptions_dialog.h | 22 +++++++++++++++++++ 4 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 plugins/gui/src/searchoptions_dialog/searchoptions_dialog.cpp create mode 100644 plugins/gui/src/searchoptions_dialog/searchoptions_dialog.h diff --git a/plugins/gui/include/gui/searchbar/searchbar.h b/plugins/gui/include/gui/searchbar/searchbar.h index 905ae1190b8..336b98629ee 100644 --- a/plugins/gui/include/gui/searchbar/searchbar.h +++ b/plugins/gui/include/gui/searchbar/searchbar.h @@ -193,6 +193,8 @@ namespace hal */ void handleClearClicked(); + void handleSearchOptionsDialog(); + private: QHBoxLayout* mLayout; diff --git a/plugins/gui/src/searchbar/searchbar.cpp b/plugins/gui/src/searchbar/searchbar.cpp index 6ff2e9f3766..a67acb94838 100644 --- a/plugins/gui/src/searchbar/searchbar.cpp +++ b/plugins/gui/src/searchbar/searchbar.cpp @@ -2,6 +2,7 @@ #include "gui/gui_utils/graphics.h" #include "gui/label_button/label_button.h" +#include "gui/src/searchoptions_dialog/searchoptions_dialog.h" #include #include @@ -35,7 +36,7 @@ namespace hal //Placeholder icons get better ones mDownButton->setIcon(QIcon(":/icons/arrow-down")); mUpButton->setIcon(QIcon(":/icons/arrow-up")); - mExactMatchButton->setIcon(QIcon(":/icons/menu")); + mExactMatchButton->setIcon(QIcon(":/icons/settings")); mSearchIconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); mLineEdit->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); @@ -43,17 +44,17 @@ namespace hal mLayout->addWidget(mSearchIconLabel); mLayout->addWidget(mLineEdit); - mExactMatchButton->setText("=="); + //mExactMatchButton->setText("=="); mExactMatchButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); mExactMatchButton->setCheckable(true); - mExactMatchButton->setToolTip("Exact Match"); + mExactMatchButton->setToolTip("Search Options"); mLayout->addWidget(mExactMatchButton); - mCaseSensitiveButton->setText("Aa"); + /*mCaseSensitiveButton->setText("Aa"); mCaseSensitiveButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); mCaseSensitiveButton->setCheckable(true); mCaseSensitiveButton->setToolTip("Case Sensitive"); - mLayout->addWidget(mCaseSensitiveButton); + mLayout->addWidget(mCaseSensitiveButton);*/ mClearButton->setIcon(gui_utility::getStyledSvgIcon(mClearIconStyle, mClearIcon)); mClearButton->setIconSize(QSize(10, 10)); @@ -67,9 +68,11 @@ namespace hal connect(mLineEdit, &QLineEdit::textEdited, this, &Searchbar::emitTextEdited); connect(mLineEdit, &QLineEdit::returnPressed, this, &Searchbar::handleReturnPressed); connect(mCaseSensitiveButton, &QToolButton::clicked, this, &Searchbar::emitTextEdited); - connect(mExactMatchButton, &QToolButton::clicked, this, &Searchbar::emitTextEdited); + //connect(mExactMatchButton, &QToolButton::clicked, this, &Searchbar::emitTextEdited); connect(mClearButton, &QToolButton::clicked, this, &Searchbar::handleClearClicked); + connect(mExactMatchButton, &QToolButton::clicked, this, &Searchbar::handleSearchOptionsDialog); + setFocusProxy(mLineEdit); } @@ -269,4 +272,11 @@ namespace hal { return !getCurrentText().isEmpty() || exactMatchChecked() || caseSensitiveChecked(); } + + void Searchbar::handleSearchOptionsDialog() + { + SearchOptionsDialog sd; + qInfo() << "opened"; + sd.exec(); + } } diff --git a/plugins/gui/src/searchoptions_dialog/searchoptions_dialog.cpp b/plugins/gui/src/searchoptions_dialog/searchoptions_dialog.cpp new file mode 100644 index 00000000000..e24258a36a4 --- /dev/null +++ b/plugins/gui/src/searchoptions_dialog/searchoptions_dialog.cpp @@ -0,0 +1,10 @@ +#include "gui/src/searchoptions_dialog/searchoptions_dialog.h" + +namespace hal +{ + SearchOptionsDialog::SearchOptionsDialog(QWidget* parent): QDialog(parent) + { + setWindowTitle("Search"); + mLayout = new QGridLayout(this); + } +} diff --git a/plugins/gui/src/searchoptions_dialog/searchoptions_dialog.h b/plugins/gui/src/searchoptions_dialog/searchoptions_dialog.h new file mode 100644 index 00000000000..90e9a1f0a48 --- /dev/null +++ b/plugins/gui/src/searchoptions_dialog/searchoptions_dialog.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include + +namespace hal +{ + class SearchOptionsDialog : public QDialog + { + Q_OBJECT + public: + /** + * Constructor. Initializes the Dialog. + * + * @param parent - The parent widget. + */ + explicit SearchOptionsDialog(QWidget *parent = nullptr); + + private: + QGridLayout* mLayout; + }; +}