"QPaintEngine* MyQWidget::paintEngine() const" Never called!
Unsolved
General and Desktop
-
Hi,
I try to do an offscreen "display" without OpenGL.
I try to do something similar to this:
https://parich.us/blog/2019/07/02/qt-widgets-vulkan.htmlUnfortunately, my paintEngine overload is never called.
For now, I only have
.hpp:class MyQWidget: public QWidget { public: QPixmap m_oTheBackendPixmap; QPaintEngine *paintEngine() const override; };
.cpp:
QPaintEngine* MyQWidget::paintEngine() const { qDebug() << "MyQWidget::paintEngine()"; return m_oTheBackendPixmap.paintEngine(); } MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { mainWindowWidget = new MyQWidget; this->setCentralWidget(mainWindowWidget); ...
But my main windows are drawn as before, and I never see my debug message "MyQWidget::paintEngine()"
Someone can help me to see what I miss?
Thanks,
Stéphane Germain
-
Don't look for it anymore, I got it.
For info, far in QWidget doc, we can read://If you are using a custom paint engine without Qt's backingstore, // Qt::WA_PaintOnScreen must be set. Otherwise // QWidget::paintEngine() will never be called; // the backingstore will be used instead. setAttribute(Qt::WA_PaintOnScreen);
It was that!
Thanks
Stéphane -
Hi and welcome to devnet,
What version of Qt are you using ?
What OS are you running ?