matrixion/qml/components/AdaptiveLayoutElement.qml

26 lines
782 B
QML
Raw Normal View History

2021-06-06 00:36:08 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
2021-06-06 00:36:08 +03:00
// SPDX-License-Identifier: GPL-3.0-or-later
2021-06-13 02:48:11 +03:00
import QtQuick 2.12
import QtQuick.Controls 2.5
2021-06-13 03:48:22 +03:00
import QtQuick.Layouts 1.12
2021-06-06 00:36:08 +03:00
Item {
2022-04-16 03:13:01 +03:00
property bool collapsed: width < minimumWidth
2021-06-06 00:36:08 +03:00
property int collapsedWidth: 40
property bool collapsible: true
2022-04-16 03:13:01 +03:00
property int maximumWidth: 400
property int minimumWidth: 100
2021-06-06 00:36:08 +03:00
property int preferredWidth: 100
2022-04-16 03:13:01 +03:00
property int splitterWidth: 1
2021-06-06 00:36:08 +03:00
Component.onCompleted: {
children[0].width = Qt.binding(() => {
2022-04-16 03:13:01 +03:00
return parent.singlePageMode ? parent.width : width - splitterWidth;
});
2021-06-06 00:36:08 +03:00
children[0].height = Qt.binding(() => {
2022-04-16 03:13:01 +03:00
return parent.height;
});
2021-06-06 00:36:08 +03:00
}
}