forked from kleroop/TechCourse_2022_12
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_window.cpp
36 lines (28 loc) · 840 Bytes
/
main_window.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
#include "main_window.h"
static void pushed_s(bool checked)
{
(void) checked;
puts("Push");
}
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent) // call parent class constructor
{
counter = 0;
ui.setupUi(this); // init all ui elements
ui.label->setText(QString::fromUtf8("Привіт, світ!"));
timer.setInterval(5000);
QObject::connect(&timer, &QTimer::timeout, this, &MainWindow::timeout);
timer.start();
QObject::connect(ui.pushButton, &QPushButton::clicked, &pushed_s);
QObject::connect(ui.pushButton, &QPushButton::clicked, this, &MainWindow::pushed);
}
void MainWindow::pushed(bool checked)
{
(void) checked;
counter++;
ui.label->setText(QString::fromStdString("pushed " + std::to_string(counter)));
}
void MainWindow::timeout()
{
this->pushed(false);
}