mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
fix for issue #45:
- for Qt 5.15: added missing #include statements that became necessary since Qt 5.15 - for Qt 5.15: fixed use of several deprecated functions - for Qt 5.15/6: removed usage of QMatrix
This commit is contained in:
parent
35965b2e09
commit
7e9bad29b4
@ -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);
|
||||
```
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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()));
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
|
||||
#include <QPainterPath>
|
||||
|
||||
/**
|
||||
* \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<int>(xx1+(xx2-xx1)/2-fm.width(s)/2), static_cast<int>(yy1+3*lineWidth+fm.ascent()), s);
|
||||
painter.drawText(static_cast<int>(xx1+(xx2-xx1)/2-fm.horizontalAdvance(s)/2), static_cast<int>(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<int>(xx1+(xx2-xx1)/2-fm.width(s)/2), static_cast<int>(yy1+3*lineWidth+fm.ascent()), s);
|
||||
painter.drawText(static_cast<int>(xx1+(xx2-xx1)/2-fm.horizontalAdvance(s)/2), static_cast<int>(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<int>(xx1+(xx2-xx1)/2-fm.width(s)/2), static_cast<int>(yy1-3*lineWidth-fm.descent()), s);
|
||||
painter.drawText(static_cast<int>(xx1+(xx2-xx1)/2-fm.horizontalAdvance(s)/2), static_cast<int>(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<int>(xx1+(xx2-xx1)/2-fm.width(s)/2), static_cast<int>(yy1-3*lineWidth-fm.descent()), s);
|
||||
painter.drawText(static_cast<int>(xx1+(xx2-xx1)/2-fm.horizontalAdvance(s)/2), static_cast<int>(yy1-3*lineWidth-fm.descent()), s);
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <QFontDatabase>
|
||||
#include <typeinfo>
|
||||
#include <QApplication>
|
||||
#include <QPainterPath>
|
||||
|
||||
const double JKQTMathText::ABS_MIN_LINEWIDTH=0.02;
|
||||
|
||||
|
@ -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)));
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
@ -199,7 +199,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
|
||||
|
||||
QRect cb(topSpace.x()+(topSpace.width()-barWidth)/2, static_cast<int>(topSpace.bottom()-cbParent->pt2px(painter, colorBarOffset+(colorBarWidth))), barWidth, static_cast<int>(cbParent->pt2px(painter, colorBarWidth)));
|
||||
//qDebug()<<"t: "<<imageName<<topSpace<<topSpace.bottom()<<colorBarOffset<<"\n "<<cb;
|
||||
QMatrix rm;
|
||||
QTransform rm;
|
||||
rm.rotate(90);
|
||||
painter.drawImage(cb, b.transformed(rm));
|
||||
QPen p=painter.pen();
|
||||
@ -699,7 +699,7 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
|
||||
|
||||
QRect cb(topSpace.x()+(topSpace.width()-barWidth)/2, topSpace.bottom()-cbParent->pt2px(painter, colorBarOffset+((modifierMode==JKQTPMathImageModifierMode::ModifyNone)?colorBarWidth:colorBarModifiedWidth)), barWidth, cbParent->pt2px(painter, (modifierMode==JKQTPMathImageModifierMode::ModifyNone)?colorBarWidth:colorBarModifiedWidth));
|
||||
//qDebug()<<"t: "<<imageName<<topSpace<<topSpace.bottom()<<colorBarOffset<<"\n "<<cb;
|
||||
QMatrix rm;
|
||||
QTransform rm;
|
||||
rm.rotate(90);
|
||||
painter.drawImage(cb, b.transformed(rm));
|
||||
QPen p=painter.pen();
|
||||
|
@ -936,7 +936,7 @@ void JKQTPlotter::wheelEvent ( QWheelEvent * event ) {
|
||||
if (itAction.value()==JKQTPMouseWheelActions::jkqtpmwaZoomByWheel) {
|
||||
//if (act==JKQTPMouseWheelActions::jkqtpmwaZoomByWheel) {
|
||||
//qDebug()<<"wheelEvent("<<event->modifiers()<<"):ZoomByWheel";
|
||||
double factor=pow(2.0, 1.0*static_cast<double>(event->delta())/120.0)*2.0;
|
||||
const double factor=pow(2.0, 1.0*static_cast<double>(event->angleDelta().y())/120.0)*2.0;
|
||||
double xmin=plotter->p2x(static_cast<double>(event->x())/magnification-static_cast<double>(plotter->getPlotWidth())/factor);
|
||||
double xmax=plotter->p2x(static_cast<double>(event->x())/magnification+static_cast<double>(plotter->getPlotWidth())/factor);
|
||||
double ymin=plotter->p2y(static_cast<double>(event->y())/magnification-static_cast<double>(getPlotYOffset())+static_cast<double>(plotter->getPlotHeight())/factor);
|
||||
|
Loading…
Reference in New Issue
Block a user