Results 1 to 3 of 3

Thread: Transparent Canvas

  1. #1
    Join Date
    Dec 2017
    Posts
    19
    Thanks
    10
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Transparent Canvas

    Hi everyone,
    I want to make a semi-transparent canvas for qwtplot.
    But a black background will appear instead of parent widget behind it.
    QwtPlotCanvas Class Reference
    qwtmissed.png

  2. #2
    Join Date
    Jun 2016
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Transparent Canvas

    Try this in your QwtPlot class

    Qt Code:
    1. QString styleSheet = QString("QwtPlotCanvas { background: rgba(255, 255, 255, 100); }");
    2. setStyleSheet(styleSheet);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Transparent Canvas

    Better not - style sheets are a nightmare as there is no API to know them. Qwt tries its best to somehow reverse engineer its settings to handle rounded borders etc. but from the point of view of a widget library they are a PITA.
    But for setting the background you can simply change the palette - no need for using style sheets at all.

    Uwe

Similar Threads

  1. Replies: 4
    Last Post: 7th November 2017, 20:45
  2. Canvas never transparent
    By _qt_user_ in forum Qwt
    Replies: 4
    Last Post: 6th August 2012, 17:18
  3. Replies: 8
    Last Post: 17th April 2011, 18:16
  4. Replies: 0
    Last Post: 25th August 2010, 18:39
  5. Non-transparent QWidget on semi-transparent parent
    By EuroElessar in forum Qt Programming
    Replies: 0
    Last Post: 29th August 2008, 17:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.