CopperSpice API  1.9.2
Object Model

The standard C++ object model provides efficient runtime support for the object paradigm. However the static type system of C++ can be inflexible under some conditions. Graphical user interface programming requires both runtime efficiency and flexibility. CopperSpice provides the GUI required support by adding the an Object Model architecture.

CopperSpice adds the following features to C++. Many of these features are implemented with standard C++ techniques based on inheritance from QObject.

  • A very powerful mechanism for seamless object communication called Signals and Slots
  • Queryable and designable object properties
  • Events and event filters
  • Contextual string translation for internationalization
  • Sophisticated interval driven timers which make it possible to integrate several tasks in an event-driven GUI
  • Hierarchical and queryable object trees which organize object ownership
  • Guarded pointers (QPointer) which are automatically set to null when the referenced object is destroyed.
  • Dynamic cast which works across library boundaries

Important Classes

These are the classes which form the basis of the CopperSpice Object Model.

QMetaClassInfo Additional information about a class
QMetaEnum Meta data about an enumerator
QMetaMethod Meta data about a member function
QMetaObject Contains meta information about CopperSpice objects
QMetaProperty Meta data about a property
QObject The base class of all CopperSpice objects
QObjectCleanupHandler Watches the lifetime of multiple QObjects
QPointer Template class that provides guarded pointers to QObject
QSignalMapper Bundles signals from identifiable senders
QVariant Manages named types in the property system, stores a single value of almost any data type

QObjects in CopperSpice

QObject and all subclasses of QObject (direct or indirect) have their copy constructor and assignment operator disabled.

  • Might have a unique QObject::objectName()
    If we copy a Object what name should we give the copy?
  • Has a location in an object hierarchy
    If we copy a Object where should the copy be located?
  • Can be connected to other CopperSpice Objects to emit signals to them or to receive signals emitted by them
    If we copy a Object, how should we transfer these connections to the copy?
  • Can have new properties added to it at runtime which are not declared in the class
    If we copy a Object, should the copy include the properties which were added to the original?