2026-04-02 00:19:02 +03:00
|
|
|
#include "SearchBar.h"
|
2026-04-02 16:14:26 +03:00
|
|
|
#include "Style.h"
|
2026-04-02 00:19:02 +03:00
|
|
|
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
|
|
|
|
|
SearchBar::SearchBar(QWidget* parent)
|
|
|
|
|
: QWidget(parent)
|
|
|
|
|
{
|
|
|
|
|
auto* layout = new QHBoxLayout(this);
|
2026-04-02 16:14:26 +03:00
|
|
|
layout->setContentsMargins(0, 4, 0, 4);
|
|
|
|
|
layout->setSpacing(8);
|
2026-04-02 00:19:02 +03:00
|
|
|
|
|
|
|
|
m_input = new QLineEdit(this);
|
|
|
|
|
m_input->setPlaceholderText("Search by block ID / block hash / tx hash / account ID...");
|
2026-04-02 16:14:26 +03:00
|
|
|
m_input->setMinimumHeight(38);
|
|
|
|
|
m_input->setStyleSheet(Style::searchInput());
|
2026-04-02 00:19:02 +03:00
|
|
|
|
|
|
|
|
auto* searchBtn = new QPushButton("Search", this);
|
2026-04-02 16:14:26 +03:00
|
|
|
searchBtn->setMinimumHeight(38);
|
|
|
|
|
searchBtn->setStyleSheet(Style::searchButton());
|
2026-04-02 00:19:02 +03:00
|
|
|
|
|
|
|
|
layout->addWidget(m_input, 1);
|
|
|
|
|
layout->addWidget(searchBtn);
|
|
|
|
|
|
|
|
|
|
connect(m_input, &QLineEdit::returnPressed, this, [this]() {
|
|
|
|
|
emit searchRequested(m_input->text());
|
|
|
|
|
});
|
|
|
|
|
connect(searchBtn, &QPushButton::clicked, this, [this]() {
|
|
|
|
|
emit searchRequested(m_input->text());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SearchBar::clear()
|
|
|
|
|
{
|
|
|
|
|
m_input->clear();
|
|
|
|
|
}
|