Meshroom/meshroom/ui/qml/Controls/TabPanel.qml
Fabien Castan 72e0e64e27
[ui] GraphEditor: fix QML errors
- fix anchors/layout/padding conflicts
- fix references to non-existing variables
- fix anchors to a position and not to an object
2019-11-29 11:34:15 +01:00

93 lines
2.9 KiB
QML

import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
Page {
id: root
property alias headerBar: headerLayout.data
property alias footerContent: footerLayout.data
property var tabs: []
property int currentTab: 0
clip: true
QtObject {
id: m
readonly property color paneBackgroundColor: Qt.darker(root.palette.window, 1.15)
}
padding: 0
header: Pane {
id: headerPane
padding: 0
background: Rectangle { color: m.paneBackgroundColor }
RowLayout {
width: parent.width
spacing: 0
TabBar {
id: mainTabBar
padding: 4
Layout.fillWidth: true
onCurrentIndexChanged: root.currentTab = currentIndex
Repeater {
model: root.tabs
TabButton {
text: modelData
y: mainTabBar.padding
padding: 4
width: 150
background: Rectangle {
color: index === mainTabBar.currentIndex ? root.palette.window : Qt.darker(root.palette.window, 1.30)
}
Rectangle {
property bool commonBorder : false
property int lBorderwidth : index === mainTabBar.currentIndex ? 2 : 1
property int rBorderwidth : index === mainTabBar.currentIndex ? 2 : 1
property int tBorderwidth : index === mainTabBar.currentIndex ? 2 : 1
property int bBorderwidth : 0
property int commonBorderWidth : 1
z : -1
color: Qt.darker(root.palette.window, 1.50)
anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: parent.bottom
topMargin : commonBorder ? -commonBorderWidth : -tBorderwidth
bottomMargin : commonBorder ? -commonBorderWidth : -bBorderwidth
leftMargin : commonBorder ? -commonBorderWidth : -lBorderwidth
rightMargin : commonBorder ? -commonBorderWidth : -rBorderwidth
}
}
}
}
}
Row { id: headerLayout }
}
}
footer: Pane {
id: footerPane
visible: footerLayout.children.length > 0
background: Rectangle { color: m.paneBackgroundColor }
RowLayout {
id: footerLayout
width: parent.width
}
}
}