Transparent QImage on QSGTexture



  • I am using Qt5.8 on Windows. I have created a QQucikItem which i am rendering on QML. In updatePaintNode function i am creating a QImage(which have some transparent part) as finalImage.

    QSGSimpleTextureNode *node = 0;
    QSGTexture *texture;        
    node = static_cast<QSGSimpleTextureNode *>(oldNode);
    if (!node) {
        node = new QSGSimpleTextureNode();
    }
    
    texture = window()->createTextureFromImage(finalImage);
    node->setTexture(texture);
    node->setRect(boundingRect());
    node->markDirty(QSGNode::DirtyForceUpdate);
    return node;
    

    so in qml transparent part is becoming black instead of transparent.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you provide a minimal compilable example that shows the error ?



  • I found there was bug in creation of QImage i was using RGB32 instead of ARGB32


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.