Unable to promote widget (in an attemp to adjust VTK with Qt)
-
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
-
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. -
It is already promoted according to your object tree in the right
-
@Christian-Ehrlicher thank you for comment
it is promoted by default to QWidget but according to mailing list it should be promoted as QOpenGLWidget -
Remove the promoted widget in the dialog and create a new one afterwards.
-
@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.
-
You first have to un-promote the widget - you can't delete it as long as it's used.
-
@Christian-Ehrlicher how to unpromote it?
-
@Please_Help_me_D
Hi
Right click the widget and there should be a Demote menu -
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. -
@mrjj Thank you!
I don't know know why but after I deleted widget and reopened QtCreator I could promote widget to QVTKOpenGLWidgetDon'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
-
yes! That works!
I needed to change:widget->SetRenderWindow(window);
to
openGLWidget->SetRenderWindow(window);
-
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 :)
-
@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?
-
@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"