I have made an QML application using a frameless window and implemented actions like dragging and resizing by myself. But this way the application doesn't support native window manager features like windows aero snap or the Gnome window manager features. So I searched and found this where someone found a way to support them in a frameless window using the win32 API. But is there a way to use this with a QML application or another way to use the native window manager features?
I initialize the window from C++ with this code:
QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml"));
QObject *topLevel = engine.rootObjects().value(0);
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
window->setFlags(window->flags() | Qt::FramelessWindowHint);
if ( !window ) {
qWarning("Error: Your root item has to be a Window.");
return -1;
}
window->show();
EDIT: I would also like to use the native window manager drop shadow like in the example I have linked to, if possible.
EDIT: I have a second problem: Following @Kuba Obers instructions I got it to work how it was intended to. But now I have the problem, that when I resize or move it Qt leaves an undrawn area with the size of the frame.