Initial commit

This commit is contained in:
2026-04-29 07:19:21 +03:00
commit 9a8cdfa08a
5964 changed files with 1194660 additions and 0 deletions
@@ -0,0 +1,13 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Templates as T
T.ApplicationWindow {
id: window
color: window.palette.window
}
@@ -0,0 +1,66 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Shapes
T.BusyIndicator {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
contentItem: Item {
implicitWidth: 32
implicitHeight: 32
x: (control.availableWidth - width) / 2
y: (control.availableHeight - height) / 2
property Shape ring: Shape {
parent: control.contentItem
x: (parent.width - width) / 2
y: (parent.height - height) / 2
implicitWidth: parent.implicitWidth
implicitHeight: parent.implicitHeight
width: Math.min(control.contentItem.width, control.contentItem.height)
height: width
preferredRendererType: Shape.CurveRenderer
antialiasing: true
ShapePath {
fillColor: "transparent"
strokeColor: control.palette.accent
strokeWidth: control.contentItem.ring.width >= 64 ? 6 : control.contentItem.ring.width <= 16 ? 1 : 3
capStyle: ShapePath.RoundCap
PathAngleArc {
centerX: control.contentItem.ring.width / 2
centerY: control.contentItem.ring.height / 2
radiusX: control.contentItem.ring.width / 2 - 2
radiusY: radiusX
startAngle: -90
sweepAngle: 120
SequentialAnimation on startAngle {
loops: Animation.Infinite
running: control.visible && control.running
NumberAnimation { from: 0; to: 450; duration: 1000 }
NumberAnimation { from: 450; to: 1080; duration: 1000 }
}
SequentialAnimation on sweepAngle {
loops: Animation.Infinite
running: control.visible && control.running
NumberAnimation { from: 0; to: 180; duration: 1000 }
NumberAnimation { from: 180; to: 0; duration: 1000 }
}
}
}
}
}
}
@@ -0,0 +1,87 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl
import QtQuick.Templates as T
T.Button {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
icon.width: __config.icon.width
icon.height: __config.icon.height
readonly property string __currentState: [
(control.checked || control.highlighted) && "checked",
!control.enabled && "disabled",
control.enabled && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: (control.flat && Config.controls.flatbutton
? Config.controls.flatbutton[__currentState]
: Config.controls.button[__currentState]) || {}
readonly property Item __focusFrameTarget: control
contentItem: IconLabel {
spacing: control.spacing
mirrored: control.mirrored
display: control.display
alignment: control.__config.label.textVAlignment | control.__config.label.textHAlignment
icon: control.icon
text: control.text
font: control.font
color: defaultIconColor
defaultIconColor: {
if (Application.styleHints.accessibility.contrastPreference === Qt.HighContrast) {
return (control.enabled && ((control.flat && (control.down || control.hovered))
|| ((control.highlighted || control.checked) && !control.down)))
? control.palette.button
: control.enabled && (control.hovered || control.down)
? control.palette.highlight
: control.palette.buttonText
}
if (control.down) {
return (control.checked || control.highlighted)
? Application.styleHints.colorScheme === Qt.Light
? Color.transparent("white", 0.7) : Color.transparent("black", 0.5)
: (Application.styleHints.colorScheme === Qt.Light
? Color.transparent(control.palette.buttonText, 0.62)
: Color.transparent(control.palette.buttonText, 0.7725))
} else if (control.checked || control.highlighted) {
return (Application.styleHints.colorScheme === Qt.Dark && !control.enabled)
? Color.transparent("white", 0.5302)
: (Application.styleHints.colorScheme === Qt.Dark ? "black" : "white")
} else {
return control.palette.buttonText
}
}
}
background: ButtonBackground {
control: control
implicitHeight: control.__config.background.height
implicitWidth: control.__config.background.width
radius: control.__config.background.topOffset
subtle: control.flat
}
}
@@ -0,0 +1,66 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.CheckBox {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
readonly property string __currentState: [
control.checkState === Qt.Checked && "checked",
!control.enabled && "disabled",
control.enabled && !control.down && control.hovered && "hovered",
control.checkState === Qt.PartiallyChecked && "partiallyChecked",
control.down && "pressed",
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.checkbox[__currentState] || {}
readonly property bool __mirroredIndicator: control.mirrored !== (__config.mirrored || false)
readonly property Item __focusFrameTarget: control
indicator: Impl.CheckIndicator {
x: control.text ? (control.__mirroredIndicator ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
control: control
filePath: Qt.resolvedUrl(control.__config.indicator.filePath)
}
contentItem: Text {
leftPadding: control.indicator && !control.__mirroredIndicator ? control.indicator.width + control.spacing : 0
rightPadding: control.indicator && control.__mirroredIndicator ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
color: control.palette.text
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
background: Impl.StyleImage {
imageConfig: control.__config.background
}
}
@@ -0,0 +1,90 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
T.CheckDelegate {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 10
topPadding: __config.topPadding || 0 + verticalOffset
leftPadding: __config.leftPadding || 0 + __horizontalOffset
rightPadding: __config.rightPadding || 0 + __horizontalOffset
bottomPadding: __config.bottomPadding || 0 + __verticalOffset
icon.width: 16
icon.height: 16
readonly property int __horizontalOffset: 4
readonly property int __verticalOffset: 2
readonly property string __currentState: [
!control.enabled && "disabled",
control.highlighted && "highlighted",
control.enabled && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.itemdelegate[__currentState] || {}
readonly property Item __focusFrameTarget: control
indicator: Impl.CheckIndicator {
readonly property string currentState: [
control.checkState === Qt.Checked && "checked",
!control.enabled && control.checkState !== Qt.Unchecked && "disabled",
control.enabled && control.checkState !== Qt.Unchecked && !control.down && control.hovered && "hovered",
control.checkState === Qt.PartiallyChecked && "partiallyChecked",
control.checkState !== Qt.Unchecked && control.down && "pressed",
].filter(Boolean).join("_") || "normal"
readonly property var config: Config.controls.checkbox[currentState] || {}
x: control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
control: control
filePath: Qt.resolvedUrl(config.indicator.filePath)
}
contentItem: IconLabel {
leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing
rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing
spacing: control.spacing
mirrored: control.mirrored
display: control.display
alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft
icon: control.icon
defaultIconColor: control.down ? pressedText : control.palette.buttonText
text: control.text
font: control.font
color: defaultIconColor
readonly property color pressedText: Application.styleHints.colorScheme === Qt.Light
? Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.62)
: Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.7725)
}
background: Item {
implicitWidth: 160
implicitHeight: 40
property Item backgroundImage: Impl.StyleImage {
parent: control.background
imageConfig: control.__config.background
implicitWidth: parent.width - control.__horizontalOffset * 2
implicitHeight: parent.height - control.__verticalOffset * 2
x: control.__horizontalOffset
y: control.__verticalOffset
}
}
}
@@ -0,0 +1,175 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
T.ComboBox {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
spacing: __config.contentItem.spacing || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: (__config.leftPadding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)) || 0
rightPadding: (__config.rightPadding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)) || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
readonly property string __currentState: [
!control.enabled && "disabled",
control.enabled && !control.pressed && control.hovered && "hovered",
control.down && control.popup.visible && "open",
control.pressed && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: (control.editable && control.down && control.popup.visible // editable combobox differs from normal one only in opened state
? Config.controls.editablecombobox[__currentState]
: Config.controls.combobox[__currentState]) || {}
readonly property Item __focusFrameTarget: control.editable ? null : control
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
delegate: ItemDelegate {
required property var model
required property int index
width: ListView.view.width
text: model[control.textRole]
palette.highlightedText: control.palette.highlightedText
highlighted: control.highlightedIndex === index
hoverEnabled: control.hoverEnabled
}
indicator: ColorImage {
x: control.mirrored ? control.__config.leftPadding : control.width - width - control.__config.rightPadding
y: (control.topPadding + (control.availableHeight - height) / 2) + (control.pressed ? 1 : 0)
source: Qt.resolvedUrl(control.__config.indicator.filePath)
color: !control.__isHighContrast ? defaultColor : control.palette.buttonText
Behavior on y {
NumberAnimation{ easing.type: Easing.OutCubic; duration: 167 }
}
}
contentItem: T.TextField {
text: control.editable ? control.editText : control.displayText
topPadding: control.__config.label_contentItem.topPadding || 0
leftPadding: control.__config.label_contentItem.leftPadding || 0
rightPadding: control.__config.label_contentItem.rightPadding || 0
bottomPadding: control.__config.label_contentItem.bottomPadding || 0
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
enabled: control.editable
autoScroll: control.editable
readOnly: control.down
inputMethodHints: control.inputMethodHints
validator: control.validator
selectByMouse: control.selectTextByMouse
readonly property color __pressedText: Application.styleHints.colorScheme == Qt.Light
? Qt.rgba(control.palette.text.r, control.palette.text.g, control.palette.text.b, 0.62)
: Qt.rgba(control.palette.text.r, control.palette.text.g, control.palette.text.b, 0.7725)
color: !control.__isHighContrast && control.down ? __pressedText : control.palette.buttonText
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
horizontalAlignment: control.__config.label_text.textHAlignment
verticalAlignment: control.__config.label_text.textVAlignment
readonly property Item __focusFrameControl: control
ContextMenu.menu: Impl.TextEditingContextMenu {
editor: parent
}
}
background: ItemGroup {
Impl.StyleImage {
visible: !control.__isHighContrast
imageConfig: control.__config.background
Item {
visible: control.editable && ((control.down && control.popup.visible) || control.activeFocus)
width: parent.width
height: 2
y: parent.height - height
Impl.FocusStroke {
width: parent.width
height: parent.height
radius: control.down && control.popup.visible ? 0 : control.__config.background.bottomOffset
color: control.palette.accent
}
}
}
Rectangle {
visible: control.__isHighContrast
implicitWidth: control.__config.background.width
implicitHeight: control.__config.background.height
color: control.palette.window
border.color: control.hovered ? control.palette.accent : control.palette.buttonText
radius: 4
}
}
popup: T.Popup {
topPadding: control.__config.popup_contentItem.topPadding || 0
leftPadding: control.__config.popup_contentItem.leftPadding || 0
rightPadding: control.__config.popup_contentItem.rightPadding || 0
bottomPadding: control.__config.popup_contentItem.bottomPadding || 0
contentItem: ListView {
clip: true
implicitHeight: contentHeight
highlightMoveDuration: 0
model: control.delegateModel
currentIndex: control.highlightedIndex
}
y: control.editable ? control.height
: -0.25 * Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
readonly property real __targetHeight: Math.min(contentItem.implicitHeight + topPadding + bottomPadding, control.Window.height - topMargin - bottomMargin)
property real __heightScale: 1
height: __heightScale * __targetHeight
width: control.width
topMargin: 8
bottomMargin: 8
palette: control.palette
enter: Transition {
NumberAnimation { property: "__heightScale"; from: 0.33; to: 1; easing.type: Easing.OutCubic; duration: 250 }
}
background: ItemGroup {
Impl.StyleImage {
visible: !control.__isHighContrast
imageConfig: control.__config.popup_background.filePath ? control.__config.popup_background : Config.controls.popup["normal"].background // fallback to regular popup
}
Rectangle {
visible: control.__isHighContrast
implicitWidth: Config.controls.popup["normal"].background.width
implicitHeight: Config.controls.popup["normal"].background.height
color: control.palette.window
border.color: control.palette.buttonText
radius: 4
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,115 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl
T.DelayButton {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
icon.width: __config.icon.width
icon.height: __config.icon.height
icon.color: __buttonText
readonly property color __buttonText: {
if (Application.styleHints.accessibility.contrastPreference === Qt.HighContrast) {
return (control.enabled && ((control.flat && (control.down || control.hovered))
|| ((control.highlighted || control.checked) && !control.down)))
? control.palette.button
: control.enabled && (control.hovered || control.down)
? control.palette.highlight
: control.palette.buttonText
}
if (control.down) {
return (control.checked)
? Application.styleHints.colorScheme == Qt.Light
? Color.transparent("white", 0.7) : Color.transparent("black", 0.5)
: (Application.styleHints.colorScheme === Qt.Light
? Color.transparent(control.palette.buttonText, 0.62)
: Color.transparent(control.palette.buttonText, 0.7725))
} else if (control.checked) {
return (Application.styleHints.colorScheme === Qt.Dark && !control.enabled)
? Color.transparent("white", 0.5302)
: (Application.styleHints.colorScheme === Qt.Dark ? "black" : "white")
} else {
return control.palette.buttonText
}
}
readonly property string __currentState: [
control.checked && "checked",
!control.enabled && "disabled",
control.enabled && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.button[__currentState] || {}
readonly property Item __focusFrameTarget: control
transition: Transition {
NumberAnimation {
duration: control.delay * (control.pressed ? 1.0 - control.progress : 0.3 * control.progress)
}
}
contentItem: ItemGroup {
ClippedText {
clip: control.progress > 0
clipX: -control.leftPadding + control.progress * control.width
clipWidth: (1.0 - control.progress) * control.width
visible: control.progress < 1
text: control.text
font: control.font
color: control.icon.color
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
ClippedText {
clip: control.progress > 0
clipX: -control.leftPadding
clipWidth: control.progress * control.width
visible: control.progress > 0
text: control.text
font: control.font
color: control.icon.color
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
}
background: ButtonBackground {
control: control
implicitHeight: control.__config.background.height
implicitWidth: control.__config.background.width
radius: control.__config.background.topOffset
subtle: false
Rectangle {
width: control.progress * parent.width
height: parent.height
radius: parent.radius
color: control.down ? control.palette.accent : "transparent"
visible: !control.checked && control.enabled
}
}
}
@@ -0,0 +1,98 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Effects
T.Dialog {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding,
implicitHeaderWidth,
implicitFooterWidth)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding
+ (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
leftInset: __isHighContrast ? 0 : -32
topInset: __isHighContrast ? 0 : -32
rightInset: __isHighContrast ? 0 : -32
bottomInset: __isHighContrast ? 0 : -32
padding: 24
topPadding: 12
bottomPadding: 23
enter: Transition {
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.Linear; duration: 83 }
NumberAnimation { property: "scale"; from: control.modal ? 1.05 : 1; to: 1; easing.type: Easing.OutCubic; duration: 167 }
}
exit: Transition {
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.Linear; duration: 83 }
NumberAnimation { property: "scale"; from: 1; to: control.modal ? 1.05 : 1; easing.type: Easing.OutCubic; duration: 167 }
}
background: Rectangle {
color: control.__isHighContrast ? control.palette.window : "transparent"
border.color: control.__isHighContrast ? control.palette.text : "transparent"
border.width: 2
radius: 8
MultiEffect {
visible: !control.__isHighContrast
x: -control.leftInset
y: -control.topInset
width: source.width
height: source.height
source: Rectangle {
width: control.background.width + control.leftInset + control.rightInset
height: control.background.height + control.topInset + control.bottomInset
color: Application.styleHints.colorScheme === Qt.Light ? "white" : Qt.tint(control.palette.window, Color.transparent("white", 0.05))
border.color: "#66757575"
radius: 8
}
shadowScale: 1
shadowOpacity: 0.19
shadowColor: control.palette.shadow
shadowEnabled: true
shadowHorizontalOffset: 0
shadowVerticalOffset: 32
blurMax: 64
}
}
header: Label {
text: control.title
topPadding: control.padding
leftPadding: control.padding
rightPadding: control.padding
visible: control.title && parent?.parent === Overlay.overlay
elide: Label.ElideRight
font.bold: true
font.pixelSize: 20
font.weight: Font.DemiBold
}
footer: DialogButtonBox {
visible: count > 0
leftInset: control.__isHighContrast ? 1 : 0
topInset: control.__isHighContrast ? 1 : 0
rightInset: control.__isHighContrast ? 1 : 0
bottomInset: control.__isHighContrast ? 1 : 0
}
T.Overlay.modal: Rectangle {
color: Color.transparent(control.palette.shadow, 0.3)
}
T.Overlay.modeless: Rectangle {
color: "transparent"
}
}
@@ -0,0 +1,55 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Templates as T
T.DialogButtonBox {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
spacing: 8
padding: 24
alignment: count === 1 ? Qt.AlignRight : undefined
delegate: Button {
highlighted: DialogButtonBox.buttonRole === DialogButtonBox.AcceptRole || DialogButtonBox.buttonRole === DialogButtonBox.YesRole
}
contentItem: ListView {
implicitWidth: contentWidth
model: control.contentModel
spacing: control.spacing
orientation: ListView.Horizontal
boundsBehavior: Flickable.StopAtBounds
snapMode: ListView.SnapToItem
}
background: Item {
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
implicitHeight: 81
Rectangle {
implicitHeight: parent.__isHighContrast ? 2 : 1
width: parent.width
color: parent.__isHighContrast ? control.palette.text : Application.styleHints.colorScheme === Qt.Light ? "#0F000000" : "#15FFFFFF"
}
Rectangle {
implicitHeight: parent.__isHighContrast ? 79 : 80
x: 1; y: parent.__isHighContrast ? 2 : 1
width: parent.width - 2
height: parent.height - (parent.__isHighContrast ? 3 : 2)
color: control.palette.window
topLeftRadius: 0
bottomLeftRadius: 7
bottomRightRadius: 7
topRightRadius: 0
}
}
}
@@ -0,0 +1,145 @@
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.DoubleSpinBox {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
up.implicitIndicatorHeight, down.implicitIndicatorHeight)
property string __controlState: [
enabled && (down.hovered || down.pressed) && "down",
enabled && (up.hovered || up.pressed) && !(down.hovered || down.pressed) && "up",
enabled && (hovered || down.hovered || up.hovered) && !(down.pressed || up.pressed) && "hovered",
enabled && (down.pressed || up.pressed) && "pressed",
!enabled && "disabled"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.spinbox[__controlState] || {}
readonly property var __downConfig: value == from ? Config.controls.spinbox["atlimit"] : __config
readonly property var __upConfig: value == to ? Config.controls.spinbox["atlimit"] : __config
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
spacing: __config.contentItem.spacing || 0
leftPadding: ((!mirrored ? __config.leftPadding : __config.rightPadding) || 0) + (mirrored ? (up.indicator ? up.indicator.width * 2 : 0) : 0)
rightPadding: ((!mirrored ? __config.rightPadding : __config.leftPadding) || 0) + (!mirrored ? (up.indicator ? up.indicator.width * 2 : 0) : 0)
topPadding: __config.topPadding || 0
bottomPadding: __config?.bottomPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
validator: DoubleValidator {
locale: control.locale.name
bottom: Math.min(control.from, control.to)
top: Math.max(control.from, control.to)
decimals: control.decimals
}
contentItem: TextInput {
clip: width < implicitWidth
text: control.displayText
opacity: control.enabled ? 1 : 0.3
font: control.font
color: control.palette.buttonText
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
horizontalAlignment: control.mirrored ? Text.AlignRight : Text.AlignLeft
verticalAlignment: Text.AlignVCenter
readOnly: !control.editable
validator: control.validator
inputMethodHints: control.inputMethodHints
ContextMenu.menu: Impl.TextEditingContextMenu {
editor: parent
}
}
down.indicator: ItemGroup {
x: !control.mirrored ? control.up.indicator ? (control.up.indicator.x - width) : 0
: control.__config.rightPadding
y: control.topPadding
Impl.StyleImage {
height: control.availableHeight
visible: !control.__isHighContrast
imageConfig: control.__downConfig.indicator_down_background
}
Rectangle {
height: control.availableHeight
visible: control.__isHighContrast && control.down.pressed
color: control.down.pressed ? control.palette.highlight : control.palette.button
radius: control.__config.indicator_down_background.bottomOffset
}
ColorImage {
x: Math.ceil((parent.width - width) / 2)
y: Math.floor((parent.height - height) / 2)
width: implicitWidth
height: implicitHeight
source: control.__downConfig.indicator_down_icon.filePath
color: !control.__isHighContrast ? defaultColor : control.down.pressed ? control.palette.button : control.palette.buttonText
}
}
up.indicator: ItemGroup {
x: control.mirrored ? control.__config.rightPadding + (control.down.indicator ? control.down.indicator.width : 0)
: control.width - width - control.__config.rightPadding
y: control.topPadding
Impl.StyleImage {
height: control.availableHeight
visible: !control.__isHighContrast
imageConfig: control.__upConfig.indicator_up_background
}
Rectangle {
visible: control.__isHighContrast && control.up.pressed
height: control.availableHeight
color: control.up.pressed ? control.palette.highlight : control.palette.button
radius: control.__config.indicator_up_background.bottomOffset
}
ColorImage {
x: Math.ceil((parent.width - width) / 2)
y: Math.floor((parent.height - height) / 2)
width: implicitWidth
height: implicitHeight
source: control.__upConfig.indicator_up_icon.filePath
color: !control.__isHighContrast ? defaultColor : control.up.pressed ? control.palette.button : control.palette.buttonText
}
}
background: ItemGroup {
Impl.StyleImage {
visible: !control.__isHighContrast
imageConfig: control.__config.background
Item {
visible: control.activeFocus
width: parent.width
height: 2
y: parent.height - height
Impl.FocusStroke {
width: parent.width
height: parent.height
radius: control.__config.background.bottomOffset
color: control.palette.accent
}
}
}
Rectangle {
visible: control.__isHighContrast
color: control.palette.window
border.color: control.enabled && control.hovered || control.activeFocus ? control.palette.accent : control.palette.buttonText
border.width: control.editable && control.activeFocus ? 2 : 1
radius: control.__config.background.bottomOffset
}
}
}
@@ -0,0 +1,58 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
@Deprecated {
reason: "FocusFrame component has been moved to private FluentWinUI3.impl module \
and is no longer part of the public QML API."
}
Rectangle {
Component.onCompleted: {
print("FocusFrame has been moved to private FluentWinUI3.impl module "
+ "and is no longer part of the public QML API.")
}
function moveToItem(item) {
if (!item) {
targetItem = null;
parent = null;
return;
}
parent = item.parent
targetItem = item
}
property Item targetItem
property real innerFrameSize: 1
property real outerFrameSize: 3
property real frameRadius: 4.0
x: targetItem ? targetItem.x - outerFrameSize : 0
y: targetItem ? targetItem.y - outerFrameSize : 0
// Stack on top of all siblings of the targetItem
z: 100
width: targetItem ? targetItem.width + outerFrameSize * 2 : 0
height: targetItem ? targetItem.height + outerFrameSize * 2 : 0
radius: frameRadius + outerFrameSize
visible: targetItem && targetItem.visible
color: "transparent"
border.color: Application.styleHints.colorScheme === Qt.Light ? "black" : "white"
border.width: outerFrameSize - (Application.styleHints.colorScheme === Qt.Light ? innerFrameSize : 0)
Rectangle {
id: innerFocusFrame
z: 10
x: outerFrameSize - innerFrameSize
y: outerFrameSize - innerFrameSize
width: targetItem ? targetItem.width + innerFrameSize * 2 : 0
height: targetItem ? targetItem.height + innerFrameSize * 2 : 0
radius: frameRadius + innerFrameSize
visible: targetItem && targetItem.visible
color: "transparent"
border.color: Application.styleHints.colorScheme === Qt.Light ? "white" : "black"
border.width: innerFrameSize
}
}
@@ -0,0 +1,45 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.Frame {
id: control
implicitWidth: Math.max((background.minimumWidth || implicitBackgroundWidth)
+ leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max((background.minimumHeight || implicitBackgroundHeight)
+ topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
readonly property string __currentState: !control.enabled ? "disabled" : "normal";
readonly property var __config: Config.controls.frame[__currentState] || {}
background: Rectangle {
implicitWidth: control.__config.background.width
implicitHeight: control.__config.background.height
color: "transparent"
border.color: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast ? control.palette.text : "transparent"
radius: 4
Impl.StyleImage {
width: parent.width
height: parent.height
imageConfig: control.__config.background
}
}
}
@@ -0,0 +1,72 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.GroupBox {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding,
implicitLabelWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
readonly property real __deltaY: (__config.background.y - __config.label.y) || 0
readonly property real __deltaX: (__config.background.x - __config.label.x) || 0
spacing: (__deltaY - __config.label.height) || 0
topPadding: (__config.topPadding || 0) + (spacing >= 0 ? (label.height + spacing) : __deltaY)
bottomPadding: __config.bottomPadding || 0
leftPadding: (__config.leftPadding || 0) + (__deltaX >= 0 ? __deltaX : 0)
rightPadding: __config.rightPadding || 0
topInset: __deltaY > 0 ? __deltaY : 0
bottomInset: -__config.bottomInset || 0
leftInset: __deltaX > 0 ? __deltaX : 0
rightInset: -__config.rightInset || 0
readonly property string __currentState: [
!control.enabled && "disabled",
control.enabled && control.hovered && "hovered",
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.groupbox[__currentState] || {}
label: T.Label {
x: control.__deltaX > 0 ? 0 : -__deltaX
y: control.__deltaY > 0 ? 0 : -__deltaY
topPadding: control.__config.label_contentItem.topPadding || 0
leftPadding: control.__config.label_contentItem.leftPadding || 0
rightPadding: control.__config.label_contentItem.rightPadding || 0
bottomPadding: control.__config.label_contentItem.bottomPadding || 0
height: Math.max(implicitHeight, __config.label.height)
text: control.title
font: control.font
color: control.palette.windowText
elide: Text.ElideRight
horizontalAlignment: control.__config.label_text.textHAlignment
verticalAlignment: control.__config.label_text.textVAlignment
background: Impl.StyleImage {
imageConfig: control.__config.label_background
}
}
background: Rectangle {
color: "transparent"
border.color: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast ? control.palette.text : "transparent"
radius: 4
Impl.StyleImage {
imageConfig: control.__config.background.filePath ? control.__config.background : Config.controls.frame["normal"].background // fallback to regular frame background
width: parent.width
height: parent.height
}
}
}
@@ -0,0 +1,108 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.ItemDelegate {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0 + verticalOffset
leftPadding: __config.leftPadding || 0 + __horizontalOffset
rightPadding: __config.rightPadding || 0 + __horizontalOffset
bottomPadding: __config.bottomPadding || 0 + __verticalOffset
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
icon.width: 16
icon.height: 16
readonly property int __horizontalOffset: 4
readonly property int __verticalOffset: 2
readonly property string __currentState: [
!control.enabled && "disabled",
control.highlighted && "highlighted",
control.enabled && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.itemdelegate[__currentState] || {}
readonly property Item __focusFrameTarget: control
contentItem: IconLabel {
spacing: control.spacing
mirrored: control.mirrored
display: control.display
alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft
icon: control.icon
defaultIconColor: control.down ? pressedText : control.__isHighContrast && control.hovered
? control.palette.button : control.palette.buttonText
text: control.text
font: control.font
color: defaultIconColor
readonly property color pressedText: Application.styleHints.colorScheme === Qt.Light
? Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.62)
: Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.7725)
}
background: Item {
implicitWidth: 160
implicitHeight: 40
property Item backgroundImage: Impl.StyleImage {
visible: !control.__isHighContrast
parent: control.background
imageConfig: control.__config.background
implicitWidth: parent.width - control.__horizontalOffset * 2
implicitHeight: parent.height - control.__verticalOffset * 2
x: control.__horizontalOffset
y: control.__verticalOffset
}
property Rectangle selector: Rectangle {
parent: control.background.backgroundImage
y: (parent.height - height) / 2
width: 3
height: (control.highlighted || control.activeFocus)
? control.down ? 10 : 16
: 0
radius: width * 0.5
color: control.palette.accent
visible: (control.highlighted || control.activeFocus) && !control.__isHighContrast
Behavior on height {
NumberAnimation {
duration: 187
easing.type: Easing.OutCubic
}
}
}
Rectangle {
visible: control.__isHighContrast
implicitWidth: parent.width - control.__horizontalOffset * 2
implicitHeight: parent.height - control.__verticalOffset * 2
x: control.__horizontalOffset
y: control.__verticalOffset
color: control.hovered ? control.palette.accent : control.palette.window
radius: 4
}
}
}
@@ -0,0 +1,80 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Effects
T.Menu {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
leftPadding: 5
topPadding: 5
rightPadding: 5
bottomPadding: 5
margins: 0
overlap: 4
readonly property var __config: Config.controls.popup["normal"]
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
leftInset: -__config.background.leftShadow
topInset: -__config.background.topShadow
rightInset: -__config.background.rightShadow
bottomInset: -__config.background.bottomShadow
delegate: MenuItem { }
contentItem: ListView {
implicitHeight: contentHeight
model: control.contentModel
interactive: Window.window
? contentHeight + control.topPadding + control.bottomPadding > control.height
: false
currentIndex: control.currentIndex
spacing: 4
clip: true
ScrollIndicator.vertical: ScrollIndicator {}
}
property real __heightScale: 1
height: __heightScale * implicitHeight
enter: Transition {
NumberAnimation { property: "__heightScale"; from: 0.33; to: 1; easing.type: Easing.OutCubic; duration: 250 }
}
background: Impl.StyleImage {
implicitWidth: 200 + imageConfig.leftShadow + imageConfig.rightShadow
implicitHeight: 30 + imageConfig.topShadow + imageConfig.bottomShadow
imageConfig: control.__config.background
drawShadowWithinBounds: true
Rectangle {
x: -control.leftInset
y: -control.topInset
implicitWidth: parent.width + control.leftInset + control.rightInset
implicitHeight: parent.height + control.topInset + control.bottomInset
visible: control.__isHighContrast
radius: 8
color: control.palette.window
border.color: control.palette.text
border.width: 2
}
}
T.Overlay.modal: Rectangle {
color: "transparent"
}
T.Overlay.modeless: Rectangle {
color: "transparent"
}
}
@@ -0,0 +1,39 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
T.MenuBar {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: SafeArea.margins.top + (__config.topPadding || 0)
bottomPadding: SafeArea.margins.bottom + (__config.bottomPadding || 0)
leftPadding: SafeArea.margins.left + (__config.leftPadding || 0)
rightPadding: SafeArea.margins.right + (__config.rightPadding || 0)
readonly property var __config: Config.controls.toolbar["normal"] || {}
delegate: MenuBarItem { }
contentItem: Row {
spacing: control.spacing
Repeater {
model: control.contentModel
}
}
background: Impl.StyleImage {
imageConfig: control.__config.background
}
}
@@ -0,0 +1,69 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl
T.MenuBarItem {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
icon.width: __config.icon.width
icon.height: __config.icon.height
readonly property string __currentState: [
!control.enabled && "disabled",
control.enabled && !control.down && (control.hovered || control.highlighted) && "hovered",
down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.toolbutton[__currentState] || {}
readonly property Item __focusFrameTarget: control
contentItem: IconLabel {
spacing: control.spacing
mirrored: control.mirrored
display: control.display
alignment: Qt.AlignLeft
icon: control.icon
defaultIconColor: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
? control.hovered || control.highlighted ? control.palette.highlight : control.palette.buttonText
: !control.down
? control.palette.buttonText : Application.styleHints.colorScheme === Qt.Light
? Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.62)
: Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.7725)
text: control.text
font: control.font
color: defaultIconColor
}
background: ButtonBackground {
control: control
implicitHeight: 30
implicitWidth: 30
radius: control.__config.background.topOffset
subtle: (!control.checked || control.flat) && Application.styleHints.accessibility.contrastPreference !== Qt.HighContrast
accented: control.checked
}
}
@@ -0,0 +1,87 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
T.MenuItem {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
leftPadding: 12
rightPadding: 12
topPadding: 3
bottomPadding: 3
spacing: 6
icon.width: 16
icon.height: 16
implicitTextPadding: control.checkable && control.indicator ? control.indicator.width + control.spacing : 0
contentItem: IconLabel {
readonly property real arrowPadding: control.subMenu && control.arrow ? control.arrow.width + control.spacing : 0
leftPadding: !control.mirrored ? control.textPadding : arrowPadding
rightPadding: control.mirrored ? control.textPadding : arrowPadding
spacing: control.spacing
mirrored: control.mirrored
display: control.display
alignment: Qt.AlignLeft
icon: control.icon
defaultIconColor: control.palette.text
text: control.text
font: control.font
color: defaultIconColor
}
arrow: ColorImage {
x: control.mirrored ? control.padding : control.width - width - control.padding
y: control.topPadding + (control.availableHeight - height) / 2
width: 20
visible: control.subMenu
rotation: control.mirrored ? -180 : 0
color: control.palette.text
source: Qt.resolvedUrl("icons/menuarrow.png")
fillMode: Image.Pad
}
indicator: Item {
implicitWidth: 14
implicitHeight: 10
x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding
y: control.topPadding + (control.availableHeight - height) / 2
visible: control.checkable
ColorImage {
y: (parent.height - height) / 2
color: control.palette.text
source: Qt.resolvedUrl("icons/checkmark.png")
visible: control.checkState === Qt.Checked
|| (control.checked && control.checkState === undefined)
}
}
background: Rectangle {
implicitWidth: 200
implicitHeight: 30
radius: 4
readonly property real alpha: control.down
? Application.styleHints.colorScheme === Qt.Light ? 0.0241 : 0.0419
: control.hovered ? Application.styleHints.colorScheme === Qt.Light ? 0.0373 : 0.0605 : 0
color: Application.styleHints.colorScheme === Qt.Light ? Qt.rgba(0, 0, 0, alpha) : Qt.rgba(1, 1, 1, alpha)
visible: control.down || control.highlighted
}
}
@@ -0,0 +1,24 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
T.MenuSeparator {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
horizontalPadding: 0
verticalPadding: 2
contentItem: Rectangle {
implicitWidth: 188
implicitHeight: 1
color: Application.styleHints.colorScheme === Qt.Light ? "#0F000000" : "#15FFFFFF"
}
}
@@ -0,0 +1,70 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.PageIndicator {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
readonly property string __currentState: [
!control.enabled && "disabled",
control.enabled && control.hovered && "hovered",
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.pageindicator[__currentState] || {}
delegate: Impl.StyleImage {
required property int index
property alias hovered: hoverHandler.hovered
readonly property string __currentState: [
!control.enabled && "disabled",
control.enabled && (index === control.currentIndex || pressed) && "delegate",
control.enabled && index === control.currentIndex && "current",
control.enabled && hovered && !pressed && "hovered",
control.enabled && control.interactive && pressed && "pressed",
].filter(Boolean).join("_") || "normal"
readonly property var config: Config.controls.pageindicatordelegate[__currentState].indicator || {}
imageConfig: config
HoverHandler {
id: hoverHandler
enabled: control.interactive
}
}
contentItem: Row {
spacing: control.spacing
Repeater {
model: control.count
delegate: control.delegate
}
}
background: Impl.StyleImage {
imageConfig: control.__config.background
}
}
@@ -0,0 +1,65 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.Popup {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
readonly property string __currentState: "normal"
readonly property var __config: Config.controls.popup[__currentState] || {}
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
enter: Transition {
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.Linear; duration: 83 }
NumberAnimation { property: "scale"; from: control.modal ? 1.05 : 1; to: 1; easing.type: Easing.OutCubic; duration: 167 }
}
exit: Transition {
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.Linear; duration: 83 }
NumberAnimation { property: "scale"; from: 1; to: control.modal ? 1.05 : 1; easing.type: Easing.OutCubic; duration: 167 }
}
background: Impl.StyleImage {
implicitWidth: 320
implicitHeight: 72
imageConfig: control.__config.background
drawShadowWithinBounds: control.__isHighContrast
Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
visible: control.__isHighContrast
radius: 4
color: control.palette.window
border.color: control.palette.text
border.width: 2
}
}
T.Overlay.modal: Rectangle {
color: Color.transparent(control.palette.shadow, 0.3)
}
T.Overlay.modeless: Rectangle {
color: "transparent"
}
}
@@ -0,0 +1,121 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
import QtQuick.Effects
T.ProgressBar {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: (__isHighContrast ? -1 : 0) - (__config.topInset || 0)
bottomInset: (__isHighContrast ? -1 : 0) - (__config.bottomInset || 0)
leftInset: (__isHighContrast ? -1 : 0) - (__config.leftInset || 0)
rightInset: (__isHighContrast ? -1 : 0) - (__config.rightInset || 0)
readonly property string __currentState: [
!control.enabled && "disabled",
control.indeterminate && "indeterminate"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.progressbar[__currentState] || {}
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
contentItem: Item {
implicitWidth: control.indeterminate ? parent.availableWidth : progress.implicitWidth
implicitHeight: control.indeterminate ? control.__config.track.height : progress.implicitHeight
scale: control.mirrored ? -1 : 1
clip: control.indeterminate
readonly property Rectangle progress: Rectangle {
x: control.background.groove?.x - (control.__isHighContrast ? 0 : 1)
y: control.background.groove?.y - (control.__isHighContrast ? 0 : 1)
parent: control.contentItem
visible: !control.indeterminate && control.value
implicitWidth: control.__config.track.width
implicitHeight: control.__config.track.height
width: control.position * parent.width
height: control.__config.track.height
radius: control.__config.track.height * 0.5
color: control.palette.accent
}
readonly property Rectangle animatedProgress: Rectangle {
parent: control.contentItem
implicitWidth: parent.width
implicitHeight: control.__config.track.height
radius: control.__config.track.height * 0.5
clip: true
visible: false
color: "transparent"
Rectangle {
width: 0.5 * parent.width
height: control.__config.track.height
radius: control.__config.track.height * 0.5
color: control.palette.accent
SequentialAnimation on x {
loops: Animation.Infinite
running: control.indeterminate && control.visible
NumberAnimation {
from: -control.contentItem.animatedProgress.width
to: control.contentItem.width
easing.type: Easing.InOutCubic
duration: control.width * 8
}
NumberAnimation {
from: -control.contentItem.animatedProgress.width * 0.5
to: control.contentItem.width
easing.type: Easing.InOutCubic
duration: control.width * 5
}
}
}
}
readonly property Rectangle mask: Rectangle {
parent: control.contentItem
width: control.availableWidth
height: control.contentItem.animatedProgress.height
radius: control.contentItem.animatedProgress.radius
visible: false
color: control.palette.accent
layer.enabled: true
antialiasing: false
}
MultiEffect {
visible: control.indeterminate
source: control.contentItem.animatedProgress
width: control.contentItem.animatedProgress.width
height: control.contentItem.animatedProgress.height
maskEnabled: true
maskSource: control.contentItem.mask
}
}
background: Rectangle {
implicitWidth: groove.width
radius: height * 0.5
color: control.__isHighContrast ? control.palette.window : "transparent"
border.color: control.__isHighContrast ? control.palette.text : "transparent"
property Item groove: Impl.StyleImage {
imageConfig: control.__config.groove
visible: !control.indeterminate && !control.__isHighContrast
parent: control.background
height: implicitHeight
width: parent.width
}
}
}
@@ -0,0 +1,64 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.RadioButton {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
readonly property string __currentState: [
control.checked && "checked",
!control.enabled && "disabled",
control.enabled && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.radiobutton[__currentState] || {}
readonly property bool __mirroredIndicator: control.mirrored !== (__config.mirrored || false)
readonly property Item __focusFrameTarget: control
indicator: Impl.RadioIndicator {
x: control.text ? (control.__mirroredIndicator ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
control: control
filePath: Qt.resolvedUrl(control.__config.indicator.filePath)
}
contentItem: Text {
leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
color: control.palette.text
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
background: Impl.StyleImage {
imageConfig: control.__config.background
}
}
@@ -0,0 +1,89 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
T.RadioDelegate {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 10
topPadding: __config.topPadding || 0 + verticalOffset
leftPadding: __config.leftPadding || 0 + __horizontalOffset
rightPadding: __config.rightPadding || 0 + __horizontalOffset
bottomPadding: __config.bottomPadding || 0 + __verticalOffset
icon.width: 16
icon.height: 16
readonly property int __horizontalOffset: 4
readonly property int __verticalOffset: 2
readonly property string __currentState: [
!control.enabled && "disabled",
control.highlighted && "highlighted",
control.enabled && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.itemdelegate[__currentState] || {}
readonly property Item __focusFrameTarget: control
indicator: Impl.RadioIndicator {
readonly property string currentState: [
control.checked && "checked",
!control.enabled && control.checked && "disabled",
control.enabled && control.checked && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var config: Config.controls.radiobutton[currentState] || {}
x: control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
control: control
filePath: Qt.resolvedUrl(config.indicator.filePath)
}
contentItem: IconLabel {
leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing
rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing
spacing: control.spacing
mirrored: control.mirrored
display: control.display
alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft
icon: control.icon
defaultIconColor: control.down ? pressedText : control.palette.buttonText
text: control.text
font: control.font
color: defaultIconColor
readonly property color pressedText: Application.styleHints.colorScheme === Qt.Light
? Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.62)
: Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.7725)
}
background: Item {
implicitWidth: 160
implicitHeight: 40
property Item backgroundImage: Impl.StyleImage {
parent: control.background
imageConfig: control.__config.background
implicitWidth: parent.width - control.__horizontalOffset * 2
implicitHeight: parent.height - control.__verticalOffset * 2
x: control.__horizontalOffset
y: control.__verticalOffset
}
}
}
@@ -0,0 +1,270 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.RangeSlider {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
first.implicitHandleWidth + leftPadding + rightPadding,
second.implicitHandleWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
first.implicitHandleHeight + topPadding + bottomPadding,
second.implicitHandleHeight + topPadding + bottomPadding)
topPadding: horizontal ? __config.topPadding : __config.leftPadding || 0
leftPadding: horizontal ? __config.leftPadding : __config.bottomPadding || 0
rightPadding: horizontal ? __config.rightPadding : __config.topPadding || 0
bottomPadding: horizontal ? __config.bottomPadding : __config.rightPadding || 0
readonly property string __controlState: [
!control.enabled && "disabled",
control.enabled && control.hovered && !(first.pressed || second.pressed) && "hovered",
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.rangeslider[__controlState] || {}
readonly property real __steps: Math.abs(to - from) / stepSize
readonly property bool __isDiscrete: stepSize >= Number.EPSILON
&& Math.abs(Math.round(__steps) - __steps) < Number.EPSILON
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
property string __firstHandleState: [
!control.enabled && "disabled",
first.hovered && !first.pressed && "hovered",
first.pressed && "handle_pressed",
].filter(Boolean).join("_") || "normal"
readonly property var __firstHandleConfig: Config.controls.rangeslider[__firstHandleState] || {}
property string __secondHandleState: [
!control.enabled && "disabled",
second.hovered && !second.pressed && "hovered",
second.pressed && "handle_pressed",
].filter(Boolean).join("_") || "normal"
readonly property var __secondHandleConfig: Config.controls.rangeslider[__secondHandleState] || {}
readonly property Item __focusFrameControl: control
readonly property Item __focusFrameTarget: control
first.handle: ItemGroup {
x: Math.round(control.leftPadding + (control.horizontal
? control.first.visualPosition * (control.availableWidth - width)
: (control.availableWidth - width) / 2))
y: Math.round(control.topPadding + (control.horizontal
? (control.availableHeight - height) / 2
: control.first.visualPosition * (control.availableHeight - height)))
Impl.StyleImage {
visible: !control.__isHighContrast
imageConfig: control.__firstHandleConfig.first_handle
readonly property Item __focusFrameTarget: control
}
Rectangle {
visible: control.__isHighContrast
implicitWidth: control.__secondHandleConfig.first_handle.width
implicitHeight: control.__secondHandleConfig.first_handle.height
color: control.palette.buttonText
radius: width / 2
}
property Rectangle indicator: Rectangle {
property real diameter: !control.enabled ? 10
: control.first.pressed ? 8
: control.__isHighContrast && !control.hovered ? 0
: control.first.hovered ? 14 : 10
parent: control.first.handle
width: diameter
height: diameter
radius: diameter * 0.5
x: (control.__secondHandleConfig.first_handle.width - width) / 2
y: (control.__secondHandleConfig.first_handle.height - height) / 2
color: control.enabled ? (control.first.hovered ? Qt.rgba(control.palette.accent.r, control.palette.accent.g, control.palette.accent.b, 0.9020)
: control.first.pressed ? Qt.rgba(control.palette.accent.r, control.palette.accent.g, control.palette.accent.b, 0.8)
: control.palette.accent)
: control.palette.accent
Behavior on diameter {
// From WindowsUI 3 Animation Values
NumberAnimation {
duration: 167
easing.type: Easing.OutCubic
}
}
}
}
second.handle: ItemGroup {
x: Math.round(control.leftPadding + (control.horizontal
? control.second.visualPosition * (control.availableWidth - width)
: (control.availableWidth - width) / 2))
y: Math.round(control.topPadding + (control.horizontal
? (control.availableHeight - height) / 2
: control.second.visualPosition * (control.availableHeight - height)))
Impl.StyleImage {
visible: !control.__isHighContrast
imageConfig: control.__secondHandleConfig.second_handle
readonly property Item __focusFrameTarget: control
}
Rectangle {
visible: control.__isHighContrast
implicitWidth: control.__secondHandleConfig.second_handle.width
implicitHeight: control.__secondHandleConfig.second_handle.height
color: control.palette.buttonText
radius: width / 2
}
property Rectangle indicator: Rectangle {
property real diameter: !control.enabled ? 10
: control.second.pressed ? 8
: control.__isHighContrast && !control.hovered ? 0
: control.second.hovered ? 14 : 10
parent: control.second.handle
width: diameter
height: diameter
radius: diameter * 0.5
x: (control.__secondHandleConfig.second_handle.width - width) / 2
y: (control.__secondHandleConfig.second_handle.height - height) / 2
color: control.enabled ? (control.second.hovered ? Qt.rgba(control.palette.accent.r, control.palette.accent.g, control.palette.accent.b, 0.9020)
: control.second.pressed ? Qt.rgba(control.palette.accent.r, control.palette.accent.g, control.palette.accent.b, 0.8)
: control.palette.accent)
: control.palette.accent
Behavior on diameter {
// From WindowsUI 3 Animation Values
NumberAnimation{
duration: 167
easing.type: Easing.OutCubic
}
}
}
}
background: Item {
implicitWidth: control.horizontal
? (_background.implicitWidth || _background.groove.implicitWidth)
: (_background.implicitHeight || _background.groove.implicitHeight)
implicitHeight: control.horizontal
? (_background.implicitHeight || _background.groove.implicitHeight)
: (_background.implicitWidth || _background.groove.implicitWidth)
property Item _background: Impl.StyleImage {
visible: !control.__isHighContrast
parent: control.background
width: parent.width
height: parent.width
imageConfig: control.__config.background
property Item groove: Impl.StyleImage {
parent: control.background._background
x: control.leftPadding - control.leftInset + (control.horizontal
? control.__firstHandleConfig.first_handle.width / 2
: (control.availableWidth - width) / 2)
y: control.topPadding - control.rightInset + (control.horizontal
? ((control.availableHeight - height) / 2)
: control.__firstHandleConfig.first_handle.height / 2)
width: control.horizontal
? control.availableWidth
- (control.__firstHandleConfig.first_handle.width / 2) - (control.__secondHandleConfig.second_handle.width / 2)
: implicitWidth
height: control.horizontal
? implicitHeight
: control.availableHeight
- (control.__firstHandleConfig.first_handle.width / 2) - (control.__secondHandleConfig.second_handle.width / 2)
imageConfig: control.__config.groove
horizontal: control.horizontal
property Rectangle track: Rectangle {
parent: control.background._background.groove
x: control.horizontal ? parent.width * control.first.position : 0
y: control.horizontal ? 0 : parent.height - (parent.height * control.second.position)
implicitWidth: control.horizontal ? control.__config.track.width : control.__config.track.height
implicitHeight: control.horizontal ? control.__config.track.height : control.__config.track.width
width: control.horizontal
? parent.width * (control.second.position - control.first.position)
: parent.width
height: control.horizontal
? parent.height
: parent.height * (control.second.position - control.first.position)
radius: control.__config.track.height * 0.5
color: control.palette.accent
}
}
property Repeater ticksTop: Repeater {
parent: control.__isHighContrast ? control.background._highContrastBackground : control.background._background.groove
model: control.__isDiscrete ? Math.floor(control.__steps) + 1 : 0
delegate: Rectangle {
width: control.horizontal ? 1 : 4
height: control.horizontal ? 4 : 1
x: control.horizontal
? 6 + index * (parent.width - 2 * 6 - width) / (control.background._background.ticksTop.model - 1)
: -4 - width
y: control.horizontal
? -4 - height
: 6 + index * (parent.height - 2 * 6 - height) / (control.background._background.ticksTop.model - 1)
color: Application.styleHints.colorScheme === Qt.Light ? "#9C000000" : "#9AFFFFFF"
required property int index
}
}
property Repeater ticksBottom: Repeater {
parent: control.__isHighContrast ? control.background._highContrastBackground : control.background._background.groove
model: control.__isDiscrete ? Math.floor(control.__steps) + 1 : 0
delegate: Rectangle {
width: control.horizontal ? 1 : 4
height: control.horizontal ? 4 : 1
x: control.horizontal
? 6 + index * (parent.width - 2 * 6 - width) / (control.background._background.ticksBottom.model - 1)
: parent.width + 4
y: control.horizontal
? parent.height + 4
: 6 + index * (parent.height - 2 * 6 - height) / (control.background._background.ticksBottom.model - 1)
color: Application.styleHints.colorScheme === Qt.Light ? "#9C000000" : "#9AFFFFFF"
required property int index
}
}
}
property Item _highContrastBackground: Rectangle {
parent: control.background
visible: control.__isHighContrast
implicitWidth: control.horizontal ? 200 : 4
implicitHeight: control.horizontal ? 4 : 200
x: control.leftPadding - control.leftInset + (control.horizontal
? control.__firstHandleConfig.first_handle.width / 2
: (control.availableWidth - width) / 2)
y: control.topPadding - control.topInset + (control.horizontal
? ((control.availableHeight - height) / 2)
: control.__firstHandleConfig.first_handle.height / 2)
width: control.horizontal
? control.availableWidth - control.__firstHandleConfig.first_handle.width
: implicitWidth
height: control.horizontal
? implicitHeight
: control.availableHeight - control.__firstHandleConfig.first_handle.width
radius: 2
color: control.palette.buttonText
scale: control.horizontal && control.mirrored ? -1 : 1
Rectangle {
x: control.horizontal ? parent.width * control.first.position : 0
y: control.horizontal ? 0 : parent.height - (parent.height * control.second.position)
implicitWidth: control.horizontal ? parent.width * (control.second.position - control.first.position) : parent.width
implicitHeight: control.horizontal ? parent.height : parent.height * (control.second.position - control.first.position)
radius: 2
color: control.palette.highlight
}
}
}
}
@@ -0,0 +1,82 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl
import QtQuick.Templates as T
T.RoundButton {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
icon.width: __config.icon.width
icon.height: __config.icon.height
readonly property string __currentState: [
(control.checked || control.highlighted) && "checked",
!control.enabled && "disabled",
control.enabled && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: (control.flat && Config.controls.flatbutton
? Config.controls.flatbutton[__currentState]
: Config.controls.button[__currentState]) || {}
readonly property Item __focusFrameTarget: control
contentItem: IconLabel {
spacing: control.spacing
mirrored: control.mirrored
display: control.display
icon: control.icon
defaultIconColor: {
if (Application.styleHints.accessibility.contrastPreference === Qt.HighContrast) {
return (control.enabled && ((control.flat && (control.down || control.hovered))
|| ((control.highlighted || control.checked) && !control.down)))
? control.palette.button
: control.enabled && (control.hovered || control.down)
? control.palette.highlight
: control.palette.buttonText
}
if (control.down) {
return (control.checked || control.highlighted)
? Application.styleHints.colorScheme === Qt.Light
? Color.transparent("white", 0.7) : Color.transparent("black", 0.5)
: (Application.styleHints.colorScheme === Qt.Light
? Color.transparent(control.palette.buttonText, 0.62)
: Color.transparent(control.palette.buttonText, 0.7725))
} else if (control.checked || control.highlighted) {
return (Application.styleHints.colorScheme === Qt.Dark && !control.enabled)
? Color.transparent("white", 0.5302)
: (Application.styleHints.colorScheme === Qt.Dark ? "black" : "white")
} else {
return control.palette.buttonText
}
}
text: control.text
font: control.font
color: defaultIconColor
}
background: ButtonBackground {
control: control
implicitHeight: control.__config.background.height
implicitWidth: implicitWidth
radius: control.radius
}
}
@@ -0,0 +1,214 @@
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
T.SearchField {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
+ searchIndicator.implicitIndicatorWidth + clearIndicator.implicitIndicatorWidth
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
searchIndicator.implicitIndicatorHeight + topPadding + bottomPadding)
spacing: __config.contentItem.spacing / 2 || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
readonly property real __clearIndicator: (!clearIndicator.indicator || !clearIndicator.indicator.visible ? 0 : clearIndicator.indicator.width + control.spacing)
readonly property real __searchIndicator: (!searchIndicator.indicator || !searchIndicator.indicator.visible ? 0 : searchIndicator.indicator.width + control.spacing)
leftPadding: __config.leftPadding + (control.mirrored ? __clearIndicator + __searchIndicator : 0)
rightPadding: __config.rightPadding + (control.mirrored ? 0 : __clearIndicator + __searchIndicator)
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
readonly property string __currentState: [
!control.enabled && "disabled",
(control.searchIndicator.pressed && control.clearIndicator.pressed) && "hovered",
control.popup.visible && "open",
(control.searchIndicator.pressed && control.clearIndicator.pressed) && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: (control.popup.visible
? Config.controls.editablecombobox[__currentState]
: Config.controls.combobox[__currentState]) || {}
readonly property Item __focusFrameTarget: null
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
delegate: ItemDelegate {
width: ListView.view.width
text: model[control.textRole]
palette.text: control.palette.text
palette.highlightedText: control.palette.highlightedText
font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
highlighted: control.highlightedIndex === index
hoverEnabled: control.hoverEnabled
required property var model
required property int index
}
searchIndicator.indicator: Impl.StyleImage {
// use SpinBox indicator assets as they share the same style
readonly property string __state: [
(control.searchIndicator.hovered || control.searchIndicator.pressed) && "up",
(control.searchIndicator.indicator.enabled && control.searchIndicator.hovered && !control.searchIndicator.pressed) && "hovered",
(control.searchIndicator.indicator.enabled && control.searchIndicator.pressed) && "pressed",
(!control.searchIndicator.indicator.enabled) && "disabled"
].filter(Boolean).join("_") || "normal"
readonly property var indicatorConfig: Config.controls.spinbox[__state] || {}
imageConfig: indicatorConfig.indicator_up_background
x: !control.mirrored ? control.width - width - control.spacing : control.spacing
y: control.topPadding + (control.availableHeight - height) / 2
implicitWidth: 32
implicitHeight: 24
ColorImage {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: 13
height: 13
source: Qt.resolvedUrl("icons/search-magnifier")
color: control.palette.placeholderText
opacity: control.searchIndicator.pressed ? 0.7 : 1
}
}
clearIndicator.indicator: Impl.StyleImage {
// use SpinBox indicator assets as they share the same style
readonly property string __state: [
(control.clearIndicator.hovered || control.clearIndicator.pressed) && "down",
(control.clearIndicator.indicator.enabled && control.clearIndicator.hovered && !control.clearIndicator.pressed) && "hovered",
(control.clearIndicator.indicator.enabled && control.clearIndicator.pressed) && "pressed",
(!control.clearIndicator.indicator.enabled) && "disabled"
].filter(Boolean).join("_") || "normal"
readonly property var indicatorConfig: Config.controls.spinbox[__state] || {}
imageConfig: indicatorConfig.indicator_down_background
x: (!searchIndicator.indicator || !searchIndicator.indicator.visible)
? (!control.mirrored ? control.width - width - control.spacing : control.spacing)
: (!control.mirrored ? control.width - width - (control.spacing * 2) - searchIndicator.indicator.width : searchIndicator.indicator.width + (control.spacing * 2))
y: control.topPadding + (control.availableHeight - height) / 2
implicitWidth: 32
implicitHeight: 24
visible: control.text.length > 0
ColorImage {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: 13
height: 13
source: Qt.resolvedUrl("icons/close_big")
color: control.palette.placeholderText
opacity: control.clearIndicator.pressed ? 0.7 : 1
}
}
contentItem: T.TextField {
leftPadding: control.__config.label_contentItem.leftPadding
rightPadding: control.__config.label_contentItem.rightPadding
topPadding: control.__config.label_contentItem.topPadding
bottomPadding: control.__config.label_contentItem.bottomPadding
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
text: control.text
color: control.palette.text
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
horizontalAlignment: control.__config.label_text.textHAlignment
verticalAlignment: control.__config.label_text.textVAlignment
readonly property Item __focusFrameControl: control
ContextMenu.menu: Impl.TextEditingContextMenu {
editor: parent
}
}
background: ItemGroup {
Impl.StyleImage {
visible: !control.__isHighContrast
imageConfig: control.__config.background
Item {
visible: control.popup.visible || control.activeFocus
width: parent.width
height: 2
y: parent.height - height
Impl.FocusStroke {
width: parent.width
height: parent.height
radius: control.popup.visible ? 0 : control.__config.background.bottomOffset
color: control.palette.accent
}
}
}
Rectangle {
visible: control.__isHighContrast
implicitWidth: control.__config.background.width
implicitHeight: control.__config.background.height
color: control.palette.window
border.color: control.hovered ? control.palette.accent : control.palette.text
radius: 4
}
}
popup: T.Popup {
y: control.height
width: control.width
height: control.suggestionCount > 0 ? Math.min(contentItem.implicitHeight + topPadding + bottomPadding, control.Window.height - topMargin - bottomMargin) : 0
topMargin: 8
bottomMargin: 8
palette: control.palette
topPadding: control.__config.popup_contentItem.topPadding || 0
leftPadding: control.__config.popup_contentItem.leftPadding || 0
rightPadding: control.__config.popup_contentItem.rightPadding || 0
bottomPadding: control.__config.popup_contentItem.bottomPadding || 0
contentItem: ListView {
clip: true
implicitHeight: contentHeight
model: control.delegateModel
currentIndex: control.highlightedIndex
highlightMoveDuration: 0
}
enter: Transition {
NumberAnimation { property: "height"; from: control.popup.height / 3; to: control.popup.height; easing.type: Easing.OutCubic; duration: 250 }
}
background: ItemGroup {
Impl.StyleImage {
visible: !control.__isHighContrast
imageConfig: control.__config.popup_background.filePath ? control.__config.popup_background : Config.controls.popup["normal"].background // fallback to regular popup
}
Rectangle {
visible: control.__isHighContrast
implicitWidth: Config.controls.popup["normal"].background.width
implicitHeight: Config.controls.popup["normal"].background.height
color: control.palette.window
border.color: control.palette.text
radius: 4
}
}
}
}
@@ -0,0 +1,201 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.Slider {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitHandleWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitHandleHeight + topPadding + bottomPadding)
topPadding: horizontal ? __config.topPadding : __config.leftPadding || 0
leftPadding: horizontal ? __config.leftPadding : __config.bottomPadding || 0
rightPadding: horizontal ? __config.rightPadding : __config.topPadding || 0
bottomPadding: horizontal ? __config.bottomPadding : __config.rightPadding || 0
readonly property string __currentState: [
!control.enabled && "disabled",
control.enabled && !control.pressed && control.hovered && "hovered",
control.pressed && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.slider[__currentState] || {}
readonly property Item __focusFrameTarget: control
readonly property real __steps: Math.abs(to - from) / stepSize
readonly property bool __isDiscrete: stepSize >= Number.EPSILON
&& Math.abs(Math.round(__steps) - __steps) < Number.EPSILON
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
handle: ItemGroup {
x: Math.round(control.leftPadding + (control.horizontal
? control.visualPosition * (control.availableWidth - width)
: (control.availableWidth - width) / 2))
y: Math.round(control.topPadding + (control.horizontal
? (control.availableHeight - height) / 2
: control.visualPosition * (control.availableHeight - height)))
Impl.StyleImage {
visible: !control.__isHighContrast
imageConfig: control.__config.handle
}
Rectangle {
visible: control.__isHighContrast
implicitWidth: control.__config.handle.width
implicitHeight: control.__config.handle.height
color: control.palette.buttonText
radius: width / 2
}
property HoverHandler _hoverHandler: HoverHandler {
parent: control.handle
target: control.handle
}
property Rectangle indicator: Rectangle {
property real diameter: !control.enabled ? 10
: control.pressed ? 8
: control.__isHighContrast && !control.hovered ? 0
: control.handle?._hoverHandler.hovered ? 14 : 10
parent: control.handle
width: diameter
height: diameter
radius: diameter * 0.5
x: (control.__config.handle.width - width) / 2
y: (control.__config.handle.height - height) / 2
color: control.enabled ? (control.hovered ? Qt.rgba(control.palette.accent.r, control.palette.accent.g, control.palette.accent.b, 0.9020)
: control.pressed ? Qt.rgba(control.palette.accent.r, control.palette.accent.g, control.palette.accent.b, 0.8)
: control.palette.accent)
: control.palette.accent
Behavior on diameter {
// From WindowsUI 3 Animation Values
NumberAnimation {
duration: 167
easing.type: Easing.OutCubic
}
}
}
}
background: Item {
implicitWidth: control.horizontal
? (control.__config.groove.width)
: (control.__config.groove.height)
implicitHeight: control.horizontal
? (control.__config.groove.height)
: (control.__config.groove.width)
property Item _background: Impl.StyleImage {
visible: !control.__isHighContrast
parent: control.background
width: parent.width
height: parent.height
imageConfig: control.__config.background
property Item groove: Impl.StyleImage {
parent: control.background._background
x: control.leftPadding - control.leftInset + (control.horizontal
? control.__config.handle.width / 2
: (control.availableWidth - width) / 2)
y: control.topPadding - control.topInset + (control.horizontal
? ((control.availableHeight - height) / 2)
: control.__config.handle.height / 2)
width: control.horizontal
? control.availableWidth - control.__config.handle.width
: implicitWidth
height: control.horizontal
? implicitHeight
: control.availableHeight - control.__config.handle.width
imageConfig: control.__config.groove
horizontal: control.horizontal
property Rectangle track: Rectangle {
parent: control.background._background.groove
y: control.horizontal ? 0 : parent.height - (parent.height * control.position)
implicitWidth: control.horizontal ? control.__config.track.width : control.__config.track.height
implicitHeight: control.horizontal ? control.__config.track.height : control.__config.track.width
width: control.horizontal ? parent.width * control.position : parent.width
height: control.horizontal ? parent.height : parent.height * control.position
radius: control.__config.track.height * 0.5
color: control.palette.accent
}
}
property Repeater ticksTop: Repeater {
parent: control.__isHighContrast ? control.background._highContrastBackground : control.background._background.groove
model: control.__isDiscrete ? Math.floor(control.__steps) + 1 : 0
delegate: Rectangle {
width: control.horizontal ? 1 : 4
height: control.horizontal ? 4 : 1
x: control.horizontal
? 6 + index * (parent.width - 2 * 6 - width) / (control.background._background.ticksTop.model - 1)
: -4 - width
y: control.horizontal
? -4 - height
: 6 + index * (parent.height - 2 * 6 - height) / (control.background._background.ticksTop.model - 1)
color: Application.styleHints.colorScheme == Qt.Light ? "#9C000000" : "#9AFFFFFF"
required property int index
}
}
property Repeater ticksBottom: Repeater {
parent: control.__isHighContrast ? control.background._highContrastBackground : control.background._background.groove
model: control.__isDiscrete ? Math.floor(control.__steps) + 1 : 0
delegate: Rectangle {
width: control.horizontal ? 1 : 4
height: control.horizontal ? 4 : 1
x: control.horizontal
? 6 + index * (parent.width - 2 * 6 - width) / (control.background._background.ticksBottom.model - 1)
: parent.width + 4
y: control.horizontal
? parent.height + 4
: 6 + index * (parent.height - 2 * 6 - height) / (control.background._background.ticksBottom.model - 1)
color: Application.styleHints.colorScheme == Qt.Light ? "#9C000000" : "#9AFFFFFF"
required property int index
}
}
}
property Item _highContrastBackground: Rectangle {
parent: control.background
visible: control.__isHighContrast
implicitWidth: control.horizontal ? 200 : 4
implicitHeight: control.horizontal ? 4 : 200
x: control.leftPadding - control.leftInset + (control.horizontal
? control.__config.handle.width / 2
: (control.availableWidth - width) / 2)
y: control.topPadding - control.topInset + (control.horizontal
? ((control.availableHeight - height) / 2)
: control.__config.handle.height / 2)
width: control.horizontal
? control.availableWidth - control.__config.handle.width
: implicitWidth
height: control.horizontal
? implicitHeight
: control.availableHeight - control.__config.handle.width
radius: 2
color: control.palette.buttonText
scale: control.horizontal && control.mirrored ? -1 : 1
Rectangle {
y: control.horizontal ? 0 : parent.height - (parent.height * control.position)
implicitWidth: control.horizontal ? parent.width * control.position : parent.width
implicitHeight: control.horizontal ? parent.height : parent.height * control.position
radius: 2
color: control.palette.highlight
}
}
}
}
@@ -0,0 +1,146 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.SpinBox {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
up.implicitIndicatorHeight, down.implicitIndicatorHeight)
property string __controlState: [
enabled && (down.hovered || down.pressed) && "down",
enabled && (up.hovered || up.pressed) && !(down.hovered || down.pressed) && "up",
enabled && (hovered || down.hovered || up.hovered) && !(down.pressed || up.pressed) && "hovered",
enabled && (down.pressed || up.pressed) && "pressed",
!enabled && "disabled"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.spinbox[__controlState] || {}
readonly property var __downConfig: value == from ? Config.controls.spinbox["atlimit"] : __config
readonly property var __upConfig: value == to ? Config.controls.spinbox["atlimit"] : __config
readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
spacing: __config.contentItem.spacing || 0
leftPadding: ((!mirrored ? __config.leftPadding : __config.rightPadding) || 0) + (mirrored ? (up.indicator ? up.indicator.width * 2 : 0) : 0)
rightPadding: ((!mirrored ? __config.rightPadding : __config.leftPadding) || 0) + (!mirrored ? (up.indicator ? up.indicator.width * 2 : 0) : 0)
topPadding: __config.topPadding || 0
bottomPadding: __config?.bottomPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
validator: IntValidator {
locale: control.locale.name
bottom: Math.min(control.from, control.to)
top: Math.max(control.from, control.to)
}
contentItem: TextInput {
clip: width < implicitWidth
text: control.displayText
opacity: control.enabled ? 1 : 0.3
font: control.font
color: control.palette.buttonText
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
horizontalAlignment: control.mirrored ? Text.AlignRight : Text.AlignLeft
verticalAlignment: Text.AlignVCenter
readOnly: !control.editable
validator: control.validator
inputMethodHints: control.inputMethodHints
ContextMenu.menu: Impl.TextEditingContextMenu {
editor: parent
}
}
down.indicator: ItemGroup {
x: !control.mirrored ? control.up.indicator ? (control.up.indicator.x - width) : 0
: control.__config.rightPadding
y: control.topPadding
Impl.StyleImage {
height: control.availableHeight
visible: !control.__isHighContrast
imageConfig: control.__downConfig.indicator_down_background
}
Rectangle {
height: control.availableHeight
visible: control.__isHighContrast && control.down.pressed
color: control.down.pressed ? control.palette.highlight : control.palette.button
radius: control.__config.indicator_down_background.bottomOffset
}
ColorImage {
// Hack: Use Math.ceil/floor to avoid subpixel rendering issues
x: Math.ceil((parent.width - width) / 2)
y: Math.floor((parent.height - height) / 2)
width: implicitWidth
height: implicitHeight
source: control.__downConfig.indicator_down_icon.filePath
color: !control.__isHighContrast ? defaultColor : control.down.pressed ? control.palette.button : control.palette.buttonText
}
}
up.indicator: ItemGroup {
x: control.mirrored ? control.__config.rightPadding + (control.down.indicator ? control.down.indicator.width : 0)
: control.width - width - control.__config.rightPadding
y: control.topPadding
Impl.StyleImage {
height: control.availableHeight
visible: !control.__isHighContrast
imageConfig: control.__upConfig.indicator_up_background
}
Rectangle {
visible: control.__isHighContrast && control.up.pressed
height: control.availableHeight
color: control.up.pressed ? control.palette.highlight : control.palette.button
radius: control.__config.indicator_up_background.bottomOffset
}
ColorImage {
// Hack: Use Math.ceil/floor to avoid subpixel rendering issues
x: Math.ceil((parent.width - width) / 2)
y: Math.floor((parent.height - height) / 2)
width: implicitWidth
height: implicitHeight
source: control.__upConfig.indicator_up_icon.filePath
color: !control.__isHighContrast ? defaultColor : control.up.pressed ? control.palette.button : control.palette.buttonText
}
}
background: ItemGroup {
Impl.StyleImage {
visible: !control.__isHighContrast
imageConfig: control.__config.background
Item {
visible: control.activeFocus
width: parent.width
height: 2
y: parent.height - height
Impl.FocusStroke {
width: parent.width
height: parent.height
radius: control.__config.background.bottomOffset
color: control.palette.accent
}
}
}
Rectangle {
visible: control.__isHighContrast
color: control.palette.window
border.color: control.enabled && control.hovered || control.activeFocus ? control.palette.accent : control.palette.buttonText
border.width: control.editable && control.activeFocus ? 2 : 1
radius: control.__config.background.bottomOffset
}
}
}
@@ -0,0 +1,65 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
@Deprecated {
reason: "StyleImage component has been moved to private FluentWinUI3.impl module \
and is no longer part of the public QML API."
}
// This item will resize the child image in such a way that any drop shadow
// or blur (or other effects) will be drawn outside its own bounds.
// The effect is that users of this item won't have to take e.g shadows
// into account when positioning it, as such effects will only be visual, and
// not be a part of the geometry.
Item {
id: root
Component.onCompleted: {
print("StyleImage has been moved to private FluentWinUI3.impl module "
+ "and is no longer part of the public QML API.")
}
implicitWidth: horizontal ? imageConfig.width : imageConfig.height
implicitHeight: horizontal ? imageConfig.height : imageConfig.width
required property var imageConfig
// Set horizontal to false if you want the image to be rotated 90 degrees
// Doing so will rotate the image, but also flip it, to make sure that
// the shadow ends up on the correct side. The implicit geometry of the
// item will also be adjusted to match the rotated image.
property bool horizontal: true
// The minimum size of the image should be at least 1px tall and wide, even without any offsets
property real minimumWidth: Math.max(1, imageConfig.leftOffset + imageConfig.rightOffset)
property real minimumHeight: Math.max(1, imageConfig.topOffset + imageConfig.bottomOffset)
BorderImage {
x: -imageConfig.leftShadow
y: -imageConfig.topShadow
width: Math.max(root.minimumWidth, (root.horizontal ? root.width : root.height))
+ imageConfig.leftShadow + imageConfig.rightShadow
height: Math.max(root.minimumHeight, (root.horizontal ? root.height : root.width))
+ imageConfig.topShadow + imageConfig.bottomShadow
source: Qt.resolvedUrl(imageConfig.filePath)
border {
top: Math.min(height / 2, imageConfig.topOffset + imageConfig.topShadow)
left: Math.min(width / 2, imageConfig.leftOffset + imageConfig.leftShadow)
bottom: Math.min(height / 2, imageConfig.bottomOffset + imageConfig.bottomShadow)
right: Math.min(width / 2, imageConfig.rightOffset + imageConfig.rightShadow)
}
transform: [
Rotation {
angle: root.horizontal ? 0 : 90
},
Scale {
xScale: root.horizontal ? 1 : -1
}
]
}
}
@@ -0,0 +1,68 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
T.SwipeDelegate {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
bottomPadding: __config.bottomPadding || 0
icon.width: 16
icon.height: 16
readonly property string __currentState: [
!control.enabled && "disabled",
control.highlighted && "highlighted",
control.enabled && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.itemdelegate[__currentState] || {}
readonly property Item __focusFrameTarget: control
swipe.transition: Transition { SmoothedAnimation { duration: 167; easing.type: Easing.OutCubic } }
contentItem: IconLabel {
spacing: control.spacing
mirrored: control.mirrored
display: control.display
alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft
icon: control.icon
defaultIconColor: control.down ? pressedText : control.palette.buttonText
text: control.text
font: control.font
color: defaultIconColor
readonly property color pressedText: Application.styleHints.colorScheme === Qt.Light
? Color.transparent(control.palette.buttonText, 0.62)
: Color.transparent(control.palette.buttonText, 0.7725)
}
background: Rectangle {
implicitWidth: control.__config.background.width
implicitHeight: control.__config.background.height
readonly property bool lightScheme: Application.styleHints.colorScheme === Qt.Light
readonly property color bakcgroundColorTint: control.down
? lightScheme ? Color.transparent("black", 0.02) : Color.transparent("white", 0.04)
: control.hovered || control.highlighted
? lightScheme ? Color.transparent("black", 0.04) : Color.transparent("white", 0.06)
: "transparent"
color: Qt.tint(control.palette.window, bakcgroundColorTint)
}
}
@@ -0,0 +1,62 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl
T.Switch {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding,
implicitIndicatorWidth)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: control.text ? __config.topPadding || 0 : 0
leftPadding: control.text ? __config.leftPadding || 0 : 0
rightPadding: control.text ? __config.rightPadding || 0 : 0
bottomPadding: control.text ? __config.bottomPadding || 0 : 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
readonly property string __currentState: [
control.checked && "checked",
!control.enabled && "disabled",
control.enabled && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.switch_[__currentState] || {}
readonly property bool __mirroredIndicator: control.mirrored !== (__config.mirrored || false)
readonly property Item __focusFrameTarget: control
indicator: SwitchIndicator {
x: control.text ? (control.__mirroredIndicator ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
implicitWidth: control.__config.handle_background.width
implicitHeight: control.__config.handle_background.height
control: control
}
contentItem: Text {
leftPadding: control.indicator && !control.__mirroredIndicator ? control.indicator.width + control.spacing : 0
rightPadding: control.indicator && control.__mirroredIndicator ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
color: control.palette.text
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
}
@@ -0,0 +1,90 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
T.SwitchDelegate {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 10
topPadding: __config.topPadding || 0 + verticalOffset
leftPadding: __config.leftPadding || 0 + __horizontalOffset
rightPadding: __config.rightPadding || 0 + __horizontalOffset
bottomPadding: __config.bottomPadding || 0 + __verticalOffset
icon.width: 16
icon.height: 16
readonly property int __horizontalOffset: 4
readonly property int __verticalOffset: 2
readonly property string __currentState: [
!control.enabled && "disabled",
control.highlighted && "highlighted",
control.enabled && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.itemdelegate[__currentState] || {}
readonly property Item __focusFrameTarget: control
indicator: Impl.SwitchIndicator {
readonly property string currentState: [
control.checked && "checked",
!control.enabled && control.checked && "disabled",
control.enabled && control.checked && !control.down && control.hovered && "hovered",
control.down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var config: Config.controls.switch_[currentState] || {}
x: control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
implicitWidth: config.handle_background.width
implicitHeight: config.handle_background.height
control: control
}
contentItem: IconLabel {
leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing
rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing
spacing: control.spacing
mirrored: control.mirrored
display: control.display
alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft
icon: control.icon
defaultIconColor: control.down ? pressedText : control.palette.buttonText
text: control.text
font: control.font
color: defaultIconColor
readonly property color pressedText: Application.styleHints.colorScheme === Qt.Light
? Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.62)
: Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.7725)
}
background: Item {
implicitWidth: 160
implicitHeight: 40
property Item backgroundImage: Impl.StyleImage {
parent: control.background
imageConfig: control.__config.background
implicitWidth: parent.width - control.__horizontalOffset * 2
implicitHeight: parent.height - control.__verticalOffset * 2
x: control.__horizontalOffset
y: control.__verticalOffset
}
}
}
@@ -0,0 +1,54 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.TabBar {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
readonly property string __currentState: position === TabBar.Header
? (enabled ? "normal" : "disabled")
: (enabled ? "normal_footer" : "disabled_footer")
readonly property var __config: Config.controls.tabbar[__currentState] || {}
contentItem: ListView {
model: control.contentModel
currentIndex: control.currentIndex
spacing: control.__config.spacing
orientation: ListView.Horizontal
boundsBehavior: Flickable.StopAtBounds
flickableDirection: Flickable.AutoFlickIfNeeded
snapMode: ListView.SnapToItem
highlightMoveDuration: 0
highlightRangeMode: ListView.ApplyRange
preferredHighlightBegin: 48
preferredHighlightEnd: width - 48
}
background: Impl.StyleImage {
imageConfig: control.__config.background
}
}
@@ -0,0 +1,92 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
import QtQuick.Templates as T
T.TabButton {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
icon.width: 16
icon.height: 16
readonly property string __currentState: [
checked && "checked",
!enabled && "disabled",
enabled && !down && hovered && "hovered",
down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.tabbutton[__currentState] || {}
readonly property Item __focusFrameTarget: control
contentItem: IconLabel {
spacing: control.spacing
mirrored: control.mirrored
display: control.display
alignment: control.__config.label.textVAlignment | control.__config.label.textHAlignment
text: control.text
font: control.font
icon: control.icon
defaultIconColor: control.down ? pressedText : control.hovered ? hoveredText : control.palette.buttonText
color: control.icon.color
readonly property color pressedText: Application.styleHints.colorScheme === Qt.Light
? Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.447)
: Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.529)
readonly property color hoveredText: Application.styleHints.colorScheme === Qt.Light
? Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.62)
: Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.7725)
}
background: Impl.StyleImage {
imageConfig: control.__config.background
property Rectangle selector: Rectangle {
parent: control.background
x: (parent.width - implicitWidth) / 2
y: parent.height - height
height: 3
implicitWidth: 16
radius: height * 0.5
color: control.palette.accent
visible: control.checked
states: State {
name: "checked"
when: control.checked
PropertyChanges {
target: control.background.selector
width: 16
}
}
transitions: Transition {
to: "checked"
ParallelAnimation {
NumberAnimation { target: control.background.selector; property: "opacity"; from: 0; to: 1; easing.type: Easing.Linear; duration: 83}
NumberAnimation { target: control.background.selector; property: "scale"; from: 0.33; to: 1; easing.type: Easing.InOutCubic; duration: 167}
}
}
}
}
}
@@ -0,0 +1,78 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
T.TextArea {
id: control
implicitWidth: implicitBackgroundWidth + leftInset + rightInset
|| Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding,
placeholder.implicitHeight + topPadding + bottomPadding)
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
color: control.palette.text
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
placeholderTextColor: control.palette.placeholderText
verticalAlignment: Text.AlignVCenter
readonly property string __currentState: [
!enabled && "disabled",
activeFocus && "focused",
enabled && !activeFocus && hovered && "hovered",
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.textarea[__currentState] || {}
ContextMenu.menu: Impl.TextEditingContextMenu {
editor: control
}
PlaceholderText {
id: placeholder
x: control.leftPadding
y: control.topPadding
width: control.width - (control.leftPadding + control.rightPadding)
height: control.height - (control.topPadding + control.bottomPadding)
text: control.placeholderText
font: control.font
color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
horizontalAlignment: control.horizontalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
renderType: control.renderType
}
background: Impl.StyleImage {
imageConfig: control.__config.background
Item{
visible: control.activeFocus
width: parent.width
height: 2
y: parent.height - height
Impl.FocusStroke {
width: parent.width
height: parent.height
radius: control.__config.background.bottomOffset
color: control.palette.accent
}
}
}
}
@@ -0,0 +1,78 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl as Impl
T.TextField {
id: control
implicitWidth: implicitBackgroundWidth + leftInset + rightInset
|| Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding,
placeholder.implicitHeight + topPadding + bottomPadding)
readonly property string __currentState: [
!enabled && "disabled",
activeFocus && "focused",
enabled && !activeFocus && hovered && "hovered",
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.textfield[__currentState] || {}
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
color: control.palette.text
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
placeholderTextColor: control.palette.placeholderText
verticalAlignment: Text.AlignVCenter
ContextMenu.menu: Impl.TextEditingContextMenu {
editor: control
}
PlaceholderText {
id: placeholder
x: control.leftPadding
y: control.topPadding
width: control.width - (control.leftPadding + control.rightPadding)
height: control.height - (control.topPadding + control.bottomPadding)
text: control.placeholderText
font: control.font
color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
horizontalAlignment: control.horizontalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
renderType: control.renderType
}
background: Impl.StyleImage {
imageConfig: control.__config.background
Item{
visible: control.activeFocus
width: parent.width
height: 2
y: parent.height - height
Impl.FocusStroke {
width: parent.width
height: parent.height
radius: control.__config.background.bottomOffset
color: control.palette.accent
}
}
}
}
@@ -0,0 +1,37 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.FluentWinUI3.impl as Impl
T.ToolBar {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: SafeArea.margins.top + (__config.topPadding || 0)
bottomPadding: SafeArea.margins.bottom + (__config.bottomPadding || 0)
leftPadding: SafeArea.margins.left + (__config.leftPadding || 0)
rightPadding: SafeArea.margins.right + (__config.rightPadding || 0)
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
readonly property string __currentState: position === ToolBar.Header
? (enabled ? "normal" : "disabled")
: (enabled ? "normal_footer" : "disabled_footer")
readonly property var __config: Config.controls.toolbar[__currentState] || {}
background: Impl.StyleImage {
imageConfig: control.__config.background
}
}
@@ -0,0 +1,97 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Controls.FluentWinUI3.impl
import QtQuick.Templates as T
T.ToolButton {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
spacing: __config.spacing || 0
topPadding: __config.topPadding || 0
bottomPadding: __config.bottomPadding || 0
leftPadding: __config.leftPadding || 0
rightPadding: __config.rightPadding || 0
topInset: -__config.topInset || 0
bottomInset: -__config.bottomInset || 0
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
icon.width: __config.icon.width
icon.height: __config.icon.height
readonly property string __currentState: [
control.checked && "checked",
!control.enabled && "disabled",
control.enabled && !control.down && control.hovered && "hovered",
down && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.toolbutton[__currentState] || {}
readonly property Item __focusFrameTarget: control
contentItem: IconLabel {
spacing: control.spacing
mirrored: control.mirrored
display: control.display
icon: control.icon
defaultIconColor: {
if (Application.styleHints.accessibility.contrastPreference === Qt.HighContrast) {
if (!control.enabled)
return control.palette.buttonText
else if (control.checked && (control.hovered || control.down))
return control.palette.highlight
else if (!control.checked && !(control.down || control.hovered))
return control.palette.buttonText
else
return control.palette.button
}
if (control.down) {
return (control.checked || control.highlighted)
? Application.styleHints.colorScheme == Qt.Light
? Qt.rgba(1, 1, 1, 0.7) : Qt.rgba(0, 0, 0, 0.5)
: (Application.styleHints.colorScheme === Qt.Light
? Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.62)
: Qt.rgba(control.palette.buttonText.r, control.palette.buttonText.g, control.palette.buttonText.b, 0.7725))
} else if (control.checked || control.highlighted) {
return (Application.styleHints.colorScheme === Qt.Dark && !control.enabled)
? Qt.rgba(1, 1, 1, 0.5302)
: (Application.styleHints.colorScheme === Qt.Dark ? "black" : "white")
} else {
return control.palette.buttonText
}
}
text: control.text
font: control.font
color: defaultIconColor
}
background: ButtonBackground {
control: control
implicitHeight: control.__config.background.height
implicitWidth: implicitHeight
radius: control.__config.background.topOffset
subtle: !(control.checked || control.highlighted) || control.flat
highContrastBackgroundColorFunc: function() {
if (!control.enabled)
return "transparent"
else if (control.checked && control.hovered)
return control.palette.highlightedText
else if (control.checked || control.hovered)
return control.palette.highlight
else
return control.palette.button
}
}
}
@@ -0,0 +1,29 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Templates as T
T.ToolSeparator {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
padding: 2
topPadding: vertical ? __config.topPadding : padding
bottomPadding: vertical ? __config.bottomPadding : padding
leftPadding: vertical ? padding : __config.topPadding
rightPadding: vertical ? padding : __config.bottomPadding
readonly property var __config: Config.controls.toolbutton["normal"] || {}
contentItem: Rectangle {
implicitWidth: control.vertical ? 1 : control.__config.background.height
implicitHeight: control.vertical ? control.__config.background.height : 1
color: Application.styleHints.colorScheme === Qt.Light ? "#0F000000" : "#15FFFFFF"
}
}
@@ -0,0 +1,60 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Templates as T
import QtQuick.Effects
T.ToolTip {
id: control
x: parent ? (parent.width - implicitWidth) / 2 : 0
y: -implicitHeight
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
padding: 8
topInset: -8
bottomInset: -8
leftInset: -8
rightInset: -8
closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
contentItem: Text {
text: control.text
font: control.font
wrapMode: Text.Wrap
color: control.palette.toolTipText
}
background: Item {
MultiEffect {
x: -control.leftInset
y: -control.topInset
width: source.width
height: source.height
source: Rectangle {
width: control.background.width + control.leftInset + control.rightInset
implicitHeight: 30
height: control.background.height + control.topInset + control.bottomInset
color: control.palette.toolTipBase
border.width: 1
border.color: Application.styleHints.colorScheme === Qt.Light ? control.palette.midlight : Color.transparent(control.palette.shadow, 0.2)
radius: 4
}
shadowOpacity: Application.styleHints.colorScheme === Qt.Light ? 0.14 : 0.26
shadowColor: control.palette.shadow
shadowEnabled: true
shadowHorizontalOffset: 0
shadowVerticalOffset: 4
blurMax: 32
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Some files were not shown because too many files have changed in this diff Show More