chore: extract input cursor delegate into StatusCursorDelegate
- unified UI/UX; no code changes, just reduces code duplication - use the correct OS/platform blink interval with `Qt.styleHints.cursorFlashTime`
This commit is contained in:
parent
01e96318e9
commit
19e7c42cc2
|
@ -0,0 +1,22 @@
|
|||
import QtQuick 2.15
|
||||
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
required property bool cursorVisible
|
||||
|
||||
color: Theme.palette.primaryColor1
|
||||
implicitWidth: 2
|
||||
implicitHeight: 22
|
||||
radius: 1
|
||||
visible: cursorVisible
|
||||
|
||||
SequentialAnimation on visible {
|
||||
loops: Animation.Infinite
|
||||
running: root.cursorVisible
|
||||
PropertyAnimation { to: false; duration: Qt.styleHints.cursorFlashTime / 2 }
|
||||
PropertyAnimation { to: true; duration: Qt.styleHints.cursorFlashTime / 2 }
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ StatusChatListItem 0.1 StatusChatListItem.qml
|
|||
StatusChatListCategory 0.1 StatusChatListCategory.qml
|
||||
StatusChatListCategoryItem 0.1 StatusChatListCategoryItem.qml
|
||||
StatusChatListAndCategories 0.1 StatusChatListAndCategories.qml
|
||||
StatusCursorDelegate 0.1 StatusCursorDelegate.qml
|
||||
StatusToolBar 0.1 StatusToolBar.qml
|
||||
StatusContactRequestsIndicatorListItem 0.1 StatusContactRequestsIndicatorListItem.qml
|
||||
StatusEmoji 0.1 StatusEmoji.qml
|
||||
|
|
|
@ -411,19 +411,8 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
cursorDelegate: Rectangle {
|
||||
color: Theme.palette.primaryColor1
|
||||
implicitWidth: 2
|
||||
implicitHeight: 22
|
||||
radius: 1
|
||||
visible: edit.cursorVisible
|
||||
|
||||
SequentialAnimation on visible {
|
||||
loops: Animation.Infinite
|
||||
running: edit.cursorVisible
|
||||
PropertyAnimation { to: false; duration: 600; }
|
||||
PropertyAnimation { to: true; duration: 600; }
|
||||
}
|
||||
cursorDelegate: StatusCursorDelegate {
|
||||
cursorVisible: edit.cursorVisible
|
||||
}
|
||||
|
||||
StatusBaseText {
|
||||
|
|
|
@ -2,6 +2,7 @@ import QtQuick 2.14
|
|||
import QtQuick.Controls 2.14
|
||||
|
||||
import StatusQ.Core.Theme 0.1
|
||||
import StatusQ.Components 0.1
|
||||
|
||||
/*!
|
||||
\qmltype StatusTextArea
|
||||
|
@ -74,6 +75,7 @@ TextArea {
|
|||
}
|
||||
|
||||
selectByMouse: true
|
||||
persistentSelection: true
|
||||
wrapMode: TextEdit.WordWrap
|
||||
|
||||
activeFocusOnTab: enabled
|
||||
|
@ -94,18 +96,7 @@ TextArea {
|
|||
}
|
||||
}
|
||||
|
||||
cursorDelegate: Rectangle {
|
||||
color: Theme.palette.primaryColor1
|
||||
implicitWidth: 2
|
||||
implicitHeight: 22
|
||||
radius: 1
|
||||
visible: root.cursorVisible
|
||||
|
||||
SequentialAnimation on visible {
|
||||
loops: Animation.Infinite
|
||||
running: root.cursorVisible
|
||||
PropertyAnimation { to: false; duration: 600 }
|
||||
PropertyAnimation { to: true; duration: 600 }
|
||||
}
|
||||
cursorDelegate: StatusCursorDelegate {
|
||||
cursorVisible: root.cursorVisible
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<file>StatusQ/Components/StatusCommunityTags.qml</file>
|
||||
<file>StatusQ/Components/StatusContactRequestsIndicatorListItem.qml</file>
|
||||
<file>StatusQ/Components/StatusContactVerificationIcons.qml</file>
|
||||
<file>StatusQ/Components/StatusCursorDelegate.qml</file>
|
||||
<file>StatusQ/Components/StatusDatePicker.qml</file>
|
||||
<file>StatusQ/Components/StatusDescriptionListItem.qml</file>
|
||||
<file>StatusQ/Components/StatusEmoji.qml</file>
|
||||
|
|
|
@ -5,6 +5,7 @@ import QtGraphicalEffects 1.0
|
|||
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Controls 0.1
|
||||
import StatusQ.Components 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
import StatusQ.Core.Utils 0.1
|
||||
import StatusQ.Popups.Dialog 0.1
|
||||
|
@ -107,17 +108,8 @@ Item {
|
|||
selectionColor: Theme.palette.primaryColor2
|
||||
selectedTextColor: color
|
||||
|
||||
cursorDelegate: Rectangle {
|
||||
color: Theme.palette.primaryColor1
|
||||
implicitWidth: 2
|
||||
radius: 1
|
||||
visible: edit.cursorVisible
|
||||
SequentialAnimation on visible {
|
||||
loops: Animation.Infinite
|
||||
running: edit.cursorVisible
|
||||
PropertyAnimation { to: false; duration: 600; }
|
||||
PropertyAnimation { to: true; duration: 600; }
|
||||
}
|
||||
cursorDelegate: StatusCursorDelegate {
|
||||
cursorVisible: edit.cursorVisible
|
||||
}
|
||||
|
||||
onTextEdited: if (suggestionsDialog.forceHide && !pasteOperation)
|
||||
|
|
|
@ -10,8 +10,6 @@ import utils 1.0
|
|||
StatusInput {
|
||||
id: cursorInput
|
||||
|
||||
property string cursorColor: Theme.palette.primaryColor1
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
topPadding: 0
|
||||
|
@ -25,40 +23,4 @@ StatusInput {
|
|||
input.edit.padding: 0
|
||||
input.background.color: "transparent"
|
||||
input.background.border.width: 0
|
||||
// To-do this needs to be removed once https://github.com/status-im/StatusQ/issues/578 is implemented and cursor is moved to StatusInput
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1350,19 +1350,8 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
cursorDelegate: Rectangle {
|
||||
color: Theme.palette.primaryColor1
|
||||
implicitWidth: 2
|
||||
implicitHeight: 22
|
||||
radius: 1
|
||||
visible: messageInputField.cursorVisible
|
||||
|
||||
SequentialAnimation on visible {
|
||||
loops: Animation.Infinite
|
||||
running: messageInputField.cursorVisible
|
||||
PropertyAnimation { to: false; duration: 600; }
|
||||
PropertyAnimation { to: true; duration: 600; }
|
||||
}
|
||||
cursorDelegate: StatusCursorDelegate {
|
||||
cursorVisible: messageInputField.cursorVisible
|
||||
}
|
||||
|
||||
StatusSyntaxHighlighter {
|
||||
|
|
Loading…
Reference in New Issue