[Qt-interest] Getting a Dockwidget to fill all available space in a Main Window
Jens
linucks42 at gmail.com
Mon Jan 19 15:57:15 CET 2009
2009/1/18 Andreas Pakulat <apaku at gmx.de>:
> On 18.01.09 10:16:24, Jens wrote:
>> Hello,
>>
>> I've just started playing around with Qt (I'm working in Python, so
>> I'm actually using PyQt) and am extremely impressed with it. However,
>> I've hit a problem that I think should be very simple to solve, but
>> has me stuck.
>>
>> I'm implementing a text editor as a Dockwidget, so that I can have a
>> number of different editors open at the same time in the same main
>> window.
>>
>> When the app is first started with a single text editor in the main
>> wiindow, I'd like the editor widget to expand to fill all the
>> available space in the main window, regardless of the size that the
>> main window is.
>>
>> Is there a simple way to do this?
>
> AFAIK there's not even a complex way to do this, its simply not how
> QMainWindow has been designed. The only way to do this is copy
> QMainWindow's code, remove the code that deals with the central widget and
> hope that the rest still works.
>
> QMainWindow is for arranging toolviews (the dockwidgets) that provide tools
> to work with whatever cental widget you have.
>
> Andreas
>
Hi,
Thanks for the responses Andreas and Jose.
I'd looked at the QMdi framework, but I really like the way that the
dock windows can be floated free of the main window and can be grouped
together under a tab - it seems a really helpful way of working when
you have lots of separate windows open.
I guess I could get QMdi to emulate that behaviour, but as the
dockwidget already does almost everything I want I was hoping to be
able to use that.
Thanks again for the responses.
Best wishes,
Jens
More information about the Qt-interest-old
mailing list