InputPage.qml Example File
gallery/qml/InputPage.qml
import QtQuick 2.2
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.2
ScrollView {
id: page
implicitWidth: 640
implicitHeight: 400
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
Item {
id: content
width: Math.max(page.viewport.width, column.implicitWidth + 2 * column.spacing)
height: Math.max(page.viewport.height, column.implicitHeight + 2 * column.spacing)
ColumnLayout {
id: column
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: column.spacing
GroupBox {
title: "TextField"
Layout.fillWidth: true
ColumnLayout {
anchors.fill: parent
TextField { placeholderText: "..."; Layout.fillWidth: true; z: 1 }
TextField { placeholderText: "Password"; echoMode: TextInput.Password; Layout.fillWidth: true }
}
}
GroupBox {
title: "ComboBox"
Layout.fillWidth: true
ColumnLayout {
anchors.fill: parent
ComboBox {
model: Qt.fontFamilies()
Layout.fillWidth: true
}
ComboBox {
editable: true
model: ListModel {
id: listModel
ListElement { text: "Apple" }
ListElement { text: "Banana" }
ListElement { text: "Coconut" }
ListElement { text: "Orange" }
}
onAccepted: {
if (find(currentText) === -1) {
listModel.append({text: editText})
currentIndex = find(editText)
}
}
Layout.fillWidth: true
}
}
}
GroupBox {
title: "SpinBox"
Layout.fillWidth: true
ColumnLayout {
anchors.fill: parent
SpinBox { value: 99; Layout.fillWidth: true; z: 1 }
SpinBox { decimals: 2; Layout.fillWidth: true }
}
}
}
}
}