fix(BackupSeed): backup seed phrase form is not centered

Fixes #6387

TLDR; since this is a GridView, it needs a width/height set and then
centered on top of the parent component (as opposed to `anchors.fill`)

Also added a scroll indicator in case the window height is not tall
enough and fixed some small warnings
This commit is contained in:
Lukáš Tinkl 2022-07-11 17:20:35 +02:00 committed by Lukáš Tinkl
parent 5d6f2df145
commit fa8c3c6efd
3 changed files with 16 additions and 9 deletions

View File

@ -72,10 +72,10 @@ StatusStackModal {
switch (root.currentIndex) {
case 0:
case 1:
return qsTr("Confirm Seed Phrase");
return qsTr("Confirm Seed Phrase");
case 2:
case 3:
return qsTr("Continue");;
return qsTr("Continue");
default:
return "";
}

View File

@ -55,4 +55,6 @@ Flickable {
Layout.fillWidth: true
}
}
ScrollIndicator.vertical: ScrollIndicator {}
}

View File

@ -22,24 +22,28 @@ BackupSeedStepBase {
GridView {
id: grid
anchors.fill: parent
leftMargin: grid.spacing/2
width: cellWidth*2
height: parent.height
anchors.centerIn: parent
visible: !hideSeed
flow: GridView.FlowTopToBottom
cellWidth: 208
cellHeight: 48
interactive: false
model: 12
property var wordIndex: ["1", "3", "5", "7", "9", "11", "2", "4", "6", "8", "10", "12"]
readonly property var wordIndex: ["1", "3", "5", "7", "9", "11", "2", "4", "6", "8", "10", "12"]
readonly property int spacing: 4
delegate: StatusSeedPhraseInput {
id: seedWordInput
width: (grid.cellWidth - 4)
height: (grid.cellHeight - 4)
width: (grid.cellWidth - grid.spacing)
height: (grid.cellHeight - grid.spacing)
textEdit.input.edit.enabled: false
text: {
var index = parseInt(leftComponentText) - 1;
if (!root.seedPhrase || index < 0 || index > root.seedPhrase.length - 1)
const idx = parseInt(leftComponentText) - 1;
if (!root.seedPhrase || idx < 0 || idx > root.seedPhrase.length - 1)
return "";
return root.seedPhrase[index];
return root.seedPhrase[idx];
}
leftComponentText: grid.wordIndex[index]
}
@ -52,6 +56,7 @@ BackupSeedStepBase {
source: grid
radius: 16
samples: 16
transparentBorder: true
}
StatusButton {