[Qt-interest] Tab Positions QDockWidgets Show/Hide not remembered! Can't get active tab either!

velociraptor Genjix aphidia at hotmail.com
Tue Oct 26 15:29:44 CEST 2010


Can Qt add a QMainWindow::setDockAreaVisible(Qt::DockWidgetArea area, bool visible) to their API?

Looking at:

http://qt.gitorious.org/qt/qt/blobs/4.7/src/gui/widgets/qdockarealayout_p.h

It looks like a trivial change:
add to 

class QDockAreaLayout
{
  QDockAreaLayoutInfo hiddenDocks[4];  // hidden dock windows
  bool dockHidden[4];  // initialise to false, false, false, false on initialiser
};
QDockAreaLayout::setVisible(QInternal::DockPosition pos, bool visible)

if (!visible) {
  // copy
  hiddenDocks[pos] = docks[pos];
  dockHidden[pos] = true;
  // clear the dock widget area
  docks[pos].clear();
} else {
  docks[pos] = hiddenDocks[pos];
}
  

And add to QMainWindow::setVisible(area, bool) which does:
  layoutState.dockAreaLayout.setVisible(toDockPos(area), bool);
  invalidate();

Hiding/showing a sidepanel is such a common use-case :) This is a really needed feature.

----------------------------------------
> From: aphidia at hotmail.com
> CC: qt-interest at trolltech.com
> Date: Tue, 26 Oct 2010 09:43:27 +0000
> Subject: [Qt-interest] Tab Positions QDockWidgets Show/Hide not remembered! Can't get active tab either!
>
>
> Hey,
>
>
>
> C++ example (run qmake/make):
> http://www.qtcentre.org/attachment.php?attachmentid=5397&d=1288020905
>
>
>
> I'm trying to make a QDockWidget area that rolls in and out when the user mouse-overs.
> To do that I getting all the dock widgets from the window by
> window.findChildren() 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.
>
>
> If I try to restore the active tab manually then I run into a problem- QDockWidgets uses 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? QDockWidget doesn't use QTabWidget 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).
>
> What can I do here?
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
 		 	   		  



More information about the Qt-interest-old mailing list