2022-05-26 13:40:41 +00:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
2022-06-28 10:55:33 +00:00
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
|
2022-05-26 13:40:41 +00:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Controls.Validators 0.1
|
2022-06-28 10:55:33 +00:00
|
|
|
|
|
|
|
import shared.panels 1.0
|
2022-05-26 13:40:41 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-06-28 10:55:33 +00:00
|
|
|
Flickable {
|
|
|
|
id: root
|
|
|
|
|
2022-05-26 13:40:41 +00:00
|
|
|
property int wordRandomNumber: -1
|
|
|
|
property string wordAtRandomNumber
|
|
|
|
property bool secondWordValid: true
|
|
|
|
property alias titleText: txtTitle.text
|
|
|
|
property alias inputValid: inputText.valid
|
|
|
|
|
2022-06-28 10:55:33 +00:00
|
|
|
default property alias content: column.children
|
|
|
|
|
|
|
|
clip: true
|
|
|
|
contentHeight: column.height
|
|
|
|
implicitHeight: 520
|
|
|
|
interactive: contentHeight > height
|
|
|
|
flickableDirection: Flickable.VerticalFlick
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: column
|
|
|
|
width: parent.width
|
|
|
|
spacing: Style.current.padding
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: txtTitle
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2022-05-26 13:40:41 +00:00
|
|
|
|
2022-06-28 10:55:33 +00:00
|
|
|
StatusInput {
|
|
|
|
id: inputText
|
|
|
|
visible: (wordRandomNumber > -1)
|
|
|
|
implicitWidth: 448
|
|
|
|
input.implicitHeight: 44
|
|
|
|
validationMode: StatusInput.ValidationMode.Always
|
|
|
|
label: qsTr("Word #%1").arg(wordRandomNumber + 1)
|
|
|
|
input.placeholderText: qsTr("Enter word")
|
|
|
|
validators: [
|
|
|
|
StatusValidator {
|
|
|
|
validate: function (t) { return (root.wordAtRandomNumber === inputText.text); }
|
|
|
|
errorMessage: (inputText.text.length) > 0 ? qsTr("Wrong word") : ""
|
|
|
|
}
|
|
|
|
]
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2022-05-26 13:40:41 +00:00
|
|
|
}
|
2022-07-11 15:20:35 +00:00
|
|
|
|
|
|
|
ScrollIndicator.vertical: ScrollIndicator {}
|
2022-05-26 13:40:41 +00:00
|
|
|
}
|