View Full Version : QMdiArea, context menu for tabs
rtxleh
29th October 2009, 09:29
Got a QMdiArea in tabbed view.
When I right-click the tabs, a context menu with "restore" and "close" is shown.
How do I extend this menu with e.g. "close all"?
TMan
29th October 2009, 11:46
Take a look at the docs for QWidget::contextMenuEvent or QWidget::customContextMenuRequested. I think one of these will do the trick for you.
pejold
1st September 2011, 11:35
Exam:
QMdiArea *mdiArea = new QMdiArea(this);
QMdiAreaSubWindow *subWindow = mdiArea->addSubWindow(some_widget);
QMenu *menu = subWindow->systemMenu();
QAction *closeAll = new QAction(tr("Close All"),menu);
menu->addAction(closeAll);
connect(closeAll, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows()));
it should work.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.