Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkdeclarative
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#270
  • Loading branch information
deepin-ci-robot committed Jan 8, 2024
1 parent 5b1b075 commit f1d3ab5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion qt6/src/qml/ActionButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ T.Button {
id: control
property D.Palette textColor: DS.Style.button.text

palette.windowText: pressed ? D.ColorSelector.textColor : undefined
palette.windowText: pressed ? D.ColorSelector.textColor : parent ? parent.palette.windowText : undefined
opacity: D.ColorSelector.controlState === D.DTK.DisabledState ? 0.4 : 1
implicitWidth: DS.Style.control.implicitWidth(control)
implicitHeight: DS.Style.control.implicitHeight(control)
Expand Down
2 changes: 1 addition & 1 deletion qt6/src/qml/ItemDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ T.ItemDelegate {
spacing: DS.Style.control.spacing
checkable: true
autoExclusive: true
palette.windowText: checked && !control.cascadeSelected ? D.ColorSelector.checkedTextColor : undefined
palette.windowText: checked && !control.cascadeSelected ? D.ColorSelector.checkedTextColor : parent ? parent.palette.windowText : undefined

D.DciIcon.mode: D.ColorSelector.controlState
D.DciIcon.theme: D.ColorSelector.controlTheme
Expand Down
2 changes: 1 addition & 1 deletion qt6/src/qml/settings/NavigationTitle.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Control {
property D.Palette backgroundColor: DS.Style.settings.background
property D.Palette checkedTextColor: DS.Style.checkedButton.text

palette.windowText: checked ? D.ColorSelector.checkedTextColor : undefined
palette.windowText: checked ? D.ColorSelector.checkedTextColor : parent ? parent.palette.windowText : undefined
contentItem: Label {
text: Settings.SettingsGroup.name
font: __getFont(Settings.SettingsGroup.level)
Expand Down
7 changes: 7 additions & 0 deletions src/private/dquickcontrolpalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <QQuickItem>
#include <QQuickWindow>
#include <QDebug>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qquickpalette_p.h>
#endif

#include <private/qqmlopenmetaobject_p.h>
#include <private/qqmlglobal_p.h>
Expand Down Expand Up @@ -427,6 +430,10 @@ void DQuickControlColorSelector::setControl(QQuickItem *newControl)
m_control = newControl;

if (m_control) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
auto palette = m_control->property("palette").value<QQuickPalette*>();
connect(palette, &QQuickPalette::changed, this, &DQuickControlColorSelector::updateControlTheme);
#endif
connect(m_control, SIGNAL(paletteChanged()), this, SLOT(updateControlTheme()));
connect(m_control, SIGNAL(hoveredChanged()), this, SLOT(updateControlState()));
if (m_control->metaObject()->indexOfSignal("pressedChanged()") != -1) {
Expand Down

0 comments on commit f1d3ab5

Please sign in to comment.