[Qt-interest] resizeEvent get's only called _after_ resize

Sean Harmer sean.harmer at maps-technology.com
Sun Jul 19 02:05:33 CEST 2009


Hi,

chris_honschu at gmx.de wrote:
> Hi,
>
>  I want a window that can only be resized with a ratio of 4:3. I 
> achieved this by using the resizeEvent.
>
>  My problem now is that the window can be resized to any other 
> size until the user releases the mousebutton (when changing the 
> size).
>
> So I think resizeEvent works correct, because it only gets 
> triggered when the resizeEvent is done/over.
>
> What I need is a function that gives me access to the 
> resize-process itself. So that the window can always stay in 4:3 
> ratio and won't be snapped back after the resize event.
>   
Try reimplementing the int QWidget::heightForWidth ( int w ) const 
function in your window class to return  a height appropriate to the 
passed width according to your desired aspect ratio.

Sean





More information about the Qt-interest-old mailing list