-
Notifications
You must be signed in to change notification settings - Fork 2
/
IQNotificationBar.qml
64 lines (56 loc) · 1.79 KB
/
IQNotificationBar.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
64
/*
* This file is part of IQ Notifier.
*
* IQ Notifier is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* IQ Notifier is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with IQ Notifier. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.5
Item {
id: root
signal closeClicked()
property real elementsScale: 0.4
property alias color: bg.color
property alias closeButtonImageSource: closeImage.source
property alias textColor: barText.color
property alias textFontSize: barText.font.pointSize
property string text: ""
Rectangle {
id: bg
anchors.fill: parent
}
Text {
id: barText
text: root.text.length === 0 ? qsTr("Notification") : root.text
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
anchors.fill: parent
anchors.leftMargin: closeImage.width*0.4
}
MouseArea {
id: closeBtn
height: root.height
width: height
anchors.bottom: parent.bottom
anchors.top: parent.top
anchors.right: parent.right
hoverEnabled: true
Image {
id: closeImage
scale: elementsScale
anchors.fill: parent
opacity: parent.containsMouse ? 0.85 : 1
}
onClicked: closeClicked()
}
}