Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.26 KB | None | 0 0
  1. #-------------------------------------------------
  2. #
  3. # Project created by QtCreator 2019-05-29T12:23:54
  4. #
  5. #-------------------------------------------------
  6.  
  7. QT += core gui designer charts
  8.  
  9. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
  10.  
  11. TARGET = test2
  12. TEMPLATE = app
  13.  
  14. # The following define makes your compiler emit warnings if you use
  15. # any feature of Qt which has been marked as deprecated (the exact warnings
  16. # depend on your compiler). Please consult the documentation of the
  17. # deprecated API in order to know how to port your code away from it.
  18. DEFINES += QT_DEPRECATED_WARNINGS
  19.  
  20. # You can also make your code fail to compile if you use deprecated APIs.
  21. # In order to do so, uncomment the following line.
  22. # You can also select to disable deprecated APIs only up to a certain version of Qt.
  23. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
  24.  
  25. CONFIG += c++11
  26.  
  27. SOURCES +=
  28. #main.cpp
  29. mainwindow.cpp
  30. ssgraphs.cpp
  31.  
  32. HEADERS +=
  33. mainwindow.h
  34. ssgraphs.h
  35.  
  36. FORMS +=
  37. mainwindow.ui
  38. ssgraphs.ui
  39.  
  40. # Default rules for deployment.
  41. qnx: target.path = /tmp/$${TARGET}/bin
  42. else: unix:!android: target.path = /home/pi/Desktop/$${TARGET}/bin
  43. !isEmpty(target.path): INSTALLS += target
  44.  
  45. #ifndef MAINWINDOW_H
  46. #define MAINWINDOW_H
  47. #include <QMainWindow>
  48. #include <QMovie>
  49. #include <QTimer>
  50. #include <QTime>
  51. #include <QLabel>
  52. #include <QDateEdit>
  53. #include <QtCharts>
  54. #include <QBarSet>
  55. #include <QChartView>
  56. #include "ssgraphs.h"
  57. #include <QColor>
  58. #include <QtDebug>
  59. #include <QMainWindow>
  60. #include <QGraphicsPixmapItem>
  61.  
  62.  
  63. namespace Ui {
  64. class MainWindow;
  65. }
  66.  
  67. #include <QDesignerCustomWidgetCollectionInterface>
  68. #include <QtDesigner/qtdesigner.h>
  69. #include <QtCore/qplugin.h>
  70. #include "ssgraphs.h"
  71.  
  72. class MainWindow: public QObject, public QDesignerCustomWidgetCollectionInterface
  73. {
  74. Q_OBJECT
  75. Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface")
  76. Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
  77.  
  78. public:
  79. MainWindow(QObject *parent = 0);
  80.  
  81. QList<QDesignerCustomWidgetInterface*> customWidgets() const override;
  82.  
  83. private:
  84. QList<QDesignerCustomWidgetInterface*> widgets;
  85. };
  86.  
  87. #endif // MAINWINDOW_H
  88.  
  89. #ifndef SSGRAPHS_H
  90. #define SSGRAPHS_H
  91.  
  92. #include <QWidget>
  93.  
  94. #include <QtCharts>
  95. #include <QChartView>
  96.  
  97. #include <QBarSet>
  98. #include <QBarSeries>
  99.  
  100. #include <QPieSeries>
  101. #include <QPieSlice>
  102. namespace Ui {
  103. class ssGraphs;
  104. }
  105.  
  106. class ssGraphs : public QWidget
  107. {
  108. Q_OBJECT
  109.  
  110. public:
  111. explicit ssGraphs(QWidget *parent = nullptr);
  112. ~ssGraphs();
  113.  
  114.  
  115.  
  116. private:
  117. Ui::ssGraphs *ui;
  118. };
  119.  
  120. #endif // SSGRAPHS_H
  121.  
  122. #include "mainwindow.h"
  123. #include "ui_mainwindow.h"
  124.  
  125. #include <QImage>
  126. #include <QGraphicsPixmapItem>
  127. #include <QVBoxLayout>
  128. #include <QPushButton>
  129. #include <QGraphicsScene>
  130. #include <QGraphicsView>
  131. #include <QPixmap>
  132.  
  133.  
  134. #define IMAGE_COUNT 99
  135.  
  136. MainWindow::MainWindow(QObject *parent)
  137. : QObject(parent)
  138. {
  139. widgets.append(new ssGraphs(this));
  140. //widgets.append(new CustomWidgetTwoInterface(this));
  141. //widgets.append(new CustomWidgetThreeInterface(this));
  142. }
  143.  
  144. QList<QDesignerCustomWidgetInterface*> MainWindow::customWidgets() const
  145. {
  146. return widgets;
  147. }
  148.  
  149. #include "ssgraphs.h"
  150. #include "ui_ssgraphs.h"
  151.  
  152. ssGraphs::ssGraphs(QWidget *parent) :
  153. QWidget(parent),
  154. ui(new Ui::ssGraphs)
  155. {
  156. ui->setupUi(this);
  157. ////////PIE CHART///////////////////////////////////////////////////////////////////////
  158.  
  159. QPieSeries *series = new QPieSeries();
  160. series->append("Jane", 10);
  161. series->append("Joe", 20);
  162. series->append("Andy", 30);
  163. series->append("Barbara", 40);
  164. series->append("Jason", 50);
  165.  
  166. QPieSlice *slice = series->slices().at(1);
  167. slice->setExploded();
  168. slice->setLabelVisible();
  169. slice->setPen(QPen(Qt::darkGreen, 2));
  170. slice->setBrush(Qt::green);
  171.  
  172. QChart *chart = new QChart();
  173. chart->addSeries(series);
  174. chart->setTitle("Students Performance");
  175.  
  176. QChartView *chartView = new QChartView(chart);
  177. chartView->setParent(ui->verticalFrame);
  178. }
  179.  
  180. ssGraphs::~ssGraphs()
  181. {
  182. delete ui;
  183. }
  184.  
  185. /home/so/Qt_Test_Projects/test2/mainwindow.h:24: error: QtDesigner/qtdesigner.h: No such file or directory
  186. #include <QtDesigner/qtdesigner.h>
  187. ^
  188.  
  189. /home/so/Qt_Test_Projects/test2/mainwindow.h:24: error: QtDesigner/qtdesigner.h: No such file or directory
  190. #include <QtDesigner/qtdesigner.h>
  191. ^
  192.  
  193. /home/so/Qt_Test_Projects/test2/ssgraphs.cpp:6: error: invalid use of incomplete type 'class Ui::ssGraphs'
  194. ui(new Ui::ssGraphs)
  195. ^~~~~~~~
  196. /home/so/Qt_Test_Projects/test2/ssgraphs.cpp:8: error: invalid use of incomplete type 'class Ui::ssGraphs'
  197. ui->setupUi(this);
  198. ^~
  199.  
  200. /home/so/Qt_Test_Projects/test2/ssgraphs.cpp:29: error: invalid use of incomplete type 'class Ui::ssGraphs'
  201. chartView->setParent(ui->verticalFrame);
  202. ^~
  203.  
  204. /home/so/Qt_Test_Projects/test2/ssgraphs.cpp:6: error: allocation of incomplete type 'Ui::ssGraphs'
  205.  
  206.  
  207. /home/so/Qt_Test_Projects/test2/ssgraphs.cpp:8: error: member access into incomplete type 'Ui::ssGraphs'
  208.  
  209.  
  210. /home/so/Qt_Test_Projects/test2/ssgraphs.cpp:29: error: member access into incomplete type 'Ui::ssGraphs'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement