Struct QQmlScriptString

Source
#[repr(C)]
pub struct QQmlScriptString { /* private fields */ }
Expand description

QQmlScriptString is used to create QObject properties that accept a script "assignment" from QML.

C++ class: QQmlScriptString.

C++ documentation:

QQmlScriptString is used to create QObject properties that accept a script “assignment” from QML.

Normally, the following QML would result in a binding being established for the script property; i.e. script would be assigned the value obtained from running myObj.value = Math.max(myValue, 100)

MyType { script: myObj.value = Math.max(myValue, 100) }

If instead the property had a type of QQmlScriptString, the script itself -- myObj.value = Math.max(myValue, 100) -- would be passed to the script property and the class could choose how to handle it. Typically, the class will evaluate the script at some later time using a QQmlExpression.

QQmlExpression expr(scriptString); expr.evaluate();

Implementations§

Source§

impl QQmlScriptString

Source

pub unsafe fn boolean_literal(&self, ok: *mut bool) -> bool

If the content of the QQmlScriptString is a boolean literal, returns the boolean value and sets ok to true. Otherwise returns false and sets ok to false.

Calls C++ function: bool QQmlScriptString::booleanLiteral(bool* ok) const.

C++ documentation:

If the content of the QQmlScriptString is a boolean literal, returns the boolean value and sets ok to true. Otherwise returns false and sets ok to false.

Source

pub unsafe fn copy_from( &self, arg1: impl CastInto<Ref<QQmlScriptString>>, ) -> Ref<QQmlScriptString>

Assigns other to this.

Calls C++ function: QQmlScriptString& QQmlScriptString::operator=(const QQmlScriptString& arg1).

C++ documentation:

Assigns other to this.

Source

pub unsafe fn is_empty(&self) -> bool

Returns whether the QQmlScriptString is empty.

Calls C++ function: bool QQmlScriptString::isEmpty() const.

C++ documentation:

Returns whether the QQmlScriptString is empty.

Source

pub unsafe fn is_null_literal(&self) -> bool

Returns whether the content of the QQmlScriptString is the null literal.

Calls C++ function: bool QQmlScriptString::isNullLiteral() const.

C++ documentation:

Returns whether the content of the QQmlScriptString is the null literal.

Source

pub unsafe fn is_undefined_literal(&self) -> bool

Returns whether the content of the QQmlScriptString is the undefined literal.

Calls C++ function: bool QQmlScriptString::isUndefinedLiteral() const.

C++ documentation:

Returns whether the content of the QQmlScriptString is the undefined literal.

Source

pub unsafe fn new() -> CppBox<QQmlScriptString>

Constructs an empty instance.

Calls C++ function: [constructor] void QQmlScriptString::QQmlScriptString().

C++ documentation:

Constructs an empty instance.

Source

pub unsafe fn new_copy( arg1: impl CastInto<Ref<QQmlScriptString>>, ) -> CppBox<QQmlScriptString>

Copies other.

Calls C++ function: [constructor] void QQmlScriptString::QQmlScriptString(const QQmlScriptString& arg1).

C++ documentation:

Copies other.

Source

pub unsafe fn number_literal(&self, ok: *mut bool) -> c_double

If the content of the QQmlScriptString is a number literal, returns that number and sets ok to true. Otherwise returns 0.0 and sets ok to false.

Calls C++ function: double QQmlScriptString::numberLiteral(bool* ok) const.

C++ documentation:

If the content of the QQmlScriptString is a number literal, returns that number and sets ok to true. Otherwise returns 0.0 and sets ok to false.

Source

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

If the content of the QQmlScriptString is a string literal, returns that string. Otherwise returns a null QString.

Calls C++ function: QString QQmlScriptString::stringLiteral() const.

C++ documentation:

If the content of the QQmlScriptString is a string literal, returns that string. Otherwise returns a null QString.

Trait Implementations§

Source§

impl CppDeletable for QQmlScriptString

Source§

unsafe fn delete(&self)

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

Source§

impl PartialEq<Ref<QQmlScriptString>> for QQmlScriptString

Source§

fn eq(&self, arg1: &Ref<QQmlScriptString>) -> bool

Returns true if this and the other QQmlScriptString objects are equal.

Calls C++ function: bool QQmlScriptString::operator==(const QQmlScriptString& arg1) const.

C++ documentation:

Returns true if this and the other QQmlScriptString objects are equal.

See also operator!=().

1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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>,

Source§

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>,

Source§

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.