How to embed plplot or matplotlib into Qt? - qt

I can't find anything about how to embed plotting into Qt by using C++. Which component in Qt should be used for plotting?
I want to grasp the thing generated by these lib and display it using Qt.

I have a working example at this blogpost combining embedded R with Qt. I used both SVG and PNG graphs, though the current version only uses SVG.
The repository is here, if you rewind a commit or two you get the version that flips between SVG and PNG (depending on whether a particular can be loaded).
You should be able to use the logic to show plots from either plplot or matplotlib.

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.

How to use OpenGL in QT Creator

I am working on OpenGL to create a GUI .I want to create some tabs which will help me to display different things in different windows. How is this possible using OpenGL? I read in some articles that we can use QT for that. Since I have already developed some of the GUI part in OpenGL using GLUT library ,is it possible to use the same code in QT? If so brief me how to make settings for OpenGL libraries in QT creator.
In my GUI I am trying to create a Car which is following a track.
I think you might be mixing some things up: OpenGL is a API with which you can instruct drivers to draw visual primitives, like lines, boxes, 3D triangles, pictures from buffer onto a render plane.
GLUT is a library that gives you a minimal environment around that, ie. it handles creating a window etc.
Neither of them are high-level UI description tools. Qt is really most likely what you want, as it will not only give you things like tab widgets etc, but also a feature-rich framework to do things like defining what should happen when you click a button, close a window etc.
There's a lot of examples of OpenGL usage within Qt widgets. In fact, a lot of visualization frontends use Qt and OpenGL. Qt has extensive documentation on how to generate OpenGL contextes and draw inside Qt applications.

Qt5 Double range slider

There are many postings online about trying to make a double range slider
The most common answer I found is to use libqxt. However, going to the website it clearly states it is not maintained due to internal api changes with newer versions of Qt.
Does Qt5 provide any new functionality for this, or is there a longer lasting Qt implementation that provides this functionality without requiring large external libraries?
If Qt Quick is an option, Qt Quick Controls 2 has a RangeSlider (in three different styles). The module has tech preview status in Qt 5.6, but is a proper module in 5.7.
Here's the Default style RangeSlider:
From what I have read there are only two ways to go about getting a double range slider.
Use Qt4
You can use Qt4 and download libqxt. Libqxt already has that feature implemented so it shouldn't be too hard if you know how to use Qt4.
Two sliders on top of one another
http://qt-project.org/doc/qt-4.8/widgets-codeeditor.html
^That doesn't explain how to use double sliders, but it may help you figure out ho to draw two sliders on top of each other.
You can also use that same technique to draw the colors in between the two values.

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

where can i find Qt graphs or how to build them

hello im looking for Qt graph widgets that are free
something like qwt.sourceforge.net/
Outside of Qt, there's also MathGL, which is a powerful graphing library as well. It can create images (png, jpg, svg etc...) which can easily be displayd in a Qt widget. You'll of course have to sacrifice the interactivity that Qwt can offer.

Resources