mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-03 18:29:09 +00:00
Split Text item into SimpleText and ComplexText
SimpleText has all the most common properties and is half the size
This commit is contained in:
parent
8b5df70dd0
commit
35a6e7bde5
7 changed files with 247 additions and 76 deletions
|
@ -88,17 +88,21 @@ export component Rotate inherits Empty {
|
|||
//-is_internal
|
||||
}
|
||||
|
||||
export component Text inherits Empty {
|
||||
component SimpleText inherits Empty {
|
||||
in property <length> width;
|
||||
in property <length> height;
|
||||
in property <string> text;
|
||||
in property <string> font-family;
|
||||
in property <length> font-size;
|
||||
in property <bool> font-italic;
|
||||
in property <int> font-weight;
|
||||
in property <brush> color; // StyleMetrics.default-text-color set in apply_default_properties_from_style
|
||||
in property <TextHorizontalAlignment> horizontal-alignment;
|
||||
in property <TextVerticalAlignment> vertical-alignment;
|
||||
//-default_size_binding:implicit_size
|
||||
}
|
||||
|
||||
component ComplexText inherits SimpleText {
|
||||
in property <string> font-family;
|
||||
in property <bool> font-italic;
|
||||
in property <TextOverflow> overflow;
|
||||
in property <TextWrap> wrap;
|
||||
in property <length> letter-spacing;
|
||||
|
@ -108,6 +112,8 @@ export component Text inherits Empty {
|
|||
//-default_size_binding:implicit_size
|
||||
}
|
||||
|
||||
export { ComplexText as Text }
|
||||
|
||||
export component TouchArea {
|
||||
in property <bool> enabled: true;
|
||||
out property <bool> pressed;
|
||||
|
@ -420,7 +426,7 @@ export component NativeSpinBox {
|
|||
in-out property <int> value;
|
||||
in property <int> minimum;
|
||||
in property <int> maximum: 100;
|
||||
in property <int> step-size: 1;
|
||||
in property <int> step-size: 1;
|
||||
callback edited(int /* value */);
|
||||
//-is_internal
|
||||
//-accepts_focus
|
||||
|
|
|
@ -15,8 +15,7 @@ pub fn check_rotation(doc: &crate::object_tree::Document, diag: &mut BuildDiagno
|
|||
.iter()
|
||||
.any(|(property_name, _)| is_property_set(&e, property_name))
|
||||
{
|
||||
if matches!(e.native_class(), Some(native) if native.class_name != "ClippedImage" && native.class_name != "Text")
|
||||
{
|
||||
if !e.builtin_type().is_some_and(|b| matches!(b.name.as_str(), "Image" | "Text")) {
|
||||
let span = e
|
||||
.bindings
|
||||
.get("rotation-angle")
|
||||
|
|
|
@ -434,7 +434,7 @@ pub fn collect_font_sizes_used(
|
|||
.to_string()
|
||||
.as_str()
|
||||
{
|
||||
"TextInput" | "Text" => {
|
||||
"TextInput" | "Text" | "SimpleText" | "ComplexText" => {
|
||||
if let Some(font_size) = try_extract_font_size_from_element(elem, "font-size") {
|
||||
add_font_size(font_size)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue