Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QString::null
Forum Updated to NodeBB v4.3 + New Features

QString::null

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 2.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by
    #1

    I'm a bit puzzled about using or avoiding QString::null. I understand, it's equivalent to QString(), but there's no mention in the documentation (not even as obsolete), only a "compatibility" comment in qstring.h

        // compatibility
        struct Null { };
        static const Null null;
    

    Is it considered obsolete?

    kshegunovK 1 Reply Last reply
    0
    • A Asperamanca

      I'm a bit puzzled about using or avoiding QString::null. I understand, it's equivalent to QString(), but there's no mention in the documentation (not even as obsolete), only a "compatibility" comment in qstring.h

          // compatibility
          struct Null { };
          static const Null null;
      

      Is it considered obsolete?

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @Asperamanca said in QString::null:

      Is it considered obsolete?

      Pretty much, you should generally avoid it. Use QString::isEmpty instead.

      Read and abide by the Qt Code of Conduct

      A 1 Reply Last reply
      4
      • kshegunovK kshegunov

        @Asperamanca said in QString::null:

        Is it considered obsolete?

        Pretty much, you should generally avoid it. Use QString::isEmpty instead.

        A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        @kshegunov said in QString::null:

        @Asperamanca said in QString::null:

        Is it considered obsolete?

        Pretty much, you should generally avoid it. Use QString::isEmpty instead.

        And how about for setting strings?

        void showWarning(const QString& message, const QString& context = QString::null);
        
        kshegunovK 1 Reply Last reply
        0
        • A Asperamanca

          @kshegunov said in QString::null:

          @Asperamanca said in QString::null:

          Is it considered obsolete?

          Pretty much, you should generally avoid it. Use QString::isEmpty instead.

          And how about for setting strings?

          void showWarning(const QString& message, const QString& context = QString::null);
          
          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          Use a default constructed QString.

          void showWarning(const QString& message, const QString& context = QString());
          

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          5

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved