Skip to content

Conversation

@trisyoungs
Copy link
Member

@rprospero here is the stuff I came up with when looking into custom model interfaces. Still uses a template class sitting alongside the data (here focussing just on std::vector and tables) but the template derives from a concrete base class which the Qt model leverages to do all the work.

Thoughts on how any of this (if any!) can work with your own approach welcome!

@trisyoungs trisyoungs requested a review from rprospero June 19, 2024 12:47
Copy link
Contributor

@rprospero rprospero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a good framework, but I had some thoughts on how we could get more type safety and reusability from the code.

};

// Index / Column ID, Name / Column Title, Data Type, ReadOnly?
using DataItemProperty = std::tuple<int, std::string, PropertyType, Flags<PropertyFlag>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this might be a bit clearer as a struct. That would allow us to do diProp.index instead of std::get<0>(diProp). Of course, we could still overload std::get if we really needed to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, for sure! I was using the std::tuple just to quickly spin up a working example, although all the std::get<> pollution quickly became rather tiresome. struct or class definitely the way to go.

@trisyoungs trisyoungs force-pushed the 1912-create-delete-parameters branch from 6b55320 to 84f684c Compare July 9, 2024 11:01
@trisyoungs trisyoungs added this to the Release 2.0 milestone Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants