tags:

views:

137

answers:

1

QTableWidget::setItemPrototype says following.

"The table widget will use the item prototype clone function when it needs to create a new table item. For example when the user is editing in an empty cell. This is useful when you have a QTableWidgetItem subclass and want to make sure that QTableWidget creates instances of your subclass."

How does this actually work as you can pass any of the QTableWidgetItem subclass pointer to setItemPrototype and at run time there is no way you can get the size of an object having just pointer to it?

+3  A: 

QTableWidgetItem::clone() is a virtual member function and has to be reimplemented by subclasses of QTableWidget.
Thus, when clone() is called, the implementation of clone() in the subclass is getting invoked, and in the subclass, the correct type is of course known.

Georg Fritzsche