Preparing to Migrate the User Interface[ Previous: Getting Started ] [ Home ] [ Next: Using Qt Standard Dialogs ]We are ready to start migrating the user interface for our project. As mentioned in the introduction, we do this in steps, ensuring that our application is still usable at every step of the migration process. The user interface can be viewed as a hierarchy; each top-level window and dialog depends upon a parent (which is another top-level window or dialog). When using Motif XmMainWindow widgets, these should be viewed as two separate entities: the Main Window widget with the popup-menu hierarchy and the View widget contained in the Main Window widget. The View widget depends on the Main Window widget. We begin migrating the pieces that have no dependencies, and work our way up the dependency tree until all the pieces have been migrated. The hierarchy for this project looks something like this:
We will begin by migrating and replacing all of the dialogs, then the Main Window widget with popup-menu hierarchy, and finally the View widget. However, we are not ready to begin just yet. The migration process can be long, but it does not have to be difficult. The Open, Save As, Page Delete and IO Error dialogs use Motif XmFileSelectionBox and XmMessageBox dialogs. Qt provides similar functionality with QFileDialog and QMessageBox, which we can begin using immediately. The Print dialog is special, however. The Print dialog cannot be replaced until after we have replaced the View widget. Qt provides a complete printing mechanism with QPrinter, but we cannot start using it until we have replaced the View widget.
Removing the Help DialogThe Help dialog is also special. Instead of replacing the Help dialog with a custom QDialog, we will use the Qt Help System classes to provide a more advanced online help. However, we cannot start using classes like QToolTip and QWhatsThis until we replace the Main Window and View widgets. The help text included with the original project is very small and only contains information about the XmNoteBook widget. The use of tooltips and whats-this text will suffice for this example. If your migration project has a large online help system, we recommend looking at the Simple HTML Help Browser example for information on how to build an rich text help system with hypertext navigation and full printing capabilities, or using Qt Assistant. Removing the existing Help dialog is relatively simple. We remove the Xmd/Help.h, Xmd/HelpP.h and Xmd/Help.c files from our project file and regenerate our Makefile. The code to create the Help menu and Help dialog is in todo.cpp. We remove the Xmd/Help.h include, the *help_manager resource string, the help_cb() function forward declaration and the help_widget global variable. We also need to remove the code that creates the Help dialog. We will also remove the code to create the Help menu, since this menu is now empty. Finally, we remove the help_cb() function implementation. The Help dialog is now removed from our project. We cannot add QToolTip and QWhatsThis help at the moment, since we are still using XmMainWindow for the Main Window widget. Once we have migrated the Main Window and the popup-menu hierarchy, we can begin using QToolTip and QWhatsThis for online help. [ Previous: Getting Started ] [ Home ] [ Next: Using Qt Standard Dialogs ]
|
Publicité
Best OfActualités les plus luesSemaine
Mois
Année
Le Qt Developer Network au hasardUtiliser QML et QtWebKit avec PySideLe 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 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 3.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 ! |
Copyright © 2000-2012 - www.developpez.com