qxmlstreamreader

QT: QXmlStreamReader always returns “Premature End of Document” error

心已入冬 提交于 2019-12-23 16:19:05
问题 I have strange issue with Qt QXmlStreamReader. I'am trying to parse simple document (note: it is generated using QXmlStreamWriter): <?xml version="1.0" encoding="UTF-8"?> <tex> <used_by/> <facade> <tags> <town_related></town_related> <zone_related></zone_related> <visual_related></visual_related> <kind_related></kind_related> <other>flamingo</other> </tags> <additional_textures> <id>flamingo_top.psd</id> </additional_textures> </facade> </tex> Using this code: QFile file(filename); if (file

Getting paths of qrc files in Qt

浪子不回头ぞ 提交于 2019-12-12 12:25:39
问题 I want to know how to access the paths of files in the qrc file in order to use them as strings in an array. An example of qrc file is: <!DOCTYPE RCC><RCC version="1.0"> <qresource prefix=""> <file>images/1.jpg</file> <file>images/2.jpg</file> <file>images/3.jpg</file> <file>images/4.jpg</file> </qresource> </RCC> I want to use it in the following manner: for(int i=0;i<4;i++) { path=image_path[i]; } where path is an qlist that can be later used for accessing the respective images. 回答1: There