avanta27
8th September 2012, 02:33
My first post here!
I am a newbie to Qt and quite newbie to C++. What I am trying to do is to subclass QStringList, but I don't make it. This is what I have tried out so far:
class MyStringList : public QStringList
{
Q_OBJECT
public:
MyStringList();
protected:
int numbers_pos[100];
public Q_SLOTS:
void set_number(int pos, int line_number);
int get_number(int pos);
};
I'm getting errors that:
error: invalid static_cast from type 'QObject*' to type 'MyStringList*'
and I am quite sure that it has to do with the Q_OBJECT macro. However, it does not let me remove it.
Any guesses?
Thanks a lot !
I am a newbie to Qt and quite newbie to C++. What I am trying to do is to subclass QStringList, but I don't make it. This is what I have tried out so far:
class MyStringList : public QStringList
{
Q_OBJECT
public:
MyStringList();
protected:
int numbers_pos[100];
public Q_SLOTS:
void set_number(int pos, int line_number);
int get_number(int pos);
};
I'm getting errors that:
error: invalid static_cast from type 'QObject*' to type 'MyStringList*'
and I am quite sure that it has to do with the Q_OBJECT macro. However, it does not let me remove it.
Any guesses?
Thanks a lot !