PDA

View Full Version : dockable widgets (in mainwindow) with common shortcut not working



h123
10th June 2009, 11:51
Hi,
It seems that if more than one dockwidgets are shown in main window then the shortcut set for the dockwidget's pushbutton is not working.
Pl. find the attached dockwidgets.tar.gz qt-example program, here I have attached "Esc" key to close button of both 'Customers' and 'Paragraphs' dockwidgets.
Here I want to dismiss the docked widget when I press the "Esc" key. This is working fine if one dock widget is shown (and also when dock widgets are undocked from the mainwindow) but fails if two dockwidgets are shown in mainwindow.
Thank you.

h123
11th June 2009, 12:50
Any suggestion please.
Thank you.

mchara
31st July 2009, 09:18
It's because qt doesn't know which dock widget it should close(if dockwidgets are undocked shortcut for dockwidget with focus is activated and if you have only one widget visible there's also no shortcuts conflict).
You should set some global 'esc' shortcut (see QShortcut) and close dockwidgets with some priority there(if more that one are visible and docked to same main window), or see QShortcut::activatedAmbiguously () signal or QShortcutEvent.