Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Z-order issue for transparent WebengineViews in Qt6
Forum Updated to NodeBB v4.3 + New Features

Z-order issue for transparent WebengineViews in Qt6

Scheduled Pinned Locked Moved Unsolved QtWebEngine
1 Posts 1 Posters 224 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.
  • G Offline
    G Offline
    Gabriel Eles
    wrote on last edited by
    #1

    I know that WebEngineViews are using the Qt::WA_AlwaysStackOnTop attribute to properly put the views above everything else - if the background is set to Transparent color. In Qt5 I could show the views in intended z-order if I added them to the layout in the correct order.

    In Qt6 this has changed. It seems that regardless of the order I add the views to the layout, the web page with transparent background (set in the page's css) will always be shown above the web page with an opaque background (set in the page's css).

    How can I use the views in the z-order I want?

    QWebEngineView *view = new QWebEngineView(parent);
    view->load(QUrl("http://qt-project.org/"));
    view->page()->setBackgroundColor(Qt::transparent);
    
    QWebEngineView *view2 = new QWebEngineView(parent);
    view2->load(QUrl("https://test.com/transparent_page.html"));
    view2->page()->setBackgroundColor(Qt::transparent);
    
    QStackedLayout* stackedLayout = new QStackedLayout();
    stackedLayout->setStackingMode(QStackedLayout::StackAll);
    stackedLayout->addWidget(view2);
    stackedLayout->addWidget(view);
    
    setLayout(stackedLayout);
    

    The above code will put the "view" (qt-project.org page) above "view2" (transparent web page) in Qt5, but in Qt6 "view2" will always be above "view" regardless in which order I add them to the layout.

    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