StylableControls QML Type
스타일 적용이 가능한 제어 유형을 포함하는 추상 기본 유형입니다. 더 보기...
| Import Statement: | import Qt.labs.StyleKit |
| Inherited By: | AbstractStyle, Style, StyleVariation, and Theme |
| Status: | Technology preview |
이 타입은 기술 미리보기 단계에 있으며, 향후 변경될 수 있습니다.
속성
- abstractButton : ControlStyle
- applicationWindow : ControlStyle
- busyIndicator : ControlStyle
- button : ControlStyle
- checkBox : ControlStyle
- checkDelegate : ControlStyle
- comboBox : ControlStyle
- control : ControlStyle
- delayButton : ControlStyle
- dial : ControlStyle
- dialog : ControlStyle
- dialogButtonBox : ControlStyle
- flatButton : ControlStyle
- frame : ControlStyle
- groupBox : ControlStyle
- itemDelegate : ControlStyle
- label : ControlStyle
- menu : ControlStyle
- menuBar : ControlStyle
- menuBarItem : ControlStyle
- menuItem : ControlStyle
- menuSeparator : ControlStyle
- page : ControlStyle
- pageIndicator : ControlStyle
- pane : ControlStyle
- popup : ControlStyle
- progressBar : ControlStyle
- radioButton : ControlStyle
- radioDelegate : ControlStyle
- roundButton : ControlStyle
- scrollBar : ControlStyle
- scrollIndicator : ControlStyle
- scrollView : ControlStyle
- searchField : ControlStyle
- slider : ControlStyle
- spinBox : ControlStyle
- swipeDelegate : ControlStyle
- switchControl : ControlStyle
- switchDelegate : ControlStyle
- tabBar : ControlStyle
- tabButton : ControlStyle
- textArea : ControlStyle
- textField : ControlStyle
- textInput : ControlStyle
- toolBar : ControlStyle
- toolButton : ControlStyle
- toolSeparator : ControlStyle
방법
- ControlStyle getControlStyle(controlType)
상세 설명
StylableControls는 추상 기본 유형입니다. 이 유형은 Style, Theme 또는 StyleVariation 을 통해 스타일을 지정할 수 있는 각 컨트롤 유형에 대한 ControlStyle 을 포함합니다.
이러한 컨트롤 유형들은 계층 구조를 이루며, 기본 유형에 설정된 속성은 더 구체적인 유형으로 하향 전파됩니다. 예를 들어, abstractButton.background.radius 에 반지름 4를 할당하면 button, checkBox, radioButton 과 같은 모든 버튼 유형의 반지름이 4가 됩니다.
이 페이지의 코드 예제는 각 컨트롤 유형의 스타일을 지정하는 데 사용할 수 있는 몇 가지 주요 속성을 보여주고 있지만, 이것이 전부는 아닙니다. ControlStyle 및 DelegateStyle 문서에 설명된 대로 사용할 수 있는 다른 많은 속성들이 있습니다. 실제로 fallback style 에서 이미 적절한 기본값을 제공하므로, 일부 속성은 생략할 수도 있습니다. 즉, 코드 예제 중 하나에서 특정 속성을 단순히 제거하더라도, 대신 대체 스타일이 적용되므로 외관에 실제로는 영향을 미치지 않을 수 있습니다.
참고: Qt.labs 모듈의 타입은 향후 버전에서 호환성이 보장되지 않습니다.
StyleKit 속성 해결항목도 참조하십시오 .
속성 문서
abstractButton : ControlStyle
Button, CheckBox, RadioButton, Switch 및 RoundButton 을 포함한 모든 버튼형 컨트롤의 스타일을 지정하기 위한 그룹화된 속성입니다. 속성이 설정되지 않은 경우 control 로 대체됩니다.
abstractButton.background.radius: 4 // all buttons get a radius of 4
checkBox.indicator.radius: 2 // except check boxes, which get a radius of 2'제어 유형'항목도 참조하십시오 .
applicationWindow : ControlStyle
ApplicationWindow 의 스타일을 지정하기 위한 그룹화된 속성.
설정되지 않은 속성은 control 로 대체됩니다.
applicationWindow 를 사용하여 창의 배경색을 설정합니다:
light: Theme {
applicationWindow.background.color: "#f0f0f0"
}
dark: Theme {
applicationWindow.background.color: "#404040"
}참고: 이 설정이 적용되려면애플리케이션에서 Window가 아닌 ApplicationWindow 를 사용해야 합니다.
busyIndicator : ControlStyle
BusyIndicator 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 로 대체됩니다.
busyIndicator {
background {
visible: false
width: 48
height: 48
}
indicator {
fillWidth: true
fillHeight: true
color: "transparent"
border.width: 0
foreground {
radius: 255
color: palette.accent
}
}
}StyleKit은 회전 표시기의 애니메이션을 스타일링하기 위한 전용 속성을 제공하지 않습니다. 회전 표시기의 모양이나 애니메이션을 변경하려면, 대신 사용자 정의 표시기 전경( delegate )을 구현해야 합니다:
busyIndicator {
background {
visible: false
width: 48
height: 48
}
indicator {
fillWidth: true
fillHeight: true
color: "transparent"
border.width: 0
foreground {
radius: 255
color: palette.accent
delegate: Text {
required property DelegateStyle delegateStyle
required property QtObject control
opacity: control.running ? 1 : 0
Behavior on opacity { NumberAnimation{} }
text: "↻"
color: delegateStyle.color
font.pixelSize: 20
RotationAnimation on rotation {
from: 0
to: 360
duration: 1000
loops: Animation.Infinite
running: control.running
}
}
}
}
}button : ControlStyle
Button 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 abstractButton 로 대체됩니다.
button {
background {
width: 120
height: 40
shadow {
opacity: 0.6
color: "gray"
verticalOffset: 2
horizontalOffset: 2
}
color: "cornflowerblue"
gradient: Gradient {
// The gradient is drawn on top of the 'background.color', so
// we use semi-transparent stops to give the button some shading
// while letting the base color show through. This makes it easier
// to change the color, but keep the shading, in the hovered state below.
GradientStop { position: 0.0; color: Qt.alpha("black", 0.0)}
GradientStop { position: 1.0; color: Qt.alpha("black", 0.2)}
}
}
text.color: "white"
hovered.background.color: "royalblue"
pressed.background.scale: 0.95
}checkBox : ControlStyle
CheckBox 의 스타일링을 위한 그룹화된 속성.
설정되지 않은 속성은 abstractButton 로 대체됩니다.
checkBox {
// Hide the button background; show only the indicator and text
background.visible: false
indicator {
color: "white"
border.color: "darkslategray"
foreground {
color: "transparent"
image.source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/check.png"
image.color: palette.accent
// Hide the checkmark when the checkbox is not checked
visible: false
}
}
// Show the checkmark when the checkbox is checked
checked.indicator.foreground.visible: true
}checkDelegate : ControlStyle
CheckDelegate 의 스타일 지정을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 itemDelegate 로 대체됩니다.
checkDelegate {
text.alignment: Qt.AlignHCenter | Qt.AlignVCenter
background {
radius: 0
color: "white"
border.width: 0
}
indicator {
border.color: "darkslategray"
foreground {
color: "transparent"
image.source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/check.png"
image.color: palette.accent
// Hide the checkmark when the checkbox is not checked
visible: false
}
}
hovered.background.color: "#f0f0f0"
// Show the checkmark when the checkbox is checked
checked.indicator.foreground.visible: true
}comboBox : ControlStyle
ComboBox 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 로 대체됩니다.
참고: 팝업의스타일은 ` popup`을 통해, 항목의 스타일은 ` itemDelegate`을 통해 지정하십시오.
comboBox {
text.alignment: Qt.AlignHCenter | Qt.AlignVCenter
background.topLeftRadius: 4
background.topRightRadius: 4
indicator {
// Show only the dropdown arrow, not the indicator background
color: "transparent"
border.width: 0
foreground {
image.source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/drop-indicator.png"
image.color: "black"
}
}
}control : ControlStyle
모든 컨트롤의 스타일을 지정하기 위한 그룹화된 속성입니다.
control 이는 컨트롤 계층 구조의 기본 유형이며, 여기에 설정된 속성은 다른 모든 컨트롤 유형에 대한 기본값으로 사용됩니다. 예를 들어, ` control.width: 200 `를 설정하면 버튼, 스크롤 표시기 및 기타 모든 컨트롤을 포함하여 모든 컨트롤의 너비가 200픽셀로 설정됩니다. 또한 스타일 계층 구조에서 상위 레벨( Theme 의 경우 Style, Style 의 경우 fallbackStyle )로부터 상속받은 모든 값(호버 효과 및 기타 상태 기반 동작 포함 )을 재정의합니다. control 는 신중하게 사용하고, 가능하면 abstractButton 나 pane 와 같이 더 구체적인 기본 유형을 우선적으로 사용하십시오.
control {
padding: 8
background.radius: 4
}delayButton : ControlStyle
DelayButton 의 스타일을 지정하기 위한 그룹화된 속성입니다.
지연 버튼의 경우, 진행 상태는 표시기를 통해 표현됩니다. 기본적으로 표시기 자체는 투명하고 테두리가 없으므로, 표시기가 채워질 때 표시기의 전경색만 보입니다.
설정되지 않은 속성은 abstractButton 로 대체됩니다.
delayButton {
padding: 0
indicator {
fillWidth: true
fillHeight: true
color: "transparent"
border.width: 0
foreground.color: palette.accent
}
checked.indicator.foreground.color: palette.accent.darker(1.2)
}dial : ControlStyle
Dial 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 로 대체됩니다.
dial {
spacing: 0
handle.width: 15
handle.height: 15
background.visible: false
indicator {
width: 60
height: 60
radius: 255
foreground {
fillWidth: true
fillHeight: true
width: 6
height: 6
color: palette.accent
}
}
}dialog : ControlStyle
Dialog 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 popup 로 대체됩니다.
dialog {
text {
padding: 12
alignment: Qt.AlignHCenter | Qt.AlignVCenter
}
background.color: "white"
}dialogButtonBox : ControlStyle
DialogButtonBox 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 pane 로 대체됩니다.
dialogButtonBox {
background {
height: 40
radius: 0
color: "transparent"
border.width: 0
}
}flatButton : ControlStyle
플랫 버튼(일반 상태에서 배경이 보이지 않는 버튼)의 스타일을 지정하기 위한 그룹화된 속성입니다. ` Button.flat `이 ` true`로 설정된 경우, 이 스타일은 ` Button `에 적용됩니다.
설정되지 않은 속성은 기본값인 ` abstractButton`으로 복원됩니다.
flatButton {
// Hide background normally, show on hover
background.visible: false
hovered.background.visible: true
}frame : ControlStyle
스타일링을 위한 그룹화된 속성 Frame.
설정되지 않은 속성은 pane 로 대체됩니다.
frame {
background {
color: "#fafafa"
border.color: "#d0d0d0"
radius: 4
}
}groupBox : ControlStyle
GroupBox 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 frame 로 대체됩니다.
groupBox {
// A group box is a container for other controls, so we give it some
// padding to avoid the child controls to be too close to the border
padding: 20
// Move the label to the right, to match the radius of the background
text.leftPadding: 6
text.color: "darkslategray"
background {
// Move the frame down, below the text label
topMargin: 30
radius: 6
color: "#f8f8f8"
border.color: "#d0d0d0"
}
}itemDelegate : ControlStyle
ItemDelegate 의 스타일을 지정하기 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 로 대체됩니다.
참고: Qt Quick Controls에서는 ItemDelegate 가 AbstractButton 로부터 상속받습니다. 그러나 StyleKit에서는 itemDelegate 가 abstractButton 대신 control 로 대체되는데, 이는 델리게이트의 스타일이 일반적으로 버튼과는 매우 다르게 적용되기 때문입니다(플랫 디자인, 테두리나 드롭 섀도우 없음 등).
itemDelegate {
text.alignment: Qt.AlignVCenter | Qt.AlignLeft
background {
radius: 0
color: "white"
border.width: 0
}
hovered.background.color: "#f0f0f0"
}label : ControlStyle
Label 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 으로 대체됩니다.
light: Theme {
// Labels typically have no background, so set background.visible to false.
// Alternatively, hiding the background for labels can be done once for all
// themes by setting Style.label.background.visible: false.
label.background.visible: false
label.text.color: "black"
}
dark: Theme {
label.background.visible: false
label.text.color: "white"
}menu : ControlStyle
Menu 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 popup 로 대체됩니다.
menu {
background {
width: 200
height: 40
border.color: "darkslategray"
radius: 4
}
}menuBar : ControlStyle
MenuBar 의 스타일링을 위한 그룹화된 속성.
설정되지 않은 속성은 control 로 대체됩니다.
참고: MenuBar, MenuBarItem 및 MenuSeparator 에스타일을 적용해도 일반적으로 네이티브가 아닌 메뉴 바에만 영향을 미칩니다. MenuBar 가 네이티브 메뉴 바로 구현된 경우, 해당 델리게이트는 렌더링에 사용되지 않으므로 StyleKit 스타일 속성이 시각적인 효과를 나타내지 않을 수 있습니다. 자세한 내용은 ‘네이티브 메뉴 바’를 참조하십시오.
menuBar {
background {
radius: 0
border.width: 0
}
}menuBarItem : ControlStyle
MenuBar 에서 메뉴 항목의 스타일을 지정하기 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 로 대체됩니다.
참고: Qt Quick Controls에서는 MenuBarItem 가 AbstractButton 를 상속받습니다. 그러나 StyleKit에서는 menuBarItem 가 별도의 컨트롤 유형으로, 메뉴 바 항목은 일반적으로 일반 버튼(플랫 디자인, 테두리나 드롭 섀도우 없음 등)과는 매우 다른 스타일을 가지기 때문에 abstractButton 대신 control 로 대체됩니다.
menuBarItem {
text.alignment: Qt.AlignLeft | Qt.AlignVCenter
background {
radius: 0
color: "transparent"
border.width: 0
}
hovered.background.color: "#c0c0c0"
}menuItem : ControlStyle
MenuItem 의 스타일링을 위한 그룹화된 속성.
설정되지 않은 속성은 control 로 대체됩니다.
참고: Qt Quick Controls에서는 ` MenuItem `가 ` AbstractButton`에서 상속됩니다. 그러나 StyleKit에서는 메뉴 항목의 스타일이 일반 버튼과 크게 다르기 때문에(플랫 디자인, 테두리나 드롭 섀도우 없음 등), ` menuItem `는 ` abstractButton` 대신 ` control `로 대체됩니다.
menuItem {
text.alignment: Qt.AlignVCenter | Qt.AlignLeft
background {
width: 200
border.width: 0
}
indicator {
color: "transparent"
border.width: 0
foreground {
image.color: palette.accent
alignment: Qt.AlignCenter
}
first {
alignment: Qt.AlignLeft
foreground.image.source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/check.png"
}
second {
alignment: Qt.AlignRight
foreground.image.source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/arrow-indicator.png"
}
}
hovered.background.color: "#c0c0c0"
}menuSeparator : ControlStyle
MenuSeparator 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 로 대체됩니다.
menuSeparator {
background.visible: false
indicator {
width: 188
height: 1
border.width: 0
color: "#c0c0c0"
foreground.visible: false
}
}page : ControlStyle
스타일링을 위한 그룹화된 속성 Page.
설정되지 않은 속성은 pane 로 대체됩니다.
Page 의 header 및 footer 는 일반적으로 애플리케이션에 의해 ToolBar 또는 TabBar 로 설정되며, 해당 컨트롤은 별도로 스타일이 적용된다는 점에 유의하십시오. Page 내에서 ToolBar 에 대체 스타일을 적용하려면 StyleVariation 를 사용하십시오:
page {
background {
color: "white"
border.width: 0
}
variations: StyleVariation {
toolBar.background.color: "cornflowerblue"
toolButton.background.color: "skyblue"
toolButton.background.border.color: "aliceblue"
}
}pageIndicator : ControlStyle
PageIndicator 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 로 대체됩니다.
pageIndicator {
background.visible: false
indicator {
width: 5
height: 5
radius: 255
border.width: 0
color: "black"
opacity: 0.45
foreground.visible: false
}
hovered.indicator {
width: 6
height: 6
opacity: 0.7
}
pressed.indicator {
width: 4
height: 4
}
checked.indicator {
width: 7
height: 7
}
checked.hovered.indicator {
width: 8
height: 8
opacity: 0.7
}
}pane : ControlStyle
Pane 의 스타일 지정을 위한 그룹화된 속성.
설정되지 않은 속성은 control 로 대체됩니다.
pane {
background {
width: 200
height: 200
color: "white"
}
}popup : ControlStyle
Popup 에 대한 스타일링을 위한 그룹화된 속성.
설정되지 않은 속성은 control 로 대체됩니다.
popup {
background {
color: "white"
border.width: 1
border.color: "darkslategray"
radius: 4
}
}progressBar : ControlStyle
스타일 지정을 위한 그룹화된 속성 ProgressBar. 진행률 표시줄의 경우, 홈(groove)은 인디케이터를 통해 스타일이 지정되고, 진행률 트랙은 인디케이터의 전경색을 통해 스타일이 지정됩니다.
설정되지 않은 속성은 control 로 대체됩니다.
progressBar {
// Hide the background; show only the progress bar
background.visible: false
indicator {
width: 150
height: 8
radius: 4
color: "#e0e0e0"
foreground {
// Set margins to add some space between the progress track and the groove
margins: 2
color: palette.accent
radius: 4
}
}
}StyleKit은 진행 바의 불확정 애니메이션을 스타일링하기 위한 전용 속성을 제공하지 않습니다. 애니메이션을 변경하려면 대신 사용자 정의 인디케이터 전경( delegate )을 구현해야 합니다:
progressBar {
indicator {
width: 150
height: 8
foreground {
delegate: StyledItem {
// Draw a pulsating progress track when in indeterminate mode, and a normal track otherwise
width: control.indeterminate ? parent.width : parent.width * control.visualPosition
height: parent.height
opacity: control.indeterminate ? 0.1 : 1.0
SequentialAnimation on opacity {
running: control.indeterminate
loops: Animation.Infinite
NumberAnimation { from: 0.1; to: 1.0; duration: 500; easing.type: Easing.InOutQuad }
NumberAnimation { from: 1.0; to: 0.1; duration: 500; easing.type: Easing.InOutQuad }
}
}
}
}
}radioButton : ControlStyle
RadioButton 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 abstractButton 로 대체됩니다.
radioButton {
// Hide the button background; show only the indicator and text
background.visible: false
indicator {
// Make the indicator circular
radius: 255
foreground {
// The foreground circle is what shows the checked state, so we make
// it a bit smaller than the outer circle by setting margins
margins: 4
radius: 255
// Hide the foreground circle when the radio button is not checked
visible: false
}
}
// Show the foreground circle when the radio button is checked
checked.indicator.foreground.visible: true
}radioDelegate : ControlStyle
RadioDelegate 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 itemDelegate 로 대체됩니다.
radioDelegate {
text.alignment: Qt.AlignVCenter | Qt.AlignLeft
background {
radius: 0
color: "white"
border.width: 0
}
indicator {
radius: 255
foreground {
margins: 4
visible: false
radius: 255
color: palette.accent
}
}
hovered.background.color: "#f0f0f0"
checked.indicator.foreground.visible: true
}roundButton : ControlStyle
RoundButton 의 스타일을 지정하기 위한 그룹화된 속성입니다.
설정되지 않은 속성은 abstractButton 로 대체됩니다.
roundButton {
background.radius: 255
text.alignment: Qt.AlignVCenter | Qt.AlignHCenter
}scrollBar : ControlStyle
ScrollBar 의 스타일을 지정하기 위한 그룹화된 속성입니다. 홈의 스타일은 background 을 통해, 손잡이의 스타일은 indicator 을 통해 지정됩니다.
설정되지 않은 속성은 control 로 대체됩니다.
scrollBar {
padding: 0
background {
// Set the groove size and color
width: 10
height: 10
color: "white"
}
indicator {
radius: 255
fillWidth: true
width: 10
height: 10
color: "#c0c0c0"
// The indicator is so simple that it doesn't need a foreground
foreground.visible: false
}
vertical {
indicator {
// In vertical mode, the indicator should stretch vertically
// to fill the available height rather than the available width.
fillWidth: false
fillHeight: true
}
}
}scrollIndicator : ControlStyle
ScrollIndicator 의 스타일을 지정하기 위한 그룹화된 속성입니다. 홈의 스타일은 background 를 통해, 손잡이의 스타일은 indicator 를 통해 지정됩니다.
설정되지 않은 속성은 control 로 복원됩니다.
scrollIndicator {
// A scroll indicator typically has no groove, just a sliding
// indicator. So hide the background, since it represents the groove.
background.visible: false
indicator {
fillWidth: true
width: 5
height: 5
border.width: 0
color: "cornflowerblue"
// The indicator is so simple that it doesn't need a foreground
foreground.visible: false
}
vertical {
indicator {
// In vertical mode, the indicator should stretch vertically
// to fill the available height rather than the available width.
fillWidth: false
fillHeight: true
}
}
}scrollView : ControlStyle
ScrollView 의 스타일을 지정하기 위한 그룹화된 속성입니다.
ScrollView 이 속성 자체에는 스타일을 적용할 시각적 대상을 포함하지 않습니다. 스크롤 막대는 scrollBar 속성을 통해 별도로 스타일을 지정할 수 있습니다. 하지만 padding 를 사용하여 스크롤 막대와 콘텐츠 영역 사이의 간격을 제어할 수 있습니다.
설정이 해제된 속성은 control 값으로 기본값이 적용됩니다.
scrollView {
// Add some space between the scroll bars and the content area
padding: 2
// For the sake of the example, style the scroll bars in a ScrollView
// differently from the default scroll bars by using a StyleVariation.
variations: StyleVariation {
scrollBar.indicator.color: "cornflowerblue"
}
}searchField : ControlStyle
SearchField 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 로 대체됩니다.
searchField {
// Center the text between the buttons
text.padding: 5
text.alignment: Qt.AlignVCenter | Qt.AlignLeft
text.color: "black"
background.width: 200
indicator {
color: "transparent"
border.width: 0
foreground{
alignment: Qt.AlignCenter
}
// Place the search and clear buttons on the left and right side of the control
// search button
first {
alignment: Qt.AlignLeft
image.color: "black"
image.source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/search-magnifier.png"
}
// clear button
second {
alignment: Qt.AlignRight
image.color: "black"
image.source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/close_circle.png"
}
}
}slider : ControlStyle
스타일링을 위한 그룹화된 속성 Slider. 슬라이더의 경우, 홈(groove)은 인디케이터를 통해 스타일링되며, 진행 바(progress track)는 인디케이터의 전경색을 통해 스타일링됩니다.
설정되지 않은 속성은 control 로 대체됩니다.
수직 슬라이더의 경우, 아래 코드 예시에서 볼 수 있듯이 컨트롤의 높이가 너비보다 커지도록 관련 델리게이트의 ` width `와 ` height `를 서로 바꿔야 합니다.
slider {
background {
// The background is hidden, but its implicit size still
// determines the overall implicit size of the control.
visible: false
width: 150
height: 50
}
indicator {
// The groove of the slider should fill out the entire width of the control
fillWidth: true
height: 8
radius: 255
color: "#e0e0e0"
foreground {
radius: 255
color: palette.accent
}
}
handle {
width: 24
height: 24
radius: 255
color: "white"
border.color: "#c0c0c0"
}
vertical {
// Transpose relevant geometry
background {
width: 50
height: 150
}
indicator {
fillWidth: false
fillHeight: true
width: 8
}
}
}spinBox : ControlStyle
SpinBox 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 로 대체됩니다.
spinBox {
// Center the text between the up/down buttons
text.alignment: Qt.AlignHCenter | Qt.AlignVCenter
indicator {
color: "transparent"
border.width: 0
foreground {
image.source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/arrow-indicator.png"
image.color: "black"
alignment: Qt.AlignCenter
}
// Place the down and up buttons on the left and right side of the control
// up button
first {
alignment: Qt.AlignRight
foreground.rotation: -90
}
// down button
second {
alignment: Qt.AlignLeft
foreground.rotation: 90
}
}
}참고: 현재 위쪽 및 아래쪽 버튼은 컨트롤의 왼쪽이나 오른쪽에 배치할수 있을 뿐, 서로 겹쳐서 배치할 수는 없습니다.
swipeDelegate : ControlStyle
SwipeDelegate 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 itemDelegate 로 대체됩니다.
swipeDelegate {
text.alignment: Qt.AlignVCenter | Qt.AlignLeft
background {
radius: 0
color: "white"
border.width: 0
}
hovered.background.color: "#f0f0f0"
}switchControl : ControlStyle
Switch 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 abstractButton 로 대체됩니다.
switchControl {
// For a switch control, we typically don't want a background, only an indicator with a handle
background.visible: false
indicator {
radius: 12
foreground {
// Add some space between the indicator and the foreground track
margins: 2
radius: 12
// The foreground track should only be visible when the switch is checked
visible: false
}
}
checked.indicator.foreground.visible: true
handle {
// Add some space between the handle and the indicator
leftMargin: 2
rightMargin: 2
width: 20
height: 20
radius: 255
color: "white"
}
}switchDelegate : ControlStyle
SwitchDelegate 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 itemDelegate 로 대체됩니다.
switchDelegate {
text.alignment: Qt.AlignVCenter | Qt.AlignLeft
background {
radius: 0
color: "white"
border.width: 0
}
indicator {
radius: 12
foreground {
// Add some space between the indicator and the foreground track
margins: 2
radius: 12
// The foreground track should only be visible when the switch is checked
visible: false
}
}
handle {
// Add some space between the handle and the indicator
leftMargin: 2
rightMargin: 2
width: 20
height: 20
radius: 255
color: "white"
}
hovered.background.color: "#f0f0f0"
checked.indicator.foreground.visible: true
}tabBar : ControlStyle
TabBar 의 스타일 지정을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 pane 로 대체됩니다.
tabBar {
padding: 0
spacing: -1 // let tab buttons overlap slightly
background {
color: "white"
border.width: 0
}
}tabButton : ControlStyle
TabButton 의 스타일링을 위한 그룹화된 속성입니다.
설정이 해제된 속성은 abstractButton 로 대체됩니다.
tabButton {
background {
radius: 0
topLeftRadius: 4
topRightRadius: 4
color: "#e8e8e8"
}
checked.background.color: "white"
}textArea : ControlStyle
TextArea 의 스타일 지정을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 textInput 로 대체됩니다.
textArea {
// Add some space between the text and the border of the text area
padding: 8
text.color: "black"
background {
color: "white"
border.color: "#c0c0c0"
}
focused.background.border.color: palette.accent
}textField : ControlStyle
TextField 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 textInput 로 대체됩니다.
textField {
// Add some space between the text and the border of the text field
padding: 8
text.alignment: Qt.AlignVCenter
background {
width: 150
color: "white"
border.color: "#c0c0c0"
}
focused.background.border.color: palette.accent
}textInput : ControlStyle
TextField 및 TextArea 을 포함한 모든 텍스트 입력 컨트롤의 스타일을 지정하기 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 로 기본값이 적용됩니다.
textInput {
// Add some space between the text and the border of the text input
padding: 8
text.color: "black"
background {
color: "white"
border.width: 1
border.color: "#c0c0c0"
}
}toolBar : ControlStyle
ToolBar 에 대한 스타일링을 위한 그룹화된 속성.
설정되지 않은 속성은 pane 로 대체됩니다.
toolBar {
spacing: 2
background {
radius: 0
height: 40
border.width: 1
}
}toolButton : ControlStyle
ToolButton 의 스타일링을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 abstractButton 로 대체됩니다.
toolButton {
background.radius: 0
}toolSeparator : ControlStyle
ToolSeparator 의 스타일 지정을 위한 그룹화된 속성입니다.
설정되지 않은 속성은 control 로 대체됩니다.
수직 구분선의 경우, 아래 코드 조각에 표시된 것처럼 관련 델리게이트의 ` width `과 ` height `을 바꿔서 컨트롤의 높이가 너비보다 커지도록 하십시오.
toolSeparator {
background {
// The background is hidden, but its implicit size still
// determines the overall implicit size of the control.
visible: false
width: 10
height: 10
}
indicator {
width: 30
height: 1
border.width: 0
color: "#c0c0c0"
alignment: Qt.AlignCenter
foreground.visible: false
}
vertical {
indicator {
width: 1
height: 30
}
}
}메서드 문서
ControlStyle getControlStyle(controlType)
지정된 controlType 에 대한 ControlStyle 를 반환하며, 해당 타입에 대해 ControlStyle 가 정의되지 않은 경우에는 null 를 반환합니다.
controlType 이 매개변수는 StyleReader.controlType 에 문서화된 내장 유형 중 하나이거나, CustomControl 의 controlType 일 수 있습니다.
이 함수는 예를 들어, 런타임에 CustomControl 의 스타일에 대한 속성을 읽거나 쓰는 데 사용할 수 있습니다:
Style {
id: myStyle
property int customButtonType: 0
CustomControl {
controlType: myStyle.customButtonType
background.color: "green"
}
}
function changeButtonColor() {
let customControlStyle = myStyle.getControlStyle(style.customButtonType)
customControlStyle.background.color = "yellowgreen"
// You can also access the style definition in the theme, if it has one
// myStyle.theme.getControlStyle(StyleReader.Button).padding = 10
}controlType 이 내장형(예: StyleReader.Button)인 경우, myStyle.button 이나 myStyle.getControlStyle(StyleReader.Button) 을 사용하여 ControlStyle 를 가져오는 것은 거의 동일합니다. 차이점은 전자는 ControlStyle 가 아직 정의되지 않은 경우 지연 생성하는 반면, 후자는 대신 null 를 반환한다는 점입니다. 즉, 예를 들어 myStyle.button.padding = 10 는 항상 안전하지만, myStyle.getControlStyle(StyleReader.Button).padding = 10 는 myStyle.button 가 Style 에 정의되지 않은 경우 실패합니다.
CustomControl 및 StyleReader도 참조하십시오 .
© 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.