Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a QT Plugin?

Tags:

c++

plugins

qt

qt4

What is a QT Plugin? What are differences between a qt plugin and a custom made qt library?

Thanks.

like image 764
metdos Avatar asked May 10 '10 13:05

metdos


People also ask

How do I use Qt plugins?

Because of the Binary and Source Compatibility rules of Qt Creator, the Qt Creator plugin wizard creates a plugin that might only compile and run with the same Qt Creator version that it was created with. Select File > New File or Project > Library > Qt Creator Plugin > Choose.

Where are Qt plugins?

The Plugin Directory In Qt, when an application starts, the application's executable directory is the base directory where Qt searches for plugins. For example, on Windows, if the application is in C:\Program Files\MyApp and it has a style plugin, Qt looks in C:\Program Files\MyApp\styles .

What is a Qt plugin platform?

Qt is a cross-platform software that was designed to create graphical user interfaces and cross-platform applications on Windows, Linux, macOS, and Android.

How do I install Qt plugins?

Note: You can install only plugins that are supported by your Qt Creator version. To install plugins: Select Help > About Plugins > Install Plugins. In the Source dialog, enter the path to the archive or library that contains the plugin.


2 Answers

AFAIK Qt plugins are implemented as shared libraries (.so on Unix/Linux and DLLs on Windows). The differences between them are the same as with plugins and libraries in general.

What this means is that, a plug-in architecture is independent of the linking method. They tend to be thought of as plug-in/dynamic linking and non-plug-in/static linking.

A core application specifies an interface and data exchange contract (i.e. an API) through which separate modules can interact with the application and expose functionality through the application. Just shipping new modules in DLLs does not address the need of a way for the application itself to discover these DLLs and to know how to execute the logic within. This is the essence of a plugin architecture. In general, DLL's expose only a list of procedures or functions. Variables, classes, objects inside the dll are not directly accessible to outside processes. Writing a plugin involves moving most or all of the relevant code into the DLL, where all variables and objects can be directly referenced.

Something like Eclipse, wherein you place you plugin in a pre-defined directory and the next time you click on some Menu you see new entries. All this without restarting your app or running a new version of the exe.

like image 195
Abhay Avatar answered Sep 29 '22 17:09

Abhay


The feature you call a Qt Plugin is formally a framework inside Qt that allows developers to propose a plugin system for their application. Qt Plugin handles the dynamic loading of the plugins that can be used through the plugin interface by the application. You can look at Qt Plugin documentation for more information and examples.

like image 24
Lohrun Avatar answered Sep 29 '22 17:09

Lohrun