Problem with BrightnessContrast QML Type



  • Hello,
    I would like to implement something which lets user of my program to change brightness and contrast. I tried BrightnessContrast QML Type, but it "covers" places with mouseAreas making them useless. My tree:

    • Item
      • MainScreen (rect)
      • RowLayout
        • Buttons
          • mouseAreas
      • BrightnessContrast

    When I gave RowLayout bigger z coordinate than BrightnessContrast, buttons were visible but mouseAreas were unable. I tried to put mouseAreas outside RowLayout - I made mouseAreas and BrightnessContrast siblings. Then I tried to manipulate with z coordinate, but mouseAreas are still useless. Could you tell me, why mouseAreas are unable to use? Maybe you have better idea how can I reach what I scheduled? Please help.



  • import QtQuick 2.4
    import QtQuick.Controls 1.4
    import QtQuick.Layouts 1.1
    import QtQuick.Extras 1.4
    import QtQuick.Window 2.2
    import QtQuick.Controls.Styles 1.4
    import QtGraphicalEffects 1.0
    
    Item {
        width: 640
        height: 480
        id: item
    
        property alias text1: text1
        property alias mouseArea1: mouseArea1
        property alias mouseArea2: mouseArea2
    
        Rectangle {
            id: okno_glowne
            color: "#bb8a63"
            anchors.fill: parent
    
            Text {
    
                id: text1
                x: 499
                y: 193
                width: 65
                height: 42
                font.pixelSize: 33
                text: "pampam"
            }
        }
    
        states: [
            State {
                name: "drugi_ekran"
                PropertyChanges { target: okno_glowne; visible: false  }
    
                PropertyChanges {
                    target: drugie_okno
                    x: 163
                    y: 75
                    opacity: 1
                }
            }
        ]
    
        Rectangle {
            id: drugie_okno
            color: "#bb8a63"
            anchors.fill: parent
            opacity: 0
        }
    
        RowLayout {
            id: rowLayout1
            x: 170
            y: 322
            z:3
            width: 300
            height: 150
    
            Button {
                id: button1
                text: qsTr("Button")
                anchors.rightMargin: 150
                anchors.fill: parent
                width: 150
                height: 150
                z:3
    
                MouseArea {
                    id: mouseArea1
                    x: 0
                    y: 0
                    z:3
                    anchors.fill: parent
    
                    width: 150
                    height: 150
                    enabled: true
                    visible: true
    
                }
    
            }
    
            Button {
                id: button2
                text: qsTr("Button")
                anchors.leftMargin: 150
                anchors.fill: parent
                width: 150
                height: 150
                z:3
    
                MouseArea {
                    id: mouseArea2
                    x: 0
                    y: 0
                    z:3
    
                    anchors.fill: parent
                    width: 150
                    height: 150
                    enabled: true
                    visible: true
                }            
            }        
        }
    
        BrightnessContrast {
            id: asd        
    
            anchors.fill: okno_glowne
            source: okno_glowne
            brightness: -0.6
            contrast: -0.6
            z:0
        }
    }
    

    Do You see any mistakes in the code?


Log in to reply
 

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