-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.cpp
85 lines (68 loc) · 1.93 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "MainWindow.h"
#include "ui_MainWindow.h"
#include <iostream>
#include <QMessageBox>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::SetClockHora(QString newHora)
{
// QString newHora;
// newHora = "15:13:01";
qDebug() << "SetClockHora: " << newHora;
QPalette newColorHora = ui->labelHora->palette();
newColorHora.setColor(ui->labelHora->backgroundRole(), Qt::red);
newColorHora.setColor(ui->labelHora->foregroundRole(), Qt::yellow);
ui->labelHora->setText(newHora);
ui->labelHora->setPalette(newColorHora);
}
void MainWindow::SetClockData(QString newData)
{
// QString newData;
// newData = "01/04/22";
qDebug() << "SetClockData: " << newData;
QPalette newColorData = ui->labelData->palette();
newColorData.setColor(ui->labelHora->backgroundRole(), Qt::red);
newColorData.setColor(ui->labelHora->foregroundRole(), Qt::green);
ui->labelData->setText(newData);
ui->labelData->setPalette(newColorData);
//ui->labelData->setVisible(false);
}
void MainWindow::SetClockStyle(clockStyle clockStyleSelected)
{
qDebug() << "clockStyleSelected: " << QVariant::fromValue(clockStyleSelected).toString();
switch (clockStyleSelected)
{
case clockStyle::Basic:
qDebug() << "clockStyleSelected Basic ";
ui->widgetTextClock->setVisible(true);
break;
case clockStyle::Circular:
qDebug() << "clockStyleSelected Circular ";
ui->widgetTextClock->setVisible(false);
break;
case clockStyle::LCD:
qDebug() << "clockStyleSelected LCD ";
ui->widgetTextClock->setVisible(false);
break;
default:
qDebug() << "clockStyleSelected default ";
ui->widgetTextClock->setVisible(true);
break;
}
}
void MainWindow::ButtonClicked()
{
QMessageBox msgBox;
msgBox.setText("Hello, World!");
msgBox.setWindowTitle("VisualGDB Qt Demo");
msgBox.exec();
}