Results 1 to 2 of 2

Thread: How to create transparent widgets on top of GLWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2016
    Location
    Pakistan
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to create transparent widgets on top of GLWidget

    Hi everyone,
    I am quite new to OpenGL programming, and i have a problem while creating transparent widgets over glWidget. I am using Qt 4.2 with C++ on centOs(linux) operating system. The requirements of my project are: to create a glwidget on the screen with some drawing(circles, shapes and so on). then we need to create some transparent widgets over the openGL widget in such a way that the drawing over glWidget should be visible under the new child widgets.
    The main files i have created is:
    First i have a main Widget (Form), and a child openGLWidget on the top of the main widget. Now the problem is that when i am creating transparent child widgets over the glWidget, then the system desktop is visible under the child widget instead of the drawing over glWidget. Some part of my code is:

    Qt Code:
    1. //constructor of MainWindow:
    2. // object of GLWidget
    3. glWidget = new GLWidget();
    4. glWidget ->setParent(this);
    5. glWidget ->resize(1024,800);
    6. glWidget ->show();
    7.  
    8. //creating object for child widget
    9. childWidget = new Form(glWidget );
    10. childWidget ->setParent(glWidget);
    11. childWidget ->setGeometery(1024-320,300,300,300);
    12. childWidget ->show();
    13.  
    14.  
    15. //constructor of child widget which should be transparent over the above glWidget
    16. widget.setupUi(this);
    17. setWindowFlags(Qt::FrameLessWindowHint);
    18. setAutoFillBackground(false);
    19. setAttribute(Qt::WA_NoSystemBackground);
    20. setAttribute(Qt::WA_TranslucentBackground);
    21. setAttribute(Qt::WA_PaintOnScreen);
    22. setAttribute(Qt::WA_TransparentForMouseEvents);
    23. setAttribute(Qt::WA_ContentsPropagated);
    To copy to clipboard, switch view to plain text mode 
    Any help will be appreciated.

    Thanks.
    Last edited by Anwar Said; 7th September 2016 at 14:47.

Similar Threads

  1. Replies: 2
    Last Post: 8th December 2015, 12:26
  2. Widgets on top of GLWidget on MacOS
    By GdelP in forum Qt Programming
    Replies: 1
    Last Post: 18th August 2013, 13:06
  3. Replies: 0
    Last Post: 30th September 2010, 13:22
  4. Replies: 2
    Last Post: 31st May 2010, 11:57
  5. Transparent widgets
    By incapacitant in forum Newbie
    Replies: 10
    Last Post: 21st March 2006, 18:01

Tags for this Thread

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.