Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Coloring the QString



  • @QString text("<FONT COLOR=red>%1</FONT>");
    text.arg(strMat);
    QDomNode text_node
    text_node.setNodeValue(text);@

    I have the above code . what i want is text color shall be red and that text value shall be decided during the run time .



  • Using HTML to color a text can work, but in a QDomNode? I don't get that. QDomNode is not for displaying...



  • My requirement is to coloring the QString then setting that color text in QDomNode .
    that is the thing i want to do in the above code .
    But i am not able to know why its not working .



  • But having a colored string in a domnode is nonsense. Color is a display property, and a QDomNode is not displayed. How do you even check if your coloring worked if you can't display it?


Log in to reply