From af516751791b2bd12083884ccf90b7ca35f31e3d Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Thu, 17 Feb 2022 16:07:21 -0500 Subject: [PATCH 1/2] Build - allow WITH_QT_GUI_WEBENGINE with Qt5 --- app/gui/qt/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/gui/qt/CMakeLists.txt b/app/gui/qt/CMakeLists.txt index ddd82f503f..d69fd47c88 100644 --- a/app/gui/qt/CMakeLists.txt +++ b/app/gui/qt/CMakeLists.txt @@ -44,6 +44,9 @@ if(Qt6_FOUND AND WITH_QT_GUI_WEBENGINE) add_compile_definitions(WITH_WEBENGINE) elseif(Qt6_FOUND) find_package(Qt6 COMPONENTS Core Widgets Gui Concurrent Network OpenGLWidgets PrintSupport Xml Svg REQUIRED) +elseif(WITH_QT_GUI_WEBENGINE) + find_package(Qt5 COMPONENTS Core Widgets Gui Concurrent Network OpenGL PrintSupport Xml Svg WebEngineWidgets REQUIRED) + add_compile_definitions(WITH_WEBENGINE) else() find_package(Qt5 COMPONENTS Core Widgets Gui Concurrent Network OpenGL PrintSupport Xml Svg REQUIRED) endif() @@ -97,7 +100,7 @@ set(SOURCES ${QTAPP_ROOT}/model/settings.h ) - if(Qt6_FOUND AND WITH_QT_GUI_WEBENGINE) + if(WITH_QT_GUI_WEBENGINE) set(SOURCES ${SOURCES} ${QTAPP_ROOT}/widgets/phxwebview.h From 7811a2bdcf0008de21127f4ddeb2dc7c42bb6325 Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Thu, 17 Feb 2022 16:04:02 -0500 Subject: [PATCH 2/2] GUI - fix tau/phx widget runtime errors Fixes messages like ``` Release of profile requested but WebEnginePage still not deleted. Expect troubles ! ``` indicating webview destruction order issues and ``` QLayout: Attempting to add QLayout "" to PhxWidget "", which already has a layout ``` indicating a widget layout was attempted to be overridden --- app/gui/qt/widgets/phxwebview.cpp | 6 ++++-- app/gui/qt/widgets/phxwidget.cpp | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/gui/qt/widgets/phxwebview.cpp b/app/gui/qt/widgets/phxwebview.cpp index 7aa8b1c132..47ed78b671 100644 --- a/app/gui/qt/widgets/phxwebview.cpp +++ b/app/gui/qt/widgets/phxwebview.cpp @@ -17,8 +17,10 @@ PhxWebView::PhxWebView(QWidget *parent) : QWebEngineView(parent) { - phxProfile = new QWebEngineProfile(this); - phxPage = new QWebEnginePage(phxProfile, this); + phxProfile = new QWebEngineProfile(); + phxPage = new QWebEnginePage(phxProfile); + phxPage->setParent(this); + phxProfile->setParent(this); setPage(phxPage); setContextMenuPolicy(Qt::NoContextMenu); setZoomFactor(2.0); diff --git a/app/gui/qt/widgets/phxwidget.cpp b/app/gui/qt/widgets/phxwidget.cpp index 3b8420dacd..427886ed1d 100644 --- a/app/gui/qt/widgets/phxwidget.cpp +++ b/app/gui/qt/widgets/phxwidget.cpp @@ -32,7 +32,7 @@ PhxWidget::PhxWidget(QWidget *parent) phxView->setSizePolicy(sp_retain); phxView->hide(); mainLayout = new QHBoxLayout(this); - topRowSubLayout = new QVBoxLayout(this); + topRowSubLayout = new QVBoxLayout(); sizeDownButton = new QPushButton("-"); sizeUpButton = new QPushButton("+"); openExternalBrowserButton = new QPushButton(" E "); @@ -51,7 +51,6 @@ PhxWidget::PhxWidget(QWidget *parent) mainLayout->addWidget(phxView, 1); mainLayout->addLayout(topRowSubLayout); - connect(sizeDownButton, &QPushButton::released, this, &PhxWidget::handleSizeDown); connect(sizeUpButton, &QPushButton::released, this, &PhxWidget::handleSizeUp); connect(openExternalBrowserButton, &QPushButton::released, this, &PhxWidget::handleOpenExternalBrowser);