Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QQmlIncubationController Class

QQmlIncubationController instances drive the progress of QQmlIncubators More...

 #include <QQmlIncubationController>

Public Functions

QQmlIncubationController()
QQmlEngine * engine() const
void incubateFor(int msecs)
void incubateWhile(volatile bool * flag, int msecs = 0)
int incubatingObjectCount() const

Protected Functions

virtual void incubatingObjectCountChanged(int incubatingObjectCount)

Detailed Description

QQmlIncubationController instances drive the progress of QQmlIncubators

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's 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 QQmlEngine::setIncubationController() method. Processing is then controlled by calling the QQmlIncubationController::incubateFor() or QQmlIncubationController::incubateWhile() methods as dictated by the application's 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:
     virtual void timerEvent(QTimerEvent *) {
         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.

Member Function Documentation

QQmlIncubationController::QQmlIncubationController()

Create a new incubation controller.

QQmlEngine * QQmlIncubationController::engine() const

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

void QQmlIncubationController::incubateFor(int msecs)

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

void QQmlIncubationController::incubateWhile(volatile bool * flag, int msecs = 0)

Incubate objects while the bool pointed to by flag is true, or until there are no more objects to incubate, or up to msecs if msecs is not zero.

Generally this method is used in conjunction with a thread or a UNIX signal that sets the bool pointed to by flag to false when it wants incubation to be interrupted.

int QQmlIncubationController::incubatingObjectCount() const

Return the number of objects currently incubating.

void QQmlIncubationController::incubatingObjectCountChanged(int incubatingObjectCount) [virtual protected]

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

The default implementation does nothing.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web