Results 1 to 8 of 8

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

Threaded 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 QPushButton - setText with "\n" not working

    Sorry, I'm quiet new in Qt and it's possible that somebody will laugh about this question, but I can't found a solution so I would like to ask you guys for al little bit help.

    Actually I'm using Qt 4.3 together with Linux and MySQL 5.

    From a MySql database I got "Hello\n World" using

    Qt Code:
    1. QString test1(query.value(1).toString())
    To copy to clipboard, switch view to plain text mode 

    In my database "Hello\n World" is stored as varschar(40).

    Then for testing I have tried this:

    Qt Code:
    1. QString test1(query.value(1).toString());
    2. QString test2 = "Hello\n World";
    3.  
    4. qDebug() << query.value(1); // QVariant(QString, "Hello\World")
    5. qDebug() << test1; // gives me "Hello\n World"
    6. qDebug() << test2; // gives me "Hello
    7. World"
    To copy to clipboard, switch view to plain text mode 

    How it comes, that in test1 the newline character is ignored?

    Thanks in advance

    Guenther
    Davao City, Philippines, Planet Earth
    Last edited by gboelter; 9th February 2008 at 08:02. Reason: reformatted to look better

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.