Subclassing QTreeWidgetItem
-
Hello can anyoune explain me how to subclass QTreeWidgetIem? Please help me.
Here is the compiler error.
@
/home/serge/Desktop/build-openhomedesigner-Desktop-Debug/moc_treewidgetitem.cpp:52: error: 'staticMetaObject' is not a member of 'QTreeWidgetItem'
{ &QTreeWidgetItem::staticMetaObject, qt_meta_stringdata_TreeWidgetItem,
^
@Here is my header and my source file.
@
#ifndef TREEWIDGETITEM_H
#define TREEWIDGETITEM_H#include <QtCore>
#include <QtGui>class TreeWidgetItem : public QTreeWidgetItem{
Q_OBJECTpublic:
explicit TreeWidgetItem(QTreeWidget *parent = 0, int type = Type);
TreeWidgetItem(QTreeWidgetItem *parent = 0, int type = Type);protected:
private:
public slots:
protected slots:
private slots:
signals:
};#endif // TREEWIDGETITEM_H
@@
#include "treewidgetitem.h"TreeWidgetItem::TreeWidgetItem(QTreeWidget *parent, int type) : QTreeWidgetItem(parent, type){
}TreeWidgetItem::TreeWidgetItem(QTreeWidgetItem *parent, int type) : QTreeWidgetItem(parent, type){
}
@I am subclassing every other Widget without problems, I don't know where my error is...
-
Hi,
Simple: QTreeWidgetItem is not a QObject
-
Yeah and how do I reimplement it? Not very useful.
-
Either:
- Don't put QObject related stuff in your sub-class
- Inherit from both QTreeWidgetItem and QObject, which generally is a bad idea if you plan to have many data in your QTreeWidget. However if you want to do it anyway, the first class that must be inherited is QObject.