QIconEngine Class Reference

[ QtGui module]

The QIconEngine class provides an abstract base class for QIcon renderers. 更多...

Inherited by QIconEngineV2 .

方法


详细描述

The QIconEngine class provides an abstract base class for QIcon renderers.

使用 QIconEngineV2 代替。

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.

The icon is rendered by the paint () function, and the icon can additionally be obtained as a pixmap with the pixmap () function (the default implementation simply uses paint () to achieve this). The addPixmap () function can be used to add new pixmaps to the icon engine, and is used by QIcon to add specialized custom pixmaps.

paint (), pixmap (),和 addPixmap () functions are all virtual, and can therefore be reimplemented in subclasses of QIconEngine.


方法文档编制

QIconEngine.__init__ ( self )

QIconEngine.__init__ ( self , QIconEngine )

QSize QIconEngine.actualSize ( self , QSize   size , QIcon.Mode   mode , QIcon.State   state )

Returns the actual size of the icon the engine provides for the requested size , mode and state 。默认 implementation returns the given size .

QIconEngine.addFile ( self , QString  fileName , QSize   size , QIcon.Mode   mode , QIcon.State   state )

Called by QIcon.addFile (). Adds a specialized pixmap from the file with the given fileName , size , mode and state 。 default pixmap-based engine stores any supplied file names, and it loads the pixmaps on demand instead of using scaled pixmaps if the size of a pixmap matches the size of icon requested. Custom icon engines that implement scalable vector formats are free to ignores any extra files.

QIconEngine.addPixmap ( self , QPixmap   pixmap , QIcon.Mode   mode , QIcon.State   state )

Called by QIcon.addPixmap (). Adds a specialized pixmap 为给定 mode and state . The default pixmap-based engine stores any supplied pixmaps, and it uses them instead of scaled pixmaps if the size of a pixmap matches the size of icon requested. Custom icon engines that implement scalable vector formats are free to ignores any extra pixmaps.

QIconEngine.paint ( self , QPainter   painter , QRect   rect , QIcon.Mode   mode , QIcon.State   state )

This method is abstract and should be reimplemented in any sub-class.

Uses the given painter to paint the icon with the required mode and state into the rectangle rect .

QPixmap QIconEngine.pixmap ( self , QSize   size , QIcon.Mode   mode , QIcon.State   state )

Returns the icon as a pixmap with the required size , mode ,和 state . The default implementation creates a new pixmap and calls paint () to fill it.