What makes this small browser app fail to return the window.returnValue given in the modal window? The Qt Browser demo does make it work, but I can't figure why it does and this mini browser app doesn't.
#include <QApplication>
#include <QWebView>
#include <QWebPage>
#include <QUrl>
class WebPage : public QWebPage
{
public:
QWebPage *createWindow(QWebPage::WebWindowType type)
{
QWebView *wv = new QWebView;
if (type == QWebPage::WebModalDialog)
wv->setWindowModality(Qt::ApplicationModal);
return wv->page();
}
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWebView view;
QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
view.setPage(new WebPage);
view.load(QUrl("http://help.dottoro.com/external/examples/ljdlgxbu/showModalDialog_1.htm"));
view.show();
return a.exec();
}
showModalDialog() is synchronous and should return the value set as window.returnValue in the modal dialog created by the call. The small browser app opens the dialog window successfully, but the (modal)window.returnValue is not set as return value for showModalDialog().