BibleTime
src
frontend
display
btfindwidget.h
Go to the documentation of this file.
1
/*********
2
*
3
* In the name of the Father, and of the Son, and of the Holy Spirit.
4
*
5
* This file is part of BibleTime's source code, https://bibletime.info/
6
*
7
* Copyright 1999-2021 by the BibleTime developers.
8
* The BibleTime source code is licensed under the GNU General Public License
9
* version 2.0.
10
*
11
**********/
12
13
#pragma once
14
15
#include <QWidget>
16
17
#include <QObject>
18
#include <QString>
19
20
21
class
QCheckBox;
22
class
QLineEdit
;
23
class
QToolButton
;
24
25
class
BtFindWidget
final:
public
QWidget
{
26
27
Q_OBJECT
28
29
private
:
/* Types: */
30
31
struct
HighlightState
{
32
QString
text
;
33
bool
caseSensitive
;
34
35
friend
bool
operator==
(
HighlightState
const
& lhs,
36
HighlightState
const
& rhs) noexcept
37
{
38
return
(lhs.text == rhs.text)
39
&& (lhs.caseSensitive == rhs.caseSensitive);
40
}
41
42
friend
bool
operator!=
(
HighlightState
const
& lhs,
43
HighlightState
const
& rhs) noexcept
44
{
45
return
(lhs.text != rhs.text)
46
|| (lhs.caseSensitive != rhs.caseSensitive);
47
}
48
};
49
50
public
:
// methods:
51
52
BtFindWidget
(
QWidget
* parent =
nullptr
);
53
54
void
showAndSelect
();
55
56
protected
:
// Methods:
57
58
void
timerEvent
(QTimerEvent *
const
event)
final
override
;
59
60
private
:
// methods:
61
62
void
queueHighlight
();
63
void
highlightImmediately
();
64
void
retranslateUi
();
65
66
Q_SIGNALS:
67
68
void
findPrevious
();
69
void
findNext
();
70
void
highlightText
(QString
const
& text,
bool
caseSensitive);
71
72
private
:
// fields:
73
74
QLineEdit
*
m_textEditor
;
75
QToolButton
*
m_nextButton
;
76
QToolButton
*
m_previousButton
;
77
QCheckBox *
m_caseCheckBox
;
78
HighlightState
m_lastHighlightState
{{},
false
};
79
int
m_throttleTimerId
= 0;
80
81
};
BtFindWidget
Definition:
btfindwidget.h:25
BtFindWidget::m_lastHighlightState
HighlightState m_lastHighlightState
Definition:
btfindwidget.h:78
BtFindWidget::findPrevious
void findPrevious()
BtFindWidget::retranslateUi
void retranslateUi()
Definition:
btfindwidget.cpp:126
BtFindWidget::BtFindWidget
BtFindWidget(QWidget *parent=nullptr)
Definition:
btfindwidget.cpp:30
BtFindWidget::highlightImmediately
void highlightImmediately()
Definition:
btfindwidget.cpp:115
BtFindWidget::showAndSelect
void showAndSelect()
Definition:
btfindwidget.cpp:94
BtFindWidget::m_textEditor
QLineEdit * m_textEditor
Definition:
btfindwidget.h:74
BtFindWidget::findNext
void findNext()
BtFindWidget::m_previousButton
QToolButton * m_previousButton
Definition:
btfindwidget.h:76
BtFindWidget::m_nextButton
QToolButton * m_nextButton
Definition:
btfindwidget.h:75
BtFindWidget::m_throttleTimerId
int m_throttleTimerId
Definition:
btfindwidget.h:79
BtFindWidget::highlightText
void highlightText(QString const &text, bool caseSensitive)
BtFindWidget::timerEvent
void timerEvent(QTimerEvent *const event) final override
Definition:
btfindwidget.cpp:100
BtFindWidget::m_caseCheckBox
QCheckBox * m_caseCheckBox
Definition:
btfindwidget.h:77
BtFindWidget::queueHighlight
void queueHighlight()
Definition:
btfindwidget.cpp:110
QLineEdit
QToolButton
QWidget
BtFindWidget::HighlightState
Definition:
btfindwidget.h:31
BtFindWidget::HighlightState::text
QString text
Definition:
btfindwidget.h:32
BtFindWidget::HighlightState::operator==
friend bool operator==(HighlightState const &lhs, HighlightState const &rhs) noexcept
Definition:
btfindwidget.h:35
BtFindWidget::HighlightState::operator!=
friend bool operator!=(HighlightState const &lhs, HighlightState const &rhs) noexcept
Definition:
btfindwidget.h:42
BtFindWidget::HighlightState::caseSensitive
bool caseSensitive
Definition:
btfindwidget.h:33
Generated by
1.9.1