This commit is contained in:
ItsLemmy
2025-10-20 12:22:38 -04:00
parent 8652fdb731
commit 621b37cd1f
7 changed files with 181 additions and 180 deletions
+39 -39
View File
@@ -75,31 +75,31 @@ ColumnLayout {
propagateComposedEvents: false
onPressed: mouse => {
mouse.accepted = true
// Focus the input and position cursor
input.forceActiveFocus()
var inputPos = mapToItem(inputContainer, mouse.x, mouse.y)
if (inputPos.x >= 0 && inputPos.x <= inputContainer.width) {
var textPos = inputPos.x - Style.marginM
if (textPos >= 0 && textPos <= input.width) {
input.cursorPosition = input.positionAt(textPos, input.height / 2)
}
}
}
mouse.accepted = true
// Focus the input and position cursor
input.forceActiveFocus()
var inputPos = mapToItem(inputContainer, mouse.x, mouse.y)
if (inputPos.x >= 0 && inputPos.x <= inputContainer.width) {
var textPos = inputPos.x - Style.marginM
if (textPos >= 0 && textPos <= input.width) {
input.cursorPosition = input.positionAt(textPos, input.height / 2)
}
}
}
onReleased: mouse => {
mouse.accepted = true
}
mouse.accepted = true
}
onDoubleClicked: mouse => {
mouse.accepted = true
input.selectAll()
}
mouse.accepted = true
input.selectAll()
}
onPositionChanged: mouse => {
mouse.accepted = true
}
mouse.accepted = true
}
onWheel: wheel => {
wheel.accepted = true
}
wheel.accepted = true
}
}
// Container for the actual text field
@@ -167,32 +167,32 @@ ColumnLayout {
property int selectionStart: 0
onPressed: mouse => {
mouse.accepted = true
input.forceActiveFocus()
var pos = input.positionAt(mouse.x, mouse.y)
input.cursorPosition = pos
selectionStart = pos
}
mouse.accepted = true
input.forceActiveFocus()
var pos = input.positionAt(mouse.x, mouse.y)
input.cursorPosition = pos
selectionStart = pos
}
onPositionChanged: mouse => {
if (mouse.buttons & Qt.LeftButton) {
mouse.accepted = true
var pos = input.positionAt(mouse.x, mouse.y)
input.select(selectionStart, pos)
}
}
if (mouse.buttons & Qt.LeftButton) {
mouse.accepted = true
var pos = input.positionAt(mouse.x, mouse.y)
input.select(selectionStart, pos)
}
}
onDoubleClicked: mouse => {
mouse.accepted = true
input.selectAll()
}
mouse.accepted = true
input.selectAll()
}
onReleased: mouse => {
mouse.accepted = true
}
mouse.accepted = true
}
onWheel: wheel => {
wheel.accepted = true
}
wheel.accepted = true
}
}
}
NIconButton {