QObjectRegistryRef Class
이 클래스는 C++ 코드에서 ObjectRegistry QML 유형으로 등록된 객체에 접근하는 데 사용됩니다. 더 보기...
| 헤더: | #include <QObjectRegistryRef> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS QmlDesignSupport) target_link_libraries(mytarget PRIVATE Qt6::QmlDesignSupport) |
| qmake: | QT += qmldesignsupport |
| 다음부터: | Qt 6.12부터 |
| QML에서: | MultiObjectRegistryRef 그리고 ObjectRegistryRef |
| 상속: | QAbstractObjectRegistryRef |
- 상속된 멤버를 포함한 모든 멤버 목록
- QObjectRegistryRef는 ‘Qt Qml ’ 디자인 지원 C++ 클래스의 일부입니다.
속성
- object : QObject*
공개 함수
| QObjectRegistryRef(QObject *parent = nullptr) | |
| QObjectRegistryRef(QQmlEngine *engine, QObject *parent = nullptr) | |
| QObjectRegistryRef(QQmlEngine *engine, const QString &key, QObject *parent = nullptr) | |
| QObject * | object() const |
신호
| void | objectChanged(QObject *object) |
재구현된 보호된 함수
| virtual bool | event(QEvent *event) override |
상세 설명
사용 예:
// Register object in a QML file
MouseArea {
ObjectRegistry.key: "MyMouseArea"
}
// In C++ code, refer to the registered object, using the QML engine you loaded the QML with
auto ref = new QObjectRegistryRef(engine, "MyMouseArea");
const auto object = ref->object();
connect(object, SIGNAL(clicked(QQuickMouseEvent*)),
this, SLOT(myClickHandler()));ObjectRegistry 및 QAbstractObjectRegistryRef::key도 참조하십시오 .
속성 문서
[read-only] object : QObject*
이 속성은 이 인스턴스가 참조하는 객체를 담습니다.
동일한 키로 여러 객체가 등록된 경우, 이 인스턴스가 참조하는 객체는 그중에서 임의로 선택된 객체입니다. 이 경우 대신 ` QMultiObjectRegistryRef `을 사용하십시오.
액세스 함수:
| QObject * | object() const |
Notifier 신호:
| void | objectChanged(QObject *object) |
ObjectRegistry 및 QAbstractObjectRegistryRef::key도 참조하십시오 .
멤버 함수 설명서
[explicit] QObjectRegistryRef::QObjectRegistryRef(QObject *parent = nullptr)
parent 를 사용하여 QObjectRegistryRef 인스턴스를 생성합니다.
참고: 키가 설정될 때 올바른 QML 엔진이 자동으로 해결되는 경우에만 이 생성자를사용하십시오 . 일반적으로 C++에서 이 클래스의 인스턴스를 생성할 때는 이러한 현상이 발생하지 않습니다. QML 엔진 포인터를 매개변수로 받는 생성자 중 하나를 사용하는 것이 좋습니다.
qmlEngine() 및 QAbstractObjectRegistryRef::key도 참조하십시오 .
[explicit] QObjectRegistryRef::QObjectRegistryRef(QQmlEngine *engine, QObject *parent = nullptr)
QML engine 및 parent 를 사용하여 QObjectRegistryRef 인스턴스를 생성합니다. 모든 등록은 지정된 QML 엔진에 국한됩니다.
QAbstractObjectRegistryRef::key도 참조하십시오 .
[explicit] QObjectRegistryRef::QObjectRegistryRef(QQmlEngine *engine, const QString &key, QObject *parent = nullptr)
QML engine, key 및 parent 를 사용하여 QObjectRegistryRef 인스턴스를 생성합니다. 모든 등록 항목은 지정된 QML 엔진에 한정됩니다.
QAbstractObjectRegistryRef::key도 참조하십시오 .
[override virtual protected] bool QObjectRegistryRef::event(QEvent *event)
QAbstractObjectRegistryRef::event(QEvent *event)를 재구현합니다.
© 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.