qml ChartView的属性plotArea设置踩坑

在前端开发中,使用 QML 的 ChartView 绘制表格时遇到了 plotArea 属性设置的问题。尝试去除表格的空白区域,却发现第一个表格无法完全填充其父窗口。经过调试发现,必须将 afChartView 的 height 属性设置为至少 86 才能使 plotArea 正常工作,这是一个意外的坑。
摘要由CSDN通过智能技术生成

我需要两个表格,每个表格都去掉空白区域,于是使用plotArea属性设置表格绘图区域,但是很奇怪的是,第一个表格始终不能填满父窗口,如下图:

代码如下:

ColumnLayout {
        id: mainColumn
        x: 10
        width: parent.width-10
        height: 205
        spacing: 0

        onWidthChanged:{
            console.log(mainColumn.width)
        }

        RowLayout{
            id:afRow
            Layout.margins: 0
            Layout.fillWidth: true
            Layout.fillHeight: true
            Layout.preferredHeight: parent.height*1/3
            Layout.preferredWidth: parent.width

            onWidthChanged:{
                console.log("afRow.height=", afRow.height)
                console.log("rrRow.height=", rrRow.height)
            }

            Text {
                id: afText
           
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值