QIconEnginePlugin Class

The QIconEnginePlugin class provides an abstract base for custom QIconEngine 插件。 更多...

头: #include <QIconEnginePlugin>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
继承: QObject

公共函数

QIconEnginePlugin (QObject * parent = nullptr)
virtual ~QIconEnginePlugin ()
virtual QIconEngine * create (const QString & filename = QString()) = 0

详细描述

The icon engine plugin is a simple plugin interface that makes it easy to create custom icon engines that can be loaded dynamically into applications through QIcon . QIcon uses the file or resource name's suffix to determine what icon engine to use.

Writing a icon engine plugin is achieved by subclassing this base class, reimplementing the pure virtual function create (),和导出类采用 Q_PLUGIN_METADATA () 宏。

The json metadata should contain a list of icon engine keys that this plugin supports. The keys correspond to the suffix of the file or resource name used when the plugin was created. Keys are case insensitive.

{ "Keys": [ "myiconengine" ] }
					

另请参阅 如何创建 Qt 插件 .

成员函数文档编制

QIconEnginePlugin:: QIconEnginePlugin ( QObject * parent = nullptr)

Constructs a icon engine plugin with the given parent 。这被插件加载程序自动援引。

[virtual noexcept] QIconEnginePlugin:: ~QIconEnginePlugin ()

Destroys the icon engine plugin.

从不需要明确调用这。Qt 自动销毁插件当不再使用时。

[pure virtual] QIconEngine *QIconEnginePlugin:: create (const QString & filename = QString())

创建并返回 QIconEngine object for the icon with the given filename .