[Interest] QObject::dumpObjectTree() & const

Thiago Macieira thiago.macieira at intel.com
Mon Oct 3 13:18:44 CEST 2016

On domingo, 2 de outubro de 2016 20:05:49 MDT Andy wrote:
> Why aren't QObject::dumpObjectTree() and QObject::dumpObjectInfo() const?
> Surely they shouldn't be modifying the state of the object.

Because they don't need to be. You can call any function from the debugger, 
regardless of actual constness of the object.

They were designed to be called from the debugger itself, never by your code.

> I occasionally add them to my own debug dump() methods which are const
> (ensures no modification is happening accidentally) and have to work around
> this each time.
> Obviously not a huge deal, just curious if anyone knows why that decision
> was made.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Interest mailing list