Results 1 to 9 of 9

Thread: Translucent Qt widget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Posts
    106
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Translucent Qt widget

    I am developing an application for Embedded Linux using Qt 4.6.2 where we need to display video along with UI. UI may have a hole along with other UI objects on screen where user can see the video displayed in background.

    I apply following attributes to every widget in my application:
    Qt Code:
    1. widget->setAttribute(Qt::WA_NoMousePropagation);
    2. widget->setAutoFillBackground(true);
    3. //widget->setAttribute(Qt::WA_OpaquePaintEvent);
    4. widget->setAttribute(Qt::WA_PaintOnScreen);
    To copy to clipboard, switch view to plain text mode 

    I use the following method to create a hole in UI at required place:

    Qt Code:
    1. void DVRGlobal::createHole(QWidget *widget)
    2. {
    3. if(widget==NULL)
    4. return;
    5. QWidget *parentWidget = widget;
    6. //Find out parent most widget
    7. while(parentWidget->parentWidget()!=NULL)
    8. parentWidget = parentWidget->parentWidget();
    9.  
    10. parentWidget->setAttribute(Qt::WA_TranslucentBackground);
    11. if(parentWidget!=widget)
    12. widget->setStyleSheet("background:transparent");
    13. }
    To copy to clipboard, switch view to plain text mode 

    This works with following two problems:
    (1) Translucent widget does not repaint itself and I only see the background until I hide/show the complete widget, and it is very slow too.
    (2) Any child widget on translucent widget does not repaint itself. i.e. when tool tip disappears on any widget, the background area is not repainted and remains black.
    Last edited by manojmka; 9th July 2010 at 11:47.

Similar Threads

  1. translucent background (on Gnome)
    By drus in forum Qt Programming
    Replies: 0
    Last Post: 31st May 2010, 08:23
  2. QT Quarterly 29 - Translucent Widgets
    By PLan2010 in forum Newbie
    Replies: 0
    Last Post: 17th May 2010, 09:32
  3. Have translucent window follow mouse
    By mike_am_i in forum Qt Programming
    Replies: 2
    Last Post: 27th October 2009, 10:18
  4. Translucent window background in 4.3.2 - possible?
    By dpimka in forum Qt Programming
    Replies: 2
    Last Post: 15th July 2009, 08:53
  5. Opague/Transparent/translucent
    By maverick_pol in forum Qt Programming
    Replies: 1
    Last Post: 22nd October 2008, 20:56

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
  •  
Qt is a trademark of The Qt Company.