Issue 28 · Q4 2008
Total Page:16
File Type:pdf, Size:1020Kb
Issue 28 · Q4 2008 Contents Spotlight on Qt Creator: The Cross-Platform IDE Qt 4.5 Beta Released & Available For Download . 1 Qt Creator is a no-frills, cross-platform, integrated Spotlight on Qt Creator: The Cross-Platform IDE . 2 development environment (IDE) for developing Qt Using QtHelp to Lend a Helping Hand . 4 projects. It is available for the Linux, Mac OS X, and Qt on Mac OS X using Cocoa . 6 Windows platforms. A sneak preview of Qt Creator was QtNews .............................................. 9 revealed during Qt Software’s Developer Days 2008; a Technology Preview was released on 30 October 2008. Qt 4.5 Beta Released & Available for Download Free of Clutter Qt Software has released a beta of Qt 4.5 – the upcoming Designed with the words “speed” and “efficiency” in mind, Qt version of its cross-platform application framework for Creator contains many helpful features, such as a smart code desktop and embedded development. Preview packages editor, a powerful file and code navigator, a GUI frontend for are now available to commercial and open source users the GNU Debugger (gdb), as well as Qt Designer and Qt Help for download, testing and feedback. integrations. This article highlights these features and sheds The upcoming Qt 4.5 release emphasizes performance and some light on how Qt Creator works. stability over pure feature improvements. Nonetheless, a num- ber of new features have been included to keep things interest- ing. Here are just a few of them. QtWebKit Improvements The QtWebKit module has been updated to reflect the latest development in the WebKit community. Some of the new fea- tures available for Qt 4.5 are support for Flash plugins, HTML 5 media element (to embed audio and video),CSS transforma- tions for animation, full-page zoom, and visual HTML editing. Web standards support has been improved as well, to achieve a 100% score in the ACID3 tests. In addition, SquirrelFish, a fast JavaScript engine, has been added to help boost the per- formance of rich-Internet applications. Qt Designer Improvements If you look closely at Qt Creator’s user interface, you will notice A lot of work has gone into improving Qt Designer’s usability. that it lets you use most of your screen’s real estate for your Among these improvements are: work, and stays out of the way as much as possible. Should • Icon Mode for the widget box which substantially reduces you require more space you can always remove the Projects scrolling. sidebar. • Morphing Widgets which lets you morph similar widget Locator types, e.g., a QWidget to a QFrame, via the context menu’s When developing applications, it is tricky to keep track of your Morph into entry. files and navigate your source code at the same time. Qt Cre- • Filters for the Property Editor that lets you find properties ator’s Locator feature lets you launch files that you need using or widgets quickly. a few keystrokes. • Find option for the Object Inspector that performs an incremental search on the form’s widgets. In addition, Qt Designer now features an Embedded Design tab that can be found in the Preferences dialog. Within this tab, you can define embedded device profiles. These profiles contain screen settings; e.g., display resolution, default font and default style. Qt Designer will use these settings when you edit forms. Learn More You can also navigate your source files to locate a particular class, method, line of code, and look up documentation for Qt More information about the Qt 4.5 Beta and packages for classes,as Locator knows about all the symbols in your opened different platforms can be obtained from the preview site: files. Simply type Ctrl+K followed by one of the prefixes below http://www.trolltech.com/developer/preview-qt-4.5 to begin. 2 Qt Quarterly Qt Creator’s Locator Prefixes Qt Designer Integration Qt Creator provides a set of prefixes to aid navigation: The Qt Designer Integration module is also provided with Qt • l, Space, line number: Creator. So you can design a form, write the necessary code, build and run your application within one single program. Go to a line in the current document. • :, Space, symbol name: Go to a symbol definition. • o, Space, document name: Go to an open document. • ?, Space, topic: Go to a help topic. • f, Space, file name: Go to a file in the file system. • a, Space, file name: Go to a file in any project currently loaded. Syntax Highlighting and Code Completion Qt Help Integration Qt Creator’s smart code editor includes syntax highlighting for Qt Creator is packaged with the Qt Help Integration plugin. codekeywords,preprocessor directives,andother context-sen- To look up information in Qt’s reference documentation and in sitive information. Qt Creator’s manual, simply switch to Help mode. For context If you work with many source files and projects concurrently, sensitive help, move your text cursor to a Qt class or function you will appreciate the code completion feature of Qt Creator.It and press F1. The image below shows the tooltip that appears not only completes classes and functions with parameter types when you hover over functions or classes. but also completes signals and slots. The screenshot below further illustrates this feature. Context sensitive help is displayed in a panel on the right so you can view it side-by-side with your source code. When you write code, Qt Creator collects all the symbols for your code in a structured database of symbols.Qt Creator then scans the symbols in this database for those most relevant to your incomplete input in order to present a selection of those Project Files and the Qt 4 Project Wizard that are syntactically correct. All this is done in real time, while you edit your code. Qt Creator uses qmake’s .pro file format for its project files. This avoids the introduction of yet another project file format Gdb Frontend and simplifies the process of importing existing Qt projects. Qt Creator does not have its own debugger.Instead,it provides Just load your .pro file and you are ready to go. a graphical frontend for the popular GNU Debugger (gdb). This Creating a project with Qt Creator is simplified with the frontend allows you to step through lines and instructions in a Project Generating Wizard. This provides the developer with program,interrupt running programs,set breakpoints,examine three options: Qt 4 Console Application, Qt 4 GUI Application, the contents of the call stack, local and global variables, and and C++ Library.If you select a Qt 4 GUI Application, a header so on. file, source file, .ui file, main.cpp file and a .pro file will be gener- Since Qt Creator is designed to simplify the process of de- ated for you. The header file and source file come with the nec- bugging Qt applications, it actually provides an additional fea- essary boilerplate code; the .pro file is also complete. ture: displaying the real objects of Qt classes and QTL con- A step-by-step tutorial about using the wizard is available in tainers. Qt Creator’s documentation. Press “Esc” to Escape The Esc key has a special function in Qt Creator: In Edit mode, the first time you press Esc, the editor will be given focus,without closing any secondary windows; e.g., the Help pane, Compile Output pane or Find toolbar. If you press Esc for the second time, all your secondary windows will be closed. In Debug and Help mode, the Esc key switches to Edit mode. Issue 28 Qt Quarterly3 Peeking Under the Hood Using QtHelp to Lend a Helping Hand The key to intelligent code completion and syntax highlight- Just as libraries like Qt are not complete without reference ing lies in the project manager. The code completer needs guides and API documentation, end user applications to resolve #include, #ifdef, and other directives. If Qt Cre- need to be distributed with manuals and online help. In ator cannot find foo.h, it is not possible to get code comple- their quest to assist with all aspects of the development tion for #include <foo.h>. So, the completion engine requires experience, the developers of Qt’s tools have provided a a well configured project with all paths declared in a qmake solution that you can use to keep your users informed. INCLUDEPATH variable. When the project is loaded, the project manager collects Qt 4.4 introduced so many new features for a minor release the files, the include paths, and the user’s DEFINES. After that, that one of them may have escaped many people’s notice. The a process similar to compiling is carried out, where a code QtHelp module replaces the QtAssistant module of previous model is created for each file in the project and held in a list. versions by providing a mechanism to integrate the Qt Assis- Qt Creator keeps this list model updated in real time. This tant application into applications, but it provides so much more completion engine is also used by the syntax highlighting than this. feature. In this article,we aim to cover some of the new features of the QtHelp module by providing online help for a simple application that happens to feature a scripting interface. As a result, we Latest Release and Future Improvements need to create some API documentation in addition to a user Currently, there are plans to make Qt Creator more robust for manual, so we will begin by looking at this problem. developing C++ code, as well as provide features for code gen- Getting Started with API Documentation eration and refactoring.