mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-12 05:16:48 +00:00
C++ tutorial: Remove use of xml entities
This commit is contained in:
parent
57d25c6d9b
commit
6e4da0c14e
1 changed files with 5 additions and 5 deletions
|
@ -13,22 +13,22 @@ We modify the main function like so:
|
|||
```cpp
|
||||
// main.cpp
|
||||
#include "memory.h"
|
||||
#include <random> // Added
|
||||
#include <random> // Added
|
||||
|
||||
int main()
|
||||
{
|
||||
auto main_window = MainWindow::create();
|
||||
auto old_tiles = main_window->get_memory_tiles();
|
||||
std::vector<TileData> new_tiles;
|
||||
std::vector<TileData> new_tiles;
|
||||
new_tiles.reserve(old_tiles->row_count() * 2);
|
||||
for (int i = 0; i < old_tiles->row_count(); ++i) {
|
||||
for (int i = 0; i < old_tiles->row_count(); ++i) {
|
||||
new_tiles.push_back(old_tiles->row_data(i));
|
||||
new_tiles.push_back(old_tiles->row_data(i));
|
||||
}
|
||||
std::default_random_engine rng{};
|
||||
std::shuffle(new_tiles.begin(), new_tiles.end(), rng);
|
||||
auto tiles_model = std::make_shared<
|
||||
sixtyfps::VectorModel<TileData>>(new_tiles);
|
||||
auto tiles_model = std::make_shared<
|
||||
sixtyfps::VectorModel<TileData>>(new_tiles);
|
||||
main_window->set_memory_tiles(tiles_model);
|
||||
|
||||
main_window->run();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue