Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, June 2007
programatically hiding, showing and manipulating widget sizes


Message 1 in thread

Hi,

I have a problem in my application that I hope somebody here can help me 
  with. Thanks in advance. This is my first post on the list, sorry if 
this was already answered.


In my application I am programatically hiding and showing widgets in a 
dialog. After the hide (or show) I need to know how the layout left the 
sizes of all the widgets in the dialog.

Querying for size() after a hide() or show() doesn't work. That is, I 
found, because hide() and show() operations need several Message Loop 
iterations.

Doing it after hideEvent() or showEvent() are called didn't work it 
either. It seems (but I am not sure) that those might be invoked before 
all the widgets get resized.

Right now I am inserting 
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);

but I don't like it because it makes my methods reentrant and they are 
not. And sometimes I found out that I need more than 1 call to 
processEvents (even weirder).


I really, really, really appreciate some help regards this. I would like 
much to know the Qt's legal way of doing what I need to (programatically 
  hiding, showing and manipulating widget sizes).


Thanks a lot.


--
 [ signature omitted ] 

Message 2 in thread

> I really, really, really appreciate some help regards this. I would
like
> much to know the Qt's legal way of doing what I need to
(programatically
>   hiding, showing and manipulating widget sizes).

Hi,
May i ask why are you manipulating widget sizes? This sounds very much
like you are doing something that Qt should do for you. Aren't you using
any layouts?

Cheers,
Peter

--
 [ signature omitted ] 

Message 3 in thread

Please reply to the list, not to me in private.

You can give the other widgets fixed sizes with QWidget::setFixedSize.

also tell the layout of your main window to adjust sizes:

	layout()->setSizeConstraint(QLayout::SetMinAndMaxSize);

now your main window should grow and shrink as needed.

Cheers,
Peter

> -----Original Message-----
> From: Hernan Tylim [mailto:htylim@xxxxxxxxxxxx]
> Sent: Wednesday, June 06, 2007 8:12 PM
> To: Peter Prade
> Subject: Re: programatically hiding, showing and manipulating widget
sizes
> 
> Hi. Like for example to adjust the window size after an inner widget
> dissapear so the other widgets will keep their same size.
> 
> Thanks
> 
> 
> Peter Prade wrote:
> >> I really, really, really appreciate some help regards this. I would
> > like
> >> much to know the Qt's legal way of doing what I need to
> > (programatically
> >>   hiding, showing and manipulating widget sizes).
> >
> > Hi,
> > May i ask why are you manipulating widget sizes? This sounds very
much
> > like you are doing something that Qt should do for you. Aren't you
using
> > any layouts?
> >
> > Cheers,
> > Peter
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
with
> "unsubscribe" in the subject or the body.
> > List archive and information:
http://lists.trolltech.com/qt-interest/
> >
> >

--
 [ signature omitted ] 

Message 4 in thread

Thanks, I didn't realize that I was replying to you privately.

I will try what you said.


Thanks again.
Regards,
Hernán


Peter Prade wrote:
> Please reply to the list, not to me in private.
> 
> You can give the other widgets fixed sizes with QWidget::setFixedSize.
> 
> also tell the layout of your main window to adjust sizes:
> 
> 	layout()->setSizeConstraint(QLayout::SetMinAndMaxSize);
> 
> now your main window should grow and shrink as needed.
> 
> Cheers,
> Peter
> 
>> -----Original Message-----
>> From: Hernan Tylim [mailto:htylim@xxxxxxxxxxxx]
>> Sent: Wednesday, June 06, 2007 8:12 PM
>> To: Peter Prade
>> Subject: Re: programatically hiding, showing and manipulating widget
> sizes
>> Hi. Like for example to adjust the window size after an inner widget
>> dissapear so the other widgets will keep their same size.
>>
>> Thanks
>>
>>
>> Peter Prade wrote:
>>>> I really, really, really appreciate some help regards this. I would
>>> like
>>>> much to know the Qt's legal way of doing what I need to
>>> (programatically
>>>>   hiding, showing and manipulating widget sizes).
>>> Hi,
>>> May i ask why are you manipulating widget sizes? This sounds very
> much
>>> like you are doing something that Qt should do for you. Aren't you
> using
>>> any layouts?
>>>
>>> Cheers,
>>> Peter
>>>
>>> --
>>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with
>> "unsubscribe" in the subject or the body.
>>> List archive and information:
> http://lists.trolltech.com/qt-interest/
>>>
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
> 
> 

--
 [ signature omitted ]