Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char *argv[])
- {
- #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- #endif
- QGuiApplication app(argc, argv);
- QmlCBridge c_app;
- QQmlApplicationEngine engine;
- 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);
- QQmlContext *root = engine.rootContext();
- root->setContextProperty("app", &c_app);
- QObject *component = engine.rootObjects().first();
- c_app.setComponent(component);
- WId window = qobject_cast<QWindow*>(component)->winId();
- Display *display = QX11Info::display();
- // make window visible on all desktops
- unsigned long data = 0xffffffff; // all desktop
- XChangeProperty (display, window,
- XInternAtom(display, "_NET_WM_DESKTOP", False),
- XA_CARDINAL,
- 32,
- PropModeReplace,
- reinterpret_cast<unsigned char *>(&data),
- 1);
- // make window pass-through
- XRectangle rect;
- XserverRegion region = XFixesCreateRegion(display, &rect, 1);
- XFixesSetWindowShapeRegion(display, window, ShapeInput, 0, 0, region);
- XFixesSetWindowShapeRegion (display, window, ShapeBounding, 0, 0, 0);
- XFixesDestroyRegion(display, region);
- XMapWindow(display, window);
- XFlush(display);
- int status = app.exec();
- return status;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement