-
Notifications
You must be signed in to change notification settings - Fork 5
/
mainwindow_find.h
99 lines (84 loc) · 2.98 KB
/
mainwindow_find.h
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef MAINWINDOW_FINDDOCKWIDGET_H
#define MAINWINDOW_FINDDOCKWIDGET_H
#include <QObject>
#include <QWidget>
#include <QDockWidget>
#include <QLayout>
#include <QComboBox>
#include <QCheckBox>
#include "table_views.h"
class FindDialog;
class MainWindow;
class QCloseEvent;
/*!
* \brief The FindDockWidget class. A wrapper object that contains a FindDialog.
*
* A QDockWidget is a small window-like interface that can be attached to the
* margins of a QMainWindow object.
*/
class FindDockWidget : public QDockWidget
{
Q_OBJECT
MainWindow* m_parent_window;
FindDialog* m_child_dialog;
public:
FindDockWidget(MainWindow* p_main_window);
FindDialog* get_child_dialog() { return m_child_dialog; }
public slots:
void closeEvent(QCloseEvent *event);
};
#endif // MAINWINDOW_FINDDOCKWIDGET_H
/*!
* \brief The FindDialog class. The main widget for implementing the search
* functionality.
*
* The FindDialog object detects if its interactive components (buttons, etc.)
* are activated through detecting signals from them to the FindDialog object's
* slots. These slots then send signals to the UpperTableView objects so that
* the TableView objects change their appearance in accordance with the search
* request.
*/
class FindDialog : public QWidget
{
Q_OBJECT
friend class FindDockWidget;
typedef enum SearchRange {
e_tableview_upper_all,
e_tableview_upper_left,
e_tableview_upper_right
} SearchRange;
QHBoxLayout* m_layout;
SearchRange m_search_range;
MainWindow* m_mainwindow;
QLabel* m_label_selection;
QComboBox* m_combobox_selection;
QCheckBox* m_checkbox_exact_match;
QLineEdit* m_line_edit;
QLabel* m_label_items_found;
QPushButton* m_button_find_next;
QPushButton* m_button_find_prev;
QPushButton* m_button_clear_search;
QPushButton* m_button_close;
int m_left_items_found;
int m_right_items_found;
private:
void connect_button_signals();
void connect_search_signals();
public:
FindDialog(MainWindow* p_main_window);
void set_search_selection(QString s) {m_combobox_selection->setCurrentText(s);}
bool is_exact_match() { return m_checkbox_exact_match->isChecked(); }
signals:
void search_for_left_next(QString& s);
void search_for_right_next(QString& s);
void search_for_left_prev(QString& s);
void search_for_right_prev(QString& s);
void clear_left_search();
void clear_right_search();
public slots:
void change_search_range(QString);
void do_next_search();
void do_prev_search();
void item_found(int n);
void do_clear_search();
};