got rid of deprecated warnings when compiling with Qt6

This commit is contained in:
jkriege2 2022-06-02 21:44:58 +02:00
parent 4031e9a54e
commit fd2ae94c6c
2 changed files with 59 additions and 59 deletions

View File

@ -215,8 +215,8 @@ void JKQTFastPlotter::copyImage()
void JKQTFastPlotter::mouseDoubleClickEvent ( QMouseEvent * event ) { void JKQTFastPlotter::mouseDoubleClickEvent ( QMouseEvent * event ) {
if (event->button()==Qt::LeftButton) { if (event->button()==Qt::LeftButton) {
double x=p2x(event->x()); double x=p2x(event->pos().x());
double y=p2y(event->y()); double y=p2y(event->pos().y());
emit doubleClicked(x, y); emit doubleClicked(x, y);
emit doubleClicked(x, y, event->modifiers()); emit doubleClicked(x, y, event->modifiers());
event->accept(); event->accept();
@ -224,8 +224,8 @@ void JKQTFastPlotter::mouseDoubleClickEvent ( QMouseEvent * event ) {
} }
void JKQTFastPlotter::mouseMoveEvent ( QMouseEvent * event ) { void JKQTFastPlotter::mouseMoveEvent ( QMouseEvent * event ) {
double x=p2x(event->x()); double x=p2x(event->pos().x());
double y=p2y(event->y()); double y=p2y(event->pos().y());
emit mouseMoved(x, y); emit mouseMoved(x, y);
//qDebug()<<"JKQTFastPlotter::mouseMoveEvent "<<x<<y; //qDebug()<<"JKQTFastPlotter::mouseMoveEvent "<<x<<y;
if (event->buttons()&Qt::LeftButton) { if (event->buttons()&Qt::LeftButton) {
@ -242,8 +242,8 @@ void JKQTFastPlotter::mouseMoveEvent ( QMouseEvent * event ) {
void JKQTFastPlotter::mousePressEvent ( QMouseEvent * event ) { void JKQTFastPlotter::mousePressEvent ( QMouseEvent * event ) {
if (event->button()==Qt::LeftButton) { if (event->button()==Qt::LeftButton) {
double x=p2x(event->x()); double x=p2x(event->pos().x());
double y=p2y(event->y()); double y=p2y(event->pos().y());
emit clicked(x, y); emit clicked(x, y);
emit clicked(x, y, event->modifiers()); emit clicked(x, y, event->modifiers());
mouseDragStart=event->pos(); mouseDragStart=event->pos();
@ -256,8 +256,8 @@ void JKQTFastPlotter::mouseReleaseEvent(QMouseEvent *event)
if (event->button()==Qt::LeftButton) { if (event->button()==Qt::LeftButton) {
double xd=p2x(mouseDragStart.x()); double xd=p2x(mouseDragStart.x());
double yd=p2y(mouseDragStart.y()); double yd=p2y(mouseDragStart.y());
double x=p2x(event->x()); double x=p2x(event->pos().x());
double y=p2y(event->y()); double y=p2y(event->pos().y());
emit mouseDragged(xd, yd, x, y, event->modifiers()); emit mouseDragged(xd, yd, x, y, event->modifiers());
emit mouseDragFinished(xd, yd, x, y, event->modifiers()); emit mouseDragFinished(xd, yd, x, y, event->modifiers());
dragging=false; dragging=false;

View File

@ -710,14 +710,14 @@ void JKQTPlotter::paintUserAction() {
void JKQTPlotter::mouseMoveEvent ( QMouseEvent * event ) { void JKQTPlotter::mouseMoveEvent ( QMouseEvent * event ) {
if (plotterStyle.displayMousePosition) { if (plotterStyle.displayMousePosition) {
mousePosX=plotter->p2x(event->x()/magnification); mousePosX=plotter->p2x(event->pos().x()/magnification);
mousePosY=plotter->p2y((event->y()-getPlotYOffset())/magnification); mousePosY=plotter->p2y((event->pos().y()-getPlotYOffset())/magnification);
update(); update();
} }
if (plotterStyle.toolbarEnabled && (!plotterStyle.toolbarAlwaysOn) && (!toolbar->isVisible())) { // decide whether to display toolbar if (plotterStyle.toolbarEnabled && (!plotterStyle.toolbarAlwaysOn) && (!toolbar->isVisible())) { // decide whether to display toolbar
int y1=10; int y1=10;
if (event->y()/magnification>=0 && event->y()/magnification<=y1) { if (event->pos().y()/magnification>=0 && event->pos().y()/magnification<=y1) {
toolbar->show(); toolbar->show();
toolbar->move(1,1); toolbar->move(1,1);
} }
@ -746,10 +746,10 @@ void JKQTPlotter::mouseMoveEvent ( QMouseEvent * event ) {
mouseDragRectXStartPixel=mouseDragRectXEndPixel; mouseDragRectXStartPixel=mouseDragRectXEndPixel;
mouseDragRectYStartPixel=mouseDragRectYEndPixel; mouseDragRectYStartPixel=mouseDragRectYEndPixel;
} }
mouseDragRectXEnd=plotter->p2x(event->x()/magnification); mouseDragRectXEnd=plotter->p2x(event->pos().x()/magnification);
mouseDragRectYEnd=plotter->p2y((event->y()-getPlotYOffset())/magnification); mouseDragRectYEnd=plotter->p2y((event->pos().y()-getPlotYOffset())/magnification);
mouseDragRectXEndPixel=event->x(); mouseDragRectXEndPixel=event->pos().x();
mouseDragRectYEndPixel=event->y(); mouseDragRectYEndPixel=event->pos().y();
if (currentMouseDragAction.mode==jkqtpmdaToolTipForClosestDataPoint) { if (currentMouseDragAction.mode==jkqtpmdaToolTipForClosestDataPoint) {
@ -799,20 +799,20 @@ void JKQTPlotter::mouseMoveEvent ( QMouseEvent * event ) {
// we found a matching action // we found a matching action
currentMouseMoveAction.insert(actionIT.value()); currentMouseMoveAction.insert(actionIT.value());
if(actionIT.value()==jkqtpmmaToolTipForClosestDataPoint){ if(actionIT.value()==jkqtpmmaToolTipForClosestDataPoint){
mouseDragRectXStart=plotter->p2x(event->x()/magnification); mouseDragRectXStart=plotter->p2x(event->pos().x()/magnification);
mouseDragRectYStart=plotter->p2y((event->y()-getPlotYOffset())/magnification); mouseDragRectYStart=plotter->p2y((event->pos().y()-getPlotYOffset())/magnification);
mouseDragRectXStartPixel=event->x(); mouseDragRectXStartPixel=event->pos().x();
mouseDragRectYStartPixel=event->y(); mouseDragRectYStartPixel=event->pos().y();
fillInternalStructForToolTipOfClosestDataPoint(plotter->p2x(event->x()/magnification), plotter->p2y((event->y()-getPlotYOffset())/magnification)); fillInternalStructForToolTipOfClosestDataPoint(plotter->p2x(event->pos().x()/magnification), plotter->p2y((event->pos().y()-getPlotYOffset())/magnification));
} }
paintUserAction(); paintUserAction();
} }
} }
// emit move signal, if event occured inside plot only // emit move signal, if event occured inside plot only
if ( (event->x()/magnification>=plotter->getInternalPlotBorderLeft()) && (event->x()/magnification<=plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) && if ( (event->pos().x()/magnification>=plotter->getInternalPlotBorderLeft()) && (event->pos().x()/magnification<=plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) &&
((event->y()-getPlotYOffset())/magnification>=plotter->getInternalPlotBorderTop()) && ((event->y()-getPlotYOffset())/magnification<=plotter->getPlotHeight()+plotter->getInternalPlotBorderTop()) ) { ((event->pos().y()-getPlotYOffset())/magnification>=plotter->getInternalPlotBorderTop()) && ((event->pos().y()-getPlotYOffset())/magnification<=plotter->getPlotHeight()+plotter->getInternalPlotBorderTop()) ) {
emit plotMouseMove(plotter->p2x(event->x()/magnification), plotter->p2y((event->y()-getPlotYOffset())/magnification)); emit plotMouseMove(plotter->p2x(event->pos().x()/magnification), plotter->p2y((event->pos().y()-getPlotYOffset())/magnification));
} }
updateCursor(); updateCursor();
} }
@ -827,28 +827,28 @@ void JKQTPlotter::mousePressEvent ( QMouseEvent * event ){
auto actionIT=findMatchingMouseDragAction(event->button(), event->modifiers(), &foundIT); auto actionIT=findMatchingMouseDragAction(event->button(), event->modifiers(), &foundIT);
if (foundIT) { if (foundIT) {
// we found a matching action // we found a matching action
mouseLastClickX=event->x(); mouseLastClickX=event->pos().x();
mouseLastClickY=event->y(); mouseLastClickY=event->pos().y();
mouseDragRectXStart=plotter->p2x(event->x()/magnification); mouseDragRectXStart=plotter->p2x(event->pos().x()/magnification);
mouseDragRectYStart=plotter->p2y((event->y()-getPlotYOffset())/magnification); mouseDragRectYStart=plotter->p2y((event->pos().y()-getPlotYOffset())/magnification);
mouseDragRectXEndPixel=mouseDragRectXStartPixel=event->x(); mouseDragRectXEndPixel=mouseDragRectXStartPixel=event->pos().x();
mouseDragRectYEndPixel=mouseDragRectYStartPixel=event->y(); mouseDragRectYEndPixel=mouseDragRectYStartPixel=event->pos().y();
currentMouseDragAction=MouseDragAction(actionIT.key().first, actionIT.key().second, actionIT.value()); currentMouseDragAction=MouseDragAction(actionIT.key().first, actionIT.key().second, actionIT.value());
mouseDragingRectangle=true; mouseDragingRectangle=true;
oldImage=image; oldImage=image;
if (currentMouseDragAction.mode==jkqtpmdaScribbleForEvents) emit userScribbleClick(mouseDragRectXStart, mouseDragRectYStart, event->modifiers(), true, false); if (currentMouseDragAction.mode==jkqtpmdaScribbleForEvents) emit userScribbleClick(mouseDragRectXStart, mouseDragRectYStart, event->modifiers(), true, false);
event->accept(); event->accept();
} else if (event->button()==Qt::RightButton && event->modifiers()==Qt::NoModifier && contextMenuMode!=jkqtpcmmNoContextMenu) { } else if (event->button()==Qt::RightButton && event->modifiers()==Qt::NoModifier && contextMenuMode!=jkqtpcmmNoContextMenu) {
mouseLastClickX=event->x(); mouseLastClickX=event->pos().x();
mouseLastClickY=event->y(); mouseLastClickY=event->pos().y();
openContextMenu(event->x(), event->y()); openContextMenu(event->pos().x(), event->pos().y());
event->accept(); event->accept();
} }
// emit clicked signal, if event occured inside plot only // emit clicked signal, if event occured inside plot only
if ( (event->x()/magnification>=plotter->getInternalPlotBorderLeft()) && (event->x()/magnification<=plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) && if ( (event->pos().x()/magnification>=plotter->getInternalPlotBorderLeft()) && (event->pos().x()/magnification<=plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) &&
((event->y()-getPlotYOffset())/magnification>=plotter->getInternalPlotBorderTop()) && ((event->y()-getPlotYOffset())/magnification<=plotter->getPlotHeight()+plotter->getInternalPlotBorderTop()) ) { ((event->pos().y()-getPlotYOffset())/magnification>=plotter->getInternalPlotBorderTop()) && ((event->pos().y()-getPlotYOffset())/magnification<=plotter->getPlotHeight()+plotter->getInternalPlotBorderTop()) ) {
emit plotMouseClicked(plotter->p2x(event->x()/magnification), plotter->p2y((event->y()-getPlotYOffset())/magnification), event->modifiers(), event->button()); emit plotMouseClicked(plotter->p2x(event->pos().x()/magnification), plotter->p2y((event->pos().y()-getPlotYOffset())/magnification), event->modifiers(), event->button());
event->accept(); event->accept();
} }
updateCursor(); updateCursor();
@ -863,10 +863,10 @@ void JKQTPlotter::mouseReleaseEvent ( QMouseEvent * event ){
return; return;
} }
if (currentMouseDragAction.isValid()) { if (currentMouseDragAction.isValid()) {
mouseDragRectXEnd=plotter->p2x(event->x()/magnification); mouseDragRectXEnd=plotter->p2x(event->pos().x()/magnification);
mouseDragRectYEnd=plotter->p2y((event->y()-getPlotYOffset())/magnification); mouseDragRectYEnd=plotter->p2y((event->pos().y()-getPlotYOffset())/magnification);
mouseDragRectXEndPixel=event->x(); mouseDragRectXEndPixel=event->pos().x();
mouseDragRectYEndPixel=event->y(); mouseDragRectYEndPixel=event->pos().y();
image=oldImage; image=oldImage;
//update(); //update();
mouseDragingRectangle=false; mouseDragingRectangle=false;
@ -933,21 +933,21 @@ void JKQTPlotter::mouseDoubleClickEvent ( QMouseEvent * event ){
if (foundIT) { if (foundIT) {
// we found an action to perform on this double-click // we found an action to perform on this double-click
if (itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickOpensContextMenu) { if (itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickOpensContextMenu) {
openStandardContextMenu(event->x(), event->y()); openStandardContextMenu(event->pos().x(), event->pos().y());
} else if (itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickOpensSpecialContextMenu) { } else if (itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickOpensSpecialContextMenu) {
openSpecialContextMenu(event->x(), event->y()); openSpecialContextMenu(event->pos().x(), event->pos().y());
} else if (itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickZoomsIn || itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickZoomsOut) { } else if (itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickZoomsIn || itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickZoomsOut) {
double factor=4.0; double factor=4.0;
if (itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickZoomsOut) factor=1; if (itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickZoomsOut) factor=1;
double xmin=plotter->p2x(static_cast<double>(event->x())/magnification-static_cast<double>(plotter->getPlotWidth())/factor); double xmin=plotter->p2x(static_cast<double>(event->pos().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 xmax=plotter->p2x(static_cast<double>(event->pos().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); double ymin=plotter->p2y(static_cast<double>(event->pos().y())/magnification-static_cast<double>(getPlotYOffset())+static_cast<double>(plotter->getPlotHeight())/factor);
double ymax=plotter->p2y(static_cast<double>(event->y())/magnification-static_cast<double>(getPlotYOffset())-static_cast<double>(plotter->getPlotHeight())/factor); double ymax=plotter->p2y(static_cast<double>(event->pos().y())/magnification-static_cast<double>(getPlotYOffset())-static_cast<double>(plotter->getPlotHeight())/factor);
if ( (event->x()/magnification<plotter->getInternalPlotBorderLeft()) || (event->x()/magnification>plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) ) { if ( (event->pos().x()/magnification<plotter->getInternalPlotBorderLeft()) || (event->pos().x()/magnification>plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) ) {
xmin=getXMin(); xmin=getXMin();
xmax=getXMax(); xmax=getXMax();
} else if (((event->y()-getPlotYOffset())/magnification<plotter->getInternalPlotBorderTop()) || ((event->y()-getPlotYOffset())/magnification>plotter->getPlotHeight()+plotter->getInternalPlotBorderTop()) ) { } else if (((event->pos().y()-getPlotYOffset())/magnification<plotter->getInternalPlotBorderTop()) || ((event->pos().y()-getPlotYOffset())/magnification>plotter->getPlotHeight()+plotter->getInternalPlotBorderTop()) ) {
ymin=getYMin(); ymin=getYMin();
ymax=getYMax(); ymax=getYMax();
} }
@ -955,25 +955,25 @@ void JKQTPlotter::mouseDoubleClickEvent ( QMouseEvent * event ){
update(); update();
} else if (itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickMovesViewport) { } else if (itAction.value()==JKQTPMouseDoubleClickActions::jkqtpdcaClickMovesViewport) {
QRectF zoomRect= QRectF(QPointF(plotter->x2p(getXAxis()->getMin()),plotter->y2p(getYAxis()->getMax())), QPointF(plotter->x2p(getXAxis()->getMax()),plotter->y2p(getYAxis()->getMin()))); QRectF zoomRect= QRectF(QPointF(plotter->x2p(getXAxis()->getMin()),plotter->y2p(getYAxis()->getMax())), QPointF(plotter->x2p(getXAxis()->getMax()),plotter->y2p(getYAxis()->getMin())));
if ( (event->x()/magnification<plotter->getInternalPlotBorderLeft()) || (event->x()/magnification>plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) ) { if ( (event->pos().x()/magnification<plotter->getInternalPlotBorderLeft()) || (event->pos().x()/magnification>plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) ) {
zoomRect.moveCenter(QPointF(zoomRect.center().x(), event->y())); zoomRect.moveCenter(QPointF(zoomRect.center().x(), event->pos().y()));
} else if (((event->y()-getPlotYOffset())/magnification<plotter->getInternalPlotBorderTop()) || ((event->y()-getPlotYOffset())/magnification>plotter->getPlotHeight()+plotter->getInternalPlotBorderTop()) ) { } else if (((event->pos().y()-getPlotYOffset())/magnification<plotter->getInternalPlotBorderTop()) || ((event->pos().y()-getPlotYOffset())/magnification>plotter->getPlotHeight()+plotter->getInternalPlotBorderTop()) ) {
zoomRect.moveCenter(QPointF(event->x(), zoomRect.center().y())); zoomRect.moveCenter(QPointF(event->pos().x(), zoomRect.center().y()));
} else { } else {
zoomRect.moveCenter(QPointF(event->x(), event->y())); zoomRect.moveCenter(QPointF(event->pos().x(), event->pos().y()));
} }
setXY(plotter->p2x(zoomRect.left()), plotter->p2x(zoomRect.right()), plotter->p2y(zoomRect.bottom()), plotter->p2y(zoomRect.top())); setXY(plotter->p2x(zoomRect.left()), plotter->p2x(zoomRect.right()), plotter->p2y(zoomRect.bottom()), plotter->p2y(zoomRect.top()));
} }
} }
// only react on double clicks inside the widget // only react on double clicks inside the widget
if ( (event->x()/magnification>=plotter->getInternalPlotBorderLeft()) && (event->x()/magnification<=plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) && if ( (event->pos().x()/magnification>=plotter->getInternalPlotBorderLeft()) && (event->pos().x()/magnification<=plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) &&
((event->y()-getPlotYOffset())/magnification>=plotter->getInternalPlotBorderTop()) && ((event->y()-getPlotYOffset())/magnification<=plotter->getPlotHeight()+plotter->getInternalPlotBorderTop()) ) { ((event->pos().y()-getPlotYOffset())/magnification>=plotter->getInternalPlotBorderTop()) && ((event->pos().y()-getPlotYOffset())/magnification<=plotter->getPlotHeight()+plotter->getInternalPlotBorderTop()) ) {
mouseLastClickX=event->x(); mouseLastClickX=event->pos().x();
mouseLastClickY=event->y(); mouseLastClickY=event->pos().y();
emit plotMouseDoubleClicked(plotter->p2x(event->x()/magnification), plotter->p2y((event->y()-getPlotYOffset())/magnification), event->modifiers(), event->button()); emit plotMouseDoubleClicked(plotter->p2x(event->pos().x()/magnification), plotter->p2y((event->pos().y()-getPlotYOffset())/magnification), event->modifiers(), event->button());
} }
event->accept(); event->accept();
@ -1000,8 +1000,8 @@ void JKQTPlotter::wheelEvent ( QWheelEvent * event ) {
const double wheel_x=event->position().x(); const double wheel_x=event->position().x();
const double wheel_y=event->position().y(); const double wheel_y=event->position().y();
#else #else
const int wheel_x=event->x(); const int wheel_x=event->pos().x();
const int wheel_y=event->y(); const int wheel_y=event->pos().y();
#endif #endif
//qDebug()<<"wheelEvent("<<event->modifiers()<<"): plotterStyle.registeredMouseWheelActions="<<plotterStyle.registeredMouseWheelActions; //qDebug()<<"wheelEvent("<<event->modifiers()<<"): plotterStyle.registeredMouseWheelActions="<<plotterStyle.registeredMouseWheelActions;