Most Qt widgets are not drawn using opengl but instead are rasterized. I
was surprised when I first learned this as well.
says that it is impossible to mix it. This is some sort of hopeless
situation. (((
Hi Denis,
Most Qt widgets are not drawn using opengl but instead are rasterized. I
was surprised when I first learned this as well.
"QPainter <http://doc.qt.io/qt-5/qpainter.html>
<http://doc.qt.io/qt-5/qpainter.html> provides API for drawing vector
graphics, text and images onto different surfaces, or QPaintDevice
<http://doc.qt.io/qt-5/qpaintdevice.html>
<http://doc.qt.io/qt-5/qpaintdevice.html> instances, such as QImage
<http://doc.qt.io/qt-5/qimage.html> <http://doc.qt.io/qt-5/qimage.html>,
QOpenGLPaintDevice
<http://doc.qt.io/qt-5/whatsnew50.html#qopenglpaintdevice>
<http://doc.qt.io/qt-5/whatsnew50.html#qopenglpaintdevice>, QWidget
<http://doc.qt.io/qt-5/qwidget.html> <http://doc.qt.io/qt-5/qwidget.html>,
and QPrinter <http://doc.qt.io/qt-5/qprinter.html>
<http://doc.qt.io/qt-5/qprinter.html>. The actual drawing happens in the
QPaintDevice <http://doc.qt.io/qt-5/qpaintdevice.html>
<http://doc.qt.io/qt-5/qpaintdevice.html>'s QPaintEngine
<http://doc.qt.io/qt-5/qpaintengine.html>
<http://doc.qt.io/qt-5/qpaintengine.html>. The software rasterizer and
the OpenGL (ES) 2.0 back-ends are the two most important QPaintEngine
<http://doc.qt.io/qt-5/qpaintengine.html>
<http://doc.qt.io/qt-5/qpaintengine.html> implementations. *The raster
paint engine is Qtâs software rasterizer, and is used when drawing on a
QImage <http://doc.qt.io/qt-5/qimage.html>
<http://doc.qt.io/qt-5/qimage.html> or QWidget
<http://doc.qt.io/qt-5/qwidget.html> <http://doc.qt.io/qt-5/qwidget.html>.*
Its strength over the OpenGL paint engine is its high quality when
antialiasing is enabled, and a complete feature set.â
I even have created a simple test app, which re-fill the 1280x800 rect
every 50 msec with the 'red' and 'green' colors.
[code]
#include <QApplication>
#include <QWidget>
#include <QPaintEvent>
#include <QPainter>
class Widget final : public QWidget
{
explicit Widget(QWidget *parent = nullptr);
void paintEvent(QPaintEvent *event) final;
void timerEvent(QTimerEvent *event) final;
};
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
startTimer(50);
}
void Widget::paintEvent(QPaintEvent *event)
{
QPainter p(this);
static bool toggled = false;
const auto color = (toggled) ? QColor(Qt::red) : QColor(Qt::green);
const auto rect = event->rect();
p.fillRect(rect, color);
toggled = !toggled;
}
void Widget::timerEvent(QTimerEvent *event)
{
Q_UNUSED(event);
update();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Widget w;
w.setMinimumSize(1280, 800);
w.show();
return app.exec();
}
[/code]
And then I see that the Desktop PC has the ~0% CPU load, but the iMX6 has
~50% CPU load. WTF?
BR,
Denis
Post by Denis ShienkovHi all.
I have an Apalis iMX6 board with the Yocto's image with the working
'eglfs' and 'linuxfb' backends (without of X11 support).
I need to create a 'pure' QtWidgets application, where I need to use a
real-time plotting with the Qwt library (using the Qt Quick is not an
option, as there the QtCharts is not ready for usage) .
But, I'm sadly surprised that a 2D painting takes ~100% CPU loading as
with the 'eglfs' and as with 'linuxfb' backends. It is not an acceptable,
because, e.g. on Desktop Linux/Windows it takes ~4-5% CPU loading.
Is any workarounds for this? Maybe I need to re-build the Yocto's image
to enable the X11 'xcb' support?
BR,
Denis
_______________________________________________
_______________________________________________
Development mailing list
http://lists.qt-project.org/mailman/listinfo/development