aLiNuSh
2nd April 2007, 21:04
Hi,
I have a QTreeView that uses a subclassed QStandardItemModel model.
The treeview should keep an user list for a chat program.
What I want to do is to subclass QStandardItem in order to make user insertion/deletion/hiding easier but I'm not sure how should I reimplement the QStandardItem * QStandardItem::clone () const [virtual] (http://doc.trolltech.com/4.2/qstandarditem.html#clone) method. I know that I need to do that in order to call void QStandardItemModel::setItemPrototype ( const QStandardItem * item ) (http://doc.trolltech.com/4.2/qstandarditemmodel.html#setItemPrototype) in the model.
Here's what I was thinking the derived class should look like:
class MyQStandardItem : public QStandardItem {
private:
bool online;
/* some other flags */
public:
/* default constructors and overloaded ones */
bool isOnline () const { return online; }
/* other functions */
};
Considering I'm not using pointers as data members should I worry about clone () ?
I'm really confused on this one.
Thanks!
I have a QTreeView that uses a subclassed QStandardItemModel model.
The treeview should keep an user list for a chat program.
What I want to do is to subclass QStandardItem in order to make user insertion/deletion/hiding easier but I'm not sure how should I reimplement the QStandardItem * QStandardItem::clone () const [virtual] (http://doc.trolltech.com/4.2/qstandarditem.html#clone) method. I know that I need to do that in order to call void QStandardItemModel::setItemPrototype ( const QStandardItem * item ) (http://doc.trolltech.com/4.2/qstandarditemmodel.html#setItemPrototype) in the model.
Here's what I was thinking the derived class should look like:
class MyQStandardItem : public QStandardItem {
private:
bool online;
/* some other flags */
public:
/* default constructors and overloaded ones */
bool isOnline () const { return online; }
/* other functions */
};
Considering I'm not using pointers as data members should I worry about clone () ?
I'm really confused on this one.
Thanks!