mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-13 22:06:29 +00:00
C++ tutorial: Remove inline code for the memory tile chapter
This commit is contained in:
parent
031acd77d3
commit
57d25c6d9b
2 changed files with 27 additions and 15 deletions
26
docs/tutorial/cpp/src/memory_tile.60
Normal file
26
docs/tutorial/cpp/src/memory_tile.60
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* LICENSE BEGIN
|
||||
This file is part of the SixtyFPS Project -- https://sixtyfps.io
|
||||
Copyright (c) 2020 Olivier Goffart <olivier.goffart@sixtyfps.io>
|
||||
Copyright (c) 2020 Simon Hausmann <simon.hausmann@sixtyfps.io>
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
This file is also available under commercial licensing terms.
|
||||
Please contact info@sixtyfps.io for more information.
|
||||
LICENSE END */
|
||||
// ANCHOR: main_window
|
||||
MemoryTile := Rectangle {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
background: #3960D5;
|
||||
|
||||
Image {
|
||||
source: @image-url("icons/bus.png");
|
||||
width: parent.width;
|
||||
height: parent.height;
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow := Window {
|
||||
MemoryTile {}
|
||||
}
|
||||
// ANCHOR_END: main_window
|
|
@ -10,21 +10,7 @@ mixing values with different units attached to them.
|
|||
We copy the following code into the `memory.60` file:
|
||||
|
||||
```60
|
||||
MemoryTile := Rectangle {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
background: #3960D5;
|
||||
|
||||
Image {
|
||||
source: @image-url("icons/bus.png");
|
||||
width: parent.width;
|
||||
height: parent.height;
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow := Window {
|
||||
MemoryTile {}
|
||||
}
|
||||
{{#include memory_tile.60:main_window}}
|
||||
```
|
||||
|
||||
Inside the <span class="hljs-built_in">Rectangle</span> we place an <span class="hljs-built_in">Image</span> element that
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue