CopperSpice Overview  1.5.1
Known limits of moc

There are several features in C++ which moc does not support. CopperSpice was written to maintain the advantages and power of Signals and Slots, without the limitations moc introduced. The new functionality added to C++11 was required in order to redesign moc.

The following is a list of what is lost in C++ when using moc. Except where noted CopperSpice does not have any of these restrictions.

  • Class templates can not contain Signals or Slots
  • Nested classes can not have Signals or Slots
  • A macro can not be used to declare a Signal or a Slot
  • Macros can not be used to define a base class for a QObject
  • Macros can not be used to define the data type for Signal and Slot parameters
  • Multiple inheritance requires QObject to be the first parent

    • With multiple inheritance, moc assumes the first inherited class is a subclass of QObject
    • CopperSpice allows QObject inheritance in any position
  • Virtual inheritance with QObject is not supported
  • Signal or Slot parameters can not use function or method pointers
  • Enums and Typedefs must be fully qualified for Signal and Slot parameters

    • When checking the signatures of Signals and Slots, QObject::connect() compares the data types as strings. For example, double and qreal are treated as different types even though qreal is a typedef for double.
    • CopperSpice removes this limitation when using method pointers for the Signal and Slot parameters in QObject::connect()