PDA

View Full Version : resizeEvent help pls



munna
21st January 2006, 06:12
Hi,

I have a widget which always needs to be square in shape. Therefore when user resizes the widget how can i make it square while he is resizing it (not after he is finished resizing)?

Thanks

wysota
21st January 2006, 11:07
Did you try heightForWidth?

munna
21st January 2006, 11:49
Can you please give me a simple example?

Thanks

wysota
21st January 2006, 12:45
int QWidget::heightForWidth ( int w ) const [virtual]
Returns the preferred height for this widget, given the width w.
If this widget has a layout, the default implementation returns the layout's preferred height. if there is no layout, the default implementation returns -1 indicating that the preferred height does not depend on the width.

And http://doc.trolltech.com/qq/qq04-height-for-width.html

munna
21st January 2006, 13:23
Hi,

Thanks for reply. I have already read it, but how would i use this and reimplement the resizeEvent and achieve my goal.

I have already tries this. Bu the problem is only after the user finishes resizing the widget resizes itself again and only then it is a square. What is want is that when user drags the edge of the widget, the widget should resize itself in such a way that it is always square.

For example when the width is incresed the height should also increase along with the width and thr vice-versa.

Thanks

wysota
21st January 2006, 14:03
For example when the width is incresed the height should also increase along with the width and thr vice-versa.

I don't think you can do that... It is the window manager who is responsible for this. The resize event is generated when the resize finishes.

munna
21st January 2006, 14:17
But an application which is written using pascal is doing it and i want to reproduce the same effect in my application also.

If it was windows manager that was responsible for it then how is it possible using pascal?

Thanks

wysota
21st January 2006, 17:07
If it was windows manager that was responsible for it then how is it possible using pascal?

It is probably window-manager dependent :) Or it causes a resize event to be generated with every mouse move while changing size (it's probably the same as opaque window sizing).

krsmichael
10th February 2006, 19:49
But an application which is written using pascal is doing it and i want to reproduce the same effect in my application also.

If it was windows manager that was responsible for it then how is it possible using pascal?

Thanks

You could handle the mouse down, move and up events yourself. I did this when I needed the illusion of a main window but did not want the standard windows capation bar. So essentially, the window was a frameless window. When a mouse down occurred in a predefined region of window, it moved the window around until a mouse up occured. Worked very well. I am certain the same could be done for resizeing the window.

soodeh
3rd July 2010, 09:29
I want to resize a frameless window with adding 8 squers in the 8 sides of window. please help me!

wysota
9th July 2010, 09:38
I want to resize a frameless window with adding 8 squers in the 8 sides of window. please help me!

And what exactly is the problem?