Qt Widgets Examples

Lots of examples of how to use different kinds of widgets.

../_images/widget-examples.png

Qt comes with a large range of standard widgets that users of modern applications have come to expect.

You can also develop your own custom widgets and controls, and use them alongside standard widgets.

It is even possible to provide custom styles and themes for widgets that can be used to change the appearance of standard widgets and appropriately written custom widgets.

System Tray Icon Example

The System Tray Icon example shows how to add an icon with a menu and popup messages to a desktop environment’s system tray.

Analog Clock Example

The Analog Clock example shows how to draw the contents of a custom widget.

Calculator Example

The example shows how to use signals and slots to implement the functionality of a calculator widget, and how to use QGridLayout to place child widgets in a grid.

Calendar Widget Example

The Calendar Widget example shows use of QCalendarWidget.

Character Map Example

The Character Map example shows how to create a custom widget that can both display its own content and respond to user input.

Code Editor Example

The Code Editor example shows how to create a simple editor that has line numbers and that highlights the current line.

Digital Clock Example

The Digital Clock example shows how to use QLCDNumber to display a number with LCD-like digits.

Widgets Gallery Example

The Widgets Gallery example shows widgets relevant for designing UIs.

Group Box Example

The Group Box example shows how to use the different kinds of group boxes in Qt.

Icons Example

The Icons example shows how QIcon can generate pixmaps reflecting an icon’s state, mode and size.

Image Viewer Example

The example shows how to combine QLabel and QScrollArea to display an image.

Line Edits Example

The Line Edits example demonstrates the many ways that QLineEdit can be used, and shows the effects of various properties and validators on the input and output supplied by the user.

Movie Example

The Movie example demonstrates how to use QMovie and QLabel to display animations.

Scribble Example

The Scribble example shows how to reimplement some of QWidget’s event handlers to receive the events generated for the application’s widgets.

Shaped Clock Example

The Shaped Clock example shows how to apply a translucent background and a widget mask to a top-level widget to produce a shaped window.

Sliders Example

The Sliders example shows how to use the different types of sliders available in Qt: QSlider, QScrollBar and QDial.

Spin Boxes Example

The Spin Boxes example shows how to use the many different types of spin boxes available in Qt, from a simple QSpinBox widget to more complex editors like the QDateTimeEdit widget.

Styles Example

The Styles example illustrates how to create custom widget drawing styles using Qt, and demonstrates Qt’s predefined styles.

Style Sheet Example

The Style Sheet Example shows how to use style sheets.

Tablet Example

This example shows how to use a Wacom tablet in Qt applications.

Tetrix Example

The Tetrix example is a Qt version of the classic Tetrix game.

Tool Tips Example

The Tool Tips example shows how to provide static and dynamic tool tips for an application’s widgets.

Wiggly Example

The Wiggly example shows how to animate a widget using QBasicTimer and timerEvent(). In addition, the example demonstrates how to use QFontMetrics to determine the size of text on screen.

Window Flags Example

The Window Flags example shows how to use the window flags available in Qt.