How to Create Qt Plugins

Qt provides two APIs for creating plugins:

  • A high-level API for writing extensions to Qt itself: custom database drivers, image formats, text codecs, custom styles, etc.

  • A low-level API for extending Qt applications.

For example, if you want to write a custom QStyle subclass and have Qt applications load it dynamically, you would use the higher-level API.

Since the higher-level API is built on top of the lower-level API, some issues are common to both.

If you want to provide plugins for use with Qt Designer, see the Qt Designer module documentation.

Topics:

The High-Level API: Writing Qt Extensions

Writing a plugin that extends Qt itself is achieved by subclassing the appropriate plugin base class, implementing a few functions, and adding a macro.

There are several plugin base classes. Derived plugins are stored by default in sub-directories of the standard plugin directory. Qt will not find plugins if they are not stored in the appropriate directory.

The following table summarizes the plugin base classes. Some of the classes are private, and are therefore not documented. You can use them, but there is no compatibility promise with later Qt versions.

Base Class

Directory Name

Qt Module

Key Case Sensitivity

QAccessibleBridgePlugin

accessiblebridge

Qt GUI

Case Sensitive

QImageIOPlugin

imageformats

Qt GUI

Case Sensitive

QPictureFormatPlugin (obsolete)

pictureformats

Qt GUI

Case Sensitive

QAudioSystemPlugin

audio

Qt Multimedia

Case Insensitive

QDeclarativeVideoBackendFactoryInterface

video/declarativevideobackend

Qt Multimedia

Case Insensitive

QGstBufferPoolPlugin

video/bufferpool

Qt Multimedia

Case Insensitive

QMediaPlaylistIOPlugin

playlistformats

Qt Multimedia

Case Insensitive

QMediaResourcePolicyPlugin

resourcepolicy

Qt Multimedia

Case Insensitive

QMediaServiceProviderPlugin

mediaservice

Qt Multimedia

Case Insensitive

QSGVideoNodeFactoryPlugin

video/videonode

Qt Multimedia

Case Insensitive

QBearerEnginePlugin

bearer

Qt Network

Case Sensitive

QPlatformInputContextPlugin

platforminputcontexts

Qt Platform Abstraction

Case Insensitive

QPlatformIntegrationPlugin

platforms

Qt Platform Abstraction