The QIconEngineV2 class provides an abstract base class for QIcon renderers. 更多...
| 头: | #include <QIconEngineV2> |
| Since: | Qt 4.3 |
| 继承: | QIconEngine |
| class | AvailableSizesArgument |
| enum | IconEngineHook { AvailableSizesHook, IconNameHook } |
| QList<QSize> | availableSizes (QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) |
| virtual QIconEngineV2 * | clone () const |
| QString | iconName () |
| virtual QString | key () const |
| virtual bool | read (QDataStream & in ) |
| virtual void | virtual_hook (int id , void * data ) |
| virtual bool | write (QDataStream & out ) const |
The QIconEngineV2 class provides an abstract base class for QIcon renderers.
An icon engine renders QIcon s. With icon engines, you can customize icons. Qt provides a default engine that makes icons adhere to the current style by scaling the icons and providing a disabled appearance.
An engine is installed on an icon either through a QIcon constructor or through a QIconEnginePluginV2 . The plugins are used by Qt if a specific engine is not given when the icon is created. See the QIconEngineV2 class description to learn how to create icon engine plugins.
An icon engine provides the rendering functions for a QIcon . Each icon has a corresponding icon engine that is responsible for drawing the icon with a requested size, mode and state.
QIconEngineV2 extends the API of QIconEngine to allow streaming of the icon engine contents, and should be used instead of QIconEngine for implementing new icon engines.
另请参阅 QIconEnginePluginV2 .
These enum values are used for virtual_hook () to allow additional queries to icon engine without breaking binary compatibility.
| 常量 | 值 | 描述 |
|---|---|---|
QIconEngineV2::AvailableSizesHook
|
1
|
Allows to query the sizes of the contained pixmaps for pixmap-based engines. The data argument of the virtual_hook () function is a AvailableSizesArgument pointer that should be filled with icon sizes. Engines that work in terms of a scalable, vectorial format normally return an empty list. |
QIconEngineV2::IconNameHook
|
2
|
Allows to query the name used to create the icon, for example when instantiating an icon using QIcon::fromTheme (). |
该枚举在 Qt 4.5 引入或被修改。
另请参阅 virtual_hook ().
Returns sizes of all images that are contained in the engine for the specific mode and state .
注意: This is a helper method and the actual work is done by virtual_hook () method, hence this method depends on icon engine support and may not work with all icon engines.
该函数在 Qt 4.5 引入。
[虚拟]
QIconEngineV2
* QIconEngineV2::
clone
() const
Returns a clone of this icon engine.
返回用于创建引擎的名称,若可用。
注意: This is a helper method and the actual work is done by virtual_hook () method, hence this method depends on icon engine support and may not work with all icon engines.
该函数在 Qt 4.7 引入。
[虚拟]
QString
QIconEngineV2::
key
() const
Returns a key that identifies this icon engine.
[虚拟]
bool
QIconEngineV2::
read
(
QDataStream
&
in
)
Reads icon engine contents from the QDataStream in . Returns true if the contents were read; otherwise returns false.
QIconEngineV2 's default implementation always return false.
[虚拟]
void
QIconEngineV2::
virtual_hook
(
int
id
,
void
*
data
)
Additional method to allow extending QIconEngineV2 without adding new virtual methods (and without breaking binary compatibility). The actual action and format of data depends on id argument which is in fact a constant from IconEngineHook 枚举。
该函数在 Qt 4.5 引入。
另请参阅 IconEngineHook .
[虚拟]
bool
QIconEngineV2::
write
(
QDataStream
&
out
) const
Writes the contents of this engine to the QDataStream out . Returns true if the contents were written; otherwise returns false.
QIconEngineV2 's default implementation always return false.