[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Restoring default window configuration
From: |
Torsten |
Subject: |
Re: Restoring default window configuration |
Date: |
Tue, 30 Apr 2013 19:11:28 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 |
On 30.04.2013 09:06, Daniel J Sebald wrote:
> On 04/29/2013 04:41 PM, John W. Eaton wrote:
>> What is the proper way to restore the "factory default" window
>> configuration in the GUI without resetting all the current Qt settings?
>>
>> My attempt is here:
>>
>> http://hg.savannah.gnu.org/hgweb/octave/rev/e13051d7a472
>>
>> Does this look like a reasonable solution, or is there some better way
>> to do it?
>
> Looks reasonable but the cast that already existed in there is so-so.
> Seems like something that should be a level down, plus it's a
> QMainWindow and should have a list of QDockWidgets somewhere that is
> easily accessible, at least one would think that.
I am not aware of such a list but maybe findChildren would be a more
elegant solution (just found this one:
http://www.qtcentre.org/threads/22812-How-to-get-list-of-DockWidgets-in-QMainWindow).
>
> + if (floating)
> + widget->setWindowFlags (Qt::Window);
>
> There is this "setFloating" routine:
>
> http://qt-project.org/doc/qt-4.8/qdockwidget.html#floating-prop
>
> that might be the preferred route (since it exists...what else could it
> be for?).
setFloating only makes the dock widget a floating one which then always
stays on top of the main window and is not treated as an individual
window (with title bar, task bar entry, alt-tab etc.). The Qt::Window
flag is needed for that.
>
> This documentation makes it look too simple:
>
> http://qt-project.org/doc/qt-4.8/qmainwindow.html#restoreState
>
> Instead of individual QDockWidget restoreGeometry member functions, it
> uses the QMainWindow restoreGeometry member function.
I remember restoreState and restoreGemoetry of the main window did not
restore the correct sizes and (floating)-state of the dock widget in
every situation (fullscreen etc.). Thats why the loop over all dock
widget is necessary.
Torsten