시작하기 Qt Quick Controls
컨트롤을 사용하는 QML 파일의 기본 예제는 다음과 같습니다:
import QtQuick
import QtQuick.Controls
ApplicationWindow {
title: "My Application"
width: 640
height: 480
visible: true
Button {
text: "Push Me"
anchors.centerIn: parent
}
}C++에서 컨트롤 설정하기
QQuickView 는 전통적으로 C++ 애플리케이션에서 QML 파일을 표시하는 데 사용되어 왔지만, 이렇게 하면 C++에서 창 속성만 설정할 수 있습니다.
Qt Quick Controls 을 사용할 때는 애플리케이션의 루트 항목으로 ` ApplicationWindow `을 선언하고, 대신 ` QQmlApplicationEngine `을 사용하여 실행하십시오. 이렇게 하면 QML에서 최상위 창 속성을 제어할 수 있습니다.
컨트롤을 활용하는 소스 파일의 기본 예제는 다음과 같습니다:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}QML에서 C++ 데이터 사용하기
QML에서 사용할 C++ 클래스를 등록해야 하는 경우, QQmlApplicationEngine 를 선언하기 전에 qmlRegisterType()를 호출할 수 있습니다. 자세한 내용은 C++에서 QML 유형 정의하기를 참조하십시오.
QML 컴포넌트에 데이터를 노출해야 하는 경우, 해당 데이터를 현재 QML 엔진의 컨텍스트에서 사용할 수 있도록 해야 합니다. 자세한 내용은 ` QQmlContext `을 참조하십시오.
© 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.