[webkit-help] Window close messages

nkbai baink baizhenxuan at gmail.com
Wed Sep 23 19:19:03 PDT 2009

i use the qt webkit port,
found the these code:
closeWindowSoon just call the client, and let the client make decision
void Chrome::closeWindowSoon()
void ChromeClientQt::closeWindowSoon()
    emit m_webPage->windowCloseRequested();

the function ChromeClientQt::closeWindowSoon doesn't really close the window
and left it to the user.
so, in  the qt webkit port, you can safely ignore this request and the
window will still open.

if you want the user to decide close the window or not, just connect this
signal to your own slot,this can be found in
the qt's demo browser:
void TabWidget::windowCloseRequested()

    WebPage *webPage = qobject_cast<WebPage*>(sender());
    WebView *webView = qobject_cast<WebView*>(webPage->view());
    int index = webViewIndex(webView);
    if (index >= 0) {
        if (count() == 1)
            qDebug()<<"close window";
// raise a messagebox to tell the user here

wish it help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20090924/9df45990/attachment.html>

More information about the webkit-help mailing list