entrada qml

Inserte la descripción de la imagen aquí
TTextEdit.qml

// TTextEdit.qml
import QtQuick 2.0
FocusScope {
    width: 96; height: 96
    Rectangle {
        anchors.fill: parent
        color: "lightsteelblue"
        border.color: "gray"
    }
    property alias text: input.text
    property alias input: input
    TextEdit {
        id: input
        anchors.fill: parent
        anchors.margins: 4
        focus: true
    }
}

TLineEditV1.qml

import QtQuick 2.0

FocusScope{
    width: 96
    height: input.height + 8
    Rectangle{
        anchors.fill: parent
        color: "lightsteelblue"
        border.color: "gray"
    }
    property alias text: input.text
    property alias input: input

    TextInput{
        id: input
        anchors.fill: parent
        anchors.margins: 4
        focus: true
    }
}

input.qml

import QtQuick 2.12
import QtQuick.Window 2.12

Rectangle{
    width: 200
    height: 200
    color: "linen"

    TLineEditV1{
        id:input1
        x: 8; y: 8
        width: 96; height: 20
        text: "input1"
        KeyNavigation.tab: input2
        focus: true
    }

    TLineEditV1{
        id:input2
        x: 8; y: 36
        width: 96; height: 20
        text: "input2"
        KeyNavigation.tab: input1
    }

    TTextEdit{
        x: 8; y: 62
        id:input3
        text: "Text Edit"
    }
}

Código fuente: https://github.com/sunlianqi/qml/tree/master/input

Supongo que te gusta

Origin blog.csdn.net/sinat_33859977/article/details/115049782
Recomendado
Clasificación