QQmlScriptString Class
QQmlScriptString クラスは、スクリプトとそのコンテキストをカプセル化します。詳細...
ヘッダ | #include <QQmlScriptString> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Qml) target_link_libraries(mytarget PRIVATE Qt6::Qml) |
qmake: | QT += qml |
パブリック関数
QQmlScriptString() | |
QQmlScriptString(const QQmlScriptString &other) | |
bool | booleanLiteral(bool *ok) const |
bool | isEmpty() const |
bool | isNullLiteral() const |
bool | isUndefinedLiteral() const |
qreal | numberLiteral(bool *ok) const |
QString | stringLiteral() const |
bool | operator!=(const QQmlScriptString &other) const |
QQmlScriptString & | operator=(const QQmlScriptString &other) |
bool | operator==(const QQmlScriptString &other) const |
詳しい説明
QQmlScriptString は、QML からスクリプトの "代入 "を受け付けるQObject プロパティを作成するために使用されます。
通常、次のような QML は、script
プロパティに対してバインディングを確立することになります。つまり、script
には、running から得られた値が代入されることになります。myObj.value = Math.max(myValue, 100)
MyType { script: myObj.value = Math.max(myValue, 100) }
もし、このプロパティがQQmlScriptString型であれば、スクリプトそのもの(myObj.value = Math.max(myValue, 100))がscript
プロパティに渡され、クラスはそのスクリプトをどのように扱うかを選択することができます。通常、クラスはQQmlExpression を使用して、後でスクリプトを評価します。
QQmlExpression expr(scriptString); expr.evaluate();
QQmlExpressionも参照してください 。
メンバ関数のドキュメント
QQmlScriptString::QQmlScriptString()
空のインスタンスを構築する。
QQmlScriptString::QQmlScriptString(const QQmlScriptString &other)
コピーother.
bool QQmlScriptString::booleanLiteral(bool *ok) const
QQmlScriptString の内容がブーリアンリテラルの場合、ブーリアン値を返し、ok を true に設定する。そうでない場合はfalseを返し、ok をfalseに設定する。
bool QQmlScriptString::isEmpty() const
QQmlScriptString が空かどうかを返します。
bool QQmlScriptString::isNullLiteral() const
QQmlScriptString の内容がnull
リテラルであるかどうかを返します。
bool QQmlScriptString::isUndefinedLiteral() const
QQmlScriptString の内容がundefined
リテラルであるかどうかを返します。
qreal QQmlScriptString::numberLiteral(bool *ok) const
QQmlScriptString の内容が数値リテラルであれば、その数値を返し、ok を true に設定する。そうでない場合は0.0を返し、ok をfalseに設定する。
QString QQmlScriptString::stringLiteral() const
QQmlScriptString の内容が文字列リテラルであれば、その文字列を返す。そうでない場合は、NULLQString を返す。
bool QQmlScriptString::operator!=(const QQmlScriptString &other) const
other QQmlScriptString オブジェクトと異なる場合はtrue
を返す。
operator==()も参照 。
QQmlScriptString &QQmlScriptString::operator=(const QQmlScriptString &other)
other 。
bool QQmlScriptString::operator==(const QQmlScriptString &other) const
other QQmlScriptString オブジェクトと等しい場合はtrue
を返す。
operator!=()も参照 。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.