Commit graph

6496 commits

Author SHA1 Message Date
Olivier Goffart
3e2f4a60ba Revert "slint-docs-preview.html: Update URL for the release"
This reverts commit c1b6ac258b.
2022-05-09 15:48:31 +02:00
Olivier Goffart
f96894fd5f Fix link in the changelog 2022-05-09 15:48:10 +02:00
Olivier Goffart
c1b6ac258b slint-docs-preview.html: Update URL for the release 2022-05-09 14:52:10 +02:00
Olivier Goffart
e999ecd444 Update version number in docs 2022-05-09 14:49:53 +02:00
Olivier Goffart
fef10ae177 Prepare changelog for release 2022-05-09 14:48:22 +02:00
Tobias Hunger
186e7c0ff2
Fix focus of next item with empty components (#1247)
Handle empty components in the item tree when looking for the next item
to focus.
2022-05-09 12:46:10 +02:00
Jared Moulton
6a2818288f
Add treesitter tests (#1239)
* Add tree-sitter tests

Some test are currently failing but this will make it obvious and clear
where the current problems are and make it simple to get started fixing
them without causing more regressions.

* Add a contributing guide

* Add copyright header

* Make up copyright for tree-sitter changes

Co-authored-by: Tobias Hunger <tobias.hunger@slint-ui.com>
2022-05-09 10:18:04 +02:00
Olivier Goffart
2aaefa8e0d C++: Setting a value to a property having a binding should always clear the binding
... even if the old value holds the same value as the new value

This fixes test_cpp_bindings_two_way_priority_default

Also add a C++ unit test that tests the Property type specificaly
2022-05-09 09:30:01 +02:00
Olivier Goffart
a2d5ddaeca Fix priority of aliases when default value are involved
This code would have unpredictable results:

```slint
export Button := Rectangle {
    property<bool> the_enabled <=> touch.enabled;
    property<bool> the_visible <=> touch.visible;
    background: !the_enabled ? blue : red;
    border-color: !the_visible ? green : yellow;
    border-width: 15px;
    touch := TouchArea {}
    fs := FocusScope {
        enabled <=> root.the_enabled;
        visible <=> root.the_visible;
    }
}

Demo := Rectangle {
    VerticalLayout {
        spacing: 10px;
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
    }
}
```

Because the enabled and visible property defaults to true (default
enforced by the compiler), but we set it also to false via an alias
2022-05-09 09:30:01 +02:00
Olivier Goffart
51146eccd1 Update corrosion 2022-05-09 09:23:23 +02:00
Olivier Goffart
aaca85b250 cargo fmt 2022-05-09 09:22:53 +02:00
Olivier Goffart
a15293891b C++ test driver: fix the env variable to keep the temporary C++ file
Because in case of failure we panic or return before we get the chance
to call keep()
2022-05-09 08:58:22 +02:00
Christoph Herzog
4304a27a12 Fix typo in bash example README 2022-05-07 16:41:01 +02:00
Simon Hausmann
6e18513c12 GL backend: fix locating the default font in slightly atypical environments
Enable fontdb's fontconfig feature to parse fontconfig files to locate
the directories where truetype fonts are located. This helps in system
setups that differ from the defaults that fontdb uses otherwise.

Fixes #1240
2022-05-07 21:59:16 +08:00
Olivier Goffart
4442ac823d Changelog: add issue number 2022-05-06 12:56:07 +02:00
Olivier Goffart
01bf529f79 Properly initialize the default binding of a state to its materialized value
Fixes #1237
2022-05-06 12:55:42 +02:00
Olivier Goffart
8be92eac1d Fix conversion from brush to color in the ternary operator
Fixes #1235
2022-05-06 10:29:54 +02:00
Olivier Goffart
58c1c96e8f Fix tests after they were moved 2022-05-06 10:23:10 +02:00
Olivier Goffart
9e5f1f8e3d Move lone tests to sub-folder 2022-05-06 09:56:39 +02:00
Lukas Jung
9ac98b9155 implement undo redo for circledraw 2022-05-06 09:47:30 +02:00
Olivier Goffart
76f3fcd89f Fix BoxShadow property incorrectly considered const
We steal the bindings for the geometry from the containing element,
so we should also take the analysis.

Fixes #1233
2022-05-05 22:03:59 +02:00
Olivier Goffart
0c19751a1e Qt: do not wrap QPainter directly, but use a unique_ptr instead
Because QPainter can't be relocated.

Fixes #1230
2022-05-05 13:50:26 +02:00
Olivier Goffart
696ce933f7
Refactor the Model tracking in a module (#1223)
Contain the unsafe code in a smaller module.
Add an abstraction to make it easier to create change listener other
than the repeater.
2022-05-05 10:25:15 +02:00
Olivier Goffart
59291092b5 online-editor: Update JS dependencies
Seems to just work and will maybe fix the current CI faillure
2022-05-05 09:49:51 +02:00
Olivier Goffart
4165065fa4 wasm-interpreter: Disable the backend-qt feature
We don't need to compile cpp, qttypes, and all such dependencies to only
have the qt backend's buildscript ignore the qt compilation error and
fallback to the dummy no_qt backend.
2022-05-05 09:46:30 +02:00
Olivier Goffart
bc0f878799 Update corrosion 2022-05-05 08:54:32 +02:00
ogoffart
6395cdfc09 Bump version number to 0.2.3 2022-05-04 12:32:58 +00:00
Olivier Goffart
ed7eb6f540 Revert "Update URL in docs for release"
This reverts commit 79a1bd5d6e.

Release is done 🎉
2022-05-04 13:53:31 +02:00
Olivier Goffart
88d55e036a xtask: Fix node package script
the xshell API changed a bit and does not create the destination directory,
also the path from the iterator is absolute.
2022-05-04 13:52:21 +02:00
Olivier Goffart
79a1bd5d6e Update URL in docs for release 2022-05-04 12:02:36 +02:00
Olivier Goffart
2442b9628e Update date in the Changelog 2022-05-04 12:01:03 +02:00
Olivier Goffart
69a2d45203 Update version number in docs and readme 2022-05-04 12:00:57 +02:00
Olivier Goffart
525e9982d8 Re-export and document ModelExt 2022-05-04 11:08:14 +02:00
Lukas Jung
7c45be97cd Move row_data_tracked to ModelExt trait 2022-05-04 11:08:14 +02:00
Olivier Goffart
530623a61b vtable: update changelog for release 2022-05-04 09:30:09 +02:00
Tobias Hunger
5bcdf1be64
Improve README.md (#1209)
Add a "Quick Start" early on pointing to the Web demos and build
instructions. The idea is that you can go and play with Slint right after
reading what it actually is.

Mention recipes and other docs first, then point to the API docs. I am
pretty sure most users will stop reading once they find the links to the
APIs:-)
2022-05-04 09:23:40 +02:00
Lukas Jung
d648862589 Make window.hide() respect the set EventLoopQuitBehavior 2022-05-04 09:16:13 +02:00
Tobias Hunger
11f23cbbdb
Hack to make Qt not close newly opened popups when running on Windows (#1227)
* Hack to make Qt not close newly opened popups when running on Windows

Windows sends a mouse release event after the close event when running
on windows. This confuses our hack to close popups!

So hack around the problem by ignoring any mouse button release event
that does not follow a mouse button press event. I hope this will
not couse too many side effects.

Fixes: #1211

* Update internal/backends/qt/qt_window.rs

Co-authored-by: Olivier Goffart <olivier@woboq.com>

Co-authored-by: Olivier Goffart <olivier@woboq.com>
2022-05-03 18:46:53 +02:00
Olivier Goffart
931838e2ce Qt: quit the application when calling hide() on the last window
Fixes the todo example not exiting when clicking on "yes" in
the close popup

cc #1212
2022-05-03 17:20:41 +02:00
Olivier Goffart
1b9917db37 Fix PopupMenu showing in a wrong place from qt_viewer
qt_viewer reparent the window so we need to use mapToGlobal to compute
the popup position

Fixes #1219
2022-05-03 11:54:53 +02:00
Olivier Goffart
590ef33018 Fix crash in qt_viewer at exit
Destroy the slint instance before destroying the main QWidget

Workaround #1222
2022-05-03 11:47:35 +02:00
Olivier Goffart
284335356c 7gui/crud example: don't panic when deleting non-existing row
Two counter measure

 1. Disable the button when an invalid selection is there
 2. double check in the rust code that the selected item is valid
2022-05-02 14:13:37 +02:00
Olivier Goffart
8a4d6a34ba Revert #1049
This breaks the printer demo USB page, it makes it impossible to
change the current item.
That's because the printer demo do `current-item: 1;` to preselect the cat.
But that breaks the property binding that makes current-item follow the
actual-current-item.

 * Revert "move actual-current-item to FocusScope"
   This reverts commit 8240531e6e.

 * Revert "reset StandardListView's current-item if it is out of bounds"
   This reverts commit 9d18882f9d.
2022-05-02 14:13:37 +02:00
Tobias Hunger
894ee5aa91
Do not build node by default (#1210)
Having to make sure the right version of npm is installed is a hassle
for people that just want to try out slint for the first time. The
proposed way to disable node support enables basically everything else,
which opens another can of worms when Windows tries to build MCU
support.

So do not build Node.JS as part of the default build anymore, but
document how to build it.

The CI should build with `--workspace` already, so there should be no
need to change the CI build.
2022-05-02 13:30:19 +02:00
Tobias Hunger
9a881f9a90
Clippy 0 2 3 (#1203)
* janitor: Fix clippy error in textlayout.rs

This one is almost certainly a bug.

* janitor: clippy fixes in inline_expressions.rs

Clippy claims the original code was slower and less clean, so let's
change this.
2022-05-02 13:23:35 +02:00
Olivier Goffart
86d893245e Model: When items are inserted, sets the components after that as dirty
Because their index property needs to be updated
2022-05-02 11:47:17 +02:00
Olivier Goffart
2a55daff32 Focus: fix looping in repeater when the repeater ends with a repeater 2022-04-29 17:27:59 +02:00
Olivier Goffart
36313e8182 Fix focus navigation involving repeater at the end of the chain
The parent_node function doesn't reset its argument if it is already
set while calling the function
2022-04-29 16:35:46 +02:00
Olivier Goffart
b6ac53896f
Ci: crater: Remove a project
Not using slint anymore :-(
2022-04-29 15:01:19 +02:00
Olivier Goffart
723f89d342 Fix changing the size of contrained window on x11
Changing the constraint doesn't work on non-rezsizable window.
So first set the window as resizeable, then change the constraints, then
maybe remove the resizable flag
2022-04-29 11:54:31 +02:00