In case a simple visual will help, here it is. Again, the problem is I don't know how to connect the SIGNAL from the slider, to the cone rotation.
In case a simple visual will help, here it is. Again, the problem is I don't know how to connect the SIGNAL from the slider, to the cone rotation.
I didn't look at the code yet, but the normal approach is to create wrappers in the classes that are liked to the signal and slot you want to connect.
For example if class A contains object obj1 and class B contains object obj2, then to connect a signal from obj1 to a slot in obj2:
obj1 signal -> class A slot -> class A signal -> class B slot -> obj2 slot.
Of course, this has to be done from a class that hass access to both A and B.
This you can do if you don't want to redesign too much.
Regards
First I should say: it is no problem at all to do a complete redesign. I think there is a simple solution, on how to connect a Qt widget to Coin geometry/fields/etc, I just don't know how to do it yet. (I think I said this before: Qt is awesome, with all the sample code to figure out how to do things. Coin on the other hand: almost nothing, not even a simple demo to integrate Coin & Qt.)
Do I understand you correctly: by "wrapper", do you mean create a new class that derives from both the Window and Model classes (the Qt widget and Coin geometry classes), and use functions from this class to access the Model fields? For example:
given:
qt _obj
model_obj
qt_obj signal -> WrapperClass slot -> function in WrapperClass updates field_value in model_obj (i.e. SoSFFloat xRot)
No, I said "wrapper functions" - signals and slots.
OK, Marcel, from what I gather you're talking standard SIGNALs and SLOTs stuff, right? So I need to be able to add SLOTs in my Model class.
but: my Model class (in "model.cpp") doesn't (and cannot?) have any SLOTs, because it derives only from a Coin3d class, "SoQtExaminerViewer". I want to put fields/variables in my Model class that are updated by input from Window-class SIGNALs. What is the best way to add them?? I must include the Q_OBJECT macro and, presumably, derive my Model class not only from the SoQtExaminerViewer class, but also from a Qt class. Which class should I choose? ...or is this even the right path?
Bookmarks