X-man,
Sorry but I'm at work athe moment so I can't give you a "tested" response, but I can give you something to work on during the day. I can break your problem into two peices
1. How do I connect the signals and slots.
2. How do I share a scenegraph.
The first is relatively straightforward - I'll outline 3 options, but for now I'd recommend the first as it should be the easiest to implement and test.
a) Alter your Window2 constructor to take a Window pointer, and cache it in a Window2 member variable - perhaps call it "partnerWindow". From the top down in main.cpp you'd see something like
Window *window = new Window();
Window2 *window2 = new Window2(window);
window->show();
window2->show();
Window *window = new Window();
Window2 *window2 = new Window2(window);
window->show();
window2->show();
To copy to clipboard, switch view to plain text mode
Now you can connect public slots and signals between the two windows in your Window2 constructor - or another method.
b) Connect the signals and slots statically in main.cpp with fully qualified QObject::connect(.....) methods - you have pointers to both objects here.
c) Build a new proxy "controller" class and use this to sychronise events between the 2 windows.
The next piece needs some testing, but in essence what you can do is to expose the scenegraph root node in window.cpp/h via a public getSceneGraph() function. In option a) this can be accessed directly from the new classmember (partnerWindow) - in options c) and b) you might need a corresponding setSceneGraph(...) exposed in Window2. Both set/getSceneGraph will actually need to be wrappers for the enclosed Model objects which will also need amending . Now you should be able to set the Window's Model scenegraph as the root node of the Model in Window2 - what happens next I can't tell. I'll try it myself tonight.
You can post the code to "peter at dolbey dot freeserve dot co dot uk" - with the usual replacements.
Pete
Bookmarks