Results 1 to 8 of 8

Thread: QPushButton - setText with "\n" not working

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Davao City, Philippines
    Posts
    77
    Thanks
    16
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPushButton - setText with "\n" not working

    [QUOTE=marcel;62576]Might be an encoding problem.
    Try with:
    Qt Code:
    1. QString test1(query.value(1).toString().toAscii().constData());
    To copy to clipboard, switch view to plain text mode 

    Sorry, still the same ....


  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton - setText with "\n" not working

    I think the "\" in test1 might be escaped. It is the only explanation.
    Try :
    Qt Code:
    1. int c = test1.count('\');
    To copy to clipboard, switch view to plain text mode 
    See what is the value of c.

    If it is then you only need to remove one \ from the string.

  3. The following user says thank you to marcel for this useful post:

    gboelter (9th February 2008)

  4. #3
    Join Date
    Jan 2008
    Location
    Davao City, Philippines
    Posts
    77
    Thanks
    16
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPushButton - setText with "\n" not working

    [QUOTE=marcel;62579]I think the "\" in test1 might be escaped. It is the only explanation.

    Thanks Marcel, you are right, that was the problem.

    Guenther

Similar Threads

  1. setText not working
    By MarkoSan in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2006, 13:05

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.