Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt OpenGL Widget as a view port for qcustomPlot
QtWS25 Last Chance

Qt OpenGL Widget as a view port for qcustomPlot

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
qt5openglqcustomplotc++rendering
14 Posts 5 Posters 7.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Qudor EngQ Offline
    Qudor EngQ Offline
    Qudor Eng
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Qudor EngQ 1 Reply Last reply
      0
      • SGaistS SGaist

        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.

        Qudor EngQ Offline
        Qudor EngQ Offline
        Qudor Eng
        wrote on last edited by
        #3

        @SGaist
        thank you for replay. Do you suggest me to use QWT ? I think it support opengl

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Qudor EngQ 1 Reply Last reply
          0
          • SGaistS SGaist

            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.

            Qudor EngQ Offline
            Qudor EngQ Offline
            Qudor Eng
            wrote on last edited by
            #5

            @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"

            1 Reply Last reply
            0
            • tekojoT Offline
              tekojoT Offline
              tekojo
              wrote on last edited by
              #6

              Hi, I moved the topic to "Mobile and Embedded" as it is about doing embedded.

              1 Reply Last reply
              1
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                In that case you should rather look for a solution that can be power by OpenGL e.g. QtCharts

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                Qudor EngQ 1 Reply Last reply
                0
                • SGaistS SGaist

                  In that case you should rather look for a solution that can be power by OpenGL e.g. QtCharts

                  Qudor EngQ Offline
                  Qudor EngQ Offline
                  Qudor Eng
                  wrote on last edited by
                  #8

                  @SGaist
                  I think, I have to buy Qt licence to install QtCharts, isn't it?

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    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.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • MuzabM Offline
                      MuzabM Offline
                      Muzab
                      wrote on last edited by
                      #10

                      I am using Qt 5.6 Creator but

                      QT += charts
                      

                      gives me an error:

                      Project ERROR: Unknown module(s) in QT: charts

                      1 Reply Last reply
                      0
                      • V Offline
                        V Offline
                        vish
                        wrote on last edited by
                        #11

                        I have used qwt. It is coolest open source lib for chart, I would strongly recommend. Check it out if it meets your requirement.

                        Development is possible at any level.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Because it's not part of Qt 5.6, you have to compile it by hand.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • MuzabM Offline
                            MuzabM Offline
                            Muzab
                            wrote on last edited by
                            #13

                            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?

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              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

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved