I wonder is the method QTableWidget::setModel reimplemented as a private? In Qt Reference Documentation it seems to be public?
I wonder is the method QTableWidget::setModel reimplemented as a private? In Qt Reference Documentation it seems to be public?
wha is version of Qt? I didn't find setModel as public in docs in 4.4.3.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
what is version of Qt? I didn't find setModel as public in 4.4.3 docs.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
YES !I wonder is the method QTableWidget::setModel reimplemented as a private?
In docs, you are seeing QAbstractItemView::setModel .
QTableWidget manages its own internal model. If you want to use model, use it with QTableView
yup, setModel() can be used only with item view classes like QListView, QTableView, QTreeView etc. For QTableWidget, you can't play with the model directly.
My GNU/Linux Blog:
http://funwithlinux.blogspot.com
But it not result from docs. This method exists in list of inherited method.QTableWidget manages its own internal model. If you want to use model, use it with QTableView
Thanks!
Well, you can refer in source code for QTableWidget.
And you are right, setModel shows in list of all methods for QTableWidget. May be its a mistake.
It is a method of the base class of QTableWidget so why shouldn't it be listed there? The documentation clearly says it's a list of all methods including inherited ones. It's just reimplemented as private so that you don't have a stupid idea of calling it and segfaulting your application on the first reference to the widget.
Yes, but documentation shows only public method, and also should show inherited public method.The documentation clearly says it's a list of all methods including inherited ones.
Where it is written?It's just reimplemented as private so
For you knowledge, you can't compile program where you use virtual method reimplemented as private!you don't have a stupid idea of calling it and segfaulting your application on the first reference to the widget.
And I have a favour to ask of you Can you be more polite?
When you access the "all method" page, all methods are shown. When you access the base documentation page, only those declared in this particular class are mentioned. SetModel() is declared in the base class and specifically hidden in the subclass. As you see no private methods are mentioned in any docs.
Here:Where it is written?
"If you want a table that uses your own data model you should use QTableView rather than this class."
That's the whole idea of it being redeclared as private. If it remained public you could have compiled it and thus wrecked the application without any possiblility of knowing why and you would have blamed Qt code for it as the debugger would clearly indicate the crash was caused by Qt code and not yours.For you knowledge, you can't compile program where you use virtual method reimplemented as private!
Where have I been impolite? By using the word "stupid"? I don't think there is anything impolite there, I do stupid things as well, there is nothing wrong in making mistakes and calling ones actions such, especially if you learn from them. Please note I didn't call you stupid, I said the method is private to stop stupid ideas of using it where it is not appropriate. You can't imagine what people are trying to do with Qt code If your ideas felt offended by my words, I appologize to them.And I have a favour to ask of you Can you be more polite?
But I think, it would be more comfortable if the method public in parent not available in children was mentioned in docs.
From QTableWidget docs, right from the beginning of the detailed description:
The QTableWidget class provides an item-based table view with a default model.
...
If you want a table that uses your own data model you should use QTableView rather than this class.
...
J-P Nurmi
Bookmarks