| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 1 | |
I am using Qt 4.3.3 on Mac OS X 10.5.1. I designed a QDialog in the designer app (attached) which contains among other elements a group box. In the constructor for the dialog, I hide the group box and then call adjustSize(); which does what I would expect, giving me the dialog without the group box, and sized down appropriately. I can then click a button in the dialog, which shows the group box thad resized the window larger to accommodate it. This all works as expected. However, if I then try to hide the group box again and run the adjust(); command, rather than giving me the smaller window again, the main window layout adjusts to fill the larger size window, even with the group box hidden, and refuses to go smaller (see attached screen shot). Attempts to manually adjust the window size smaller fail (although I can adjust larger easily enough), and adjusting the window size programatically (using the resize command) work, but hide portions of the content, specifically the ok/cancel buttons, as the layout refuses to go smaller. How can I fix this? or is there a better way to do what I am trying to do (hide and show a portion of the window content, while keeping the window at minimum height)? Thanks. ----------------------------------------------- Israel Brewster Computer Support Technician Frontier Flying Service Inc. 5245 Airport Industrial Rd Fairbanks, AK 99709 (907) 450-7250 x293 -----------------------------------------------
Attachment:
Attachment:
login.ui
Description: Binary data
Message 2 in thread
On Jan 3, 2008, at 12:33 PM, Israel Brewster wrote:
> I am using Qt 4.3.3 on Mac OS X 10.5.1. I designed a QDialog in the
> designer app (attached) which contains among other elements a group
> box. In the constructor for the dialog, I hide the group box and
> then call adjustSize(); which does what I would expect, giving me
> the dialog without the group box, and sized down appropriately. I
> can then click a button in the dialog, which shows the group box
> thad resized the window larger to accommodate it. This all works as
> expected. However, if I then try to hide the group box again and run
> the adjust(); command, rather than giving me the smaller window
> again, the main window layout adjusts to fill the larger size
> window, even with the group box hidden, and refuses to go smaller
> (see attached screen shot). Attempts to manually adjust the window
> size smaller fail (although I can adjust larger easily enough), and
> adjusting the window size programatically (using the resize command)
> work, but hide portions of the content, specifically the ok/cancel
> buttons, as the layout refuses to go smaller. How can I fix this? or
> is there a better way to do what I am trying to do (hide and show a
> portion of the window content, while keeping the window at minimum
> height)? Thanks.
>
> -----------------------------------------------
> Israel Brewster
> Computer Support Technician
> Frontier Flying Service Inc.
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7250 x293
> -----------------------------------------------
Ok, after several aditional hours of googling, I finally found the
solution: I just needed to add the following line of code to my
constructor:
layout()->setSizeConstraint(QLayout::SetFixedSize);
Now, granted, this doesn't make a whole lot of sense to me, since I
don't necessarily want the dialog to be of a fixed size (although in
this particular case that works) but it does do the trick in resizing
the layout properly.
-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------
>
>
> <login.ui><BadLayout.png>
--
[ signature omitted ]
Message 3 in thread
My favourite trick for resizing widgets to the smallest possible size is to
try and resize it to something ridiculously small - like (10, 10). The layout
manager will make sure this doesn't actually go below the minimum size.
Of course, this is after I have tried "dialog->resize(dialog->minimumSize())".
Bo.
On torsdag den 3. Januar 2008, Israel Brewster wrote:
> I am using Qt 4.3.3 on Mac OS X 10.5.1. I designed a QDialog in the
> designer app (attached) which contains among other elements a group
> box. In the constructor for the dialog, I hide the group box and then
> call adjustSize(); which does what I would expect, giving me the
> dialog without the group box, and sized down appropriately. I can then
> click a button in the dialog, which shows the group box thad resized
> the window larger to accommodate it. This all works as expected.
> However, if I then try to hide the group box again and run the
> adjust(); command, rather than giving me the smaller window again, the
> main window layout adjusts to fill the larger size window, even with
> the group box hidden, and refuses to go smaller (see attached screen
> shot). Attempts to manually adjust the window size smaller fail
> (although I can adjust larger easily enough), and adjusting the window
> size programatically (using the resize command) work, but hide
> portions of the content, specifically the ok/cancel buttons, as the
> layout refuses to go smaller. How can I fix this? or is there a better
> way to do what I am trying to do (hide and show a portion of the
> window content, while keeping the window at minimum height)? Thanks.
>
> -----------------------------------------------
> Israel Brewster
> Computer Support Technician
> Frontier Flying Service Inc.
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7250 x293
> -----------------------------------------------
--
[ signature omitted ]
Message 4 in thread
On Jan 4, 2008, at 1:05 AM, Bo Thorsen wrote:
> My favourite trick for resizing widgets to the smallest possible
> size is to
> try and resize it to something ridiculously small - like (10, 10).
> The layout
> manager will make sure this doesn't actually go below the minimum
> size.
Oddly, though, that didn't work in this case. That was one of the
first things I tried- I did a dialog->resize to the width I wanted and
15 pixels high. And that's exactly what I ended up with- a dialog 15
pixels high and the width I wanted, cutting off all the contents. If I
then tried using the resize handle to resize the dialog, the dialog
would jump back up to the full size as shown in the original screen
shot, and refuse to resize any smaller- until the next time I ran the
code, at least.
Odder still, at least in my mind, is that the dialog->adjustSize()
command had the same effect of resizing the window to smaller than
it's contents (although not the extreme of 15 pixels that the resize
command gave me), at least in some iterations of my code. Actually,
the adjustSize command appeared to give me the size window I wanted -
unfortunately the contents of the window did not reflow to fit, so the
accept/cancel buttons were cut off. Manual adjustment using the resize
handle had the same effect as mention above.
The layout()->setSizeConstraint(QLayout::SetFixedSize); command does,
however, seem to fix the issue and produce the desired result, at
least in this instance, so I'll just run with that. Thanks :)
-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------
>
>
> Of course, this is after I have tried "dialog->resize(dialog-
> >minimumSize())".
>
> Bo.
>
> On torsdag den 3. Januar 2008, Israel Brewster wrote:
>> I am using Qt 4.3.3 on Mac OS X 10.5.1. I designed a QDialog in the
>> designer app (attached) which contains among other elements a group
>> box. In the constructor for the dialog, I hide the group box and then
>> call adjustSize(); which does what I would expect, giving me the
>> dialog without the group box, and sized down appropriately. I can
>> then
>> click a button in the dialog, which shows the group box thad resized
>> the window larger to accommodate it. This all works as expected.
>> However, if I then try to hide the group box again and run the
>> adjust(); command, rather than giving me the smaller window again,
>> the
>> main window layout adjusts to fill the larger size window, even with
>> the group box hidden, and refuses to go smaller (see attached screen
>> shot). Attempts to manually adjust the window size smaller fail
>> (although I can adjust larger easily enough), and adjusting the
>> window
>> size programatically (using the resize command) work, but hide
>> portions of the content, specifically the ok/cancel buttons, as the
>> layout refuses to go smaller. How can I fix this? or is there a
>> better
>> way to do what I am trying to do (hide and show a portion of the
>> window content, while keeping the window at minimum height)? Thanks.
>>
>> -----------------------------------------------
>> Israel Brewster
>> Computer Support Technician
>> Frontier Flying Service Inc.
>> 5245 Airport Industrial Rd
>> Fairbanks, AK 99709
>> (907) 450-7250 x293
>> -----------------------------------------------
>
>
>
> --
>
> Thorsen Consulting ApS - Qt consulting services
> http://www.thorsen-consulting.dk
>
> --
> 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 ]