-
Notifications
You must be signed in to change notification settings - Fork 1
/
MyComboBox.qml
47 lines (44 loc) · 1.59 KB
/
MyComboBox.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
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
ComboBox {
id: ctrl
width: (mscoreMajorVersion >= 4)?40:undefined
height: parent.height
//Layout.preferredHeight: parent.height
currentIndex: 0
font.pointSize: 10
font.family: (mscoreMajorVersion >= 4)? ui.theme.bodyFont.family : "segoe UI" ////
hoverEnabled: true
contentItem: Text {
text: ctrl.displayText
anchors.verticalCenter: parent.verticalCenter
color: (mscoreMajorVersion >= 4)? ui.theme.fontPrimaryColor : "white"
verticalAlignment: Text.AlignVCenter
leftPadding: 5
rightPadding: 10 + ctrl.indicator.width + ctrl.spacing
}
indicator: Canvas {
x: ctrl.width - width - ctrl.rightPadding
y: ctrl.topPadding + (ctrl.availableHeight - height) / 2
width: 8
height: 5
contextType: "2d"
onPaint: {
context.reset();
context.moveTo(0, 0);
context.lineTo(width, 0);
context.lineTo(width / 2, height);
context.closePath();
context.fillStyle = (mscoreMajorVersion >= 4)? ui.theme.fontPrimaryColor : "white";
context.fill();
}
}
background: Rectangle {
color:(mscoreMajorVersion >= 4)? ui.theme.textFieldColor : "#242427"
opacity: hovered ? 0.8:1
////border.width: parent && parent.activeFocus ? 2 : 1
border.color: (mscoreMajorVersion >= 4)? hovered? ui.theme.accentColor : ui.theme.strokeColor : "grey"
radius: 4
}
}