QWebView transparent problem
Hi all,
I want to have a transparent QWebView. Now, I can make a transprent window by this thread.
As I know, QWebView is a child of QWidget. But when I use webView->load(QUrl("http://www.google.com/"));, the window of QWebView is not transparent. Can I make the QWebView appear as text on the desktop? Anyone who can help me.
here is my code.
Code:
class WebView : public QWebView
{
public:
WebView()
{
}
~WebView()
{
delete pixmap;
}
protected:
{
QWebView::resizeEvent(event);
pixmap->fill(Qt::transparent);
paintEvent(&pe);
setMask(pixmap->mask());//
}
private:
};
int main(int argc, char* argv[])
{
WebView* webView = new WebView();
webView
->load
(QUrl("http://www.google.com/"));
webView->show();
return a.exec();
}
Re: QWebView transparent problem
I've tried to set palette of webview, but the background turns out to be full transparent (nothing on the screen, totally transparent...), what's the problem, anybody help?
Code:
WebView() {
pal.
setBrush(QPalette::Window, Qt
::transparent);
setPalette(pal);
}
Re: QWebView transparent problem
Re: QWebView transparent problem
Dont do anything,,, just use QWidget::setWindowOpacityIt will set the transparency for the whole widget.
Re: QWebView transparent problem
Quote:
Originally Posted by
aamer4yu
Thanks for your answer first!
The method you mentioned do be able to solve the transparency problem of a *whole* widget, nevertheless, our purpose is to leave the background transparent, while make the contents (for example, a button, an input, etc) opaque, somehow like the effect of Yahoo! desktop widget.
So any suggestion for these? Thanks!