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로 설정합니다. 그렇지 않으면 거짓을 반환하고 ok 을 거짓으로 설정합니다.
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!=()도 참조하세요 .
© 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.