diff options
author | Dennis Oberst <[email protected]> | 2024-01-15 14:38:36 +0100 |
---|---|---|
committer | Dennis Oberst <[email protected]> | 2024-01-16 11:38:39 +0100 |
commit | eaaa8647da5a39621c7bb963c75c3071d3bec9a7 (patch) | |
tree | cb5cb81266e793c4a004f12989cc10c74f42d0f9 /examples/quickcontrols/filesystemexplorer | |
parent | d06ed7fdd8beec490e453ce493e53041f58a2107 (diff) |
Filesystem Explorer: Add a minimum width and height
This prevents to reduce the window to a minimum of 1px (default), where
it gets hard to expand the window again. As a drive-by improve the
visualization of highlighted files.
Fixes: QTBUG-119785
Change-Id: Ib4a7f37fa4886589bad4cce534a9d73c352dd4ee
Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'examples/quickcontrols/filesystemexplorer')
-rw-r--r-- | examples/quickcontrols/filesystemexplorer/Main.qml | 2 | ||||
-rw-r--r-- | examples/quickcontrols/filesystemexplorer/qml/FileSystemView.qml | 15 |
2 files changed, 14 insertions, 3 deletions
diff --git a/examples/quickcontrols/filesystemexplorer/Main.qml b/examples/quickcontrols/filesystemexplorer/Main.qml index 9970ca02e2..4d9ce7f2da 100644 --- a/examples/quickcontrols/filesystemexplorer/Main.qml +++ b/examples/quickcontrols/filesystemexplorer/Main.qml @@ -16,6 +16,8 @@ ApplicationWindow { width: 1100 height: 600 + minimumWidth: 200 + minimumHeight: 100 visible: true color: Colors.background flags: Qt.Window | Qt.FramelessWindowHint diff --git a/examples/quickcontrols/filesystemexplorer/qml/FileSystemView.qml b/examples/quickcontrols/filesystemexplorer/qml/FileSystemView.qml index c25d518b4e..db955168c5 100644 --- a/examples/quickcontrols/filesystemexplorer/qml/FileSystemView.qml +++ b/examples/quickcontrols/filesystemexplorer/qml/FileSystemView.qml @@ -78,11 +78,20 @@ Rectangle { anchors.fill: directoryIcon source: directoryIcon - - colorizationColor: (treeDelegate.expanded && treeDelegate.hasChildren) - ? Colors.color2 : Colors.folder colorization: 1.0 brightness: 1.0 + colorizationColor: { + const isFile = treeDelegate.index === fileSystemTreeView.lastIndex + && !treeDelegate.hasChildren; + if (isFile) + return Qt.lighter(Colors.folder, 3) + + const isExpandedFolder = treeDelegate.expanded && treeDelegate.hasChildren; + if (isExpandedFolder) + return Colors.color2 + else + return Colors.folder + } } HoverHandler { |