1 Star 0 Fork 6

豆腐干二等分/ukui-clipboard

forked from openKylin/ukui-clipboard 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ImagePreviewArea.qml 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import ContentMenu 1.0
Item {
id: root
property int visibleWidth: 0
property int visibleHeight: 0
Rectangle {
width: parent.visibleWidth
height: parent.visibleHeight
anchors.horizontalCenter: parent.horizontalCenter
color: "transparent"
Flickable {
id: flick
anchors.fill: parent
contentWidth: screenshot.paintedWidth
contentHeight: screenshot.paintedHeight
boundsMovement: Flickable.StopAtBounds
clip: true
ScrollBar.vertical: ScrollBar {
active: true
visible: flick.contentHeight > flick.height
}
ScrollBar.horizontal: ScrollBar {
active: true
visible: flick.contentWidth > flick.width
}
// 鼠标事件处理区域
MouseArea {
anchors.fill: parent
onWheel: {
if (wheel.modifiers & Qt.ShiftModifier) {
flick.contentX -= wheel.angleDelta.y
} else {
flick.contentY -= wheel.angleDelta.y
}
}
}
Image {
id: screenshot
x: root.width > paintedWidth ? Math.round((root.width - paintedWidth) / 2) : 0
y: root.height > paintedHeight ? Math.round((root.height - paintedHeight) / 2) : 0
cache: false
fillMode: Image.PreserveAspectFit
source: "image://inMemoryImages/Image0"
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ll-eleven/ukui-clipboard.git
git@gitee.com:ll-eleven/ukui-clipboard.git
ll-eleven
ukui-clipboard
ukui-clipboard
openkylin/nile

搜索帮助