Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/DetailsText.qml
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 74 | anchors { | |||
---|---|---|---|---|---|
76 | leftMargin: repeater.longestString - paintedWidth + Math.round(units.gridUnit / 2) | 76 | leftMargin: repeater.longestString - paintedWidth + Math.round(units.gridUnit / 2) | ||
77 | verticalCenter: parent.verticalCenter | 77 | verticalCenter: parent.verticalCenter | ||
78 | } | 78 | } | ||
79 | height: paintedHeight | 79 | height: paintedHeight | ||
80 | font.pointSize: theme.smallestFont.pointSize | 80 | font.pointSize: theme.smallestFont.pointSize | ||
81 | horizontalAlignment: Text.AlignRight | 81 | horizontalAlignment: Text.AlignRight | ||
82 | opacity: 0.6 | 82 | opacity: 0.6 | ||
83 | text: "<b>" + details[index*2] + "</b>:  " | 83 | text: "<b>" + details[index*2] + "</b>:  " | ||
84 | textFormat: Text.StyledText | ||||
broulik: Since there are HTML tags already, it defaults to `StyledText` already, but it doesn't hurt to… | |||||
84 | 85 | | |||
85 | Component.onCompleted: { | 86 | Component.onCompleted: { | ||
86 | if (paintedWidth > repeater.longestString) { | 87 | if (paintedWidth > repeater.longestString) { | ||
87 | repeater.longestString = paintedWidth | 88 | repeater.longestString = paintedWidth | ||
88 | } | 89 | } | ||
89 | } | 90 | } | ||
90 | } | 91 | } | ||
91 | 92 | | |||
92 | PlasmaComponents.Label { | 93 | PlasmaComponents.Label { | ||
93 | id: detailValueLabel | 94 | id: detailValueLabel | ||
94 | 95 | | |||
95 | anchors { | 96 | anchors { | ||
96 | left: detailNameLabel.right | 97 | left: detailNameLabel.right | ||
97 | right: parent.right | 98 | right: parent.right | ||
98 | verticalCenter: parent.verticalCenter | 99 | verticalCenter: parent.verticalCenter | ||
99 | } | 100 | } | ||
100 | height: paintedHeight | 101 | height: paintedHeight | ||
101 | elide: Text.ElideRight | 102 | elide: Text.ElideRight | ||
102 | font.pointSize: theme.smallestFont.pointSize | 103 | font.pointSize: theme.smallestFont.pointSize | ||
103 | opacity: 0.6 | 104 | opacity: 0.6 | ||
104 | text: details[(index*2)+1] | 105 | text: details[(index*2)+1] | ||
105 | textFormat: Text.PlainText | 106 | textFormat: Text.StyledText | ||
broulik: Make sure the text is HTML-escaped | |||||
106 | 107 | | |||
107 | MouseArea { | 108 | MouseArea { | ||
108 | anchors.fill: parent | 109 | anchors.fill: parent | ||
109 | acceptedButtons: Qt.RightButton | 110 | acceptedButtons: Qt.RightButton | ||
110 | onPressed: contextMenu.show(this, detailValueLabel.text, mouse.x, mouse.y) | 111 | onPressed: contextMenu.show(this, detailValueLabel.text, mouse.x, mouse.y) | ||
111 | } | 112 | } | ||
112 | } | 113 | } | ||
113 | } | 114 | } | ||
114 | 115 | | |||
115 | // Count total height from added items, somehow contentRect.height doesn't work | 116 | // Count total height from added items, somehow contentRect.height doesn't work | ||
116 | onItemAdded: { | 117 | onItemAdded: { | ||
117 | contentHeight = contentHeight + item.height | 118 | contentHeight = contentHeight + item.height | ||
118 | } | 119 | } | ||
119 | } | 120 | } | ||
120 | } | 121 | } | ||
121 | } | 122 | } |
Since there are HTML tags already, it defaults to StyledText already, but it doesn't hurt to be explicit