QMetaProperty Class

QMetaProperty 클래스는 프로퍼티에 대한 메타 데이터를 제공합니다. 더 보기...

Header: #include <QMetaProperty>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

공용 함수

(since 6.0) QUntypedBindable bindable(QObject *object) const
QMetaEnum enumerator() const
bool hasNotifySignal() const
(since 6.0) bool isBindable() const
bool isConstant() const
bool isDesignable() const
bool isEnumType() const
bool isFinal() const
bool isFlagType() const
bool isReadable() const
bool isRequired() const
bool isResettable() const
bool isScriptable() const
bool isStored() const
bool isUser() const
bool isValid() const
bool isWritable() const
(since 6.0) QMetaType metaType() const
const char *name() const
QMetaMethod notifySignal() const
int notifySignalIndex() const
int propertyIndex() const
QVariant read(const QObject *object) const
QVariant readOnGadget(const void *gadget) const
int relativePropertyIndex() const
bool reset(QObject *object) const
bool resetOnGadget(void *gadget) const
int revision() const
(since 6.0) int typeId() const
const char *typeName() const
int userType() const
bool write(QObject *object, const QVariant &value) const
(since 6.6) bool write(QObject *object, QVariant &&v) const
bool writeOnGadget(void *gadget, const QVariant &value) const
(since 6.6) bool writeOnGadget(void *gadget, QVariant &&value) const

상세 설명

프로퍼티 메타 데이터는 객체의 메타 객체에서 가져옵니다. 자세한 내용은 QMetaObject::property() 및 QMetaObject::propertyCount()를 참조하세요.

속성 메타 데이터

프로퍼티에는 name() 및 metaType()와 함께 isReadable(), isWritable(), isDesignable(), isScriptable(), revision() 및 isStored()와 같은 동작을 지정하는 다양한 어트리뷰트가 있습니다.

속성이 열거형인 경우 isEnumType()는 true 을 반환하고, 속성이 플래그이기도 한 열거형인 경우(즉, OR 연산자를 사용하여 값을 결합할 수 있는 경우) isEnumType()와 isFlagType()는 모두 참을 반환합니다. 이러한 유형의 열거자는 enumerator()에서 사용할 수 있습니다.

속성의 값은 read(), write() 및 reset()를 사용하여 설정 및 검색할 수 있으며 QObject 의 set 및 get 함수를 통해 변경할 수도 있습니다. 자세한 내용은 QObject::setProperty() 및 QObject::property()를 참조하세요.

복사 및 할당

QMetaProperty 객체는 값별로 복사할 수 있습니다. 그러나 각 복사본은 동일한 기본 속성 메타 데이터를 참조합니다.

QMetaObject, QMetaEnum, QMetaMethodQt의 속성 시스템도참조하십시오 .

멤버 함수 문서

[since 6.0] QUntypedBindable QMetaProperty::bindable(QObject *object) const

주어진 object 에서 프로퍼티의 바인딩 가능한 인터페이스를 반환합니다.

프로퍼티가 바인딩을 지원하지 않으면 반환된 인터페이스는 유효하지 않습니다.

이 함수는 Qt 6.0에 도입되었습니다.

QObjectBindableProperty, QProperty, 및 isBindable()도 참조하십시오 .

QMetaEnum QMetaProperty::enumerator() const

이 프로퍼티의 유형이 열거형인 경우 열거자를 반환하고, 그렇지 않으면 반환된 값이 정의되지 않습니다.

isEnumType() 및 isFlagType()도 참조하세요 .

bool QMetaProperty::hasNotifySignal() const

이 속성에 해당 변경 알림 신호가 있으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

notifySignal()도 참조하세요 .

[since 6.0] bool QMetaProperty::isBindable() const

Q_PROPERTY() 이 바인딩 기능을 노출하면 true 을 반환하고, 그렇지 않으면 false를 반환합니다.

이는 이 속성을 종속성으로 사용하는 바인딩을 만들거나 이 속성에 QPropertyObserver 객체를 설치할 수 있음을 의미합니다. 프로퍼티가 읽기 전용이 아니라면 이 프로퍼티에 바인딩을 설정할 수도 있습니다.

이 함수는 Qt 6.0에 도입되었습니다.

QProperty, isWritable() 및 bindable()도 참조하십시오 .

bool QMetaProperty::isConstant() const

속성이 상수인 경우 true 를 반환하고, 그렇지 않으면 false 을 반환합니다.

Q_PROPERTY()CONSTANT 속성이 설정된 경우 속성은 상수입니다.

bool QMetaProperty::isDesignable() const

Q_PROPERTY()DESIGNABLE 속성이 거짓이면 false 을 반환하고, 그렇지 않으면 true 을 반환합니다.

isScriptable() 및 isStored()도 참조하세요 .

bool QMetaProperty::isEnumType() const

속성의 유형이 열거형 값이면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

enumerator() 및 isFlagType()도 참조하세요 .

bool QMetaProperty::isFinal() const

속성이 최종적인 경우 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

Q_PROPERTY()FINAL 속성이 설정된 경우 속성은 최종 속성입니다.

bool QMetaProperty::isFlagType() const

속성 유형이 플래그로 사용되는 열거형 값인 경우 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

플래그는 OR 연산자를 사용하여 결합할 수 있습니다. 플래그 유형은 암시적으로 열거형이기도 합니다.

isEnumType(), enumerator() 및 QMetaEnum::isFlag()도 참조하세요 .

bool QMetaProperty::isReadable() const

이 속성을 읽을 수 있으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

isWritable(), read() 및 isValid()도 참조하세요 .

bool QMetaProperty::isRequired() const

속성이 필요한 경우 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

Q_PROPERTY()REQUIRED 속성이 설정된 경우 속성은 최종 속성입니다.

bool QMetaProperty::isResettable() const

이 속성을 기본값으로 재설정할 수 있으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

reset()도 참조하세요 .

bool QMetaProperty::isScriptable() const

Q_PROPERTY()SCRIPTABLE 속성이 거짓이면 false 을 반환하고, 그렇지 않으면 참을 반환합니다.

isDesignable() 및 isStored()도 참조하세요 .

bool QMetaProperty::isStored() const

속성이 저장되어 있으면 true 을 반환하고, 그렇지 않으면 false를 반환합니다.

Q_PROPERTY()STORED 속성이 거짓이면 false 을 반환하고, 그렇지 않으면 참을 반환합니다.

isDesignable() 및 isScriptable()도 참조하세요 .

bool QMetaProperty::isUser() const

Q_PROPERTY()USER 속성이 거짓이면 false 을 반환합니다. 그렇지 않으면 참을 반환하여 해당 속성이 USER 속성(즉, 사용자가 편집할 수 있거나 다른 방식으로 중요한 속성)으로 지정되었음을 나타냅니다.

QMetaObject::userProperty(), isDesignable() 및 isScriptable()도 참조하세요 .

bool QMetaProperty::isValid() const

이 속성이 유효(읽기 가능)하면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

isReadable()도 참조하세요 .

bool QMetaProperty::isWritable() const

이 속성이 쓰기 가능하면 true 을 반환하고, 그렇지 않으면 false를 반환합니다.

isReadable() 및 write()도 참조하세요 .

[since 6.0] QMetaType QMetaProperty::metaType() const

이 프로퍼티의 QMetaType 를 반환합니다.

이 함수는 Qt 6.0에 도입되었습니다.

QMetaType도 참조하십시오 .

const char *QMetaProperty::name() const

이 프로퍼티의 이름을 반환합니다.

type() 및 typeName()도 참조하세요 .

QMetaMethod QMetaProperty::notifySignal() const

지정된 경우 속성 변경 알림 신호의 QMetaMethod 인스턴스를 반환하고, 그렇지 않으면 유효하지 않은 QMetaMethod 을 반환합니다.

hasNotifySignal()도 참조하세요 .

int QMetaProperty::notifySignalIndex() const

지정한 경우 속성 변경 알림 신호의 인덱스를 반환하고, 그렇지 않으면 -1을 반환합니다.

hasNotifySignal()도 참조하세요 .

int QMetaProperty::propertyIndex() const

이 프로퍼티의 인덱스를 반환합니다.

QVariant QMetaProperty::read(const QObject *object) const

주어진 object 에서 프로퍼티의 값을 읽습니다. 값을 읽을 수 있으면 값을 반환하고, 그렇지 않으면 유효하지 않은 변형을 반환합니다.

write(), reset() 및 isReadable()도 참조하세요 .

QVariant QMetaProperty::readOnGadget(const void *gadget) const

주어진 gadget 에서 프로퍼티의 값을 읽습니다. 값을 읽을 수 있으면 값을 반환하고, 그렇지 않으면 유효하지 않은 변형을 반환합니다.

이 함수는 해당 프로퍼티가 Q_GADGET

int QMetaProperty::relativePropertyIndex() const

둘러싸는 메타 객체 내에서 상대적인 이 프로퍼티의 인덱스를 반환합니다.

bool QMetaProperty::reset(QObject *object) const

리셋 메서드를 사용하여 지정된 object 의 프로퍼티를 리셋합니다. 재설정이 성공하면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

리셋 메서드는 선택 사항이며 일부 속성만 지원합니다.

read() 및 write()도 참조하세요 .

bool QMetaProperty::resetOnGadget(void *gadget) const

리셋 메서드를 사용하여 지정된 gadget 의 프로퍼티를 리셋합니다. 재설정이 성공하면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

리셋 메서드는 선택 사항이며 일부 속성만 지원합니다.

이 함수는 다음과 같은 경우에만 사용해야 합니다. Q_GADGET

int QMetaProperty::revision() const

Q_REVISION 으로 지정된 경우 속성 개정판을 반환하고, 그렇지 않으면 0을 반환합니다. Qt 6.0부터 0이 아닌 값은 인코딩되며 QTypeRevision::fromEncodedVersion()을 사용하여 디코딩할 수 있습니다.

[since 6.0] int QMetaProperty::typeId() const

프로퍼티의 저장소 유형을 반환합니다. metaType ().id()와 동일합니다.

이 함수는 Qt 6.0에 도입되었습니다.

QMetaType, typeName() 및 metaType()도 참조하십시오 .

const char *QMetaProperty::typeName() const

이 프로퍼티의 유형 이름을 반환합니다.

type() 및 name()도 참조하세요 .

int QMetaProperty::userType() const

이 속성의 사용자 유형을 반환합니다. 반환 값은 QMetaType 에 등록된 값 중 하나입니다.

이는 metaType().id()와 동일합니다.

type(), QMetaType, typeName() 및 metaType()도 참조하세요 .

bool QMetaProperty::write(QObject *object, const QVariant &value) const

주어진 object 에 프로퍼티의 값으로 value 을 씁니다. 쓰기에 성공하면 true를 반환하고, 그렇지 않으면 false 를 반환합니다.

value 이 프로퍼티와 같은 유형이 아닌 경우 변환이 시도됩니다. 이 프로퍼티가 재설정 가능한 경우 빈 QVariant()는 reset()를 호출하거나 그렇지 않으면 기본으로 구성된 객체를 설정하는 것과 같습니다.

참고: 이 함수는 내부적으로 value 의 복사본을 만듭니다. 가능하면 rvalue 오버로드를 사용하는 것을 선호합니다.

read(), reset() 및 isWritable()도 참조하세요 .

[since 6.6] bool QMetaProperty::write(QObject *object, QVariant &&v) const

이 함수는 오버로드된 함수입니다.

이 함수는 Qt 6.6에 도입되었습니다.

bool QMetaProperty::writeOnGadget(void *gadget, const QVariant &value) const

주어진 gadget 에 프로퍼티의 값으로 value 을 씁니다. 쓰기에 성공하면 true를 반환하고, 그렇지 않으면 false 를 반환합니다.

이 함수는 프로퍼티의 프로퍼티가 Q_GADGET

[since 6.6] bool QMetaProperty::writeOnGadget(void *gadget, QVariant &&value) const

이 함수는 오버로드된 함수입니다.

이 함수는 Qt 6.6에 도입되었습니다.

© 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.