summaryrefslogtreecommitdiffstats
path: root/examples/models/completionmodel/main.qml
blob: eca1432fbec03832fb530a8bdd08175efe53ef0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import QtQuick 2.0

Rectangle {
    width: 300
    height: 400
    color: "blue"

    Rectangle {
        y: 10
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.right: parent.right
        anchors.rightMargin: 10
        height: 20
        color: "white"

        TextInput {
            anchors.fill: parent
            clip: true
            onTextChanged: completionModel.setCompletionPrefix(text)
        }
    }

    Rectangle {
        anchors.top: parent.top
        anchors.topMargin: 40
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.right: parent.right
        anchors.rightMargin: 10
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 10
        color: "white"

        ListView {
            anchors.fill: parent
            model: completionModel
            clip: true
            delegate: Text {
                text: display
            }
        }
    }
}