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

@ -75,7 +75,7 @@ StatusStackModal {
return qsTr("Confirm Seed Phrase"); return qsTr("Confirm Seed Phrase");
case 2: case 2:
case 3: case 3:
return qsTr("Continue");; return qsTr("Continue");
default: default:
return ""; return "";
} }

View File

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

View File

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