mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-20 03:50:00 +00:00
Make the Model/Repeater type safe in C++
This commit is contained in:
parent
4c07fbfb3d
commit
f6c8ea0f20
3 changed files with 58 additions and 48 deletions
|
|
@ -9,12 +9,13 @@
|
|||
LICENSE END */
|
||||
#include "printerdemo.h"
|
||||
|
||||
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>;
|
||||
|
||||
struct InkLevelModel : sixtyfps::Model<InkData> {
|
||||
int count() const override { return m_data.size(); }
|
||||
const InkData 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 },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue