Am Dienstag 05 Oktober 2010, 13:42:45 schrieb Knacktus: > I think I need to identify the QDockWidget, which had focus when I > pressed the button. I've tried the following approaches: > > 1) qApp.hasFocus() in my "expand_all()" method --> didn't work, gives > the focus of the button I pressed
Right, so in the moment you press the button, it first gets focus. Makes sense. You can still add QActions with shortcuts in order to expand a specific treeview, but this is too late to get the focus. So either you follow Hans-Peters suggestion and remember which of the treeviews *last* had the focus, or you add one such button into every dockwidget. Looking from even farther away, you might also expand the views by default, or add the above-mentioned actions to the dock widgets' (or treeviews') context menus. (BTW: this is particularly easy with dockWidget.addAction(...) dockWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu).) HTH, Hans _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt