diff --git a/src/app/puzzle/share/resources/puzzleicon.qrc b/src/app/puzzle/share/resources/puzzleicon.qrc
index 83dde8c8e..cf7527f52 100644
--- a/src/app/puzzle/share/resources/puzzleicon.qrc
+++ b/src/app/puzzle/share/resources/puzzleicon.qrc
@@ -9,12 +9,12 @@
puzzleicon/64x64/iconPortrait.png
puzzleicon/64x64/iconGrainlineVertical.png
puzzleicon/64x64/iconGrainlineHorizontal.png
- puzzleicon/64x64/cursorRotate.png
puzzleicon/64x64/iconProperties.png
puzzleicon/svg/icon_scissors.svg
puzzleicon/svg/icon_scissors_vertical.svg
puzzleicon/svg/icon_scissors_horizontal.svg
puzzleicon/16x16/roll.png
puzzleicon/16x16/template.png
+ puzzleicon/svg/cursor_rotate.svg
diff --git a/src/app/puzzle/share/resources/puzzleicon/64x64/cursorRotate.png b/src/app/puzzle/share/resources/puzzleicon/64x64/cursorRotate.png
index a9ade2aee..831f77ed0 100644
Binary files a/src/app/puzzle/share/resources/puzzleicon/64x64/cursorRotate.png and b/src/app/puzzle/share/resources/puzzleicon/64x64/cursorRotate.png differ
diff --git a/src/app/puzzle/share/resources/puzzleicon/64x64/cursorRotate@2x.png b/src/app/puzzle/share/resources/puzzleicon/64x64/cursorRotate@2x.png
index 0bde89ddb..4cb07973b 100644
Binary files a/src/app/puzzle/share/resources/puzzleicon/64x64/cursorRotate@2x.png and b/src/app/puzzle/share/resources/puzzleicon/64x64/cursorRotate@2x.png differ
diff --git a/src/app/puzzle/share/resources/puzzleicon/svg/cursor_rotate.svg b/src/app/puzzle/share/resources/puzzleicon/svg/cursor_rotate.svg
index f5b2423cb..2bc7aa1ac 100644
--- a/src/app/puzzle/share/resources/puzzleicon/svg/cursor_rotate.svg
+++ b/src/app/puzzle/share/resources/puzzleicon/svg/cursor_rotate.svg
@@ -1,6 +1,4 @@
-
-
diff --git a/src/app/puzzle/vpgraphicspiece.cpp b/src/app/puzzle/vpgraphicspiece.cpp
index fda68e039..c0973ce34 100644
--- a/src/app/puzzle/vpgraphicspiece.cpp
+++ b/src/app/puzzle/vpgraphicspiece.cpp
@@ -31,13 +31,13 @@
#include
#include
#include
-#include
#include
#include
#include
#include
#include
#include
+#include
#include "vppiece.h"
#include "vppiecelist.h"
@@ -61,8 +61,13 @@ VPGraphicsPiece::VPGraphicsPiece(VPPiece *piece, QGraphicsItem *parent) :
m_internalPaths(QVector()),
m_internalPathsPenStyle(QVector()),
m_placeLabels(QVector()),
- m_rotationStartPoint(QPointF())
+ m_rotationStartPoint(QPointF()),
+ m_rotateCursor(QCursor())
{
+
+ QPixmap cursor_pixmap = QIcon("://puzzleicon/svg/cursor_rotate.svg").pixmap(QSize(32,32));
+ m_rotateCursor= QCursor(cursor_pixmap, 16, 16);
+
Init();
}
@@ -276,11 +281,24 @@ void VPGraphicsPiece::mousePressEvent(QGraphicsSceneMouseEvent *event)
//perform the default behaviour
QGraphicsItem::mousePressEvent(event);
- // change the cursor when clicking left button
+ // change the cursor when clicking the left button
+ if((event->button() == Qt::LeftButton))
+ {
+ if(event->modifiers() & Qt::AltModifier)
+ {
+ setCursor(m_rotateCursor);
+ }
+ else
+ {
+ setCursor(Qt::ClosedHandCursor);
+ }
+ }
+
+
+ // change the selected state when clicking left button
if (event->button() == Qt::LeftButton)
{
setSelected(true);
- setCursor(Qt::ClosedHandCursor);
if (event->modifiers() & Qt::ControlModifier)
{
@@ -295,12 +313,6 @@ void VPGraphicsPiece::mousePressEvent(QGraphicsSceneMouseEvent *event)
if((event->button() == Qt::LeftButton) && (event->modifiers() & Qt::AltModifier))
{
m_rotationStartPoint = event->scenePos();
-
- QPixmap cursor_pixmap = QPixmap(":/cursor_rotate");
- cursor_pixmap = cursor_pixmap.scaledToWidth(32);
- QCursor cursor_rotate = QCursor(cursor_pixmap, 16, 16);
-
- setCursor(cursor_rotate);
}
}
@@ -309,6 +321,8 @@ void VPGraphicsPiece::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
{
if((event->buttons() == Qt::LeftButton) && (event->modifiers() & Qt::AltModifier))
{
+ //FIXME: it flickers between the arrow cursor and the rotate cursor
+ setCursor(m_rotateCursor);
QPointF rotationNewPoint = event->scenePos();
QPointF rotationCenter = sceneBoundingRect().center();
@@ -365,20 +379,14 @@ void VPGraphicsPiece::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
-
if(event->modifiers() & Qt::AltModifier)
{
- // TODO FIXME: find a more efficient way
-
- QPixmap cursor_pixmap = QPixmap(":/cursor_rotate");
- cursor_pixmap = cursor_pixmap.scaledToWidth(32);
- QCursor cursor_rotate = QCursor(cursor_pixmap, 16, 16);
-
- setCursor(cursor_rotate);
+ //FIXME: it flickers between the arrow cursor and the rotate cursor
+ setCursor(m_rotateCursor);
}
else
{
- setCursor(QCursor(Qt::OpenHandCursor));
+ setCursor(Qt::OpenHandCursor);
}
}
diff --git a/src/app/puzzle/vpgraphicspiece.h b/src/app/puzzle/vpgraphicspiece.h
index aefcca155..f7238a759 100644
--- a/src/app/puzzle/vpgraphicspiece.h
+++ b/src/app/puzzle/vpgraphicspiece.h
@@ -30,6 +30,7 @@
#define VPGRAPHICSPIECE_H
#include
+#include
class VPPiece;
@@ -105,6 +106,8 @@ private:
QVector m_placeLabels;
QPointF m_rotationStartPoint;
+
+ QCursor m_rotateCursor;
};
#endif // VPGRAPHICSPIECE_H