-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
68 lines (58 loc) · 1.17 KB
/
mainwindow.h
File metadata and controls
68 lines (58 loc) · 1.17 KB
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QSpinBox>
#include <QLineEdit>
class Plot3D;
class QTextEdit;
namespace Ui {
class MainWindow;
}
class Power2Spinbox : public QSpinBox
{
Q_OBJECT
public:
Power2Spinbox(QWidget* parent = Q_NULLPTR):
QSpinBox(parent)
{
setMaximum(4096);
setMinimum(16);
setValue(256);
findChild<QLineEdit*>()->setReadOnly(true);
}
void stepBy(int steps)
{
int newValue = value();
if(steps > 0)
{
while(steps > 0)
{
newValue *= 2;
--steps;
}
setValue(std::min(newValue, maximum()));
return;
}
while(steps < 0)
{
newValue /= 2;
++steps;
}
setValue(std::max(newValue, minimum()));
}
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void onSolve();
void onMessage(const QString& message);
private:
Ui::MainWindow *ui;
Plot3D* m_plot;
QTextEdit* m_log;
};
#endif // MAINWINDOW_H