How to precisely control position/size of QDockWidgets

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to precisely control position/size of QDockWidgets

rj_pyqt_qwzqfors
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.

I also cannot figure out how to specify the default width of height of the dock windows. Could someone please help me with this?

Thank you.

-- Timothy
_______________________________________________
PyQt mailing list    [hidden email]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

PyQt vs wxPython.png (114K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to precisely control position/size of QDockWidgets

Andreas Pakulat
Hi,

On Tue, Apr 22, 2014 at 4:42 PM, rj_pyqt_qwzqfors <[hidden email]> 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.

Andreas
 

_______________________________________________
PyQt mailing list    [hidden email]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt