PDA

View Full Version : How to show the web element overlay the transparent window on webkit?



horoma
20th November 2012, 04:00
Hi all,


void WebView::paintEvent(QPaintEvent *event){
QWebView::paintEvent(event);
QPainter p(this);
p.setCompositionMode(QPainter::CompositionMode_Cle ar);
p.fillRect(10, 10, 100, 100, Qt::transparent);
}

I override the paintEvent on WebView, so that the transparent window can be made.
My question is that all the element within this window are cleared. I want my web element in website overlay on top of this window.
For example, my website has transparent body, and I have a <div> with alpha 0.5. When the div overlay on the transparent window, all things are cleared within window.
What I want to do is showing this div with alpha 0.5.

Do you guy have any suggestions? I doubt that the solution can be solved by swap the position of QWebView::paintEvent(event); to the end, such that

void WebView::paintEvent(QPaintEvent *event){
QPainter p(this);
p.setCompositionMode(QPainter::CompositionMode_Cle ar);
p.fillRect(10, 10, 100, 100, Qt::transparent);
QWebView::paintEvent(event);
}

But it make a segfault.