QQmlIncubationController露

QQmlIncubationController instances drive the progress of QQmlIncubators. More鈥�

Inheritance diagram of PySide2.QtQml.QQmlIncubationController

Synopsis露

Functions露

Virtual functions露

Detailed Description露

In order to behave asynchronously and not introduce stutters or freezes in an application, the process of creating objects a QQmlIncubators must be driven only during the application鈥檚 idle time. QQmlIncubationController allows the application to control exactly when, how often and for how long this processing occurs.

A QQmlIncubationController derived instance should be created and set on a QQmlEngine by calling the setIncubationController() method. Processing is then controlled by calling the incubateFor() or incubateWhile() methods as dictated by the application鈥檚 requirements.

For example, this is an example of a incubation controller that will incubate for a maximum of 5 milliseconds out of every 16 milliseconds.

class PeriodicIncubationController : public QObject,
                                     public QQmlIncubationController
{
public:
    PeriodicIncubationController() {
        startTimer(16);
    }

protected:
    void timerEvent(QTimerEvent *) override {
        incubateFor(5);
    }
};

Although the previous example would work, it is not optimal. Real world incubation controllers should try and maximize the amount of idle time they consume - rather than a static amount like 5 milliseconds - while not disturbing the application.

class PySide2.QtQml.QQmlIncubationController露

Create a new incubation controller.

PySide2.QtQml.QQmlIncubationController.engine()露
Return type:

PySide2.QtQml.QQmlEngine

Return the QQmlEngine this incubation controller is set on, or 0 if it has not been set on any engine.

PySide2.QtQml.QQmlIncubationController.incubateFor(msecs)露
Parameters:

msecs 鈥� int

Incubate objects for msecs , or until there are no more objects to incubate.

PySide2.QtQml.QQmlIncubationController.incubateWhile(flag[, msecs=0])露
Parameters:
  • flag 鈥� bool

  • msecs 鈥� int

Note

This function is deprecated.

PySide2.QtQml.QQmlIncubationController.incubatingObjectCount()露
Return type:

int

Return the number of objects currently incubating.

PySide2.QtQml.QQmlIncubationController.incubatingObjectCountChanged(arg__1)露
Parameters:

arg__1 鈥� int

Called when the number of incubating objects changes. incubatingObjectCount is the new number of incubating objects.

The default implementation does nothing.