Results 1 to 10 of 10

Thread: Change colour of QString

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Change colour of QString

    But why doesn't the HTML code work with spaces?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Change colour of QString

    Because HTML trimms multiple whitespaces into one. If you want to keep them, transform each of the multiple spaces to " " (keep single ones as they are).

  3. #3
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Change colour of QString

    Thanks for all the help so far, but now I'm stuck. I get a crash when the program starts.
    The problem seems to be with the creation of the red/green part.
    The point of the program is to press enter, get a random text, and directly start writing the same thing (marked red/green if wrong/right).

    I attach a tgz with the code.
    It's produced with dev-c++ in windows.
    Attached Files Attached Files
    Last edited by Morea; 10th February 2006 at 21:30.

  4. #4
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Change colour of QString

    Ah, is it perhaps the infinite loop I get with all the textChanged signals that are emitted, and the KollaText() slot that receives it and then again emits a textChanged signal..
    It might be! But I doesn't seem possible to change to a keypressed event or something like that. Any ideas, or should I just use the code that cesar sent earlier?
    Last edited by Morea; 10th February 2006 at 21:39.

  5. #5
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Change colour of QString

    Now it works fine! I strongly recomend anyone using Dev-C++ to rebuild everything once in a while, otherwise you might have parts that is not properly updated.

Similar Threads

  1. Custom Model Advice Requested
    By mclark in forum Qt Programming
    Replies: 3
    Last Post: 18th September 2008, 16:26
  2. Convert from iso-8859-1 to... Something else :-)
    By Nyphel in forum Qt Programming
    Replies: 4
    Last Post: 7th March 2007, 17:59
  3. Replies: 2
    Last Post: 12th October 2006, 09:17
  4. Converting QString to unsigned char
    By salston in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2006, 22:10

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
  •  
Qt is a trademark of The Qt Company.