QUntypedBindable Class
QUntypedBindable은 T 에 정의된 모든 유형의 QProperty\<T\> 및 QObjectBindableProperty 과 같은 바인딩 가능한 속성을 포괄하는 통합 인터페이스입니다. 더 보기...
| 헤더: | #include <QUntypedBindable> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
| 다음부터: | Qt 6.0부터 |
| 상속된 버전: |
공개 함수
| QUntypedBindable() | |
| QUntypedBindable(Property *property) | |
| QPropertyNotifier | addNotifier(Functor f) |
| QUntypedPropertyBinding | binding() const |
| bool | hasBinding() const |
(since 6.1) bool | isReadOnly() const |
| bool | isValid() const |
| QUntypedPropertyBinding | makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) const |
(since 6.2) QMetaType | metaType() const |
| QPropertyChangeHandler<Functor> | onValueChanged(Functor f) const |
| bool | setBinding(const QUntypedPropertyBinding &binding) |
| QPropertyChangeHandler<Functor> | subscribe(Functor f) const |
(since 6.1) QUntypedPropertyBinding | takeBinding() |
상세 설명
QUntypedBindable은 바인더블 속성을 감싸는, 유형 정보가 완전히 제거된 제네릭 인터페이스입니다. 이 인터페이스를 사용하면 속성의 유형을 알 필요도 없고, 어떤 종류의 바인더블 속성인지(예: QProperty 또는 QObjectBindableProperty) 신경 쓸 필요 없이 속성과 상호작용할 수 있습니다. 대부분의 사용 사례에서는 QBindable<T>(속성 구현에 대해 제네릭이지만 고정된 유형을 가짐)를 사용하는 것이 더 바람직합니다.
멤버 함수 문서
[constexpr noexcept default] QUntypedBindable::QUntypedBindable()
QUntypedBindable을 기본 생성합니다. 이 객체는 유효하지 않은 상태입니다.
isValid()도 참조하십시오 .
template <typename Property> QUntypedBindable::QUntypedBindable(Property *property)
property 속성을 사용하여 QUntypedBindable 객체를 생성합니다. Property가 const인 경우, QUntypedBindable은 읽기 전용이 됩니다. property 가 null인 경우, QUntypedBindable은 유효하지 않게 됩니다.
isValid() 및 isReadOnly()도 참조하십시오 .
template <typename Functor> QPropertyNotifier QUntypedBindable::addNotifier(Functor f)
f 를 변경 핸들러로 등록합니다. 반환된 QPropertyNotifier 와 해당 속성이 유효한 상태로 유지되는 한, 기본 속성이 변경될 때마다 f 가 호출됩니다.
이 메서드는 반환되는 객체가 템플릿이 아니기 때문에, 경우에 따라 onValueChanged()보다 사용하기 더 편리합니다. 따라서 클래스의 멤버 변수 등으로 더 쉽게 저장할 수 있습니다.
onValueChanged() 및 subscribe()도 참조하십시오 .
QUntypedPropertyBinding QUntypedBindable::binding() const
해당 속성의 바인딩이 존재하면 이를 반환하고, 그렇지 않은 경우 기본 생성된 ` QUntypedPropertyBinding `를 반환합니다.
setBinding() 및 hasBinding()도 참조하십시오 .
bool QUntypedBindable::hasBinding() const
기본 속성에 바인딩이 설정되어 있으면 ` true `를 반환합니다.
[since 6.1] bool QUntypedBindable::isReadOnly() const
QUntypedBindable 가 읽기 전용인 경우 true를 반환합니다.
이 함수는 Qt 6.1에서 도입되었습니다.
bool QUntypedBindable::isValid() const
QUntypedBindable 가 유효한 경우 true를 반환합니다. 유효하지 않은 QUntypedBindable 에 대해 호출된 메서드는 별도로 명시되지 않는 한 일반적으로 아무런 효과도 없습니다.
QUntypedPropertyBinding QUntypedBindable::makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) const
지정된 소스 location 를 사용하여 기본 속성의 값을 반환하는 바인딩을 생성합니다.
[since 6.2] QMetaType QUntypedBindable::metaType() const
QUntypedBindable 가 생성된 속성의 메타타입을 반환합니다. 바인더블이 유효하지 않은 경우, 유효하지 않은 메타타입이 반환됩니다.
이 함수는 Qt 6.2에서 도입되었습니다.
isValid() 및 QUntypedPropertyBinding::valueMetaType()도 참조하십시오 .
template <typename Functor> QPropertyChangeHandler<Functor> QUntypedBindable::onValueChanged(Functor f) const
f 를 변경 핸들러로 등록합니다. 기본 속성이 변경될 때마다, 반환된 QPropertyChangeHandler 와 해당 속성이 유지되는 한 f 가 호출됩니다. 값이 변경될 때마다, 컨텍스트에 따라 핸들러가 즉시 호출되거나 호출이 연기됩니다.
QProperty::onValueChanged() 및 subscribe()도 참조하십시오 .
bool QUntypedBindable::setBinding(const QUntypedPropertyBinding &binding)
기본 속성의 바인딩을 ` binding`로 설정합니다. ` QUntypedBindable `가 읽기 전용이거나 null인 경우, 또는 ` binding`의 유형이 기본 속성의 유형과 일치하지 않는 경우에는 아무런 효과가 없습니다.
바인딩이 성공적으로 설정되면 true 를 반환합니다.
binding() 및 QUntypedPropertyBinding::valueMetaType()도 참조하십시오 .
template <typename Functor> QPropertyChangeHandler<Functor> QUntypedBindable::subscribe(Functor f) const
f 호출 뒤에 onValueChanged(f) 호출이 이어지는 것과 같은 동작을 합니다.
onValueChanged()도 참조하십시오 .
[since 6.1] QUntypedPropertyBinding QUntypedBindable::takeBinding()
속성에서 현재 설정된 바인딩을 제거하고 해당 속성을 반환합니다. 바인딩이 설정되어 있지 않은 경우, 기본 생성된 ` QUntypedPropertyBinding ` 객체를 반환합니다.
이 함수는 Qt 6.1에서 도입되었습니다.
© 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.