[PyQt] Resizing a DockWidget?
Marc Nations
mnations.lists at gmail.com
Wed Jan 21 20:57:51 GMT 2009
Thanks for the link. I was able to get it working by placing all the widgets
in the dock widget into a container frame placed in a vertical layout. That
part done in Designer. Then in the application I place the custom lable
widget with reimplimented sizeHint function at the bottom as a blank field
so it just serves as a spacer with 0 height.
Marc
On Wed, Jan 21, 2009 at 9:02 AM, Darryl Wallace <darryl.wallace at prosensus.ca
> wrote:
> Try this:
> http://www.qtsoftware.com/developer/faqs/550
>
> Darryl
>
>
> Marc Nations wrote:
>
>> I'm trying to resize it while it is docked. The reason I'm trying to
>> resize it is because I want to adjust the default width of the form based on
>> how many other windows are currently open in the main application and how
>> big the monitor is. As a result, I won't know it's geometry until after the
>> application starts. The dock widget is hidden until the user decides to open
>> it. At the point it needs to know it's size.
>> So when you say it's going to take the shape of the space it's docked in,
>> I had assumed that using the resize() function would propagate upwards and
>> instruct the containing frame to redraw. Is that not the case?
>> As far as going the other direction and resizing the containing frame,
>> which would then force a resize on the dock widget, I'm not sure how to
>> reference the containing frame since the parent object is the main window.
>>
>> On Wed, Jan 21, 2009 at 8:16 AM, Darryl Wallace <
>> darryl.wallace at prosensus.ca <mailto:darryl.wallace at prosensus.ca>> wrote:
>>
>> Hello,
>>
>>
>> Marc Nations wrote:
>>
>> Hi,
>> I'm trying to resize a DockWidget after the application has
>> started. I have tried all of the functions that I thought
>> would resize it:
>> self.ui.dockWidget.setGeometry(x,y,w,h)
>> self.ui.dockWidget.resize(w,h)
>> I tried with QSize and QGeometry as well. I also tried using
>> the adjustSize() and a couple of others to see if it changed.
>> I tried to call show() after to see if it would help, but
>> nothing seems to work.
>> It flickers momentarily at the new size and pops back, so it
>> looks like it's being properly resizes and then something
>> resets it back to the original size. Is this the correct way
>> to resize the dock widget, and what is causing it to
>> immediately change again?
>>
>> Perhaps this is a silly question, but is it floating or is it
>> docked? If it's docked then it's going to take the shape of the
>> space in which it is docked. If it is docked, I am wondering why
>> you're trying to change it's shape.
>>
>> Darryl
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090121/9b7ece50/attachment-0001.html
More information about the PyQt
mailing list