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:
{
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);
};
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);
};
To copy to clipboard, switch view to plain text mode
I'm getting errors that:
error: invalid static_cast from type 'QObject*' to type 'MyStringList*'
error: invalid static_cast from type 'QObject*' to type 'MyStringList*'
To copy to clipboard, switch view to plain text mode
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 !
Bookmarks