-
Notifications
You must be signed in to change notification settings - Fork 0
/
PreferencesWindow.hpp
62 lines (51 loc) · 1.9 KB
/
PreferencesWindow.hpp
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
// First Inclusion: The first time this header is included in a .cpp file, MYCLASS_H is not
// yet defined, so the code enters the block between #ifndef MYCLASS_H and #endif.
// The preprocessor directive #define MYCLASS_H is encountered, defining MYCLASS_H.
// The actual content of the header file (your class definition, function declarations, etc.)
// is included.
// Subsequent Inclusions: If the same header is included again, either in the same .cpp file
// or in another one that gets linked with the first, the #ifndef MYCLASS_H check will fail,
// because MYCLASS_H has already been defined.
// The content between #ifndef MYCLASS_H and #endif will be skipped, effectively preventing
// multiple inclusions of the same code.
#ifndef LUMID_PREFERENCESWINDOW_HPP
#define LUMID_PREFERENCESWINDOW_HPP
#include <QDialog>
#include <QHBoxLayout>
#include <QKeySequenceEdit>
#include <QLabel>
#include <QPushButton>
#include <QSpinBox>
#define PREFSWINDOW_WIDTH 240
#define PREFSWINDOW_HEIGHT 180
#define LABEL_SPINBOX_WIDTH 120
class PreferencesWindow : public QDialog {
public:
// In C++, you generally only provide default values
// for arguments in the function declaration, not in
// the function definition.
PreferencesWindow();
void closeEvent(QCloseEvent* event) override;
void showEvent(QShowEvent* event) override;
int getStride() const;
QPushButton* applyButton;
QPushButton* resetButton;
QSpinBox* spinbox;
// keybinding edit fields
QKeySequenceEdit* keySeqEditIncrease;
QKeySequenceEdit* keySeqEditDecrease;
private:
int posX, posY;
QLabel* strideLabel;
QLabel* increaseLabel;
QLabel* decreaseLabel;
// Qt will manage their lifetime
QHBoxLayout* strideLayout;
QHBoxLayout* increaseLayout;
QHBoxLayout* decreaseLayout;
QHBoxLayout* bottomButtonLayout;
QVBoxLayout* mainLayout;
private slots:
void reset();
};
#endif