QSettings and xml
-
Why do you declare writeXmlFile and readXmlFile again in the lines 8 and 9 in file.cpp above?
Hi Andreyc, I have been finding "Qsettings-mit-xml-format", but the link http://www.openshots.de/2011/03/qsettings-mit-xml-format/ is broken, is there some way for i can see this example? thanks
-
Hi Andreyc, I have been finding "Qsettings-mit-xml-format", but the link http://www.openshots.de/2011/03/qsettings-mit-xml-format/ is broken, is there some way for i can see this example? thanks
@zabdielfer said in QSettings and xml:
Hi Andreyc, I have been searching "Qsettings-mit-xml-format", but the link http://www.openshots.de/2011/03/qsettings-mit-xml-format/ is broken, is there some way for i can see this example? thanks
-
@zabdielfer as @andreyc sayed. You have to change the methods readXmlFile and writeXmlFile to static members..
Especially:
in your header file:
changebool readXmlFile(QIODevice &device, QSettings::SettingsMap &map);
bool writeXmlFile(QIODevice &device, const QSettings::SettingsMap &map);to
static bool readXmlFile(QIODevice &device, QSettings::SettingsMap &map);
static bool writeXmlFile(QIODevice &device, const QSettings::SettingsMap &map);and remove in the implementation file (QControlPanel constructor) the forward declarations
bool readXmlFile(QIODevice &device, QSettings::SettingsMap &map);
bool writeXmlFile(QIODevice &device, const QSettings::SettingsMap &map); -
@zabdielfer as @andreyc sayed. You have to change the methods readXmlFile and writeXmlFile to static members..
Especially:
in your header file:
changebool readXmlFile(QIODevice &device, QSettings::SettingsMap &map);
bool writeXmlFile(QIODevice &device, const QSettings::SettingsMap &map);to
static bool readXmlFile(QIODevice &device, QSettings::SettingsMap &map);
static bool writeXmlFile(QIODevice &device, const QSettings::SettingsMap &map);and remove in the implementation file (QControlPanel constructor) the forward declarations
bool readXmlFile(QIODevice &device, QSettings::SettingsMap &map);
bool writeXmlFile(QIODevice &device, const QSettings::SettingsMap &map);@karlheinzreichel
thank you, I will try it -
@karlheinzreichel
thank you, I will try itThis post is deleted! -
@zabdielfer as @andreyc sayed. You have to change the methods readXmlFile and writeXmlFile to static members..
Especially:
in your header file:
changebool readXmlFile(QIODevice &device, QSettings::SettingsMap &map);
bool writeXmlFile(QIODevice &device, const QSettings::SettingsMap &map);to
static bool readXmlFile(QIODevice &device, QSettings::SettingsMap &map);
static bool writeXmlFile(QIODevice &device, const QSettings::SettingsMap &map);and remove in the implementation file (QControlPanel constructor) the forward declarations
bool readXmlFile(QIODevice &device, QSettings::SettingsMap &map);
bool writeXmlFile(QIODevice &device, const QSettings::SettingsMap &map);@zabdielfer
Hi:
how could I get all attributes of a node for example this xml file
<Ajustes>
<Personalizado>
<AjustesECG setting_ecg.V_on="false" setting_ecg.marcapasos="false" setting_ecg.alarm_on_st2="true" />
<AjustesRSP setting_rsp.gain="2" setting_rsp.apnea_delay="1" setting_rsp.alarm_on="true" />
<AjustesNIBP setting_pni.period="2" setting_pni.alarm_sy_on="true" setting_pni.alarm_di_on="true"
<AjustesCO2 setting_cos.apnea_delay="1" setting_cos.compensation="false" setting_cos.alarm_cex_on="true" />
<AjustesNO2 setting_nos.alarm_nex_on="false" setting_nos.alarm_nin_on="false" setting_nos.alarm_nex_lvl="1"
<AjustesTNM setting_nmt.current="0" setting_nmt.period="0" setting_nmt.type="0" setting_nmt.width="0" />
</Personalizado>
<Fabrica>
<AjustesECG setting_ecg.V_on="false" setting_ecg.marcapasos="false" setting_ecg.alarm_on_st2="true" />
<AjustesRSP setting_rsp.gain="2" setting_rsp.apnea_delay="1" setting_rsp.alarm_on="true" />
<AjustesNIBP setting_pni.period="2" setting_pni.alarm_sy_on="true" setting_pni.alarm_di_on="true"
<AjustesCO2 setting_cos.apnea_delay="1" setting_cos.compensation="false" setting_cos.alarm_cex_on="true" />
<AjustesNO2 setting_nos.alarm_nex_on="false" setting_nos.alarm_nin_on="false" setting_nos.alarm_nex_lvl="1"
<AjustesTNM setting_nmt.current="0" setting_nmt.period="0" setting_nmt.type="0" setting_nmt.width="0" />
</Fabrica>
</Ajustes> -
@zabdielfer
Hi:
how could I get all attributes of a node for example this xml file
<Ajustes>
<Personalizado>
<AjustesECG setting_ecg.V_on="false" setting_ecg.marcapasos="false" setting_ecg.alarm_on_st2="true" />
<AjustesRSP setting_rsp.gain="2" setting_rsp.apnea_delay="1" setting_rsp.alarm_on="true" />
<AjustesNIBP setting_pni.period="2" setting_pni.alarm_sy_on="true" setting_pni.alarm_di_on="true"
<AjustesCO2 setting_cos.apnea_delay="1" setting_cos.compensation="false" setting_cos.alarm_cex_on="true" />
<AjustesNO2 setting_nos.alarm_nex_on="false" setting_nos.alarm_nin_on="false" setting_nos.alarm_nex_lvl="1"
<AjustesTNM setting_nmt.current="0" setting_nmt.period="0" setting_nmt.type="0" setting_nmt.width="0" />
</Personalizado>
<Fabrica>
<AjustesECG setting_ecg.V_on="false" setting_ecg.marcapasos="false" setting_ecg.alarm_on_st2="true" />
<AjustesRSP setting_rsp.gain="2" setting_rsp.apnea_delay="1" setting_rsp.alarm_on="true" />
<AjustesNIBP setting_pni.period="2" setting_pni.alarm_sy_on="true" setting_pni.alarm_di_on="true"
<AjustesCO2 setting_cos.apnea_delay="1" setting_cos.compensation="false" setting_cos.alarm_cex_on="true" />
<AjustesNO2 setting_nos.alarm_nex_on="false" setting_nos.alarm_nin_on="false" setting_nos.alarm_nex_lvl="1"
<AjustesTNM setting_nmt.current="0" setting_nmt.period="0" setting_nmt.type="0" setting_nmt.width="0" />
</Fabrica>
</Ajustes>@zabdielfer
QXmlStreamReader * rdr = new QXmlStreamReader("path");while (!rdr->atEnd()) { QXmlStreamReader::TokenType token = rdr->readNext(); if(token == QXmlStreamReader::StartDocument) continue; if (rdr->name() == "Personalizado") { continue; } if(rdr->name() == "AjustesECG"){ qDebug() << rdr->attributes().value("setting_ecg.V_on").toString(); qDebug() << rdr->attributes().value("setting_ecg.marcapasos").toString(); qDebug() << rdr->attributes().value("setting_ecg.alarm_on_st2").toString(); } }
-
@zabdielfer
QXmlStreamReader * rdr = new QXmlStreamReader("path");while (!rdr->atEnd()) { QXmlStreamReader::TokenType token = rdr->readNext(); if(token == QXmlStreamReader::StartDocument) continue; if (rdr->name() == "Personalizado") { continue; } if(rdr->name() == "AjustesECG"){ qDebug() << rdr->attributes().value("setting_ecg.V_on").toString(); qDebug() << rdr->attributes().value("setting_ecg.marcapasos").toString(); qDebug() << rdr->attributes().value("setting_ecg.alarm_on_st2").toString(); } }
@Taz742
Thank you for spent time in my topic. :) -
@Taz742
Thank you for spent time in my topic. :)@zabdielfer
Is it helpfull for you? -
@zabdielfer
Is it helpfull for you?@Taz742
yes, thank you