Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGraphicsScene not output image after add QPixmap



  • Hello!
    I use qt-5.5.1 x64 on linux.
    For output images I use qrpaphicsscene, follow simple code

    _scene->addPixmap(QPixmap::fromImage(image));
    

    Usually I work with images in QImage::Format_RGB888, but now I have images in QImage::Format_ARGB32 and I see only black screen.
    Ok, may be qgraphicsscene can't work with QImage::Format_ARGB32?
    I convert image to QImage::Format_RGB888

    QImage rgb = image.convertToFormat(QImage::Format_RGB888);
    _scene->addPixmap(QPixmap::fromImage(rgb));
    

    Unfortunately this not solve problem.
    How can I solve this problem?
    Thank you and excuse my bad english.


  • Lifetime Qt Champion

    Hi,

    Might be a silly question but are you sure that the new image is valid and not null ?


Log in to reply