반응형
사용예
qmlRegisterType<Hello>("testhello",1,0,"HiClass");
qmlRegisterType<클래스명명> ("사용할접근주소", 큰버전, 작은버전, "QML에서 쓸 이름");
사용법
1. 클래스 생성
위와같이 qDebug() 을 사용할경우 #include <QDebug> 선언이 필요합니다.
2. main.cpp 작성
qmlRegisterType<Hello>("testhello",1,0,"HiClass");
4. QML 아래와깉이 선언
Import testhello 1.0
아래와 같이 QML내에서 사용이 가능하다.
HiClass{
id : test
Component.onCompleted: {
test.test();
}
}
반응형
'programming > Qt' 카테고리의 다른 글
Qt d-bus 예제 (0) | 2016.02.11 |
---|---|
Virtualbox 에서 QtCreator 실행 (0) | 2016.02.02 |
qml signal /slot (0) | 2015.09.25 |
여러개의 파일 확장자 변경 유틸리티 (0) | 2012.07.03 |
Qt [UI] css를 이용한 버튼 효과주기 (0) | 2012.06.07 |