PDA

View Full Version : Problem with resizing dialog



Seema Rao
5th May 2006, 13:49
Hi all,

I have written a small app and tried to align the controles in the layout properly. When app comes up it looks good. But when I resize the window using mouse making it smaller layout is messed up. Can some body please explain am I wrong here. I have attached the sample.

Thanks in advance,
Seema Rao

349

jacek
5th May 2006, 14:31
when I resize the window using mouse making it smaller layout is messed up.
But what exactly is wrong? Maybe it's just a matter of setting a minimum size for the central label?

Note that layouts will ignore everything you have set with setGeometry().

Seema Rao
5th May 2006, 15:11
Its not only matter with centered QLabel, even buttons that I have subclassed fail to adapt to Layout when resizing!!

Can some body please help!!

jacek
5th May 2006, 15:19
Its not only matter with centered QLabel, even buttons that I have subclassed fail to adapt to Layout when resizing!!
Could you post an image that shows the correct behavior or at least describe it?

Seema Rao
5th May 2006, 15:51
351

352

here is the screen shots of image I got when window is created, but when I resized it, it looks like second one. why this happens even I have bound the controls to the layout?

Glitch
5th May 2006, 15:56
Can you post the code to this dialog and the custom buttons? I think you have a bad sizeHint() somewhere. What's your baseclass for thses buttons? You may need to override sizeHint()const and minimumSizeHint()const in your button class.

--Justin Noel
justin@ics.com

Seema Rao
5th May 2006, 16:00
I have posted the whole sample's source files in the first thread!!

jacek
5th May 2006, 16:00
when I resized it, it looks like second one.
What is wrong with that? I'm not sure what do you want to achieve.

Glitch
5th May 2006, 18:27
I read your code.

The tool buttons are disappearing because thier sizeHint() and minuminSizeHint() are returning QSize(0,0) whcih is the default inherited from QWidget. QAbstractButton implements no sizeHint().

I suggest implementing minimumSizeHint() in TooButton to return the size of your pixmap. Then habd sizeHint() return that valut too so...

ToolButton::minimumSizeHint() const
{
return m_myPixmap.size(); //Or wheverever you are getting the pixmap from.
}

ToolButton::sizeHint() const
{
return minimumSizeHint();
}

--Justin Noel
justin@ics.com