[vtkusers] R: Re: QVTKWidget in QT GUI freezes other QWidgets
bartolomei-luca at virgilio.it
bartolomei-luca at virgilio.it
Thu Oct 19 03:22:05 EDT 2017
Hi Alessandro,
at first I thought that something similar to what you describe was happening. I looked into this and double checked my code, but I think that the issue is due to OpenGL. Thanks for the hint anyway!
Best,
Luca
----Messaggio originale----
Da: "Alessandro Volz" <alessandro.volz at gmail.com>
Data: 18-ott-2017 14.55
A: "bartolomei-luca at virgilio.it"<bartolomei-luca at virgilio.it>
Cc: "Shawn Waldon"<shawn.waldon at kitware.com>, "Sankhesh Jhaveri"<sankhesh.jhaveri at kitware.com>, "VTK Users"<vtkusers at vtk.org>
Ogg: Re: [vtkusers] QVTKWidget in QT GUI freezes other QWidgets
Luca, I haven't looked into your problem/thread in detail, but I have one suggestion that might come useful: are you maybe at some point doing things in a secondary thread, and somehow passing data to your widget from this thread?It has happened to me in the past, and the GUI would temporarily switch to drawing in black or not updating any more.If you are using background threads, look into this.Best,AlessandroOn Oct 17, 2017, at 5:23 PM, bartolomei-luca at virgilio.it wrote:Thanks to everyone for the inputs.I will try to include the QVTKOpenGLWidget in my project. I will let you know if I succeed in doing that and if this solve the issue. at Shawn -> About the Cmake: I can successfully build VTK 8.0 and use it in QT if I use a newer version of cmake (currently, the default cmake version for my system is 3.2.2). The problem is that I cannot build my project with VTK 8.0 using ROS. So the problem is not Cmake itself, but the version ROS uses for building (too "old" for VTK 8.0). I will try also to fix this.For the moment, thanks to all. I will let you know in case of success/failure.Best,Luca
----Messaggio originale----
Da: "Shawn Waldon" <shawn.waldon at kitware.com>
Data: 17-ott-2017 16.18
A: "Sankhesh Jhaveri"<sankhesh.jhaveri at kitware.com>
Cc: "bartolomei-luca at virgilio.it"<bartolomei-luca at virgilio.it>, "Elvis Stansvik"<elvis.stansvik at orexplore.com>, "VTK Users"<vtkusers at vtk.org>
Ogg: Re: [vtkusers] QVTKWidget in QT GUI freezes other QWidgets
When one of the projects I work on first started using Qt5 with VTK we had similar problems. Embedding a QVTKWidget in a Qt5 Tab or Scroll widget or using it alongside other OpenGL-based widgets in Qt5 can cause these kinds of issues and this was the motivation for creating the QVTKOpenGLWidget. The QVTKOpenGLWidget correctly lets Qt manage the OpenGL context rather than hacking it in with window system calls. You could try grabbing the QVTKOpenGLWidget code from VTK 8.0.0 and copying it into your project as a temporary solution (I'm not sure if it relies on any features added between 7.1 and 8.0).You said upgrading CMake was blocking you from using more recent VTK? The CMake developers try really hard to be backwards compatible. Have you reported the issues you are having to them? I know they try their best to handle compatibility issues that are reported.HTH,ShawnOn Tue, Oct 17, 2017 at 10:03 AM, Sankhesh Jhaveri <sankhesh.jhaveri at kitware.com> wrote:How are you initializing the QVTKWidget?One other thing to test would be to try removing the QTabWidget and showing both the QVTKWidget and QWidget in the same central widget side-by-side. Finally, you could see if the setup works fine with Qt4.I am not sure how you would put a GLUT window inside a QWidget. But if you have can do that, you could try the vtkExternalOpenGLRenderWindow. See TestGLUTRenderWindow.cxx for an example.
On Tue, Oct 17, 2017 at 9:24 AM bartolomei-luca at virgilio.it <bartolomei-luca at virgilio.it> wrote:Hello Sankhesh,thanks a lot for the reply.Let's say the GUI "pipeline" is as I explained to Elvis. Then:At the moment the two widgets are under the central widget (a QWidget). They are in two different tabs of a QTabWidget. I tried to move the QVTKWidget out of its tab but no luck. I have also noted another thing. If I show at the same time the QWidget and the QVTKWidget, the QVTKWidget works fine, but the QWidget freeze. That's why I thought that it could be an OpenGL context issue.What do you mean by "replacing ROS widget with a simple button"? In any case, I can make QVTKWidget work, but no success with the QWidget. It just freeze on the last view.Unfortunately, QVTKOpenGLWidget is available only for VTK 8.0 and higher. I am using VTK 7.1 and I cannot upgrade to 8.0 because of the cmake that is installed on my laptop. I cannot upgrade the cmake version due to some compatibility issues with ROS. I will get in a lot of trouble if I try to do that. Is there a way to use glut or vtkOpenGLRenderer (available in vtk 7.1)?Thanks a lot again for the help.Best,Luca
----Messaggio originale----
Da: "Sankhesh Jhaveri" <sankhesh.jhaveri at kitware.com>
Data: 17-ott-2017 14.21
A: "Elvis Stansvik"<elvis.stansvik at orexplore.com>, "bartolomei-luca at virgilio.it"<bartolomei-luca at virgilio.it>
Cc: "VTK Users"<vtkusers at vtk.org>
Ogg: Re: [vtkusers] QVTKWidget in QT GUI freezes other QWidgets
Hi Luca,
Do the QWidget and QVTKWidget overlap at all or are they separated by some QFrame border, etc. ? If they are not overlapping, it means they are not sharing the OpenGL context.
Have you tried replacing the ROS widget with a simple button to see if the QVTKWidget works properly?
Lastly, the QVTKWidget is known to have rendering issues with Qt5. Try using the QVTKOpenGLWidget to see if anything changes.
Best,Sankhesh
On Tue, Oct 17, 2017 at 3:29 AM Elvis Stansvik <elvis.stansvik at orexplore.com> wrote:2017-10-17 9:22 GMT+02:00 bartolomei-luca at virgilio.it
<bartolomei-luca at virgilio.it>:
> Hello Elvis,
>
> thanks for your reply.
> I don't have the gui avaiable right now; I will send a picture as soon as I
> can.
>
> To answer your question: yes, if I remove the QVTKWidget and replace it with
> QWidget everything works. The problems occur only when the QVTKWidget is
> present.
>
> The GUI is built to work in this way:
> 1) start showing stuff on the QWidget;
> 2) After a while, the QVTKWidget shows some other stuff.
>
> The QWidget is showing some interactive scene and it uses a library
> ("librviz" - for ROS users) based on Ogre and OpenGL. Could the problem
> happen because the QVTKWidget interfere with the already existing OpenGL
> context?
I don't know, but it sounds like it's possible. I think there are
other people on this list who knows much more about OpenGL and how VTK
uses it than I do, so I'll let those answer that.
Elvis
> I don't know if this is the cause, because it is sufficient to have the
> QVTKWidget on the Gui to make the QWidget freeze.
>
> Anyway, I have looked at this example:
> https://www.vtk.org/Wiki/VTK/Examples/Cxx/GLUT
> but no luck so far. Maybe is a problem of drivers (I have an Nvidia GeForce
> GTX 950M on Ubuntu 14.04 LTS).
>
> Best,
> Luca
>
>
> ----Messaggio originale----
> Da: "Elvis Stansvik" <elvis.stansvik at orexplore.com>
> Data: 17-ott-2017 8.36
> A: <bartolomei-luca at virgilio.it>
> Cc: "VTK Users"<vtkusers at vtk.org>
> Ogg: Re: [vtkusers] QVTKWidget in QT GUI freezes other QWidgets
>
>
> Den 13 okt. 2017 12:08 em skrev "bartolomei-luca at virgilio.it"
> <bartolomei-luca at virgilio.it>:
>
> Hello everyone!
>
> I have a problem with the QT GUI I am creating. Basically, I have an
> interactive QWidget, a QVTKWidget and a "Quit" button.
>
> When I launch my app, I can interact with the QWidget without any problem (I
> have a 3D interactive scene, where I can zoom and rotate).
> However, as soon as the QVTKWidget becomes "active" (i.e. some function in
> my code start using it or if I click on it), both the QWidget and the
> QVTKWidget freeze. The app keeps on working, since the "Quit" button works
> as it should.
>
> If I have a GUI with either the QWidget or the QVTKWidget (only one of them)
> everything works fine. The problem is if I try to include both of them at
> the same time.
>
> Do you have any idea why this happens?
>
>
> I don't have any immediate ideas. It would really help to see a small
> example where the problem occurs.
>
> Does it work if you put two of your QWidgets in the application. I mean, if
> you remove the QVTKWidget and put another one of your QWidget where it was?
>
> Elvis
>
>
> Thanks a lot for you help.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
>
>
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
-- Sankhesh Jhaveri
Sr. Research & Development Engineer | Kitware | (518) 881-4417
-- Sankhesh Jhaveri
Sr. Research & Development Engineer | Kitware | (518) 881-4417
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________Powered by www.kitware.comVisit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.htmlPlease keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQSearch the list archives at: http://markmail.org/search/?q=vtkusersFollow this link to subscribe/unsubscribe:http://public.kitware.com/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171019/605171b9/attachment.html>
More information about the vtkusers
mailing list