-
Notifications
You must be signed in to change notification settings - Fork 0
/
TabRectangle.qml
executable file
·63 lines (60 loc) · 1.97 KB
/
TabRectangle.qml
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
Rectangle {
id: tabRectangle
color: styleData.selected ? fillColor : nonSelectedColor
border.width: 1
border.color: frameColor
implicitWidth: tabs.width / (tabs.count + 2);
implicitHeight: 20
Rectangle { height: parent.height ; width: 1; color: frameColor;}
Rectangle { x: parent.width - 2; height: parent.height ; width: 1; color: frameColor;}
Rectangle {
anchors.left: parent.left
height: parent.height - parent.border.width - 1
anchors.verticalCenter: parent.verticalCenter
width: parent.width - 15
color: parent.color
clip: true
Text {
id: text
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 10
text: styleData.title
elide: Text.ElideRight
color: "#000000"
font.pointSize: 12
font.italic: true
}
}
Button {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: 4
height: 10
style: ButtonStyle {
background: Rectangle {
implicitWidth: 10
implicitHeight: 10
color: control.hovered ? "#DC143C" : tabRectangle.color
Text
{
text: "X"
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
color: control.hovered ? "#FFFFFF" : "#000000"
}
}
}
onClicked:
{
tabs.removeTab(styleData.index);
if(!tabs.count)
tabs.createEmptyTab(tabs.defaultProfile);
}
}
}