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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • 5.0.2, 5.1.0 RC1
    • Documentation
    • 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

        For Gerrit Dashboard: QTBUG-31280
        # Subject Branch Project Status CR V

        Activity

          People

            vertries Nico Vertriest (Inactive)
            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