Unsolved Qt OpenGL Widget as a view port for qcustomPlot
-
I'm working on project to plot the data from file. I use Qt5.4 and qcustomPlot library to plot the data as X,Y graph, as known the Qt5 don't support OpenGL. I google this problem and found this code:
QDeclarativeView mainwindow; mainwindow.setSource(QUrl::fromLocalFile("./qml/app.qml")); QGLFormat format = QGLFormat(QGL::DirectRendering); // you can play with other rendering formats like DoubleBuffer or SimpleBuffer format.setSampleBuffers(false); QGLWidget *glWidget = new QGLWidget(format); glWidget->setAutoFillBackground(false); mainwindow.setViewport(glWidget);
from this thread
but I'm new in Qt and C++ and do not know how to implment this code in my program. the source code of my program on GitHub in this link
please help me -
Hi,
Qt has support for OpenGL since way before Qt 5.
Changing the viewport is only available to a small subset of class which doesn't include QMainWindow.
-
@SGaist
thank you for replay. Do you suggest me to use QWT ? I think it support opengl -
I don't suggest anything since I don't know what you are trying to plot and why you would need OpenGL as a viewport for it.
-
@SGaist
I need to plot real-time signal and I want to use openGL because this plot will be run on raspberry pi "as known the pi CPU very very slow to plot real-time data" -
Hi, I moved the topic to "Mobile and Embedded" as it is about doing embedded.
-
In that case you should rather look for a solution that can be power by OpenGL e.g. QtCharts
-
@SGaist
I think, I have to buy Qt licence to install QtCharts, isn't it? -
It will be available to both Commercial and GPLv3 since 5.6. See this article. So if your application is GPLv3 then your good to go.
-
I am using Qt 5.6 Creator but
QT += charts
gives me an error:
Project ERROR: Unknown module(s) in QT: charts
-
I have used qwt. It is coolest open source lib for chart, I would strongly recommend. Check it out if it meets your requirement.
-
Because it's not part of Qt 5.6, you have to compile it by hand.
-
The documentation here mentions that I can use Package Manager in Maintenance Tool. But for Qt Creator there is no option there to install add-ons. CAn you suggest me something?
-
Again: currently it's not yet part of Qt's OpenSource offering so you have to clone it using git and built it by hand. The repository is here