diff --git a/examples/advplotstyling/README.md b/examples/advplotstyling/README.md index 5504a13e41..561004b223 100644 --- a/examples/advplotstyling/README.md +++ b/examples/advplotstyling/README.md @@ -38,7 +38,7 @@ In addition, a `JKQTPSpecialLineHorizontalGraph` is filled using an image `examp graphF->setSpecialLineType(JKQTPDirectLine); graphF->setDrawLine(true); graphF->setFillTexture(QPixmap(":/example.bmp")); - graphF->setFillTransform(QMatrix(0.5,0,0,0.5,0,0).rotate(45)); + graphF->setFillTransform(QTransform(0.5,0,0,0.5,0,0).rotate(45)); graphF->setFillCurve(true); graphF->setLineWidth(0.5); ``` diff --git a/examples/advplotstyling/advplotstyling.cpp b/examples/advplotstyling/advplotstyling.cpp index 69d737c56a..cb3b753609 100644 --- a/examples/advplotstyling/advplotstyling.cpp +++ b/examples/advplotstyling/advplotstyling.cpp @@ -90,7 +90,7 @@ int main(int argc, char* argv[]) graphF->setSpecialLineType(JKQTPDirectLine); graphF->setDrawLine(true); graphF->setFillTexture(QPixmap(":/example.bmp")); - graphF->setFillTransform(QMatrix(0.5,0,0,0.5,0,0).rotate(45)); + graphF->setFillTransform(QTransform(0.5,0,0,0.5,0,0).rotate(45)); graphF->setFillCurve(true); graphF->setLineWidth(0.5); diff --git a/lib/jkqtcommon/jkqtpdrawingtools.cpp b/lib/jkqtcommon/jkqtpdrawingtools.cpp index a7bb4482b0..88efa067ba 100644 --- a/lib/jkqtcommon/jkqtpdrawingtools.cpp +++ b/lib/jkqtcommon/jkqtpdrawingtools.cpp @@ -244,7 +244,7 @@ JKQTPGraphSymbols String2JKQTPGraphSymbols(const QString& pos) { QPolygonF jkqtpRotateRect(QRectF r, double angle) { QPolygonF p; - QMatrix m; + QTransform m; m.rotate(angle); p.append(m.map(r.bottomLeft())); p.append(m.map(r.bottomRight())); diff --git a/lib/jkqtfastplotter/jkqtfastplotter.cpp b/lib/jkqtfastplotter/jkqtfastplotter.cpp index 5dc9bf725b..e086518f99 100644 --- a/lib/jkqtfastplotter/jkqtfastplotter.cpp +++ b/lib/jkqtfastplotter/jkqtfastplotter.cpp @@ -29,7 +29,7 @@ #include #include #include - +#include /** * \brief saves the given property (for which also a default_property exists) into the given settings object @@ -1447,7 +1447,7 @@ void JKQTFPQScaleBarXPlot::drawGraph(QPainter& painter) { painter.drawLine(QLineF(xx1, yy1, xx2, yy2)); painter.setFont(font); QFontMetrics fm=painter.fontMetrics(); - painter.drawText(static_cast(xx1+(xx2-xx1)/2-fm.width(s)/2), static_cast(yy1+3*lineWidth+fm.ascent()), s); + painter.drawText(static_cast(xx1+(xx2-xx1)/2-fm.horizontalAdvance(s)/2), static_cast(yy1+3*lineWidth+fm.ascent()), s); } else if (position==JKQTFPQScaleBarXPlot::TopLeft) { yy1=parent->getInternalPlotBorderTop()+yDistance; yy2=yy1; @@ -1458,7 +1458,7 @@ void JKQTFPQScaleBarXPlot::drawGraph(QPainter& painter) { painter.drawLine(QLineF(xx1, yy1, xx2, yy2)); painter.setFont(font); QFontMetrics fm=painter.fontMetrics(); - painter.drawText(static_cast(xx1+(xx2-xx1)/2-fm.width(s)/2), static_cast(yy1+3*lineWidth+fm.ascent()), s); + painter.drawText(static_cast(xx1+(xx2-xx1)/2-fm.horizontalAdvance(s)/2), static_cast(yy1+3*lineWidth+fm.ascent()), s); } else if (position==JKQTFPQScaleBarXPlot::BottomLeft) { yy1=parent->getInternalPlotBorderTop()+parent->getPlotHeight()-yDistance; yy2=yy1; @@ -1469,7 +1469,7 @@ void JKQTFPQScaleBarXPlot::drawGraph(QPainter& painter) { painter.drawLine(QLineF(xx1, yy1, xx2, yy2)); painter.setFont(font); QFontMetrics fm=painter.fontMetrics(); - painter.drawText(static_cast(xx1+(xx2-xx1)/2-fm.width(s)/2), static_cast(yy1-3*lineWidth-fm.descent()), s); + painter.drawText(static_cast(xx1+(xx2-xx1)/2-fm.horizontalAdvance(s)/2), static_cast(yy1-3*lineWidth-fm.descent()), s); } else if (position==JKQTFPQScaleBarXPlot::BottomRight) { yy1=parent->getInternalPlotBorderTop()+parent->getPlotHeight()-yDistance; yy2=yy1; @@ -1480,7 +1480,7 @@ void JKQTFPQScaleBarXPlot::drawGraph(QPainter& painter) { painter.drawLine(QLineF(xx1, yy1, xx2, yy2)); painter.setFont(font); QFontMetrics fm=painter.fontMetrics(); - painter.drawText(static_cast(xx1+(xx2-xx1)/2-fm.width(s)/2), static_cast(yy1-3*lineWidth-fm.descent()), s); + painter.drawText(static_cast(xx1+(xx2-xx1)/2-fm.horizontalAdvance(s)/2), static_cast(yy1-3*lineWidth-fm.descent()), s); } diff --git a/lib/jkqtmathtext/jkqtmathtext.cpp b/lib/jkqtmathtext/jkqtmathtext.cpp index 9510496f40..cfbafa35a8 100644 --- a/lib/jkqtmathtext/jkqtmathtext.cpp +++ b/lib/jkqtmathtext/jkqtmathtext.cpp @@ -28,6 +28,7 @@ #include #include #include +#include const double JKQTMathText::ABS_MIN_LINEWIDTH=0.02; diff --git a/lib/jkqtplotter/graphs/jkqtpgeometric.cpp b/lib/jkqtplotter/graphs/jkqtpgeometric.cpp index 926d3524bd..972caead83 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeometric.cpp +++ b/lib/jkqtplotter/graphs/jkqtpgeometric.cpp @@ -733,8 +733,8 @@ JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTPlotter *parent, QPointF bottomleft, QP this->y=bottomleft.y()+this->height/2.0; } -QMatrix JKQTPGeoRectangle::getMatrix() { - QMatrix trans; +QTransform JKQTPGeoRectangle::getTransform() { + QTransform trans; trans.rotate(angle); return trans; } @@ -765,7 +765,7 @@ bool JKQTPGeoRectangle::getYMinMax(double& miny, double& maxy, double& smallestG } QPolygonF JKQTPGeoRectangle::getPolygon() { - QMatrix m=getMatrix(); + QTransform m=getTransform(); QPolygonF rect; rect.append(m.map(QPointF(0-width/2.0, 0-height/2.0))); rect.append(m.map(QPointF(0-width/2.0, 0+height/2.0))); diff --git a/lib/jkqtplotter/graphs/jkqtpgeometric.h b/lib/jkqtplotter/graphs/jkqtpgeometric.h index 7f380d8ded..131513399a 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeometric.h +++ b/lib/jkqtplotter/graphs/jkqtpgeometric.h @@ -679,7 +679,7 @@ protected: /** \brief rotation angle of rectangle [degrees] around (x,y) */ double angle; /** \brief returns the transformation matrix used for this rectangle */ - QMatrix getMatrix(); + QTransform getTransform(); /** \brief returns a QPolygonF which represents the rectangle after rotation, but still in the world coordinate system, not in the screen/widget system */ QPolygonF getPolygon(); }; @@ -974,7 +974,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoArc: public JKQTPGeoBaseLine { /** \brief closing mode for arcs: secand or pie */ /** \brief returns the transformation matrix used for this rectangle */ - QMatrix getMatrix(); + QTransform getTransform(); /** \brief returns a QPolygonF which represents the rectangle after rotation, but still in the world coordinate system, not in the screen/widget system */ QPolygonF getPolygon(); diff --git a/lib/jkqtplotter/graphs/jkqtpimagergb.cpp b/lib/jkqtplotter/graphs/jkqtpimagergb.cpp index 2eea70849f..9cc191cbf5 100644 --- a/lib/jkqtplotter/graphs/jkqtpimagergb.cpp +++ b/lib/jkqtplotter/graphs/jkqtpimagergb.cpp @@ -449,7 +449,7 @@ void JKQTPRGBMathImage::drawOutside(JKQTPEnhancedPainter& painter, QRect /*leftS QRectF cb(tX, tY, gbarWidth, parent->pt2px(painter, colorBarWidth)); - QMatrix mt; + QTransform mt; mt.rotate(90); painter.drawImage(cb, l[li].paletteImage.transformed(mt)); QPen p=painter.pen(); diff --git a/lib/jkqtplotter/jkqtpgraphsbaseerrors.cpp b/lib/jkqtplotter/jkqtpgraphsbaseerrors.cpp index 8c8ff2cffc..2f95573a5e 100644 --- a/lib/jkqtplotter/jkqtpgraphsbaseerrors.cpp +++ b/lib/jkqtplotter/jkqtpgraphsbaseerrors.cpp @@ -254,11 +254,6 @@ void JKQTPGraphErrorStyleMixin::setErrorFillBrush(const QBrush &b) m_errorFillColor=b.color(); } -void JKQTPGraphErrorStyleMixin::setErrorFillTransform(const QMatrix &b) -{ - m_errorFillBrush.setMatrix(b); -} - void JKQTPGraphErrorStyleMixin::setErrorFillTransform(const QTransform &b) { m_errorFillBrush.setTransform(b); diff --git a/lib/jkqtplotter/jkqtpgraphsbaseerrors.h b/lib/jkqtplotter/jkqtpgraphsbaseerrors.h index 7fa216d370..81b68dd777 100644 --- a/lib/jkqtplotter/jkqtpgraphsbaseerrors.h +++ b/lib/jkqtplotter/jkqtpgraphsbaseerrors.h @@ -146,8 +146,6 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphErrorStyleMixin { /** \brief sets an error indicator fill brush (overwrites all internal properties!) */ void setErrorFillBrush(const QBrush& b); - /** \brief sets an error indicator fill transformation matrix*/ - void setErrorFillTransform(const QMatrix& b); /** \brief sets an error indicator fill transformation */ void setErrorFillTransform(const QTransform& b); diff --git a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp index dbadf7ab92..6e98bf4693 100644 --- a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp +++ b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp @@ -364,10 +364,6 @@ void JKQTPGraphFillStyleMixin::setFillBrush(const QBrush &b) m_fillColor=b.color(); } -void JKQTPGraphFillStyleMixin::setFillTransform(const QMatrix &b) -{ - m_fillBrush.setMatrix(b); -} void JKQTPGraphFillStyleMixin::setFillTransform(const QTransform &b) { diff --git a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h index 24da022c33..2bd5be012e 100644 --- a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h +++ b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h @@ -313,8 +313,6 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphFillStyleMixin { /** \brief sets a fill brush (overwrites all internal properties!) */ void setFillBrush(const QBrush& b); - /** \brief sets a fill transformation matrix*/ - void setFillTransform(const QMatrix& b); /** \brief sets a fill transformation */ void setFillTransform(const QTransform& b); diff --git a/lib/jkqtplotter/jkqtpimagetools.cpp b/lib/jkqtplotter/jkqtpimagetools.cpp index 3b40ad3cdb..1f7208e6a8 100644 --- a/lib/jkqtplotter/jkqtpimagetools.cpp +++ b/lib/jkqtplotter/jkqtpimagetools.cpp @@ -199,7 +199,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa QRect cb(topSpace.x()+(topSpace.width()-barWidth)/2, static_cast(topSpace.bottom()-cbParent->pt2px(painter, colorBarOffset+(colorBarWidth))), barWidth, static_cast(cbParent->pt2px(painter, colorBarWidth))); //qDebug()<<"t: "<pt2px(painter, colorBarOffset+((modifierMode==JKQTPMathImageModifierMode::ModifyNone)?colorBarWidth:colorBarModifiedWidth)), barWidth, cbParent->pt2px(painter, (modifierMode==JKQTPMathImageModifierMode::ModifyNone)?colorBarWidth:colorBarModifiedWidth)); //qDebug()<<"t: "<modifiers()<<"):ZoomByWheel"; - double factor=pow(2.0, 1.0*static_cast(event->delta())/120.0)*2.0; + const double factor=pow(2.0, 1.0*static_cast(event->angleDelta().y())/120.0)*2.0; double xmin=plotter->p2x(static_cast(event->x())/magnification-static_cast(plotter->getPlotWidth())/factor); double xmax=plotter->p2x(static_cast(event->x())/magnification+static_cast(plotter->getPlotWidth())/factor); double ymin=plotter->p2y(static_cast(event->y())/magnification-static_cast(getPlotYOffset())+static_cast(plotter->getPlotHeight())/factor);