mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +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
|
@ -9,7 +9,7 @@ endif()
|
|||
|
||||
add_executable(memory_tutorial_initial main_initial.cpp)
|
||||
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)
|
||||
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
|
||||
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
|
||||
:language: slint,no-preview
|
||||
: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
|
||||
:language: slint,no-preview
|
||||
|
|
|
@ -36,12 +36,12 @@ Replace the content of `src/main.cpp` with the following:
|
|||
:::
|
||||
|
||||
Also in `CMakeLists.txt` the line
|
||||
`slint_target_sources(my_application ui/appwindow.slint)` is a Slint function used to
|
||||
add the `appwindow.slint` file to the target.
|
||||
`slint_target_sources(my_application ui/app-window.slint)` is a Slint function used to
|
||||
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
|
||||
: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.
|
||||
|
||||
Replace the contents of `ui/appwindow.slint` with the following:
|
||||
Replace the contents of `ui/app-window.slint` with the following:
|
||||
|
||||
:::{literalinclude} memory.slint
|
||||
: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
|
||||
:language: slint,no-preview
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// ANCHOR: main
|
||||
// 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)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// main.js
|
||||
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();
|
||||
await mainWindow.run();
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// ANCHOR: main
|
||||
// main.js
|
||||
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 initial_tiles = mainWindow.memory_tiles;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// ANCHOR: main_window
|
||||
// appwindow.slint
|
||||
// app-window.slint
|
||||
export component MainWindow inherits Window {
|
||||
Text {
|
||||
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
|
||||
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
|
||||
: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.
|
||||
|
||||
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
|
||||
[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
|
||||
_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
|
||||
:language: slint,no-preview
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue