2023-03-25 13:35:21 +08:00
|
|
|
|
import QtQuick 2.15
|
2023-03-27 18:24:35 +08:00
|
|
|
|
import QtQuick.Controls 2.15
|
2023-03-25 13:35:21 +08:00
|
|
|
|
import FluentUI 1.0
|
2023-03-08 18:14:21 +08:00
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
|
|
|
|
|
property string headerText: "Titlte"
|
|
|
|
|
property bool expand: false
|
2023-03-27 18:24:35 +08:00
|
|
|
|
property int contentHeight : 300
|
|
|
|
|
default property alias content: container.data
|
2023-03-08 18:14:21 +08:00
|
|
|
|
|
|
|
|
|
id:root
|
|
|
|
|
height: layout_header.height + container.height
|
|
|
|
|
width: 400
|
2023-03-10 18:08:32 +08:00
|
|
|
|
implicitWidth: width
|
|
|
|
|
implicitHeight: height
|
2023-03-08 18:14:21 +08:00
|
|
|
|
|
|
|
|
|
Rectangle{
|
|
|
|
|
id:layout_header
|
|
|
|
|
width: parent.width
|
2023-03-09 23:11:59 +08:00
|
|
|
|
height: 45
|
2023-03-08 18:14:21 +08:00
|
|
|
|
radius: 4
|
2023-03-28 21:37:10 +08:00
|
|
|
|
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
|
|
|
|
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
2023-03-08 18:14:21 +08:00
|
|
|
|
|
|
|
|
|
MouseArea{
|
|
|
|
|
id:root_mouse
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
onClicked: {
|
|
|
|
|
expand = !expand
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FluText{
|
|
|
|
|
text: headerText
|
|
|
|
|
anchors{
|
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
|
left: parent.left
|
|
|
|
|
leftMargin: 15
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FluIconButton{
|
|
|
|
|
anchors{
|
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
|
right: parent.right
|
|
|
|
|
rightMargin: 15
|
|
|
|
|
}
|
2023-03-12 14:26:03 +08:00
|
|
|
|
color:{
|
|
|
|
|
if(root_mouse.containsMouse){
|
2023-03-28 21:37:10 +08:00
|
|
|
|
return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(245/255,245/255,245/255,1)
|
2023-03-12 14:26:03 +08:00
|
|
|
|
}
|
2023-03-28 21:37:10 +08:00
|
|
|
|
return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
2023-03-12 14:26:03 +08:00
|
|
|
|
}
|
2023-03-11 00:29:06 +08:00
|
|
|
|
iconSize: 15
|
2023-03-12 21:49:11 +08:00
|
|
|
|
iconSource: expand ? FluentIcons.ChevronUp : FluentIcons.ChevronDown
|
2023-03-08 18:14:21 +08:00
|
|
|
|
onClicked: {
|
|
|
|
|
expand = !expand
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle{
|
|
|
|
|
id:container
|
|
|
|
|
width: parent.width
|
|
|
|
|
clip: true
|
|
|
|
|
anchors{
|
|
|
|
|
top: layout_header.bottom
|
|
|
|
|
left: layout_header.left
|
|
|
|
|
}
|
|
|
|
|
radius: 4
|
2023-03-28 21:37:10 +08:00
|
|
|
|
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
|
|
|
|
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
2023-03-08 18:14:21 +08:00
|
|
|
|
height: expand ? contentHeight : 0
|
|
|
|
|
Behavior on height {
|
|
|
|
|
NumberAnimation{
|
|
|
|
|
duration: 150
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|