Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions qt6/src/qml/Button.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ T.Button {
opacity: D.ColorSelector.controlState === D.DTK.DisabledState ? 0.4 : 1
D.DciIcon.mode: D.ColorSelector.controlState
D.DciIcon.theme: D.ColorSelector.controlTheme
D.DciIcon.palette: D.DTK.makeIconPalette(palette)
palette.windowText: D.ColorSelector.textColor
D.DciIcon.palette: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉这样改有点儿奇怪,这含义有点儿不同,D.DciIcon.palette针对的是dci图标的调色板,只对图标有效,
而palette.windowText针对的是qt的调色板,是通用的,
可能存在没有D.DciIcon.palette 但有palette.windowText的情况,

const iconPalette = D.DTK.makeIconPalette(control.palette)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不应该用const修饰吧,

iconPalette.foreground = control.D.ColorSelector.textColor
return iconPalette
}
icon {
width: DS.Style.button.iconSize
height: DS.Style.button.iconSize
Expand Down
2 changes: 1 addition & 1 deletion qt6/src/qml/ButtonIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Rectangle {
width: DS.Style.buttonIndicator.iconSize
}
name: "arrow_ordinary_down"
palette: control.D.DTK.makeIconPalette(control.palette)
palette: control.D.DciIcon.palette

@18202781743 18202781743 Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不需要用control.D.DciIcon.palette吧,用原来的D.DTK.makeIconPalette(control.palette)应该也可以吧,control不一定是Button,有附加属性DciIcon.palette的值吧,

mode: control.D.ColorSelector.controlState
theme: control.D.ColorSelector.controlTheme
fallbackToQIcon: false
Expand Down
2 changes: 1 addition & 1 deletion qt6/src/qml/IconButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Button {
contentItem: D.DciIcon {
smooth: control.smooth
name: control.icon.name
palette: D.DTK.makeIconPalette(control.palette)
palette: control.D.DciIcon.palette
mode: control.D.ColorSelector.controlState
theme: control.D.ColorSelector.controlTheme
sourceSize: Qt.size(control.icon.width, control.icon.height)
Expand Down
19 changes: 12 additions & 7 deletions qt6/src/qml/ItemDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,19 @@ T.ItemDelegate {
spacing: DS.Style.control.spacing
checkable: true
autoExclusive: true
palette.windowText: {
let undraged = D.DTK.hasAnimation ? control.backgroundVisible && !dragActive : true
return checked && !control.cascadeSelected && undraged ? D.ColorSelector.checkedTextColor : undefined
}

D.DciIcon.mode: D.ColorSelector.controlState
D.DciIcon.theme: D.ColorSelector.controlTheme
D.DciIcon.palette: D.DTK.makeIconPalette(palette)
D.DciIcon.palette: {
const iconPalette = D.DTK.makeIconPalette(control.palette)
const dragAllowsSelection = D.DTK.hasAnimation
? control.backgroundVisible && !control.dragActive
: true
iconPalette.foreground = control.checked && !control.cascadeSelected && dragAllowsSelection
? control.D.ColorSelector.checkedTextColor
: control.palette.windowText
return iconPalette
}
icon {
width: DS.Style.itemDelegate.iconSize
height: DS.Style.itemDelegate.iconSize
Expand All @@ -65,7 +70,7 @@ T.ItemDelegate {

sourceComponent: D.DciIcon {
smooth: control.smooth
palette: D.DTK.makeIconPalette(control.palette)
palette: control.D.DciIcon.palette
mode: control.D.ColorSelector.controlState
theme: control.D.ColorSelector.controlTheme
fallbackToQIcon: false
Expand All @@ -84,7 +89,7 @@ T.ItemDelegate {
? Qt.AlignCenter : Qt.AlignLeft | Qt.AlignVCenter
text: control.text
font: control.font
color: control.palette.windowText
color: control.D.DciIcon.palette.foreground
icon: D.DTK.makeIcon(control.icon, control.D.DciIcon)
Layout.fillWidth: !control.contentFlow
}
Expand Down
9 changes: 6 additions & 3 deletions qt6/src/qml/MenuItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ T.MenuItem {
: DS.Style.menu.itemText
property D.Palette subMenuBackgroundColor: DS.Style.menu.subMenuOpenedBackground

palette.windowText: D.ColorSelector.textColor
D.DciIcon.mode: D.ColorSelector.controlState
D.DciIcon.theme: D.ColorSelector.controlTheme
D.DciIcon.palette: D.DTK.makeIconPalette(palette)
D.DciIcon.palette: {
const iconPalette = D.DTK.makeIconPalette(control.palette)
iconPalette.foreground = control.D.ColorSelector.textColor
return iconPalette
}
contentItem: D.IconLabel {
readonly property real arrowPadding: control.subMenu && control.arrow ? control.arrow.width + control.spacing : 0
readonly property real indicatorPadding: control.useIndicatorPadding && control.indicator ? control.indicator.width + control.spacing : 0
Expand All @@ -44,7 +47,7 @@ T.MenuItem {
alignment: Qt.AlignLeft
text: control.text
font: control.font
color: control.palette.windowText
color: control.D.ColorSelector.textColor
Behavior on color {
enabled: D.DTK.hasAnimation
ColorAnimation { duration: control.hovered ? 100 : 0; }
Expand Down
2 changes: 1 addition & 1 deletion qt6/src/qml/WindowButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ D.IconButton {
smooth: control.smooth
name: control.icon.name
asynchronous: false
palette: D.DTK.makeIconPalette(control.palette)
palette: control.D.DciIcon.palette
mode: control.D.ColorSelector.controlState
theme: control.D.ColorSelector.controlTheme
sourceSize: Qt.size(control.icon.width, control.icon.height)
Expand Down
Loading