Results 1 to 3 of 3

Thread: webview createWindow for javascrip applet

  1. #1
    Join Date
    Feb 2011
    Posts
    55
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default webview createWindow for javascrip applet

    hi i reimpleted the createWindow method of qwebview to add support for javascript applet for my web browser, i also enble the setting javacanopenwindows, this is what i did

    QWebView * WebView::createWindow ( QWebPage::WebWindowType type ){

    QWidget *view = new QWidget;
    QWebView *appletview = new QWebView(view);
    appletview = QWebView::createWindow (type );
    //appletview->load(appletview->url());

    view->show();

    }

    but whenever a page open a javascript applet, i get two windows that get open, and non of them loads the intended content, please help!

  2. #2
    Join Date
    Mar 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: webview createWindow for javascrip applet

    They are several errors in the procedure above,

    You create two webviews... First in a widget and second by calling parent createWindow(). Use only one of this constructor and "return" the pointer ...

    Qt Code:
    1. QWebView * WebView::createWindow ( QWebPage::WebWindowType type ) {
    2. QWebView *appletview = new QWebView(NULL);
    3. // ...
    4. return appletView;
    5. }
    To copy to clipboard, switch view to plain text mode 

    Instead of made a show() call in the createWindow function, try to do it on the loadFinished() signal. This reduce flickering of your page when the window open and draw the content of the page...

    Qt Code:
    1. WebView::WebView(QWidget * parent)
    2. :QWebView(parent)
    3. {
    4. hide();
    5. ...
    6. connect(this, SIGNAL(loadFinished(bool)), this, SLOT(onPageLoadFinished(bool)));
    7. }
    8.  
    9. void WebView::onPageLoadFinished(bool value)
    10. {
    11. show();
    12. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Feb 2011
    Posts
    55
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: webview createWindow for javascrip applet

    many thanks, it works, thanks alot!!!

Similar Threads

  1. web applet from Qt-program
    By tmfd in forum Qt Programming
    Replies: 0
    Last Post: 7th July 2010, 12:39
  2. Replies: 1
    Last Post: 3rd March 2010, 08:04
  3. WebView
    By mskzo in forum Qt Programming
    Replies: 7
    Last Post: 5th December 2008, 21:18
  4. webView
    By peace_comp in forum Qt Programming
    Replies: 1
    Last Post: 6th July 2008, 17:57
  5. How execute applet if i'am using libqt3-java
    By Dmitry in forum Qt Programming
    Replies: 1
    Last Post: 15th January 2006, 21:23

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
  •  
Qt is a trademark of The Qt Company.