aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml/TemplateSection.qml
blob: 3bebaca9b65b6ad8c24ee258c1112d4e9d84dc30 (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
27
28
29
30
31
32
33
34
35
36
// SPDX-License-Identifier: GPL-2.0
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11

Column {
	width: parent.width -20
	property string title: "no title"
	property bool isExpanded: false

	Button {
		width: parent.width

		background: Rectangle {
			id: buttonBackground
			antialiasing: true
			height: buttonText.height + 2
			width: parent.width
			border.color: "black"
			border.width: 1
			color: subsurfaceTheme.backgroundColor
			opacity: 0.5
		}
		contentItem: Text {
			id: buttonText
			font.pointSize: subsurfaceTheme.regularPointSize
			anchors.centerIn: buttonBackground
			color: subsurfaceTheme.textColor
			text: (isExpanded ? "- " : "+ ") + title
			font.bold: true
		}
		onClicked: {
			isExpanded = !isExpanded
		}
	}
}