qml 怎么将ChartView 的 background 图层的边距设置为 0

小明 2025-05-05 20:19:20 6

��       qml的ChartView有个background图层,background图层默认是有边距的,而且这个边距是没有属性与方法可以修改的,假如我要创建两个ChartView,让他们纵向紧挨着,实际结果如图:

代码如下:

ColumnLayout {
        id: mainColumn
        anchors.fill: parent
        anchors.leftMargin: 10
        spacing: 0
        Item {
            id:firstRow
            Layout.fillWidth: true
            Layout.fillHeight: true
            Layout.preferredHeight: 10
        }
        RowLayout{
            id:afRow
            Layout.margins: 0
            Layout.fillWidth: true
            Layout.fillHeight: true
            Layout.maximumHeight: 42
            Layout.preferredHeight: (mainColumn.height-firstRow.height)*1/5
            Text {
                id: afText
                text: qsTr("房颤")
                Layout.alignment
The End
微信