mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 22:31:14 +00:00

This removes the need to manually register fonts. This is initially applied to the printer demo, but the other demos and removal of the public manual registration API will come in follow-up commits.
30 lines
1.2 KiB
C++
30 lines
1.2 KiB
C++
/* 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 */
|
|
#include "printerdemo.h"
|
|
|
|
struct InkLevelModel : sixtyfps::Model<InkLevel>
|
|
{
|
|
int row_count() const override { return m_data.size(); }
|
|
InkLevel row_data(int i) const override { return m_data[i]; }
|
|
|
|
std::vector<InkLevel> m_data = { { sixtyfps::Color::from_rgb_uint8(255, 255, 0), 0.9 },
|
|
{ sixtyfps::Color::from_rgb_uint8(0, 255, 255), 0.5 },
|
|
{ sixtyfps::Color::from_rgb_uint8(255, 0, 255), 0.8 },
|
|
{ sixtyfps::Color::from_rgb_uint8(0, 0, 0), 0.1 } };
|
|
};
|
|
|
|
int main()
|
|
{
|
|
auto printer_demo = MainWindow::create();
|
|
printer_demo->set_ink_levels(std::make_shared<InkLevelModel>());
|
|
printer_demo->on_quit([] { std::exit(0); });
|
|
|
|
printer_demo->run();
|
|
}
|