[][src]Struct qt_gui::QIconEngine

#[repr(C)]
pub struct QIconEngine { /* fields omitted */ }

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

C++ class: QIconEngine.

C++ documentation:

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

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.

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

Methods

impl QIconEngine[src]

pub unsafe fn actual_size(
    &mut self,
    size: impl CastInto<Ref<QSize>>,
    mode: Mode,
    state: State
) -> CppBox<QSize>
[src]

Returns the actual size of the icon the engine provides for the requested size, mode and state. The default implementation returns the given size.

Calls C++ function: virtual QSize QIconEngine::actualSize(const QSize& size, QIcon::Mode mode, QIcon::State state).

C++ documentation:

Returns the actual size of the icon the engine provides for the requested size, mode and state. The default implementation returns the given size.

pub unsafe fn add_file(
    &mut self,
    file_name: impl CastInto<Ref<QString>>,
    size: impl CastInto<Ref<QSize>>,
    mode: Mode,
    state: State
)
[src]

Called by QIcon::addFile(). Adds a specialized pixmap from the file with the given fileName, size, mode and state. The 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.

Calls C++ function: virtual void QIconEngine::addFile(const QString& fileName, const QSize& size, QIcon::Mode mode, QIcon::State state).

C++ documentation:

Called by QIcon::addFile(). Adds a specialized pixmap from the file with the given fileName, size, mode and state. The 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.

pub unsafe fn add_pixmap(
    &mut self,
    pixmap: impl CastInto<Ref<QPixmap>>,
    mode: Mode,
    state: State
)
[src]

Called by QIcon::addPixmap(). Adds a specialized pixmap for the given 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.

Calls C++ function: virtual void QIconEngine::addPixmap(const QPixmap& pixmap, QIcon::Mode mode, QIcon::State state).

C++ documentation:

Called by QIcon::addPixmap(). Adds a specialized pixmap for the given 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.

pub unsafe fn available_sizes_2a(
    &self,
    mode: Mode,
    state: State
) -> CppBox<QListOfQSize>
[src]

Returns sizes of all images that are contained in the engine for the specific mode and state.

Calls C++ function: virtual QList<QSize> QIconEngine::availableSizes(QIcon::Mode mode = …, QIcon::State state = …) const.

C++ documentation:

Returns sizes of all images that are contained in the engine for the specific mode and state.

Note: This is a helper method and the actual work is done by the virtual_hook() method, hence this method depends on icon engine support and may not work with all icon engines.

This function was introduced in Qt 4.5.

pub unsafe fn available_sizes_1a(&self, mode: Mode) -> CppBox<QListOfQSize>[src]

Returns sizes of all images that are contained in the engine for the specific mode and state.

Calls C++ function: virtual QList<QSize> QIconEngine::availableSizes(QIcon::Mode mode = …) const.

C++ documentation:

Returns sizes of all images that are contained in the engine for the specific mode and state.

Note: This is a helper method and the actual work is done by the virtual_hook() method, hence this method depends on icon engine support and may not work with all icon engines.

This function was introduced in Qt 4.5.

pub unsafe fn available_sizes_0a(&self) -> CppBox<QListOfQSize>[src]

Returns sizes of all images that are contained in the engine for the specific mode and state.

Calls C++ function: virtual QList<QSize> QIconEngine::availableSizes() const.

C++ documentation:

Returns sizes of all images that are contained in the engine for the specific mode and state.

Note: This is a helper method and the actual work is done by the virtual_hook() method, hence this method depends on icon engine support and may not work with all icon engines.

This function was introduced in Qt 4.5.

pub unsafe fn clone(&self) -> MutPtr<QIconEngine>[src]

Reimplement this method to return a clone of this icon engine.

Calls C++ function: pure virtual QIconEngine* QIconEngine::clone() const.

C++ documentation:

Reimplement this method to return a clone of this icon engine.

pub unsafe fn icon_name(&self) -> CppBox<QString>[src]

Returns the name used to create the engine, if available.

Calls C++ function: virtual QString QIconEngine::iconName() const.

C++ documentation:

Returns the name used to create the engine, if available.

Note: This is a helper method and the actual work is done by the virtual_hook() method, hence this method depends on icon engine support and may not work with all icon engines.

This function was introduced in Qt 4.7.

pub unsafe fn is_null(&self) -> bool[src]

Returns true if this icon engine represent a null QIcon.

Calls C++ function: bool QIconEngine::isNull() const.

C++ documentation:

Returns true if this icon engine represent a null QIcon.

Note: This is a helper method and the actual work is done by the virtual_hook() method, hence this method depends on icon engine support and may not work with all icon engines.

This function was introduced in Qt 5.7.

pub unsafe fn key(&self) -> CppBox<QString>[src]

Returns a key that identifies this icon engine.

Calls C++ function: virtual QString QIconEngine::key() const.

C++ documentation:

Returns a key that identifies this icon engine.

pub unsafe fn paint(
    &mut self,
    painter: impl CastInto<MutPtr<QPainter>>,
    rect: impl CastInto<Ref<QRect>>,
    mode: Mode,
    state: State
)
[src]

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

Calls C++ function: pure virtual void QIconEngine::paint(QPainter* painter, const QRect& rect, QIcon::Mode mode, QIcon::State state).

C++ documentation:

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

pub unsafe fn pixmap(
    &mut self,
    size: impl CastInto<Ref<QSize>>,
    mode: Mode,
    state: State
) -> CppBox<QPixmap>
[src]

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

Calls C++ function: virtual QPixmap QIconEngine::pixmap(const QSize& size, QIcon::Mode mode, QIcon::State state).

C++ documentation:

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

pub unsafe fn read(&mut self, in_: impl CastInto<MutRef<QDataStream>>) -> bool[src]

Reads icon engine contents from the QDataStream in. Returns true if the contents were read; otherwise returns false.

Calls C++ function: virtual bool QIconEngine::read(QDataStream& in).

C++ documentation:

Reads icon engine contents from the QDataStream in. Returns true if the contents were read; otherwise returns false.

QIconEngine's default implementation always return false.

pub unsafe fn scaled_pixmap(
    &mut self,
    size: impl CastInto<Ref<QSize>>,
    mode: Mode,
    state: State,
    scale: c_double
) -> CppBox<QPixmap>
[src]

Returns a pixmap for the given size, mode, state and scale.

Calls C++ function: QPixmap QIconEngine::scaledPixmap(const QSize& size, QIcon::Mode mode, QIcon::State state, double scale).

C++ documentation:

Returns a pixmap for the given size, mode, state and scale.

The scale argument is typically equal to the device pixel ratio of the display.

Note: This is a helper method and the actual work is done by the virtual_hook() method, hence this method depends on icon engine support and may not work with all icon engines.

Note: Some engines may cast scale to an integer.

This function was introduced in Qt 5.9.

See also ScaledPixmapArgument.

pub unsafe fn virtual_hook(
    &mut self,
    id: c_int,
    data: impl CastInto<MutPtr<c_void>>
)
[src]

Additional method to allow extending QIconEngine 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 enum.

Calls C++ function: virtual void QIconEngine::virtual_hook(int id, void* data).

C++ documentation:

Additional method to allow extending QIconEngine 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 enum.

This function was introduced in Qt 4.5.

See also IconEngineHook.

pub unsafe fn write(&self, out: impl CastInto<MutRef<QDataStream>>) -> bool[src]

Writes the contents of this engine to the QDataStream out. Returns true if the contents were written; otherwise returns false.

Calls C++ function: virtual bool QIconEngine::write(QDataStream& out) const.

C++ documentation:

Writes the contents of this engine to the QDataStream out. Returns true if the contents were written; otherwise returns false.

QIconEngine's default implementation always return false.

Trait Implementations

impl CppDeletable for QIconEngine[src]

unsafe fn delete(&mut self)[src]

Destroys the icon engine.

Calls C++ function: virtual [destructor] void QIconEngine::~QIconEngine().

C++ documentation:

Destroys the icon engine.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.