In my project I created a transparent and frameless QMainWindow, then created QmlApplicationViewer. I need to be able to drag and resize the window.
How can I do?
In my project I created a transparent and frameless QMainWindow, then created QmlApplicationViewer. I
Share
This app is a small variation of the one presented here to deal with transparent windows in QML applications:
win.cpp:
win.pro:
draw_rectangles.qml:
Even though you are not interested in transparency, this app shows how to expose
QMainWindowto QML. This allows the QML application to make changes in the main window.Click on the blue rectangle to drag the window around, and click on the red rectangle to resize the window using hardcoded values in the qml. Of course, as the window is transparent you won’t have the visual feedback of a regular opaque application when you resize it. But the resize operation works, though. Enjoy!