Results 1 to 15 of 15

Thread: Floating QDockWidget not re-docked by QMainWindow::restoreState

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Floating QDockWidget not re-docked by QMainWindow::restoreState

    Looks like a bug to me too. But what do we know? Here is the info in the docs for the latest Qt version.

    One thing I did notice is (using your scenario):
    • Call QMainWindow::saveState on a main window with two docked QDockWidgets which are nested/tabbed
    • Float one of the nested/tabbed QDockWidgets, i.e. one will be docked and the other floating
    • Call QMainWindow::restoreState - doesn't work.

    If you then click the float button (or double click on the top bar) the floating widget will return to tabbed mode. So the app is retaining the information about the previous location of the floated tab. Apparently "saveState()" doesn't return that information to "QSettings.setValue".

    I've never filed a bug report either. I'd appreciate it if you'd post back about what happens.
    Last edited by norobro; 4th March 2010 at 00:53. Reason: Correct bad link

  2. #2
    Join Date
    Feb 2010
    Location
    Sydney, Australia
    Posts
    111
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Floating QDockWidget not re-docked by QMainWindow::restoreState

    I get the same behaviour on my side when double clicking the QDockWidget titlebar.

    I'll go one step further though and say that it's not the previous state that is being "remembered" by the application. I think the application has the correct state stored for the QDockWidget, but it just isn't applying the "float" property correctly. I suspect this because I'm building an app that has a layout manager allowing the user to save an arbitrary number of layouts (or QMainWindow states) and then restore them from a list in the menu. When switching back to a layout that has tabbed QDockWidgets, the floating ones aren't restored (a la this bug), but double clicking their title bars does restore them correctly. So the app knows where they should be placed (i.e. QMainWindow state was actually restored correctly), but maybe just doesn't call QDockWidget::setFloating correctly.

  3. #3
    Join Date
    Feb 2010
    Location
    Sydney, Australia
    Posts
    111
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Floating QDockWidget not re-docked by QMainWindow::restoreState

    Bug already logged (http://bugreports.qt.nokia.com/browse/QTBUG-7921). Would be great if some of you could vote for it to get fixed!

  4. #4
    Join Date
    Mar 2013
    Posts
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Floating QDockWidget not re-docked by QMainWindow::restoreState

    Floating dock widget problem still exists in Qt 5.0.1 I found a workaround. After state restore do this:
    Qt Code:
    1. if(yourDockWidget->isFloating())
    2. {
    3. yourDockWidget->setFloating(true);
    4. }
    To copy to clipboard, switch view to plain text mode 
    And widget becomes dock able again.

Similar Threads

  1. QDockWidget saveState and restoreState
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 28th January 2016, 09:56
  2. how to hide the title bar when a QDockWidget is docked?
    By oscar721 in forum Qt Programming
    Replies: 5
    Last Post: 23rd January 2014, 20:16
  3. QMainWindow ignores dynamically created, floating QDockWidget
    By stefanadelbert in forum Qt Programming
    Replies: 1
    Last Post: 2nd March 2010, 01:06
  4. QMainWindow : restorestate problems
    By fmariusd in forum Qt Programming
    Replies: 10
    Last Post: 30th October 2009, 08:05
  5. QMainWindow::restoreState
    By EnErGy[CSDX] in forum Qt Programming
    Replies: 3
    Last Post: 15th September 2008, 00:49

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.