Increasing usage for C++ new operators based on data model indexes?
-
Does your software development experience include the usage of
QAbstractItemModel
?My knowledge is growing also in this software area.
… he's firmly in the top tier of developers contributing on this forum.
This is fine.
Our experiences are varying in several areas, don't they?
Understanding difficulties can happen then when someone (like me) dares to present special development ideas.
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
Understanding difficulties can happen then when someone (like me) dares to present special development ideas.
Sorry if it came out wrongly before, we are not against new development ideas at all, not on this forum and not in the Qt Project.
I think what is clear from the discussion above is that nobody here can think of an elegant, efficient, functional and safe way to introduce the concept you suggest in the
QAbstractItemModel
(or any of its subclasses) interface.
Having said that, you are correct by sayingOur experiences are varying in several areas, don't they?
So our point is, if you have an idea for an implementation then please go ahead and propose it to the community. I'd be very happy to participate in the review process of such an innovation as well as I might end up learning something new (punt not intended)
-
The project maintainers are seasoned (15-20 years experience) developers and are familiar with all aspects of standard C++ (especially its oldest parts like placement new).
It's safe to assume a total mastery of the placement new concept by people reviewing code, don't worry
-
It's safe to assume a total mastery of the placement new concept by people reviewing code, don't worry
This information is very promising.
- Unfortunately, I could not extract corresponding indications of understanding for my proposal so far.
- How would you like to clarify a possible mapping from data model indexes to pointers further?
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
How would you like to clarify a possible mapping from data model indexes to pointers further?
That's what we are asking you to propose.
We can't think of a way unfortunately -
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
Unfortunately, I could not extract corresponding indications of understanding for my proposal so far.
Because you have not proposed anything. Show an API and it will be judged. Show a usage example of that API and it will help us know if the API is convenient. Measure with benchmark and we'll know if it improves performance.
Without concrete foundations, any idea can be argued endlessly without result.
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
We can't think of a way unfortunately
Why do you stumble on limitations in your imaginations here?
I guess that will depend on this basic clarification:
Are you familiar with the usage of placement new? -
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
Why do you stumble on limitations in your imaginations here?
Honestly I just think I'm not smart enough to get into this. It wouldn't be the first time. On the other hand I'd be really happy to see how it could be implemented so I could learn something new
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
Can this application programming interface be just “placement new” (which got the parameters “row” and “column” passed)?
See, I struggle already, what would the return type be? (
void*
is a bit useless...) -
I still can't see a way forward.
The simplest example would probably be QStringListModel. Could you help me understand how the placement new operator would work in that case? -
Yes,
I find this answer confusing in combination with the subsequent information.
I can't see a safe way to use that pointer though
You are used to the application of ordinary pointers.
auto x(new my_ball);
How many ball variants would you manage by your QStringListModel example?
-
of, let's say you have a
new
that takes therow
as anint
parameter (QStringListModel
has only 1 column).I imagine that the implementation would check that the argument is within the range (
row>=0 && row < lst.size()
) and then return something like&lst[row]
(which is of typeQString*
).Now we are back to the point we discussed here. How can we make sure that if the
QString
is modified then thedataChanged
signal is sent?