Struct qmetaobject::qtdeclarative::QmlEngine[][src]

#[repr(C)]
pub struct QmlEngine { /* fields omitted */ }
Expand description

Wrap a Qt Application and a QmlEngine

Note that since there can only be one Application in the process, creating two QmlEngine at the same time is not allowed. Doing that will panic.

Implementations

impl QmlEngine[src]

pub fn new() -> QmlEngine[src]

Create a new QmlEngine

pub fn load_file(&mut self, path: QString)[src]

Loads a file as a qml file (See QQmlApplicationEngine::load(const QString & filePath))

pub fn load_url(&mut self, url: QUrl)[src]

Loads the root QML file located at url (See QQmlApplicationEngine::load(const QUrl &url))

pub fn load_data(&mut self, data: QByteArray)[src]

Loads qml data (See QQmlApplicationEngine::loadData)

pub fn load_data_as(&mut self, data: QByteArray, url: QUrl)[src]

Loads qml data with url as base url component (See QQmlApplicationEngine::loadData)

pub fn exec(&self)[src]

Launches the application

pub fn quit(&self)[src]

Closes the application

pub fn set_property(&mut self, name: QString, value: QVariant)[src]

Sets a property for this QML context (calls QQmlEngine::rootContext()->setContextProperty)

pub fn set_object_property<T: QObject + Sized>(
    &mut self,
    name: QString,
    obj: QObjectPinned<'_, T>
)
[src]

Sets a property for this QML context (calls QQmlEngine::rootContext()->setContextProperty)

pub fn invoke_method(&mut self, name: QByteArray, args: &[QVariant]) -> QVariant[src]

pub fn new_qobject<T: QObject>(&mut self, obj: T) -> QJSValue[src]

Give a QObject to the engine by wrapping it in a QJSValue

This will create the C++ object. Panic if the C++ object was already created.

pub fn add_import_path(&mut self, path: QString)[src]

Adds an import path for this QML engine (calls QQmlEngine::addImportPath)

pub fn cpp_ptr(&self) -> *mut c_void[src]

Returns a pointer to the C++ object. The pointer is of the type QQmlEngine * in C++.

Trait Implementations

impl Drop for QmlEngine[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

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

Performs the conversion.

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.

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

Performs the conversion.