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