Results 1 to 3 of 3

Thread: QDockWidget -> Reset all

  1. #1
    Join Date
    Oct 2010
    Posts
    95
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question QDockWidget -> Reset all

    Hi,

    I have several QDockWidgets in my app. But I have closed one of them !

    Now, when I restore the state it does not appear. The problem is that I don't know how to reset my layout and force to redisplay the docking widget !

    Do you have an idea ?

    Thks

  2. #2
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDockWidget -> Reset all

    Quote Originally Posted by pl01 View Post
    Now, when I restore the state it does not appear. The problem is that I don't know how to reset my layout and force to redisplay the docking widget !
    I have a reset all feature in my application to, among other things, address the kind of problem you came across. Here is what I currently use:

    Qt Code:
    1. if( QMessageBox::question(this, qApp->applicationName(),
    2. tr("You are about to reset <strong>all</strong> of your user settings. Are you sure that this is what you want?"),
    3. QMessageBox::Yes|QMessageBox::No,
    4. QMessageBox::Yes) == QMessageBox::Yes ) {
    5. // Clear all the user settings and restart <APP> (indeed, a restart
    6. // will ensure that the various dock windows are, for instance, properly
    7. // reset with regards to their dimensions)
    8.  
    9. QSettings(qApp->applicationName()).clear();
    10.  
    11. // Restart <APP>, but without providing any of the argument with which
    12. // <APP> was originally started, since we indeed want to reset
    13. // everything
    14.  
    15. QProcess::startDetached(qApp->applicationFilePath(), QStringList(),
    16. qApp->applicationDirPath());
    17.  
    18. // Quit <APP>
    19. // Note: the closeEvent method won't get called and this is exactly what
    20. // we want, since we don't want to save <APP>'s settings
    21.  
    22. qApp->quit();
    23. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Oct 2010
    Posts
    95
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDockWidget -> Reset all

    Thanks,

    The problem is that I don't want to restart the application !

    If I do this :

    addDockWidget(static_cast<Qt:ockWidgetArea>(1), ui.dockWidget_left);
    ui.dockWidget_left->raise();
    ui.dockWidget_right->setFloating(false);
    ui.dockWidget_left->show();

    Everything works... I only redisplay them as docked at the default place.

    Thanks for your help

Similar Threads

  1. Replies: 1
    Last Post: 7th December 2010, 21:46
  2. Replies: 1
    Last Post: 9th February 2010, 12:11
  3. Bug in Qt4.3.3 QXmlSimpleReader::reset() ?
    By Shawn in forum Qt Programming
    Replies: 9
    Last Post: 3rd March 2008, 09:14
  4. reset QwtPlot
    By sarefo in forum Qwt
    Replies: 1
    Last Post: 24th January 2008, 08:00
  5. QImage reset
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2007, 10:18

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.