Fix desktop model not found

This commit is contained in:
cutefishd 2021-04-05 15:24:52 +08:00
parent cbd653013b
commit 4f0489703a

View file

@ -61,7 +61,7 @@ Item {
} }
FolderModel { FolderModel {
id: folderModel id: dirModel
url: desktopPath() url: desktopPath()
isDesktop: true isDesktop: true
viewAdapter: viewAdapter viewAdapter: viewAdapter
@ -70,7 +70,7 @@ Item {
ItemViewAdapter { ItemViewAdapter {
id: viewAdapter id: viewAdapter
adapterView: _folderView adapterView: _folderView
adapterModel: folderModel adapterModel: dirModel
adapterIconSize: 40 adapterIconSize: 40
adapterVisibleArea: Qt.rect(_folderView.contentX, _folderView.contentY, adapterVisibleArea: Qt.rect(_folderView.contentX, _folderView.contentY,
_folderView.contentWidth, _folderView.contentHeight) _folderView.contentWidth, _folderView.contentHeight)
@ -85,7 +85,7 @@ Item {
maximumIconSize: globalSettings.maximumIconSize maximumIconSize: globalSettings.maximumIconSize
minimumIconSize: globalSettings.minimumIconSize minimumIconSize: globalSettings.minimumIconSize
focus: true focus: true
model: folderModel model: dirModel
onIconSizeChanged: { onIconSizeChanged: {
globalSettings.desktopIconSize = _folderView.iconSize globalSettings.desktopIconSize = _folderView.iconSize
@ -102,11 +102,11 @@ Item {
onActiveFocusChanged: { onActiveFocusChanged: {
if (!activeFocus) if (!activeFocus)
folderModel.clearSelection() dirModel.clearSelection()
} }
Component.onCompleted: { Component.onCompleted: {
folderModel.requestRename.connect(rename) dirModel.requestRename.connect(rename)
} }
} }
@ -115,21 +115,21 @@ Item {
function onKeyPress(event) { function onKeyPress(event) {
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return)
folderModel.openSelected() dirModel.openSelected()
else if (event.key === Qt.Key_C && event.modifiers & Qt.ControlModifier) else if (event.key === Qt.Key_C && event.modifiers & Qt.ControlModifier)
folderModel.copy() dirModel.copy()
else if (event.key === Qt.Key_X && event.modifiers & Qt.ControlModifier) else if (event.key === Qt.Key_X && event.modifiers & Qt.ControlModifier)
folderModel.cut() dirModel.cut()
else if (event.key === Qt.Key_V && event.modifiers & Qt.ControlModifier) else if (event.key === Qt.Key_V && event.modifiers & Qt.ControlModifier)
folderModel.paste() dirModel.paste()
else if (event.key === Qt.Key_F2) else if (event.key === Qt.Key_F2)
folderModel.requestRename() dirModel.requestRename()
else if (event.key === Qt.Key_L && event.modifiers & Qt.ControlModifier) else if (event.key === Qt.Key_L && event.modifiers & Qt.ControlModifier)
folderPage.requestPathEditor() folderPage.requestPathEditor()
else if (event.key === Qt.Key_A && event.modifiers & Qt.ControlModifier) else if (event.key === Qt.Key_A && event.modifiers & Qt.ControlModifier)
folderModel.selectAll() dirModel.selectAll()
else if (event.key === Qt.Key_Backspace) else if (event.key === Qt.Key_Backspace)
folderModel.up() dirModel.up()
} }
} }