Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QVTKOpenGLWidget - which library?
QtWS25 Last Chance

QVTKOpenGLWidget - which library?

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 3 Posters 6.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Christian Zemlin
    wrote on 3 Aug 2018, 13:57 last edited by
    #1

    Hi all,

    I am trying to integrate a VTK render window in a Qt GUI. Using QtCreator/Designer, I added an openGLWidget to the MainWindow and promoted it to QVTKOpenGLWidget. When I try to compile, the compiler does not find the header "QVTKOpenGLWidget.h". After I manually added this header to the project, the linker apparently does not find the right library and gives the error:

    /home/christian/InSync/Tmp/build-Viewer3D-Desktop_f4eeec-Debug/ui_mainwindow.h:42: error: undefined reference to `QVTKOpenGLWidget::QVTKOpenGLWidget(QWidget*, QFlags)'

    I added first the vtk libraries that appeared most likely to contain QVTKOpenGLWidget, later ALL vtk libraries, but the problem persists.

    In which library is the QVTKOpenGlWidget located?

    Also, if anyone could point me to an example project that uses QVTKOpenGLWidget, I would greatly appreciate it.

    I am using Qt 5.9.5 and VTK 7.1

    Thanks, Christian

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on 3 Aug 2018, 15:09 last edited by
      #2

      When using VTK, and/or ITK, it's much easier to include the correct directories and libraries if you use CMake/CMakeLists.txt for the configuration instead of .pro project files.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 3 Aug 2018, 20:36 last edited by
        #3

        Hi and welcome to devnet,

        QVTKOpenGLWidget is provided by VTK. You have examples over here that should help you get started.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        C 1 Reply Last reply 4 Aug 2018, 11:59
        0
        • S SGaist
          3 Aug 2018, 20:36

          Hi and welcome to devnet,

          QVTKOpenGLWidget is provided by VTK. You have examples over here that should help you get started.

          C Offline
          C Offline
          Christian Zemlin
          wrote on 4 Aug 2018, 11:59 last edited by SGaist 8 Apr 2018, 19:50
          #4

          @SGaist
          Thank you for the examples! One warning ahead: In the preview of this post it seems that the font is randomly set to large in some parts, this is not intended (I could not figure out how to prevent it).
          Trying the examples, I basically run into the same problem, so I am wondering if my VTK installation is OK.

          When I untar the BorderWidgetQt archive from the example and execute cmake from the "build" directory, I get:

          ==============
          christian@christian-white:~/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/build$ cmake ..
          -- The imported target "vtkRenderingPythonTkWidgets" references the file
             "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
          but this file does not exist.  Possible reasons include:
          * The file was deleted, renamed, or moved to another location.
          * An install or uninstall procedure did not complete successfully.
          * The installation package was faulty and contained
             "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
          but not all the files it references.
          
          -- The imported target "vtk" references the file
             "/usr/bin/vtk"
          but this file does not exist.  Possible reasons include:
          * The file was deleted, renamed, or moved to another location.
          * An install or uninstall procedure did not complete successfully.
          * The installation package was faulty and contained
             "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
          but not all the files it references.
          
          -- The imported target "pvtk" references the file
             "/usr/bin/pvtk"
          but this file does not exist.  Possible reasons include:
          * The file was deleted, renamed, or moved to another location.
          * An install or uninstall procedure did not complete successfully.
          * The installation package was faulty and contained
             "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
          but not all the files it references.
          
          -- Configuring done
          -- Generating done
          -- Build files have been written to: /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/build
          christian@christian-white:~/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/build$ 
          ==========================
          

          So there are some warnings (I don't know enough about cmake to judge how serious they are), but cmake still generates a Makefile. When I execute "make", I get:

          =============================
          christian@christian-white:~/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/build$ make
          [ 16%] Automatic MOC for target BorderWidgetQt
          
          AutoGen error
          -------------
            "/home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/QVTKOpenGLWidget.h"
          Could not read the header file: The file does not exist.
          
          CMakeFiles/BorderWidgetQt_autogen.dir/build.make:57: recipe for target 'CMakeFiles/BorderWidgetQt_autogen' failed
          make[2]: *** [CMakeFiles/BorderWidgetQt_autogen] Error 1
          CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/BorderWidgetQt_autogen.dir/all' failed
          make[1]: *** [CMakeFiles/BorderWidgetQt_autogen.dir/all] Error 2
          Makefile:83: recipe for target 'all' failed
          make: *** [all] Error 2
          christian@christian-white:~/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/build$ 
          ====================
          

          So it does not find the QVTKOpenGLWidget.h header file, I assume that is a bad sign. When I manually download that header file and put it in the source directory and repeat the make, I get:

          ==================
          christian@christian-white:~/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/build$ make
          [ 16%] Automatic MOC for target BorderWidgetQt
          [ 16%] Built target BorderWidgetQt_autogen
          [ 33%] Building CXX object CMakeFiles/BorderWidgetQt.dir/BorderWidgetQt.cxx.o
          /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx: In constructor ‘BorderWidgetQt::BorderWidgetQt()’:
          /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:37:49: error: no matching function for call to ‘QVTKOpenGLWidget::SetRenderWindow(vtkNew<vtkGenericOpenGLRenderWindow>&)’
             this->qvtkWidget->SetRenderWindow(renderWindow);
                                                           ^
          In file included from /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/build/ui_BorderWidgetQt.h:19:0,
                           from /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.h:9,
                           from /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:1:
          /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/QVTKOpenGLWidget.h:90:8: note: candidate: void QVTKOpenGLWidget::SetRenderWindow(vtkGenericOpenGLRenderWindow*)
             void SetRenderWindow(vtkGenericOpenGLRenderWindow* win);
                  ^~~~~~~~~~~~~~~
          /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/QVTKOpenGLWidget.h:90:8: note:   no known conversion for argument 1 from ‘vtkNew<vtkGenericOpenGLRenderWindow>’ to ‘vtkGenericOpenGLRenderWindow*’
          /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/QVTKOpenGLWidget.h:91:8: note: candidate: void QVTKOpenGLWidget::SetRenderWindow(vtkRenderWindow*)
             void SetRenderWindow(vtkRenderWindow* win);
                  ^~~~~~~~~~~~~~~
          /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/QVTKOpenGLWidget.h:91:8: note:   no known conversion for argument 1 from ‘vtkNew<vtkGenericOpenGLRenderWindow>’ to ‘vtkRenderWindow*’
          /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:45:38: error: no matching function for call to ‘vtkActor::SetMapper(vtkNew<vtkPolyDataMapper>&)’
             sphereActor->SetMapper(sphereMapper);
                                                ^
          In file included from /usr/include/vtk-7.1/vtkActorCollection.h:32:0,
                           from /usr/include/vtk-7.1/vtkRenderer.h:39,
                           from /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:8:
          /usr/include/vtk-7.1/vtkActor.h:144:16: note: candidate: virtual void vtkActor::SetMapper(vtkMapper*)
             virtual void SetMapper(vtkMapper *);
                          ^~~~~~~~~
          /usr/include/vtk-7.1/vtkActor.h:144:16: note:   no known conversion for argument 1 from ‘vtkNew<vtkPolyDataMapper>’ to ‘vtkMapper*’
          /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:49:33: error: no matching function for call to ‘vtkRenderer::AddActor(vtkNew<vtkActor>&)’
             renderer->AddActor(sphereActor);
                                           ^
          In file included from /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:8:0:
          /usr/include/vtk-7.1/vtkRenderer.h:76:8: note: candidate: void vtkRenderer::AddActor(vtkProp*)
             void AddActor(vtkProp *p);
                  ^~~~~~~~
          /usr/include/vtk-7.1/vtkRenderer.h:76:8: note:   no known conversion for argument 1 from ‘vtkNew<vtkActor>’ to ‘vtkProp*’
          /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:52:60: error: no matching function for call to ‘vtkRenderWindow::AddRenderer(vtkNew<vtkRenderer>&)’
             this->qvtkWidget->GetRenderWindow()->AddRenderer(renderer);
                                                                      ^
          In file included from /usr/include/vtk-7.1/vtkOpenGLRenderWindow.h:29:0,
                           from /usr/include/vtk-7.1/vtkGenericOpenGLRenderWindow.h:31,
                           from /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:5:
          /usr/include/vtk-7.1/vtkRenderWindow.h:96:16: note: candidate: virtual void vtkRenderWindow::AddRenderer(vtkRenderer*)
             virtual void AddRenderer(vtkRenderer *);
                          ^~~~~~~~~~~
          /usr/include/vtk-7.1/vtkRenderWindow.h:96:16: note:   no known conversion for argument 1 from ‘vtkNew<vtkRenderer>’ to ‘vtkRenderer*’
          /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:56:24: error: no match for ‘operator=’ (operand types are ‘vtkSmartPointer<vtkBorderWidget>’ and ‘vtkNew<vtkBorderWidget>’)
             this->BorderWidget = bw;
                                  ^~
          In file included from /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.h:4:0,
                           from /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:1:
          /usr/include/vtk-7.1/vtkSmartPointer.h:56:20: note: candidate: vtkSmartPointer<T>& vtkSmartPointer<T>::operator=(T*) [with T = vtkBorderWidget]
             vtkSmartPointer& operator=(T* r)
                              ^~~~~~~~
          /usr/include/vtk-7.1/vtkSmartPointer.h:56:20: note:   no known conversion for argument 1 from ‘vtkNew<vtkBorderWidget>’ to ‘vtkBorderWidget*’
          /usr/include/vtk-7.1/vtkSmartPointer.h:69:20: note: candidate: template<class U> vtkSmartPointer<T>& vtkSmartPointer<T>::operator=(const vtkSmartPointer<U>&) [with U = U; T = vtkBorderWidget]
             vtkSmartPointer& operator=(const vtkSmartPointer<U>& r)
                              ^~~~~~~~
          /usr/include/vtk-7.1/vtkSmartPointer.h:69:20: note:   template argument deduction/substitution failed:
          /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:56:24: note:   ‘vtkNew<vtkBorderWidget>’ is not derived from ‘const vtkSmartPointer<T>’
             this->BorderWidget = bw;
                                  ^~
          In file included from /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.h:4:0,
                           from /home/christian/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/BorderWidgetQt.cxx:1:
          /usr/include/vtk-7.1/vtkSmartPointer.h:29:7: note: candidate: vtkSmartPointer<vtkBorderWidget>& vtkSmartPointer<vtkBorderWidget>::operator=(const vtkSmartPointer<vtkBorderWidget>&)
           class vtkSmartPointer: public vtkSmartPointerBase
                 ^~~~~~~~~~~~~~~
          /usr/include/vtk-7.1/vtkSmartPointer.h:29:7: note:   no known conversion for argument 1 from ‘vtkNew<vtkBorderWidget>’ to ‘const vtkSmartPointer<vtkBorderWidget>&’
          /usr/include/vtk-7.1/vtkSmartPointer.h:29:7: note: candidate: vtkSmartPointer<vtkBorderWidget>& vtkSmartPointer<vtkBorderWidget>::operator=(vtkSmartPointer<vtkBorderWidget>&&)
          /usr/include/vtk-7.1/vtkSmartPointer.h:29:7: note:   no known conversion for argument 1 from ‘vtkNew<vtkBorderWidget>’ to ‘vtkSmartPointer<vtkBorderWidget>&&’
          CMakeFiles/BorderWidgetQt.dir/build.make:66: recipe for target 'CMakeFiles/BorderWidgetQt.dir/BorderWidgetQt.cxx.o' failed
          make[2]: *** [CMakeFiles/BorderWidgetQt.dir/BorderWidgetQt.cxx.o] Error 1
          CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/BorderWidgetQt.dir/all' failed
          make[1]: *** [CMakeFiles/BorderWidgetQt.dir/all] Error 2
          Makefile:83: recipe for target 'all' failed
          make: *** [all] Error 2
          christian@christian-white:~/InSync/Tmp/QVTKtest/BorderWall/BorderWidgetQt/build$
          ================
          

          So it does not find the implementation of QVTKOpenGLWidget.

          I installed Qt 5.9.5 and VTK-7.1 through the Ubuntu package manager, including any packages that seemed relevant.

          I would greatly appreciate your help in getting past this initial roadblock!

          Christian

          [edit: Added missing coding tags SGaist]

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 4 Aug 2018, 19:54 last edited by
            #5

            How did you download the example ?

            As for VTK, did you install all VTK related development packages ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Christian Zemlin
              wrote on 4 Aug 2018, 22:14 last edited by
              #6

              Regarding downloading, the link that you sent me contained both a link to a .tar file (which I downloaded) and instruction (which I followed).
              Regarding VTK, yes I installed everything that seemed relevant, including

              vtk7
              libvtk7-dev
              libvtk7.1
              libvtk7.1-qt

              Best wishes,

              Christian

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 5 Aug 2018, 21:31 last edited by
                #7

                @Christian-Zemlin said in QVTKOpenGLWidget - which library?:

                libvtkRenderingPythonTkWidgets.so

                Do you have that file on your system ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                C 1 Reply Last reply 5 Aug 2018, 23:38
                0
                • S SGaist
                  5 Aug 2018, 21:31

                  @Christian-Zemlin said in QVTKOpenGLWidget - which library?:

                  libvtkRenderingPythonTkWidgets.so

                  Do you have that file on your system ?

                  C Offline
                  C Offline
                  Christian Zemlin
                  wrote on 5 Aug 2018, 23:38 last edited by
                  #8

                  @SGaist
                  No, that file is not on my system. I now installed all Ubuntu packages that contained "vtk" and "python" in their name but still don't have the file.

                  Is this library the one that contains QVTKOpenGLWidget? Do you know which Ubuntu 18.04 package it is supposed to be in?

                  Best wishes,

                  Christian

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 6 Aug 2018, 20:54 last edited by
                    #9

                    From a quick search it seems to be in python-vtk.

                    I don't think so, but it's a least one error less on your list.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    C 2 Replies Last reply 7 Aug 2018, 02:20
                    0
                    • S SGaist
                      6 Aug 2018, 20:54

                      From a quick search it seems to be in python-vtk.

                      I don't think so, but it's a least one error less on your list.

                      C Offline
                      C Offline
                      Christian Zemlin
                      wrote on 7 Aug 2018, 02:20 last edited by
                      #10

                      @SGaist
                      Strange, I do have the package "python-vtk6" installed (the current version for Ubuntu 18.04) and get the errors I posted earlier. Also, looking at the files that are installed from "python-vtk6", there is no library "vtkOpenGLWidget.so". There are a number of libraries that sound related, including "vtkRenderingOpenGLPython.x86_64-linux-gnu.so" and "vtkRenderingQTPython.x86_64-linux-gnu.so".

                      Thanks for your continuing help!
                      Christian

                      M 1 Reply Last reply 14 Aug 2018, 12:27
                      0
                      • S SGaist
                        6 Aug 2018, 20:54

                        From a quick search it seems to be in python-vtk.

                        I don't think so, but it's a least one error less on your list.

                        C Offline
                        C Offline
                        Christian Zemlin
                        wrote on 11 Aug 2018, 22:48 last edited by
                        #11

                        @SGaist
                        Any more thoughts?

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 12 Aug 2018, 18:51 last edited by
                          #12

                          AFAIK, there's no specific library for just the VTKOpenGLWidget.

                          By the way, how many versions of VTK do you have installed ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • C Christian Zemlin
                            7 Aug 2018, 02:20

                            @SGaist
                            Strange, I do have the package "python-vtk6" installed (the current version for Ubuntu 18.04) and get the errors I posted earlier. Also, looking at the files that are installed from "python-vtk6", there is no library "vtkOpenGLWidget.so". There are a number of libraries that sound related, including "vtkRenderingOpenGLPython.x86_64-linux-gnu.so" and "vtkRenderingQTPython.x86_64-linux-gnu.so".

                            Thanks for your continuing help!
                            Christian

                            M Offline
                            M Offline
                            mchinand
                            wrote on 14 Aug 2018, 12:27 last edited by mchinand
                            #13

                            Should be in the vtkGUISupportQt library.

                            1 Reply Last reply
                            1

                            2/13

                            3 Aug 2018, 15:09

                            topic:navigator.unread, 11
                            • Login

                            • Login or register to search.
                            2 out of 13
                            • First post
                              2/13
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved