UI: Use QCustomPlot instead of QtCharts.

This commit is contained in:
Nodir Temirkhodjaev 2018-10-25 15:40:21 +05:00
parent 421501e77a
commit f08dbc9182
7 changed files with 36910 additions and 17 deletions

View File

@ -2,7 +2,6 @@
"files": { "files": {
"${TARGET}": { "${TARGET}": {
"common": [ "common": [
"${QTPATH}/bin/Qt5Charts.dll",
"${QTPATH}/bin/Qt5Core.dll", "${QTPATH}/bin/Qt5Core.dll",
"${QTPATH}/bin/Qt5Gui.dll", "${QTPATH}/bin/Qt5Gui.dll",
"${QTPATH}/bin/Qt5Qml.dll", "${QTPATH}/bin/Qt5Qml.dll",

View File

@ -6,7 +6,7 @@
md %TARGET_PATH% md %TARGET_PATH%
cd %TARGET_PATH% cd %TARGET_PATH%
del /Q /F qt*.* FortFirewall.exe del /Q /F qt*.* FortFirewall.exe
rd /Q /S imports plugins i18n rd /Q /S i18n imports plugins scripts
cd .. cd ..
powershell.exe -executionpolicy remotesigned -file setup-deployment.ps1 %TARGET_PATH% %* powershell.exe -executionpolicy remotesigned -file setup-deployment.ps1 %TARGET_PATH% %*

30214
src/3rdparty/qcustomplot/qcustomplot.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

6673
src/3rdparty/qcustomplot/qcustomplot.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
QT += charts core gui qml widgets QT += core gui qml widgets
CONFIG += c++11 CONFIG += c++11
@ -168,3 +168,5 @@ installer_build {
} }
include(db/sqlite/sqlite.pri) include(db/sqlite/sqlite.pri)
include(graph/qcustomplot/qcustomplot.pri)

View File

@ -1,14 +1,8 @@
#include "graphwindow.h" #include "graphwindow.h"
#include <QGraphicsLayout>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QtCharts/QBarCategoryAxis>
#include <QtCharts/QBarSeries>
#include <QtCharts/QBarSet>
#include <QtCharts/QChartView>
#include <QtCharts/QLegend>
QT_CHARTS_USE_NAMESPACE #include "qcustomplot.h"
GraphWindow::GraphWindow(QWidget *parent) : GraphWindow::GraphWindow(QWidget *parent) :
WidgetWindow(parent) WidgetWindow(parent)
@ -26,15 +20,14 @@ GraphWindow::GraphWindow(QWidget *parent) :
void GraphWindow::setupUi() void GraphWindow::setupUi()
{ {
QChart *chart = new QChart(); QCustomPlot *plot = new QCustomPlot(this);
chart->layout()->setContentsMargins(0, 0, 0, 0); plot->setContentsMargins(0, 0, 0, 0);
chart->setBackgroundRoundness(0);
QChartView *chartView = new QChartView(chart); QCPGraph *graph = plot->addGraph();
chartView->setRenderHint(QPainter::Antialiasing); graph->setPen(QColor(250, 120, 0));
QVBoxLayout *mainLayout = new QVBoxLayout(); QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(0); mainLayout->setMargin(0);
mainLayout->addWidget(chartView); mainLayout->addWidget(plot);
setLayout(mainLayout); setLayout(mainLayout);
} }

View File

@ -0,0 +1,12 @@
DEFINES += \
QCUSTOMPLOT_USE_OPENGL
QCUSTOMPLOT_DIR = $$PWD/../../../3rdparty/qcustomplot
INCLUDEPATH += $$QCUSTOMPLOT_DIR
SOURCES += \
$$QCUSTOMPLOT_DIR/qcustomplot.cpp
HEADERS += \
$$QCUSTOMPLOT_DIR/qcustomplot.h