Na ovoj stranici

Utils::PersistentSettingsReader Class

class Utils::PersistentSettingsReader

Klasa PersistentSettingsReader čita konfiguracijsku postavku ( QVariantMap ) proizvoljnih, ugniježđenih struktura podataka iz XML datoteke. Više...

Header: #include <PersistentSettingsReader>

Detaljan opis

Podržava sve string-serijalizabilne jednostavne tipove te QVariantList i QVariantMap. Primjer:

<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>

Pri parsiranju strukture za svaki element <data> koristi se parse stack od ParseValueStackEntry. ParseValueStackEntry je varijanta/unija od:

  • jednostavna vrijednost
  • mapu
  • popis

Možete registrirati funkcije za string-serijalizaciju prilagođenih tipova registriranjem u Qt Meta sustav tipova. Primjer:

QMetaType::registerConverter(&MyCustomType::toString);
QMetaType::registerConverter<QString, MyCustomType>(&myCustomTypeFromString);

Pri ulasku u element s vrijednošću ( <value> / <valuelist>, <valuemap> ) odgovarajući se unos gura na gomilu. Pri izlasku iz elementa vrijednost unosa QVariant-a skida se s gomile i dodaje na donji unos gomile (dodaje se na listu ili se ubacuje u mapu). Prvi element gomile je vrijednost elementa <data>.

Vidi također 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.