Source Code (Gui Example 32)
This example demonstrates how to use low level drawing methods to create a polygon shape and then set the pen to draw the border and the brush for the fill characteristics.
This example demonstrates how to use low level drawing methods to create a polygon shape and then set the pen to draw the border and the brush for the fill characteristics.
A common practice in a GUI application is the ability to press the tab key and move from one widget to another in some logical sequence. The tab ordering is initially set to mimic the order widgets are created. However, this might not match the tab order users expect. Let’s look at how we can create several widgets and then adjust the tab sequence, without rearranging the widget constructors.
A status message can be displayed on the bottom of a GUI main window. If the message is designated as “temporary” or only intended to be shown for a given time interval, it is displayed on the left side of the status bar. If the message is “permanent”, like showing the current line and column number in a document, this will be shown on the right side of the status bar and always visible.
The “What’s This” feature can be used to provide additional information about a menu option, push buttons or other widgets. This example adds “What’s This” help and also shows how to add a special question mark icon to a menu item and the tool bar for easy access to this feature.
A tool tip provides a hint or relevant additional information about the current object. In this example tool tips are added for several actions and the push buttons located on the central window. The hint will be displayed when the user hovers the mouse over the corresponding toolbar item or push button.
In this example a tool bar is added to a user application. A tool bar typically contains the most commonly used menu items. The same actions and icons used for the menu will be used on the tool bar.
This example will show how to create a user application which contains a top level menu. Adding a menu bar with icons and shortcuts is the next step in creating a graphical application.
This example uses a QTreeView with the QFileSystemModel to display the structure of a file system.
A QTreeView arranges a group of data elements based on a parent-child relationship. Top level items can be empty or have child items. Items which do have children can be expanded or collapsed and the child elements will be displayed or hidden. The QStandardItemModel will be used to store the data.
The QTableView class is used to display multiple rows and columns of data. This view makes sense when the data resides in a multi-dimensional container or a database. Since our data is stored in an SQL table we will use the QSqlTableModel to populate the view.
This example shows how to use a QListView to display a list of strings in a view where each row contains one item. Users can add, edit, and remove entries and the list will remain sorted. A string model is used to store the data and a proxy model is used to automatically sort the data.
This example shows several different frame styles which can be added to a variety of GUI widgets. A frame can also be used to group a collection of related widgets. The purpose of using a frame is to change the visual appearance of the boarder around a single widget or a group of widgets.
A common requirement for applications is to save user settings when an application is closed and then restore them the next time the application is opened. This example shows how to save information about the application and text the user has entered.
This example will show how to use check boxes and radio buttons on the pages of a Tab Widget. The layout of a tab page may contain any number of controls and the number of pages is unlimited.
The code in this example compares the three built in GUI widgets which are used to edit text. Each of these controls offers slightly different functionality and features.