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

Non Image item as OpacityMask::maskSource



  • Following code does not show anything on desktop (windows 7 x64, Qt 5.1):

    @import QtQuick 2.0
    import QtGraphicalEffects 1.0

    Item {
    width: 300; height: 300

    Rectangle {
        id: source
    
        anchors.fill: parent
        color: 'red'
        visible: false
    }
    
    Rectangle {
        id: mask
    
        gradient: Gradient {
            GradientStop { position: 0.0; color: 'black' }
            GradientStop { position: 0.5; color: 'transparent' }
            GradientStop { position: 1.0; color: 'white' }
        }
        visible: false
    }
    
    OpacityMask {
        anchors.fill: parent
        source: source
        maskSource: mask
    }
    

    }@

    I expect it to show red gradient dissolving to the sides. If i put Image as maskSource it will work as expected. On android device, similar code as above works as expected.

    It seem to me as malfunction.


Log in to reply