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

QString::toInt returns 0

    XMLWordPrintable

Details

    Description

      When running the code below

      int dataOriginal = 0x80000001; 
      QString dataStr = QString::number(dataOriginal, 16); 
      bool ok;
      int dataInt = dataStr.toInt(&ok, 16); 
      

      the result ends up

      Qt 5.15.10

      dataOriginal : (hex) ffffffff080000001
      dataStr : "ffffffff080000001"
      dataInt : 0  
      ok : false
      

      As a reference the result in Qt6.3.1 is

      dataOriginal : (hex) ffffffff080000001
      dataStr : "-7fffffff"
      dataInt : (hex) ffffffff080000001
      ok : true
      

      How to reproduce

      Attachments

        Issue Links

          Activity

            People

              thiago Thiago Macieira
              nagrohn Nahomi Gröhn (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: