Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. I want to apply a chart theme to a specific widget.

I want to apply a chart theme to a specific widget.

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 367 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    meria0503
    wrote on last edited by meria0503
    #1

    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?

    화면 캡처 2022-05-18 100144.png

    JonBJ 1 Reply Last reply
    0
    • M meria0503

      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?

      화면 캡처 2022-05-18 100144.png

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @meria0503
      What is a "charttheme", and how is it set, globally?
      If it is CSS you can apply that to any QWidget-derived element via setStyle() 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.

      M 1 Reply Last reply
      0
      • JonBJ JonB

        @meria0503
        What is a "charttheme", and how is it set, globally?
        If it is CSS you can apply that to any QWidget-derived element via setStyle() 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.

        M Offline
        M Offline
        meria0503
        wrote on last edited by meria0503
        #3

        @JonB

        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.

        JonBJ 1 Reply Last reply
        0
        • M meria0503

          @JonB

          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.

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved