-
Notifications
You must be signed in to change notification settings - Fork 156
Expand file tree
/
Copy pathScreenTab.qml
More file actions
49 lines (47 loc) · 1.75 KB
/
Copy pathScreenTab.qml
File metadata and controls
49 lines (47 loc) · 1.75 KB
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
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.15
import org.deepin.dtk 1.0 as D
import org.deepin.dcc 1.0
Item {
id: root
property var screen
property alias model: repeater.model
signal screenClicked(var screen)
implicitHeight: 30
RowLayout {
Repeater {
id: repeater
delegate: Rectangle {
property bool isSelect: {
var modelName = model.modelData ? model.modelData.name : "null"
var screenName = screen ? screen.name : "null"
return model.modelData && screen ? model.modelData.name === screen.name : false
}
property alias hovered: mouseArea.containsMouse
implicitWidth: nameLabel.implicitWidth + 20
implicitHeight: 30
radius: 8
color: isSelect ? (D.DTK.themeType == D.ApplicationHelper.LightType ? Qt.rgba(0, 0, 0, 0.1) : Qt.rgba(1, 1, 1, 0.1)) : "transparent"
Label {
id: nameLabel
anchors.centerIn: parent
text: model.modelData.name
color: hovered ? this.palette.link : (isSelect ? this.palette.highlight : this.palette.text)
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
if (!isSelect) {
screenClicked(model.modelData)
}
}
}
}
}
}
}