最近文件添加滑动条和文字超出折叠

This commit is contained in:
gjq 2023-02-14 10:09:55 +08:00 committed by hewenfei
parent 015186df71
commit 86a8b6387d
1 changed files with 67 additions and 40 deletions

View File

@ -17,6 +17,7 @@
*/
import QtQuick 2.0
import QtQuick.Controls 2.5
import org.ukui.menu.extension 1.0
import AppControls2 1.0 as AppControls2
@ -26,18 +27,41 @@ UkuiMenuExtension {
extensionData.recentFilesModel.updateData()
}
Item {
anchors.fill: parent
MouseArea {
anchors.fill: parent
hoverEnabled: true
onContainsMouseChanged: {
if (containsMouse) {
scrollBar.visible = true
}
else {
scrollBar.visible = false
}
}
ListView {
id: recentFileView
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 6
spacing: 4
ScrollBar.vertical: AppControls2.ScrollBar {
id: scrollBar
visible: false
width: 14
height: recentFileView.height
}
delegate: AppControls2.StyleBackground {
width: parent.width
width: parent.width - 18
height: 40
useStyleTransparent: false
alpha: itemArea.pressed ? 1 : itemArea.hovered ? 0.4 : 0
alpha: itemArea.pressed ? 1 : itemArea.hovered ? 0.65 : 0
radius: 8
Row {
anchors.fill: parent
@ -57,6 +81,7 @@ UkuiMenuExtension {
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
text: model.name
elide: Text.ElideRight
}
}
@ -81,3 +106,5 @@ UkuiMenuExtension {
}
}
}
}
}