summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatView.cpp10
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();