-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
42 lines (32 loc) · 924 Bytes
/
mainwindow.cpp
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
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
button_incr = new QPushButton("&Increment", this);
button_zero = new QPushButton("&Zero", this);
label = new QLabel(this);
connect(button_incr, &QPushButton::pressed, this, &MainWindow::push_button_increment_on_click);
connect(button_zero, &QPushButton::pressed, this, &MainWindow::push_button_zero_on_click);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::RenderUi() {
label->setText("Some int");
button_incr->move(50,50);
button_zero->move(50,90);
label->move(150, 70);
MainWindow::show();
}
void MainWindow::push_button_increment_on_click () {
counter++;
label->setNum(counter);
}
void MainWindow::push_button_zero_on_click () {
counter = 0;
label->setNum(counter);
}