Because here you don't care that it is a proxy, you just want your original model index back. It's a shortcut over using the activated() signal that carries a string and finding that string in your model. So the same functionality could be obtained without qobject_cast with one or two additional lines of code.
This is not a need where you want to use the completionModel for anything. You just want the original model index back.what difference does it make regarding such uses we need?
No, you didn't.you wanted an example case and I showed you one clear, simple, standard, and completely official one.
So file a bug report to Qt Software. They won't change the API because it would break compatibility with existing applications but they might say "you're right, it should have been a QAbstractProxyModel".I think its clear enough to everyone.
I don't have a reponsibility to prove anything. You should always use the most general interface to an object and that's a rule of a thumb in OO Software Engineering.so you have the responsibility to prove any further claim you make here.
I take it that in your implementation of Qt the source of QCompleter::setModel() doesn't contain a line:base model may be any model that can be potentially complex, costly to process, harder to work with, etc.
but regarding auto completion's suggestions and user's choice among them, many times we need only simple features without any further/external dependencies,
so a simple and shortened model that contains only the relevant items is the best to work with. that is what completionModel gives to us (a simple list model).
which sets the source model of the completion model to the model you pass to it. So sorry, but there is no "simple list model" here. You have all the drawbacks of your original model plus an additional layer that returns the currently used list model to the user. And still you shouldn't care what it does. To you this is just "some" model that can be completely unrelated to your base model, especially if you subclass QCompleter and reimplement setModel - there might not be any proxy there anymore.Qt Code:
d->proxy->setSourceModel(mode);To copy to clipboard, switch view to plain text mode
Examples often use hacks or simplifications. This is one of them.maybe I don't understand your meaning clearly.
can you explain more?
clearly, some feature of the example will not work without that functionality.
Bookmarks