Utils::PersistentSettingsReader Class
class Utils::PersistentSettingsReaderLa classe `PersistentSettingsReader` legge un file ` QVariantMap ` contenente strutture di dati arbitrarie e annidate da un file XML. Per saperne di più...
| Header: | #include <PersistentSettingsReader> |
Descrizione dettagliata
Gestisce tutti i tipi semplici serializzabili come stringhe, nonché QVariantList e QVariantMap. Esempio:
<qtcreator> <data> <variable>ProjectExplorer.Project.ActiveTarget</variable> <value type="int">0</value> </data> <data> <variable>ProjectExplorer.Project.EditorSettings</variable> <valuemap type="QVariantMap"> <value type="bool" key="EditorConfiguration.AutoIndent">true</value> </valuemap> </data>
Durante l'analisi della struttura, per ogni elemento <data> viene utilizzato uno stack di analisi di tipo ParseValueStackEntry. ParseValueStackEntry è una variante/unione di:
- valore semplice
- mappa
- lista
È possibile registrare funzioni di serializzazione in stringa per tipi personalizzati registrandole nel sistema di tipi Qt Meta. Esempio:
QMetaType::registerConverter(&MyCustomType::toString); QMetaType::registerConverter<QString, MyCustomType>(&myCustomTypeFromString);
Quando si accede a un elemento di valore ( <value> / <valuelist>, <valuemap> ), la voce viene inserita nello stack in modo corrispondente. Quando si esce dall’elemento, il valore QVariant della voce viene prelevato dallo stack e aggiunto alla voce successiva dello stack (aggiunto alla lista o inserito nella mappa). Il primo elemento dello stack è il valore dell’elemento <data>.
Vedi anche Utils::PersistentSettingsWriter.
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.