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:
Iuri Matias 2020-06-04 09:00:17 -04:00
parent 64b565c6c3
commit 0ea8fc08de
5 changed files with 23 additions and 24 deletions

View File

@ -23,6 +23,10 @@ SwipeView {
AccountSelection {
id: accountSelection
onAccountSelect: function() {
loginModel.setCurrentAccount(this.selectedIndex)
swipeView.incrementCurrentIndex()
}
}
Item {

View File

@ -2,12 +2,11 @@ import QtQuick 2.14
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import Qt.labs.platform 1.1
//import "../../../../shared"
//import "../../../../imports"
import "./samples/"
ListView {
property var accounts: AccountsData {}
property var onAccountSelect: function() {}
id: addressesView
anchors.right: parent.right
@ -25,14 +24,13 @@ ListView {
delegate: AddressView {
username: model.username
identicon: model.identicon
onAccountSelect: function(index) {
addressesView.onAccountSelect(index)
}
}
Layout.fillHeight: true
Layout.fillWidth: true
focus: true
Keys.onReturnPressed: {
selectBtn.clicked()
}
}

View File

@ -7,17 +7,17 @@ import "../../shared"
import "../../imports"
Item {
property alias btnGenKey: btnGenKey
// property alias selectedIndex: selecte
id: wizardStep1
property int selectedIndex: 0
property alias btnGenKey: btnGenKey
property var onAccountSelect: function() {}
Layout.fillHeight: true
Layout.fillWidth: true
Text {
id: title
text: "Login"
text: qsTr("Login")
font.pointSize: 36
anchors.top: parent.top
anchors.topMargin: 20
@ -31,6 +31,9 @@ Item {
AccountList {
id: accountList
accounts: loginModel
onAccountSelect: function(index) {
wizardStep1.selectedIndex = index
}
}
Item {
@ -43,19 +46,16 @@ Item {
StyledButton {
id: btnGenKey
label: "Generate new account"
label: qsTr("Generate new account")
}
StyledButton {
id: selectBtn
anchors.left: btnGenKey.right
anchors.leftMargin: Theme.padding
label: "Select"
label: qsTr("Select")
onClicked: {
loginModel.setCurrentAccount(accountList.selectedAccount)
swipeView.incrementCurrentIndex()
}
onClicked: onAccountSelect()
}
}
}

View File

@ -6,6 +6,7 @@ import Qt.labs.platform 1.1
Item {
property string username: "Jotaro Kujo"
property string identicon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
property var onAccountSelect: function() {}
id: addressViewDelegate
height: 56
@ -18,9 +19,7 @@ Item {
RadioButton {
checked: index == 0 ? true : false
ButtonGroup.group: accountGroup
onClicked: {
wizardStep1.selectedIndex = index
}
onClicked: { onAccountSelect(index) }
}
Column {
Image {

View File

@ -1,6 +1,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.4
//import "../../../../imports"
import "../imports"
Item {
id: slide
@ -17,7 +17,6 @@ Item {
anchors.topMargin: 17
fillMode: Image.PreserveAspectFit
source: image
}
Text {
@ -38,13 +37,12 @@ Item {
font.bold: true
font.pixelSize: 22
font.kerning: true
}
Text {
id: txtDesc1
x: 772
color: "#939BA1"
color: Theme.darkGrey
text: description
font.weight: Font.Normal
style: Text.Normal
@ -70,7 +68,7 @@ Item {
visible: !isLast
background: Rectangle {
id: rctNext1
color: "#ECEFFC"
color: Theme.grey
border.width: 0
radius: 50