[PyQt] QDockWidget sizing behavior

John Wiggins jwiggins at enthought.com
Tue Oct 12 00:32:39 BST 2010


Wow, I feel daft now :) Thanks for the sharp gaze Baz. I'll look through the
more complicated code that this example is based on and see if the problem
was really this dumb...

- John

On Mon, Oct 11, 2010 at 6:04 PM, Baz Walter <bazwal at ftml.net> wrote:

> On 11/10/10 15:17, John Wiggins wrote:
>
>> Hello,
>>
>> I'm laying out part of the UI for my app using a QMainWindow with no
>> central
>> widget and 4 dock widgets. I'd like the dock widgets to be sized
>> proportionally to each other but they seem to ignore the value returned by
>> sizeHint(). Am I missing something?
>>
>> - John
>>
>> Here's a concrete example illustrating my problem:
>>
>
> [snip]
>
>
>      def createDockWindows(self):
>>         dock1 = self.createDockWidget("Dock1", (0.5, 0.75))
>>         self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock1)
>>         dock2 = self.createDockWidget("Dock2", (0.5, 0.75))
>>         self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, dock2)
>>         dock3 = self.createDockWidget("Dock3", (0.5, 0.25))
>>         self.splitDockWidget(dock2, dock3, QtCore.Qt.Horizontal)
>>         dock4 = self.createDockWidget("Dock4", (0.5, 0.25))
>>         self.splitDockWidget(dock1, dock4, QtCore.Qt.Horizontal)
>>
>
> this makes no sense: how can the top dock area and the bottom dock area
> *both* have 75% of the height?
>
> change dock2 to (0.5, 0.25), and dock4 to (0.5, 0.75), and it should work
> correctly (well, it does for me using qt4.7, anyway).
>
> (nb: and don't forget to disable your restoreLayout method before trying :)
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101011/4d74665a/attachment.html>


More information about the PyQt mailing list