试了下,没有问题
编译的库:
https://github.com/jkriege2/JKQtPlotter/releases/tag/v4.0.3
我的环境:
Qt Creator 12.0.2
Based on Qt 6.6.0 (MSVC 2019, x86_64)
testjkqtp.pro
```
LIBS += -LD:\Qt\pj\build-JKQtPlotterBuildAllExamples-Desktop_Qt_6_6_3_MinGW_64_bit-Debug\qmake\staticlib\jkqtplotterlib\debug -ljkqtplotterlib_debug
INCLUDEPATH += D:\Qt\pj\JKQtPlotter-4.0.3\lib
```
mainwindow.cpp
```
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
plot = new JKQTPlotter(true, this);
}
MainWindow::~MainWindow()
{
delete ui;
delete plot;
}
```
hpp
```
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QElapsedTimer>
#include <QCheckBox>
#include <QLineEdit>
#include <QTimer>
#include <QImage>
#include <QVBoxLayout>
#include <QWidget>
#include <QTabWidget>
#include <QFormLayout>
#include <QCheckBox>
#include "jkqtplotter/jkqtplotter.h"
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
JKQTPlotter* plot;
};
#endif // MAINWINDOW_H
```
效果
![123123]( https://img2.imgtp.com/2024/05/14/CMZCRxcq.jpg) |