[Qt-interest] Compositing Support in QGraphicsScene/View

Michael Jackson mike.jackson at bluequartz.net
Mon Nov 8 20:59:00 CET 2010


Is there any compositing support in QGraphicsView or QGraphics Scene? Here
is what I want to do. I have 2 images that I want to use the usual Qt
compositing stuff with. In a previous program I manually implemented a
"paint" method with something like the following code:

  if (m_CompositeImages == true && m_OverlayImage.isNull() == false)
  {
    QImage topImage = _scaleImage(m_OverlayImage);
    QPainter painter;
    QImage paintImage(dataImage.size(),
        QImage::Format_ARGB32_Premultiplied);
    QPoint point(0, 0);
    painter.begin(&paintImage);
    // Draw the fixed Image first
    painter.setPen(Qt::NoPen);
    painter.drawImage(point, topImage);
    // Draw the moving image next
    painter.setCompositionMode(m_composition_mode);
    painter.drawImage(point, dataImage);
    painter.end();
    imagePixmap = QPixmap::fromImage(paintImage);
    m_CompositedImage = paintImage;
  }

Then send the m_CompositedImage to the graphics scene. I was wondering if
there is any type of "automatic" compositing support in the QGraphicsView?
Maybe setting the background, background brush or something like that?


Thanks for any help
Mike Jackson
Www.bluequartz.net




More information about the Qt-interest-old mailing list