View Issue Details

IDProjectCategoryView StatusLast Update
0016861ScribusBuild Systempublic2023-05-29 18:56
Reporterfsimonis Assigned Tojghali  
PrioritynormalSeverityblockReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.7.0.svn 
Fixed in Version1.7.0.svn 
Summary0016861: Port of AdapterWidget to Qt6
DescriptionThe ui/AdapterWidget is currently implemented as a QGLWidget, which was removed in Qt6.

The provided patch ports the implementation of the AdapterWidget to using OpenGLWidget instead of QGLWidget.
It also adds OpenGLWidgets to the Qt dependencies.
Additional InformationThe patch has only been tested on an updated Arch Linux install with Qt6 installed.
TagsNo tags attached.
PatchYes

Activities

fsimonis

2022-11-19 15:04

reporter  

0001-Port-QGL-to-Gt6.patch (5,771 bytes)   
From 816ca3148057b2c945f60edffca67f8187bf3a19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= <simonisfrederic@gmail.com>
Date: Sat, 19 Nov 2022 15:57:14 +0100
Subject: [PATCH] Port QGL to Gt6

---
 CMakeLists_Dependencies.cmake | 4 ++++
 scribus/CMakeLists.txt        | 1 +
 scribus/ui/AdapterWidget.cpp  | 2 +-
 scribus/ui/AdapterWidget.h    | 7 ++++---
 scribus/ui/osgeditor.cpp      | 8 ++++----
 5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/CMakeLists_Dependencies.cmake b/CMakeLists_Dependencies.cmake
index 3634100..b45d8ec 100644
--- a/CMakeLists_Dependencies.cmake
+++ b/CMakeLists_Dependencies.cmake
@@ -31,6 +31,10 @@ find_package(Qt6 COMPONENTS OpenGL REQUIRED)
 include_directories(${Qt6OpenGL_INCLUDE_DIRS})
 add_definitions(${Qt6OpenGL_DEFINITIONS})
 
+find_package(Qt6 COMPONENTS OpenGLWidgets REQUIRED)
+include_directories(${Qt6OpenGLWidgets_INCLUDE_DIRS})
+add_definitions(${Qt6OpenGLWidgets_DEFINITIONS})
+
 find_package(Qt6 COMPONENTS PrintSupport REQUIRED)
 include_directories(${Qt6PrintSupport_INCLUDE_DIRS})
 add_definitions(${Qt6PrintSupport_DEFINITIONS})
diff --git a/scribus/CMakeLists.txt b/scribus/CMakeLists.txt
index e22db44..9e82181 100644
--- a/scribus/CMakeLists.txt
+++ b/scribus/CMakeLists.txt
@@ -771,6 +771,7 @@ target_link_libraries(${EXE_NAME}
 	Qt6::Xml
 	Qt6::PrintSupport
 	Qt6::OpenGL
+	Qt6::OpenGLWidgets
 	)
 
 target_link_libraries(${EXE_NAME}
diff --git a/scribus/ui/AdapterWidget.cpp b/scribus/ui/AdapterWidget.cpp
index 16a21d2..d68cf81 100644
--- a/scribus/ui/AdapterWidget.cpp
+++ b/scribus/ui/AdapterWidget.cpp
@@ -33,7 +33,7 @@ for which a new license (GPL+exception) is in place.
 #include "iconmanager.h"
 #include "AdapterWidget.h"
 
-AdapterWidget::AdapterWidget ( QWidget * parent, const char * name, const QGLWidget * shareWidget) : QGLWidget ( parent, shareWidget)
+AdapterWidget::AdapterWidget ( QWidget * parent, const char * name) : QOpenGLWidget ( parent )
 {
 	_gw = new osgViewer::GraphicsWindowEmbedded ( 0,0,width(),height() );
 	setFocusPolicy ( Qt::ClickFocus );
diff --git a/scribus/ui/AdapterWidget.h b/scribus/ui/AdapterWidget.h
index a797b13..59fb71f 100644
--- a/scribus/ui/AdapterWidget.h
+++ b/scribus/ui/AdapterWidget.h
@@ -18,14 +18,15 @@ for which a new license (GPL+exception) is in place.
 #include <QtCore>
 #include <QtGui>
 #include <QtOpenGL>
+#include <QOpenGLWidget>
 #include <osgViewer/Viewer>
 #include <osg/Vec3>
 
-class AdapterWidget : public QGLWidget
+class AdapterWidget : public QOpenGLWidget
 {
     Q_OBJECT
 	public:
-		AdapterWidget ( QWidget* parent = nullptr, const char * name = 0, const QGLWidget * shareWidget = 0);
+		AdapterWidget ( QWidget* parent = nullptr, const char * name = 0);
 
 		virtual ~AdapterWidget() {}
 
@@ -53,7 +54,7 @@ class AdapterWidget : public QGLWidget
 class ViewerQT : public osgViewer::Viewer, public AdapterWidget
 {
 	public:
-		ViewerQT ( QWidget* parent = nullptr, const char * name = 0, const QGLWidget * shareWidget = 0) : AdapterWidget ( parent, name, shareWidget)
+		ViewerQT ( QWidget* parent = nullptr, const char * name = 0) : AdapterWidget ( parent, name )
 		{
 			getCamera()->setViewport ( new osg::Viewport ( 0,0,width(),height() ) );
 			getCamera()->setProjectionMatrixAsPerspective ( 30.0f, static_cast<double> ( width() ) /static_cast<double> ( height() ), 1.0f, 10000.0f );
diff --git a/scribus/ui/osgeditor.cpp b/scribus/ui/osgeditor.cpp
index fe437c1..ddd5fba 100644
--- a/scribus/ui/osgeditor.cpp
+++ b/scribus/ui/osgeditor.cpp
@@ -111,7 +111,7 @@ OSGEditorDialog::OSGEditorDialog(QWidget* parent, PageItem_OSGFrame *frame, QStr
 		drawingarea->getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
 		drawingarea->getCamera()->setProjectionMatrixAsPerspective(currentView.angleFOV, aspectRatio, zNear, zFar);
 		changeRenderMode(static_cast<int>(currentView.rendermode));
-		drawingarea->updateGL();
+		drawingarea->update();
 		connect(drawingarea, SIGNAL(mouseMoved()), this, SLOT(reportCamera()));
 		connect(viewCombo, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(changeView(QString)));
 		connect(buttonAddView, SIGNAL(clicked()), this, SLOT(addView()));
@@ -185,7 +185,7 @@ void OSGEditorDialog::clearDisplay()
 void OSGEditorDialog::setCameraValues()
 {
 	drawingarea->getCamera()->setProjectionMatrixAsPerspective(fovAngle->value(), static_cast<double>(drawingarea->width()) / static_cast<double>(drawingarea->height()), 1.0f, 10000.0f );
-	drawingarea->updateGL();
+	drawingarea->update();
 	currentView.angleFOV = fovAngle->value();
 }
 
@@ -219,7 +219,7 @@ void OSGEditorDialog::changeView(QString viewName)
 	drawingarea->getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
 	drawingarea->getCamera()->setProjectionMatrixAsPerspective(currentView.angleFOV, aspectRatio, zNear, zFar);
 	changeRenderMode(static_cast<int>(currentView.rendermode));
-	drawingarea->updateGL();
+	drawingarea->update();
 	connect(fovAngle, SIGNAL(valueChanged(double)), this, SLOT(setCameraValues()));
 	connect(renderStyleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changeRenderMode(int)));
 	connect(lightStyleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changeLightMode(int)));
@@ -649,7 +649,7 @@ void OSGEditorDialog::accept()
 		currentView.illumination = static_cast<PageItem_OSGFrame::LightType>(lightStyleCombo->currentIndex());
 		currentView.rendermode = static_cast<PageItem_OSGFrame::RenderType>(renderStyleCombo->currentIndex());
 		currItem->modelFile = modelFile;
-		QImage image = drawingarea->grabFrameBuffer();
+		QImage image = drawingarea->grabFramebuffer();
 		currItem->setImage(image);
 		viewMap[currentViewName] = currentView;
 		currItem->viewMap = viewMap;
-- 
2.38.1

0001-Port-QGL-to-Gt6.patch (5,771 bytes)   

jghali

2022-11-19 19:05

administrator   ~0049811

Thanks for your work. I've committed your patch to trunk with a few more modifications intended at fixing some Qt deprecation warnings.

Issue History

Date Modified Username Field Change
2022-11-19 15:04 fsimonis New Issue
2022-11-19 15:04 fsimonis File Added: 0001-Port-QGL-to-Gt6.patch
2022-11-19 18:40 jghali Summary Port of QOpenGLWidget to QT6 => Port of AdapterWidget to Qt6
2022-11-19 19:05 jghali Assigned To => jghali
2022-11-19 19:05 jghali Status new => resolved
2022-11-19 19:05 jghali Resolution open => fixed
2022-11-19 19:05 jghali Fixed in Version => 1.7.0.svn
2022-11-19 19:05 jghali Note Added: 0049811
2023-05-29 18:56 cbradney Status resolved => closed