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.
main.cpp
widget.cpp
widget.h
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:
Qt Code:
Q_OBJECT QTextEdit *t; QVBoxLayout *_v; QString *str; public: MainWidget(); ~MainWidget(); public slots: *s = text->toPlainText(); } };To copy to clipboard, switch view to plain text mode
Bookmarks