Using hardware acceleration(GPU) for QWidget::paintEvent()
Unsolved
General and Desktop
-
How would I convert below code to use hardware rendering ?
- My BaseWidget class has to be a custom QWidget.
- Do I have to perform hardware checks before writing any GPU related code?
- Will OpenGLWidget help ?
BaseWidget::BaseWidget() { ... m_pCanvas = new QWidget; m_pQVBoxLayout->addWidget(m_pCanvas); this->setLayout(m_pQVBoxLayout); ... } //supposed to be called 30 times a second. BaseWidget::getImageData(uchar* buf, size_t size) { m_pQPixmap->loadFromData(buf,size,"BMP"); this->update(); } BaseWidget::paintEvent() { ... painter.drawPixmap(rect,*m_pQPixmap, m_pQImage->rect()); ... }
-
Hi,
- Why ?
- Depends on your target
- Might be. QWidget doesn't use hardware acceleration.
-
- If you are sure that the target has a GPU.