Is resizing a QGLWidget glitchy or am I doing it wrong ?



  • Hi,

    I am "developping" an application that use QGLWidgets.

    The GUI is made to be resize-able and it was working great, thanks to QSplitter.

    The only problem was occurring upon resizing. The first image below show the GUI before being resized, and the second image show the GUI while being resized.

    Before Resizing...
    !http://i559.photobucket.com/albums/ss36/Ninja_Goliath/1-34_zps70c4922a.jpg(Image 1)!

    While Resizing...
    !http://i559.photobucket.com/albums/ss36/Ninja_Goliath/2-19_zpsc03b537e.jpg(Image 2)!

    I tried looking on the web for answers, I strangely never found anyone having the same issue as me. I did some RTFM and fiddled with a few functions but never got quite to a point where the glitch was gone.

    ... So I decided to simply use one big QGLWidget (that makes the whole screen minus the top and side bars) and handle all the resizing by myself (Using good ol' openGL stuff). The result is great and it's actually pretty simple (and the glitch isn't there at all, not even a little : gone !) but after a few months I still wonder : "is this the only way ?"

    ... or is there a way to get rid of this glitch and still get to use QSplitters ?
    (the interrest of this question is because I believe it is easier on the computer to have multiple QGLWidget(s) because when you update one you don't have to update the other widgets (notice one of these GLWidgets would be a 3D tree that would _eventually _be pretty complex to redraw every time another widget need an update))

    Thanks you for your time.

    PS : the images before are about an old version of my GUI (where I was still using QSplitters) my interface right now look a little less awful, see image below (constructive comments on the GUI are appreciated too):

    !http://i559.photobucket.com/albums/ss36/Ninja_Goliath/3-8_zps9176105f.jpg(New GUI)!



  • Hi! I have read your post and I have something on my mind. If you are using widget inherited from QGLWidget on the left of splitter and some other Qt Widget on the right and if visual glitches occur on the area taken by GLWidget you should check your code in resizeGL else you should check code for your other widget. I really doesn't test GLWidgets with splitter but with simple windows resize it works well. Also you could check splitter signals or properties - it possible it happens cause resize event is issued only when you release splitter handle (for example QSlider has tracking property which affect how valueChanged signal is emitted).



  • Hi Space,

    There is a GLWidget on both sides of the QSplitters.

    I looked at my resizing code as you suggested, I still have the issue.

    I am not sure how to stop the signals and slots to mess up the resizing if they does, but I can assure you the resizing happen even if I don't release the splitter handle (it just resize in a glitchy way as pictured above).

    Thank you for your time Space,

    Now that I think about it, I am pretty sure it's impossible to solve this issue using Qt otherwise there would be a solution for this obvious problem all over the web (or as a demo maybe).



  • Hi,

    After some more wandering on the web, I found out that this question has been asked many times before (sometime even on this very website). Unfortunately, the threads I found did not carry any answer and some didn't even got any reply.

    I also found a bug-report (that remain open for now, there is still hope) on this topic :

    https://bugreports.qt-project.org/browse/QTBUG-17869

    I also got a promising article that pretend the solution is actually there somewhere inside Qt since version 4.4 (although it might involve some dark magics). I couldn't understand very well how to do it but it is apparently possible :

    http://blog.qt.digia.com/blog/2007/08/09/qt-invaded-by-aliens-the-end-of-all-flicker/

    Lastly but not least, I RTFM at the documentation on the QSplitter (which I should have done in the first place I know, sorry) and found out that it is possible to simply prevent the widgets to be updated while the splitter is being used :

    splitter->setOpaqueResize(false);

    Myself I will stick with my original solution for now : using a single QGLWidget and draw twice inside it using 2 differents glViewport with some custom splitter controls.

    ...at the cost of performance sadly.

    PS : if you are looking for a solution on your own, I share that I had the best luck with the search engines using the following terms : qt, QGLWidget, flicker, resizing.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.