diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-10-03 17:59:48 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-10-03 17:59:48 (GMT) |
commit | c60720c32c4b6e8745ae4ec8eead825a06a93555 (patch) | |
tree | 8e467c1fb561a90bcbfacb7c5d31e96a9aee5d2c /Swift/QtUI | |
parent | a487e087022105ae82a1e30abf70bfcc4e6b8281 (diff) | |
download | swift-c60720c32c4b6e8745ae4ec8eead825a06a93555.zip swift-c60720c32c4b6e8745ae4ec8eead825a06a93555.tar.bz2 |
Make the webkit view loads synchronous.
Hopefully
Resolves: #589
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtChatView.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index eea18f7..1ad274f 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -7,6 +7,7 @@ #include "QtChatView.h" #include <QtDebug> +#include <QEventLoop> #include <QFile> #include <QDesktopServices> #include <QVBoxLayout> @@ -163,7 +164,16 @@ void QtChatView::resetView() { pageHTML.replace(pageHTML.indexOf("%@"), 2, "Variants/Blue on Green.css"); pageHTML.replace(pageHTML.indexOf("%@"), 2, ""/*headerSnippet.getContent()*/); pageHTML.replace(pageHTML.indexOf("%@"), 2, ""/*footerSnippet.getContent()*/); + QEventLoop syncLoop; + connect(webView_, SIGNAL(loadFinished(bool)), &syncLoop, SLOT(quit())); webPage_->mainFrame()->setHtml(pageHTML); + while (!viewReady_) { + QTimer t; + t.setSingleShot(true); + connect(&t, SIGNAL(timeout()), &syncLoop, SLOT(quit())); + t.start(50); + syncLoop.exec(); + } document_ = webPage_->mainFrame()->documentElement(); QWebElement chatElement = document_.findFirst("#Chat"); newInsertPoint_ = chatElement.clone(); |