CopperSpice Overview
Limitations 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 it introduced. New capabilities and functionality were added in C++11 which provided the power to remove the Meta Object Compiler while maintaining full Reflection in CopperSpice.

With moc

The following is a summary of what is lost when using moc.

  • 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 or Slot parameters
  • Virtual inheritance with QObject is not supported
  • Signal and Slot parameters can not b function or method pointers
  • Multiple Inheritance
    • Multiple inheritance requires QObject to be the first parent
    • With multiple inheritance moc assumed the first inherited class is a subclass of QObject
  • Enums and Typedefs
    • Enums and Typedefs must be fully qualified with the complete scope for signal and slot parameters
    • If you are using a string based QObject::connect() the signale and slot signatures are compared as strings
      • Data types like double and qreal are equivalent but will not match since qreal is a typedef
      • Using method pointers or lambdas will bypass this restriction

Without moc

None of the limitations listed above exist in CopperSpice.

  • A templated class can inherit from QObject
  • The QObject class can be anywhere in the multiple inheritance list
  • Easier to build since there are no generated files to get out of sync