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. Unable to promote widget (in an attemp to adjust VTK with Qt)
Forum Updated to NodeBB v4.3 + New Features

Unable to promote widget (in an attemp to adjust VTK with Qt)

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 4 Posters 2.5k Views 1 Watching
  • 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.
  • Please_Help_me_DP Offline
    Please_Help_me_DP Offline
    Please_Help_me_D
    wrote on last edited by
    #1

    Hi,

    I've started to work with Qt GUI and VTK library.
    I need to display VTK object in Qt window. To do that I follow the mailing list. One said that I need to promote QOpenGLWidget in designer to a QVTKOpenGLWidget.

    As I understood QOpenGLWidget is a OpenGL Widget in designer. So I add OpenGL Widget and click Promote to. Then as I understood I need to choose base class name as QOpenGLWidget, promoted class name is QVTKOpenGLWidget, header file is qvtkopenglwidget.h.

    But as in the picture I can't press the button promote (it is inactive) and the QVTKOpenGLWidget is already recognised as QWidget insted of QOpenGLWidget.

    I use windows 10 x 64, Qt 5.14, MSVC 2017 x64
    380bf0f1-b903-42d4-8c81-4f31640dd608-image.png

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #10

      Hi
      Its a bit hard to see but it looks like it just its still a openGL widget and not the VLK version. (widget on form)
      But that would explain no demote menu.

      Can you press the Add button and then the Promote should be active?
      (in Promote dialog)

      Im not sure why it already has VKL version in promote dialog however, if it wont allow you to
      delete the old entry then delete thw widget from the form and close/reopen Creator.
      Then it should forget the old enty.

      Please_Help_me_DP 1 Reply Last reply
      2
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        It is already promoted according to your object tree in the right

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        Please_Help_me_DP 1 Reply Last reply
        2
        • Christian EhrlicherC Christian Ehrlicher

          It is already promoted according to your object tree in the right

          Please_Help_me_DP Offline
          Please_Help_me_DP Offline
          Please_Help_me_D
          wrote on last edited by
          #3

          @Christian-Ehrlicher thank you for comment
          it is promoted by default to QWidget but according to mailing list it should be promoted as QOpenGLWidget

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            Remove the promoted widget in the dialog and create a new one afterwards.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            Please_Help_me_DP 1 Reply Last reply
            1
            • Christian EhrlicherC Christian Ehrlicher

              Remove the promoted widget in the dialog and create a new one afterwards.

              Please_Help_me_DP Offline
              Please_Help_me_DP Offline
              Please_Help_me_D
              wrote on last edited by Please_Help_me_D
              #5

              @Christian-Ehrlicher the button delete (or minus on the picture above) is also inactive. So I cannot remove QVTKOpenGLWidget from "promote dialogue" :(

              I have QVTKOpenGLWidget.h header file in VTK library in C:\apps\MSVC_apps_debug\VTK_820_MPI\include\vtk-8.2 which is include directory to my project. I included it in .pro file.

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #6

                You first have to un-promote the widget - you can't delete it as long as it's used.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                Please_Help_me_DP 1 Reply Last reply
                1
                • Christian EhrlicherC Christian Ehrlicher

                  You first have to un-promote the widget - you can't delete it as long as it's used.

                  Please_Help_me_DP Offline
                  Please_Help_me_DP Offline
                  Please_Help_me_D
                  wrote on last edited by
                  #7

                  @Christian-Ehrlicher how to unpromote it?

                  mrjjM 1 Reply Last reply
                  0
                  • Please_Help_me_DP Please_Help_me_D

                    @Christian-Ehrlicher how to unpromote it?

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #8

                    @Please_Help_me_D
                    Hi
                    Right click the widget and there should be a Demote menu

                    Please_Help_me_DP 1 Reply Last reply
                    1
                    • mrjjM mrjj

                      @Please_Help_me_D
                      Hi
                      Right click the widget and there should be a Demote menu

                      Please_Help_me_DP Offline
                      Please_Help_me_DP Offline
                      Please_Help_me_D
                      wrote on last edited by
                      #9

                      @mrjj Hi,
                      No< I think I don't have Demote menu. Here is a drop down menu that I can see after pressing right-click on Widget:
                      qtqwe.png

                      1 Reply Last reply
                      0
                      • mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #10

                        Hi
                        Its a bit hard to see but it looks like it just its still a openGL widget and not the VLK version. (widget on form)
                        But that would explain no demote menu.

                        Can you press the Add button and then the Promote should be active?
                        (in Promote dialog)

                        Im not sure why it already has VKL version in promote dialog however, if it wont allow you to
                        delete the old entry then delete thw widget from the form and close/reopen Creator.
                        Then it should forget the old enty.

                        Please_Help_me_DP 1 Reply Last reply
                        2
                        • mrjjM mrjj

                          Hi
                          Its a bit hard to see but it looks like it just its still a openGL widget and not the VLK version. (widget on form)
                          But that would explain no demote menu.

                          Can you press the Add button and then the Promote should be active?
                          (in Promote dialog)

                          Im not sure why it already has VKL version in promote dialog however, if it wont allow you to
                          delete the old entry then delete thw widget from the form and close/reopen Creator.
                          Then it should forget the old enty.

                          Please_Help_me_DP Offline
                          Please_Help_me_DP Offline
                          Please_Help_me_D
                          wrote on last edited by Please_Help_me_D
                          #11

                          @mrjj Thank you!
                          I don't know know why but after I deleted widget and reopened QtCreator I could promote widget to QVTKOpenGLWidget

                          Don't you know if I am theoretically able now to display VTK object in Qt window? I just started with GUI in Qt and I get an error on the line (the code used to work before I changed "Promote to" QVTKOpenGLWidget but VTK objects were on the full Qt GUI Frame):

                          widget->SetRenderWindow(window); // error: C2039: 'SetRenderWindow': is not a member of 'QWidget'
                          

                          I understand the error but anyway I need some time to get started with GUI
                          OpenGLwidget.png

                          1 Reply Last reply
                          0
                          • Please_Help_me_DP Offline
                            Please_Help_me_DP Offline
                            Please_Help_me_D
                            wrote on last edited by
                            #12

                            yes! That works!
                            I needed to change:

                            widget->SetRenderWindow(window);
                            

                            to

                            openGLWidget->SetRenderWindow(window);
                            

                            041b41fd-3b5f-4c66-b2a7-943062d165c1-image.png

                            1 Reply Last reply
                            0
                            • mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by mrjj
                              #13

                              Hi
                              It looks right now. In the objects list, its now the VTK version.

                              Try pressing f2 on widget-> and see where it goes. Then press f2 on the declaration
                              and inspect the object it goes too. it should have the SetRenderWindow function.

                              Ok super :)

                              Please_Help_me_DP 1 Reply Last reply
                              1
                              • mrjjM mrjj

                                Hi
                                It looks right now. In the objects list, its now the VTK version.

                                Try pressing f2 on widget-> and see where it goes. Then press f2 on the declaration
                                and inspect the object it goes too. it should have the SetRenderWindow function.

                                Ok super :)

                                Please_Help_me_DP Offline
                                Please_Help_me_DP Offline
                                Please_Help_me_D
                                wrote on last edited by Please_Help_me_D
                                #14

                                @mrjj you said press F2, where can I see how F1, F2, F3 and other F-buttons work?
                                I know that F5 lauch the program, is there any description of it?
                                I pressed F2 on the name of widget (it is openGLWidget) and it leads me to the ui_MainWindow.h but there is no such file in my project. Does Qt create this file by itself?
                                qwerrt.png

                                jsulmJ 1 Reply Last reply
                                0
                                • Please_Help_me_DP Please_Help_me_D

                                  @mrjj you said press F2, where can I see how F1, F2, F3 and other F-buttons work?
                                  I know that F5 lauch the program, is there any description of it?
                                  I pressed F2 on the name of widget (it is openGLWidget) and it leads me to the ui_MainWindow.h but there is no such file in my project. Does Qt create this file by itself?
                                  qwerrt.png

                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #15

                                  @Please_Help_me_D said in Unable to promote widget (in an attemp to adjust VTK with Qt):

                                  where can I see how F1, F2, F3 and other F-buttons work?

                                  "Options.../Environment/Keyboard"

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  2

                                  • Login

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