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. How to set color of QChart background to radial gradient?
Qt 6.11 is out! See what's new in the release blog

How to set color of QChart background to radial gradient?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 574 Views 1 Watching
  • 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.
  • R Offline
    R Offline
    Rozerin YILDIZ
    wrote on last edited by
    #1

    I have a basic qchart in qt c++. I want to set the color of the background to a radial gradient, doesn't matter what color. Like this:

    534c370f-a3ee-41c1-a230-749e469bb901-image.png

    I can change the color of background of qchart with this code:

     chart->setBackgroundBrush(QBrush(QColor("salmon")));
    

    It is not a radial gradient. How can I set this?

    Pl45m4P 1 Reply Last reply
    0
    • R Rozerin YILDIZ

      I have a basic qchart in qt c++. I want to set the color of the background to a radial gradient, doesn't matter what color. Like this:

      534c370f-a3ee-41c1-a230-749e469bb901-image.png

      I can change the color of background of qchart with this code:

       chart->setBackgroundBrush(QBrush(QColor("salmon")));
      

      It is not a radial gradient. How can I set this?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @Rozerin-YILDIZ said in How to set color of QChart background to radial gradient?:

      I can change the color of background of qchart with this code:

      chart->setBackgroundBrush(QBrush(QColor("salmon")));

      If you set a plain color, you can't expect to receive any gradient...

      Use QRadialGradient.

      • https://doc.qt.io/qt-6/qradialgradient.html#details

      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      2

      • Login

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