如何使下划线在QML中的PieSlice标签中不可见?

时间:2018-08-21 14:22:09

标签: qt qml qt5

我试图在QML中创建一个饼图,并以百分比值显示为标签。 我可以用PieSeries和PieSlice实现它。但是问题在于,百分比值(标签)总是显示有我不想显示的下划线。

尝试通过将PieSlice的labelFont.underline属性设置为FALSE,并将labelArmLengthFactor设置为0,但没有效果。

感谢您的帮助

请在下面找到我的main.qml代码(使用QQmlApplicationEngine从main.cpp加载)

import QtQuick 2.9
import QtQuick.Window 2.2
import QtCharts 2.0

    Window {
    visible: true;
    width: 300
    height: 300
    title: qsTr("PieChart")
    ChartView{
        id:chart
        anchors.fill:parent
        backgroundColor: "black"
        PieSeries{
            id : series
            PieSlice{
                label: "40%"
                value: 40
                color: "red"
                labelColor: color
                labelVisible : true;
                labelArmLengthFactor: 0
                labelFont.underline: false
            }
            PieSlice{
                label: "60%"
                value: 60
                color: "green"
                labelColor: color
                labelVisible : true;
                labelArmLengthFactor: 0
                labelFont.underline: false
            }
        }
    }
}

0 个答案:

没有答案