feat(StatusInputWithCursor): Extended the StatusInput to support an Input with no background and a blinking custom cursor

This commit is contained in:
Khushboo Mehta 2022-03-22 18:26:50 +01:00 committed by r4bbit.eth
parent 41f67b59e9
commit ad659a5dc2
4 changed files with 73 additions and 0 deletions

View File

@ -212,4 +212,12 @@ Column {
}
input.edit.readOnly: true
}
StatusInputWithCursor {
id: cursor
input.placeholderText: "0.00 SNT"
Component.onCompleted: {
cursor.input.edit.forceActiveFocus()
}
}
}

View File

@ -25,6 +25,7 @@ Item {
property alias edit: edit
property alias text: edit.text
property alias background: background
property alias color: edit.color
property alias font: edit.font
@ -78,6 +79,7 @@ Item {
44, root.minimumHeight), root.maximumHeight) : 44
Rectangle {
id: background
width: parent.width
height: maximumHeight != 0 ? Math.min(
minimumHeight

View File

@ -0,0 +1,62 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
StatusInput {
id: cursorInput
property string cursorColor: Theme.palette.primaryColor1
height: input.edit.height
leftPadding: 0
rightPadding: 0
input.placeholderText: ""
input.edit.cursorVisible: true
input.edit.font.pixelSize: 32
input.placeholderFont.pixelSize: 32
input.leftPadding: 0
input.rightPadding: 0
input.topPadding: 0
input.bottomPadding: 0
input.edit.padding: 0
input.background.color: "transparent"
input.background.border.width: 0
input.edit.cursorDelegate: Rectangle {
id: cursor
visible: input.edit.cursorVisible
color: cursorColor
width: 2
SequentialAnimation {
loops: Animation.Infinite
running: input.edit.cursorVisible
PropertyAction {
target: cursor
property: 'visible'
value: true
}
PauseAnimation {
duration: 600
}
PropertyAction {
target: cursor
property: 'visible'
value: false
}
PauseAnimation {
duration: 600
}
onStopped: {
cursor.visible = false
}
}
}
}

View File

@ -36,3 +36,4 @@ StatusWalletColorButton 0.1 StatusWalletColorButton.qml
StatusWalletColorSelect 0.1 StatusWalletColorSelect.qml
StatusColorSelectorGrid 0.1 StatusColorSelectorGrid.qml
StatusSeedPhraseInput 0.1 StatusSeedPhraseInput.qml
StatusInputWithCursor 0.1 StatusInputWithCursor.qml