Results 1 to 5 of 5

Thread: QWebView transparent problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2009
    Posts
    1
    Platforms
    Windows

    Default 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.

    Qt Code:
    1. class WebView : public QWebView
    2. {
    3.  
    4. public:
    5. WebView()
    6. {
    7. pixmap = new QPixmap(size());
    8. }
    9. ~WebView()
    10. {
    11. delete pixmap;
    12. }
    13. protected:
    14. void resizeEvent(QResizeEvent* event)
    15. {
    16. QWebView::resizeEvent(event);
    17. pixmap->fill(Qt::transparent);
    18. QPainter::setRedirected(this, pixmap);
    19. QPaintEvent pe(rect());
    20. paintEvent(&pe);
    21. QPainter::restoreRedirected(this);
    22. setMask(pixmap->mask());//
    23.  
    24. }
    25. private:
    26. QPixmap* pixmap;
    27. };
    28. int main(int argc, char* argv[])
    29. {
    30. QApplication a(argc, argv);
    31. WebView* webView = new WebView();
    32. QPalette palette = webView->palette();
    33. webView->load(QUrl("http://www.google.com/"));
    34.  
    35. webView->show();
    36. return a.exec();
    37. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 14th January 2009 at 22:41. Reason: changed [quote] to [code] tags

Similar Threads

  1. Problem With QWebView
    By ivi2501 in forum Qt Programming
    Replies: 8
    Last Post: 2nd August 2009, 20:37
  2. Transparent QScrollbar groove in QWebView
    By Jonas in forum Qt Programming
    Replies: 0
    Last Post: 20th October 2008, 09:55
  3. Problem in QWebView
    By navi1084 in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2008, 20:27
  4. QWebView problem with pdf
    By oscar in forum Qt Programming
    Replies: 5
    Last Post: 23rd August 2008, 16:37
  5. QWebView unknown problem
    By morfei in forum Qt Programming
    Replies: 1
    Last Post: 5th August 2008, 01:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.