-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfinddialog.cpp
42 lines (36 loc) · 1.27 KB
/
finddialog.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
// ******************************************************
// * copyright (C) 2017 by Reinhardt Behm/rbehm@hushmail.com
// * All Rights reserved
// * created 1/25/2017 by behm
// ******************************************************
#include "finddialog.h"
FindDialog::FindDialog(QWidget *parent)
: QWidget(parent)
{
QFormLayout *lay = new QFormLayout(this);
lay->addRow("Text", findString = new QLineEdit);
findString->setClearButtonEnabled(true);
QPushButton *bf = new QPushButton("Find");
QPushButton *br = new QPushButton("Find Rev");
bf->setIcon(QIcon(":/icons/pics/find-next.png"));
br->setIcon(QIcon(":/icons/pics/find-previous.png"));
QHBoxLayout *hl = new QHBoxLayout;
lay->addRow(hl);
hl->addWidget(bf);
hl->addWidget(br);
connect(bf, &QPushButton::clicked, this, &FindDialog::findSlot);
connect(br, &QPushButton::clicked, this, &FindDialog::findBackSlot);
connect(findString, &QLineEdit::returnPressed, this, &FindDialog::findSlot);
}
void FindDialog::findSlot()
{
const QString text = findString->text();
QTextDocument::FindFlags options = QTextDocument::FindFlags();
emit find(text, options);
}
void FindDialog::findBackSlot()
{
const QString text = findString->text();
QTextDocument::FindFlags options = QTextDocument::FindBackward;
emit find(text, options);
}