-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
45 lines (37 loc) · 963 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
41
42
43
44
45
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->pushButton->setText("ClickMe");
MainWindow::connectClock();
connect(clock, &Clock::ClockTick, this, &MainWindow::onClockTick);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::connectClock()
{
Clock *myClock = new Clock();
myClock->setInterval(500);
myClock->start();
this->clock = myClock;
}
void MainWindow::on_pushButton_clicked()
{
int THEtICKS = this->clock->getTicks();
QString TicksString = QString::number(THEtICKS);
this->ui->ClockTicksText->setText(TicksString);
}
void MainWindow::onClockTick()
{
QString TotalTicks = QString::number(this->clock->getTicks());
this->ui->label_8->setText(TotalTicks);
}
void MainWindow::on_verticalSlider_valueChanged(int value)
{
this->clock->updateInterval(value);
}