r25019 by jghali - More removals of deprecated globalPos() calls
scribus-commit
scribus-commit at lists.scribus.net
Sat Mar 12 16:00:07 UTC 2022
Author: jghali
Date: Sat Mar 12 16:00:07 2022
New Revision: 25019
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25019
Log:
More removals of deprecated globalPos() calls
Modified:
trunk/Scribus/scribus/canvas.cpp
trunk/Scribus/scribus/canvas.h
trunk/Scribus/scribus/canvasgesture_cellselect.cpp
trunk/Scribus/scribus/canvasgesture_rectselect.cpp
trunk/Scribus/scribus/canvasgesture_rectselect.h
trunk/Scribus/scribus/canvasgesture_resize.cpp
trunk/Scribus/scribus/canvasgesture_resize.h
trunk/Scribus/scribus/canvasgesture_rulermove.cpp
trunk/Scribus/scribus/canvasgesture_rulermove.h
trunk/Scribus/scribus/canvasmode.cpp
trunk/Scribus/scribus/canvasmode_edit.cpp
trunk/Scribus/scribus/canvasmode_edittable.cpp
trunk/Scribus/scribus/canvasmode_framelinks.cpp
trunk/Scribus/scribus/canvasmode_measurements.cpp
trunk/Scribus/scribus/canvasmode_measurements.h
trunk/Scribus/scribus/canvasmode_nodeedit.cpp
trunk/Scribus/scribus/canvasmode_normal.cpp
trunk/Scribus/scribus/canvasmode_rotate.cpp
trunk/Scribus/scribus/chartableview.cpp
trunk/Scribus/scribus/ui/hruler.cpp
trunk/Scribus/scribus/ui/rulermover.cpp
trunk/Scribus/scribus/ui/rulermover.h
trunk/Scribus/scribus/ui/storyeditor.cpp
Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp (original)
+++ trunk/Scribus/scribus/canvas.cpp Sat Mar 12 16:00:07 2022
@@ -119,7 +119,8 @@
// (xoff, yoff) = ruler origin relative to canvas top-left
double xoff = m_doc->rulerXoffset - xmin;
double yoff = m_doc->rulerYoffset - ymin;
- if (m_doc->guidesPrefs().rulerMode) {
+ if (m_doc->guidesPrefs().rulerMode)
+ {
xoff += m_doc->currentPage()->xOffset();
yoff += m_doc->currentPage()->yOffset();
}
@@ -131,8 +132,8 @@
// number of ruler divisions from ruler origin to ruler mark closest to the
// selected mouse coordinate
- double xn = qRound((p.x()/sc - xoff)/xsp);
- double yn = qRound((p.y()/sc - yoff)/ysp);
+ double xn = qRound((p.x() / sc - xoff) / xsp);
+ double yn = qRound((p.y() / sc - yoff) / ysp);
// xn*xsp + xoff, yn*ysp + yoff = distance in canvas coordinates
// from canvas top-left to ruler mark closest to selected mouse coordinate
@@ -140,9 +141,9 @@
// If these round to the selected mouse coordinate, use these to define
// (x,y), the coordinates of the desired point relative to the canvas top-left.
// Otherwise, simply scale the mouse coordinates.
- double x = ( qRound(sc*(xn*xsp + xoff)) == p.x() ?
+ double x = ( qRound(sc*(xn * xsp + xoff)) == p.x() ?
xn * xsp + xoff : p.x() / sc );
- double y = ( qRound(sc*(yn*ysp + yoff)) == p.y() ?
+ double y = ( qRound(sc*(yn * ysp + yoff)) == p.y() ?
yn * ysp + yoff : p.y() / sc );
// Finally, add xmin,ymin to get the absolute canvas coordinates of the
@@ -150,14 +151,53 @@
return FPoint(x + xmin, y + ymin);
}
-
-/*
FPoint Canvas::localToCanvas(QPointF p) const
{
- return FPoint(p.x() / m_viewMode.scale + m_doc->minCanvasCoordinate.x() ,
- p.y() / m_viewMode.scale + m_doc->minCanvasCoordinate.y());
-}
-*/
+
+ /* Allow the user to select the exact coordinate represented by a ruler mark
+ when the mouse is lined up with the ruler, rather than returning the
+ coordinate represented by the mathematical centre of the pixel which
+ may not be exactly the same as the coordinate represented by the ruler.
+ */
+
+ // (xmin, xmax) = canvas top-left
+ double xmin = m_doc->minCanvasCoordinate.x();
+ double ymin = m_doc->minCanvasCoordinate.y();
+
+ // (xoff, yoff) = ruler origin relative to canvas top-left
+ double xoff = m_doc->rulerXoffset - xmin;
+ double yoff = m_doc->rulerYoffset - ymin;
+ if (m_doc->guidesPrefs().rulerMode)
+ {
+ xoff += m_doc->currentPage()->xOffset();
+ yoff += m_doc->currentPage()->yOffset();
+ }
+ // (xsp, ysp) = spacing of ruler divisions
+ double xsp = m_doc->view()->horizRuler->ruleSpacing();
+ double ysp = m_doc->view()->vertRuler->ruleSpacing();
+
+ double sc = m_viewMode.scale;
+
+ // number of ruler divisions from ruler origin to ruler mark closest to the
+ // selected mouse coordinate
+ double xn = qRound((p.x() / sc - xoff) / xsp);
+ double yn = qRound((p.y() / sc - yoff) / ysp);
+
+ // xn*xsp + xoff, yn*ysp + yoff = distance in canvas coordinates
+ // from canvas top-left to ruler mark closest to selected mouse coordinate
+
+ // If these round to the selected mouse coordinate, use these to define
+ // (x,y), the coordinates of the desired point relative to the canvas top-left.
+ // Otherwise, simply scale the mouse coordinates.
+ double x = (qRound(sc * (xn * xsp + xoff)) == p.x() ?
+ xn * xsp + xoff : p.x() / sc);
+ double y = (qRound(sc * (yn * ysp + yoff)) == p.y() ?
+ yn * ysp + yoff : p.y() / sc);
+
+ // Finally, add xmin,ymin to get the absolute canvas coordinates of the
+ // desired point.
+ return FPoint(x + xmin, y + ymin);
+}
QPoint Canvas::canvasToLocal(const FPoint& p) const
{
@@ -553,18 +593,18 @@
return nullptr;
}
-bool Canvas::cursorOverTextFrameControl(QPoint globalPos, PageItem* frame)
-{
- FPoint mp=globalToCanvas(globalPos);
+bool Canvas::cursorOverTextFrameControl(QPointF globalPos, PageItem* frame)
+{
+ FPoint mp = globalToCanvas(globalPos);
qreal sideLength = 10 / qMax(m_viewMode.scale, 1.0);
qreal left = frame->xPos() + frame->width() - sideLength;// / 2;
qreal right = left + sideLength;
qreal top = frame->yPos() + frame->height() - sideLength;// * 1.5;
qreal bottom = top + sideLength;
- return mp.x()>left && mp.x()<right && mp.y()>top && mp.y()<bottom;
-}
-
-bool Canvas::cursorOverFrameControl(QPoint globalPos, const QRectF& targetRect, PageItem* frame)
+ return mp.x() > left && mp.x() < right && mp.y() > top && mp.y() < bottom;
+}
+
+bool Canvas::cursorOverFrameControl(QPointF globalPos, const QRectF& targetRect, PageItem* frame)
{
FPoint mp = globalToCanvas(globalPos);
QRectF tg = targetRect.translated(frame->xPos(), frame->yPos());
Modified: trunk/Scribus/scribus/canvas.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvas.h
==============================================================================
--- trunk/Scribus/scribus/canvas.h (original)
+++ trunk/Scribus/scribus/canvas.h Sat Mar 12 16:00:07 2022
@@ -157,7 +157,7 @@
QRect canvasToGlobal(const QRectF& p) const;
QRectF canvasToGlobalF(const QRectF& p) const;
FPoint localToCanvas(QPoint p) const;
-// FPoint localToCanvas(QPointF p) const;
+ FPoint localToCanvas(QPointF p) const;
FPoint globalToCanvas(QPoint p) const;
FPoint globalToCanvas(QPointF p) const;
QRectF globalToCanvas(QRect p) const;
@@ -168,8 +168,8 @@
bool hitsCanvasPoint(QPointF globalPoint, QPointF canvasPoint) const;
bool hitsCanvasPoint(const FPoint& globalPoint, const QPointF& canvasPoint) const;
QRect exposedRect() const;
- bool cursorOverTextFrameControl(QPoint globalPos, PageItem* frame);
- bool cursorOverFrameControl(QPoint globalPos, const QRectF& targetRect, PageItem* frame);
+ bool cursorOverTextFrameControl(QPointF globalPos, PageItem* frame);
+ bool cursorOverFrameControl(QPointF globalPos, const QRectF& targetRect, PageItem* frame);
/** Returns the framehandle or INSIDE if the position falls into the frame. */
FrameHandle frameHitTest(QPointF canvasPoint, PageItem* item) const;
FrameHandle frameHitTest(QPointF canvasPoint, const QRectF& frame) const;
Modified: trunk/Scribus/scribus/canvasgesture_cellselect.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasgesture_cellselect.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_cellselect.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_cellselect.cpp Sat Mar 12 16:00:07 2022
@@ -56,7 +56,7 @@
{
// Show the table popup menu.
m_view->setCursor(Qt::ArrowCursor);
- m_view->m_ScMW->scrMenuMgr->runMenuAtPos("ItemTable", event->globalPos());
+ m_view->m_ScMW->scrMenuMgr->runMenuAtPos("ItemTable", event->globalPosition().toPoint());
}
else
{
Modified: trunk/Scribus/scribus/canvasgesture_rectselect.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasgesture_rectselect.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_rectselect.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_rectselect.cpp Sat Mar 12 16:00:07 2022
@@ -36,20 +36,21 @@
void RectSelect::leaveEvent(QEvent * e){}
-void RectSelect::prepare(QPoint globalStartPos)
+void RectSelect::prepare(QPointF globalStartPos)
{
if (!m_selectionRubberBand)
m_selectionRubberBand = new SelectionRubberBand(QRubberBand::Rectangle, m_view);
setStart(globalStartPos);
//FIXME Move to new code like SelectionRubberBand
+ QPoint selectionPoint = m_view->mapFromGlobal(globalStartPos).toPoint();
m_selectionRubberBand->setWindowOpacity(0.5);
- m_selectionRubberBand->setGeometry(QRect(m_view->mapFromGlobal(globalStartPos), m_view->mapFromGlobal(globalStartPos)));
+ m_selectionRubberBand->setGeometry(QRect(selectionPoint, selectionPoint));
}
void RectSelect::clear()
{
m_selectionRubberBand->hide();
- m_start = QPoint(0,0);
+ m_start = QPointF(0,0);
}
@@ -66,14 +67,16 @@
CanvasGesture::deactivate(fromGesture);
}
-void RectSelect::setStart(QPoint globalPos)
+void RectSelect::setStart(QPointF globalPos)
{
m_start = globalPos;
}
-void RectSelect::setEnd(QPoint globalPos)
+void RectSelect::setEnd(QPointF globalPos)
{
- m_selectionRubberBand->setGeometry(QRect(m_view->mapFromGlobal(m_start), m_view->mapFromGlobal(globalPos)).normalized());
+ QPointF startPoint = m_view->mapFromGlobal(m_start);
+ QPointF endPoint = m_view->mapFromGlobal(globalPos);
+ m_selectionRubberBand->setGeometry(QRect(startPoint.toPoint(), endPoint.toPoint()).normalized());
}
@@ -86,22 +89,22 @@
void RectSelect::mousePressEvent(QMouseEvent *m)
{
- prepare(m->globalPos());
+ prepare(m->globalPosition());
m->accept();
}
void RectSelect::mouseReleaseEvent(QMouseEvent *m)
{
-// qDebug() << "RectSelect::mouseRelease" << m->globalPos();
- setEnd(m->globalPos());
+// qDebug() << "RectSelect::mouseRelease" << m->globalPosition();
+ setEnd(m->globalPosition());
m->accept();
m_view->stopGesture();
}
void RectSelect::mouseMoveEvent(QMouseEvent *m)
{
- setEnd(m->globalPos());
+ setEnd(m->globalPosition());
m->accept();
}
Modified: trunk/Scribus/scribus/canvasgesture_rectselect.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasgesture_rectselect.h
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_rectselect.h (original)
+++ trunk/Scribus/scribus/canvasgesture_rectselect.h Sat Mar 12 16:00:07 2022
@@ -51,7 +51,7 @@
explicit RectSelect (CanvasMode* parent) : CanvasGesture(parent), m_start(0,0), m_selectionRubberBand(nullptr) {};
~RectSelect() override = default;
- void prepare(QPoint globalStartPos);
+ void prepare(QPointF globalStartPos);
void clear();
void enterEvent(QEvent * e) override;
@@ -69,10 +69,10 @@
QRectF result() const ;
private:
- void setStart(QPoint globalPos);
- void setEnd(QPoint globalPos);
+ void setStart(QPointF globalPos);
+ void setEnd(QPointF globalPos);
- QPoint m_start;
+ QPointF m_start;
SelectionRubberBand* m_selectionRubberBand;
};
Modified: trunk/Scribus/scribus/canvasgesture_resize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasgesture_resize.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_resize.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_resize.cpp Sat Mar 12 16:00:07 2022
@@ -217,7 +217,7 @@
//add action itemResizeToMargin for right click on item`s handlers
else if (m->button() == Qt::RightButton)
{
- const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
+ const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
Canvas::FrameHandle fh = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem);
m_doc->itemResizeToMargin(currItem, fh);
}
@@ -441,9 +441,9 @@
doResize(m->modifiers() & Qt::AltModifier);
}
m->accept();
- QPoint point = m->globalPos() - (m_canvas->mapToParent(QPoint(0, 0)) + m_canvas->parentWidget()->mapToGlobal(QPoint(0, 0)));
- m_view->ensureVisible(point.x(), point.y(), 20, 20);
- m_canvas->repaint();
+ QPointF point = m->globalPosition() - (m_canvas->mapToParent(QPointF(0, 0)) + m_canvas->parentWidget()->mapToGlobal(QPointF(0, 0)));
+ m_view->ensureVisible(qRound(point.x()), qRound(point.y()), 20, 20);
+ m_canvas->update();
QRectF newBounds = m_bounds.normalized();
m_canvas->displaySizeHUD(m->globalPosition(), newBounds.width() - m_extraWidth, newBounds.height() - m_extraHeight);
}
@@ -453,7 +453,7 @@
void ResizeGesture::adjustBounds(QMouseEvent *m)
{
QTransform rotation;
- FPoint docPoint = m_canvas->globalToCanvas(m->globalPos());
+ FPoint docPoint = m_canvas->globalToCanvas(m->globalPosition());
// proportional resize
bool constrainRatio = ((m->modifiers() & Qt::ControlModifier) != Qt::NoModifier);
@@ -462,7 +462,7 @@
bool centerPivot = ((m->modifiers() & Qt::ShiftModifier) != Qt::NoModifier);
/*
- if (m_mousePressPoint == m->globalPos())
+ if (m_mousePressPoint == m->globalPosition())
{
m_bounds = m_mousePressBounds;
return;
@@ -493,7 +493,7 @@
docPoint = FPoint(x, docPoint.y());
else
docPoint = FPoint(x,y);
-// qDebug() << "resize snap grid/guides:" << m->globalPos() << "-->" << m_canvas->canvasToGlobal(docPoint);
+// qDebug() << "resize snap grid/guides:" << m->globalPosition() << "-->" << m_canvas->canvasToGlobal(docPoint);
}
// un-rotate point
@@ -948,8 +948,8 @@
void ResizeGesture::mousePressEvent(QMouseEvent *m)
{
- FPoint point = m_canvas->globalToCanvas(m->globalPos());
- m_mousePressPoint = m->globalPos();
+ FPoint point = m_canvas->globalToCanvas(m->globalPosition());
+ m_mousePressPoint = m->globalPosition();
if (m_doc->m_Selection->isEmpty())
{
m_handle = Canvas::OUTSIDE;
Modified: trunk/Scribus/scribus/canvasgesture_resize.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasgesture_resize.h
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_resize.h (original)
+++ trunk/Scribus/scribus/canvasgesture_resize.h Sat Mar 12 16:00:07 2022
@@ -78,7 +78,7 @@
FPoint applyGuides(const FPoint& docPoint);
Canvas::FrameHandle m_handle {Canvas::INSIDE};
- QPoint m_mousePressPoint;
+ QPointF m_mousePressPoint;
QRectF m_bounds;
QRectF m_mousePressBounds;
QRectF m_origBounds;
Modified: trunk/Scribus/scribus/canvasgesture_rulermove.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasgesture_rulermove.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_rulermove.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_rulermove.cpp Sat Mar 12 16:00:07 2022
@@ -44,29 +44,30 @@
page = m_doc->OnPage(m_mousePoint.x(), m_mousePoint.y());
if (page == -1)
return;
- ScPage* dragToPage=m_doc->Pages->at(page);
+ ScPage* dragToPage = m_doc->Pages->at(page);
if (!dragToPage)
return;
if (m_haveGuide)
dragToPage = m_doc->Pages->at(m_page);
QColor color(m_doc->guidesPrefs().guideColor);
p->save();
+ QPoint roundedXY = m_xy.toPoint();
QPoint pageOrigin = m_canvas->canvasToLocal(QPointF(dragToPage->xOffset(), dragToPage->yOffset()));
QSize pageSize = (QSizeF(dragToPage->width(), dragToPage->height()) * m_canvas->scale()).toSize();
switch (m_mode)
{
case HORIZONTAL:
p->setPen(QPen(color, 1.0, Qt::DashDotLine, Qt::FlatCap, Qt::MiterJoin));
- p->drawLine(QPoint(pageOrigin.x(), m_xy.y()), QPoint(pageOrigin.x() + pageSize.width(), m_xy.y()));
+ p->drawLine(QPoint(pageOrigin.x(), roundedXY.y()), QPoint(pageOrigin.x() + pageSize.width(), roundedXY.y()));
break;
case VERTICAL:
p->setPen(QPen(color, 1.0, Qt::DashDotLine, Qt::FlatCap, Qt::MiterJoin));
- p->drawLine(QPoint(m_xy.x(), pageOrigin.y()), QPoint(m_xy.x(), pageOrigin.y() + pageSize.height()));
+ p->drawLine(QPoint(roundedXY.x(), pageOrigin.y()), QPoint(roundedXY.x(), pageOrigin.y() + pageSize.height()));
break;
case ORIGIN:
p->setPen(QPen(color, 1.0, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
- p->drawLine(QPoint(m_xy.x(), 0), QPoint(m_xy.x(), m_canvas->height()));
- p->drawLine(QPoint(0, m_xy.y()), QPoint(m_canvas->width(), m_xy.y()));
+ p->drawLine(QPoint(roundedXY.x(), 0), QPoint(roundedXY.x(), m_canvas->height()));
+ p->drawLine(QPoint(0, roundedXY.y()), QPoint(m_canvas->width(), roundedXY.y()));
break;
}
p->restore();
@@ -87,11 +88,11 @@
{
CanvasGesture::activate(fromGesture);
- m_haveCursor = (qApp->overrideCursor() != nullptr);
- if ( (!fromGesture) && qApp->overrideCursor())
+ m_haveCursor = (QApplication::overrideCursor() != nullptr);
+ if ( (!fromGesture) && QApplication::overrideCursor())
{
m_haveCursor = true;
- m_cursor = *(qApp->overrideCursor());
+ m_cursor = *(QApplication::overrideCursor());
}
else
{
@@ -100,13 +101,13 @@
switch (m_mode)
{
case HORIZONTAL:
- qApp->changeOverrideCursor(QCursor(Qt::SplitVCursor));
+ QApplication::changeOverrideCursor(QCursor(Qt::SplitVCursor));
break;
case VERTICAL:
- qApp->changeOverrideCursor(QCursor(Qt::SplitHCursor));
+ QApplication::changeOverrideCursor(QCursor(Qt::SplitHCursor));
break;
case ORIGIN:
- qApp->changeOverrideCursor(QCursor(Qt::CrossCursor));
+ QApplication::changeOverrideCursor(QCursor(Qt::CrossCursor));
break;
}
emit guideInfo(m_mode, m_guide);
@@ -115,7 +116,7 @@
void RulerGesture::deactivate(bool fromGesture)
{
if (m_haveCursor)
- qApp->changeOverrideCursor(m_cursor);
+ QApplication::changeOverrideCursor(m_cursor);
m_haveGuide = false;
m_mousePoint = FPoint();
@@ -156,7 +157,7 @@
void RulerGesture::mouseSelectGuide(QMouseEvent *m)
{
- FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
+ FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
const int page = m_doc->OnPage(mousePointDoc.x(), mousePointDoc.y());
if ((m_doc->guidesPrefs().guidesShown) && page >= 0)
{
@@ -178,10 +179,10 @@
void RulerGesture::movePoint(QMouseEvent* m, bool mouseRelease)
{
- FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
+ FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
const int page = m_doc->OnPage(mousePointDoc.x(), mousePointDoc.y());
- QRect viewport(m_view->viewport()->mapToGlobal(QPoint(0,0)), QSize(m_view->visibleWidth(), m_view->visibleHeight()));
- QPoint newMousePoint = m->globalPos() - (m_canvas->mapToParent(QPoint(0, 0)) + m_canvas->parentWidget()->mapToGlobal(QPoint(0, 0)));
+ QRectF viewport(m_view->viewport()->mapToGlobal(QPointF(0, 0)), QSizeF(m_view->visibleWidth(), m_view->visibleHeight()));
+ QPointF newMousePoint = m->globalPosition() - (m_canvas->mapToParent(QPointF(0, 0)) + m_canvas->parentWidget()->mapToGlobal(QPointF(0, 0)));
double x = mousePointDoc.x();
double y = mousePointDoc.y();
switch (m_mode)
@@ -193,9 +194,9 @@
case HORIZONTAL:
if (!m_ScMW->doc->guidesPrefs().guidesShown)
break;
- m_canvas->update(0, m_xy.y() - 2, m_canvas->width(), 4);
+ m_canvas->update(0, qRound(m_xy.y()) - 2, m_canvas->width(), 4);
- if ((page >= 0) && (viewport.contains(m->globalPos())))
+ if ((page >= 0) && (viewport.contains(m->globalPosition())))
{
ScPage* currentPage = m_doc->Pages->at(page);
if (m_doc->SnapElement)
@@ -211,7 +212,7 @@
}
if (!m_haveGuide)
{
- qApp->changeOverrideCursor(QCursor(Qt::SplitVCursor));
+ QApplication::changeOverrideCursor(QCursor(Qt::SplitVCursor));
if (mouseRelease)
{
currentPage->guides.addHorizontal(y - currentPage->yOffset(), GuideManagerCore::Standard);
@@ -237,9 +238,9 @@
}
else
{
- QCursor* cursor = qApp->overrideCursor();
+ QCursor* cursor = QApplication::overrideCursor();
if (cursor && (cursor->shape() != Qt::SplitVCursor))
- qApp->changeOverrideCursor(QCursor(Qt::SplitVCursor));
+ QApplication::changeOverrideCursor(QCursor(Qt::SplitVCursor));
}
m_currentGuide = y - currentPage->yOffset();
}
@@ -247,7 +248,7 @@
{
if (m_haveGuide)
{
- qApp->changeOverrideCursor(IconManager::instance().loadCursor("DelPoint.png"));
+ QApplication::changeOverrideCursor(IconManager::instance().loadCursor("DelPoint.png"));
if (mouseRelease)
{
m_doc->Pages->at(m_page)->guides.deleteHorizontal( m_guide, GuideManagerCore::Standard);
@@ -262,8 +263,8 @@
case VERTICAL:
if (!m_ScMW->doc->guidesPrefs().guidesShown)
break;
- m_canvas->update(m_xy.x() - 2, 0, 4, m_canvas->height());
- if ((page >= 0) && viewport.contains(m->globalPos()))
+ m_canvas->update(qRound(m_xy.x()) - 2, 0, 4, m_canvas->height());
+ if ((page >= 0) && viewport.contains(m->globalPosition()))
{
ScPage* currentPage = m_doc->Pages->at(page);
if (m_doc->SnapElement)
@@ -279,7 +280,7 @@
}
if (!m_haveGuide)
{
- qApp->changeOverrideCursor(QCursor(Qt::SplitHCursor));
+ QApplication::changeOverrideCursor(QCursor(Qt::SplitHCursor));
if (mouseRelease)
{
currentPage->guides.addVertical(x - currentPage->xOffset(), GuideManagerCore::Standard);
@@ -305,9 +306,9 @@
}
else
{
- QCursor* cursor = qApp->overrideCursor();
+ QCursor* cursor = QApplication::overrideCursor();
if (cursor && (cursor->shape() != Qt::SplitHCursor))
- qApp->changeOverrideCursor(QCursor(Qt::SplitHCursor));
+ QApplication::changeOverrideCursor(QCursor(Qt::SplitHCursor));
}
m_currentGuide = x - currentPage->xOffset();
}
@@ -315,7 +316,7 @@
{
if (m_haveGuide)
{
- qApp->changeOverrideCursor(IconManager::instance().loadCursor("DelPoint.png"));
+ QApplication::changeOverrideCursor(IconManager::instance().loadCursor("DelPoint.png"));
if (mouseRelease)
{
m_doc->Pages->at(m_page)->guides.deleteVertical( m_guide, GuideManagerCore::Standard);
@@ -346,7 +347,7 @@
void RulerGesture::mouseMoveEvent(QMouseEvent* m)
{
- m_mousePoint=m_canvas->globalToCanvas(m->globalPos());
+ m_mousePoint = m_canvas->globalToCanvas(m->globalPosition());
m->accept();
if (m_view->moveTimerElapsed())
{
@@ -386,12 +387,13 @@
void RulerGesture::mousePressEvent(QMouseEvent* m)
{
m->accept();
- FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
- m_view->registerMousePress(m->globalPos());
+
+ FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
+ m_view->registerMousePress(m->globalPosition());
+
if (mouseHitsGuide(mousePointDoc))
- {
- m_xy = m->globalPos() - (m_canvas->mapToParent(QPoint(0, 0)) + m_canvas->parentWidget()->mapToGlobal(QPoint(0, 0)));
- }
+ m_xy = m->globalPosition() - (m_canvas->mapToParent(QPointF(0, 0)) + m_canvas->parentWidget()->mapToGlobal(QPointF(0, 0)));
+
if (m_ScMW->doc->guidesPrefs().guidesShown)
emit guideInfo(m_mode, m_currentGuide);
}
Modified: trunk/Scribus/scribus/canvasgesture_rulermove.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasgesture_rulermove.h
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_rulermove.h (original)
+++ trunk/Scribus/scribus/canvasgesture_rulermove.h Sat Mar 12 16:00:07 2022
@@ -85,7 +85,7 @@
FPoint m_mousePoint;
Mode m_mode;
QCursor m_cursor;
- QPoint m_xy;
+ QPointF m_xy;
ScribusMainWindow* m_ScMW {nullptr};
bool m_haveCursor {false};
bool m_haveGuide {false};
Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Sat Mar 12 16:00:07 2022
@@ -833,7 +833,7 @@
bool CanvasMode::commonMouseMove(QMouseEvent *m)
{
- //m_mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
+ //m_mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
if ((m_canvas->m_viewMode.m_MouseButtonPressed && (m->buttons() & Qt::RightButton) && (m->modifiers() & Qt::ControlModifier)) || ((!(m->modifiers() & Qt::ControlModifier)) && (m->buttons() & Qt::MiddleButton)))
{
if (!m_panGesture)
@@ -977,7 +977,7 @@
ContextMenu* cmen=nullptr;
if (m_doc->m_Selection->isEmpty())
{
- //CB We should be able to get this calculated by the canvas.... it is already in m_canvas->globalToCanvas(m->globalPos());
+ //CB We should be able to get this calculated by the canvas.... it is already in m_canvas->globalToCanvas(m->globalPosition());
QPoint p(QCursor::pos() - mainWindow->mapToGlobal(QPoint(0,0)));
FPoint fp(p.x() / m_view->scale() + m_doc->minCanvasCoordinate.x(),
p.y() / m_view->scale() + m_doc->minCanvasCoordinate.y());
@@ -1142,7 +1142,7 @@
m_view->setCursor(QCursor(Qt::ArrowCursor));
if (m_doc->m_Selection->isEmpty())
{
- //CB We should be able to get this calculated by the canvas.... it is already in m_canvas->globalToCanvas(m->globalPos());
+ //CB We should be able to get this calculated by the canvas.... it is already in m_canvas->globalToCanvas(m->globalPosition());
FPoint fp = m_canvas->globalToCanvas(QCursor::pos());
cmen = new ContextMenu(mainWindow, m_doc, fp.x(), fp.y());
}
Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp Sat Mar 12 16:00:07 2022
@@ -166,7 +166,7 @@
QPoint oldP = m_canvas->canvasToLocal(QPointF(mRulerGuide, itPos.y()));
mRulerGuide = base + xp;
QPoint p = m_canvas->canvasToLocal(QPointF(mRulerGuide, itPos.y() + currItem->height() * mm.m22()));
- m_canvas->update(QRect(oldP.x()-2, oldP.y(), p.x()+2, p.y()));
+ m_canvas->update(QRect(oldP.x() - 2, oldP.y(), p.x() + 2, p.y()));
}
}
@@ -392,7 +392,8 @@
void CanvasMode_Edit::mouseMoveEvent(QMouseEvent *m)
{
- const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
+ const QPoint globalPos = m->globalPosition().toPoint();
+ const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
double newX, newY;
PageItem *currItem;
@@ -438,7 +439,7 @@
int refEndSel(currItem->asTextFrame()->itemText.endOfSelection());
currItem->itemText.deselectAll();
currItem->HasSel = false;
- m_view->slotSetCurs(m->globalPos().x(), m->globalPos().y());
+ m_view->slotSetCurs(globalPos.x(), globalPos.y());
//Make sure we don't go here if the old cursor position was not set
if (oldCp!=-1 && currItem->itemText.length() > 0)
{
@@ -513,7 +514,7 @@
SeRx = newX;
SeRy = newY;
QPoint startP = m_canvas->canvasToGlobal(QPointF(Mxp, Myp));
- m_view->redrawMarker->setGeometry(QRect(m_view->mapFromGlobal(startP), m_view->mapFromGlobal(m->globalPos())).normalized());
+ m_view->redrawMarker->setGeometry(QRect(m_view->mapFromGlobal(startP), m_view->mapFromGlobal(globalPos)).normalized());
m_view->setRedrawMarkerShown(true);
m_view->HaveSelRect = true;
return;
@@ -537,19 +538,18 @@
ss->set("ETEA", QString(""));
}
}
- const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
-
- bool inText;
- PageItem *currItem;
+
+ const QPoint globalPos = m->globalPosition().toPoint();
+ const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
+
m_canvas->PaintSizeRect(QRect());
- QTransform pm;
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
m_view->HaveSelRect = false;
m_doc->DragP = false;
m_doc->leaveDrag = false;
m->accept();
- m_view->registerMousePress(m->globalPos());
+ m_view->registerMousePress(m->globalPosition());
Mxp = mousePointDoc.x();
Myp = mousePointDoc.y();
SeRx = Mxp;
@@ -563,13 +563,15 @@
}
frameResizeHandle = 0;
- int oldP=0;
+ int oldP = 0;
+
+ PageItem* currItem{ nullptr };
if (GetItem(&currItem))
{
// m_view->slotDoCurs(false);
if ((!currItem->locked() || currItem->isTextFrame()) && !currItem->isLine())
{
- FPoint canvasPoint = m_canvas->globalToCanvas(m->globalPos());
+ FPoint canvasPoint = m_canvas->globalToCanvas(m->globalPosition());
if (m_canvas->frameHitTest(QPointF(canvasPoint.x(), canvasPoint.y()), currItem) < 0)
{
m_doc->m_Selection->delaySignalsOn();
@@ -590,7 +592,7 @@
}
if (currItem->isTextFrame())
{
- m_view->slotSetCurs(m->globalPos().x(), m->globalPos().y());
+ m_view->slotSetCurs(globalPos.x(), globalPos.y());
oldCp = currItem->itemText.cursorPosition();
}
}
@@ -612,7 +614,7 @@
//CB Where we set the cursor for a click in text frame
if (currItem->isTextFrame())
{
- inText = m_view->slotSetCurs(m->globalPos().x(), m->globalPos().y());
+ bool inText = m_view->slotSetCurs(globalPos.x(), globalPos.y());
//CB If we clicked outside a text frame to go out of edit mode and deselect the frame
if (!inText)
{
@@ -728,8 +730,8 @@
#ifdef GESTURE_FRAME_PREVIEW
clearPixmapCache();
#endif // GESTURE_FRAME_PREVIEW
- const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
- PageItem *currItem;
+ const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
+ PageItem *currItem = nullptr;
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_canvas->resetRenderMode();
m->accept();
@@ -941,20 +943,18 @@
const unsigned SELECT_IN_GROUP = Qt::AltModifier;
const unsigned SELECT_MULTIPLE = Qt::ShiftModifier;
const unsigned SELECT_BENEATH = Qt::ControlModifier;
- QTransform p;
- QRectF mpo;
- PageItem *currItem;
+
m_canvas->m_viewMode.m_MouseButtonPressed = true;
- FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
- Mxp = mousePointDoc.x(); //m->x()/m_canvas->scale());
- Myp = mousePointDoc.y(); //m->y()/m_canvas->scale());
+
+ FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
+ Mxp = mousePointDoc.x();
+ Myp = mousePointDoc.y();
double grabRadius = m_doc->guidesPrefs().grabRadius / m_canvas->scale();
- int MxpS = static_cast<int>(mousePointDoc.x()); //m->x()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.x());
- int MypS = static_cast<int>(mousePointDoc.y()); //m->y()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.y());
- mpo = QRectF(Mxp-grabRadius, Myp-grabRadius, grabRadius*2, grabRadius*2);
-// mpo.translate(m_doc->minCanvasCoordinate.x() * m_canvas->scale(), m_doc->minCanvasCoordinate.y() * m_canvas->scale());
+ int MxpS = static_cast<int>(mousePointDoc.x());
+ int MypS = static_cast<int>(mousePointDoc.y());
+ QRectF mpo(Mxp - grabRadius, Myp - grabRadius, grabRadius * 2, grabRadius * 2);
+
m_doc->nodeEdit.deselect();
-// int a;
if (!m_doc->masterPageMode())
{
int pgNum = -1;
@@ -1004,7 +1004,7 @@
m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
}
- currItem = nullptr;
+ PageItem* currItem = nullptr;
if ((m->modifiers() & SELECT_BENEATH) != 0)
{
for (int i = 0; i < m_doc->m_Selection->count(); ++i)
@@ -1021,7 +1021,7 @@
{
m_view->deselectItems(false);
}
- currItem = m_canvas->itemUnderCursor(m->globalPos(), currItem, (m->modifiers() & SELECT_IN_GROUP));
+ currItem = m_canvas->itemUnderCursor(m->globalPosition(), currItem, (m->modifiers() & SELECT_IN_GROUP));
if (currItem)
{
m_doc->m_Selection->delaySignalsOn();
Modified: trunk/Scribus/scribus/canvasmode_edittable.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasmode_edittable.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edittable.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_edittable.cpp Sat Mar 12 16:00:07 2022
@@ -158,7 +158,7 @@
{
event->accept();
- QPointF canvasPoint = m_canvas->globalToCanvas(event->globalPos()).toQPointF();
+ QPointF canvasPoint = m_canvas->globalToCanvas(event->globalPosition()).toQPointF();
double threshold = m_doc->guidesPrefs().grabRadius / m_canvas->scale();
TableHandle handle = m_table->hitTest(canvasPoint, threshold);
@@ -206,7 +206,8 @@
PageItem_TextFrame* activeFrame;
event->accept();
- QPointF canvasPoint = m_canvas->globalToCanvas(event->globalPos()).toQPointF();
+ QPointF canvasPoint = m_canvas->globalToCanvas(event->globalPosition()).toQPointF();
+ QPoint globalPos = event->globalPosition().toPoint();
double threshold = m_doc->guidesPrefs().grabRadius / m_canvas->scale();
TableHandle handle = m_table->hitTest(canvasPoint, threshold);
TableCell cell;
@@ -228,7 +229,7 @@
// Select row and pre-position text cursor
m_table->moveTo(cell);
m_table->selectRow(cell.row());
- m_view->slotSetCurs(event->globalPos().x(), event->globalPos().y());
+ m_view->slotSetCurs(globalPos.x(), globalPos.y());
m_lastCursorPos = -1;
updateCanvas(true);
break;
@@ -250,7 +251,7 @@
// Select column and pre-position text cursor
m_table->moveTo(cell);
m_table->selectColumn(cell.column());
- m_view->slotSetCurs(event->globalPos().x(), event->globalPos().y());
+ m_view->slotSetCurs(globalPos.x(), globalPos.y());
m_lastCursorPos = -1;
updateCanvas(true);
break;
@@ -268,7 +269,7 @@
// Move to the pressed cell and position the text cursor.
m_table->clearSelection();
m_table->moveTo(m_table->cellAt(canvasPoint));
- m_view->slotSetCurs(event->globalPos().x(), event->globalPos().y());
+ m_view->slotSetCurs(globalPos.x(), globalPos.y());
m_lastCursorPos = m_table->activeCell().textFrame()->itemText.cursorPosition();
m_view->m_ScMW->setTBvals(m_table->activeCell().textFrame());
makeLongTextCursorBlink();
@@ -292,8 +293,7 @@
else if (event->button() == Qt::RightButton)
{
// Show the table popup menu.
- //m_view->m_ScMW->scrMenuMgr->runMenuAtPos("ItemTable", event->globalPos());
- const FPoint mousePointDoc(m_canvas->globalToCanvas(event->globalPos()));
+ const FPoint mousePointDoc(m_canvas->globalToCanvas(event->globalPosition()));
createContextMenu(m_table, mousePointDoc.x(), mousePointDoc.y());
}
}
@@ -305,7 +305,7 @@
void CanvasMode_EditTable::mouseDoubleClickEvent(QMouseEvent* event)
{
- TableCell hitCell = m_table->cellAt(m_canvas->globalToCanvas(event->globalPos()).toQPointF());
+ TableCell hitCell = m_table->cellAt(m_canvas->globalToCanvas(event->globalPosition()).toQPointF());
if (!hitCell.isValid())
return;
@@ -407,7 +407,7 @@
void CanvasMode_EditTable::handleMouseDrag(QMouseEvent* event)
{
- TableCell hitCell = m_table->cellAt(m_canvas->globalToCanvas(event->globalPos()).toQPointF());
+ TableCell hitCell = m_table->cellAt(m_canvas->globalToCanvas(event->globalPosition()).toQPointF());
TableCell activeCell = m_table->activeCell();
PageItem_TextFrame* activeFrame = activeCell.textFrame();
@@ -416,7 +416,9 @@
// Select text in active cell text frame.
activeFrame->itemText.deselectAll();
activeFrame->HasSel = false;
- m_view->slotSetCurs(event->globalPos().x(), event->globalPos().y());
+
+ QPoint globalPos = event->globalPosition().toPoint();
+ m_view->slotSetCurs(globalPos.x(), globalPos.y());
PageItem_TextFrame* newActiveFrame = m_table->activeCell().textFrame();
if (activeFrame == newActiveFrame)
Modified: trunk/Scribus/scribus/canvasmode_framelinks.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasmode_framelinks.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_framelinks.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_framelinks.cpp Sat Mar 12 16:00:07 2022
@@ -157,7 +157,8 @@
if ((m_canvas->m_viewMode.m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton))
{
QPoint startP = m_canvas->canvasToGlobal(QPointF(m_Mxp, m_Myp));
- m_view->redrawMarker->setGeometry(QRect(m_view->mapFromGlobal(startP), m_view->mapFromGlobal(m->globalPos())).normalized());
+ QPoint globalPos = m->globalPosition().toPoint();
+ m_view->redrawMarker->setGeometry(QRect(m_view->mapFromGlobal(startP), m_view->mapFromGlobal(globalPos)).normalized());
m_view->setRedrawMarkerShown(true);
m_view->HaveSelRect = true;
return;
Modified: trunk/Scribus/scribus/canvasmode_measurements.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasmode_measurements.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_measurements.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_measurements.cpp Sat Mar 12 16:00:07 2022
@@ -88,7 +88,7 @@
if (m_active)
{
m->accept();
- adjustPoint(m->globalPos());
+ adjustPoint(m->globalPosition());
}
m_active = false;
showValues();
@@ -99,12 +99,12 @@
if (m_active)
{
m->accept();
- adjustPoint(m->globalPos());
+ adjustPoint(m->globalPosition());
showValues();
}
else
{
- FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
+ FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
m_canvas->displayCorrectedXYHUD(m->globalPosition(), mousePointDoc.x(), mousePointDoc.y());
}
}
@@ -113,24 +113,24 @@
{
m->accept();
m_active = true;
- adjustPoint(m->globalPos());
+ adjustPoint(m->globalPosition());
m_start = m_current;
m_startDoc = m_currentDoc;
showValues();
}
-void MeasurementsMode::adjustPoint(QPoint globalPoint)
+void MeasurementsMode::adjustPoint(QPointF globalPoint)
{
- QPoint point = globalPoint - (m_canvas->mapToParent(QPoint(0, 0)) + m_canvas->parentWidget()->mapToGlobal(QPoint(0, 0)));
- m_canvas->update(QRect(m_start, m_current).normalized().adjusted(-1,-1,1,1));
+ QPointF point = globalPoint - (m_canvas->mapToParent(QPointF(0, 0)) + m_canvas->parentWidget()->mapToGlobal(QPointF(0, 0)));
+ m_canvas->update(QRect(m_start.toPoint(), m_current.toPoint()).normalized().adjusted(-1, -1, 1, 1));
m_current = point;
- m_currentDoc = m_canvas->localToCanvas(m_current) - FPoint(m_doc->currentPage()->xOffset(),m_doc->currentPage()->yOffset());
+ m_currentDoc = m_canvas->localToCanvas(m_current) - FPoint(m_doc->currentPage()->xOffset(), m_doc->currentPage()->yOffset());
}
void MeasurementsMode::showValues()
{
double dx = m_currentDoc.x() - m_startDoc.x();
double dy = m_currentDoc.y() - m_startDoc.y();
- m_palette->setValues(m_startDoc.x(), m_startDoc.y(), m_currentDoc.x(), m_currentDoc.y(), -xy2Deg(dx, dy), sqrt(dx*dx + dy*dy));
- m_canvas->update(QRect(m_start, m_current).normalized());
+ m_palette->setValues(m_startDoc.x(), m_startDoc.y(), m_currentDoc.x(), m_currentDoc.y(), -xy2Deg(dx, dy), sqrt(dx * dx + dy * dy));
+ m_canvas->update(QRect(m_start.toPoint(), m_current.toPoint()).normalized());
}
Modified: trunk/Scribus/scribus/canvasmode_measurements.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasmode_measurements.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_measurements.h (original)
+++ trunk/Scribus/scribus/canvasmode_measurements.h Sat Mar 12 16:00:07 2022
@@ -54,11 +54,11 @@
void setActive(bool);
private:
- void adjustPoint(QPoint point);
+ void adjustPoint(QPointF point);
void showValues();
bool m_active {false};
- QPoint m_start;
- QPoint m_current;
+ QPointF m_start;
+ QPointF m_current;
FPoint m_startDoc;
FPoint m_currentDoc;
Measurements* m_palette {nullptr};
Modified: trunk/Scribus/scribus/canvasmode_nodeedit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasmode_nodeedit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_nodeedit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_nodeedit.cpp Sat Mar 12 16:00:07 2022
@@ -264,11 +264,12 @@
void CanvasMode_NodeEdit::mouseMoveEvent(QMouseEvent *m)
{
- PageItem *currItem;
- FPoint npf;
double sc = m_canvas->scale();
+ FPoint npf = m_canvas->globalToCanvas(m->globalPosition());
+
m->accept();
- npf = m_canvas->globalToCanvas(m->globalPos());
+
+ PageItem* currItem { nullptr };
if (GetItem(&currItem))
{
if (m_doc->DragP)
@@ -293,14 +294,14 @@
}
else // shouldn't be in nodeedit mode now, should it??
{
- npf = m_canvas->globalToCanvas(m->globalPos());
+ npf = m_canvas->globalToCanvas(m->globalPosition());
if ((m_canvas->m_viewMode.m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton) && (m_GyM == -1) && (m_GxM == -1))
{
if (!m_rectangleSelect)
{
m_rectangleSelect = new RectSelect(this);
}
- m_rectangleSelect->prepare(m->globalPos());
+ m_rectangleSelect->prepare(m->globalPosition());
m_view->startGesture(m_rectangleSelect);
return;
}
@@ -353,7 +354,7 @@
m_doc->leaveDrag = false;
m_MoveGX = m_MoveGY = false;
m->accept();
- m_view->registerMousePress(m->globalPos());
+ m_view->registerMousePress(m->globalPosition());
QRect mpo;
m_Mxp = m->position().x();
m_Myp = m->position().y();
@@ -407,7 +408,7 @@
if (m_doc->nodeEdit.hasNodeSelected() && (m_doc->nodeEdit.selectionCount() == 1))
{
//FIXME:av
- FPoint newP = m_canvas->globalToCanvas(m->globalPos());
+ FPoint newP = m_canvas->globalToCanvas(m->globalPosition());
currItem->OldB2 = currItem->width();
currItem->OldH2 = currItem->height();
FPointArray Clip;
@@ -507,7 +508,7 @@
m_doc->nodeEdit.deselect();
QTransform pm2 = currItem->getTransform();
- npf2 = m_canvas->globalToCanvas(m->globalPos()).transformPoint(pm2, true);
+ npf2 = m_canvas->globalToCanvas(m->globalPosition()).transformPoint(pm2, true);
if ((currItem->isSymbol() || currItem->isGroup()) && (!m_doc->nodeEdit.isContourLine()))
{
if (currItem->imageFlippedH())
@@ -526,7 +527,7 @@
if (((m_doc->nodeEdit.edPoints()) && (i % 2 != 0)) || ((!m_doc->nodeEdit.edPoints()) && (i % 2 == 0)))
continue;
QPointF npf = pm2.map(Clip.pointQF(i));
- if (m_canvas->hitsCanvasPoint(m->globalPos(), npf))
+ if (m_canvas->hitsCanvasPoint(m->globalPosition(), npf))
{
m_doc->nodeEdit.setClre(i);
if ((m_doc->nodeEdit.edPoints()) && (m_doc->nodeEdit.selNode().contains(i) == 0))
@@ -952,7 +953,7 @@
m_Dyp = qRound(m->y() / m_canvas->scale()); // + m_doc->minCanvasCoordinate.y());
if (!m_rectangleSelect)
m_rectangleSelect = new RectSelect(this);
- m_rectangleSelect->prepare(m->globalPos());
+ m_rectangleSelect->prepare(m->globalPosition());
m_view->startGesture(m_rectangleSelect);
}
@@ -993,7 +994,7 @@
if (((m_doc->nodeEdit.edPoints()) && (i % 2 != 0)) || ((!m_doc->nodeEdit.edPoints()) && (i % 2 == 0)))
continue;
QPointF point = Clip.pointQF(i);
- if (m_canvas->hitsCanvasPoint(m->globalPos(), itemPos.map(point)))
+ if (m_canvas->hitsCanvasPoint(m->globalPosition(), itemPos.map(point)))
{
if (m_doc->nodeEdit.submode() == NodeEditContext::MOVE_POINT)
m_view->setCursor(QCursor(Qt::SizeAllCursor));
@@ -1026,7 +1027,7 @@
for (double d = 0.0; d <= 1.0; d += delta)
{
QPointF pl = Bez.pointAtPercent(d);
- if (m_canvas->hitsCanvasPoint(m->globalPos(), FPoint(pl.x(), pl.y())))
+ if (m_canvas->hitsCanvasPoint(m->globalPosition(), FPoint(pl.x(), pl.y())))
{
if (m_doc->nodeEdit.submode() == NodeEditContext::MOVE_POINT)
m_view->setCursor(IconManager::instance().loadCursor("handc.png"));
@@ -1054,7 +1055,7 @@
{
if (!m_rectangleSelect)
m_rectangleSelect = new RectSelect(this);
- m_rectangleSelect->prepare(m->globalPos());
+ m_rectangleSelect->prepare(m->globalPosition());
m_view->startGesture(m_rectangleSelect);
return;
}
@@ -1095,7 +1096,7 @@
int storedClRe = m_doc->nodeEdit.clre();
if (m_doc->nodeEdit.selectionCount() == 1)
{
- npf = m_canvas->globalToCanvas(m->globalPos());
+ npf = m_canvas->globalToCanvas(m->globalPosition());
double nx = npf.x();
double ny = npf.y();
if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
@@ -1199,7 +1200,7 @@
}
else
{
- npf = m_canvas->globalToCanvas(m->globalPos());
+ npf = m_canvas->globalToCanvas(m->globalPosition());
double nx = npf.x();
double ny = npf.y();
if (!m_doc->ApplyGuides(&nx, &ny) && !m_doc->ApplyGuides(&nx, &ny,true))
Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Sat Mar 12 16:00:07 2022
@@ -138,8 +138,11 @@
void CanvasMode_Normal::mouseDoubleClickEvent(QMouseEvent *m)
{
+ const QPoint globalPos = m->globalPosition().toPoint();
PageItem *currItem = nullptr;
+
m->accept();
+
m_canvas->m_viewMode.m_MouseButtonPressed = false;
if (m_doc->drawAsPreview)
{
@@ -225,7 +228,7 @@
else if (currItem->itemType() == PageItem::TextFrame)
{
// See if double click was on a frame handle
- FPoint p = m_canvas->globalToCanvas(m->globalPos());
+ FPoint p = m_canvas->globalToCanvas(m->globalPosition());
Canvas::FrameHandle fh = m_canvas->frameHitTest(QPointF(p.x(),p.y()), currItem);
//CB if annotation, open the annotation dialog
if (currItem->isAnnotation())
@@ -239,7 +242,7 @@
else if (m_doc->appMode != modeEdit)
{
m_view->requestMode(modeEdit);
- m_view->slotSetCurs(m->globalPos().x(), m->globalPos().y());
+ m_view->slotSetCurs(globalPos.x(), globalPos.y());
//used for updating Notes Styles Editor and menu actions for marks
//if cursor is in mark`s place
m_ScMW->setTBvals(currItem);
@@ -270,7 +273,7 @@
else if (currItem->isTable())
{
m_view->requestMode(modeEditTable);
- m_view->slotSetCurs(m->globalPos().x(), m->globalPos().y());
+ m_view->slotSetCurs(globalPos.x(), globalPos.y());
m_ScMW->setTBvals(currItem);
}
}
@@ -280,16 +283,15 @@
void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
{
// qDebug()<<"CanvasMode_Normal::mouseMoveEvent";
-// const double mouseX = m->globalX();
-// const double mouseY = m->globalY();
- const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
+ const QPoint globalPos = m->globalPosition().toPoint();
+ const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
bool wasLastPostOverGuide = m_lastPosWasOverGuide;
m_lastPosWasOverGuide = false;
- PageItem *currItem=nullptr;
+ PageItem *currItem = nullptr;
bool erf = false;
m->accept();
-// qDebug() << "legacy mode move:" << m->x() << m->y() << m_canvas->globalToCanvas(m->globalPos()).x() << m_canvas->globalToCanvas(m->globalPos()).y();
+// qDebug() << "legacy mode move:" << m->x() << m->y() << m_canvas->globalToCanvas(m->globalPosition()).x() << m_canvas->globalToCanvas(m->globalPosition()).y();
// emit MousePos(m->x()/m_canvas->scale(),// + m_doc->minCanvasCoordinate.x(),
// m->y()/m_canvas->scale()); // + m_doc->minCanvasCoordinate.y());
@@ -316,7 +318,7 @@
}
else
{
- PageItem* hoveredItem = m_canvas->itemUnderCursor(m->globalPos(), nullptr, m->modifiers());
+ PageItem* hoveredItem = m_canvas->itemUnderCursor(m->globalPosition(), nullptr, m->modifiers());
if (hoveredItem)
frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(), mousePointDoc.y()), hoveredItem);
}
@@ -366,7 +368,7 @@
if (!movingOrResizing && mouseIsOnPage)
{
PageItem* hoveredItem = nullptr;
- hoveredItem = m_canvas->itemUnderCursor(m->globalPos(), hoveredItem, m->modifiers());
+ hoveredItem = m_canvas->itemUnderCursor(m->globalPosition(), hoveredItem, m->modifiers());
if (hoveredItem)
{
if (m_doc->drawAsPreview)
@@ -396,7 +398,7 @@
if (toolT.isEmpty())
toolT = hoveredItem->itemText.plainText();
if (!toolT.isEmpty())
- QToolTip::showText(m->globalPos() + QPoint(5, 5), toolT, m_canvas);
+ QToolTip::showText(globalPos + QPoint(5, 5), toolT, m_canvas);
if (hoveredItem != m_hoveredItem)
{
if (m_hoveredItem)
@@ -429,9 +431,9 @@
{
if (hoveredItem->isTextFrame() && hoveredItem->frameOverflows())
{
- if (m_canvas->cursorOverTextFrameControl(m->globalPos(), hoveredItem))
+ if (m_canvas->cursorOverTextFrameControl(m->globalPosition(), hoveredItem))
{
- QToolTip::showText(m->globalPos() + QPoint(5, 5), tr("Overflow Characters: %1 (%2 White Spaces)\nClick to link to existing text frame or auto-create new linked text frame").arg(hoveredItem->frameOverflowCount()).arg(hoveredItem->frameOverflowBlankCount()), m_canvas);
+ QToolTip::showText(globalPos + QPoint(5, 5), tr("Overflow Characters: %1 (%2 White Spaces)\nClick to link to existing text frame or auto-create new linked text frame").arg(hoveredItem->frameOverflowCount()).arg(hoveredItem->frameOverflowBlankCount()), m_canvas);
}
}
else
@@ -805,7 +807,7 @@
double newY = qRound(mousePointDoc.y());
m_mouseSavedPoint.setXY(newX, newY);
QPoint startP = m_canvas->canvasToGlobal(m_mousePressPoint);
- m_view->redrawMarker->setGeometry(QRect(m_view->mapFromGlobal(startP), m_view->mapFromGlobal(m->globalPos())).normalized());
+ m_view->redrawMarker->setGeometry(QRect(m_view->mapFromGlobal(startP), m_view->mapFromGlobal(globalPos)).normalized());
m_view->setRedrawMarkerShown(true);
m_view->HaveSelRect = true;
return;
@@ -816,7 +818,8 @@
void CanvasMode_Normal::mousePressEvent(QMouseEvent *m)
{
// qDebug("CanvasMode_Normal::mousePressEvent");
- const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
+ const QPoint globalPos = m->globalPosition().toPoint();
+ const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
PageItem *currItem;
m_objectDeltaPos = FPoint(0, 0);
@@ -828,7 +831,7 @@
m_doc->DragP = false;
m_doc->leaveDrag = false;
m->accept();
- m_view->registerMousePress(m->globalPos());
+ m_view->registerMousePress(m->globalPosition());
if (m->button() == Qt::MiddleButton)
{
@@ -909,7 +912,7 @@
if (m_doc->m_Selection->isEmpty())
{
m_mouseCurrentPoint = m_mousePressPoint = m_mouseSavedPoint = mousePointDoc;
- m_view->redrawMarker->setGeometry(m->globalPos().x(), m->globalPos().y(), 1, 1);
+ m_view->redrawMarker->setGeometry(globalPos.x(), globalPos.y(), 1, 1);
m_view->setRedrawMarkerShown(true);
}
else
@@ -962,8 +965,8 @@
#ifdef GESTURE_FRAME_PREVIEW
clearPixmapCache();
#endif // GESTURE_FRAME_PREVIEW
- const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
- PageItem *currItem;
+ const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
+ PageItem *currItem { nullptr };
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_canvas->resetRenderMode();
m->accept();
@@ -990,12 +993,12 @@
// link text frames
//<<#10116: Click on overflow icon to get into link frame mode
PageItem* clickedItem = nullptr;
- clickedItem = m_canvas->itemUnderCursor(m->globalPos(), clickedItem, m->modifiers());
+ clickedItem = m_canvas->itemUnderCursor(m->globalPosition(), clickedItem, m->modifiers());
if (clickedItem && clickedItem->isTextFrame() && (!clickedItem->isAnnotation()) && (!m_doc->drawAsPreview))
{
if (clickedItem->frameOverflows())
{
- if (m_canvas->cursorOverTextFrameControl(m->globalPos(), clickedItem))
+ if (m_canvas->cursorOverTextFrameControl(m->globalPosition(), clickedItem))
{
m_view->requestMode(modeLinkFrames);
return;
@@ -1261,7 +1264,7 @@
{
if (currItem->annotation().IsOpen())
{
- if (m_canvas->cursorOverFrameControl(m->globalPos(), QRectF(245, 20, 11, 11), currItem))
+ if (m_canvas->cursorOverFrameControl(m->globalPosition(), QRectF(245, 20, 11, 11), currItem))
{
currItem->annotation().setOpen(false);
currItem->asTextFrame()->setTextAnnotationOpen(false);
@@ -1557,7 +1560,7 @@
QTransform p;
PageItem *currItem;
m_canvas->m_viewMode.m_MouseButtonPressed = true;
- FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
+ FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPosition());
m_mouseCurrentPoint = mousePointDoc;
// double grabRadius = m_doc->guidesPrefs().grabRadius / m_canvas->scale();
int MxpS = static_cast<int>(mousePointDoc.x()); //m->x()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.x());
@@ -1581,7 +1584,7 @@
}
else
{
- PageItem* hoveredItem = m_canvas->itemUnderCursor(m->globalPos(), nullptr, m->modifiers());
+ PageItem* hoveredItem = m_canvas->itemUnderCursor(m->globalPosition(), nullptr, m->modifiers());
if (hoveredItem)
frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(), mousePointDoc.y()), hoveredItem);
}
@@ -1678,7 +1681,7 @@
m_view->deselectItems(false);
}
- currItem = m_canvas->itemUnderCursor(m->globalPos(), currItem, ((m->modifiers() & SELECT_IN_GROUP) || (m_doc->drawAsPreview && !m_doc->editOnPreview)));
+ currItem = m_canvas->itemUnderCursor(m->globalPosition(), currItem, ((m->modifiers() & SELECT_IN_GROUP) || (m_doc->drawAsPreview && !m_doc->editOnPreview)));
if (currItem)
{
m_doc->m_Selection->delaySignalsOn();
@@ -1750,7 +1753,7 @@
}
else
{
- PageItem* hoveredItem = m_canvas->itemUnderCursor(m->globalPos(), nullptr, m->modifiers());
+ PageItem* hoveredItem = m_canvas->itemUnderCursor(m->globalPosition(), nullptr, m->modifiers());
if (hoveredItem)
frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(), mousePointDoc.y()), hoveredItem);
}
Modified: trunk/Scribus/scribus/canvasmode_rotate.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/canvasmode_rotate.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_rotate.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_rotate.cpp Sat Mar 12 16:00:07 2022
@@ -431,7 +431,8 @@
if ((m_canvas->m_viewMode.m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton))
{
QPoint startP = m_canvas->canvasToGlobal(m_canvasPressCoord);
- m_view->redrawMarker->setGeometry(QRect(m_view->mapFromGlobal(startP), m_view->mapFromGlobal(m->globalPos())).normalized());
+ QPoint globalPos = m->globalPosition().toPoint();
+ m_view->redrawMarker->setGeometry(QRect(m_view->mapFromGlobal(startP), m_view->mapFromGlobal(globalPos)).normalized());
m_view->setRedrawMarkerShown(true);
m_view->HaveSelRect = true;
}
Modified: trunk/Scribus/scribus/chartableview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/chartableview.cpp
==============================================================================
--- trunk/Scribus/scribus/chartableview.cpp (original)
+++ trunk/Scribus/scribus/chartableview.cpp Sat Mar 12 16:00:07 2022
@@ -94,7 +94,7 @@
else
{
deleteAct->setData(index);
- actionMenu->popup(event->globalPos());
+ actionMenu->popup(event->globalPosition().toPoint());
}
}
}
Modified: trunk/Scribus/scribus/ui/hruler.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/ui/hruler.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/hruler.cpp (original)
+++ trunk/Scribus/scribus/ui/hruler.cpp Sat Mar 12 16:00:07 2022
@@ -202,7 +202,7 @@
{
qApp->setOverrideCursor(QCursor(Qt::SplitVCursor));
m_view->startGesture(rulerGesture);
- m_view->registerMousePress(m->globalPos());
+ m_view->registerMousePress(m->globalPosition());
}
}
}
Modified: trunk/Scribus/scribus/ui/rulermover.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/ui/rulermover.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/rulermover.cpp (original)
+++ trunk/Scribus/scribus/ui/rulermover.cpp Sat Mar 12 16:00:07 2022
@@ -41,7 +41,7 @@
#include "ui/guidemanager.h"
-RulerMover::RulerMover(ScribusView *pa) : QWidget(pa)
+RulerMover::RulerMover(ScribusView *pa) : QWidget(pa), m_currView(pa)
{
setBackgroundRole(QPalette::Window);
setAutoFillBackground(true);
@@ -49,45 +49,43 @@
palette.setBrush(QPalette::Window, QColor(240, 240, 240));
palette.setBrush(backgroundRole(), QBrush(IconManager::instance().loadPixmap("mover.png")));
setPalette(palette);
- currView = pa;
- rulerGesture = new RulerGesture(currView, RulerGesture::ORIGIN);
- Mpressed = false;
+ m_rulerGesture = new RulerGesture(m_currView, RulerGesture::ORIGIN);
}
void RulerMover::mouseDoubleClickEvent(QMouseEvent *)
{
- currView->m_doc->rulerXoffset = 0;
- currView->m_doc->rulerYoffset = 0;
- currView->DrawNew();
+ m_currView->m_doc->rulerXoffset = 0;
+ m_currView->m_doc->rulerYoffset = 0;
+ m_currView->DrawNew();
}
void RulerMover::mousePressEvent(QMouseEvent *m)
{
if (m->button() == Qt::LeftButton)
{
- Mpressed = true;
- qApp->setOverrideCursor(QCursor(Qt::CrossCursor));
- currView->startGesture(rulerGesture);
- currView->registerMousePress(m->globalPos());
+ m_mousePressed = true;
+ QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));
+ m_currView->startGesture(m_rulerGesture);
+ m_currView->registerMousePress(m->globalPosition());
}
QWidget::mousePressEvent(m);
}
void RulerMover::mouseReleaseEvent(QMouseEvent *m)
{
- qApp->restoreOverrideCursor();
- if (Mpressed)
+ QApplication::restoreOverrideCursor();
+ if (m_mousePressed)
{
- rulerGesture->mouseReleaseEvent(m);
- Mpressed = false;
+ m_rulerGesture->mouseReleaseEvent(m);
+ m_mousePressed = false;
}
else if (m->button() == Qt::RightButton)
{
QMenu *pmen = new QMenu();
QMenu *pmen2 = nullptr;
pmen->addAction( tr("Reset Rulers"), this, SLOT(resetRulers()));
- pmen->addAction(currView->m_doc->scMW()->scrActions["viewRulerMode"]);
- if (currView->m_doc->guidesPrefs().rulerMode)
+ pmen->addAction(m_currView->m_doc->scMW()->scrActions["viewRulerMode"]);
+ if (m_currView->m_doc->guidesPrefs().rulerMode)
{
pmen2 = new QMenu();
if (pmen2)
@@ -107,64 +105,64 @@
delete pmen;
delete pmen2;
}
- if (currView->m_doc->guidesPrefs().guidesShown)
- currView->m_doc->scMW()->guidePalette->setupPage();
+ if (m_currView->m_doc->guidesPrefs().guidesShown)
+ m_currView->m_doc->scMW()->guidePalette->setupPage();
QWidget::mouseReleaseEvent(m);
}
void RulerMover::mouseMoveEvent(QMouseEvent *m)
{
- if (Mpressed)
- rulerGesture->mouseMoveEvent(m);
+ if (m_mousePressed)
+ m_rulerGesture->mouseMoveEvent(m);
QWidget::mouseMoveEvent(m);
}
void RulerMover::resetRulers()
{
- currView->m_doc->rulerXoffset = 0;
- currView->m_doc->rulerYoffset = 0;
- currView->DrawNew();
+ m_currView->m_doc->rulerXoffset = 0;
+ m_currView->m_doc->rulerYoffset = 0;
+ m_currView->DrawNew();
}
void RulerMover::moveRulerTopRight()
{
- currView->m_doc->rulerXoffset = currView->m_doc->currentPage()->width();
- currView->m_doc->rulerYoffset = 0;
- currView->DrawNew();
+ m_currView->m_doc->rulerXoffset = m_currView->m_doc->currentPage()->width();
+ m_currView->m_doc->rulerYoffset = 0;
+ m_currView->DrawNew();
}
void RulerMover::moveRulerBottomLeft()
{
- currView->m_doc->rulerXoffset = 0;
- currView->m_doc->rulerYoffset = currView->m_doc->currentPage()->height();
- currView->DrawNew();
+ m_currView->m_doc->rulerXoffset = 0;
+ m_currView->m_doc->rulerYoffset = m_currView->m_doc->currentPage()->height();
+ m_currView->DrawNew();
}
void RulerMover::moveRulerBottomRight()
{
- currView->m_doc->rulerXoffset = currView->m_doc->currentPage()->width();
- currView->m_doc->rulerYoffset = currView->m_doc->currentPage()->height();
- currView->DrawNew();
+ m_currView->m_doc->rulerXoffset = m_currView->m_doc->currentPage()->width();
+ m_currView->m_doc->rulerYoffset = m_currView->m_doc->currentPage()->height();
+ m_currView->DrawNew();
}
void RulerMover::moveRulerCenter()
{
- currView->m_doc->rulerXoffset = currView->m_doc->currentPage()->width() / 2.0;
- currView->m_doc->rulerYoffset = currView->m_doc->currentPage()->height() / 2.0;
- currView->DrawNew();
+ m_currView->m_doc->rulerXoffset = m_currView->m_doc->currentPage()->width() / 2.0;
+ m_currView->m_doc->rulerYoffset = m_currView->m_doc->currentPage()->height() / 2.0;
+ m_currView->DrawNew();
}
void RulerMover::moveRulerTopCenter()
{
- currView->m_doc->rulerXoffset = currView->m_doc->currentPage()->width() / 2.0;
- currView->m_doc->rulerYoffset = 0;
- currView->DrawNew();
+ m_currView->m_doc->rulerXoffset = m_currView->m_doc->currentPage()->width() / 2.0;
+ m_currView->m_doc->rulerYoffset = 0;
+ m_currView->DrawNew();
}
void RulerMover::moveRulerBottomCenter()
{
- currView->m_doc->rulerXoffset = currView->m_doc->currentPage()->width() / 2.0;
- currView->m_doc->rulerYoffset = currView->m_doc->currentPage()->height();
- currView->DrawNew();
+ m_currView->m_doc->rulerXoffset = m_currView->m_doc->currentPage()->width() / 2.0;
+ m_currView->m_doc->rulerYoffset = m_currView->m_doc->currentPage()->height();
+ m_currView->DrawNew();
}
Modified: trunk/Scribus/scribus/ui/rulermover.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/ui/rulermover.h
==============================================================================
--- trunk/Scribus/scribus/ui/rulermover.h (original)
+++ trunk/Scribus/scribus/ui/rulermover.h Sat Mar 12 16:00:07 2022
@@ -38,11 +38,12 @@
public:
RulerMover(ScribusView *pa);
~RulerMover() {};
- void mouseDoubleClickEvent(QMouseEvent *);
- void mousePressEvent(QMouseEvent *m);
- void mouseReleaseEvent(QMouseEvent *m);
- void mouseMoveEvent(QMouseEvent *m);
- bool Mpressed;
+
+protected:
+ void mouseDoubleClickEvent(QMouseEvent*) override;
+ void mousePressEvent(QMouseEvent* m) override;
+ void mouseReleaseEvent(QMouseEvent* m) override;
+ void mouseMoveEvent(QMouseEvent* m) override;
private slots:
void resetRulers();
@@ -54,8 +55,9 @@
void moveRulerBottomCenter();
private: // Private attributes
- ScribusView *currView;
- RulerGesture* rulerGesture;
+ bool m_mousePressed { false };
+ ScribusView *m_currView { nullptr };
+ RulerGesture* m_rulerGesture { nullptr };
};
#endif
Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25019&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp (original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp Sat Mar 12 16:00:07 2022
@@ -139,7 +139,7 @@
void SideBar::mouseReleaseEvent(QMouseEvent *m)
{
- QPoint globalPos = m->globalPos();
+ QPoint globalPos = m->globalPosition().toPoint();
QPoint viewPos = m_editor->viewport()->mapFromGlobal(globalPos);
int p = m_editor->cursorForPosition(QPoint(2, viewPos.y())).position();
currentPar = m_editor->StyledText.nrOfParagraph(p);
More information about the scribus-commit
mailing list