r24847 by jghali - Qt6: Build fixes

scribus-commit scribus-commit at lists.scribus.net
Sun Jan 30 00:27:32 UTC 2022


Author: jghali
Date: Sun Jan 30 00:27:32 2022
New Revision: 24847

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24847
Log:
Qt6: Build fixes

Modified:
    trunk/Scribus/scribus/canvas.cpp
    trunk/Scribus/scribus/canvas.h
    trunk/Scribus/scribus/canvasgesture_linemove.cpp
    trunk/Scribus/scribus/ui/hruler.cpp
    trunk/Scribus/scribus/ui/hruler.h
    trunk/Scribus/scribus/ui/vruler.h

Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24847&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp	(original)
+++ trunk/Scribus/scribus/canvas.cpp	Sun Jan 30 00:27:32 2022
@@ -159,13 +159,17 @@
 }
 */
 
-
 QPoint Canvas::canvasToLocal(const FPoint& p) const
 {
 	return { qRound((p.x() - m_doc->minCanvasCoordinate.x()) * m_viewMode.scale),
 	         qRound((p.y() - m_doc->minCanvasCoordinate.y()) * m_viewMode.scale) };
 }
 
+QPointF Canvas::canvasToLocalF(const FPoint& p) const
+{
+	return { ((p.x() - m_doc->minCanvasCoordinate.x()) * m_viewMode.scale),
+			 ((p.y() - m_doc->minCanvasCoordinate.y()) * m_viewMode.scale) };
+}
 
 QPoint Canvas::canvasToLocal(QPointF p) const
 {
@@ -173,6 +177,11 @@
 	         qRound((p.y() - m_doc->minCanvasCoordinate.y()) * m_viewMode.scale) };
 }
 
+QPointF Canvas::canvasToLocalF(QPointF p) const
+{
+	return { ((p.x() - m_doc->minCanvasCoordinate.x()) * m_viewMode.scale),
+			 ((p.y() - m_doc->minCanvasCoordinate.y()) * m_viewMode.scale) };
+}
 
 QRect Canvas::canvasToLocal(const QRectF& p) const
 {
@@ -217,7 +226,7 @@
 
 FPoint Canvas::globalToCanvas(QPointF p) const
 {
-	return localToCanvas(p - mapToGlobal(QPoint(0, 0)));
+	return localToCanvas(p.toPoint() - (mapToParent(QPoint(0, 0)) + parentWidget()->mapToGlobal(QPoint(0, 0))));
 }
 
 QRectF Canvas::globalToCanvas(QRect p) const
@@ -248,11 +257,26 @@
 	return qAbs(localPoint1.x() - localPoint2.x()) < radius && qAbs(localPoint1.y() - localPoint2.y()) < radius;
 }
 
+bool Canvas::hitsCanvasPoint(QPointF globalPoint, const FPoint& canvasPoint) const
+{
+	QPointF localPoint1 = globalPoint - (mapToParent(QPointF(0, 0)) + parentWidget()->mapToGlobal(QPointF(0, 0)));
+	QPointF localPoint2 = canvasToLocalF(canvasPoint);
+	int radius = m_doc->guidesPrefs().grabRadius;
+	return qAbs(localPoint1.x() - localPoint2.x()) < radius && qAbs(localPoint1.y() - localPoint2.y()) < radius;
+}
 
 bool Canvas::hitsCanvasPoint(QPoint globalPoint, QPointF canvasPoint) const
 {
 	QPoint localPoint1 = globalPoint - (mapToParent(QPoint(0,0)) + parentWidget()->mapToGlobal(QPoint(0, 0)));
 	QPoint localPoint2 = canvasToLocal(canvasPoint);
+	int radius = m_doc->guidesPrefs().grabRadius;
+	return qAbs(localPoint1.x() - localPoint2.x()) < radius && qAbs(localPoint1.y() - localPoint2.y()) < radius;
+}
+
+bool Canvas::hitsCanvasPoint(QPointF globalPoint, QPointF canvasPoint) const
+{
+	QPointF localPoint1 = globalPoint - (mapToParent(QPointF(0, 0)) + parentWidget()->mapToGlobal(QPointF(0, 0)));
+	QPointF localPoint2 = canvasToLocalF(canvasPoint);
 	int radius = m_doc->guidesPrefs().grabRadius;
 	return qAbs(localPoint1.x() - localPoint2.x()) < radius && qAbs(localPoint1.y() - localPoint2.y()) < radius;
 }

Modified: trunk/Scribus/scribus/canvas.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24847&path=/trunk/Scribus/scribus/canvas.h
==============================================================================
--- trunk/Scribus/scribus/canvas.h	(original)
+++ trunk/Scribus/scribus/canvas.h	Sun Jan 30 00:27:32 2022
@@ -144,9 +144,12 @@
 
 	double scale() const { return m_viewMode.scale; }
 	void setScale(double scale);
+
 	QPoint canvasToLocal(const FPoint& p) const;
+	QPointF canvasToLocalF(const FPoint& p) const;
 	QPoint canvasToGlobal(const FPoint& p) const;
 	QPoint canvasToLocal(QPointF p) const;
+	QPointF canvasToLocalF(QPointF p) const;
 	QPoint canvasToGlobal(QPointF p) const;
 	QRect canvasToLocal(const QRectF& p) const;
 	QRectF canvasToLocalF(const QRectF& p) const;
@@ -158,7 +161,9 @@
 	QRectF globalToCanvas(QRect p) const;
 //	QRectF globalToCanvas(QRectF p) const;
 	bool hitsCanvasPoint(QPoint globalPoint, const FPoint& canvasPoint) const;
+	bool hitsCanvasPoint(QPointF globalPoint, const FPoint& canvasPoint) const;
 	bool hitsCanvasPoint(QPoint globalPoint, QPointF canvasPoint) const;
+	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);

Modified: trunk/Scribus/scribus/canvasgesture_linemove.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24847&path=/trunk/Scribus/scribus/canvasgesture_linemove.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_linemove.cpp	(original)
+++ trunk/Scribus/scribus/canvasgesture_linemove.cpp	Sun Jan 30 00:27:32 2022
@@ -167,7 +167,7 @@
 		double angle = rotation();
 		if (angle > 0)
 			angle = 360 - angle;
-		m_canvas->displaySizeHUD(m->globalPosition(), length(), fabs(angle), true);
+		m_canvas->displaySizeHUD(m->globalPosition().toPoint(), length(), fabs(angle), true);
 	}
 	m->accept();
 	m_canvas->repaint();

Modified: trunk/Scribus/scribus/ui/hruler.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24847&path=/trunk/Scribus/scribus/ui/hruler.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/hruler.cpp	(original)
+++ trunk/Scribus/scribus/ui/hruler.cpp	Sun Jan 30 00:27:32 2022
@@ -296,7 +296,7 @@
 	qApp->restoreOverrideCursor();
 }
 
-void Hruler::enterEvent(QEvent* e)
+void Hruler::enterEvent(QEnterEvent* e)
 {
 	if (m_textEditMode)
 		qApp->changeOverrideCursor(IconManager::instance().loadCursor("tab.png", 3));

Modified: trunk/Scribus/scribus/ui/hruler.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24847&path=/trunk/Scribus/scribus/ui/hruler.h
==============================================================================
--- trunk/Scribus/scribus/ui/hruler.h	(original)
+++ trunk/Scribus/scribus/ui/hruler.h	Sun Jan 30 00:27:32 2022
@@ -79,12 +79,12 @@
 private:
 	int findRulerHandle(QPoint mp, double grabRadius);
 	
-	virtual void paintEvent(QPaintEvent *e);
-	virtual void mousePressEvent(QMouseEvent *m);
-	virtual void mouseReleaseEvent(QMouseEvent *);
-	virtual void mouseMoveEvent(QMouseEvent *m);
-	virtual void enterEvent(QEnterEvent *m);
-	virtual void leaveEvent(QEvent *m);
+	void paintEvent(QPaintEvent *e) override;
+	void mousePressEvent(QMouseEvent *m) override;
+	void mouseReleaseEvent(QMouseEvent *) override;
+	void mouseMoveEvent(QMouseEvent *m) override;
+	void enterEvent(QEnterEvent *m) override;
+	void leaveEvent(QEvent *m) override;
 
 	void drawMarks(QPainter& p);
 	void drawTextMarks(double pos, double endPos, QPainter& p);

Modified: trunk/Scribus/scribus/ui/vruler.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24847&path=/trunk/Scribus/scribus/ui/vruler.h
==============================================================================
--- trunk/Scribus/scribus/ui/vruler.h	(original)
+++ trunk/Scribus/scribus/ui/vruler.h	Sun Jan 30 00:27:32 2022
@@ -58,10 +58,10 @@
 	void unitChange();
 
 private:
-	virtual void paintEvent(QPaintEvent *e);
-	virtual void mousePressEvent(QMouseEvent *m);
-	virtual void mouseReleaseEvent(QMouseEvent *m);
-	virtual void mouseMoveEvent(QMouseEvent *m);
+	void paintEvent(QPaintEvent *e) override;
+	void mousePressEvent(QMouseEvent *m) override;
+	void mouseReleaseEvent(QMouseEvent *m) override;
+	void mouseMoveEvent(QMouseEvent *m) override;
 	void drawNumber(const QString& num, int starty, QPainter *p);
 
 	RulerGesture* rulerGesture {nullptr};




More information about the scribus-commit mailing list