[Qt-interest] buggy QDomElement

Pascal Patry iscy at invalidip.com
Mon May 4 21:16:40 CEST 2009


This piece of code fails in Qt 4.5.x:

====
QDomElement elem;
QString tag = "test";
elem.setTagName(tag);
assert(elem.tagName() == tag);
assert(elem.nodeName() == tag);
====

This used to work prior to Qt 4.5.

The documentation states:
"[...]
 QDomElement::QDomElement ()

  Constructs an empty element. Use the QDomDocument::createElement() function 
to construct elements with content.
[...]"

So I should be able to use it to create an empty element and not a null-and-
read-only-element-that-can-not-be-modified-later... :)

By creating an empty Document and then calling 'createElement()', I can get 
around the problem, but are there any plans to fix this?

Thank you,




More information about the Qt-interest-old mailing list