I need a fixed aspect ratio top level window. Can someone help?
Re: Fixed aspect ratio for a widget
I used a QDockWidget as a floating window and tried to fix its aspect ratio (e.g 3:2). However I can't do that when I try to reimplement the heightForWidth in the widget/sizePolicy/Layout. Later on I had to use resize in the ResizeEvent. The side effect was the window triggered several ResizeEvent and the sizes of the widget changed several time before it finally finished. The ResizeEvent was invoked only AFTER the RESIZE was done.
The better way should be to update the width or height according to the aspect ratio before the the actual resize event. However I can't find a solution.
At last I found a way to address the issue: use the nativeEvent() to monitor the Windows message WM_RESISING and update the rectangle of the window.