forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Printer demo: the ink data now comes from the native code
- Loading branch information
Showing
3 changed files
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,11 +8,23 @@ | |
Please contact [email protected] for more information. | ||
LICENSE END */ | ||
#include "printerdemo.h" | ||
#include <iostream> | ||
|
||
struct InkLevelModel : sixtyfps::Model { | ||
int count() const override { return m_data.size(); } | ||
const void *get(int i) const override { return &m_data[i]; } | ||
|
||
/// FIXME: Ideally it should be a better type in the generated code | ||
using InkData = std::tuple<sixtyfps::Color, float>; | ||
std::vector<InkData> m_data = { | ||
{ sixtyfps::Color(0xffffff00), 0.9 }, | ||
{ sixtyfps::Color(0xff00ffff), 0.5 }, | ||
{ sixtyfps::Color(0xffff00ff), 0.8 }, | ||
{ sixtyfps::Color(0xff000000), 0.1 }}; | ||
}; | ||
|
||
int main() | ||
{ | ||
static MainWindow printer_demo; | ||
|
||
printer_demo.set_ink_levels(std::make_shared<InkLevelModel>()); | ||
printer_demo.run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters