I want to apply a chart theme to a specific widget.
-
I saw an example of chartheme, and the example is a method of applying it by setting it as global, but I want to apply the chart only. How shall I do it?

@meria0503
What is a "charttheme", and how is it set, globally?
If it is CSS you can apply that to anyQWidget-derived element viasetStyle()and it only applies to that element downward (i.e. it descendants), so put it on whatever the closest widget ancestor to your chart is. -
@meria0503
What is a "charttheme", and how is it set, globally?
If it is CSS you can apply that to anyQWidget-derived element viasetStyle()and it only applies to that element downward (i.e. it descendants), so put it on whatever the closest widget ancestor to your chart is. -
Can I apply only graphView as stylesheet?
https://doc.qt.io/qt-5/qtcharts-chartthemes-example.html << I think this example applies globally. I just wanted to apply that graph. It just didn't work out.
@meria0503
I see in https://doc.qt.io/qt-5/qtcharts-chartthemes-example.html#changing-theme:The user can select a built-in theme to be used in the example. This theme is then applied to all charts in the layout.
QChart::ChartTheme theme = static_cast<QChart::ChartTheme>( m_ui->themeComboBox->itemData(m_ui->themeComboBox->currentIndex()).toInt()); chartView->chart()->setTheme(theme);I know no more than what it states there.