refactor to use passed functions as props
Update ui/onboarding/Login/AccountList.qml Co-authored-by: RichΛrd <info@richardramos.me> context refactor to use passed functions as props
This commit is contained in:
parent
64b565c6c3
commit
0ea8fc08de
|
@ -23,6 +23,10 @@ SwipeView {
|
||||||
|
|
||||||
AccountSelection {
|
AccountSelection {
|
||||||
id: accountSelection
|
id: accountSelection
|
||||||
|
onAccountSelect: function() {
|
||||||
|
loginModel.setCurrentAccount(this.selectedIndex)
|
||||||
|
swipeView.incrementCurrentIndex()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -2,12 +2,11 @@ import QtQuick 2.14
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import Qt.labs.platform 1.1
|
import Qt.labs.platform 1.1
|
||||||
//import "../../../../shared"
|
|
||||||
//import "../../../../imports"
|
|
||||||
import "./samples/"
|
import "./samples/"
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
property var accounts: AccountsData {}
|
property var accounts: AccountsData {}
|
||||||
|
property var onAccountSelect: function() {}
|
||||||
|
|
||||||
id: addressesView
|
id: addressesView
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
@ -25,14 +24,13 @@ ListView {
|
||||||
delegate: AddressView {
|
delegate: AddressView {
|
||||||
username: model.username
|
username: model.username
|
||||||
identicon: model.identicon
|
identicon: model.identicon
|
||||||
|
onAccountSelect: function(index) {
|
||||||
|
addressesView.onAccountSelect(index)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
focus: true
|
focus: true
|
||||||
Keys.onReturnPressed: {
|
|
||||||
selectBtn.clicked()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,17 @@ import "../../shared"
|
||||||
import "../../imports"
|
import "../../imports"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
property alias btnGenKey: btnGenKey
|
|
||||||
// property alias selectedIndex: selecte
|
|
||||||
|
|
||||||
id: wizardStep1
|
id: wizardStep1
|
||||||
property int selectedIndex: 0
|
property int selectedIndex: 0
|
||||||
|
property alias btnGenKey: btnGenKey
|
||||||
|
property var onAccountSelect: function() {}
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: title
|
id: title
|
||||||
text: "Login"
|
text: qsTr("Login")
|
||||||
font.pointSize: 36
|
font.pointSize: 36
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: 20
|
anchors.topMargin: 20
|
||||||
|
@ -31,6 +31,9 @@ Item {
|
||||||
AccountList {
|
AccountList {
|
||||||
id: accountList
|
id: accountList
|
||||||
accounts: loginModel
|
accounts: loginModel
|
||||||
|
onAccountSelect: function(index) {
|
||||||
|
wizardStep1.selectedIndex = index
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -43,19 +46,16 @@ Item {
|
||||||
|
|
||||||
StyledButton {
|
StyledButton {
|
||||||
id: btnGenKey
|
id: btnGenKey
|
||||||
label: "Generate new account"
|
label: qsTr("Generate new account")
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledButton {
|
StyledButton {
|
||||||
id: selectBtn
|
id: selectBtn
|
||||||
anchors.left: btnGenKey.right
|
anchors.left: btnGenKey.right
|
||||||
anchors.leftMargin: Theme.padding
|
anchors.leftMargin: Theme.padding
|
||||||
label: "Select"
|
label: qsTr("Select")
|
||||||
|
|
||||||
onClicked: {
|
onClicked: onAccountSelect()
|
||||||
loginModel.setCurrentAccount(accountList.selectedAccount)
|
|
||||||
swipeView.incrementCurrentIndex()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import Qt.labs.platform 1.1
|
||||||
Item {
|
Item {
|
||||||
property string username: "Jotaro Kujo"
|
property string username: "Jotaro Kujo"
|
||||||
property string identicon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
|
property string identicon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
|
||||||
|
property var onAccountSelect: function() {}
|
||||||
|
|
||||||
id: addressViewDelegate
|
id: addressViewDelegate
|
||||||
height: 56
|
height: 56
|
||||||
|
@ -18,9 +19,7 @@ Item {
|
||||||
RadioButton {
|
RadioButton {
|
||||||
checked: index == 0 ? true : false
|
checked: index == 0 ? true : false
|
||||||
ButtonGroup.group: accountGroup
|
ButtonGroup.group: accountGroup
|
||||||
onClicked: {
|
onClicked: { onAccountSelect(index) }
|
||||||
wizardStep1.selectedIndex = index
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Column {
|
Column {
|
||||||
Image {
|
Image {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 2.4
|
import QtQuick.Controls 2.4
|
||||||
//import "../../../../imports"
|
import "../imports"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: slide
|
id: slide
|
||||||
|
@ -17,7 +17,6 @@ Item {
|
||||||
anchors.topMargin: 17
|
anchors.topMargin: 17
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
source: image
|
source: image
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
@ -38,13 +37,12 @@ Item {
|
||||||
font.bold: true
|
font.bold: true
|
||||||
font.pixelSize: 22
|
font.pixelSize: 22
|
||||||
font.kerning: true
|
font.kerning: true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: txtDesc1
|
id: txtDesc1
|
||||||
x: 772
|
x: 772
|
||||||
color: "#939BA1"
|
color: Theme.darkGrey
|
||||||
text: description
|
text: description
|
||||||
font.weight: Font.Normal
|
font.weight: Font.Normal
|
||||||
style: Text.Normal
|
style: Text.Normal
|
||||||
|
@ -70,7 +68,7 @@ Item {
|
||||||
visible: !isLast
|
visible: !isLast
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
id: rctNext1
|
id: rctNext1
|
||||||
color: "#ECEFFC"
|
color: Theme.grey
|
||||||
border.width: 0
|
border.width: 0
|
||||||
radius: 50
|
radius: 50
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue