View Full Version : send the text QCheckBox to QTextEdit

18th November 2011, 19:38
It is possible when you click a QCheckBox the text () is sent to a QTextEdit?

18th November 2011, 22:44
Yes, you can program anything you like in a slot connected to the clicked() or stateChanged() signal.

19th November 2011, 12:03
I was not plain in my question. Sorry my English.
It would be something like:

connect(QCheckBox, SIGNAL(clicked()), QTextEdit, SLOT(insertHtml(QCheckBox->text())));

Clicking on QCheckBox it sends your text() to QTextEdit.
You can do this without derive the class QTextEdit to create a new SLOT?

19th November 2011, 12:29
No, it's impossible, because signatures of signal and slot are not match. (see http://doc.qt.nokia.com/stable/signalsandslots.html - fifth paragraph)

The signature of a signal must match the signature of the receiving slot

You have to define your own slot with signature (void) or (), then connect clicked() signal to this slot. Inside you slot you can create any action.