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. QHostAdress behaves differently with Qt 5.4.1

QHostAdress behaves differently with Qt 5.4.1

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 739 Views 3 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.
  • _rth__ Offline
    _rth__ Offline
    _rth_
    wrote on last edited by _rth_
    #1

    Hello.

    Following simple application gives different results when compiled against Qt 4.8.5 and Qt 5.4.1:

    #include <QCoreApplication>
    #include <QHostAddress>
    #include <QDebug>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        QString ip("1");
        //QString ip("x");
    
        QHostAddress adr;
        if (adr.setAddress(ip))
            qDebug() << "OK";
        else
            qDebug() << "NOK";
    
        if (adr.isNull())
            qDebug() << "NOK";
        else
            qDebug() << "OK";
    
        //return a.exec();
    }
    

    Result from Qt 4.8.5 build:
    NOK
    NOK

    Result from Qt 5.4.1 build:
    OK
    OK

    Is this a bug? Or I am doing something wrong?

    p3c0P 1 Reply Last reply
    0
    • _rth__ _rth_

      Hello.

      Following simple application gives different results when compiled against Qt 4.8.5 and Qt 5.4.1:

      #include <QCoreApplication>
      #include <QHostAddress>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          QString ip("1");
          //QString ip("x");
      
          QHostAddress adr;
          if (adr.setAddress(ip))
              qDebug() << "OK";
          else
              qDebug() << "NOK";
      
          if (adr.isNull())
              qDebug() << "NOK";
          else
              qDebug() << "OK";
      
          //return a.exec();
      }
      

      Result from Qt 4.8.5 build:
      NOK
      NOK

      Result from Qt 5.4.1 build:
      OK
      OK

      Is this a bug? Or I am doing something wrong?

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @_rth_ See QTBUG-36506 for more info.

      157

      _rth__ 1 Reply Last reply
      1
      • p3c0P p3c0

        @_rth_ See QTBUG-36506 for more info.

        _rth__ Offline
        _rth__ Offline
        _rth_
        wrote on last edited by
        #3

        @p3c0 Thanks.

        1 Reply Last reply
        0

        • Login

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