mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Added TextEditBase (#5236)
This commit is contained in:
parent
28c6b8d0ba
commit
bd777b4312
9 changed files with 323 additions and 211 deletions
74
internal/compiler/widgets/qt/textedit.slint
Normal file
74
internal/compiler/widgets/qt/textedit.slint
Normal file
|
@ -0,0 +1,74 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.2 OR LicenseRef-Slint-commercial
|
||||
|
||||
import { TextEditBase } from "../common/textedit-base.slint";
|
||||
|
||||
export component TextEdit {
|
||||
in property <TextWrap> wrap <=> base.wrap;
|
||||
in property <TextHorizontalAlignment> horizontal-alignment <=> base.horizontal-alignment;
|
||||
in property <bool> read-only <=> base.read-only;
|
||||
in property <length> font-size <=> base.font-size;
|
||||
in property <bool> enabled <=> base.enabled;
|
||||
in-out property <bool> has-focus: base.has-focus;
|
||||
out property <length> visible-width <=> base.visible-width;
|
||||
out property <length> visible-height <=> base.visible-height;
|
||||
in-out property <string> text <=> base.text;
|
||||
in-out property <length> viewport-x <=> base.viewport-x;
|
||||
in-out property <length> viewport-y <=> base.viewport-y;
|
||||
in-out property <length> viewport-width <=> base.viewport-width;
|
||||
in-out property <length> viewport-height <=> base.viewport-height;
|
||||
|
||||
callback edited(/* text */ string);
|
||||
accessible-role: AccessibleRole.text-input;
|
||||
accessible-value <=> text;
|
||||
|
||||
public function set-selection-offsets(start: int, end: int) {
|
||||
base.set-selection-offsets(start, end);
|
||||
}
|
||||
|
||||
public function select-all() {
|
||||
base.select-all();
|
||||
}
|
||||
|
||||
public function clear-selection() {
|
||||
base.clear-selection();
|
||||
}
|
||||
|
||||
public function cut() {
|
||||
base.cut();
|
||||
}
|
||||
|
||||
public function copy() {
|
||||
base.copy();
|
||||
}
|
||||
|
||||
public function paste() {
|
||||
base.paste();
|
||||
}
|
||||
|
||||
forward-focus: base;
|
||||
horizontal-stretch: 1;
|
||||
vertical-stretch: 1;
|
||||
|
||||
states [
|
||||
disabled when !root.enabled: {
|
||||
root.opacity: 0.5;
|
||||
}
|
||||
focused when base.has-focus: {
|
||||
base.border-width: 2px;
|
||||
base.border-color: NativePalette.accent-background;
|
||||
}
|
||||
]
|
||||
|
||||
base := TextEditBase {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 2px;
|
||||
border-width: 1px;
|
||||
border-color: NativePalette.border;
|
||||
scroll-view-padding: 4px;
|
||||
foreground: NativePalette.foreground;
|
||||
selection-background-color: NativePalette.selection-background;
|
||||
selection-foreground-color: NativePalette.selection-foreground;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue