It seems you want QML to send two different signal types, one to mark the start and finish of resizing, and one to mark size changes during resizing. The event sequence would then be something like this:
window.resizeStarted() // hypothetical new event
window.widthChanged()
window.heightChanged()
window.widthChanged()
window.heightChanged()
...
window.resizeEnded() // hypothetical new event
That is apparently impossible in Qt out of the box, but you should be able to implement it yourself with this approach, originally meant to not repaint the window at all while resizing:
Filter the relevant events out until the mouse button has been released. Specifically, "eat" the resize event while the mouse button is held down, and then synthesize the final resize event once the mouse is released. You can do it all in an event filter attached to the window / widget object that displays your QML interface. (source)
The process would be very similar to the one in the quote:
Extend the QML Window type with custom signals:
//MyWindow.qml
Window {
signal resizeStarted()
signal resizeEnded()
}
Create an event filter on the QML window that "eats" all window resize events. When it encounters the first one, it sends resizeStarted()
. Then it forwards the window resize events. When it encounters a mouse release event while resizing, it sends resizeEnded()
after the last widthChanged()
/ heightChanged()
event.
Implement a corresponding signal handler onResizeEnded
in QML to react, here to adapt the height of your application window to a certain fixed value.
Seems quite a promising route to me, but to note, I haven't tried it in code so far.