Skip to content

Commit 46170bc

Browse files
author
Mosolov_S
committed
Implemented
1 parent 145f53b commit 46170bc

12 files changed

+37358
-1
lines changed

PlotView.qml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import QtQuick 2.0
2+
import CustomPlot 1.0
3+
4+
Item {
5+
id: plotForm
6+
7+
Text {
8+
id: text
9+
text: qsTr("Plot form")
10+
}
11+
12+
CustomPlotItem {
13+
id: customPlot
14+
anchors.fill: parent
15+
16+
Component.onCompleted: initCustomPlot()
17+
}
18+
}

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
qmlplot
1+
# qmlplot
2+
3+
This is a wrapper to QCustomPlot to render by QtQuick2.
4+
Implemented [solution from QCustomPlot forum](http://www.qcustomplot.com/index.php/support/forum/172).

main.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <QtPrintSupport/QPrinter>
2+
//#include <QGuiApplication>
3+
#include<QApplication>
4+
#include <QQmlApplicationEngine>
5+
6+
#include "qmlplot.h"
7+
8+
int main(int argc, char *argv[])
9+
{
10+
QApplication a(argc, argv);
11+
// QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
12+
// QGuiApplication app(argc, argv);
13+
14+
qmlRegisterType<CustomPlotItem>("CustomPlot", 1, 0, "CustomPlotItem");
15+
16+
QQmlApplicationEngine engine;
17+
engine.load(QUrl(QLatin1String("qrc:/main.qml")));
18+
19+
return a.exec();
20+
}

main.qml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import QtQuick 2.7
2+
import QtQuick.Controls 2.0
3+
import QtQuick.Layouts 1.0
4+
5+
ApplicationWindow {
6+
visible: true
7+
width: 640
8+
height: 480
9+
title: qsTr("Hello QCustomPlot in QML")
10+
11+
// Item {
12+
// id: mainView
13+
// anchors.fill: parent
14+
// PlotView {
15+
// }
16+
// }
17+
SwipeView {
18+
id: swipeView
19+
anchors.fill: parent
20+
currentIndex: tabBar.currentIndex
21+
interactive: false
22+
23+
PlotView {
24+
}
25+
26+
Page {
27+
Label {
28+
text: qsTr("This is implementation of http://www.qcustomplot.com/index.php/support/forum/172\n" +
29+
"Adding random data on 500 ms tick to plot")
30+
anchors.centerIn: parent
31+
}
32+
}
33+
}
34+
35+
footer: TabBar {
36+
id: tabBar
37+
currentIndex: swipeView.currentIndex
38+
TabButton {
39+
text: qsTr("Plot")
40+
}
41+
TabButton {
42+
text: qsTr("Info")
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)