이 페이지에서

QtObject QML Type

기본 QML 유형입니다. 더 보기...

Import Statement: import QtQml
In C++: QObject
Inherited By:
135 types

AbstractButton, Action, ActionGroup, AllOfFilter, AnimatedImage, AnimatedSprite, AnyOfFilter, BorderImage, BusyIndicator, Button, ButtonGroup, Calendar, Canvas, CheckBox, CheckDelegate, ColorGroup, ColorOpacityAnimation, Column, ColumnLayout, ComboBox, Container, Control, DayOfWeekRow, DelayButton, Dial, Dialog, DialogButtonBox, DoubleSpinBox, Drawer, DropArea, EllipseShape, FilterBase, FlexboxLayout, Flickable, Flipable, Flow, FocusScope, Frame, FunctionFilter, FunctionSorter, Grid, GridLayout, GridView, GroupBox, HorizontalHeaderView, HorizontalHeaderViewDelegate, Image, ImageParticle, Item, ItemDelegate, ItemGrabResult, ItemParticle, Label, LayoutItemProxy, ListView, Loader, MaskShape, Menu, MenuBar, MenuBarItem, MenuItem, MenuSeparator, MonthGrid, MouseArea, MultiEffect, MultiPointTouchArea, Overlay, Page, PageIndicator, Palette, Pane, ParticlePainter, PathView, PinchArea, Popup, ProgressBar, RadioButton, RadioDelegate, RangeFilter, RangeSlider, Rectangle, RectangularShadow, RegExpFilter, Repeater, RoleFilter, RoleSorter, RoundButton, Row, RowLayout, ScrollBar, ScrollIndicator, ScrollView, SearchField, SelectionRectangle, Settings, ShaderEffect, ShaderEffectSource, Shape, Slider, Sorter, SpinBox, SplitHandle, SplitView, SpriteSequence, StackLayout, StackView, StandardPaths, StringSorter, SwipeDelegate, SwipeView, Switch, SwitchDelegate, SystemInformation, TabBar, TabButton, TableView, TableViewDelegate, Text, TextArea, TextEdit, TextField, TextInput, ToolBar, ToolButton, ToolSeparator, ToolTip, TreeView, TreeViewDelegate, Tumbler, ValueFilter, VectorImage, VerticalHeaderView, VerticalHeaderViewDelegate, WeekNumberColumn, and WindowContainer

속성

상세 설명

QtObject 유형은 ` objectName ` 속성만을 포함하는 비시각적 요소입니다.

일련의 사용자 정의 속성을 포함할 극도로 가벼운 타입이 필요한 경우 QtObject를 생성하는 것이 유용할 수 있습니다:

import QtQuick

Item {
    QtObject {
        id: attributes
        property string name
        property int size
        property variant attributes
    }

    Text { text: attributes.name }
}

또한 단순한 ` QObject`이므로 C++ 통합에도 유용할 수 있습니다. 자세한 내용은 QObject 문서를 참조하십시오.

속성 문서

objectName : string

이 속성은 해당 객체 인스턴스에 대한 ` QObject::objectName `를 보관합니다.

이를 통해 C++ 애플리케이션은 ` QObject::findChild()` 메서드를 사용하여 QML 컴포넌트 내에서 항목을 찾을 수 있습니다. 예를 들어, 다음 C++ 애플리케이션은 자식 ` Rectangle ` 항목을 찾아 ` color ` 값을 동적으로 변경합니다:

// MyRect.qml

import QtQuick 2.0

Item {
    width: 200; height: 200

    Rectangle {
        anchors.fill: parent
        color: "red"
        objectName: "myRect"
    }
}
// main.cpp

QQuickView view;
view.setSource(QUrl::fromLocalFile("MyRect.qml"));
view.show();

QQuickItem *item = view.rootObject()->findChild<QQuickItem*>("myRect");
if (item)
    item->setProperty("color", QColor(Qt::yellow));

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