Results 1 to 2 of 2

Thread: simple QString comment

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: simple QString comment

    calling clear() on is makes it both empty and null.
    Should not.
    From the docs:
    void QString::clear ()

    Clears the contents of the string and makes it empty.
    bool QString::isNull () const

    Returns true if this string is null; otherwise returns false.

    Example:

    QString().isNull(); // returns true
    QString("").isNull(); // returns false
    QString("abc").isNull(); // returns false

    Qt makes a distinction between null strings and empty strings for historical reasons. For most applications, what matters is whether or not a string contains any data, and this can be determined using isEmpty().

    See also isEmpty().

  2. The following user says thank you to high_flyer for this useful post:

    fnmblot (3rd August 2006)

Similar Threads

  1. simple pointer question
    By mickey in forum General Programming
    Replies: 6
    Last Post: 16th June 2006, 10:19
  2. QSqlQueryModel + set Write
    By raphaelf in forum Qt Programming
    Replies: 7
    Last Post: 5th June 2006, 09:55
  3. Converting QString to unsigned char
    By salston in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2006, 23:10
  4. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 15:52
  5. [SOLVED] Widget plugin ... how to ?
    By yellowmat in forum Newbie
    Replies: 10
    Last Post: 29th January 2006, 21:41

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.