Results 1 to 20 of 27

Thread: Coin3d + Qt: SIGLNALs and SLOTs

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    43
    Thanked 3 Times in 3 Posts

    Default Re: Coin3d + Qt: SIGLNALs and SLOTs

    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.
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Coin3d + Qt: SIGLNALs and SLOTs

    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

  3. #3
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    43
    Thanked 3 Times in 3 Posts

    Default Re: Coin3d + Qt: SIGLNALs and SLOTs

    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)

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Coin3d + Qt: SIGLNALs and SLOTs

    No, I said "wrapper functions" - signals and slots.

  5. #5
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    43
    Thanked 3 Times in 3 Posts

    Default Re: Coin3d + Qt: SIGLNALs 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.