QTableWidgetItem Class text = data(Qt::DisplayRole).toString()
-
I found in some book the statement that the text property of QTableWidgetItem Class is equivalent to calling data(Qt::DisplayRole).toString(). My question is about assistant: how do I check the statement using assistant? I found no explanations of text and roles in QTableWidgetItem Class and no connection to Qt::DisplayRole. Should I expect that many parts of assistant can not be understood regardless how carefully they are read? I mean, some classes are not completely explained in the documentation?
-
the doc page of the QTableWidgetItem class has a reference to this "page":http://qt-project.org/doc/qt-4.8/model-view-programming.html which gives an overview of the concept in Qt.
To come back to your question:
QTableWidgetItem is a helper class which does most of the work for you. But it builds upon also builds upon a "model":http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html.
It's "::data()":http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#data method should give you more clearness what the values mean. -
Thank you for your answer. I did not know that the concept of role is part of the model/view model. Now everything is clear.
[quote author="raven-worx" date="1367068601"]the doc page of the QTableWidgetItem class has a reference to this "page":http://qt-project.org/doc/qt-4.8/model-view-programming.html which gives an overview of the concept in Qt.
To come back to your question:
QTableWidgetItem is a helper class which does most of the work for you. But it builds upon also builds upon a "model":http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html.
It's "::data()":http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#data method should give you more clearness what the values mean. [/quote]