Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Use QCustomPlot
QtWS25 Last Chance

Use QCustomPlot

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 4 Posters 923 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.
  • R Offline
    R Offline
    Raphawel
    wrote on last edited by
    #1

    Hello,

    I am in Qt 5.6.4 version to be able to program in 32bit. I need help to use the QCustomPlot library. I have already done the necessary installations by adding it in my project folder. To use this library, I need a QCustomPlot widget in my .ui. Except that such a widget with QCustomPlot is not in my list.
    My question is: How to create a QCustomPlot widget to integrate it in the object list?

    Thanks for your help

    jsulmJ 1 Reply Last reply
    0
    • R Raphawel

      Hello,

      I am in Qt 5.6.4 version to be able to program in 32bit. I need help to use the QCustomPlot library. I have already done the necessary installations by adding it in my project folder. To use this library, I need a QCustomPlot widget in my .ui. Except that such a widget with QCustomPlot is not in my list.
      My question is: How to create a QCustomPlot widget to integrate it in the object list?

      Thanks for your help

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Raphawel said in Use QCustomPlot:

      Except that such a widget with QCustomPlot is not in my list

      Simply add QCustomPlot to your UI in code

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 2 Replies Last reply
      0
      • jsulmJ jsulm

        @Raphawel said in Use QCustomPlot:

        Except that such a widget with QCustomPlot is not in my list

        Simply add QCustomPlot to your UI in code

        R Offline
        R Offline
        Raphawel
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • jsulmJ jsulm

          @Raphawel said in Use QCustomPlot:

          Except that such a widget with QCustomPlot is not in my list

          Simply add QCustomPlot to your UI in code

          R Offline
          R Offline
          Raphawel
          wrote on last edited by Raphawel
          #4

          @jsulm
          But if I want to use an object with QCustomPlot, the object must be the class QCustomPlot no? What I mean is that adding QCustomPlot in my ui in code is not enough ?

          38557b9c-5dfd-4e6c-a2de-fda376e8f481-image.png

          Christian EhrlicherC jsulmJ 2 Replies Last reply
          0
          • R Raphawel

            @jsulm
            But if I want to use an object with QCustomPlot, the object must be the class QCustomPlot no? What I mean is that adding QCustomPlot in my ui in code is not enough ?

            38557b9c-5dfd-4e6c-a2de-fda376e8f481-image.png

            Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            You have to promote a QWidget (assuming QWidget is the Qt base class of QCustomPlot): https://doc.qt.io/qt-6/designer-using-custom-widgets.html

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            2
            • R Raphawel

              @jsulm
              But if I want to use an object with QCustomPlot, the object must be the class QCustomPlot no? What I mean is that adding QCustomPlot in my ui in code is not enough ?

              38557b9c-5dfd-4e6c-a2de-fda376e8f481-image.png

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Raphawel Do what @Christian-Ehrlicher suggested.
              Another way is: add a QWidget in designer where you want to have your QCustomPlot. Then in code create QCustomPlot instance and use the QWidget added in designer as its parent.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              R 1 Reply Last reply
              1
              • jsulmJ jsulm

                @Raphawel Do what @Christian-Ehrlicher suggested.
                Another way is: add a QWidget in designer where you want to have your QCustomPlot. Then in code create QCustomPlot instance and use the QWidget added in designer as its parent.

                R Offline
                R Offline
                Raphawel
                wrote on last edited by
                #7

                @jsulm Thanks for your help, I don't know if I followed your advice but I created a widget on my ui and promoted it to QCustomPlot, like on the picture :

                (The created widget is the one selected in blue)

                bb3cb6ac-6871-4a19-abf3-155c53a37409-image.png

                a55711b4-8daf-429a-8aa0-d3ef63e47ac1-image.png

                (Just to clarify, I wanted to create a widget to use QCustomPlot to be able to create a graph)

                And now, I have to connect the function on which I will write the program to create the graph, on the created widget ? To be able to use QCustomPlot.

                mrjjM 1 Reply Last reply
                0
                • R Raphawel

                  @jsulm Thanks for your help, I don't know if I followed your advice but I created a widget on my ui and promoted it to QCustomPlot, like on the picture :

                  (The created widget is the one selected in blue)

                  bb3cb6ac-6871-4a19-abf3-155c53a37409-image.png

                  a55711b4-8daf-429a-8aa0-d3ef63e47ac1-image.png

                  (Just to clarify, I wanted to create a widget to use QCustomPlot to be able to create a graph)

                  And now, I have to connect the function on which I will write the program to create the graph, on the created widget ? To be able to use QCustomPlot.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #8

                  @Raphawel
                  Hi
                  Using promotion is a nice way to be able to design with a custom widget.

                  The type in ui->XXXX will be the right one ( QCustomPlot ) and the remaining of the task is
                  to add data to it.

                  Do understand you have now access to the QCustomPlot via the UI->Nameofpromotedwidget so
                  have this in mind if you reuse code from the examples as they often NEW another instance of QCustomPlot and you want to use the one you have promoted.

                  Lets say you use
                  https://www.qcustomplot.com/index.php/tutorials/basicplotting

                  then all
                  customPlot->xxxxx

                  should be changed to
                  ui->widget->xxxxxxx

                  to use the promoted one.

                  Hope this helps.

                  R 1 Reply Last reply
                  1
                  • mrjjM mrjj

                    @Raphawel
                    Hi
                    Using promotion is a nice way to be able to design with a custom widget.

                    The type in ui->XXXX will be the right one ( QCustomPlot ) and the remaining of the task is
                    to add data to it.

                    Do understand you have now access to the QCustomPlot via the UI->Nameofpromotedwidget so
                    have this in mind if you reuse code from the examples as they often NEW another instance of QCustomPlot and you want to use the one you have promoted.

                    Lets say you use
                    https://www.qcustomplot.com/index.php/tutorials/basicplotting

                    then all
                    customPlot->xxxxx

                    should be changed to
                    ui->widget->xxxxxxx

                    to use the promoted one.

                    Hope this helps.

                    R Offline
                    R Offline
                    Raphawel
                    wrote on last edited by Raphawel
                    #9

                    @mrjj Hi

                    Hello, I apologize for the late reply, and thank you for your help it helped me.

                    I managed to display a graph. So I'll post the steps to follow to use QCustomPlot (send me a message if it's not good):

                    1° Install QCustomPlot via this link: https://www.qcustomplot.com/index.php/download

                    2° Unzip the file then put these two files in your project folder.
                    819f877d-a2d5-40b5-944d-d4c355a218f6-image.png

                    3° Add existing files of both files, then they should appear in your tree.
                    d3073e8a-6e8e-4142-a7af-477ad01ca097-image.png

                    4° Add printsupport in your .pro : 8303f9f8-cc4f-43ac-9c1e-77caa3d762d6-image.png

                    5° Create a widget and place it in your interface
                    10ef2dc2-2f5c-4bc3-9cc6-d14b17a3327a-image.png

                    6° Right click on the widget /Promote widget/

                    731d0c39-6e3c-4f83-8f8c-8febdfc64ddc-image.png

                    Normally in the interface tree, the widget should be in QCustomPlot.

                    3454a186-a1c4-4c85-84e0-1db4a55227c7-image.png

                    7° Create a function (here makePlot() ) in which you will create your graphic (don't forget to put the function in the private slot)

                    db4bbbce-9889-4d93-9e3b-9768b7c90823-image.png

                    8° Be careful when you call your widget : ui->name_widget->command . For example, my widget is called customplot :

                    6c21bb98-f306-46b2-b401-e6fd80e91e49-image.png

                    mrjjM 1 Reply Last reply
                    1
                    • R Raphawel

                      @mrjj Hi

                      Hello, I apologize for the late reply, and thank you for your help it helped me.

                      I managed to display a graph. So I'll post the steps to follow to use QCustomPlot (send me a message if it's not good):

                      1° Install QCustomPlot via this link: https://www.qcustomplot.com/index.php/download

                      2° Unzip the file then put these two files in your project folder.
                      819f877d-a2d5-40b5-944d-d4c355a218f6-image.png

                      3° Add existing files of both files, then they should appear in your tree.
                      d3073e8a-6e8e-4142-a7af-477ad01ca097-image.png

                      4° Add printsupport in your .pro : 8303f9f8-cc4f-43ac-9c1e-77caa3d762d6-image.png

                      5° Create a widget and place it in your interface
                      10ef2dc2-2f5c-4bc3-9cc6-d14b17a3327a-image.png

                      6° Right click on the widget /Promote widget/

                      731d0c39-6e3c-4f83-8f8c-8febdfc64ddc-image.png

                      Normally in the interface tree, the widget should be in QCustomPlot.

                      3454a186-a1c4-4c85-84e0-1db4a55227c7-image.png

                      7° Create a function (here makePlot() ) in which you will create your graphic (don't forget to put the function in the private slot)

                      db4bbbce-9889-4d93-9e3b-9768b7c90823-image.png

                      8° Be careful when you call your widget : ui->name_widget->command . For example, my widget is called customplot :

                      6c21bb98-f306-46b2-b401-e6fd80e91e49-image.png

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Raphawel
                      Thank you. Its a nice guide for getting up and running.

                      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