Menu

Installation

Jochen Baier
Installation:

include QuteContainer.cpp and QuteContainer.h in your project.

Requirements:

C++ Qt framework. Tested with 4.8. and 5.0.

Only objects derived from QObject* can be resolved and registered.
The constructor must have the Q_INVOKABLE key word. The first parameter
must be QObject* parent type to set the parent object. All constructor parameter
must derive from QObject.

:::C++
class Dependency: public QObject
{
  Q_OBJECT
public:
  Q_INVOKABLE Dependency(QObject *parent, DependencyOne *dep1, .....) :QObject(parent),
};

Up to 9 parameter are supported. At the moment only one constructor is supported.

Object lifetime:

void registerType(bool isSingleton=false): If 'isSingleton' is set the object will be only created on the first call of resolve(). Later calls to resolve() will return the same object. Otherwise new objects are returned. For singletons the object parent() is set to QuteContainer. For injected parameters the parent() is set to the calling object. You can set resolved objects to other parents if you want.

How it works internally:

QuteContainer is using Qt Meta-Object System to create the objects.


Related

Wiki: Home

MongoDB Logo MongoDB