O'Reilly logo

Learn Qt 5 by Nicholas Sherriff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

QObject

So, what is this funky QObject thingy we are inheriting from which keeps popping up? Well, it’s the base class for all Qt objects, and it gives us some powerful features for free.

QObjects organize themselves into object hierarchies with a parent object assuming ownership of their child objects, which means we don’t have to worry (as much!) about memory management. For example, if we have an instance of a Client class derived from QObject that is the parent of an Address also derived from QObject, then the address is automatically destroyed when the client is destroyed.

QObjects carry metadata that allows a degree of type inspection and is the backbone for interaction with QML. They can also communicate with each other via an event ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required