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

Manually read a QML file from resource returns an empty file in release mode when QML compiler is active

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 5.13.0 Alpha 1
    • 5.11.0, 5.11.3, 5.12.0
    • QML: Compiler
    • macOS High Sierra 10.13.6 and others
    • Android, Linux/X11, macOS
    • 21ffde85a1b4592d24785a3ba82817de05486060

      Reading a QML file with QFile from a resource bundle returns an empty file in release mode on MacOS. 

      Testing the same code in debug mode works fine.

       

      for(auto fileName : {":/__initializer.qml", ":/__initializer.txt"}) {
          QFile f(fileName);
          if(f.open(QFile::ReadOnly))
             qDebug() << fileName << ":" << f.readAll(); 
      }
      // Output Debug:
      // :/__initializer.qml : "import QtQuick 2.0\nItem {\n    // Do nothing\n}\n"
      // :/__initializer.txt : "This is just a test message\n"
       
      // Output Release: 
      // :/__initializer.qml : ""
      // :/__initializer.txt : "This is just a test message\n"
      
      
      

      It looks like, it just happens on MacOS. Testing on Windows works fine. Cross compiling code for Android on MacOS shows the same behaviors as on MacOS. Compiling the code on Windows for Android works fine.

       

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

            ulherman Ulf Hermann
            yakin Sebastian Stadelmann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes