1//-----------------------------------------------------------------------------
2/** @file pentobi/qml/ScoreElement.qml
3    @author Markus Enzenberger
4    @copyright GNU General Public License version 3 or later */
5//-----------------------------------------------------------------------------
6
7import QtQuick 2.0
8
9Item {
10    property alias color: point.color
11    property bool isFinal
12    property real value
13    property real bonus
14    property alias fontSize: text.font.pixelSize
15
16    implicitWidth: point.implicitWidth + text.implicitWidth
17                   + text.anchors.leftMargin
18    implicitHeight: Math.max(point.implicitHeight, text.implicitHeight)
19
20    Rectangle {
21        id: point
22
23        anchors.verticalCenter: parent.verticalCenter
24        implicitWidth: 0.7 * fontSize
25        implicitHeight: 0.7 * fontSize
26        radius: width / 2
27    }
28    Text {
29        id: text
30
31        anchors {
32            verticalCenter: parent.verticalCenter
33            left: point.right
34            leftMargin: 0.14 * font.pixelSize
35        }
36        text: ! isFinal ?
37                  "%L1".arg(value) :
38                  "%1<u>%L2</u>".arg(bonus > 0 ? "★" : "").arg(value)
39        color: theme.colorText
40        opacity: 0.8
41        font.preferShaping: false
42    }
43}
44