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

Qt can no longer convert QIODevice* into QFile* in custom QSettings write function

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.4.0
    • Core: Other
    • None
    • Qt 5.4 for MSVC2013 x86, Windows 7 x64, MSVC2013 compiler for x86

      I have a custom settings file which I write with QSettings as:

          auto format = QSettings::registerFormat ("iniformat",  readIniFile, writeIniFile);
          QSettings settings("Settings/local.info",format);
      

      since version 5.4 the conversion in writeIniFile :

      bool writeIniFile( QIODevice& device, const QSettings::SettingsMap& map )
      {
          QFile*file = qobject_cast<QFile*>(&device);
      

      fails to convert device into QFile*. The result is 0. This was working at least in 5.2.1, now it doesn't

      I have attached a minimal test project. Set breakpoint at line 11 and you will see the problem - file is 0, as conversion failed.

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

            thiago Thiago Macieira
            zekses Nikolai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes