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 には、以下を実行して得られた値が代入されます。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 の内容が文字列リテラルである場合は、その文字列を返します。それ以外の場合は、null 値のQString を返します。
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!=()も参照してください 。
© 2026 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.