Editing Signals and Slots
Qt Designer's connection editing mode allows objects in a form to be connected together using Qt's signals and slots mechanism. Both widgets and layout objects can be connected via an intuitive connection interface, and Qt Designer will present a menu of compatible signals and slots to use for each connection made. When the form is saved, the connections are preserved so that they will be ready for use when your project is built. Connecting ObjectsTo begin connecting objects, enter connection mode by opening the Edit menu and selecting Edit Signals/Slots, or by pressing the F4 key. All widgets and layout objects on the form can be connected together. Spacers just provide spacing hints to layouts, so they cannot be connected to other objects.
To make a connection, hold down the left mouse button over a highlighted object, and drag the cursor towards the object you want to connect it to. As you do this, a line will extend from the source object to the cursor. If the cursor is over another object on the form, the line will end with an arrow head that points to the destination object, indicating that a connection will be made between the two objects when you release the mouse button. You can abandon the connection at any point while you are dragging the connection path by pressing Escape.
When you are satisfied that the correct objects will be connected, release the mouse button to make the connection. A dialog displays the signals from the source object and the slots from the destination object that can be used to connect the two objects. To complete the connection, select a signal from the source object and a slot from the destination object, then click the OK button. Click Cancel if you wish to abandon the connection.
You can make as many connections as you like between objects on the form, and it is possible to connect signals from objects to slots in the form itself. As a result, the signal and slot connections in many dialogs can be completely configured from within Qt Designer.
Editing and Deleting ConnectionsBy default, connection paths are created with two labels that show the signal and slot involved in the connection. These labels are usually oriented along the line of the connection, and they can be moved around inside their host widgets by dragging the red square at each end of the connection path. The signal and slot used in a connection can be changed after it has been set up. To do this, simply double click on the connection path or one of its labels, and select the signal and slot to be used in the connection dialog.
[Previous: Using Containers in Qt Designer] [Contents] [Next: Qt Designer's Buddy Editing Mode] |
Publicité
Best OfActualités les plus luesSemaine
Mois
Année
Le Qt Quarterly au hasardQt s'associe avec le nouvel OS MeeGoQt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. Lire l'article.
CommunautéRessources
Liens utilesContact
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.0 | |
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