Results 1 to 7 of 7

Thread: how to embed Coin3d window in Qt application?

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

    Default how to embed Coin3d window in Qt application?

    I've created a very simple Qt application with a few pushButtons. I now need to embed a Coin3d (OpenInventor) window inside my Qt application. I've gotten a couple pointers on how to do this from folks on a Coin3d forum, but I'm running into some problems.

    My code includes a

    #include <Inventor/Qt/SoQt.h>

    header which wasn't found until I edited the vsvars32.bat file. (should I have done this?) Now, however, I'm receiving the following error message:

    C:\coin3d\include\Inventor\Qt\SoQtBasic.h(130) : fatal error C1189: #error : Define either SOQT_DLL or SOQT_NOT_DLL as appropriate for your linkage!

    I'm using MSVC++ 2005 Express to compile: qmake -project ; qmake ; nmake in the Visual Studio 2005 Command Prompt. Given the inclusion of extraneous/non-Qt stuff, do I need to go about compiling this differently? ...edit one of the Makefiles or use additional arguments when running qmake?

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

    Default Re: how to embed Coin3d window in Qt application?

    No, all you have to do is define of the two, depending if you want to use SOQt as dll , or as static lib.

    Either way, all you have to do is to open the project properties dialog ( in Visual Studio ), and add SOQT_DLL or SOQT_NOT_DLL to C/C++->Preprocessor->Preprocessor definitions.

    And that's it. Should work fine now.
    Last edited by marcel; 1st May 2007 at 19:15.

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

    Default Re: how to embed Coin3d window in Qt application?

    Quote Originally Posted by marcel View Post
    Either way, all you have to do is to open the project properties dialog ( in Visual Studio ), and add SOQT_DLL or SOQT_NOT_DLL to C/C++->Preprocessor->Preprocessor definitions.
    this is how I've done it, when building a Coin/OpenInventor executable. However, with Qt I am not using MSVC++ gui/menus, etc... just the MSVC command prompt and:

    qmake -project
    qmake
    nmake

    so there is no project (or project properties dialog) for me to set the Preprocessor definitions.
    Last edited by vonCZ; 2nd May 2007 at 08:27.

  4. #4
    Join Date
    Nov 2006
    Location
    Shrewsbury, UK
    Posts
    97
    Thanks
    3
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to embed Coin3d window in Qt application?

    Here's a bare bones project for a SoQtExaminerViewer. I assume you've qtwin'd yoyr Qt environment.

    Before using this create an environment variable called COINDIR to point to yoyr Coin3d environment - mine is set to F:\Coin3d. Also add "%COINDIR%\bin" to your system path.

    Expand the 2 files and open a "cmd" prompt in the folder. Run

    "qmake -tp vc"

    This will create file Coin3d.vcproj - load this into VS2005. Build the exe - you'll be asked to save the Coin3.sln file first. Enjoy the viewer.

    You should be able to use this as a template. Even though I develop and debug in VS2005, if I have any changes to configuration such adding as new file or DEFINES, I'll edit the .pro file and regenerate the .vcproj as above - it ends being much simpler and more reliable to maintain.

    Pete
    Attached Files Attached Files

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

    Default Re: how to embed Coin3d window in Qt application?

    Awww Pete, you really got my hopes up, but I think you posted the wrong .zip file: the template you posted is a stand-alone Coin application with no Qt interface/widgets (except for the call to SoQt instead of SoWin). Do you/anyone have a simple Qt template program that includes a Coin render window? Something like the

    examples/opengl/hellogl

    program?

  6. #6
    Join Date
    Nov 2006
    Location
    Shrewsbury, UK
    Posts
    97
    Thanks
    3
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to embed Coin3d window in Qt application?

    The point of the zip file file was more to do with the managment of the compiler environment settings than the simple application itself. If you want an example of how to embed a Coin3d window into an application, head over to http://sourceforge.net/projects/free-cad and grab the source fron the SVN trunk. This is an application that renders a OpenCascade CAD model in a Coin3d window - the current SVN code is migrating from Qt3 to Qt4.

    You could try replacing the code in the main.cpp with the example shown in SoQtRenderArea at http://doc.coin3d.org/SoQt/classSoQtRenderArea.html.

    Pete
    Last edited by pdolbey; 3rd May 2007 at 14:28.

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

    Default Re: how to embed Coin3d window in Qt application?

    Quote Originally Posted by pdolbey View Post
    The point of the zip file file was more to do with the managment of the compiler environment settings than the simple application itself.
    oh, ok, thanks for that. I'm creating/opening Qt/Coin VS project files now, no problem.

    Quote Originally Posted by pdolbey View Post
    If you want an example of how to embed a Coin3d window into an application, head over to http://sourceforge.net/projects/free-cad and grab the source fron the SVN trunk.
    again, thanks. I downloaded the source and took a quick look: it's quite huge and difficult for me to follow--I'm completely new to Qt, Coin, and GUI programming in general--so I'll end with one last appeal: if anyone has a simple Qt app/demo which opens a SoQT/Coin window, please post.

Similar Threads

  1. accessing my main application window widget
    By jayw710 in forum Newbie
    Replies: 8
    Last Post: 15th November 2007, 19:33
  2. Independant window in an application
    By titoo in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2007, 11:07
  3. Embed a font in the application
    By Lele in forum Qt Programming
    Replies: 1
    Last Post: 26th October 2006, 09:47
  4. Replies: 1
    Last Post: 14th June 2006, 14:36
  5. Replies: 0
    Last Post: 21st February 2006, 16:30

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.