We calculate the cursor position as byte offset in the utf-8 encoded string,
while Qt expects an index in the utf-16 encoded QString.
When those differ, the cursor is rendered at the wrong location.
Fixes#363
This requires some gymnastics to get right as the information
need to be passed to the compiler despite having no direct dependency
between the compiler and the runtime or backends.
So use a file in the build directory to tell the default style
cc: #83
Add the icon type explicitly to make it easier to do "eye" based type matching with the cpp! macro.
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
Sixtyfps uses euclid already, so let's use euclid for float comparisons
as well.
I changed the code to decide whether a number is a positive integer to
make do without a comparison along the way.
That's all it is nowadays, it's a wrapper around Rc<Window>. It's not an
alias because we need to also "wrap" it to C++ via cbindgen, but that's
about it.
* Remove the `new` function from the main impl and use the slightly
less visible From conversion trait
* Make the inner Rc<Window> pub(crate) instead of pub
* Instead, provide a public as_any() accessor that the Qt backend can use
If we were to add `sixtyfps:🪟:Window` to the re_exports, then
this clashes. We might rename the former, but this is a cleaner naming
in any case.
Relates to #333
When the widget itself is part of a hierarchy and some parent widget defines
font properties (such as weight, etc.) that aren't defined in .60, we would
inherit those for rendering, but not when measuring.
Since when measuring we don't have a widget, this patch disables all font
property merging from the widget hierarchy.
This requires the image size query to be window independent and go
through the backend instead.
This implies minor changes for the Qt backend and bigger ones for the GL
backend:
* There exists now a thread-local IMAGE_CACHE, which is used by the
backend's image_size() function as well as by the renderer for
loading CPU side images.
* The image remain as decoded images in there (including SVG tree)
and the window now has a texture_cache, which holds CachedImage
with ImageData::Texture.
* Rendering an image item therefore fetches the CPU side image,
calls upload_to_gpu() on it, which creates a new Rc<CachedImage>
and that's stored in the texture_cache.
* The texture cache continues to be pruned when hiding the window.
Split the vertical and horizontal pass into different property cache
This will allow to implement "height for with"
This patch does not port the Rust or C++ binding yet
When a Text element has wrapping enabled, it should not have zero
minimum size. Otherwise the layout will give it a height of zero in the
layout in the test case and that'll make the text disappear. There are
different options but this patch goes for minimum height as if no
wrapping was enabled (so at least one line plus forced line breaks).
Fixes#246