-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
85 lines (58 loc) · 2.13 KB
/
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
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 <QGuiApplication>
#include <QQmlApplicationEngine>
#include <windows.h>
#include <stdio.h>
#include <QDebug>
#include "titlebarchangecolor.h"
#include <QQmlContext>
#pragma comment(lib, "user32.lib")
/*
*
BOOL SetSysColors(
int cElements,
const INT *lpaElements,
const COLORREF *lpaRgbValues
);
*
*/
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
TitleBarChangeColor myObject;
engine.rootContext()->setContextProperty(QStringLiteral("myObject"), &myObject);
// // Get the current color of the active caption.
// aOldColors[1] = GetSysColor(aElements[1]);
// qDebug("Current active caption color: {0x%x, 0x%x, 0x%x}\n",
// GetRValue(aOldColors[1]),
// GetGValue(aOldColors[1]),
// GetBValue(aOldColors[1]));
// // Define new colors for the elements
// aNewColors[0] = RGB(0x80, 0x80, 0x80); // light gray
// aNewColors[1] = RGB(0x80, 0x00, 0x80); // dark purple
// qDebug("\nNew window color: {0x%x, 0x%x, 0x%x}\n",
// GetRValue(aNewColors[0]),
// GetGValue(aNewColors[0]),
// GetBValue(aNewColors[0]));
// qDebug("New active color desktop: {0x%x, 0x%x, 0x%x}\n",
// GetRValue(aNewColors[1]),
// GetGValue(aNewColors[1]),
// GetBValue(aNewColors[1]));
// // Set the elements defined in aElements to the colors defined
// // in aNewColors
// SetSysColors(2, aElements, aNewColors);
// qDebug("\nWindow background and active border have been changed.\n");
// qDebug("Reverting to previous colors in 10 seconds...\n");
// //Sleep(1000);
// // Restore the elements to their original colors
// SetSysColors(2, aElements, aOldColors);
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
return app.exec();
}