Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Transparent QWidget over a QGLWidget
QtWS25 Last Chance

Transparent QWidget over a QGLWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
qwidgetqglwidgettransparent
3 Posts 3 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • NIXINN Offline
    NIXINN Offline
    NIXIN
    wrote on last edited by
    #1

    I am trying to have a transparent QWidget over a QGLWidget something like below:

    QWidget *transparentWidget = new QWidget;
    transparentWidget->setFixedSize(1440, 720);
    transparentWidget->setAttribute(Qt::WA_TranslucentBackground);
    
    QGLWidget *glWidget  = new QGLWidget;
    transparentWidget->setParent(glWidget);
    transparentWidget->setGeometry(10, 50, 500, 500);
    
    transparentWidget->show();
    glWidget->show();
    

    But I am not getting the desired result. transparentWidget is being added at the specified geometry, however it is not transparent.

    How can I fix this??

    Any leads would be appreciated....

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Alain38 0
      wrote on last edited by Alain38 0
      #2

      Hi,
      Combine the setAttribute(Qt::WA_TranslucentBackground) with setWindowOpacity

      1 Reply Last reply
      0
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        Also, if you are on Qt 5.4 or newer, I suggest replacing QGLWidget with QOpenGLWidget. QOpenGLWidget resolves numerous issues with QGLWidget: https://blog.qt.io/blog/2014/09/10/qt-weekly-19-qopenglwidget/

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved