QDomElement pitfal (Was: comment in rc file affects line below)
Waldo Bastian
bastian at kde.org
Tue May 11 22:24:59 BST 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
(Wasn't there a webpage with common programming mistakes?)
Don't use:
for ( QDomElement e = baseElement.firstChild().toElement(); !e.isNull();
e = e.nextSibling().toElement() )
{
...
But use:
for ( QDomNode n = baseElement.firstChild(); !n.isNull();
n = n.nextSibling() )
{
QDomElement e = n.toElement();
if (e.isNull()) continue;
...
Otherwise your loop aborts on the first non-element ( text or comments for
example ) This makes the removeDOMcomments() calls obsolete.
Patch for kdeui attached.
Cheers,
Waldo
On Tue May 11 2004 20:57, Paulo Moura Guedes wrote:
> Hi,
>
> I noticed that if I have,
>
> <Menu name="help"><text>&Help</text>
> #<Action name="about_app"/>
> <Action name="report_bug"/>
> </Menu>
>
> report bug doesn't show on the help menu but if put report_bug line before
> about_app it just works.
> Is this expected behavior?
>
> P.S. The rc file belongs to the kpart of the application
- --
bastian at kde.org | Novell BrainShare Europe 2004 | bastian at suse.com
bastian at kde.org | 12-18 September, Barcelona, Spain | bastian at suse.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQFAoUSsN4pvrENfboIRAoXOAJ94eaiH6+T4vBWsZe7GggChNpr8IQCfaNJE
r2oZo/oK936NA3x95Nkcgvg=
=UGx5
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdeui_qdomelement.patch
Type: text/x-diff
Size: 21482 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20040511/4f27c75c/attachment.patch>
More information about the kde-core-devel
mailing list