Results 1 to 2 of 2

Thread: print one part of a string in blue

  1. #1
    Join Date
    Jan 2017
    Posts
    54
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default print one part of a string in blue

    I am trying to make one word (filestatus) in the string below show in blue. I have:
    Qt Code:
    1. filestatus = "MARRIED, JOINT"
    2.  
    3. self.ui.title.setText(str("My Tax Info Based on a Filing Status of: " + filestatus.format('color=blue')))
    To copy to clipboard, switch view to plain text mode 

    I get no errors but it does not work

    thanks

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,229
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: print one part of a string in blue

    Try formatting your text using Rich Text Format HTML (RTF). You'll have to use CSS to insert the color attribute into the HTML string.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Pass string to print slot (QPrintPreviewDialog)
    By Rafaelpsmed in forum Newbie
    Replies: 1
    Last Post: 11th February 2015, 09:04
  2. Replies: 3
    Last Post: 8th June 2011, 07:36
  3. how to print string??
    By pratik in forum Qt Programming
    Replies: 7
    Last Post: 25th December 2010, 17:38
  4. print text in the lineEdit control from string
    By rk0747 in forum Qt Programming
    Replies: 2
    Last Post: 6th February 2010, 09:48
  5. how to get a part of the string
    By probine in forum Newbie
    Replies: 2
    Last Post: 4th December 2006, 15:37

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.