Skip to content

Commit d8e8ecf

Browse files
Monteltilladam
authored andcommitted
TextEdit: Allow to set italic font (slint-ui#10306)
1 parent 71793f7 commit d8e8ecf

8 files changed

Lines changed: 16 additions & 0 deletions

File tree

docs/astro/src/content/docs/reference/std-widgets/views/textedit.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ The size of the font of the input text.
3939
The name of the font family selected for rendering the text.
4040
</SlintProperty>
4141

42+
### font-italic
43+
<SlintProperty propName="font-italic" typeName="bool" defaultValue="false">
44+
The italic state of the font of the input text
45+
</SlintProperty>
46+
4247
### text
4348
<SlintProperty propName="text" typeName="string" propertyVisibility="in-out" >
4449
The text being edited

internal/compiler/widgets/common/textedit-base.slint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export component TextEditBase inherits Rectangle {
1111
in property <bool> read-only <=> text-input.read-only;
1212
in property <length> font-size <=> text-input.font-size;
1313
in property <string> font-family <=> text-input.font-family;
14+
in property <bool> font-italic <=> text-input.font-italic;
1415
in property <bool> enabled <=> text-input.enabled;
1516
out property <bool> has-focus: text-input.has-focus;
1617
out property <length> visible-width <=> scroll-view.visible-width;

internal/compiler/widgets/cosmic/textedit.slint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export component TextEdit {
1111
in property <bool> read-only <=> base.read-only;
1212
in property <length> font-size <=> base.font-size;
1313
in property <string> font-family <=> base.font-family;
14+
in property <bool> font-italic <=> base.font-italic;
1415
in property <bool> enabled <=> base.enabled;
1516
in property <string> placeholder-text <=> base.placeholder-text;
1617
out property <bool> has-focus: base.has-focus;

internal/compiler/widgets/cupertino/textedit.slint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export component TextEdit {
6565
in property <bool> read-only <=> text-input.read-only;
6666
in property <length> font-size <=> text-input.font-size;
6767
in property <string> font-family <=> text-input.font-family;
68+
in property <bool> font-italic <=> text-input.font-italic;
6869
in property <bool> enabled <=> text-input.enabled;
6970
out property <length> visible-width <=> scroll-view.visible-width;
7071
out property <length> visible-height <=> scroll-view.visible-height;

internal/compiler/widgets/fluent/textedit.slint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export component TextEdit {
1111
in property <bool> read-only <=> base.read-only;
1212
in property <length> font-size <=> base.font-size;
1313
in property <string> font-family <=> base.font-family;
14+
in property <bool> font-italic <=> base.font-italic;
1415
in property <bool> enabled <=> base.enabled;
1516
in property <string> placeholder-text <=> base.placeholder-text;
1617
out property <bool> has-focus: base.has-focus;

internal/compiler/widgets/material/textedit.slint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export component TextEdit {
1111
in property <bool> read-only <=> base.read-only;
1212
in property <length> font-size <=> base.font-size;
1313
in property <string> font-family <=> base.font-family;
14+
in property <bool> font-italic <=> base.font-italic;
1415
in property <bool> enabled <=> base.enabled;
1516
in property <string> placeholder-text <=> base.placeholder-text;
1617
out property <bool> has-focus: base.has-focus;

internal/compiler/widgets/qt/textedit.slint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export component TextEdit {
1010
in property <bool> read-only <=> base.read-only;
1111
in property <length> font-size <=> base.font-size;
1212
in property <string> font-family <=> base.font-family;
13+
in property <bool> font-italic <=> base.font-italic;
1314
in property <bool> enabled <=> base.enabled;
1415
in property <string> placeholder-text <=> base.placeholder-text;
1516
out property <bool> has-focus: base.has-focus;

tests/cases/widgets/textedit.slint

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export component TestCase inherits Window {
1717
in-out property <string> text <=> edit.text;
1818
in-out property <bool> read-only <=> edit.read-only;
1919
in-out property <bool> enabled <=> edit.enabled;
20+
in-out property <bool> font-italic <=> edit.font-italic;
2021
public function paste() {
2122
edit.paste();
2223
}
@@ -108,6 +109,10 @@ instance.set_read_only(false);
108109
instance.set_enabled(false);
109110
instance.invoke_paste();
110111
assert_eq!(instance.get_text(), "XxxHello👋");
112+
113+
assert_eq!(instance.get_font_italic(), false);
114+
instance.set_font_italic(true);
115+
assert_eq!(instance.get_font_italic(), true);
111116
```
112117
113118
*/

0 commit comments

Comments
 (0)