Showing the changes to interface/src/scripting/WebWindowClass.cpp (1 of 10 files). Show all
Unified · Split
| @@ -54,26 +54,27 @@ WebWindowClass::WebWindowClass(const QString& title, const QString& url, int wid · 53 unmodified lines | ||
| 54 | 54 | |
| 55 | 55 | _windowWidget = dockWidget; |
| 56 | 56 | } else { |
| 57 | + auto dialogWidget = new QDialog(Application::getInstance()->getWindow(), Qt::Window); | |
| 58 | + dialogWidget->setWindowTitle(title); | |
| 59 | + dialogWidget->setMinimumSize(width, height); | |
| 60 | + connect(dialogWidget, &QDialog::finished, this, &WebWindowClass::hasClosed); | |
| 57 | 61 | |
| 58 | − _windowWidget = new QWidget(Application::getInstance()->getWindow(), Qt::Window); | |
| 59 | − _windowWidget->setWindowTitle(title); | |
| 60 | − _windowWidget->setMinimumSize(width, height); | |
| 61 | − | |
| 62 | − auto layout = new QVBoxLayout(_windowWidget); | |
| 62 | + auto layout = new QVBoxLayout(dialogWidget); | |
| 63 | 63 | layout->setContentsMargins(0, 0, 0, 0); |
| 64 | − _windowWidget->setLayout(layout); | |
| 64 | + dialogWidget->setLayout(layout); | |
| 65 | 65 | |
| 66 | − _webView = new QWebView(_windowWidget); | |
| 66 | + _webView = new QWebView(dialogWidget); | |
| 67 | 67 | |
| 68 | 68 | layout->addWidget(_webView); |
| 69 | 69 | |
| 70 | 70 | addEventBridgeToWindowObject(); |
| 71 | + | |
| 72 | + _windowWidget = dialogWidget; | |
| 71 | 73 | } |
| 72 | 74 | |
| 73 | 75 | _webView->setPage(new DataWebPage()); |
| 74 | 76 | _webView->setUrl(url); |
| 75 | 77 | |
| 76 | − | |
| 77 | 78 | connect(this, &WebWindowClass::destroyed, _windowWidget, &QWidget::deleteLater); |
| 78 | 79 | connect(_webView->page()->mainFrame(), &QWebFrame::javaScriptWindowObjectCleared, |
| 79 | 80 | this, &WebWindowClass::addEventBridgeToWindowObject); |
| @@ -82,6 +83,10 @@ WebWindowClass::WebWindowClass(const QString& title, const QString& url, int wid · 2 unmodified lines | ||
| 82 | 83 | WebWindowClass::~WebWindowClass() { |
| 83 | 84 | } |
| 84 | 85 | |
| 86 | +void WebWindowClass::hasClosed() { | |
| 87 | + emit closed(); | |
| 88 | +} | |
| 89 | + | |
| 85 | 90 | void WebWindowClass::addEventBridgeToWindowObject() { |
| 86 | 91 | _webView->page()->mainFrame()->addToJavaScriptWindowObject("EventBridge", _eventBridge); |
| 87 | 92 | } |