Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (39 loc) · 1.64 KB
/
Copy pathmain.cpp
File metadata and controls
46 lines (39 loc) · 1.64 KB
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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickWindow>
#include <QIcon>
int main(int argc, char* argv[])
{
qputenv("QT_QUICK_CONTROLS_STYLE", "Basic");
// Use the software (CPU raster) renderer.
//
// This app is a pure 2D text / UI — there are no 3D effects, shaders or
// GPU-only features that would justify a GPU backend. The software
// renderer eliminates ALL GPU swap-chain resize artefacts (black/white
// flicker when dragging the window border) without any platform-specific
// hacks, while still delivering smooth performance for a simple UI.
//
// Note: GPU backends (D3D11/OpenGL) in the threaded render loop expose a
// fundamental Windows limitation: the DWM compositor fills newly-uncovered
// pixels with black (expand) or the GDI background brush (shrink) between
// the moment the OS resizes the window and the moment the GPU presents the
// next frame. There is no clean fix without serialising the render loop
// (which causes stutter) or installing a native WndProc hook (fragile).
// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
QGuiApplication app(argc, argv);
QGuiApplication::setOrganizationName("RTTView2");
QGuiApplication::setApplicationName("RTTView2");
app.setWindowIcon(QIcon(":/logo.png"));
QQmlApplicationEngine engine;
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreationFailed,
&app,
[]()
{
QCoreApplication::exit(-1);
},
Qt::QueuedConnection);
engine.loadFromModule("RTTView2", "Main");
return app.exec();
}