slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.55k stars 601 forks source link

Selecting text? #736

Closed magnus-ISU closed 9 months ago

magnus-ISU commented 2 years ago

Is this possible? It seems like an important feature but as far as I can tell you can only select text in an enabled TextEdit or TextInput. But I want to be able to select text without allowing it to be editable or showing a blinking cursor always.

I think one possible solution would be to have a selectable: [true/false]; property on the generic Text, and maybe give it to the other widgets that can show text as well.

tronical commented 2 years ago

Yes, that makes sense and that seems the right straight-forward API for it.

tronical commented 9 months ago

LineEdit/TextInput supports a read-only property and it's possible to programmatically set the selection after https://github.com/slint-ui/slint/pull/4197 .