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. how create Dynamic Chart ??
Forum Updated to NodeBB v4.3 + New Features

how create Dynamic Chart ??

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 218 Views 1 Watching
  • 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.
  • timob256T Offline
    timob256T Offline
    timob256
    wrote on last edited by timob256
    #1

    Wrapper class header file errors :
    qdynamicchart.h:14:29: Unknown class name 'QChart'; did you mean 'QChar'? (fix available)
    :2089:1: note: 'QChar' declared here
    change 'QChart' to 'QChar'

    qdynamicchart.h:18:28: Unknown type name 'QChart'; did you mean 'QChar'? (fix available)
    qchar.h:75:21: 'QChar' declared here
    change 'QChart' to 'QChar'

    #ifndef QDYNAMICCHART_H
    #define QDYNAMICCHART_H
    
    #include <QChart>
    
    class QDynamicChart: public QChart
    {
        Q_OBJECT
    public:
        explicit QDynamicChart(QChart *parent = 0);
        
        ~QDynamicChart();
        
        static int ResID;   // Статическая переменная, счетчик номеров кнопок
        int getID();        // Функция для возврата локального номера кнопки
        
        
    public slots:
        
    private:
        int ChartID = 0;   // Локальная переменная, номер кнопки
    };
    
    #endif // QDYNAMICCHART_H
    

    why how create Dynamic Chart ??

    timob256T 1 Reply Last reply
    0
    • timob256T timob256

      Wrapper class header file errors :
      qdynamicchart.h:14:29: Unknown class name 'QChart'; did you mean 'QChar'? (fix available)
      :2089:1: note: 'QChar' declared here
      change 'QChart' to 'QChar'

      qdynamicchart.h:18:28: Unknown type name 'QChart'; did you mean 'QChar'? (fix available)
      qchar.h:75:21: 'QChar' declared here
      change 'QChart' to 'QChar'

      #ifndef QDYNAMICCHART_H
      #define QDYNAMICCHART_H
      
      #include <QChart>
      
      class QDynamicChart: public QChart
      {
          Q_OBJECT
      public:
          explicit QDynamicChart(QChart *parent = 0);
          
          ~QDynamicChart();
          
          static int ResID;   // Статическая переменная, счетчик номеров кнопок
          int getID();        // Функция для возврата локального номера кнопки
          
          
      public slots:
          
      private:
          int ChartID = 0;   // Локальная переменная, номер кнопки
      };
      
      #endif // QDYNAMICCHART_H
      

      why how create Dynamic Chart ??

      timob256T Offline
      timob256T Offline
      timob256
      wrote on last edited by
      #3

      @timob256

      Another header coupon, this ok #include <QtCharts>

      .h

      #ifndef QDYNAMICCHART_H
      #define QDYNAMICCHART_H
      
      //#include <QChart>
      //#include <QtCharts/QChartGlobal>
      
      #include <QtCharts>
      
      class QDynamicChart: public QChart
      {
          Q_OBJECT
      public:
          explicit QDynamicChart(QChart *parent = 0);
      
          ~QDynamicChart();
      
          static int ResID;   // Статическая переменная, счетчик номеров графика
          int getID();        // Функция для возврата локального номера графика
      
      
      public slots:
      
      private:
          int ChartID = 0;   // Локальная переменная, номер графика
      };
      
      #endif // QDYNAMICCHART_H
      

      .cpp

      #include "qdynamicchart.h"
      
      
      QDynamicChart::QDynamicChart(QChart *parent) :
          QChart(parent)
      {
          ResID++;            // Увеличение счетчика на единицу
          ChartID = ResID;   /* Присвоение кнопке номера, по которому будет производиться
                               * дальнейшая работа с кнопок
                               * */
      }
      
      QDynamicChart::~QDynamicChart()
      {
      
      }
      /* Метод для возврата значения номера кнопки
       * */
      int QDynamicChart::getID()
      {
          return ChartID;
      }
      
      /* Инициализация статической переменной класса.
       * Статическая переменная класса должна инициализироваться в обязательном порядке
       * */
      int QDynamicChart::ResID = 0;
      
      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        Did you add the module to your project as described here ?

        On an unrelated note, you really should not prefix your custom classes with Q. It's misleading and people will have a hard time checking that code thinking it's part of the Qt code base.

        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
        2
        • timob256T timob256

          Wrapper class header file errors :
          qdynamicchart.h:14:29: Unknown class name 'QChart'; did you mean 'QChar'? (fix available)
          :2089:1: note: 'QChar' declared here
          change 'QChart' to 'QChar'

          qdynamicchart.h:18:28: Unknown type name 'QChart'; did you mean 'QChar'? (fix available)
          qchar.h:75:21: 'QChar' declared here
          change 'QChart' to 'QChar'

          #ifndef QDYNAMICCHART_H
          #define QDYNAMICCHART_H
          
          #include <QChart>
          
          class QDynamicChart: public QChart
          {
              Q_OBJECT
          public:
              explicit QDynamicChart(QChart *parent = 0);
              
              ~QDynamicChart();
              
              static int ResID;   // Статическая переменная, счетчик номеров кнопок
              int getID();        // Функция для возврата локального номера кнопки
              
              
          public slots:
              
          private:
              int ChartID = 0;   // Локальная переменная, номер кнопки
          };
          
          #endif // QDYNAMICCHART_H
          

          why how create Dynamic Chart ??

          timob256T Offline
          timob256T Offline
          timob256
          wrote on last edited by
          #3

          @timob256

          Another header coupon, this ok #include <QtCharts>

          .h

          #ifndef QDYNAMICCHART_H
          #define QDYNAMICCHART_H
          
          //#include <QChart>
          //#include <QtCharts/QChartGlobal>
          
          #include <QtCharts>
          
          class QDynamicChart: public QChart
          {
              Q_OBJECT
          public:
              explicit QDynamicChart(QChart *parent = 0);
          
              ~QDynamicChart();
          
              static int ResID;   // Статическая переменная, счетчик номеров графика
              int getID();        // Функция для возврата локального номера графика
          
          
          public slots:
          
          private:
              int ChartID = 0;   // Локальная переменная, номер графика
          };
          
          #endif // QDYNAMICCHART_H
          

          .cpp

          #include "qdynamicchart.h"
          
          
          QDynamicChart::QDynamicChart(QChart *parent) :
              QChart(parent)
          {
              ResID++;            // Увеличение счетчика на единицу
              ChartID = ResID;   /* Присвоение кнопке номера, по которому будет производиться
                                   * дальнейшая работа с кнопок
                                   * */
          }
          
          QDynamicChart::~QDynamicChart()
          {
          
          }
          /* Метод для возврата значения номера кнопки
           * */
          int QDynamicChart::getID()
          {
              return ChartID;
          }
          
          /* Инициализация статической переменной класса.
           * Статическая переменная класса должна инициализироваться в обязательном порядке
           * */
          int QDynamicChart::ResID = 0;
          
          1 Reply Last reply
          0
          • timob256T timob256 has marked this topic as solved on

          • Login

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