From b8dd4ef20a749f0971d896bbb45e1803129a0e1c Mon Sep 17 00:00:00 2001 From: demmm Date: Thu, 7 Sep 2023 18:10:21 +0200 Subject: [PATCH] [partition] Qt6 conversion completed adjust QMouseEvents, update CHANGES --- CHANGES-3.3 | 1 + .../partition/gui/PartitionSplitterWidget.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGES-3.3 b/CHANGES-3.3 index 61ccbafb4..ca3a02813 100644 --- a/CHANGES-3.3 +++ b/CHANGES-3.3 @@ -17,6 +17,7 @@ Frameworks are required as well, and those need to be Qt6-based as well. This release contains contributions from (alphabetically by first name): - Adriaan de Groot + - Anke Boersma - Hector Martin - Ivan Borzenkov diff --git a/src/modules/partition/gui/PartitionSplitterWidget.cpp b/src/modules/partition/gui/PartitionSplitterWidget.cpp index 139eef168..11b6a4014 100644 --- a/src/modules/partition/gui/PartitionSplitterWidget.cpp +++ b/src/modules/partition/gui/PartitionSplitterWidget.cpp @@ -340,7 +340,11 @@ PartitionSplitterWidget::mousePressEvent( QMouseEvent* event ) { if ( m_itemToResize && m_itemToResizeNext && event->button() == Qt::LeftButton ) { +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) if ( qAbs( event->x() - m_resizeHandleX ) < HANDLE_SNAP ) +#else + if ( qAbs( event->position().x() - m_resizeHandleX ) < HANDLE_SNAP ) +#endif { m_resizing = true; } @@ -393,7 +397,11 @@ PartitionSplitterWidget::mouseMoveEvent( QMouseEvent* event ) int ew = rect().width(); //effective width qreal bpp = total / static_cast< qreal >( ew ); //bytes per pixel +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) qreal mx = event->x() * bpp - start; +#else + qreal mx = event->position().x() * bpp - start; +#endif // make sure we are within resize range mx = qBound( static_cast< qreal >( m_itemMinSize ), mx, static_cast< qreal >( m_itemMaxSize ) ); @@ -428,7 +436,11 @@ PartitionSplitterWidget::mouseMoveEvent( QMouseEvent* event ) { if ( m_itemToResize && m_itemToResizeNext ) { +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) if ( qAbs( event->x() - m_resizeHandleX ) < HANDLE_SNAP ) +#else + if ( qAbs( event->position().x() - m_resizeHandleX ) < HANDLE_SNAP ) +#endif { setCursor( Qt::SplitHCursor ); }