Solved QTableView background problem
-
Hi,
I would like to draw a pixmap on bottom right corner of a QTableView.
For that I overrided the panit event function:void MdTextureTableView::paintEvent(QPaintEvent* event) { if(!m_pixBackground.isNull()) { QPainter painter(viewport()); int iHeight = viewport()->height() / 1.5; int iWidth = (m_pixBackground.size().width() / m_pixBackground.size().height()) * iHeight; painter.drawPixmap(viewport()->width() - iWidth, viewport()->height() - iHeight, iWidth,iHeight, m_pixBackground); painter.end(); } QTableView::paintEvent(event); }
I have this results (ok for me)
but when I scroll, I have this horrible results:
I don't know what I missed, how can I fix this ?
Even this does not change anything:QObject::connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(repaint()));
More information:
(I set a QStyledItemDelegate to display elements) -
QObject::connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this->viewport(), SLOT(update()));