Results 1 to 4 of 4

Thread: Tab Positions QDockWidgets Show/Hide not remembered! Can't get active tab either!

  1. #1
    Join Date
    Oct 2010
    Posts
    37
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Tab Positions QDockWidgets Show/Hide not remembered! Can't get active tab either!

    Hey,

    C++ example (run qmake/make): dockcpp.zip
    Python PySide code: autohide_dock.py

    I'm trying to make a QDockWidget area that rolls in and out when the user mouse-overs (see the start of this video here). To do that I getting all the dock widgets from the window by window.findChildren<QDockWidget*>() and then doing w.setVisible(false) on all of them.

    Problem is that it has bugs. If you download, build and run the C++ example above then Qt selects the tab position selected before the current one, and then reselects the last one again and so forth.

    Problem is Qt provides no way to a) see the currently selected dock widget tab (so I cannot force it to be re-active).

    Are these 2 bugs? What can I do here?
    Last edited by genjix; 25th October 2010 at 20:22.

  2. #2
    Join Date
    Oct 2010
    Posts
    37
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Tab Positions QDockWidgets Show/Hide not remembered! Can't get active tab either!

    This might give you some idea about what I'm referring about:

  3. #3
    Join Date
    Oct 2010
    Posts
    37
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Tab Positions QDockWidgets Show/Hide not remembered! Can't get active tab either!

    I found the answer:
    http://developer.qt.nokia.com/faq/an...ed_qdockwidget

    EDIT: Or not. Spoke too soon. QDockWidgets use QTabBar but they don't use QTabWidget! So how am I meant to see which QDockWidget belongs to which QTabBar so I can restore the state?

    Here is my saving code (saving tab positions)
    Qt Code:
    1. # --------
    2. tabWidgetsAll = self.parent().findChildren(QTabWidget, None)
    3. # tab widgets which contain QDockWidget
    4. tabWidgets = []
    5. if len(tabWidgets) > 0:
    6. print 'yay'
    7. for w in widgets:
    8. for tab in tabWidgetsAll:
    9. if tab in tabWidgets:
    10. continue
    11. if tab.indexOf(w) != -1:
    12. tabWidgets.append(tab)
    13. for tab in tabWidgets:
    14. self.activeTabs.append((tab, tab.currentIndex()))
    To copy to clipboard, switch view to plain text mode 

    In that snippet 'yay' is never printed, indicating that no QTabWidget's exist and that QDockWidget doesn't use that for tabifying itself. Although it DOES use QTabBar and I'm able to reset the active tab using that (although I have no way to confirm which QTabBar belongs to which QTabWidget or if at all).

    And here is the restoration code:
    Qt Code:
    1. # --------
    2. for tab in self.activeTabs:
    3. tab[0].setCurrentIndex(tab[1])
    4. self.activeTabs = []
    To copy to clipboard, switch view to plain text mode 
    Last edited by genjix; 26th October 2010 at 09:41.

  4. #4
    Join Date
    Oct 2010
    Posts
    37
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Tab Positions QDockWidgets Show/Hide not remembered! Can't get active tab either!

    any ideas?

Similar Threads

  1. how to show an app if it manually hide
    By jthacker in forum Qt Programming
    Replies: 1
    Last Post: 26th March 2010, 13:02
  2. how to show and hide frames?
    By rambo83 in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2010, 09:53
  3. Hide and Show QMenu
    By febil in forum Qt Programming
    Replies: 3
    Last Post: 25th March 2009, 09:31
  4. hide from taskbar but show to ALT-TAB
    By musikit in forum Qt Programming
    Replies: 0
    Last Post: 15th August 2008, 16:14
  5. Show or hide a form
    By Gayathri in forum Newbie
    Replies: 11
    Last Post: 17th November 2006, 12:39

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.