Skip to content

Commit

Permalink
fix: Problems caused by image display ratio
Browse files Browse the repository at this point in the history
Log: Handled the problem that when the height/width of the image is too small, the actual size of the display style is incorrect and the interface problem when the image is displayed in the original scale.

BUG: https://pms.uniontech.com/bug-view-219009.html
     https://pms.uniontech.com/bug-view-168397.html
  • Loading branch information
JWWTSL authored and starhcq committed Aug 5, 2024
1 parent 2f8eed3 commit b9d745b
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 74 deletions.
94 changes: 57 additions & 37 deletions src/qml/Control/ListView/ThumbnailListDelegate.qml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ Item {
//border and shadow
Rectangle {
id: borderRect
anchors.fill: image
anchors.centerIn: parent
width: image.paintedWidth
height: image.paintedHeight
color: Qt.rgba(0, 0, 0, 0)
border.color: Qt.rgba(0, 0, 0, 0.1)
border.width: 1
Expand Down Expand Up @@ -264,37 +266,53 @@ Item {
Component {
id: selectedIconComponent
Item {
id: imageArea
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: 2
anchors.rightMargin: 2
width: 20
height: 20

//选中后显示的图标
DciIcon {
name: "select_active_1"
visible: true
anchors.centerIn: parent
}
id: iconArea

DciIcon {
name: "Inner_shadow"
visible: true
anchors.centerIn: parent
}
anchors.centerIn: parent// 确保阴影框居中于图片
width: image.paintedWidth + 14
height: image.paintedHeight + 14

DciIcon {
name: "shadow"
visible: true
anchors.centerIn: parent
}
Rectangle {
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: 2
anchors.rightMargin: 2
color: Qt.rgba(0,0,0,0)
width: 20
height: 20


// 选中后显示的图标
DciIcon {
id: selectIcon
name: "select_active_1"
visible: true
anchors.centerIn: parent
}

DciIcon {
name: "yes"
visible: true
anchors.centerIn: parent
// 内部阴影
DciIcon {
id: innerShadow
name: "Inner_shadow"
visible: true
anchors.centerIn: parent
}

// 外部阴影
DciIcon {
id: outerShadow
name: "shadow"
visible: true
anchors.centerIn: parent
}

// 确认图标
DciIcon {
id: confirmIcon
name: "yes"
visible: true
anchors.centerIn: parent
}
}
}
}
Expand All @@ -303,24 +321,25 @@ Item {
Component {
id: selectedFrameComponent
Item {
anchors.fill: parent
anchors.fill: image

z: -1

// 计算图片区域的位置
Rectangle {
id: imageArea
anchors.centerIn: parent
width: parent.width - 14
height: parent.height - 14
width: image.paintedWidth
height: image.paintedHeight
visible: false
}

//选中后显示的阴影框
// 选中后显示的阴影框
Rectangle {
id: selectShader
anchors.centerIn: parent
width: parent.width
height: parent.height
anchors.centerIn: parent// 确保阴影框居中于图片
width: image.paintedWidth + 14
height: image.paintedHeight + 14
radius: 10
color: "#AAAAAA"
visible: true
Expand All @@ -339,10 +358,11 @@ Item {
antialiasing: true
smooth: true
}

}
}



// 收藏图标组件
Component {
id: favoriteComponent
Expand Down
93 changes: 56 additions & 37 deletions src/qml/Control/ListView/ThumbnailListDelegate2.qml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ Item {
//border and shadow
Rectangle {
id: borderRect
anchors.fill: image
anchors.centerIn: parent
width: image.paintedWidth
height: image.paintedHeight
color: Qt.rgba(0, 0, 0, 0)
border.color: Qt.rgba(0, 0, 0, 0.1)
border.width: 1
Expand Down Expand Up @@ -204,37 +206,53 @@ Item {
Component {
id: selectedIconComponent
Item {
id: imageArea
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: 2
anchors.rightMargin: 2
width: 20
height: 20

//选中后显示的图标
DciIcon {
name: "select_active_1"
visible: true
anchors.centerIn: parent
}
id: iconArea

DciIcon {
name: "Inner_shadow"
visible: true
anchors.centerIn: parent
}
anchors.centerIn: parent// 确保阴影框居中于图片
width: image.paintedWidth + 14
height: image.paintedHeight + 14

DciIcon {
name: "shadow"
visible: true
anchors.centerIn: parent
}
Rectangle {
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: 2
anchors.rightMargin: 2
color: Qt.rgba(0,0,0,0)
width: 20
height: 20


// 选中后显示的图标
DciIcon {
id: selectIcon
name: "select_active_1"
visible: true
anchors.centerIn: parent
}

DciIcon {
name: "yes"
visible: true
anchors.centerIn: parent
// 内部阴影
DciIcon {
id: innerShadow
name: "Inner_shadow"
visible: true
anchors.centerIn: parent
}

// 外部阴影
DciIcon {
id: outerShadow
name: "shadow"
visible: true
anchors.centerIn: parent
}

// 确认图标
DciIcon {
id: confirmIcon
name: "yes"
visible: true
anchors.centerIn: parent
}
}
}
}
Expand All @@ -243,24 +261,25 @@ Item {
Component {
id: selectedFrameComponent
Item {
anchors.fill: parent
anchors.fill: image

z: -1

// 计算图片区域的位置
Rectangle {
id: imageArea
anchors.centerIn: parent
width: parent.width - 14
height: parent.height - 14
width: image.paintedWidth
height: image.paintedHeight
visible: false
}

//选中后显示的阴影框
// 选中后显示的阴影框
Rectangle {
id: selectShader
anchors.centerIn: parent
width: parent.width
height: parent.height
anchors.centerIn: parent// 确保阴影框居中于图片
width: image.paintedWidth + 14
height: image.paintedHeight + 14
radius: 10
color: "#AAAAAA"
visible: true
Expand All @@ -279,10 +298,10 @@ Item {
antialiasing: true
smooth: true
}

}
}


// 收藏图标组件
Component {
id: favoriteComponent
Expand Down

0 comments on commit b9d745b

Please sign in to comment.