-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.hh
62 lines (46 loc) · 1.37 KB
/
mainwindow.hh
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
// TIE-02006 fall 2017
// Project 03
// Juha Suvanto 189427
// jsuvanto@iki.fi
#ifndef MAINWINDOW_HH
#define MAINWINDOW_HH
#include <QMainWindow>
#include <QActionGroup>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
// Calculates the BMI and shows it on screen.
void calculate_bmi();
// Resets the UI.
void reset_ui();
// Sets gender to female.
void setFemale();
// Sets gender to male.
void setMale();
// Interprets the BMI and shows it on screen.
void interpret_bmi();
private:
Ui::MainWindow *ui;
bool female_; // Gender is female if true, male if false.
double bmi_;
QString interpretation_; // Stores the verbal interpretation of BMI. QString type because it's easier to use with Qt.
void createActions(); // Helper function to create actions.
void createMenus(); // Helper function to create and populate menus.
// Menu items. These are declared because I didn't use Qt Designer to make the menus.
// Also gets rid of having to use "ui->" when connecting etc.
QMenu *actionMenu;
QMenu *genderMenu;
QAction *actionReset;
QAction *actionQuit;
QAction *actionSetFemale;
QAction *actionSetMale;
QActionGroup *gendergroup;
};
#endif // MAINWINDOW_HH