[SOLVED]textEdit. Different colors for different lines/strings?



  • Im just trying to figure out,
    how can i set different colors and different front styles
    for different lines or basically for different strings in QTextEdit or QTextBrowser

    If I use the designer its easy for written text, but without it just cant do it.

    here is what I mean

    http://photouploads.com/images/untitlawa.jpg

    i can change the color for everything
    @ui.textEdit->setTextColor(11000);@

    but this is not what Im looking for.

    has someone an idea?



  • Hi!

    Use html for text styling.

    Wrap your text in span and add css style to it.
    example:
    @<span sty le="color: red">Youre text goest here. <b>You can make it bold</b><i> italic</i> or <b><i>both</i></b></span>@

    Use this when using ui->textEdit->append();



  • hi thanks for your reply but hmm

    after many tries...
    I finally made something, that's almost what I want.

    if you just add html style infront of your text/strings/arrays whasotevever
    it automatically convert it.

    for bold you just have do add @<b></b>@

    @key_storage[10000] = "<b>Film Titel Original: </b> "; @

    and if someone else read my other postings, its working as i want.

    It just little surprise me, that the @"\n" //new line command losts its effect after using one html code@

    so I have to replace that with <br>.

    but okay


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.