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. QRubberBand + QGLWidget + Transparency
Qt 6.11 is out! See what's new in the release blog

QRubberBand + QGLWidget + Transparency

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.7k Views 1 Watching
  • 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.
  • V Offline
    V Offline
    VitorAMJ
    wrote on last edited by
    #1

    Hello Guys,

    I had this problem I just forgot to fix, because it was not that important in my application. However, now I need it for some tests.

    In my QGLWidget I create a QRubberBand to select subsections of my OpenGL, I really am finding it difficult to make the QRubberBand half transparent.
    I found a post, but I don't have a viewport() to set parent as the problem was solved. "here":http://developer.qt.nokia.com/forums/viewthread/6544/
    I also found another thread pointing to an article teaching semitransparent QWidgets behind QGLWidget: "here":http://doc.qt.nokia.com/qq/qq26-openglcanvas.html
    In their example, the actual OpenGL scene rendering and widget controls are handled in a QGraphicsScene subclass, where the set up of a QGraphicsView with a QGLWidget viewport is performed. But I don't actually want all that in my program. Also, the transparency options used do not solve my problem.

    I have something like:
    QMainWindow parent of a QGLWidget subclass. This subclass is also set as centralWidget.
    Here is what I am trying:
    @origin = event->pos();
    rubberBand= new QRubberBand(QRubberBand::Rectangle, (QWidget*)this);
    rubberBand->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint /| Qt::ToolTip/);
    //tooltip moves coordinate system wrongly, but make it transparent
    rubberBand->setWindowOpacity((qreal)0.5); // no effect adding this line
    rubberBand->setGeometry(QRect(origin, QSize()));
    rubberBand->show();@

    Any ideas?
    Thanks,

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VitorAMJ
      wrote on last edited by
      #2

      I also found "this answer":http://developer.qt.nokia.com/faq/answer/is_it_possible_to_have_transparent_qt_widgets_on_top_of_a_qglwidget, but it sounds old or false.

      1 Reply Last reply
      0

      • Login

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