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. QCustomPlot integration with VS2017

QCustomPlot integration with VS2017

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 753 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.
  • T Offline
    T Offline
    tamirmichael
    wrote on last edited by
    #1

    Hi all and thanks for taking the time,

    I use Qt with VS2017 and I try to integrate QCustomPlot. I can configure VS2017 to include the directive '#include "qcustomplot.h"' in the generated sources using the options for the ".ui" file in VS2017, but the logic in the generated code (based upon the ".ui" file) does not spawn an instance of QCustomPlot.
    I tried to use Qt creator for that but without success.
    Any thought will be much appreciated!

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

      Hi,

      How exactly are you trying to use QCustomPlot in your application ?

      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
      • T Offline
        T Offline
        tamirmichael
        wrote on last edited by
        #3

        Hi,

        Thanks for replying.

        The variable "ui" is an object provided by Qt, such as

        private:
            Ui::SampleRenderer ui;
        

        which is defined here (generated code):

        (ui_SampleRenderer.h)
        namespace Ui {
            class SampleRenderer: public Ui_SampleRenderer {};
        } // namespace Ui
        

        which is turn is then included in my class:

        #include "ui_SampleRenderer.h"
        

        and finally

        ui->plot->xAxis->setRange(0, 6, Qt::AlignCenter);
        

        But the problem is that the member "plot" is not generated by VS2017, which is not surprising due to the fact that there is nothing in the ".ui" file to mandate it.
        Can I use QCustomPlot separately?
        Can you offer an alternative approach?

        jsulmJ 1 Reply Last reply
        0
        • T Offline
          T Offline
          tamirmichael
          wrote on last edited by
          #4

          In a sample provided by QCustomPlot I see in the "Ui_????" class:

          void setupUi(QMainWindow *MainWindow)
              {
                  .....
                  plot = new QCustomPlot(centralWidget);
          

          But I don't have this code generated for me....

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tamirmichael
            wrote on last edited by tamirmichael
            #5

            I followed the steps here:

            https://www.qcustomplot.com/index.php/tutorials/settingup

            To no avail - still, building my VS2017 project gives

            Severity	Code	Description	Project	File	Line	Suppression State
            Error	C2039	'plot': is not a member of 'Ui::SampleRenderer'	
            
            1 Reply Last reply
            0
            • T tamirmichael

              Hi,

              Thanks for replying.

              The variable "ui" is an object provided by Qt, such as

              private:
                  Ui::SampleRenderer ui;
              

              which is defined here (generated code):

              (ui_SampleRenderer.h)
              namespace Ui {
                  class SampleRenderer: public Ui_SampleRenderer {};
              } // namespace Ui
              

              which is turn is then included in my class:

              #include "ui_SampleRenderer.h"
              

              and finally

              ui->plot->xAxis->setRange(0, 6, Qt::AlignCenter);
              

              But the problem is that the member "plot" is not generated by VS2017, which is not surprising due to the fact that there is nothing in the ".ui" file to mandate it.
              Can I use QCustomPlot separately?
              Can you offer an alternative approach?

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

              @tamirmichael said in QCustomPlot integration with VS2017:

              But the problem is that the member "plot" is not generated by VS2017

              So, you are using QtDesigner to design your UI - is that correct?
              This "plot" variable will not be generated magically - you have to put it in QtDesigner like any other widget in order to be able to access it via ui->.

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

              1 Reply Last reply
              1
              • T Offline
                T Offline
                tamirmichael
                wrote on last edited by tamirmichael
                #7

                Hi,

                I followed the steps in the integration instructions as posted above but still, VS does not introduce the necessary code.
                Maybe I missed a step - those are instructions for the Qt Creator, not designer:
                https://www.qcustomplot.com/index.php/tutorials/settingup
                But you referred to the designer. Can you please tell me how this can be done there as well? Thanks.

                jsulmJ 1 Reply Last reply
                0
                • T tamirmichael

                  Hi,

                  I followed the steps in the integration instructions as posted above but still, VS does not introduce the necessary code.
                  Maybe I missed a step - those are instructions for the Qt Creator, not designer:
                  https://www.qcustomplot.com/index.php/tutorials/settingup
                  But you referred to the designer. Can you please tell me how this can be done there as well? Thanks.

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

                  @tamirmichael said in QCustomPlot integration with VS2017:

                  But you referred to the designer. Can you please tell me how this can be done there as well?

                  It's already done in the tutorial. See the "Promote to..." step.

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

                  1 Reply Last reply
                  1
                  • T Offline
                    T Offline
                    tamirmichael
                    wrote on last edited by
                    #9

                    OK thanks, will try later once I'm home....

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tamirmichael
                      wrote on last edited by
                      #10

                      Problem solved. Thanks for the timely support - much appreciated !

                      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