Skip to content

Commit

Permalink
added SearchOptionsDialog class as a pop-up Window for search options
Browse files Browse the repository at this point in the history
  • Loading branch information
neoneela committed Sep 18, 2023
1 parent d52e9b4 commit a26a6b3
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 6 deletions.
2 changes: 2 additions & 0 deletions plugins/gui/include/gui/searchbar/searchbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ namespace hal
*/
void handleClearClicked();

void handleSearchOptionsDialog();

private:
QHBoxLayout* mLayout;

Expand Down
22 changes: 16 additions & 6 deletions plugins/gui/src/searchbar/searchbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <QHBoxLayout>
#include <QIcon>
Expand Down Expand Up @@ -35,25 +36,25 @@ 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);

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));
Expand All @@ -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);
}

Expand Down Expand Up @@ -269,4 +272,11 @@ namespace hal
{
return !getCurrentText().isEmpty() || exactMatchChecked() || caseSensitiveChecked();
}

void Searchbar::handleSearchOptionsDialog()
{
SearchOptionsDialog sd;
qInfo() << "opened";
sd.exec();
}
}
10 changes: 10 additions & 0 deletions plugins/gui/src/searchoptions_dialog/searchoptions_dialog.cpp
Original file line number Diff line number Diff line change
@@ -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);
}
}
22 changes: 22 additions & 0 deletions plugins/gui/src/searchoptions_dialog/searchoptions_dialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once

#include <QDialog>
#include <QGridLayout>

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;
};
}

0 comments on commit a26a6b3

Please sign in to comment.