-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
34 lines (24 loc) · 778 Bytes
/
main.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
#include "TempConfig.h"
#include <QApplication>
#include <QLabel>
#include <QSettings>
static void configureLabel(QLabel* label, TempConfig* config) {
QFont font;
font.setPixelSize(config->fontSize);
label->setFont(font);
QPalette palette;
palette.setColor(QPalette::WindowText, config->color);
label->setPalette(palette);
}
int main(int argc, char* argv[]) {
QApplication app(argc, argv);
TempConfig config("config.ini");
QLabel label("Hello World");
configureLabel(&label, &config);
label.resize(320, 120);
label.setWindowTitle("Reload (QWidget)");
QObject::connect(
&config, &TempConfig::changed, &label, [&label, &config] { configureLabel(&label, &config); });
label.show();
return app.exec();
}