[Interest] qt5 settings ini format regression

Thiago Macieira thiago.macieira at intel.com
Sun Dec 30 19:50:50 CET 2012


On domingo, 30 de dezembro de 2012 18.35.20, Frank Hemer wrote:
> In QT5, QSettings with IniFormat being used with keys like 'general/entry1'
> do write all items into a '%General' section.
> This is what the doc explains as a way to ensure no keys without a group may
> get overwritten.
> 
> Unfortunately it seems that with qt5 there appear multiple '%General'
> sections when accessed as described above.
> This is a regression to the 4.x.
> 
> Can anybody confirm this behavior, maybe with other os (I tried linux) -
> I'll file a  bugreport then.

Please do, because there are no changes that could account for that. I've 
attached the full diff on all QSettings from 4.8.4 to 5.0.0. The changes can be 
divided into the following groups:

 - moving qt_windows.h includes to the last
 - renaming a mutex from globalMutex to settingsGlobalMutex
 - removing code that was #ifdef'ed out in your case
 - adding code that is still #ifdef'ed out in your case (e.g., Blackberry)
 - changes to comments and documentation
 - removal of the Qt3Support code
 - one big change to the Mac code (presumably for sandboxing)
 - and finally, one no-op change to code dealing with "general":

@@ -1757,10 +1758,10 @@ bool QConfFileSettingsPrivate::readIniFile(const 
QByteArray &data,
 
             iniSection = iniSection.trimmed();
 
-            if (qstricmp(iniSection, "general") == 0) {
+            if (qstricmp(iniSection.constData(), "general") == 0) {
                 currentSection.clear();
             } else {
-                if (qstricmp(iniSection, "%general") == 0) {
+                if (qstricmp(iniSection.constData(), "%general") == 0) {
                     currentSection = QLatin1String(iniSection.constData() + 
1);
                 } else {
                     currentSection.clear();
@@ -1917,7 +1918,7 @@ bool QConfFileSettingsPrivate::writeIniFile(QIODevice 
&device, const ParsedSetti
 
         if (realSection.isEmpty()) {
             realSection = "[General]";
-        } else if (qstricmp(realSection, "general") == 0) {
+        } else if (qstricmp(realSection.constData(), "general") == 0) {
             realSection = "[%General]";
         } else {
             realSection.prepend('[');

 
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qsettings-4.8.4-to-5.0.0.diff
Type: text/x-patch
Size: 63165 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121230/ce8e339f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121230/ce8e339f/attachment.sig>


More information about the Interest mailing list