PDA

View Full Version : [OS X] Multiple QMainWindow instances, menubar problem



mchrk
29th December 2008, 11:29
Qt 4.5
OS X

I have two QMainWindow instances of the same class, I create them on the heap. No problem there. The QMainWindow have a tabbar with content from a file in each tab.
The problem is when I call "Open" from the menubar, then the first created window open the selected file. I have no idea how I can tell the difference of which window is calling "Open" and how to open the file in the second window.

Any ideas?

wysota
30th December 2008, 13:28
Is "Open" something OSX related or simply an action in your application? If you have two instances of the same main window class, you probably have to instances of the "Open" action as well, so it should be simple to determine which one was triggered by calling QObject::sender() from within a slot connected to its triggered() signal. Especially that the slot will be called on behalf of a particular instance of the window as well.