[−][src]Struct qt_widgets::QStylePlugin
The QStylePlugin class provides an abstract base for custom QStyle plugins.
C++ class: QStylePlugin
.
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);
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)
.
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]
&self,
arg1: Call,
arg2: c_int,
arg3: *mut *mut c_void
) -> c_int
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]
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
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]
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
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()
.
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
impl RefUnwindSafe for QStylePlugin
impl Send for QStylePlugin
impl Sync for QStylePlugin
impl Unpin for QStylePlugin
impl UnwindSafe for QStylePlugin
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,