mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-29 21:34:50 +00:00
Fixed kebab casing of previous appwindow.slint
.
This commit is contained in:
parent
844590cac8
commit
9894eca229
25 changed files with 33 additions and 33 deletions
|
@ -56,7 +56,7 @@ channel = "esp"
|
||||||
# define DRAW_BUF_SIZE (BSP_LCD_H_RES * CONFIG_BSP_LCD_DRAW_BUF_HEIGHT)
|
# define DRAW_BUF_SIZE (BSP_LCD_H_RES * CONFIG_BSP_LCD_DRAW_BUF_HEIGHT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "appwindow.h"
|
#include "app-window.h"
|
||||||
|
|
||||||
extern "C" void app_main(void)
|
extern "C" void app_main(void)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ extern "C" void app_main(void)
|
||||||
ui->run();
|
ui->run();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
8. Create `main/appwindow.slint` with the following contents:
|
8. Create `main/app-window.slint` with the following contents:
|
||||||
```
|
```
|
||||||
import { VerticalBox, AboutSlint } from "std-widgets.slint";
|
import { VerticalBox, AboutSlint } from "std-widgets.slint";
|
||||||
export component AppWindow inherits Window {
|
export component AppWindow inherits Window {
|
||||||
|
@ -108,10 +108,10 @@ export component AppWindow inherits Window {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
9. Edit `main/CMakeLists.txt` to adjust for the new `slint-hello-world.cpp`, add `slint` as required component,
|
9. Edit `main/CMakeLists.txt` to adjust for the new `slint-hello-world.cpp`, add `slint` as required component,
|
||||||
and instruction the build system to compile `appwindow.slint` to `appwindow.h`. The file should look like this:
|
and instruction the build system to compile `app-window.slint` to `app-window.h`. The file should look like this:
|
||||||
```cmake
|
```cmake
|
||||||
idf_component_register(SRCS "slint-hello-world.cpp" INCLUDE_DIRS "." REQUIRES slint)
|
idf_component_register(SRCS "slint-hello-world.cpp" INCLUDE_DIRS "." REQUIRES slint)
|
||||||
slint_target_sources(${COMPONENT_LIB} appwindow.slint)
|
slint_target_sources(${COMPONENT_LIB} app-window.slint)
|
||||||
```
|
```
|
||||||
10. Open the configuration editor with `idf.py menuconfig`:
|
10. Open the configuration editor with `idf.py menuconfig`:
|
||||||
* Change the stack size under `Component config --> ESP System Settings --> Main task stack size` to at least `8192`. You may need to tweak this value in the future if you run into stack overflows.
|
* Change the stack size under `Component config --> ESP System Settings --> Main task stack size` to at least `8192`. You may need to tweak this value in the future if you run into stack overflows.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
add_executable(libraries main.cpp)
|
add_executable(libraries main.cpp)
|
||||||
target_link_libraries(libraries PRIVATE Slint::Slint)
|
target_link_libraries(libraries PRIVATE Slint::Slint)
|
||||||
slint_target_sources(libraries appwindow.slint
|
slint_target_sources(libraries app-window.slint
|
||||||
LIBRARY_PATHS
|
LIBRARY_PATHS
|
||||||
helper_components=${CMAKE_CURRENT_SOURCE_DIR}/../../../../tests/helper_components/
|
helper_components=${CMAKE_CURRENT_SOURCE_DIR}/../../../../tests/helper_components/
|
||||||
helper_buttons=${CMAKE_CURRENT_SOURCE_DIR}/../../../../tests/helper_components/test_button.slint
|
helper_buttons=${CMAKE_CURRENT_SOURCE_DIR}/../../../../tests/helper_components/test_button.slint
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
||||||
|
|
||||||
#include "appwindow.h"
|
#include "app-window.h"
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
|
|
||||||
add_executable(multiple-includes main.cpp logic.cpp)
|
add_executable(multiple-includes main.cpp logic.cpp)
|
||||||
target_link_libraries(multiple-includes PRIVATE Slint::Slint)
|
target_link_libraries(multiple-includes PRIVATE Slint::Slint)
|
||||||
slint_target_sources(multiple-includes appwindow.slint COMPILATION_UNITS 0)
|
slint_target_sources(multiple-includes app-window.slint COMPILATION_UNITS 0)
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
||||||
|
|
||||||
#include "logic.h"
|
#include "logic.h"
|
||||||
#include "appwindow.h"
|
#include "app-window.h"
|
||||||
// Test that it's ok to include twice
|
// Test that it's ok to include twice
|
||||||
#include "appwindow.h"
|
#include "app-window.h"
|
||||||
|
|
||||||
void setup_logic(const Logic &logic)
|
void setup_logic(const Logic &logic)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
||||||
|
|
||||||
#include "logic.h"
|
#include "logic.h"
|
||||||
#include "appwindow.h"
|
#include "app-window.h"
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,7 +48,7 @@ pipenv run python main.py
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
1. Add Slint Python Package Index to your Python project: `pipenv install slint`
|
1. Add Slint Python Package Index to your Python project: `pipenv install slint`
|
||||||
2. Create a file called `appwindow.slint`:
|
2. Create a file called `app-window.slint`:
|
||||||
|
|
||||||
```slint
|
```slint
|
||||||
import { Button, VerticalBox } from "std-widgets.slint";
|
import { Button, VerticalBox } from "std-widgets.slint";
|
||||||
|
@ -75,8 +75,8 @@ export component AppWindow inherits Window {
|
||||||
```python
|
```python
|
||||||
import slint
|
import slint
|
||||||
|
|
||||||
# slint.loader will look in `sys.path` for `appwindow.slint`.
|
# slint.loader will look in `sys.path` for `app-window.slint`.
|
||||||
class App(slint.loader.appwindow.AppWindow):
|
class App(slint.loader.app_window.AppWindow):
|
||||||
@slint.callback
|
@slint.callback
|
||||||
def request_increase_value(self):
|
def request_increase_value(self):
|
||||||
self.counter = self.counter + 1
|
self.counter = self.counter + 1
|
||||||
|
|
|
@ -9,7 +9,7 @@ endif()
|
||||||
|
|
||||||
add_executable(memory_tutorial_initial main_initial.cpp)
|
add_executable(memory_tutorial_initial main_initial.cpp)
|
||||||
target_link_libraries(memory_tutorial_initial PRIVATE Slint::Slint)
|
target_link_libraries(memory_tutorial_initial PRIVATE Slint::Slint)
|
||||||
slint_target_sources(memory_tutorial_initial appwindow.slint)
|
slint_target_sources(memory_tutorial_initial app-window.slint)
|
||||||
|
|
||||||
add_executable(memory_tutorial_tiles_from_cpp main_tiles_from_cpp.cpp)
|
add_executable(memory_tutorial_tiles_from_cpp main_tiles_from_cpp.cpp)
|
||||||
target_link_libraries(memory_tutorial_tiles_from_cpp PRIVATE Slint::Slint)
|
target_link_libraries(memory_tutorial_tiles_from_cpp PRIVATE Slint::Slint)
|
||||||
|
|
|
@ -19,14 +19,14 @@ The <span class="hljs-keyword">for</span> loop is declarative and automatically
|
||||||
the model changes. The loop instantiates all the <span class="hljs-title">MemoryTile</span> elements and places them on a grid based on their
|
the model changes. The loop instantiates all the <span class="hljs-title">MemoryTile</span> elements and places them on a grid based on their
|
||||||
index with spacing between the tiles.
|
index with spacing between the tiles.
|
||||||
|
|
||||||
First, add the tile data structure definition at the top of the `ui/appwindow.slint` file:
|
First, add the tile data structure definition at the top of the `ui/app-window.slint` file:
|
||||||
|
|
||||||
:::{literalinclude} main_multiple_tiles.rs
|
:::{literalinclude} main_multiple_tiles.rs
|
||||||
:language: slint,no-preview
|
:language: slint,no-preview
|
||||||
:lines: 11-15
|
:lines: 11-15
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Next, replace the _export component <span class="hljs-title">MainWindow</span> inherits Window { ... }_ section at the bottom of the `ui/appwindow.slint` file with the following:
|
Next, replace the _export component <span class="hljs-title">MainWindow</span> inherits Window { ... }_ section at the bottom of the `ui/app-window.slint` file with the following:
|
||||||
|
|
||||||
:::{literalinclude} main_multiple_tiles.rs
|
:::{literalinclude} main_multiple_tiles.rs
|
||||||
:language: slint,no-preview
|
:language: slint,no-preview
|
||||||
|
|
|
@ -36,12 +36,12 @@ Replace the content of `src/main.cpp` with the following:
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Also in `CMakeLists.txt` the line
|
Also in `CMakeLists.txt` the line
|
||||||
`slint_target_sources(my_application ui/appwindow.slint)` is a Slint function used to
|
`slint_target_sources(my_application ui/app-window.slint)` is a Slint function used to
|
||||||
add the `appwindow.slint` file to the target.
|
add the `app-window.slint` file to the target.
|
||||||
|
|
||||||
Replace the contents of `ui/appwindow.slint` with the following:
|
Replace the contents of `ui/app-window.slint` with the following:
|
||||||
|
|
||||||
:::{literalinclude} appwindow.slint
|
:::{literalinclude} app-window.slint
|
||||||
:language: slint,no-preview
|
:language: slint,no-preview
|
||||||
:lines: 6-11
|
:lines: 6-11
|
||||||
:::
|
:::
|
||||||
|
@ -116,7 +116,7 @@ Replace the contents of `src/main.js` with the following:
|
||||||
|
|
||||||
The `slint.loadFile` method resolves files from the process's current working directory, so from the `package.json` file's location.
|
The `slint.loadFile` method resolves files from the process's current working directory, so from the `package.json` file's location.
|
||||||
|
|
||||||
Replace the contents of `ui/appwindow.slint` with the following:
|
Replace the contents of `ui/app-window.slint` with the following:
|
||||||
|
|
||||||
:::{literalinclude} memory.slint
|
:::{literalinclude} memory.slint
|
||||||
:language: slint,no-preview
|
:language: slint,no-preview
|
||||||
|
@ -157,7 +157,7 @@ fn main() -> Result<(), slint::PlatformError> {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Replace the contents of `ui/appwindow.slint` with the following:
|
Replace the contents of `ui/app-window.slint` with the following:
|
||||||
|
|
||||||
:::{literalinclude} memory.slint
|
:::{literalinclude} memory.slint
|
||||||
:language: slint,no-preview
|
:language: slint,no-preview
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// ANCHOR: main
|
// ANCHOR: main
|
||||||
// src/main.cpp
|
// src/main.cpp
|
||||||
|
|
||||||
#include "appwindow.h" // generated header from memory.slint
|
#include "app-window.h" // generated header from memory.slint
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// main.js
|
// main.js
|
||||||
import * as slint from "slint-ui";
|
import * as slint from "slint-ui";
|
||||||
|
|
||||||
let ui = slint.loadFile("./ui/appwindow.slint");
|
let ui = slint.loadFile("./ui/app-window.slint");
|
||||||
let mainWindow = new ui.MainWindow();
|
let mainWindow = new ui.MainWindow();
|
||||||
await mainWindow.run();
|
await mainWindow.run();
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// ANCHOR: main
|
// ANCHOR: main
|
||||||
// main.js
|
// main.js
|
||||||
import * as slint from "slint-ui";
|
import * as slint from "slint-ui";
|
||||||
let ui = slint.loadFile("./ui/appwindow.slint");
|
let ui = slint.loadFile("./ui/app-window.slint");
|
||||||
let mainWindow = new ui.MainWindow();
|
let mainWindow = new ui.MainWindow();
|
||||||
|
|
||||||
let initial_tiles = mainWindow.memory_tiles;
|
let initial_tiles = mainWindow.memory_tiles;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// ANCHOR: main_window
|
// ANCHOR: main_window
|
||||||
// appwindow.slint
|
// app-window.slint
|
||||||
export component MainWindow inherits Window {
|
export component MainWindow inherits Window {
|
||||||
Text {
|
Text {
|
||||||
text: "hello world";
|
text: "hello world";
|
||||||
|
|
|
@ -12,7 +12,7 @@ Lengths in Slint have a unit, here, the `px` suffix.
|
||||||
This makes the code easier to read and the compiler can detect when you accidentally
|
This makes the code easier to read and the compiler can detect when you accidentally
|
||||||
mix values with different units attached to them.
|
mix values with different units attached to them.
|
||||||
|
|
||||||
Copy the following code into `ui/appwindow.slint` file, replacing the current content:
|
Copy the following code into `ui/app-window.slint` file, replacing the current content:
|
||||||
|
|
||||||
:::{literalinclude} memory_tile.slint
|
:::{literalinclude} memory_tile.slint
|
||||||
:language: slint,no-preview
|
:language: slint,no-preview
|
||||||
|
@ -22,7 +22,7 @@ Copy the following code into `ui/appwindow.slint` file, replacing the current co
|
||||||
This exports the <span class="hljs-title">MainWindow</span> component so that the game logic code can access it later.
|
This exports the <span class="hljs-title">MainWindow</span> component so that the game logic code can access it later.
|
||||||
|
|
||||||
Inside the <span class="hljs-built_in">Rectangle</span> place an <span class="hljs-built_in">Image</span> element that
|
Inside the <span class="hljs-built_in">Rectangle</span> place an <span class="hljs-built_in">Image</span> element that
|
||||||
loads an icon with the <span class="hljs-built_in">@image-url()</span> macro. The path is relative to the location of `ui/appwindow.slint`.
|
loads an icon with the <span class="hljs-built_in">@image-url()</span> macro. The path is relative to the location of `ui/app-window.slint`.
|
||||||
|
|
||||||
You need to install this icon and others you use later first. You can download a pre-prepared
|
You need to install this icon and others you use later first. You can download a pre-prepared
|
||||||
[Zip archive](https://slint.dev/blog/memory-game-tutorial/icons.zip) to the `ui` folder,
|
[Zip archive](https://slint.dev/blog/memory-game-tutorial/icons.zip) to the `ui` folder,
|
||||||
|
|
|
@ -24,7 +24,7 @@ property that can be set when instantiating the element.
|
||||||
For the final polish, add a
|
For the final polish, add a
|
||||||
_solved_ property used to animate the color to a shade of green when a player finds a pair.
|
_solved_ property used to animate the color to a shade of green when a player finds a pair.
|
||||||
|
|
||||||
Replace the code inside the `ui/appwindow.slint` file with the following:
|
Replace the code inside the `ui/app-window.slint` file with the following:
|
||||||
|
|
||||||
:::{literalinclude} main_polishing_the_tile.rs
|
:::{literalinclude} main_polishing_the_tile.rs
|
||||||
:language: slint,no-preview
|
:language: slint,no-preview
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
add_executable(platform_native WIN32 main.cpp appview.cpp)
|
add_executable(platform_native WIN32 main.cpp appview.cpp)
|
||||||
target_link_libraries(platform_native PRIVATE Slint::Slint)
|
target_link_libraries(platform_native PRIVATE Slint::Slint)
|
||||||
slint_target_sources(platform_native appwindow.slint)
|
slint_target_sources(platform_native app-window.slint)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# define UNICODE
|
# define UNICODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "appwindow.h"
|
#include "app-window.h"
|
||||||
#include <slint-platform.h>
|
#include <slint-platform.h>
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
|
|
||||||
add_executable(platform_qt main.cpp)
|
add_executable(platform_qt main.cpp)
|
||||||
target_link_libraries(platform_qt PRIVATE Slint::Slint Qt::Gui Qt::Widgets Qt::GuiPrivate)
|
target_link_libraries(platform_qt PRIVATE Slint::Slint Qt::Gui Qt::Widgets Qt::GuiPrivate)
|
||||||
slint_target_sources(platform_qt appwindow.slint)
|
slint_target_sources(platform_qt app-window.slint)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
#include "appwindow.h"
|
#include "app-window.h"
|
||||||
|
|
||||||
#include <slint-platform.h>
|
#include <slint-platform.h>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue