Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/gallery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ name = "gallery"

[dependencies]
slint = { path = "../../api/rs/slint", features = ["gettext"] }
i-slint-core = { path = "../../internal/core", features = ["experimental-rich-text"] }

[build-dependencies]
slint-build = { path = "../../api/rs/build" }
Expand Down
7 changes: 4 additions & 3 deletions examples/gallery/gallery.slint
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT

import { CheckBox, StandardListView } from "std-widgets.slint";
import { AboutPage, ControlsPage, EasingsPage, ListViewPage, TableViewPage, TableViewPageAdapter, TextEditPage } from "ui/pages/pages.slint";
import { AboutPage, ControlsPage, EasingsPage, ListViewPage, StyledTextPage, TableViewPage, TableViewPageAdapter, TextEditPage } from "ui/pages/pages.slint";
import { GallerySettings } from "ui/gallery_settings.slint";
import { SideBar } from "ui/side_bar.slint";

Expand Down Expand Up @@ -42,14 +42,15 @@ export component App inherits Window {
HorizontalLayout {
side-bar := SideBar {
title: @tr("Slint Widgets Gallery");
model: [@tr("Menu" => "Controls"), @tr("Menu" => "ListView"), @tr("Menu" => "TableView"), @tr("Menu" => "TextEdit"), @tr("Menu" => "Easings"), @tr("Menu" => "About")];
model: [@tr("Menu" => "Controls"), @tr("Menu" => "ListView"), @tr("Menu" => "TableView"), @tr("Menu" => "TextEdit"), @tr("Menu" => "Easings"), @tr("Menu" => "StyledText"), @tr("Menu" => "About")];
}

if(side-bar.current-item == 0) : ControlsPage {}
if(side-bar.current-item == 1) : ListViewPage {}
if(side-bar.current-item == 2) : TableViewPage {}
if(side-bar.current-item == 3) : TextEditPage {}
if(side-bar.current-item == 4) : EasingsPage {}
if(side-bar.current-item == 5) : AboutPage {}
if(side-bar.current-item == 5) : StyledTextPage {}
if(side-bar.current-item == 6) : AboutPage {}
}
}
1 change: 1 addition & 0 deletions examples/gallery/ui/pages/pages.slint
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export { AboutPage } from "about_page.slint";
export { ControlsPage } from "controls_page.slint";
export { EasingsPage } from "easings_page.slint";
export { ListViewPage } from "list_view_page.slint";
export { StyledTextPage } from "styled_text_page.slint";
export { TableViewPage, TableViewPageAdapter } from "table_view_page.slint";
export { TextEditPage } from "text_edit_page.slint";
65 changes: 65 additions & 0 deletions examples/gallery/ui/pages/styled_text_page.slint
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT

import { GroupBox, VerticalBox, HorizontalBox } from "std-widgets.slint";
import { Page } from "page.slint";

export component StyledTextPage inherits Page {
show-enable-switch: false;
title: @tr("Styled Text");
description: @tr("StyledText demos");

VerticalBox {
GroupBox {
title: @tr("Basic Styles");

VerticalBox {
StyledText {
text: @markdown("**bold text**, *italic text*, __underlined text__, ~~strikethrough text~~, ***bold italic***.");
}
}
}

GroupBox {
title: @tr("Colors");

VerticalBox {
StyledText {
text: @markdown("<font color='#e74c3c'>Red text</font> and <font color='#27ae60'>green text</font> and <font color='#3498db'>blue text</font>.");
}

StyledText {
text: @markdown("<font color='#9b59b6'>Purple</font> **bold** <font color='#f39c12'>orange</font> *italic* mixed together.");
}
}
}

GroupBox {
title: @tr("Hyperlinks");

VerticalBox {
StyledText {
text: @markdown("Visit [Slint Website](https://slint.dev) for more information.");
}

StyledText {
text: @markdown("Check out our [GitHub](https://github.com/slint-ui/slint) repository and [Documentation](https://slint.dev/docs).");
}
}
}

GroupBox {
title: @tr("Lists");

VerticalBox {
StyledText {
text: @markdown("* First item\n* Second item\n* Third item\n 1. Item one\n 2. Item two\n 3. Item three");
}

StyledText {
text: @markdown("1. First step\n2. Second step\n3. Third step");
}
}
}
}
}
3 changes: 0 additions & 3 deletions internal/compiler/passes/resolving.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,9 +755,6 @@ impl Expression {
}

fn from_at_markdown(node: syntax_nodes::AtMarkdown, ctx: &mut LookupCtx) -> Expression {
if !ctx.diag.enable_experimental {
ctx.diag.push_error("The @markdown() function is experimental".into(), &node);
}
let Some(string) = node
.child_text(SyntaxKind::StringLiteral)
.and_then(|s| crate::literals::unescape_string(&s))
Expand Down
3 changes: 0 additions & 3 deletions internal/compiler/typeregister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,6 @@ impl TypeRegister {
register.elements.remove("DropArea").unwrap();
register.types.remove("DropEvent").unwrap(); // Also removed in xtask/src/slintdocs.rs

register.elements.remove("StyledText").unwrap();
register.types.remove("styled-text").unwrap();

match register.elements.get_mut("Window").unwrap() {
ElementType::Builtin(b) => {
Rc::get_mut(b)
Expand Down
Loading