Struct qt_gui::QIconEngine

source ·
#[repr(C)]
pub struct QIconEngine { /* private fields */ }
Expand description

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.

Implementations§

source§

impl QIconEngine

source

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

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.

source

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

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.

source

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

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.

source

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

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.

source

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

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.

source

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

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.

source

pub unsafe fn clone(&self) -> Ptr<QIconEngine>

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.

source

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

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.

source

pub unsafe fn is_null(&self) -> bool

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.

source

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

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.

source

pub unsafe fn paint( &self, painter: impl CastInto<Ptr<QPainter>>, rect: impl CastInto<Ref<QRect>>, mode: Mode, state: State )

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.

source

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

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.

source

pub unsafe fn read(&self, in_: impl CastInto<Ref<QDataStream>>) -> bool

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.

source

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

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.

source

pub unsafe fn virtual_hook(&self, id: c_int, data: *mut c_void)

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.

source

pub unsafe fn write(&self, out: impl CastInto<Ref<QDataStream>>) -> bool

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§

source§

impl CppDeletable for QIconEngine

source§

unsafe fn delete(&self)

Destroys the icon engine.

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

C++ documentation:

Destroys the icon engine.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.