Peter Kümmel wrote:
I've tried to fix the resize bug,

- open lyx
- resize to a small window
- load a file
- scroll down a bit <- this is important
- maximize teh window,

but I could only find where it happens
and couldn't figure out how to fix it.


In QWorkArea::resizeEvent the asignment of the
QPixmap with the new size fails because the
painter is active.

This is the Qt message:
QPixmap::operator=: Cannot assign to pixmap during painting

and happens at ---->
void QWorkArea::resizeEvent(QResizeEvent * resizeEvent)
{
        workWidth_ = viewport()->width();
        workHeight_ = viewport()->height();

        verticalScrollBar()->setPageStep(viewport()->height());

//      screen_device_ = QPixmap(viewport()->width(), viewport()->height());
//      paint_device_ = QImage(viewport()->width(), viewport()->height(), 
QImage::Format_RGB32);
---->        paint_device_ = QPixmap(viewport()->width(), viewport()->height());

Try to inverse the two lines:

 paint_device_ = QPixmap(viewport()->width(), viewport()->height());
 verticalScrollBar()->setPageStep(viewport()->height());

I guess the "verticalScrollBar()->setPageStep()" results in a painting event so paint_device_ is used at the same time it is being re-affected.

If that does not solve the problem, maybe the solution is to use a shared_ptr<QPixmap> instead of a QPixmap for paint_device_.

Abdel.

Reply via email to