[][src]Struct qt_widgets::QStylePlugin

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

The QStylePlugin class provides an abstract base for custom QStyle plugins.

C++ class: QStylePlugin.

C++ documentation:

The QStylePlugin class provides an abstract base for custom QStyle plugins.

QStylePlugin is a simple plugin interface that makes it easy to create custom styles that can be loaded dynamically into applications using the QStyleFactory class.

Writing a style plugin is achieved by subclassing this base class, reimplementing the pure virtual create() function, and exporting the class using the Q_PLUGIN_METADATA() macro.

class MyStylePlugin : public QStylePlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "mystyleplugin.json") public: MyStylePlugin(QObject *parent = 0);

QStyle *create(const QString &key); };

The json metadata file mystyleplugin.json for the plugin needs to contain information about the names of the styles the plugins supports as follows:

{ "Keys": [ "Rocket", "Starbuster" ] }

See How to Create Qt Plugins for details.

Methods

impl QStylePlugin[src]

pub unsafe fn create(&self, key: impl CastInto<Ref<QString>>) -> QPtr<QStyle>[src]

Creates and returns a QStyle object for the given style key. If a plugin cannot create a style, it should return 0 instead.

Calls C++ function: pure virtual QStyle* QStylePlugin::create(const QString& key).

C++ documentation:

Creates and returns a QStyle object for the given style key. If a plugin cannot create a style, it should return 0 instead.

The style key is usually the class name of the required style. Note that the keys are case insensitive. For example:

QStyle *MyStylePlugin::create(const QString &key) { QString lcKey = key.toLower(); if (lcKey == "rocket") { return new RocketStyle; } else if (lcKey == "starbuster") { return new StarBusterStyle; } return 0; }

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QStylePlugin::metaObject() const.

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QStylePlugin::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QStylePlugin::qt_metacast(const char* arg1).

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn tr(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QStylePlugin::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QStylePlugin::trUtf8(const char* s, const char* c, int n).

Trait Implementations

impl CppDeletable for QStylePlugin[src]

unsafe fn delete(&self)[src]

Destroys the style plugin.

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

C++ documentation:

Destroys the style plugin.

Note that Qt destroys a plugin automatically when it is no longer used, so there is no need for calling the destructor explicitly.

impl Deref for QStylePlugin[src]

type Target = QObject

The resulting type after dereferencing.

fn deref(&self) -> &QObject[src]

Calls C++ function: QObject* static_cast<QObject*>(QStylePlugin* ptr).

impl DynamicCast<QStylePlugin> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QStylePlugin>[src]

Calls C++ function: QStylePlugin* dynamic_cast<QStylePlugin*>(QObject* ptr).

impl StaticDowncast<QStylePlugin> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QStylePlugin>[src]

Calls C++ function: QStylePlugin* static_cast<QStylePlugin*>(QObject* ptr).

impl StaticUpcast<QObject> for QStylePlugin[src]

unsafe fn static_upcast(ptr: Ptr<QStylePlugin>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QStylePlugin* ptr).

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.