Compare commits
2 Commits
3697258d07
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 586d9e854e | |||
| 1b28d953c2 |
+7
-7
@@ -3,13 +3,6 @@ import fbx.application 1.0
|
|||||||
import "Views" as View
|
import "Views" as View
|
||||||
|
|
||||||
Application {
|
Application {
|
||||||
// Liste des labels et types
|
|
||||||
property var fields: [
|
|
||||||
{label: "Server", type: "text"},
|
|
||||||
{label: "User", type: "text"},
|
|
||||||
{label: "Password", type: "password"}
|
|
||||||
]
|
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 10
|
spacing: 10
|
||||||
@@ -26,7 +19,14 @@ Application {
|
|||||||
|
|
||||||
color: "#000B25"
|
color: "#000B25"
|
||||||
|
|
||||||
|
focus: true
|
||||||
|
|
||||||
View.Login {}
|
View.Login {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
// Setup the login view to be focus on start
|
||||||
|
columnLogin.updateSelection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+46
-9
@@ -1,37 +1,74 @@
|
|||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
anchors.fill: parent
|
// Liste des labels et types
|
||||||
|
property var fields: [
|
||||||
|
{label: "Server", type: "text"},
|
||||||
|
{label: "User", type: "text"},
|
||||||
|
{label: "Password", type: "password"}
|
||||||
|
]
|
||||||
|
|
||||||
|
property int currentIndex: 0
|
||||||
|
|
||||||
|
id: columnLogin
|
||||||
|
|
||||||
|
//anchors.centerIn: parent
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.margins: 20
|
anchors.margins: 20
|
||||||
spacing: 15
|
spacing: 15
|
||||||
|
width: parent.width * 0.8
|
||||||
|
|
||||||
|
function updateSelection() {
|
||||||
|
for (let i = 0; i < repeater.count; i++) {
|
||||||
|
repeater.itemAt(i).color = i === columnLogin.currentIndex ? "lightblue" : "transparent";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Repeater pour générer les champs basés sur la liste des labels et types
|
// Repeater pour générer les champs basés sur la liste des labels et types
|
||||||
Repeater {
|
Repeater {
|
||||||
model: fields
|
model: fields
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
width: parent.width
|
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
width: parent.width / 2 - 5
|
||||||
text: modelData.label + ":"
|
text: modelData.label + ":"
|
||||||
width: 100
|
|
||||||
color: "white"
|
color: "white"
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
}
|
}
|
||||||
|
|
||||||
// TextInput pour les champs Server et User, et mode Password pour Password
|
// TextInput pour les champs Server et User, et mode Password pour Password
|
||||||
TextInput {
|
Rectangle {
|
||||||
width: parent.width - 110
|
width: 200
|
||||||
height: 30
|
height: 20
|
||||||
font.pixelSize: 16
|
|
||||||
color: "white"
|
color: "white"
|
||||||
|
//border.color: "black"
|
||||||
|
//border.width: 3
|
||||||
|
//radius: 5
|
||||||
|
|
||||||
|
TextInput {
|
||||||
|
font.pixelSize: 16
|
||||||
|
color: "black"
|
||||||
text: modelData.label
|
text: modelData.label
|
||||||
|
|
||||||
// Détermine le mode de saisie en fonction du type
|
// Détermine le mode de saisie en fonction du type
|
||||||
echoMode: modelData.type === "password" ? TextInput.Password : TextInput.Normal
|
echoMode: modelData.type === "password" ? TextInput.Password : TextInput.Normal
|
||||||
//echoMode: TextInput.Password
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Keys.onPressed: {
|
||||||
|
if (event.key === Qt.Key_Up) {
|
||||||
|
if (currentIndex > 0) {
|
||||||
|
currentIndex--;
|
||||||
|
updateSelection();
|
||||||
|
}
|
||||||
|
} else if (event.key == Qt.Key_Down) {
|
||||||
|
if (currentIndex < repeater.children.length - 1) {
|
||||||
|
currentIndex++;
|
||||||
|
updateSelection()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user