Important: Please read the Qt Code of Conduct -

QDomElements by ID

  • Hello Forum,

    I stored an svg file in a QDomDocument and I want to manipulate some elements (more precisely: setting visibility attributes). I know the IDs of the elements I want to manipulate.

    Now, I was quite happy when I saw that there was a QDomDocument::elementById() function... until I read that this function hasn't been implemented and does, in fact, nothing.

    Then, I thought to myself: "Ok, no Problem, I will parse the document's elements for the elements with the IDs I am looking for, myself". The Problem, though, is that I couldn't find any functions that let me query element's (or node's) IDs, at all.

    So, the questions are: Is there any way to identify elements (or nodes) by ID in the QtXml context? How can I get hold of the elements I am looking for, using the IDs?

    Thanks in advance!