Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT Custom model interface #1917

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

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!

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.

src/keywords/expressionVariableVector.h Show resolved Hide resolved
src/keywords/expressionVariableVector.h Show resolved Hide resolved
src/keywords/expressionVariableVector.h Show resolved Hide resolved
};

// 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.

2 participants