From cb649951ae56359b61de170df20981bed1f970ad Mon Sep 17 00:00:00 2001 From: Jeena Date: Fri, 12 Jun 2020 23:34:58 +0200 Subject: [PATCH] Make sidebar dissapear if thiner than 200px Often I wanted to make the sidebar dissapear because I don't need it. This patch let's you make it dissapear when it's thinner than 200px and reappear if it's wider. --- qml/Sidebar.qml | 9 +++++++-- qml/main.qml | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/qml/Sidebar.qml b/qml/Sidebar.qml index bcb70ee..ee7d762 100644 --- a/qml/Sidebar.qml +++ b/qml/Sidebar.qml @@ -48,6 +48,13 @@ ScrollView { } } + onWidthChanged: { + // Hide sidebar if smaller than 200px wide + if(width < 200) { + width = 0; + } + } + ListView { id: listView @@ -85,8 +92,6 @@ ScrollView { } item.content.post = server.posts[currentIndex] - //content.flickableItem.contentY = 0 - previousPost = item.content.post } } diff --git a/qml/main.qml b/qml/main.qml index a5fcbcb..1f6409f 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -184,7 +184,6 @@ ApplicationWindow { content: content server: server - Layout.minimumWidth: 200 implicitWidth: 300 textFontSize: app.textFontSize nightmode: app.nightmode