Utils::PersistentSettingsReader Class
class Utils::PersistentSettingsReaderKlasa `PersistentSettingsReader` odczytuje obiekt ` QVariantMap ` zawierający dowolne, zagnieżdżone struktury danych z pliku XML. Więcej...
| Header: | #include <PersistentSettingsReader> |
Szczegółowy opis
Obsługuje wszystkie proste typy dające się serializować jako ciągi znaków oraz elementy typu QVariantList i QVariantMap. Przykład:
<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>
Podczas analizowania struktury dla każdego elementu <data> wykorzystywany jest stos analizy typu ParseValueStackEntry. ParseValueStackEntry jest wariantem/unijem następujących elementów:
- prostej wartości
- mapy
- lista
Można zarejestrować funkcje serializacji do postaci ciągu znaków dla typów niestandardowych, rejestrując je w systemie typów Qt Meta. Przykład:
QMetaType::registerConverter(&MyCustomType::toString); QMetaType::registerConverter<QString, MyCustomType>(&myCustomTypeFromString);
Podczas wchodzenia do elementu wartościowego ( <value> / <valuelist>, <valuemap> ) odpowiedni wpis jest umieszczany na stosie. Podczas opuszczania elementu wartość typu QVariant tego wpisu jest pobierana ze stosu i dodawana do następnego wpisu na stosie (dodawana do listy lub wstawiana do mapy). Pierwszym elementem stosu jest wartość elementu <data>.
Zobacz także 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.