Closed Misaka299 closed 2 years ago
Thanks for your bug report!
I believe this is a duplicate of #1139 which already has been fixed in the master branch. You can try using the git version of slint, or wait for the next release
ok.
May I ask why the code I wrote can't find the checkbox, and now I use the git version.
By the way, how to set the line height of text.
did you do
import { CheckBox } from "std-widgets.slint";
How to read the checked field of the checkBox in the code.
Slint's design is very creative. but Slint's documentation feels inadequate. Although I make simple things, I can't always find the content I need. (I can't find what I need, or it may have something to do with my poor English.
I'll close this particular issue as the original issue is a duplicate of #1139
You are welcome to continue with more questions on the discussions => https://github.com/slint-ui/slint/discussions
Regarding your last question:
How to read the checked field of the checkBox in the code.
One way is to export the checkbox's checked property as a root property:
MainWindow := Window {
property foo_checked <=> foo.checked;
// ...
foo := CheckBox { ... }
//...
}
Then you can use get_foo_checked()
from the code.
Instead of a property in the root, that can also be a property in a global, see https://docs.rs/slint/latest/slint/trait.Global.html
export global MyGlobal := {
property <bool> foo_checked;
}
MainWindow := Window {
// ...
foo := CheckBox { checked <=> MyGlobal.foo_checked; }
//...
}
Or you can also pass the result in a callback (or global callback)
MainWindow := Window {
callbak foo_toggled(bool);
// ...
foo := CheckBox { toggled => { root.foo_toggled(foo.checked); } }
//...
}
thank you
If the text does not start with Chinese, the characters will be unrecognized and garbled.
Although I haven't tested it, I think this problem occurs in other languages as well.