Commit graph

1937 commits

Author SHA1 Message Date
Simon Hausmann
7354b17a6a Minor cleanup in ItemTreeBuilder trait
Pass the sub-component as a parameter in enter_component(), as it's needed in the C++
implementation, it's readily available (no need to unwrap again) and Rust will need it, too.
2021-11-04 17:55:39 +01:00
Olivier Goffart
6df78893d6 Use build_item_tree in dynamic_component 2021-11-04 16:40:48 +01:00
Olivier Goffart
4390034d9e Interpreter: properly handle alias to global callback
Fixes test_nodejs_globals_global_callback

A recent change made the aliases to global be kept in the global
in case several components are using it.
2021-11-02 12:41:30 +01:00
Simon Hausmann
096fbab93d Simplify the destructor of generated C++ components
Similar to the parent commit, avoid creating an array of item refs and pass the item tree instead
to a run-time helper function.
2021-11-01 10:19:17 +01:00
Simon Hausmann
67579ec560 Simplify drop implementation of generated components
Avoid creating an intermediate array of items to free the graphics resources.
Instead call run-time function with the item tree as a parameter, which is traversed.

It's practically the same data structure that was previously created, except
that it is shared/global and has little holes for the dynamic tree items, but those are easy to skip.
2021-11-01 08:58:53 +01:00
Simon Hausmann
d57edfbb7c Simplify free_graphics_resources API in the backend
Take an iterator reference instead of a slice, so that we can change the call sites in the future.
2021-10-30 13:03:52 +02:00
Olivier Goffart
567c644a5f Fix PopupWindow position when all elements are not inlined
Pass a reference to the parent item in the show_popup function
so we can compute the exact location at runtime.
2021-10-28 15:52:29 +02:00
ogoffart
b25ae6fbcd Bump version number to 0.1.5 2021-10-26 07:36:54 +00:00
Simon Hausmann
6671aaefcc Remove unnecessary weak-table dependency 2021-10-25 14:56:33 +02:00
Olivier Goffart
18ce1087d5 Hardcode the Qt license
Because the install qt github action does not install the documentation
2021-10-22 14:32:17 +02:00
Simon Hausmann
7b687d020c Fix compatibility of attach_peer on ModelHandle for older models
If the model doesn't implement `model_tracker` then we must
forward `attach_peer`.
2021-10-21 13:39:38 +02:00
Olivier Goffart
38c726ad4f We need to enable the png feature in the test backend 2021-10-21 13:10:22 +02:00
Olivier Goffart
68797dd0d4 Make sure to specify a high enough version for the rgb crate
There were security issues reported in previous version
2021-10-21 12:44:06 +02:00
Olivier Goffart
cc1205742d Move the image dependency down in the dependency tree
Corelib only need the image crate for doc test
the Qt bakcned don't use the image crate
2021-10-21 12:42:04 +02:00
Olivier Goffart
56d592100e Update a few dependencies 2021-10-21 12:24:48 +02:00
Simon Hausmann
2ba469cf2a Fix vector model example docs
Re-implement model_tracker instead of attach_peer.
2021-10-20 15:33:37 +02:00
Simon Hausmann
d420d5efd7 internal cleanup: Rename Property::set_dirty() to mark_dirty() 2021-10-20 15:25:28 +02:00
Simon Hausmann
a494eafa9c Make Property::set_dirty public
Property is not public API yet, there's not much value in playing hide and seek.

Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-10-20 15:25:28 +02:00
Simon Hausmann
8596cca549 Fix model length tracking in the interpreter
Added the missing tracking call and fix the test to cover this properly.
2021-10-20 15:25:28 +02:00
Simon Hausmann
7d12fd7b4e Add support for tracking the length of a model in C++
Similar to the parent commit, the model tracks changes to the rows and
marks an internal property dirty. Since we have a base class this is a
little less intrusive.

cc #98
2021-10-20 15:25:28 +02:00
Simon Hausmann
63bf1af093 Add support for tracking the length of a model in Rust
This is done by exposing the ModelNotify to the caller via the new
ModelTracker trait, which has a function that allows "hooking" into the
dirty tracking of the size.

By extension, this also works in JavaScript.

cc #98
2021-10-20 15:25:28 +02:00
Olivier Goffart
e3d9abb1f7 ListView: Attempt to account for ListView with different item height
As an attempt to fix part of https://github.com/sixtyfpsui/cargo-ui/issues/10
2021-10-20 14:10:19 +02:00
Simon Hausmann
dec6c6ca51 Work around crash in Qt mac style when drawing scrollbars with invalid size
Fixes #595
2021-10-19 12:36:26 +02:00
James Blacklock
745abe7019 handle array length in eval.rs 2021-10-18 10:21:06 +02:00
Olivier Goffart
4436b422e5 Fix LineEdit.has-focus witht he native style
The property had the wrong name.

Also it is not a native-output
2021-10-14 15:34:25 +02:00
Olivier Goffart
bb4e5d8b55 Fix animation not starting when set from a callback
Two problems:
 - We were not marking the property as dirty, so dependent property would not
   update themselves
 - In the generated rust/c++ code, we would not call set_animated_value
2021-10-13 14:33:40 +02:00
Olivier Goffart
b74ab8969e Implement Model::set_row_data for ModelHandle 2021-10-12 14:05:33 +02:00
Simon Hausmann
e305f0e61c Fix sixtyfps::quit_event_loop() not exiting the event loop with Qt 6 on macOS
As per commit 0c02f133f3daee146b805149e69bba8cee6727b2 in qtbase (qt6),
quit() on QCoreApplication on macOS calls [NSApp terminate], which will
not return to main. The latter however is documented behavior, and
sixtyfps-viewer for example relies on it.
2021-10-11 16:55:32 +02:00
Robert Broketa
52ff84c0a1 Add changelog entry and move no-frame logic to cpp closure 2021-10-11 10:21:21 +02:00
Robert Broketa
938252d740 Not set bordeless/frameless mode if fullscreen 2021-10-11 10:21:21 +02:00
Robert Broketa
c3c7765f80 Add no-frame property for a borderless/frameless window 2021-10-11 10:21:21 +02:00
Olivier Goffart
503a9b3722 Avoid spurious "cancel" event sent to TouchArea.pointer-event 2021-10-11 10:19:59 +02:00
Olivier Goffart
40e0698373 TouchArea: Grab the mouse regardless of the button 2021-10-11 10:19:59 +02:00
Olivier Goffart
b0c87cb089 Fix the middle mouse button with Qt 2021-10-08 17:30:15 +02:00
Olivier Goffart
3b6e0e5802 Fixes the PointerEvent.kind always being down
Fixes #558
2021-10-08 16:56:35 +02:00
Philipp Gesang
f916ca4124 Bound Text contents width
The contents of a Text would wander to the left with center and
right alignment because some size calculations don't take the
maximum available width into account.
2021-10-08 08:05:42 +02:00
ogoffart
77fcd5221b Bump version number to 0.1.4 2021-10-07 09:36:43 +00:00
Simon Hausmann
7aa6545046 Enable support for gzipped SVG
usvg detects gzipped SVG by looking at the first bytes, and Qt supports it as well.
2021-10-06 21:24:44 +02:00
Olivier Goffart
7939d834d4 Fix panic in the interpreter if there are properties that are aliased to struct 2021-10-06 18:33:27 +02:00
Simon Hausmann
7102f9b997 Fix standard button OK text
Ok -> OK
2021-10-06 16:16:39 +02:00
Simon Hausmann
6dce5ab32e Fix rendering of push buttons with QStyle on macOS
The button bevel was rendered upside down, which happens due to some
weird double y-axis inversion, which goes away when passing the QWidget
pointer to the style. When using the Qt backend, we can do that.
2021-10-06 14:39:56 +02:00
Olivier Goffart
db10bf2187 Fix embedded window icon with the Qt backend
Also add a window icon to the gallery
2021-10-06 12:39:22 +02:00
Simon Hausmann
4c6c8233c0 Qt style: Improve default layout spacing on macOS
When the PM_LayoutHorizontalSpacing pixel metric is negative, we're supposed to call
layoutSpacing() on the style. Until we have a detailed
overview over the controls, a default spacing is better than -1 :-)
2021-10-06 11:10:58 +02:00
Olivier Goffart
a1b27c47ae Small cleanup
The is_standard_button is alays true because the None path returns a few line before
2021-10-06 10:53:30 +02:00
Simon Hausmann
d43e0a1c83 Qt style: Only show icons in standard buttons if the style permits 2021-10-06 10:45:31 +02:00
Olivier Goffart
aa05e96d22 Native style: properly initialize the layout padding 2021-10-06 10:43:32 +02:00
Simon Hausmann
88ad176008 Improve diagnostics when images cannot be located for embedding
This is a two-stage change, that first centralizes the file I/O code
path for on-disk and builtin:/ files. Secondly the resource embedding
pass now produces diagnostics if a file cannot be located.
2021-10-05 23:16:46 +02:00
Simon Hausmann
4b267a8e9b Internal cleanup: Simplify string handling when accessing compiler-embedded files
For loading images that are included in the widget library that's included in turn
in the compiler binary, we need to create ImageInner::EmbeddedData
with &'static data and &'static file extension. The latter was
created using string interning, but we can also access the path of the
widget library data structure.
2021-10-05 23:16:46 +02:00
Simon Hausmann
332b149610 Add support for accessing resources from the embedded widget library in the interpreter 2021-10-05 23:16:46 +02:00
Simon Hausmann
30e79d3ea2 Fix panic with GL backend when using non-existent font families
The database is not empty, as the changed expect() suggests, but instead
it just means that the family could not be found. This can happen for
example with something like this:

export App := Window {
    Text {
        text: "Ok";
        font-family: "Non-existent";
    }
}

or it can also happen when loading the printer demo in the online
editor, where a custom font is supposed to be available but that's not
implemented for wasm builds.

So instead of panicing, fall back to querying for a last-resort
sans-serif family.

For Linux, we register fontconfig's choice for sans-serif, otherwise
fontdb has defaults for macOS and Windows, and for wasm we register our
copy of DejaVu. So that cannot really fail....
2021-10-05 14:03:17 +02:00