标签: qcustomplot

与Qwt相比,QCustomPlot有哪些优点/缺点?

我现在使用Qwt已经两年了.我喜欢它的面向对象的类,这使得很容易适应这些图和功能.如今,QCustomPlot正变得越来越受欢迎,并与Qwt竞争.当然我确实比较了API.但是,我对两个图书馆的有经验的用户的证词感兴趣.什么方便?什么不是?有任何陷阱吗?

plot qt qwt qcustomplot

17
推荐指数
4
解决办法
2万
查看次数

QCustomPlot - 在customPlot下面的QCPAxisRect上显示项目

在类似于QCustomPlot财务演示的项目中,我想将QCPItemRect不仅绘制到图表区域,还绘制到图表下方的区域.

QCPAxisRect *   xRect = new QCPAxisRect( this->ui.customPlot )
...
this->ui.customPlot->plotLayout()->addElement(1, 0, xRect);          
Run Code Online (Sandbox Code Playgroud)

我想添加QCPItemRect之类的

QCPItemRect *    xItem = new QCPItemRect( this->ui.customPlot );
                 xItem -> setPen   ( QPen ( Qt::black ));

                 xItem -> bottomRight ->setAxisRect( this->xRect );
                 xItem -> topLeft     ->setAxisRect( this->xRect );

                 xItem -> bottomRight ->setCoords(x - 2.0, y - 2.0);
                 xItem -> topLeft     ->setCoords(x + 2.0, y + 2.0);

                 this->ui.customPlot->addItem( xItem );
Run Code Online (Sandbox Code Playgroud)

然而,矩形仍然被绘制this->ui.customPlot而不是this->xRect.为什么?

Daniel,非常感谢任何帮助

更新 我自己找到了答案的一部分,缺少一行代码

xItem -> setClipAxisRect( xRect …
Run Code Online (Sandbox Code Playgroud)

c++ qt qcustomplot

12
推荐指数
1
解决办法
1230
查看次数

在鼠标悬停时显示绘图值. - 检测散点

我试图QCustomPlot在我的线条样式中显示不同点的绘图值lsLine.我知道我可以设置一个鼠标悬停在信号上QCustomPlot但不会真正有用,因为我只需要在鼠标悬停在绘制的线上时得到通知.我的问题是有没有办法找出鼠标是否在我的散点上.是否有可以连接的信号,当鼠标在散点上时会告诉我?

c++ qt point mouseover qcustomplot

10
推荐指数
2
解决办法
1万
查看次数

如何显示像theta这样的数学符号

我正试图找到一种方法来显示数学符号,如\ theta,\ phi,\ dot {\ theta},...等等.我找不到在我的情节中显示这些字母的方法.是否qcustomplot支持数学符号?我尝试了以下几行,但很少有字母出现,但其余的则没有.

ui->customPlot1->graph(0)->setName(QString("\u0024"));

c++ qcustomplot

7
推荐指数
1
解决办法
1260
查看次数

库需要QApplication.如何在Qt Quick项目中使用QApplication?

我有一个Qt Quick项目,我刚刚添加了一些源文件.在尝试构建时,我收到错误消息:

QWidget: Cannot create a QWidget without QApplication
Run Code Online (Sandbox Code Playgroud)

由于我有一个Qt Quick项目,我使用QGuiApplication.QApplication是QGuiApplication的子类.如何使QApplication可用于新添加的源?或者当一个人拥有Qt Quick和QWidget时如何解决它?

源文件是显示图形的QCustomPlot库.

编辑:

main.cpp中:

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QtQuick2ApplicationViewer viewer;

    //Register C++ classes with QML
    qmlRegisterType<Bluetooth>("Bluetooth", 1, 0, "Bluetooth");

    //Set start QML file
    viewer.setMainQmlFile(QStringLiteral("qml/test/main.qml"));

    //New Code:
    // generate some data:
    QWidget widget;
    QCustomPlot * customPlot = new QCustomPlot(&widget);

    QVector<double> x(101), y(101); // initialize with entries 0..100
    for (int i=0; i<101; ++i)
    {
      x[i] = i/50.0 - 1; // x goes from -1 to 1 …
Run Code Online (Sandbox Code Playgroud)

c++ qt qtgui qtquick2 qcustomplot

5
推荐指数
1
解决办法
2475
查看次数

如何实现与std :: map一起使用的自定义分配器?

我正在寻找一些关于如何实现与a一起使用的自定义分配器的指针std::map.我有兴趣用数百万个条目填充地图而不为容器中的每个元素分配(这是此容器的默认值).这样做的原因是将数据传递给使用地图存储图表样本的第三方库(QCustomPlot),并且在绘制大型时间序列时我感觉性能受到影响.

如果std::map事先已知大小,是否可以通过一次分配来完成此操作?

编辑:节点将按升序输入容器.

c++ stdmap c++11 qcustomplot

5
推荐指数
1
解决办法
537
查看次数

如何在QCustomPlot中隐藏网格并仅显示zeroline?

在隐藏网格的同时,有没有办法在QCustomPlot中显示zeroline?我试过用以下行隐藏网格:

ui->customPlot->xAxis->grid()->setVisible(false);
ui->customPlot->yAxis->grid()->setVisible(false);
Run Code Online (Sandbox Code Playgroud)

但这也隐藏了zerolines.我需要保持zerolines可见.

qt qtgui qcustomplot

4
推荐指数
1
解决办法
2315
查看次数

Qt - 如何在QCustomPlot上定义轴间隔?

我正在使用QCustomPlotQt来绘制视频序列的各个方面.

我想定义图表的背景,以便定义我的特定区域yAxis.我的图是这样的:

我的情节(例子)

我想在我的定义间隔yAxis得到这样的东西:

在此输入图像描述

最后一张图片属于一个名为PEAT的程序,用于分析可触发癫痫发作的视频.我指的是他们沿着区域定义区域的方式yAxis.

有什么建议?

c++ qt axis qt5 qcustomplot

3
推荐指数
1
解决办法
1267
查看次数

Qt5 抛出 std::bad_alloc

我正在尝试在我的控制台应用程序中使用 QCustomPlot。我首先为它创建了一个适合我用途的简单包装器。包装器应该是但是,每次我尝试显示窗口时,我都会收到 std::bad_alloc 错误。

这是我的代码,我在以下位置创建了一个包装类Plot.hpp

class Plot
{
    private:
        std::string name;
        QApplication* app;
        QMainWindow* window;
        QCustomPlot* plotWidget;
    public:
        Plot(std::string& name);
        // OTHER METHODS
        void showPlot();
};
Run Code Online (Sandbox Code Playgroud)

在我的Plot.cpp文件中,我有以下内容:

Plot::Plot(std::string& name) : name(name)
{
    char *gui_argv[] = {(char*)(name.c_str()), NULL};
    int gui_argc = sizeof(gui_argv) / sizeof(char*) - 1;
    app = new QApplication(gui_argc, gui_argv);
    window = new QMainWindow();
    // Add plot Widget
    plotWidget = new QCustomPlot(window);
    window->setCentralWidget(plotWidget);
    plotWidget->plotLayout()->clear();
}

// OTHER METHODS

void Plot::showPlot()
{
    // Run the GUI
    window->show(); …
Run Code Online (Sandbox Code Playgroud)

c++ qt c++11 qt5 qcustomplot

2
推荐指数
1
解决办法
1060
查看次数

标签 统计

qcustomplot ×9

c++ ×7

qt ×7

c++11 ×2

qt5 ×2

qtgui ×2

axis ×1

mouseover ×1

plot ×1

point ×1

qtquick2 ×1

qwt ×1

stdmap ×1