[PyQt] Resizing a DockWidget?
Darryl Wallace
darryl.wallace at prosensus.ca
Wed Jan 21 15:02:52 GMT 2009
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
>
>
More information about the PyQt
mailing list