summary refs log tree commit diff
path: root/resources/qml/components/AdaptiveLayoutElement.qml
blob: 411f6c64e6bc688805e97f5a7326ae1cc951b724 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

Item {
    property int minimumWidth: 100
    property int maximumWidth: 400
    property int collapsedWidth: 40
    property bool collapsible: true
    property bool collapsed: width < minimumWidth
    property int splitterWidth: 1
    property int preferredWidth: 100

    Component.onCompleted: {
        children[0].width = Qt.binding(() => {
            return parent.singlePageMode ? parent.width : width - splitterWidth;
        });
        children[0].height = Qt.binding(() => {
            return parent.height;
        });
    }
}