Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DciIcon can't load icon by source #248

Merged
merged 1 commit into from
Dec 12, 2023
Merged
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
23 changes: 13 additions & 10 deletions qt6/src/qml/CheckDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import org.deepin.dtk.style 1.0 as DS

T.CheckDelegate {
id: control
property Component content: Label {
text: control.text
}
property Component content
property D.Palette backgroundColor: DS.Style.itemDelegate.checkBackgroundColor

implicitWidth: DS.Style.control.implicitWidth(control)
Expand Down Expand Up @@ -41,15 +39,20 @@ T.CheckDelegate {
}

contentItem: RowLayout {
spacing: control.spacing
D.DciIcon {
palette: D.DTK.makeIconPalette(control.palette)
mode: control.D.ColorSelector.controlState
theme: control.D.ColorSelector.controlTheme
name: control.icon.name
sourceSize: Qt.size(control.icon.width, control.icon.height)
D.IconLabel {
spacing: control.spacing
mirrored: control.mirrored
display: control.display
alignment: control.display === D.IconLabel.IconOnly || control.display === D.IconLabel.TextUnderIcon
? Qt.AlignCenter : Qt.AlignLeft | Qt.AlignVCenter
text: control.text
font: control.font
color: control.palette.windowText
icon: D.DTK.makeIcon(control.icon, control.D.DciIcon)
Layout.fillWidth: !control.content
}
Loader {
active: control.content
sourceComponent: control.content
Layout.fillWidth: true
}
Expand Down
3 changes: 1 addition & 2 deletions src/private/dquickdciiconimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ void DQuickDciIconImageItemPrivate::maybeUpdateUrl()
{
Q_Q(DQuickIconImage);
if (parentPriv->name.isEmpty()) {
q->setSource(QUrl());
return;
return DQuickIconImagePrivate::maybeUpdateUrl();
}

QUrl url;
Expand Down
23 changes: 13 additions & 10 deletions src/qml/CheckDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import org.deepin.dtk.style 1.0 as DS

T.CheckDelegate {
id: control
property Component content: Label {
text: control.text
}
property Component content
property D.Palette backgroundColor: DS.Style.itemDelegate.checkBackgroundColor

implicitWidth: DS.Style.control.implicitWidth(control)
Expand Down Expand Up @@ -41,15 +39,20 @@ T.CheckDelegate {
}

contentItem: RowLayout {
spacing: control.spacing
D.DciIcon {
palette: D.DTK.makeIconPalette(control.palette)
mode: control.D.ColorSelector.controlState
theme: control.D.ColorSelector.controlTheme
name: control.icon.name
sourceSize: Qt.size(control.icon.width, control.icon.height)
D.IconLabel {
spacing: control.spacing
mirrored: control.mirrored
display: control.display
alignment: control.display === D.IconLabel.IconOnly || control.display === D.IconLabel.TextUnderIcon
? Qt.AlignCenter : Qt.AlignLeft | Qt.AlignVCenter
text: control.text
font: control.font
color: control.palette.windowText
icon: D.DTK.makeIcon(control.icon, control.D.DciIcon)
Layout.fillWidth: !control.content
}
Loader {
active: control.content
sourceComponent: control.content
Layout.fillWidth: true
}
Expand Down
Loading