Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-31280

QHostAddress::clear() isn't same that QHostAddress::setAddress("0.0.0.0")

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Out of scope
    • Affects Version/s: 5.0.2, 5.1.0 RC1
    • Fix Version/s: None
    • Component/s: Documentation
    • Labels:
      None

      Description

      In documentation says:

      void QHostAddress::clear()
      Sets the host address to 0.0.0.0.

      But in this code:

      QHostAddress addrFoo, addrBar;
      
      addrFoo.clear();
      addrBar.setAddress("0.0.0.0");
      
      if (addrFoo == addrBar) {
          qDebug() << "Foo == Bar";
      } else {
          qDebug() << "Foo != Bar";
      }

      will be output "Foo != Bar".
      Because “clear()” method sets the host address to 0.0.0.0 or :: and set protocol to QAbstractSocket::UnknownNetworkLayerProtocol
      In documentation says nothing about protocol.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            vertries Nico Vertriest (Inactive)
            Reporter:
            kiichiro Dmitriy Lazarev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes