qt QCharts 设置背景,背景透明

 

class Chartwidget : public QChartView


void Chartwidget::setBackground()
{
    m_chart->setBackgroundVisible(false);  //去背景

    QColor color(255,255,255,0);
    QPalette pal(palette());
    pal.setColor(QPalette::Window, color);
    setAutoFillBackground(true);
    QPen pen(color);
    this->setPalette(pal);
}

 

posted @ 2023-11-10 15:55  雾枫  阅读(562)  评论(0编辑  收藏  举报