mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-05 00:09:32 -04:00
Address review
This commit is contained in:
parent
faf4afcba7
commit
ce2c8ac21f
@ -11505,10 +11505,10 @@ Qgis.MouseHandlesAction.ResizeLeftUp.__doc__ = "Resize left up (Top left handle)
|
||||
Qgis.MouseHandlesAction.ResizeRightUp.__doc__ = "Resize right up (Top right handle)"
|
||||
Qgis.MouseHandlesAction.ResizeLeftDown.__doc__ = "Resize left down (Bottom left handle)"
|
||||
Qgis.MouseHandlesAction.ResizeRightDown.__doc__ = "Resize right down (Bottom right handle)"
|
||||
Qgis.MouseHandlesAction.RotateLeftUp.__doc__ = "Rotate left up (Top left handle)"
|
||||
Qgis.MouseHandlesAction.RotateRightUp.__doc__ = "Rotate right up (Top right handle)"
|
||||
Qgis.MouseHandlesAction.RotateLeftDown.__doc__ = "Rotate left up (Bottom left handle)"
|
||||
Qgis.MouseHandlesAction.RotateRightDown.__doc__ = "Rotate right up (Bottom right handle)"
|
||||
Qgis.MouseHandlesAction.RotateLeftUp.__doc__ = "Rotate from top left handle. \n.. versionadded:: 4.0"
|
||||
Qgis.MouseHandlesAction.RotateRightUp.__doc__ = "Rotate from top right handle. \n.. versionadded:: 4.0"
|
||||
Qgis.MouseHandlesAction.RotateLeftDown.__doc__ = "Rotate from bottom left handle. \n.. versionadded:: 4.0"
|
||||
Qgis.MouseHandlesAction.RotateRightDown.__doc__ = "Rotate right bottom right handle. \n.. versionadded:: 4.0"
|
||||
Qgis.MouseHandlesAction.SelectItem.__doc__ = "Select item"
|
||||
Qgis.MouseHandlesAction.NoAction.__doc__ = "No action"
|
||||
Qgis.MouseHandlesAction.__doc__ = """Action to be performed by the mouse handles
|
||||
@ -11524,10 +11524,22 @@ Qgis.MouseHandlesAction.__doc__ = """Action to be performed by the mouse handles
|
||||
* ``ResizeRightUp``: Resize right up (Top right handle)
|
||||
* ``ResizeLeftDown``: Resize left down (Bottom left handle)
|
||||
* ``ResizeRightDown``: Resize right down (Bottom right handle)
|
||||
* ``RotateLeftUp``: Rotate left up (Top left handle)
|
||||
* ``RotateRightUp``: Rotate right up (Top right handle)
|
||||
* ``RotateLeftDown``: Rotate left up (Bottom left handle)
|
||||
* ``RotateRightDown``: Rotate right up (Bottom right handle)
|
||||
* ``RotateLeftUp``: Rotate from top left handle.
|
||||
|
||||
.. versionadded:: 4.0
|
||||
|
||||
* ``RotateRightUp``: Rotate from top right handle.
|
||||
|
||||
.. versionadded:: 4.0
|
||||
|
||||
* ``RotateLeftDown``: Rotate from bottom left handle.
|
||||
|
||||
.. versionadded:: 4.0
|
||||
|
||||
* ``RotateRightDown``: Rotate right bottom right handle.
|
||||
|
||||
.. versionadded:: 4.0
|
||||
|
||||
* ``SelectItem``: Select item
|
||||
* ``NoAction``: No action
|
||||
|
||||
|
@ -11411,10 +11411,10 @@ Qgis.MouseHandlesAction.ResizeLeftUp.__doc__ = "Resize left up (Top left handle)
|
||||
Qgis.MouseHandlesAction.ResizeRightUp.__doc__ = "Resize right up (Top right handle)"
|
||||
Qgis.MouseHandlesAction.ResizeLeftDown.__doc__ = "Resize left down (Bottom left handle)"
|
||||
Qgis.MouseHandlesAction.ResizeRightDown.__doc__ = "Resize right down (Bottom right handle)"
|
||||
Qgis.MouseHandlesAction.RotateLeftUp.__doc__ = "Rotate left up (Top left handle)"
|
||||
Qgis.MouseHandlesAction.RotateRightUp.__doc__ = "Rotate right up (Top right handle)"
|
||||
Qgis.MouseHandlesAction.RotateLeftDown.__doc__ = "Rotate left up (Bottom left handle)"
|
||||
Qgis.MouseHandlesAction.RotateRightDown.__doc__ = "Rotate right up (Bottom right handle)"
|
||||
Qgis.MouseHandlesAction.RotateLeftUp.__doc__ = "Rotate from top left handle. \n.. versionadded:: 4.0"
|
||||
Qgis.MouseHandlesAction.RotateRightUp.__doc__ = "Rotate from top right handle. \n.. versionadded:: 4.0"
|
||||
Qgis.MouseHandlesAction.RotateLeftDown.__doc__ = "Rotate from bottom left handle. \n.. versionadded:: 4.0"
|
||||
Qgis.MouseHandlesAction.RotateRightDown.__doc__ = "Rotate right bottom right handle. \n.. versionadded:: 4.0"
|
||||
Qgis.MouseHandlesAction.SelectItem.__doc__ = "Select item"
|
||||
Qgis.MouseHandlesAction.NoAction.__doc__ = "No action"
|
||||
Qgis.MouseHandlesAction.__doc__ = """Action to be performed by the mouse handles
|
||||
@ -11430,10 +11430,22 @@ Qgis.MouseHandlesAction.__doc__ = """Action to be performed by the mouse handles
|
||||
* ``ResizeRightUp``: Resize right up (Top right handle)
|
||||
* ``ResizeLeftDown``: Resize left down (Bottom left handle)
|
||||
* ``ResizeRightDown``: Resize right down (Bottom right handle)
|
||||
* ``RotateLeftUp``: Rotate left up (Top left handle)
|
||||
* ``RotateRightUp``: Rotate right up (Top right handle)
|
||||
* ``RotateLeftDown``: Rotate left up (Bottom left handle)
|
||||
* ``RotateRightDown``: Rotate right up (Bottom right handle)
|
||||
* ``RotateLeftUp``: Rotate from top left handle.
|
||||
|
||||
.. versionadded:: 4.0
|
||||
|
||||
* ``RotateRightUp``: Rotate from top right handle.
|
||||
|
||||
.. versionadded:: 4.0
|
||||
|
||||
* ``RotateLeftDown``: Rotate from bottom left handle.
|
||||
|
||||
.. versionadded:: 4.0
|
||||
|
||||
* ``RotateRightDown``: Rotate right bottom right handle.
|
||||
|
||||
.. versionadded:: 4.0
|
||||
|
||||
* ``SelectItem``: Select item
|
||||
* ``NoAction``: No action
|
||||
|
||||
|
@ -5897,10 +5897,10 @@ class CORE_EXPORT Qgis
|
||||
ResizeRightUp, //!< Resize right up (Top right handle)
|
||||
ResizeLeftDown, //!< Resize left down (Bottom left handle)
|
||||
ResizeRightDown, //!< Resize right down (Bottom right handle)
|
||||
RotateLeftUp, //!< Rotate left up (Top left handle)
|
||||
RotateRightUp, //!< Rotate right up (Top right handle)
|
||||
RotateLeftDown, //!< Rotate left up (Bottom left handle)
|
||||
RotateRightDown, //!< Rotate right up (Bottom right handle)
|
||||
RotateLeftUp, //!< Rotate from top left handle. \since QGIS 4.0
|
||||
RotateRightUp, //!< Rotate from top right handle. \since QGIS 4.0
|
||||
RotateLeftDown, //!< Rotate from bottom left handle. \since QGIS 4.0
|
||||
RotateRightDown, //!< Rotate right bottom right handle. \since QGIS 4.0
|
||||
SelectItem, //!< Select item
|
||||
NoAction //!< No action
|
||||
};
|
||||
|
@ -15,10 +15,13 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsgraphicsviewmousehandles.h"
|
||||
#include "moc_qgsgraphicsviewmousehandles.cpp"
|
||||
#include "qgsrendercontext.h"
|
||||
|
||||
#include "qgis.h"
|
||||
#include "qgsgraphicsviewmousehandles.h"
|
||||
#include "qgslayoututils.h"
|
||||
#include "qgsrendercontext.h"
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsSceneHoverEvent>
|
||||
#include <QPainter>
|
||||
@ -86,6 +89,7 @@ QRectF QgsGraphicsViewMouseHandles::storedItemRect( QGraphicsItem *item ) const
|
||||
|
||||
void QgsGraphicsViewMouseHandles::rotateItem( QGraphicsItem *, double, double, double )
|
||||
{
|
||||
QgsDebugError( QStringLiteral( "Rotation is not implemented for this class" ) );
|
||||
}
|
||||
|
||||
void QgsGraphicsViewMouseHandles::previewItemMove( QGraphicsItem *, double, double )
|
||||
@ -930,13 +934,7 @@ void QgsGraphicsViewMouseHandles::rotateMouseMove( QPointF currentPosition, bool
|
||||
mRotationDelta = mRotationCurrent - mRotationBegin;
|
||||
if ( snapToCommonAngles )
|
||||
{
|
||||
const double commonAngles = 15;
|
||||
double snappedRotationDelta = std::floor( std::abs( mRotationDelta ) / commonAngles ) * commonAngles;
|
||||
if ( std::abs( std::fmod( mRotationDelta, commonAngles ) ) >= 10 )
|
||||
{
|
||||
snappedRotationDelta += commonAngles;
|
||||
}
|
||||
mRotationDelta = mRotationDelta >= 0 ? snappedRotationDelta : -snappedRotationDelta;
|
||||
mRotationDelta = QgsLayoutUtils::snappedAngle( mRotationDelta );
|
||||
}
|
||||
|
||||
const double itemRotationRadian = rotation() * M_PI / 180;
|
||||
|
@ -77,7 +77,11 @@ class GUI_EXPORT QgsGraphicsViewMouseHandles : public QObject, public QGraphicsR
|
||||
//! Returns TRUE is user is currently resizing with the handles
|
||||
bool isResizing() const { return mIsResizing; }
|
||||
|
||||
//! Returns TRUE is user is currently rotating with the handles
|
||||
/**
|
||||
* Returns TRUE is user is currently rotating with the handles.
|
||||
*
|
||||
* \since QGIS 4.0
|
||||
*/
|
||||
bool isRotating() const { return mIsRotating; }
|
||||
|
||||
bool shouldBlockEvent( QInputEvent *event ) const;
|
||||
@ -85,10 +89,23 @@ class GUI_EXPORT QgsGraphicsViewMouseHandles : public QObject, public QGraphicsR
|
||||
//! Initializes a drag operation \since QGIS 3.34
|
||||
void startMove( QPointF sceneCoordPos );
|
||||
|
||||
//! Returns TRUE if rotation functionality is enabled
|
||||
/**
|
||||
* Returns TRUE if rotation functionality is enabled.
|
||||
*
|
||||
* Rotation is not enabled by default.
|
||||
*
|
||||
* \since QGIS 4.0
|
||||
*/
|
||||
bool isRotationEnabled() const { return mRotationEnabled; }
|
||||
|
||||
//! Sets whether rotation functionality is enabled
|
||||
/**
|
||||
* Sets whether rotation functionality is enabled.
|
||||
*
|
||||
* Rotation is not enabled by default. Subclasses must implement the
|
||||
* rotateItem() method in order to support rotation.
|
||||
*
|
||||
* \since QGIS 4.0
|
||||
*/
|
||||
void setRotationEnabled( bool enable );
|
||||
|
||||
public slots:
|
||||
|
Loading…
x
Reference in New Issue
Block a user