PDA

View Full Version : QTabWidget: how to force "no current widget"?



mattc
13th May 2009, 11:33
Hello,
I have a set of QTabWidgets and I am trying to force only one "current" tab across the multiple QTabWidgets. In order to do this, I need a way to deselect all the tabs in the "inactive" QTabWidgets. How can I do this?

I tried setCurrentIndex(-1) and setCurrentWidget(0) but got no results. Incidentally, I noticed that removing the current tab from a QTabWidget leaves no current widget (that's good)... but I don't want to remove the current tab. Anything better then adding and removing a fake tab?

I am using Qt 4.5.0 on Vista sp1 + VS 2008 sp1.

Thanks.

aamer4yu
13th May 2009, 12:09
I have a set of QTabWidgets and I am trying to force only one "current" tab across the multiple QTabWidgets
Why dont you combine all the tabs from multiple tabwidgets into one QTabWidget ???

mattc
13th May 2009, 12:19
Because I need data from different QTabWidgets pages to be visible at the same time.

talk2amulya
13th May 2009, 12:44
could you explain your use case a little better..maybe there are better solutions for it

mattc
13th May 2009, 13:18
Well, it's a kind of MDI interface.

I need multiple documents displayed at the same time, but only one must be "current", so when you click a button on the toolbar you know what the target object is. Regularly tabbed documents are welcome as well, because you don't need ALL the documents visibile ALL the time. You can store them for later perusal.

For those of you who are familiar with wxWidgets, I am trying to mimic a subset of the functionality you can find in the "wxAUINotebook" control, where you can split the tab control, drag and drop tabs across multiple tab controls, detach and attach them, but only one tab is current at any given time.