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  · 

QtDesigner Module

The QtDesigner module provides classes that allow you to create your own custom widget plugins for Qt Designer, and classes that enable you to access Qt Designer's components. More...

Classes

QAbstractExtensionFactoryInterface for extension factories in Qt Designer
QAbstractExtensionManagerInterface for extension managers in Qt Designer
QAbstractFormBuilderDefault implementation for classes that create user interfaces at run-time
QDesignerActionEditorInterfaceAllows you to change the focus of Qt Designer's action editor
QDesignerContainerExtensionAllows you to add pages to a custom multi-page container in Qt Designer's workspace
QDesignerCustomWidgetCollectionInterfaceAllows you to include several custom widgets in one single library
QDesignerCustomWidgetInterfaceEnables Qt Designer to access and construct custom widgets
QDesignerFormEditorInterfaceAllows you to access Qt Designer's various components
QDesignerFormWindowCursorInterfaceAllows you to query and modify a form window's widget selection, and in addition modify the properties of all the form's widgets
QDesignerFormWindowInterfaceAllows you to query and manipulate form windows appearing in Qt Designer's workspace
QDesignerFormWindowManagerInterfaceAllows you to manipulate the collection of form windows in Qt Designer, and control Qt Designer's form editing actions
QDesignerMemberSheetExtensionAllows you to manipulate a widget's member functions which is displayed when configuring connections using Qt Designer's mode for editing signals and slots
QDesignerObjectInspectorInterfaceAllows you to change the focus of Qt Designer's object inspector
QDesignerPropertyEditorInterfaceAllows you to query and manipulate the current state of Qt Designer's property editor
QDesignerPropertySheetExtensionAllows you to manipulate a widget's properties which is displayed in Qt Designer's property editor
QDesignerTaskMenuExtensionAllows you to add custom menu entries to Qt Designer's task menu
QDesignerWidgetBoxInterfaceAllows you to control the contents of Qt Designer's widget box
QExtensionFactoryAllows you to create a factory that is able to make instances of custom extensions in Qt Designer
QExtensionManagerExtension management facilities for Qt Designer
QFormBuilderUsed to dynamically construct user interfaces from .ui files at run-time

Detailed Description

The QtDesigner module provides classes that allow you to create your own custom widget plugins for Qt Designer, and classes that enable you to access Qt Designer's components.

In addition, the QFormBuilder class provides the possibility of constructing user interfaces from .ui files at run-time.

To include the definitions of the module's classes, use the following directive:

 #include <QtDesigner>

To link against the module, add this line to your qmake .pro file:

 CONFIG += designer

Creating Custom Widget Plugins

When implementing a custom widget plugin for Qt Designer, you must subclass QDesignerCustomWidgetInterface to expose your custom widget to Qt Designer. A single custom widget plugin is build as a separate library. If you want to include several custom widget plugins in the same library, you must in addition subclass QDesignerCustomWidgetCollectionInterface.

To provide your custom widget plugin with the expected behavior and functionality within Qt Designer's workspace you can subclass the associated extension classes:

The QDesignerContainerExtension class allows you to add pages to a custom multi-page container. The QDesignerTaskMenuExtension class allows you to add custom menu entries to Qt Designer's task menu. The QDesignerMemberSheetExtension class allows you to manipulate a widget's member functions which is displayed when configuring connections using Qt Designer's mode for editing signals and slots. And finally, the QDesignerPropertySheetExtension class allows you to manipulate a widget's properties which is displayed in Qt Designer's property editor.

In Qt Designer the extensions are not created until they are required. For that reason, when implementing extensions, you must also subclass QExtensionFactory, i.e create a class that is able to make instances of your extensions. In addition, you must make Qt Designer's extension manager register your factory; the extension manager controls the construction of extensions as they are required, and you can access it through QDesignerFormEditorInterface and QExtensionManager.

For a complete example creating a custom widget plugin with an extension, see the Task Menu Extension or Container Extension examples.

Retrieving Access to Qt Designer Components

The purpose of the classes mentioned in this section is to provide access to Qt Designer's components, managers and workspace, and they are not intended to be instantiated directly.

Qt Designer is composed by several components. It has an action editor, a property editor, widget box and object inspector which you can view in its workspace.

Qt Designer also has an object that works behind the scene; it contains the logic that integrates all of Qt Designer's components into a coherent application. You can access this object, using the QDesignerFormEditorInterface, to retrieve interfaces to Qt Designer's components:

In addition, you can use QDesignerFormEditorInterface to retrieve interfaces to Qt Designer's extension manager (QExtensionManager) and form window manager (QDesignerFormWindowManagerInterface). The extension manager controls the construction of extensions as they are required, while the form window manager controls the form windows appearing in Qt Designer's workspace.

Once you have an interface to Qt Designer's form window manager (QDesignerFormWindowManagerInterface), you also have access to all the form windows currently appearing in Qt Designer's workspace: The QDesignerFormWindowInterface class allows you to query and manipulate the form windows, and it provides an interface to the form windows' cursors. QDesignerFormWindowCursorInterface is a convenience class allowing you to query and modify a given form window's widget selection, and in addition modify the properties of all the form's widgets.

Creating User Interfaces at Run-Time

The QtDesigner module contains the QFormBuilder class that provides a mechanism for dynamically creating user interfaces at run-time, based on .ui files created with Qt Designer. This class is typically used by custom components and applications that embed Qt Designer. Standalone applications that need to dynamically generate user interfaces at run-time use the QUiLoader class, found in the QtUiTools module.

For a complete example using QUiLoader, see the Calculator Builder example.

See also Qt Designer Manual and QtUiTools Module.

[Previous: QtXml Module] [Qt's Modules] [Next: QtUiTools Module]

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

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 4.2
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