Not sure why, but the QTextEdit textChanged() signal seems to be happening infinitely many times for me..is there some caveat to using this signal I didn't see in the docs somewhere?

Basically I'm just trying to implement a poor man's terminal. It works, but the printf's I've thrown in along the way get printed many many times..the way I want to implement the terminal is like this: when text is changed in the terminal, it signals the textChanged signal, which is connected to the getCommand slot. getCommand sends the command to the serialComms method, which does some processing, then emits the serial signal with the processed output string as its parameter. finally, the output string is printed on the terminal. I'm pretty sure I went overboard on the signal generation, but this should still work, according to my research on QTextEdit

my code is very messy and spread out across many files, so sorry if there's any confusion.

ctor of the class that holds the 'terminal':
Qt Code:
  1. terminal = new QTextEdit();
  2. terminal -> setText(">>");
  3. terminal -> setReadOnly(FALSE);
  4.  
  5. connect(terminal, SIGNAL(textChanged()), this, SLOT(getCommand()));
To copy to clipboard, switch view to plain text mode 

method for getting command from QTextEdit:
Qt Code:
  1. void advancedTab::getCommand() {
  2. QString text = terminal -> toPlainText();
  3. QByteArray ba = text.toLocal8Bit();
  4. char *message = ba.data();
  5.  
  6.  
  7. printf("emitting signal inputComm.\n");
  8.  
  9. emit inputComm(message);
  10. }
To copy to clipboard, switch view to plain text mode 

method for printing out command on 'terminal':
Qt Code:
  1. void advancedTab::outputComm ( char* rawMessage) {
  2. QString output = QString(rawMessage);
  3.  
  4. terminal -> setPlainText(rawMessage);
  5. printf("MESSAGE GOTTEN!\n");
  6. }
To copy to clipboard, switch view to plain text mode 

method for processing command:
Qt Code:
  1. QString serialComms(char *stringy) {
  2. //processing stuff
  3. }
To copy to clipboard, switch view to plain text mode 

main method:
Qt Code:
  1. //ops is an instance of some other class, in which the serialComms method lies
  2. //advanced is an instance of the class that houses the terminal
  3.  
  4. QObject::connect (&ops, SIGNAL(serial(char*)), advanced, SLOT(outputComm(char*)));
  5. QObject::connect(advanced, SIGNAL(inputComm(char*)), &ops, SLOT(serialComms(char *)));
To copy to clipboard, switch view to plain text mode 

note: this happened before to me, when I was just trying out a simple example with QTextEdit. This is why I think I may be missing some obvious detail about textChanged().
Also, when commands are typed into the terminal carefully and no key is pressed forever, which would (I think) call the signal too many times.