r23389 by craig - #15869: Apply patch for cursor setting simplification (ale)
scribus-commit
scribus-commit at lists.scribus.net
Sat Nov 30 16:54:19 UTC 2019
Author: craig
Date: Sat Nov 30 16:54:19 2019
New Revision: 23389
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23389
Log:
#15869: Apply patch for cursor setting simplification (ale)
Modified:
trunk/Scribus/scribus/canvasmode_normal.cpp
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/scribusview.h
Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23389&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Sat Nov 30 16:54:19 2019
@@ -765,9 +765,10 @@
QRect tx = p.mapRect(QRect(0, 0, static_cast<int>(currItem->width()), static_cast<int>(currItem->height())));
if ((tx.intersects(mpo)) && (!currItem->locked()))
{
- m_view->setCursor(QCursor(Qt::OpenHandCursor));
+ Qt::CursorShape cursorShape = Qt::OpenHandCursor;
if (!currItem->sizeLocked())
- m_view->HandleCurs(currItem, mpo);
+ cursorShape = m_view->getResizeCursor(currItem, mpo, cursorShape);
+ m_view->setCursor(QCursor(cursorShape));
}
}
}
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23389&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sat Nov 30 16:54:19 2019
@@ -1737,21 +1737,19 @@
// qApp->changeOverrideCursor(QCursor(loadIcon("dragpix.png")));
}
-void ScribusView::HandleCurs(PageItem *currItem, QRect mpo)
-{
- QPoint tx, tx2;
+Qt::CursorShape ScribusView::getResizeCursor(PageItem *currItem, QRect mpo, Qt::CursorShape cursorShape)
+{
QTransform ma;
- // ma.translate(-Doc->minCanvasCoordinate.x()*m_canvas->scale(), -Doc->minCanvasCoordinate.y()*m_canvas->scale());
m_canvas->Transform(currItem, ma);
- tx = ma.map(QPoint(static_cast<int>(currItem->width()), 0));
- tx2 = ma.map(QPoint(0, static_cast<int>(currItem->height())));
+ QPoint tx = ma.map(QPoint(static_cast<int>(currItem->width()), 0));
+ QPoint tx2 = ma.map(QPoint(0, static_cast<int>(currItem->height())));
if (mpo.contains(tx) || mpo.contains(tx2))
{
double rr = fabs(currItem->rotation());
if (((rr >= 0.0) && (rr < 45.0)) || ((rr >= 135.0) && (rr < 225.0)) || ((rr >=315.0) && (rr <= 360.0)))
- setCursor(QCursor(Qt::SizeBDiagCursor));
+ cursorShape = Qt::SizeBDiagCursor;
if (((rr >= 45.0) && (rr < 135.0)) || ((rr >= 225.0) && (rr < 315.0)))
- setCursor(QCursor(Qt::SizeFDiagCursor));
+ cursorShape = Qt::SizeFDiagCursor;
}
tx = ma.map(QPoint(static_cast<int>(currItem->width()), static_cast<int>(currItem->height())/2));
tx2 = ma.map(QPoint(0, static_cast<int>(currItem->height())/2));
@@ -1759,9 +1757,9 @@
{
double rr = fabs(currItem->rotation());
if (((rr >= 0.0) && (rr < 45.0)) || ((rr >= 135.0) && (rr < 225.0)) || ((rr >= 315.0) && (rr <= 360.0)))
- setCursor(QCursor(Qt::SizeHorCursor));
+ cursorShape = Qt::SizeHorCursor;
if (((rr >= 45.0) && (rr < 135.0)) || ((rr >= 225.0) && (rr < 315.0)))
- setCursor(QCursor(Qt::SizeVerCursor));
+ cursorShape = Qt::SizeVerCursor;
}
tx = ma.map(QPoint(static_cast<int>(currItem->width())/2, 0));
tx2 = ma.map(QPoint(static_cast<int>(currItem->width())/2, static_cast<int>(currItem->height())));
@@ -1769,9 +1767,9 @@
{
double rr = fabs(currItem->rotation());
if (((rr >= 0.0) && (rr < 45.0)) || ((rr >= 135.0) && (rr < 225.0)) || ((rr >= 315.0) && (rr <= 360.0)))
- setCursor(QCursor(Qt::SizeVerCursor));
+ cursorShape = Qt::SizeVerCursor;
if (((rr >= 45.0) && (rr < 135.0)) || ((rr >= 225.0) && (rr < 315.0)))
- setCursor(QCursor(Qt::SizeHorCursor));
+ cursorShape = Qt::SizeHorCursor;
}
tx = ma.map(QPoint(static_cast<int>(currItem->width()), static_cast<int>(currItem->height())));
tx2 = ma.map(QPoint(0, 0));
@@ -1782,11 +1780,12 @@
double rr = fabs(currItem->rotation());
if (((rr >= 0.0) && (rr < 45.0)) || ((rr >= 135.0) && (rr < 225.0)) ||
((rr >= 315.0) && (rr <= 360.0)))
- setCursor(QCursor(Qt::SizeFDiagCursor));
+ cursorShape = Qt::SizeFDiagCursor;
if (((rr >= 45.0) && (rr < 135.0)) || ((rr >= 225.0) && (rr < 315.0)))
- setCursor(QCursor(Qt::SizeBDiagCursor));
- }
- }
+ cursorShape = Qt::SizeBDiagCursor;
+ }
+ }
+ return cursorShape;
}
void ScribusView::SelectItemNr(uint nr, bool draw, bool single)
Modified: trunk/Scribus/scribus/scribusview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23389&path=/trunk/Scribus/scribus/scribusview.h
==============================================================================
--- trunk/Scribus/scribus/scribusview.h (original)
+++ trunk/Scribus/scribus/scribusview.h Sat Nov 30 16:54:19 2019
@@ -176,7 +176,8 @@
bool PointOnLine(QPoint Start, QPoint Ende, QRect MArea);
void TransformPoly(int mode, int rot = 1, double scaling = 1.0);
bool slotSetCurs(int x, int y);
- void HandleCurs(PageItem *currItem, QRect mpo);
+ // \brief return a resize cursor if the mouse is on a handle.
+ Qt::CursorShape getResizeCursor(PageItem *currItem, QRect mpo, Qt::CursorShape cursorShape = Qt::ArrowCursor);
void Deselect(bool prop = true);
void SelectItemNr(uint nr, bool draw = true, bool single = false);
void SelectItem(PageItem *pi, bool draw = true, bool single = false);
More information about the scribus-commit
mailing list