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. Transparent background: QChartView

Transparent background: QChartView

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 2.1k 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.
  • F Offline
    F Offline
    fem_dev
    wrote on last edited by
    #1

    I would like to create a QChartView with transparent background, I mean, no white default background.

    I tryed:

    legendView->setWindowFlags(Qt::FramelessWindowHint);
    legendView->setAttribute(Qt::WA_NoSystemBackground);
    legendView->setAttribute(Qt::WA_TranslucentBackground, true);
    legendView->setAttribute(Qt::WA_TransparentForMouseEvents);
    legendView->setWindowOpacity(0.5);
    

    and

    chart->setContentsMargins(0, 0, 0, 0);
    chart->setBackgroundRoundness(0);
    

    But I got always the same white background.
    4af6927d-c792-4bb3-9d79-32eb1a66072b-image.png

    How can I do this?

    SamurayHS 1 Reply Last reply
    0
    • F fem_dev

      I would like to create a QChartView with transparent background, I mean, no white default background.

      I tryed:

      legendView->setWindowFlags(Qt::FramelessWindowHint);
      legendView->setAttribute(Qt::WA_NoSystemBackground);
      legendView->setAttribute(Qt::WA_TranslucentBackground, true);
      legendView->setAttribute(Qt::WA_TransparentForMouseEvents);
      legendView->setWindowOpacity(0.5);
      

      and

      chart->setContentsMargins(0, 0, 0, 0);
      chart->setBackgroundRoundness(0);
      

      But I got always the same white background.
      4af6927d-c792-4bb3-9d79-32eb1a66072b-image.png

      How can I do this?

      SamurayHS Offline
      SamurayHS Offline
      SamurayH
      wrote on last edited by
      #2

      Hi,
      Try using QChart::setBackgroundVisible:

      chart->setBackgroundVisible(false);
      

      "قال رسول الله صلى الله عليه وسلم : " أحب الناس إلى الله أنفعهم للناس

      F 1 Reply Last reply
      5
      • SamurayHS SamurayH

        Hi,
        Try using QChart::setBackgroundVisible:

        chart->setBackgroundVisible(false);
        
        F Offline
        F Offline
        fem_dev
        wrote on last edited by
        #3

        @SamurayH Thank you so much! I'm looking for this line for hours in the Qt documentation...

        1 Reply Last reply
        1

        • Login

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