21 Mart 2018 Çarşamba

Qml Keynavigation Examples // Trafik lambası

   Rectangle {
        id: left
        x: 25
        y: 25
        width: 150
        height: 150
        color: focus ? "red" : "darkred"         
        KeyNavigation.right: right
        focus: true
    }
    Rectangle {
        id: right
        x: 225
        y: 25
        width: 150
        height: 150
        color: focus ? "green" : "darkgreen"
        KeyNavigation.left: left

    }


Yön tusu ile saga basınca sag acık yeşil , sola basınca sol acık kırmızı olarak değişir 



Share:

Qml KeyNavigaiton Examples

 TextInput {
        id: name
        text: "name"
        focus: true
        KeyNavigation.tab: adress
    }
    TextInput {
        id: adress
        text: "addressss"
        KeyNavigation.backtab: name

    }
Share:

QML Mouse Area Examples 3

  Text {
        id: title
        text: qsTr("Qt Quick ")
        x: 50
        y: 25
        font.family: "Helvetica"
        font.pixelSize: 50
        MouseArea {
            anchors.fill: parent
            onPressed: parent.color = "green"
            onReleased: parent.color = "red"
        }
    }
    Rectangle {
        x: 50
        y: 200
        width: 100
        height: 50
        color: mouse_area.containsMouse ? "blue" : "orange"
        MouseArea {
            id: mouse_area
            anchors.fill: parent
            hoverEnabled: true
        }
    }
Share:

QML Position Example 2

Image {
    source: {
        if (Screen.PixelDensity < 40)
        "image_low_dpi.png"
        else if (Screen.PixelDensity > 300)      // Pixele göre resim kullanılıyor 
        "image_high_dpi.png"
        else
        "image.png"
        }
    }
Share:

QML Position Examples

ApplicationWindow {
    id: root
    visible: true
    width: 480
    height: 620

    GridLayout {
        anchors.fill: parent
        anchors.margins: 20
        rowSpacing: 20
        columnSpacing: 20
        flow:  width > height ? GridLayout.LeftToRight : GridLayout.TopToBottom  // IMPORTANT 
        Rectangle {
            Layout.fillWidth: true
            Layout.fillHeight: true
            color: "#5d5b59"
            Label {
                anchors.centerIn: parent
                text: "Top or left"
                color: "white"
            }
        }
        Rectangle {
            Layout.fillWidth: true
            Layout.fillHeight: true
            color: "#1e1b18"
            Label {
                anchors.centerIn: parent
                text: "Bottom or right"
                color: "white"
            }
        }
    }
}
Share: