Dynamic change of font color in QtSerialPort-Terminal-Example
ddurix last edited by
I'm trying to change color of the serial-port-input/output characters in the QtSerialPort-Terminal-Example.
My problem is that QPalette::setColor
always changes the whole displayed text, but I want different colors for keyboard input and serial output.
Is this possible?
Hi and welcome to the forums.
yes you can but you have to manipulate the structure and not the palette as that is used for all text so
its a no go. (also stylesheet)
QTextCharFormat tf = ui->plainTextEdit->currentCharFormat(); tf.setForeground(QBrush(Qt::red)); ui->plainTextEdit->setCurrentCharFormat(tf); ui->plainTextEdit->appendPlainText("test");
I think you can also use HTML.