Skip to content

Is it possible to integrate Qwt plot and qnanopainter ? #66

Description

@stephenlang84

Hi.

I'm using Qwt lib to render a graph, my app uses qml, but as you know Qwt bases on QWidget, so I used QQuickPaintedItem to paint the output of Qwt to my qml app, inspired are from https://github.com/carlos22/qwtquick2.

But this is a performance issue QTBUG-96205 of using QQuickPaintedItem to render a "QWidget's content".

Even though I enabled the QwtPlotOpenGLCanvas of Qwt but I found that this optimization only works for QWidget applications because QOpenGLWidget does not support the render() function with OpenGL. QwtPlotOpenGLCanvas is working well with a widget application, this is example app of Qwt. https://github.com/opencor/qwt/tree/master/examples/refreshtest.

So qnanopainter can help solving the QQuickPaintedItem's performance issue in this case. can't it ?

Actually I tried below solution, the frequency of calling this paint() or update the graph is 40 ms, but my implementation could not solve the CPU% that takes a lot of memory, I guess it is from creating the images.

void QwtQuickPainter::paint(QNanoPainter *painter)
{
    static int index = 0;
   QwtPlotOpenGLCanvas* plotCanvas = qobject_cast< QwtPlotOpenGLCanvas* >( m_qwtPlot->canvas() );
    QNanoImage nImage(plotCanvas->grab(QRect(0, 0, width(), height())).toImage(), QString::number(index));
    painter->drawImage(nImage, 0, 0, width(), height());
    index++;
}

Thanks for your advice !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions