Question

I have a QTabWidget parented by a QMainWindow that manages QTextEdit widgets.

I'd like to know when content was changed in one the tabs and to know which one. I've been trying to google a solution but after many changed lines in my code and architecture changes of my class.

My last try was:

QTextEdit* curr_text_edit = /*slots were used to get this pointer*/;
connect(curr_text_edit, SIGNAL(textChanged()), this, SLOT(marquerChangement()));

but the slot "marquerChangement()" is never called. Any ideas?

Was it helpful?

Solution

If marquerChangement() is not being called, there can only be two possible reasons. First is that the QTextEdit represented by curr_text_edit never emits a signal (in other words, perhaps you've got the wrong QTextEdit?).

Another possibility is that your call to connect failed. This signal/slot connection is done at runtime, not compile time. Failures here typically just get printed to stdout, and then the program goes happily on its way. Check your application output to see if you get a message about a signal or a slot not found.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top