Hi Alan

I was able to build the plplot using qt6.1 and found out that there were
other classes (the 2D transformation Matrix class) that were dropped in
qt6. So I made a small patch replacing that class and some others minor
changes with function members that became deprecated in qt 6.0

I've tested it in my default qt 5.15 and in the latest qt6.1.2  version.
Everything looks to work very fine.
So I think that when the time is right one can face without any worries the
transition from qt5 to qt6 without the need to use the Core5Compat package.

cheers



On Thu, Jul 8, 2021 at 12:26 AM Alan W. Irwin <alan.w.irwin1...@gmail.com>
wrote:

> On 2021-07-06 23:34+0100 António Rodrigues Tomé wrote:
>
> > [... I built] all the examples and the patch i send you now seems to work
> > very fine:
>
> Same here so I pushed it.  See
> <
> https://sourceforge.net/p/plplot/plplot/ci/cf04f2e6b555edab673a9703cea909d7239ce21b/
> >
> for the substantially changed commit message that includes details of
> the tests I ran.
>
> Thanks very much for getting this revised version of your commit to work
> without generating
> the segfaults produced by the prior version.
>
> > P.s. Latter on I will try to understand how to deploy  pyqt5_example.
>
> The missing Python library issue that was previously stopping you can
> obviously be addressed by installing the right opensuse package.  But
> finding the name of that needed package is more "an art rather than a
> science".
>
> To help you with that "art" here are the equivalent details on my
> Debian Stable platform.
>
> # Find the names of all packages which include a partial filename
> "libplplot*.so$"
> # where ".so" with nothing further added is important since it is that
> exact suffix the linker looks for.
> irwin@merlin> apt-file search libpython |grep '\.so$' |less
>
> There were 17 different possibilities, but one of those
>
> libpython3.7-dev: /usr/lib/x86_64-linux-gnu/libpython3.7m.so
>
> referred to the development version of libpython3 so I am sure
> that is the library that is needed, and I do have that package
> already installed.  So I think this
> result for Debian Stable means you need to install the development
> version of either the python3 or libpython3 package (depending on how
> opensuse organizes its package names and designates the name of the
> development version of those).  Of course, opensuse will not have
> the apt-file application, but it should have something equivalent so
> that you can associate filenames with the packages (either installed
> or not installed) that include those files.
>
> After a successful build I confirmed that /usr/lib/x86_64-linux-gnu/
> libpython3.7m.so name as follows:
>
> # Find the exact name of that library (at least for Debian Stable after a
> successful build
> of the python binding):
>
> software@merlin> readelf -d bindings/python/_plplotc.so |grep -E
> 'PATH|NEEDED'
>   0x0000000000000001 (NEEDED)             Shared library: [libplplot.so.17]
>   0x0000000000000001 (NEEDED)             Shared library:
> [libpython3.7m.so.1.0]
>   0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
>   0x000000000000001d (RUNPATH)            Library runpath:
> [/home/software/plplot/HEAD/build_dir/src:]
>
> Hope this working Debian Stable example helps you figure out what to do
> for opensuse to gain
> access to that distro's python3 library.
>
> > also going to try to see how i can force plplot to build with qt6 and
> then
> > one will know if this small patch is enough to deal with the next major
> > version of the qt,
>
> Good luck implementing these important Qt6-ready goals for PLplot.
>
> Alan
> __________________________
> Alan W. Irwin
>
> Research affiliation with the Department of Physics and Astronomy,
> University of Victoria, Victoria, BC, Canada.
>
> Programming affiliations with the FreeEOS equation-of-state
> implementation for stellar interiors (freeeos.sf.net); the Time
> Ephemerides project (timeephem.sf.net); PLplot scientific plotting
> software package (plplot.org); the libLASi project
> (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
> and the Linux Brochure Project (lbproject.sf.net).
> __________________________
>
> Linux-powered Science
> __________________________
>


-- 

António Rodrigues Tomé
Universidade da Beira Interior
Instituto D. Luís (lab associado)
email address:
art...@gmail.com
art...@ubi.pt
http://www.researcherid.com/rid/A-5681-2013
From c8fcaf873dbe2f142d668971b5e3b2ff85c45e5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ant=C3=B3nio=20Rodrigues=20Tom=C3=A9?= <art...@gmail.com>
Date: Tue, 3 Aug 2021 11:16:51 +0100
Subject: [PATCH] This patch resulted from the first qt6 testing. there where
 still some classes  that are no long present in qt6. The patch was tested in
 Opensuse leap15.3   Using Qt version 5.15.2 from kde opensude official
 repositories. And also tested using opensuse leap15.3 Q6.1.2 from the
 offiocial qt account https://login.qt.io/. Please be aware this is only a
 patch to the c++ qt driver code the cmake was not yet changed to allow an
 option to select or use qt6 instead of qt5.

---
 bindings/qt_gui/plqt.cpp | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/bindings/qt_gui/plqt.cpp b/bindings/qt_gui/plqt.cpp
index 2df02d756..be787b49b 100644
--- a/bindings/qt_gui/plqt.cpp
+++ b/bindings/qt_gui/plqt.cpp
@@ -24,6 +24,7 @@
 
 #include "qt.h"
 #include<list>
+#include <QTransform>
 // Global variables for Qt driver.
 PLDLLIMPEXP_QT_DATA( int ) vectorize = 0;
 PLDLLIMPEXP_QT_DATA( int ) lines_aa  = 1;
@@ -427,7 +428,7 @@ void QtPLDriver::drawText( EscText* txt )
 
     rotation -= pls->diorot * M_PI / 2.0;
     m_painterP->translate( txt->x * downscale, m_dHeight - txt->y * downscale );
-    QMatrix rotShearMatrix( cos( rotation ) * stride, -sin( rotation ) * stride, cos( rotation ) * sin( shear ) + sin( rotation ) * cos( shear ), -sin( rotation ) * sin( shear ) + cos( rotation ) * cos( shear ), 0., 0. );
+    QTransform rotShearMatrix( cos( rotation ) * stride, -sin( rotation ) * stride, cos( rotation ) * sin( shear ) + sin( rotation ) * cos( shear ), -sin( rotation ) * sin( shear ) + cos( rotation ) * cos( shear ), 0., 0. );
 
     m_painterP->setWorldTransform( QTransform (rotShearMatrix), true );
 
@@ -1064,7 +1065,7 @@ void QtPLWidget::renderText( QPainter* p, struct TextStruct_* s, double x_fact,
     p->setClipping( true );
     p->setClipRect( QRectF( s->clipxmin * x_fact + x_offset, s->clipymax * y_fact + y_offset, ( s->clipxmax - s->clipxmin ) * x_fact, ( -s->clipymax + s->clipymin ) * y_fact ), Qt::ReplaceClip );
     p->translate( s->x * x_fact + x_offset, s->y * y_fact + y_offset );
-    QMatrix rotShearMatrix( cos( s->rotation ) * s->stride, -sin( s->rotation ) * s->stride, cos( s->rotation ) * sin( s->shear ) + sin( s->rotation ) * cos( s->shear ), -sin( s->rotation ) * sin( s->shear ) + cos( s->rotation ) * cos( s->shear ), 0., 0. );
+    QTransform rotShearMatrix( cos( s->rotation ) * s->stride, -sin( s->rotation ) * s->stride, cos( s->rotation ) * sin( s->shear ) + sin( s->rotation ) * cos( s->shear ), -sin( s->rotation ) * sin( s->shear ) + cos( s->rotation ) * cos( s->shear ), 0., 0. );
     p->setWorldTransform( QTransform  (rotShearMatrix), true );
 
     p->translate( -s->just * xOffset * p->device()->logicalDpiY() / picDpi, 0. );
@@ -1088,17 +1089,17 @@ void QtPLWidget::lookupButtonEvent( QMouseEvent * event )
 {
     Qt::MouseButtons      buttons   = event->buttons();
     Qt::KeyboardModifiers modifiers = event->modifiers();
-    gin.pX = event->x();
-    gin.pY = height() - event->y();
-    gin.dX = (PLFLT) event->x() / width();
-    gin.dY = (PLFLT) ( height() - event->y() ) / height();
+    gin.pX = event->pos().x();
+    gin.pY = height() - event->pos().y();
+    gin.dX = (PLFLT) event->pos().x() / width();
+    gin.dY = (PLFLT) ( height() - event->pos().y() ) / height();
 
     switch ( event->button() )
     {
     case Qt::LeftButton:
         gin.button = 1;
         break;
-    case Qt::MidButton:
+    case Qt::MiddleButton:
         gin.button = 2;
         break;
     case Qt::RightButton:
@@ -1113,7 +1114,7 @@ void QtPLWidget::lookupButtonEvent( QMouseEvent * event )
     gin.state = 0;
     if ( buttons & Qt::LeftButton )
         gin.state |= 1 << 8;
-    if ( buttons & Qt::MidButton )
+    if ( buttons &Qt::MiddleButton )
         gin.state |= 1 << 9;
     if ( buttons & Qt::RightButton )
         gin.state |= 1 << 10;
@@ -1598,8 +1599,8 @@ void QtExtWidget::mouseMoveEvent( QMouseEvent* event )
 
     getPlotParameters( x_fact, y_fact, x_offset, y_offset );
 
-    cursorParameters.cursor_x = (PLFLT) event->x();
-    cursorParameters.cursor_y = (PLFLT) event->y();
+    cursorParameters.cursor_x = (PLFLT) event->pos().x();
+    cursorParameters.cursor_y = (PLFLT) event->pos().y();
 
     double ratio_x;
     double ratio_y;
@@ -1632,8 +1633,8 @@ void QtExtWidget::mouseReleaseEvent( QMouseEvent* event )
 
     getPlotParameters( x_fact, y_fact, x_offset, y_offset );
 
-    cursorParameters.cursor_x   = (PLFLT) event->x();
-    cursorParameters.cursor_y   = (PLFLT) event->y();
+    cursorParameters.cursor_x   = (PLFLT) event->pos().x();
+    cursorParameters.cursor_y   = (PLFLT) event->pos().y();
     cursorParameters.isTracking = false;
     setMouseTracking( false );
 
-- 
2.31.1

_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to