Ok I can now demonstrate my problem - In my class I have TabWidgetTest::TabWidgetTest(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this);
m_dockWidgets.append(new QDockWidget("Dock 1",this)); m_dockWidgets.last()->setWidget(new Dock1Content(this)); addDockWidget(Qt::BottomDockWidgetArea,m_dockWidgets.last()); m_dockWidgets.last()->setAllowedAreas(Qt::BottomDockWidgetArea); m_action1 = m_dockWidgets.last()->toggleViewAction(); m_action1->setData(0); connect(m_action1,&QAction::toggled,this,&TabWidgetTest::onViewToggled); m_dockWidgets.append(new QDockWidget("Dock 2",this)); m_dockWidgets.last()->setWidget(new Dock2Content(this)); addDockWidget(Qt::BottomDockWidgetArea,m_dockWidgets.last()); m_dockWidgets.last()->setAllowedAreas(Qt::BottomDockWidgetArea); m_action2 = m_dockWidgets.last()->toggleViewAction(); m_action2->setData(1); connect(m_action2,&QAction::toggled,this,&TabWidgetTest::onViewToggled); tabifyDockWidget(m_dockWidgets[0],m_dockWidgets[1]); } In the slot I have { QList<QTabBar*> tabBarList = findChildren<QTabBar*>(); QTabBar* tabBar = NULL; if (!tabBarList.isEmpty()) { tabBar = tabBarList.at(0); qDebug() << "Count = " << tabBar->count(); } else { qDebug() << "No tab bar"; } QAction* action = dynamic_cast<QAction*>(sender()); if (action) { int data = action->data().toInt(); qDebug() << checked << " " << data; } qDebug() << ""; // m_dockWidgets[data]->raise(); //} } When the slot is called the tabbed widget that is to be added has not yet been added to the tab bar. and I cannot see a way of catching when a widget has been added to the tab bar. Is there a way in which this can be achieved? Thanks -----Original Message----- From: interest-bounces+graham.labdon=avalonsciences....@qt-project.org [mailto:interest-bounces+graham.labdon=avalonsciences....@qt-project.org] On Behalf Of Paul Miller Sent: 24 July 2014 14:49 To: interest@qt-project.org Subject: Re: [Interest] Tabbed Dock Widgets On 7/24/2014 5:29 AM, Graham Labdon wrote: > Hi > In my application I have a set of docked widgets that are all tabbed. > I have a menu to which I have added the action associated with the docked > widget that enables me to toggle the viability of the widgets. This all works > fine except for one niggle. > Say I have 2 out of 3 of my widgets on display and then use the menu to make > a 3rd visible. The 3rd widget does get added to the tabbed set of widgets but > is not made the current tab. > > Does anyone have any hints on how I can make it the current tab Are you calling raise() on it once you add it? _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest