Results 1 to 4 of 4

Thread: QDockWidget gets hidden when closing application

  1. #1
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    229
    Thanks
    2
    Thanked 29 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QDockWidget gets hidden when closing application

    Hello,
    I have a QMainWindow that holds a QDockWidget. On closing the app I want to save the visibility of the dock widget.

    When I close the app via the shortcut Alt + F4 odr via the x-Button in the upper-right corner the visibility of dock widget always is set to false. On the next application start the dock widget is not shown because the QSettings ini-file (where the settings of the app are stored) says "false" to the visibility of the dock widget.

    When I close the application via QCoreApplication::quit() the dock widget seems to stay visible right before the app is closed. On the next application start the dock widget is shown because the ini-file true"false" to the visibility of the dock widget.

    I am running the app solely on Win XP, so I have no idea if this is Windows specific behaviour for QDockWidget.

    I use QDockWidget::isHidden() to ask for the dock widgets visibility when quiting my app and to store the visibility.
    Any idea where this strange behaviour might come from, or how to store a dock widgets visibility?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QDockWidget gets hidden when closing application

    Try connecting your settings saving slot to the aboutToQuit () signal.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    229
    Thanks
    2
    Thanked 29 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDockWidget gets hidden when closing application

    This sadly does not help.
    The dock widget is still hidden "before" the signal aboutToQuit() is emitted .

  4. #4
    Join Date
    Feb 2010
    Location
    Hyderabad, India
    Posts
    15
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDockWidget gets hidden when closing application

    Override the closeEvent of the mainWindow to save your settings.

Similar Threads

  1. Replies: 6
    Last Post: 19th September 2016, 11:44
  2. QDockWidget : docking, reopening after closing
    By kghose in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2008, 20:22
  3. QDockWidget closing detection
    By danielperaza in forum Qt Programming
    Replies: 1
    Last Post: 16th April 2008, 15:28
  4. closing dialog in hidden main Widget
    By Lele in forum Qt Programming
    Replies: 3
    Last Post: 6th December 2006, 10:35
  5. Replies: 5
    Last Post: 10th May 2006, 00:20

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.