[Qt-interest] any elegant to handle toolbar visibility?

Ross Bencina rossb-lists at audiomulch.com
Thu Jul 7 20:59:34 CEST 2011


Hi Alex

The question seems clear to me. I'm not sure if it's a bug that when the 
main window is hidden its undocked widgets remain visible -- this seems like 
a bug to me though.

I would say fixing the bug is one reasonable solution. Anything else, seems 
to me is going to involve some level of "customize saving and/or loading 
widget states routine" although that might not be too bad:

save current dock widget state using Qt routinces
store list of visible undocked windoids
hide undocked windoids

(switch views)

show undocked windoids from stored list
restore dock widget state using Qt routines


Note that if you name your dock widget objects carefully it is not too hard 
to write a compact routine that iterates all child dock widgets of a parent, 
and writes their names to a QStringList (which can then be persisted) and 
can be used to reload them too.

Ross.


----- Original Message ----- 
From: "Malyushytsky, Alex" <alex at wai.com>
To: <qt-interest at qt.nokia.com>
Sent: Friday, July 08, 2011 4:34 AM
Subject: Re: [Qt-interest] any elegant to handle toolbar visibility?


> Is problem description unclear or nobody can see better way to do it?
>
> Alex
>
> -----Original Message-----
> From: qt-interest-bounces+alex=wai.com at qt.nokia.com 
> [mailto:qt-interest-bounces+alex=wai.com at qt.nokia.com] On Behalf Of 
> Malyushytsky, Alex
> Sent: Tuesday, July 05, 2011 6:08 PM
> To: qt-interest at qt.nokia.com
> Subject: [Qt-interest] any elegant to handle toolbar visibility?
>
> My application uses multi-view design. Each view is a QMainWindow 
> subclass.
> Different views display different menus/toolbars/docking widgets.
> Which view to display is define by QStackWidget (and some logic behind 
> it).
>
> Desired behavior is to show only specific for current QMainWindow 
> toolbars/docking widgets.
> Unfortunately even when QMainWindow is hidden (even if I hide it 
> explicitly ) floating widgets are still shown.
>
> I definitely could hide them manually when current index of stacked widget 
> is changed,
> but then you need to make it visible (if it was not manually hidden, which 
> has to be tracked somewhere ). Also this requires customize saving and/or 
> loading widget states routine, cause
> wrong visibility flag will be written.
>
> As a quick and dirty trick I disable toolbars and docking widgets of the 
> hidden view.
> But I still prefer visibility of toolbars/docking widgets being toggled.
>
> To be fair I would expect child widgets to be hidden automatically if 
> their parent is hidden, even if they are undocked. Unfortunately it does 
> not work this way.
>
> Anybody see any elegant solution?
>
> Thanks in advance,
>
>        Alex Malyushytsky
>
>
> ---------------------------------------------------------------------------------------------------
> Weidlinger Associates, Inc. made the following annotations.
>
> “This message and any attachments are solely for the intended recipient 
> and may contain confidential or privileged information. If you are not the 
> intended recipient, any disclosure, copying, use, or distribution of the 
> information included in this message and any attachments is prohibited. If 
> you have received this communication in error, please notify us by reply 
> e-mail and immediately and permanently delete this message and any 
> attachments. Thank you.”
>
> “Please consider our environment before printing this email.”
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
> 




More information about the Qt-interest-old mailing list