Utils::PersistentSettingsReader Class
class Utils::PersistentSettingsReaderPersistentSettingsReader クラスは、XML ファイルから、任意のネストされたデータ構造を持つQVariantMap を読み込みます。詳細...
| Header: | #include <PersistentSettingsReader> |
詳細な説明
文字列シリアライズ可能なすべての単純型、およびQVariantList およびQVariantMap を扱います。例:
<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>
構造体を解析する際、各 <data> 要素に対して ParseValueStackEntry の解析スタックが使用されます。ParseValueStackEntry は、以下の要素のバリアント/ユニオンです:
- 単純な値
- マップ
- リスト
カスタム型用の文字列シリアライズ関数は、Qt Meta型システムに登録することで登録できます。例:
QMetaType::registerConverter(&MyCustomType::toString); QMetaType::registerConverter<QString, MyCustomType>(&myCustomTypeFromString);
値要素(<value> /<valuelist> /<valuemap> )に入ると、それに応じてエントリがスタックにプッシュされます。要素を離れる際、エントリのQVariant 値がスタックから取り出され、その下のスタックエントリに追加されます(リストに追加されるか、マップに挿入されます)。スタックの最初の要素が、<data>要素の値となります。
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.