I am currently trying to complete a project using Qt4 and C++. I am using buttons to switch between states. While trying to connect the buttons’ clicked() signals to the textEdit to display the relevant state, I got stuck on an error:
Object::connect No such slot
QTextEdit::append(“move state”)
Object::connect No such slot
QTextEdit::append(“link state”)
Only, QTextEdit definitely has an append(QString) slot.
Any ideas?
Some code samples:
QPushButton *move = new QPushButton("Move");
connect(move, SIGNAL(clicked()), textEdit, SLOT(append("move state")));
You can’t pass in an argument (literally) to the append() slot when making a signal to slot connection.
You refer to it like a method signature:
If you need the textbox to append the words “move state” every time that button is clicked, then you should define your own slot that will do the append.