nativ: new LoginScreen.qml
main.qml add Button to open LoginScreen
This commit is contained in:
parent
642600b789
commit
5653cbef88
5 changed files with 174 additions and 3 deletions
|
@ -19,9 +19,11 @@ qt_add_qml_module(alisa
|
|||
Main.qml
|
||||
Data.qml
|
||||
Test.qml
|
||||
LoginScreen.qml
|
||||
|
||||
RESOURCES
|
||||
Assets/Icons/turbo.svg
|
||||
|
||||
)
|
||||
|
||||
set_target_properties(alisa PROPERTIES
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 13.0.2, 2024-07-10T14:32:54. -->
|
||||
<!-- Written by QtCreator 13.0.2, 2024-07-10T15:48:55. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
|
63
native/LoginScreen.qml
Normal file
63
native/LoginScreen.qml
Normal file
|
@ -0,0 +1,63 @@
|
|||
import QtQuick
|
||||
import QtQuick.Window
|
||||
import Qt.labs.qmlmodels
|
||||
|
||||
Window {
|
||||
width: 400
|
||||
height: 400
|
||||
visible: true
|
||||
|
||||
TableView {
|
||||
anchors.fill: parent
|
||||
columnSpacing: 1
|
||||
rowSpacing: 1
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
model: TableModel {
|
||||
TableModelColumn { display: "checked" }
|
||||
TableModelColumn { display: "amount" }
|
||||
TableModelColumn { display: "fruitType" }
|
||||
TableModelColumn { display: "fruitName" }
|
||||
TableModelColumn { display: "fruitPrice" }
|
||||
|
||||
// Each row is one type of fruit that can be ordered
|
||||
rows: [
|
||||
{
|
||||
// Each property is one cell/column.
|
||||
checked: false,
|
||||
amount: 1,
|
||||
fruitType: "Apple",
|
||||
fruitName: "Granny Smith",
|
||||
fruitPrice: 1.50
|
||||
},
|
||||
{
|
||||
checked: true,
|
||||
amount: 4,
|
||||
fruitType: "Orange",
|
||||
fruitName: "Navel",
|
||||
fruitPrice: 2.50
|
||||
},
|
||||
{
|
||||
checked: false,
|
||||
amount: 1,
|
||||
fruitType: "Banana",
|
||||
fruitName: "Cavendish",
|
||||
fruitPrice: 3.50
|
||||
}
|
||||
]
|
||||
}
|
||||
delegate: TextInput {
|
||||
text: model.display
|
||||
padding: 12
|
||||
selectByMouse: true
|
||||
|
||||
onAccepted: model.display = text
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "#efefef"
|
||||
z: -1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,11 +55,12 @@ Window {
|
|||
}
|
||||
}
|
||||
Button {
|
||||
id: testB
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
}
|
||||
text: qsTr("Click me")
|
||||
text: qsTr("Test Window")
|
||||
|
||||
onClicked: {
|
||||
var component = Qt.createComponent("Test.qml")
|
||||
|
@ -67,4 +68,22 @@ Window {
|
|||
window.show()
|
||||
}
|
||||
}
|
||||
Button {
|
||||
id: loginScreenB
|
||||
anchors {
|
||||
left: testB.right
|
||||
bottom: parent.bottom
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
text: qsTr("Login Screen")
|
||||
onClicked: {
|
||||
var component = Qt.createComponent("LoginScreen.qml")
|
||||
var window = component.createObject(root)
|
||||
window.show()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
87
native/Main.qml.autosave
Normal file
87
native/Main.qml.autosave
Normal file
|
@ -0,0 +1,87 @@
|
|||
import QtQuick
|
||||
import QtQuick.Window
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls 2.15
|
||||
|
||||
Window {
|
||||
SystemPalette { id: activeColors; colorGroup: SystemPalette.Active }
|
||||
SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Inactive }
|
||||
SystemPalette { id: disabledColors; colorGroup: SystemPalette.Disabled }
|
||||
|
||||
function getColors() {
|
||||
return root.active ? activeColors : inactiveColors;
|
||||
}
|
||||
|
||||
id: root
|
||||
width: 640
|
||||
height: 480
|
||||
visible: true
|
||||
color: getColors().window
|
||||
|
||||
title: qsTr("Alisa - License Managment")
|
||||
|
||||
Rectangle {
|
||||
id: s1
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
height: 400
|
||||
border.width: 5
|
||||
border.color: getColors().accent
|
||||
color: getColors().midlight
|
||||
}
|
||||
|
||||
TableView {
|
||||
anchors.fill: parent
|
||||
|
||||
columnSpacing: 1
|
||||
rowSpacing: 1
|
||||
clip: true
|
||||
|
||||
model: Data {}
|
||||
delegate: Rectangle {
|
||||
color: getColors().base
|
||||
implicitWidth: 100
|
||||
implicitHeight: 50
|
||||
border.width: 1
|
||||
|
||||
Text {
|
||||
text: display
|
||||
color: getColors().text
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
Button {
|
||||
id: testB
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
}
|
||||
text: qsTr("Test Window")
|
||||
|
||||
onClicked: {
|
||||
var component = Qt.createComponent("Test.qml")
|
||||
var window = component.createObject(root)
|
||||
window.show()
|
||||
}
|
||||
}
|
||||
Button {
|
||||
id: loginScreenB
|
||||
anchors {
|
||||
left: testB.right
|
||||
bottom: parent.bottom
|
||||
|
||||
|
||||
}
|
||||
text: qsTr("Login Screen")
|
||||
onClicked: {
|
||||
var component = Qt.createComponent("LoginScreen.qml")
|
||||
var window = component.createObject(root)
|
||||
window.show()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue