-
Notifications
You must be signed in to change notification settings - Fork 0
/
SearchWidget.cpp
46 lines (38 loc) · 1.28 KB
/
SearchWidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "SearchWidget.h"
#include <QVBoxLayout>
SearchWidget::SearchWidget(QWidget* parent, bool inDirs)
: QWidget(parent)
, mSearchWordLineEdit (new QLineEdit(this))
, mReplaceWordLineEdit(new QLineEdit(this))
, mSearchButton (new QPushButton(QIcon(":/search.png"), "Find", this))
, mReplaceButton (new QPushButton(QIcon(":/replace.png"), "Replace", this))
, mInDirs(inDirs)
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(createSearchPanel());
layout->addSpacerItem(new QSpacerItem(4, 4, QSizePolicy::Minimum, QSizePolicy::Minimum));
layout->addWidget(createReplacePanel());
layout->setMargin(0);
layout->setStretchFactor(this, 0);
refresh();
}
QWidget* SearchWidget::createSearchPanel() {
QWidget* widget = new QWidget(this);
QHBoxLayout* layout = new QHBoxLayout(widget);
layout->addWidget(mSearchWordLineEdit);
layout->addWidget(mSearchButton);
layout->setMargin(0);
return widget;
}
QWidget* SearchWidget::createReplacePanel() {
QWidget* widget = new QWidget(this);
QHBoxLayout* layout = new QHBoxLayout(widget);
layout->addWidget(mReplaceWordLineEdit);
layout->addWidget(mReplaceButton);
layout->setMargin(0);
return widget;
}
void SearchWidget::refresh() {
mSearchWordLineEdit->clear();
mReplaceWordLineEdit->clear();
}