From kde-devel Sun Jan 28 18:39:18 2007 From: David Jarvie Date: Sun, 28 Jan 2007 18:39:18 +0000 To: kde-devel Subject: Adding KActionCollection to a window Message-Id: <200701281839.18808.lists () astrojar ! org ! uk> X-MARC-Message: https://marc.info/?l=kde-devel&m=117001066327063 In KDE 4 code, I can't get actions to apply to a whole dialog window - they only happen after clicking on a particular widget within the window. The dialog is subclassed from KDialog. Its constructor contains the following relevant code: KActionCollection* actions = new KActionCollection(this); actions->setAssociatedWidget(topLevelWidget()); actions->addAssociatedWidget(mListView); KStandardAction::selectAll(mListView, SLOT(selectAll()), actions); KStandardAction::deselect(mListView, SLOT(clearSelection()), actions); where mListView is a QTreeView widget contained within the dialog widget. When I click inside the QTreeView, the standard shortcuts ctrl-A and shift-ctrl-A work to (de)select view items. But the shortcuts don't work when the KDialog widget has focus without first clicking in the view. How can I get the shortcuts to apply to the window as a whole? -- David Jarvie. KAlarm author and maintainer. http://www.astrojar.org.uk/linux/kalarm.html >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<