Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, April 2007
Detecting docked state of two overlapping QDockWidgets ?


Message 1 in thread

I have two QDockWidget-derived controls.

When I drag one onto the other, they dock them in two different ways 
depending on where I do the drop:
1. stacked
2. overlapping

Overlapping automatically creates a tab control and allows me to click 
between the two QDockWidget controls.

My question:
How can I detect the details of these two docked configurations so I can 
save them to my QSettings object?  I want the application to restart 
with the same docked configuration.

Thanks
Mark


-- 
 [ signature omitted ] 

Message 2 in thread

Mark Thompson wrote:
> 
> I have two QDockWidget-derived controls.
> 
> When I drag one onto the other, they dock them in two different ways 
> depending on where I do the drop:
> 1. stacked
> 2. overlapping
> 
> Overlapping automatically creates a tab control and allows me to click 
> between the two QDockWidget controls.
> 
> My question:
> How can I detect the details of these two docked configurations so I can 
> save them to my QSettings object?  I want the application to restart 
> with the same docked configuration.

Just use QMainWindow::saveState() and restoreState(). It will store 
everything for you, including toolbar locations, etc.

-- 
 [ signature omitted ] 

Message 3 in thread

Hi Paul,
Thanks QMainWindow::saveState() worked.

One question:  When the two QDockWidgets are docked in an overlapping 
configuration, Qt overlays them with a tab control.  I suppose the 
parenting of the QDockWidget is dynamically changed from the QMainWindow 
to a new tab control as one docks it?

How can I programatically get access to this tab control?

The reason is when something interesting happens on the hidden tab (for 
the QDockWidget that is "behind"), I need to bring it to the 
foreground.  If I had a pointer to the tab control, I suppose I could 
use setCurrentIndex(index).   I tried setFocus(), show(), and 
setWindowState(Qt::WindowActive) for the QDockWidget and it did not 
bring it to the front.

Mark



Paul Miller wrote:
> Mark Thompson wrote:
>>
>> I have two QDockWidget-derived controls.
>>
>> When I drag one onto the other, they dock them in two different ways 
>> depending on where I do the drop:
>> 1. stacked
>> 2. overlapping
>>
>> Overlapping automatically creates a tab control and allows me to 
>> click between the two QDockWidget controls.
>>
>> My question:
>> How can I detect the details of these two docked configurations so I 
>> can save them to my QSettings object?  I want the application to 
>> restart with the same docked configuration.
>
> Just use QMainWindow::saveState() and restoreState(). It will store 
> everything for you, including toolbar locations, etc.
>

-- 
 [ signature omitted ] 

Message 4 in thread

You can use raise() on the QDockWidget.

Marc

qt-interest-request@xxxxxxxxxxxxx wrote on 21-04-2007 20:13:28:

> Hi Paul,
> Thanks QMainWindow::saveState() worked.
> 
> One question:  When the two QDockWidgets are docked in an overlapping 
> configuration, Qt overlays them with a tab control.  I suppose the 
> parenting of the QDockWidget is dynamically changed from the QMainWindow 

> to a new tab control as one docks it?
> 
> How can I programatically get access to this tab control?
> 
> The reason is when something interesting happens on the hidden tab (for 
> the QDockWidget that is "behind"), I need to bring it to the 
> foreground.  If I had a pointer to the tab control, I suppose I could 
> use setCurrentIndex(index).   I tried setFocus(), show(), and 
> setWindowState(Qt::WindowActive) for the QDockWidget and it did not 
> bring it to the front.
> 
> Mark
> 
> 
> 
> Paul Miller wrote:
> > Mark Thompson wrote:
> >>
> >> I have two QDockWidget-derived controls.
> >>
> >> When I drag one onto the other, they dock them in two different ways 
> >> depending on where I do the drop:
> >> 1. stacked
> >> 2. overlapping
> >>
> >> Overlapping automatically creates a tab control and allows me to 
> >> click between the two QDockWidget controls.
> >>
> >> My question:
> >> How can I detect the details of these two docked configurations so I 
> >> can save them to my QSettings object?  I want the application to 
> >> restart with the same docked configuration.
> >
> > Just use QMainWindow::saveState() and restoreState(). It will store 
> > everything for you, including toolbar locations, etc.
> >
> 
> -- 
> 
> ************************************
> Mark Thompson
> Seattle, WA
> http://www.arguslab.com
> mark@xxxxxxxxxxxx
> ************************************
> 
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx 
> with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>