I have a Python application whereby I pass an object through to a QThread, where a signal is emitted back to the UI in a loop.
I am wondering if it is possible to emit a signal back to the main loop, and amend the font color depending on the returned value?
For example:
In the QThread Class...
if self.status != "True":
# Set State
state = "Failed"
result = "Fail"
reason = "I/O Failure"
# Emit State
self.state.emit(state)
self.result.emit(result)
self.reason.emit(reason)
sleep(1)
else:
print("All is Good")
From here, if the result is Fail, then I would like to amend the color to Red or color the Background of the QTableWidgetItem Cell a light red or similar, previously, I have done this as such...
status.setForeground(QtGui.QBrush(QtGui.QColor('red')))
status.setBackground(QtGui.QBrush(QtGui.QColor(255, 204, 204)))
font = QFont(results.status, weight=QFont.Bold)
But this was on the original QTableWidgetItem creation, and not from within the Thread, is there a way to achieve this?
Thanks in advance!