glutPassiveMotionFunc in Qt - qt

I'm trying to make an 'fps' camera in OpenGL using Qt. I'm able to move the mouse and rotate the camera accordingly, the only problem I'm having is that I have to click and drag in order for it to happen (the mouseMoveEvent is only called when the mouse is being pressed). Now I've been searching around all day, and there is a lot of conflicting and outdated information about OpenGL on the internet. My question is really quite simple, does the QOpenGLWidget have some functionality similar to glutPassiveMotionFunc, or do I have to install the glut library to get this functionality? Other suggestions to get this functionality (other, better documented libraries for example) are also welcome. In case I have to install the glut library, it would also be amazing if someone would have documented a proper way of doing this, because I seem to find a million different ways, all equally hard to understand.

By default, Qt doesn't handle simple mouse move events. It has to be turned on via the mouseTracking property:
yourOpenGLWidget->setMouseTracking(true);

Related

Drawing with EGL in Qt

I'm trying to get Qt and EGL to work together. I'm working on a program that uses EGL to draw, and I have to use Qt to create a GUI overlay.
The current solution was to turn a QWidget into a native window, and pass it's window handle to EGL. This works, but it's difficult to work with. Qt isn't aware that the widget is being drawn in by something else. So when another widget is overlaid, even if it's transparent, the image drawn by EGL is erased. The only way to get them to work is if I jigsaw the buttons and other GUI elements in a way that they don't overlap the parts of the native window I want to show. However this means that I can't use layouts or QML or any of the tools that would make creating different GUIs easy.
So my question is, how can I draw with EGL into Qt in a more usable way.
I'm working with Qt 5.4.2 by the way. If absolutely necessary, I might be able to upgrade to 5.5, but newer versions won't work.
I was looking into QOpenGLContext, and ways to make it use the context created by EGL, but I can't seem to find any good examples on how to actually go about doing this.

qml takes mouse click but not taking touch events

I have a Qwidget inside of which, I have multiple children in the form of QmlApplicationViewer objects, each pointing to a different qml file.
Problem is, when I use mouse, all the qml files take events, but when I try to use the touch screen, only some of them does.
Can someone give a direction as to where the problem might be ? Will appreciate and sort of possible causes which might cause this issue.
Platform : Ubuntu 12.04 - Qt 4.8 - 32 bit
There really is not enough information here to even begin to answer this question. The most obvious answer that comes to mind is some of your qml files are not correctly defining the TouchArea within the qml. If you want more help you need to post code.
I tried using the EG-Touch touch drivers for my platform, which are supposed to have some issues on 12.04(as per some forums). I reverted back to Ubuntu 11.04 and used the e-Galax touch drivers instead, and things are working fine now.
P.S. : If someone finds a working driver for 12.04 or any other work around, please update. I will accept a better answer. Closing this for now.

Keep Qt tooltip open

Windows tooltips do close after a certain amount of time (5-32 sec afaik). In Qt they seem to be set to 10 sec autoclose. Is there any way I can alter this behaviour? Qt docs remain silent about that.
Maybe there are any custom tooltip classes around which I can make sticky? Qt Creator uses some sort of custom ToolTips for debugging.
Thanks!
I googled "qt tooltip delay" and the second link sent me to the Nokia FAQ, where it explains that the tooltip timer is hardcoded, and gives a "workaround" for that here:
http://developer.qt.nokia.com/faq/answer/how_can_i_change_the_timeout_period_for_a_qtooltip
Yet the first comment on that says that it only works if you want to make the tooltip delay shorter, not longer.
The first link in my search suggest modifying the class yourself, but that's probably not a good idea, albeit it might be a temporary solution, since it seems the suggestion for this feature was sent ages ago (since before Nokia bought them), and it hasn't been implemented yet.

Qt+OpenGl+SimpleGl

I have enabled qt+OpenGl+SimpleGl on one of the ARM platform and was able to run opengl example programs.
I also has a qt+Webkit, which is working with a graphic plugin.
I wanted to use simpleGl context for every thing, instead of using the normal graphic screen. So, when I try to run Qt+Webkit with simpleGl, I just get a blank screen.
Does QT support this? If so how can we make it?
Yes, this is correct. OpenGL draws directly to the framebuffer. The simplegl driver doesn't handle what is drawn using the raster paint engine of the QWS, so you may see only black.
Using simplegl for "everything" means you want everything to be drawn using OpenGL in your EGL full-screen window? This is possible under some assumptions. You have to write all your applications to be rendered using the Qt OpenGL paint engine (using the opengl graphics system is not supported under Qt/E). This is possible also for QtWebKit, I'm doing it now. Note that this does not mean that everything is rendered using hardware acceleration. You'll have to write your applications "the right way" to get all actually hardware accelerated. Consider that you'll have to handle the mouse pointer some other way in this case.
The other way is to just modify the simplegl driver to allow for the use of Qt applications using the raster paint engine. This is possible as well with some limitations. Qt can use blit to place its own windows over OpenGL. Look for the framebuffer driver inside the Qt source tree to know how to do this. You can then have common Qt applications and OpenGL Qt applications some way. I'm doing this as well. Not everything can be done anyway.
EDIT: I'm sure you already did, but in case, give this http://doc.qt.io/qt-4.8/qt-embeddedlinux-opengl.html much attention.
Unfortunately I don't know anything about SimpleGL, but I do know that there is a way to render a standard Qt widget in a QGLWidget. Maybe have a look at this Qt Quarterly which I think is somewhat related to your question:
http://doc.qt.nokia.com/qq/qq26-openglcanvas.html

Rendering engine to load 3D model into Qt

I need an appropriate rendering engine to render a 3D model into Qt, and use Qt then as an event handler to this model. Thank you.
As for the rendering engine, you can go several directions, but I'll mention two. Qt comes with an OpenGL widget. You could make use of this by either:
writing your own rendering code to render your model using OpenGL
or
making use of a rendering engine/framework which has it's own Qt Widget (possibly derived from Qt's OpenGl widget). I know OpenSceneGraph has Qt integration available. And I seem to remember Ogre does as well. This just to mention two options. Just Google for Qt and your favorite engine and you'll most likely find something suitable. And if not, it is usually not that difficult to write your own integration if you feel like it.
Whichever option is more suitable for you depends on the exact specification of what you're trying to achieve. You probably know that better than we do.
As for the event handling, you might want to be a bit more specific as to what you mean.

Resources