Overlay Issue between QWebView and QOpenGL widget

  • I am trying to develop an application where I am loading an html page on QWebView and drawing a QOpenGLWidget on top of that to display few important graphic information.
    Facing few overlay issues to achieve this.

    The set up looks good when I use "setAttribute( Qt::WA_AlwaysStackOnTop)" attribute. But the problem starts when I use dropdowns or popovers from my html page on top of the widget.
    When I use html elements like drop-down(for example to select from a list of tools available) both the graphic item and the drop-down appear simultaneously(assuing WA_AlwaysStackOnTop is set).
    My requirement is to have the components like drop-down opaque so that whenever I have a drop-down on my html page, the graphics on the widget is not visible only for that particular region.

    Tried out different options, seems like nothing works.

    Given below is a brief account of what I am doing

    MainWindow::MainWindow(QWidget parent) :
    desktopWidget = QApplication::desktop();
    QRect screenRect = desktopWidget->screenGeometry();

    MAX_y = screenRect.height();
    MAX_x = screenRect.width();
    this->setFixedSize(MAX_x , MAX_y);
    wv = new QView(this);
    wv->setGeometry(0,0,this->width(), this->height());



    QView::QView(QWidget *parent) :
    QObject::connect(this, SIGNAL(loadFinished(bool)), this, SLOT(pageLoaded(bool)));
    viewer = new Viewer(parent, queue);
    QPalette palette = this->palette();
    palette.setBrush(QPalette::Base, Qt::transparent);
    this->setAttribute(Qt::WA_OpaquePaintEvent, false);

    QView::~QView() {

    void QView::loadPage(QUrl url) {
    QObject::connect(this->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(populateJavaScriptWindowObject()));

    void QView::pageLoaded(bool isOK) {

    this->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    // For Testing purpose only. setViewerPosition can be triggered from JavaScript layer.


    void QView::populateJavaScriptWindowObject() {
    this->page()->mainFrame()->addToJavaScriptWindowObject("jsbridge", this);

    void QView::setViewerPosition(int x, int y, int w, int h) {
    viewer->move(x, y);
    viewer->resize(w, h);

    Viewer::Viewer(QWidget parent) :
    desktopWidget = QApplication::desktop();
    m_ScreenRect = desktopWidget->screenGeometry();
    MAX_Y = m_ScreenRect.height();
    MAX_X = m_ScreenRect.width();
    layout = new ViewerLayout(2, 4, MAX_X/2, MAX_Y/2);
    setAttribute( Qt::WA_AlwaysStackOnTop);

    delete layout;

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.