Hi everybody,
I have been frustrated due to a problem I could not solve. Hope you can help me. I could not find a source which would make be able to overcome it.
I have created a class which inherits QTreeWidgetItem. I want to implement custom signals and slots. When I do that I am receiving following error.
Class declarations lacks Q_OBJECT macro.
Class declarations lacks Q_OBJECT macro.
To copy to clipboard, switch view to plain text mode
As far as I know the QTreeWidgetItem class inherits QWidget which inherits QObject so Q_OBJECT macro should not be used in my class. Just out of curiosity i added Q_OBJECT macro too see what happens and I had lots of C2440, C2039, C2664, C2665, etc.
Somehow I am not able to see available signals and slots on my class when I type connect function somewhere else. I also cannot use connect function inside my class since QObject is not related to my class.
Here is my class
#ifndef ETREEWIDGETITEM_H
#define ETREEWIDGETITEM_H
#include <QTreeWidgetItem>
#include "en.h"
{
public:
explicit ETreeWidgetItem
(En
&en,
QTreeWidget *parent
=0);
explicit ETreeWidgetItem
(En
&en,
QTreeWidgetItem *parent,
int type
= Type
);
void updateText(void);
void clearChildren(void);
En en;
signals:
void enHasChangedSignal();
public slots:
void enHasChanged();
};
#endif
#ifndef ETREEWIDGETITEM_H
#define ETREEWIDGETITEM_H
#include <QTreeWidgetItem>
#include "en.h"
class ETreeWidgetItem : public QTreeWidgetItem
{
public:
explicit ETreeWidgetItem(En &en, QTreeWidget *parent=0);
explicit ETreeWidgetItem(En &en, QTreeWidgetItem *parent, int type = Type);
void updateText(void);
void clearChildren(void);
En en;
signals:
void enHasChangedSignal();
public slots:
void enHasChanged();
};
#endif
To copy to clipboard, switch view to plain text mode
could anyone help me about it? Thanks a lot in advance.
Bookmarks