[PyQt] How to precisely control position/size of QDockWidgets
apaku at gmx.de
Tue Apr 22 18:13:41 BST 2014
On Tue, Apr 22, 2014 at 4:42 PM, rj_pyqt_qwzqfors <
rj_pyqt_qwzqfors at objectmail.com> wrote:
> I am rewriting a wxPython application in PyQt that needs to use several
> QDockWidgets. I am struggling to understand how to be able to precisely
> control their position and size.
> My program's layout contains two vertical dock windows and one horizontal
> one. I want the horizontal one to be between the vertical ones. But in
> PyQt, the horizontal one is underneath the vertical ones, and goes the
> whole way across the screen. I cannot figure out how to change this. I have
> attached a screenshot showing what I mean.
QMainWindow.setCorner() allows you to specify which dock area should take
the corner, so specify that the vertical ones use the bottom corner.
> I also cannot figure out how to specify the default width of height of the
> dock windows. Could someone please help me with this?
That is computed by the layout of the dockwidget content widget and that
way recursively up to the individual controls being part of the dock
widget. Each control provides a sizeHint, usually bound to the content of
the control (a button ensures its big enough for its text). Along with the
layout logics and the size policies this determines how much space Qt
acquires for the dock widget by default. In most cases these calculations
make for a pretty good default size. Can you show a comparison that
indicates what is wrong with that in your case? The one you already sent
does not seem to have anything wrong with the sizes in the Qt version.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt