Results 1 to 4 of 4

Thread: [Question] How to get QWidget background transperent

  1. #1

    Question [Question] How to get QWidget background transperent

    Hey got a big problem.

    Googled now for 4 hours and tryed alot of idears...


    My problem is that i want to draw over another application.

    last thing whats missing is that only the background of the QWidget is transparent without the childs.


    this->setWindowOpacity(0.25);

    is "working" but it also makes all other things that i draw onto the frame transperent.


    anyone got a way to resolv that problem?

  2. #2
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: [Question] How to get QWidget background transperent

    Qt Code:
    1. QWidget::setStyleSheet("background-color: transparent;");
    To copy to clipboard, switch view to plain text mode 
    Last edited by rawfool; 31st May 2013 at 05:10.

  3. #3
    Join Date
    Feb 2013
    Location
    India
    Posts
    153
    Thanks
    27
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: [Question] How to get QWidget background transperent

    You can set the stylesheet to your widget.

    Qt Code:
    1. // Set window color transparent and border to none
    2. myWidget->setStyleSheet("background-color: transparent; border: none;");
    To copy to clipboard, switch view to plain text mode 

    CHEERS

  4. #4

    Default Re: [Question] How to get QWidget background transperent

    hey thanks for your fast replay.

    if i use: this->setStyleSheet("background-color: transparent; border: none;");

    the Window is just completly black.


    this is my code in constructor:

    Qt Code:
    1. ui->setupUi(this);
    2. this->setStyleSheet("background-color: transparent; border: none;");
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QPixmap as background of QWidget
    By Alan_K in forum Qt Programming
    Replies: 2
    Last Post: 17th March 2013, 15:03
  2. Replies: 9
    Last Post: 11th February 2011, 15:03
  3. How use svg to set QWidget background
    By sanjayshelke in forum Qt Programming
    Replies: 2
    Last Post: 29th June 2009, 11:47
  4. QWidget background
    By salmanmanekia in forum Qt Programming
    Replies: 4
    Last Post: 23rd July 2008, 10:55
  5. background image for QWidget
    By raman_31181 in forum Qt Programming
    Replies: 2
    Last Post: 8th March 2008, 11:13

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.