BuiltinApplicationLauncher Class Reference
|
Task Name | BuiltinApplicationLauncher |
Interfaces | ApplicationTypeLauncher |
Services | None |
The BuiltinApplicationLauncher class provides the ApplicationTypeLauncher implementation for simple applications compiled into the Qt Extended Server - known as builtin applications.
A builtin application must consist of a single, toplevel widget. Generally builtins do not implement services, but they may. If multiple builtins implement the same service, or the Qt Extended Server and a builtin implements the same service, the behaviour is undefined.
Adding a builtin application is a simple case of linking it into the Qt Extended Server, and adding a QTOPIA_SIMPLE_BUILTIN() macro to your code. The QTOPIA_SIMPLE_BUILTIN() macro registers the builtin application with the BuiltinApplicationLauncher class. The macro takes the application name, and a simple static function that "launches" the application and returns a QWidget pointer as paramters.
Note: Builtins may not currently implement services. This functionality is planned for future versions of Qtopia.
The BuiltinFunc provides a type definition that the static function used to create a builtin application must conform to. The exact specification is:
typdef QWidget *(*BuiltinFunc)()
Constructs a new BuiltinApplicationLauncher instance.
Destroys the BuiltinExeApplicationLauncher instance.
Add a new builtin application to the server. ApplicationName must be the name of the application and createFunc a static function, of type BuiltinApplicationLauncher::BuiltinFunc, that creates the applications. For example, the following code adds a simple builtin named "TestBuiltin" to the server.
class TestBuiltinWindow : public QWidget
{
// ...
};
static QWidget *testBuiltinFunc()
{
static QPointer<TestBuiltinWindow> w = 0
if (!w)
w = new TestBuiltinWindow(0);
return w;
}
QTOPIA_SIMPLE_BUILTIN(TestBuiltin, testBultinFunc);
If the builtin doesn't return a widget the system assumes that the builtin application provides a background task. Therefore any UI builtin must return the widget.
Also if the function keeps a QWidget pointer it must ensure that the pointer is valid. This is best ensured by wrapping the widget with a QPointer (see above) since the BuiltinApplicationLauncher may delete the widget when it is told to kill the builtin application.
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 qtextended4.4 | |
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 ! |
Copyright © 2000-2012 - www.developpez.com