GridView: adjust the size of the icon with Ctrl + Wheel
This commit is contained in:
parent
52ab6e64fa
commit
b3622b86f6
4 changed files with 46 additions and 2 deletions
|
@ -72,10 +72,15 @@ Item {
|
|||
|
||||
isDesktopView: true
|
||||
iconSize: globalSettings.desktopIconSize
|
||||
maximumIconSize: globalSettings.maximumIconSize
|
||||
minimumIconSize: globalSettings.minimumIconSize
|
||||
focus: true
|
||||
|
||||
model: folderModel
|
||||
|
||||
onIconSizeChanged: {
|
||||
globalSettings.desktopIconSize = _folderView.iconSize
|
||||
}
|
||||
|
||||
leftMargin: desktopView.screenAvailableRect ? desktopView.screenAvailableRect.x : 0
|
||||
topMargin: desktopView.screenAvailableRect ? desktopView.screenAvailableRect.y : 0
|
||||
rightMargin: desktopView.screenRect.width - (desktopView.screenAvailableRect.x + desktopView.screenAvailableRect.width)
|
||||
|
@ -84,6 +89,11 @@ Item {
|
|||
flow: GridView.FlowTopToBottom
|
||||
|
||||
delegate: FolderGridItem {}
|
||||
|
||||
onActiveFocusChanged: {
|
||||
if (!activeFocus)
|
||||
folderModel.clearSelection()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
|
|
@ -31,6 +31,8 @@ GridView {
|
|||
property int anchorIndex: 0
|
||||
|
||||
property var iconSize: settings.gridIconSize
|
||||
property var maximumIconSize: settings.maximumIconSize
|
||||
property var minimumIconSize: settings.minimumIconSize
|
||||
|
||||
property variant cachedRectangleSelection: null
|
||||
|
||||
|
@ -276,6 +278,15 @@ GridView {
|
|||
|
||||
onReleased: pressCanceled()
|
||||
onCanceled: pressCanceled()
|
||||
|
||||
onWheel: {
|
||||
if (wheel.modifiers & Qt.ControlModifier) {
|
||||
if (wheel.angleDelta.y > 0)
|
||||
control.increaseIconSize()
|
||||
else
|
||||
control.decreaseIconSize()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearPressState() {
|
||||
|
@ -376,6 +387,24 @@ GridView {
|
|||
return Math.floor(extraSpacing)
|
||||
}
|
||||
|
||||
function increaseIconSize() {
|
||||
if (iconSize >= control.maximumIconSize) {
|
||||
iconSize = control.maximumIconSize
|
||||
return
|
||||
}
|
||||
|
||||
iconSize += (iconSize * 0.1)
|
||||
}
|
||||
|
||||
function decreaseIconSize() {
|
||||
if (iconSize <= control.minimumIconSize) {
|
||||
iconSize = control.minimumIconSize
|
||||
return
|
||||
}
|
||||
|
||||
iconSize -= (iconSize * 0.1)
|
||||
}
|
||||
|
||||
Component {
|
||||
id: editorComponent
|
||||
|
||||
|
|
|
@ -129,6 +129,11 @@ Item {
|
|||
topMargin: Meui.Units.smallSpacing
|
||||
bottomMargin: Meui.Units.smallSpacing
|
||||
|
||||
onIconSizeChanged: {
|
||||
// Save
|
||||
settings.gridIconSize = _gridView.iconSize
|
||||
}
|
||||
|
||||
onCountChanged: {
|
||||
_fileTips.visible = count === 0
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.12
|
|||
import Qt.labs.settings 1.0
|
||||
|
||||
Settings {
|
||||
property int viewMethod: 0
|
||||
property int viewMethod: 1
|
||||
property bool showHidden: false
|
||||
property int width: 900
|
||||
property int height: 580
|
||||
|
|
Loading…
Reference in a new issue