mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Fix placeholder text rendered on top of cursor when empty LineEdit is focused (#1888)
Render the placeholder underneath.
This commit is contained in:
parent
2f07caf7d1
commit
fd64060b26
2 changed files with 24 additions and 23 deletions
|
@ -19,6 +19,11 @@ export LineEditInner := Rectangle {
|
|||
min-width: max(50px, placeholder.min-width);
|
||||
clip: true;
|
||||
forward-focus: input;
|
||||
placeholder := Text {
|
||||
height: 100%; width: 100%;
|
||||
vertical-alignment: center;
|
||||
text: (root.text == "" && input.preedit-text == "") ? root.placeholder-text : "";
|
||||
}
|
||||
input := TextInput {
|
||||
property <length> computed_x;
|
||||
x: min(0px, max(parent.width - width, computed_x));
|
||||
|
@ -37,11 +42,6 @@ export LineEditInner := Rectangle {
|
|||
vertical-alignment: center;
|
||||
single-line: true;
|
||||
}
|
||||
placeholder := Text {
|
||||
height: 100%; width: 100%;
|
||||
vertical-alignment: center;
|
||||
text: (root.text == "" && input.preedit-text == "") ? root.placeholder-text : "";
|
||||
}
|
||||
}
|
||||
|
||||
export TextEdit := ScrollView {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue