Devoraz
12th August 2009, 09:52
i connect this in a (lets say setting.cpp), the slot is in another (lets say node.cpp)
connect(ui.EDnameTxt, SIGNAL(textChanged(QString)), Node, SLOT(setText(QString)));
but when i compile it give me this error,
1>.\settingswindow.cpp(57) : error C2275: 'Node' : illegal use of this type as an expression
1> c:\texas instruments\node.h(62) : see declaration of 'Node'
whats wrong with the declartion of my node.h???
class Node : public QGraphicsItem, public QObject
{
Q_OBJECT
public:
typedef enum{ACCESS_POINT, END_DEVICE}NODE_TYPE;
typedef struct
{
NODE_TYPE type;
int addr;
int xPos;
int yPos;
int strength;
float temp;
float voltage;
int re;
int t_time_on;
int fadeNumber;
int fadeTime;
int newNode;
int deletedNode;
}NODE_DATA;
QBrush fill[40];
Node(NetworkView *networkView);
NODE_DATA nodeData;
void addEdge(Edge *edge);
QList<Edge *> edges() const;
enum { Type = UserType + 1 };
int type() const { return Type; }
bool advance();
QRectF boundingRect() const;
QPainterPath shape() const;
void EDnamePreset();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setNodeData(int index);
void updateData(int index);
void AlertMessage();
int getElapsedTime();
void removeEdge(int childAddr = 0);
int getAddr() { return nodeData.addr; }
float getTemp() { return nodeData.temp; }
int getType() { return nodeData.type; }
void setTempUnit();
void setColor(const NODE_TYPE type);
int Node::find_active_node();
void Node::current_updateData(int index);
int timerId () const;
/*struct colors{
int alpha;
int r;
int g;
int b;
int newnodeflag;
int delnodeflag;
};
struct colors node_colors[100];*/
public slots:
void EDnameChanged(int);
void setText(const QString &newText){text = newText;}
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void timerEvent(QTimerEvent *);
// NODE_DATA nodeData;
private:
Ui_SettingsWindow ui;
QList<Edge *> edgeList;
QPointF newPos;
NetworkView *graph;
QPixmap pixmap,alpha_pix,back_pix,pixmap2,pix;
QColor nodeColor;
QColor nodeColorDark;
QColor AlertColor;
QColor AlertColorDark;
QColor DisAlertColorDark;
QColor DisAlertColor;
QFont modeFont;
QFont addrFont;
QFont tempFont;
QFont battFont;
QFont strengthFont;
QFont timeFont;
QFont end_deviceFont;
QFont keyFont;
QFont smallFont;
QFont txFont;
QTime timeStamp;
QDate dateStamp;
NodeDb *pNodeDb;
// Flag used to highlight node.
bool updated;
int updateTimerId,fade_speed,updateTimerId2,updateTime rId3;
bool celsius;
qreal arrowSize;
double alertTemp;
int alertDistance;
int edStrength;
QString nodeName;
QString EDname;
QString text;
QString EDnameText;
};
connect(ui.EDnameTxt, SIGNAL(textChanged(QString)), Node, SLOT(setText(QString)));
but when i compile it give me this error,
1>.\settingswindow.cpp(57) : error C2275: 'Node' : illegal use of this type as an expression
1> c:\texas instruments\node.h(62) : see declaration of 'Node'
whats wrong with the declartion of my node.h???
class Node : public QGraphicsItem, public QObject
{
Q_OBJECT
public:
typedef enum{ACCESS_POINT, END_DEVICE}NODE_TYPE;
typedef struct
{
NODE_TYPE type;
int addr;
int xPos;
int yPos;
int strength;
float temp;
float voltage;
int re;
int t_time_on;
int fadeNumber;
int fadeTime;
int newNode;
int deletedNode;
}NODE_DATA;
QBrush fill[40];
Node(NetworkView *networkView);
NODE_DATA nodeData;
void addEdge(Edge *edge);
QList<Edge *> edges() const;
enum { Type = UserType + 1 };
int type() const { return Type; }
bool advance();
QRectF boundingRect() const;
QPainterPath shape() const;
void EDnamePreset();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setNodeData(int index);
void updateData(int index);
void AlertMessage();
int getElapsedTime();
void removeEdge(int childAddr = 0);
int getAddr() { return nodeData.addr; }
float getTemp() { return nodeData.temp; }
int getType() { return nodeData.type; }
void setTempUnit();
void setColor(const NODE_TYPE type);
int Node::find_active_node();
void Node::current_updateData(int index);
int timerId () const;
/*struct colors{
int alpha;
int r;
int g;
int b;
int newnodeflag;
int delnodeflag;
};
struct colors node_colors[100];*/
public slots:
void EDnameChanged(int);
void setText(const QString &newText){text = newText;}
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void timerEvent(QTimerEvent *);
// NODE_DATA nodeData;
private:
Ui_SettingsWindow ui;
QList<Edge *> edgeList;
QPointF newPos;
NetworkView *graph;
QPixmap pixmap,alpha_pix,back_pix,pixmap2,pix;
QColor nodeColor;
QColor nodeColorDark;
QColor AlertColor;
QColor AlertColorDark;
QColor DisAlertColorDark;
QColor DisAlertColor;
QFont modeFont;
QFont addrFont;
QFont tempFont;
QFont battFont;
QFont strengthFont;
QFont timeFont;
QFont end_deviceFont;
QFont keyFont;
QFont smallFont;
QFont txFont;
QTime timeStamp;
QDate dateStamp;
NodeDb *pNodeDb;
// Flag used to highlight node.
bool updated;
int updateTimerId,fade_speed,updateTimerId2,updateTime rId3;
bool celsius;
qreal arrowSize;
double alertTemp;
int alertDistance;
int edStrength;
QString nodeName;
QString EDname;
QString text;
QString EDnameText;
};