Showing the changes to interface/src/scripting/WebWindowClass.cpp (1 of 6 files). Show all
Unified · Split
| @@ -11,9 +11,13 @@ · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | #include <QVBoxLayout> | 12 | #include <QVBoxLayout> |
| 13 | #include <QApplication> | 13 | #include <QApplication> |
| 14 | #include <QMainWindow> | ||
| 15 | #include <QDockWidget> | ||
| 14 | #include <QWebFrame> | 16 | #include <QWebFrame> |
| 15 | #include <QWebView> | 17 | #include <QWebView> |
| 18 | #include <QListWidget> | ||
| 16 | 19 | ||
| 20 | #include "Application.h" | ||
| 17 | #include "WindowScriptingInterface.h" | 21 | #include "WindowScriptingInterface.h" |
| 18 | #include "WebWindowClass.h" | 22 | #include "WebWindowClass.h" |
| 19 | 23 | ||
| @@ -31,18 +35,17 @@ void ScriptEventBridge::emitScriptEvent(const QString& data) { · 11 unmodified lines | |||
| 31 | 35 | ||
| 32 | WebWindowClass::WebWindowClass(const QString& title, const QString& url, int width, int height) | 36 | WebWindowClass::WebWindowClass(const QString& title, const QString& url, int width, int height) |
| 33 | : QObject(NULL), | 37 | : QObject(NULL), |
| 34 | _window(new QWidget(NULL, Qt::Tool)), | ||
| 35 | _eventBridge(new ScriptEventBridge(this)) { | 38 | _eventBridge(new ScriptEventBridge(this)) { |
| 36 | 39 | ||
| 40 | QMainWindow* toolWindow = Application::getInstance()->getToolWindow(); | ||
| 41 | |||
| 42 | _window = new QDockWidget(title, toolWindow); | ||
| 37 | QWebView* webView = new QWebView(_window); | 43 | QWebView* webView = new QWebView(_window); |
| 38 | webView->page()->mainFrame()->addToJavaScriptWindowObject("EventBridge", _eventBridge); | 44 | webView->page()->mainFrame()->addToJavaScriptWindowObject("EventBridge", _eventBridge); |
| 39 | webView->setUrl(url); | 45 | webView->setUrl(url); |
| 40 | QVBoxLayout* layout = new QVBoxLayout(_window); | 46 | _window->setWidget(webView); |
| 41 | _window->setLayout(layout); | 47 | |
| 42 | layout->addWidget(webView); | 48 | toolWindow->addDockWidget(Qt::RightDockWidgetArea, _window); |
| 43 | layout->setSpacing(0); | ||
| 44 | layout->setContentsMargins(0, 0, 0, 0); | ||
| 45 | _window->setGeometry(0, 0, width, height); | ||
| 46 | 49 | ||
| 47 | connect(this, &WebWindowClass::destroyed, _window, &QWidget::deleteLater); | 50 | connect(this, &WebWindowClass::destroyed, _window, &QWidget::deleteLater); |
| 48 | } | 51 | } |