icx
17th August 2010, 21:13
I'm trying to make a really simple application: while I'm writing in this QTextEdit, a QLabel need to be constantly updated and show how many characters the users can still write (similar to Twitter). The Clear button works well, but I can't make a slot to change the text of the QLabel as the user is writing.
I've attached below the sources.
5083
5084
5085
I know that in widget.h I should have used the Q_OBJECT macro, but when I use it I get some "undefined reference to `vtable for MainWidget`" errors. So this following code won't work:
class MainWidget : public QWidget{
Q_OBJECT
QTextEdit *t;
QVBoxLayout *_v;
QString *str;
public:
MainWidget();
~MainWidget();
public slots:
void nothing(QString *s, QTextEdit *text){
*s = text->toPlainText();
}
};
I've attached below the sources.
5083
5084
5085
I know that in widget.h I should have used the Q_OBJECT macro, but when I use it I get some "undefined reference to `vtable for MainWidget`" errors. So this following code won't work:
class MainWidget : public QWidget{
Q_OBJECT
QTextEdit *t;
QVBoxLayout *_v;
QString *str;
public:
MainWidget();
~MainWidget();
public slots:
void nothing(QString *s, QTextEdit *text){
*s = text->toPlainText();
}
};