Results 1 to 4 of 4

Thread: How to draw opaque background with WA_TranslucentBackground active

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2020
    Qt products

    Default How to draw opaque background with WA_TranslucentBackground active

    Edit: forgot to add - I am using Qt 5.15 under Windows 10 MSYS2 MinGW

    I have a QMainWindow subclass with
    Qt Code:
    1. setAttribute(Qt::WA_TranslucentBackground);
    To copy to clipboard, switch view to plain text mode 
    in its constructor. I want the widgets to be transparent by default, which works. But now I want to add a special widget, say the member "QWidget* m_opaque;", with a fixed non-transparent background color. However even with
    • m_opaque->setAutofillBackground(true);
    • m_opaque->setAttribute(Qt::WA_OpaquePaintEvent);
    • m_opaque->setWindowOpacity(1.0);
    • m_opaque->setStyleSheet("{ background-color: grey; }");

    the widget still has transparent background .. how do I make it opaque?
    Last edited by Maryu; 4th September 2020 at 22:25. Reason: platform/version info

Similar Threads

  1. Replies: 4
    Last Post: 12th August 2011, 13:20
  2. Replies: 2
    Last Post: 27th June 2011, 14:44
  3. Replies: 3
    Last Post: 8th October 2010, 20:01
  4. Replies: 1
    Last Post: 25th June 2010, 19:31
  5. opacity of QLabel(background opaque)
    By Stephano in forum Qt Tools
    Replies: 1
    Last Post: 9th May 2006, 13:57


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.