All: Reformat according to new standard

This commit is contained in:
pre-commit-ci[bot]
2025-11-11 13:49:01 +01:00
committed by Kacper Donat
parent eafd18dac0
commit 25c3ba7338
2390 changed files with 154630 additions and 115818 deletions

View File

@@ -21,7 +21,6 @@
***************************************************************************/
#include <numbers>
#include <QApplication>
@@ -36,7 +35,7 @@
SO_EVENT_SOURCE(SoGestureEvent);
SbBool SoGestureEvent::isSoGestureEvent(const SoEvent *ev) const
SbBool SoGestureEvent::isSoGestureEvent(const SoEvent* ev) const
{
return ev->isOfType(SoGestureEvent::getClassTypeId());
}
@@ -45,7 +44,7 @@ SbBool SoGestureEvent::isSoGestureEvent(const SoEvent *ev) const
SO_EVENT_SOURCE(SoGesturePanEvent);
SoGesturePanEvent::SoGesturePanEvent(QPanGesture* qpan, QWidget *widget)
SoGesturePanEvent::SoGesturePanEvent(QPanGesture* qpan, QWidget* widget)
{
Q_UNUSED(widget);
totalOffset = SbVec2f(qpan->offset().x(), -qpan->offset().y());
@@ -59,7 +58,7 @@ SoGesturePanEvent::SoGesturePanEvent(QPanGesture* qpan, QWidget *widget)
this->setTime(SbTime::getTimeOfDay());
}
SbBool SoGesturePanEvent::isSoGesturePanEvent(const SoEvent *ev) const
SbBool SoGesturePanEvent::isSoGesturePanEvent(const SoEvent* ev) const
{
return ev->isOfType(SoGesturePanEvent::getClassTypeId());
}
@@ -68,28 +67,29 @@ SbBool SoGesturePanEvent::isSoGesturePanEvent(const SoEvent *ev) const
SO_EVENT_SOURCE(SoGesturePinchEvent);
SoGesturePinchEvent::SoGesturePinchEvent(QPinchGesture* qpinch, QWidget *widget)
SoGesturePinchEvent::SoGesturePinchEvent(QPinchGesture* qpinch, QWidget* widget)
{
int h = widget->height();
QPointF widgetCorner = QPointF(widget->mapToGlobal(QPoint(0,0)));
qreal scaleToWidget = (widget->mapFromGlobal(QPoint(800,800))-widget->mapFromGlobal(QPoint(0,0))).x()/800.0;
QPointF pnt;//temporary
QPointF widgetCorner = QPointF(widget->mapToGlobal(QPoint(0, 0)));
qreal scaleToWidget
= (widget->mapFromGlobal(QPoint(800, 800)) - widget->mapFromGlobal(QPoint(0, 0))).x() / 800.0;
QPointF pnt; // temporary
pnt = qpinch->startCenterPoint();
pnt = (pnt-widgetCorner)*scaleToWidget;//translate screen coord. into widget coord.
pnt = (pnt - widgetCorner) * scaleToWidget; // translate screen coord. into widget coord.
startCenter = SbVec2f(pnt.x(), h - pnt.y());
pnt = qpinch->centerPoint();
pnt = (pnt-widgetCorner)*scaleToWidget;
pnt = (pnt - widgetCorner) * scaleToWidget;
curCenter = SbVec2f(pnt.x(), h - pnt.y());
pnt = qpinch->lastCenterPoint();
pnt = (pnt-widgetCorner)*scaleToWidget;
pnt = (pnt - widgetCorner) * scaleToWidget;
deltaCenter = curCenter - SbVec2f(pnt.x(), h - pnt.y());
deltaZoom = qpinch->scaleFactor();
totalZoom = qpinch->totalScaleFactor();
deltaAngle = -unbranchAngle(Base::toRadians(qpinch->rotationAngle()-qpinch->lastRotationAngle()));
deltaAngle = -unbranchAngle(Base::toRadians(qpinch->rotationAngle() - qpinch->lastRotationAngle()));
totalAngle = Base::toRadians(-qpinch->totalRotationAngle());
state = SbGestureState(qpinch->state());
@@ -102,7 +102,7 @@ SoGesturePinchEvent::SoGesturePinchEvent(QPinchGesture* qpinch, QWidget *widget)
this->setTime(SbTime::getTimeOfDay());
}
SbBool SoGesturePinchEvent::isSoGesturePinchEvent(const SoEvent *ev) const
SbBool SoGesturePinchEvent::isSoGesturePinchEvent(const SoEvent* ev) const
{
return ev->isOfType(SoGesturePinchEvent::getClassTypeId());
}
@@ -124,31 +124,31 @@ double SoGesturePinchEvent::unbranchAngle(double ang)
SO_EVENT_SOURCE(SoGestureSwipeEvent);
SoGestureSwipeEvent::SoGestureSwipeEvent(QSwipeGesture *qwsipe, QWidget *widget)
SoGestureSwipeEvent::SoGestureSwipeEvent(QSwipeGesture* qwsipe, QWidget* widget)
{
Q_UNUSED(widget);
angle = qwsipe->swipeAngle();
switch (qwsipe->verticalDirection()){
case QSwipeGesture::Up :
vertDir = +1;
break;
case QSwipeGesture::Down :
vertDir = -1;
break;
default:
vertDir = 0;
break;
switch (qwsipe->verticalDirection()) {
case QSwipeGesture::Up:
vertDir = +1;
break;
case QSwipeGesture::Down:
vertDir = -1;
break;
default:
vertDir = 0;
break;
}
switch (qwsipe->horizontalDirection()){
case QSwipeGesture::Right :
horzDir = +1;
break;
case QSwipeGesture::Left :
horzDir = -1;
break;
default:
horzDir = 0;
break;
switch (qwsipe->horizontalDirection()) {
case QSwipeGesture::Right:
horzDir = +1;
break;
case QSwipeGesture::Left:
horzDir = -1;
break;
default:
horzDir = 0;
break;
}
state = SbGestureState(qwsipe->state());
@@ -160,7 +160,7 @@ SoGestureSwipeEvent::SoGestureSwipeEvent(QSwipeGesture *qwsipe, QWidget *widget)
this->setTime(SbTime::getTimeOfDay());
}
SbBool SoGestureSwipeEvent::isSoGestureSwipeEvent(const SoEvent *ev) const
SbBool SoGestureSwipeEvent::isSoGestureSwipeEvent(const SoEvent* ev) const
{
return ev->isOfType(SoGestureSwipeEvent::getClassTypeId());
}
@@ -169,41 +169,43 @@ SbBool SoGestureSwipeEvent::isSoGestureSwipeEvent(const SoEvent *ev) const
//----------------------------GesturesDevice-------------------------------
GesturesDevice::GesturesDevice(QWidget* widget)
: InputDevice(nullptr)
: InputDevice(nullptr)
{
if (SoGestureEvent::getClassTypeId().isBad()){
if (SoGestureEvent::getClassTypeId().isBad()) {
SoGestureEvent::initClass();
SoGesturePanEvent::initClass();
SoGesturePinchEvent::initClass();
SoGestureSwipeEvent::initClass();
}
if (! widget)
throw Base::ValueError("Can't create a gestures quarter input device without widget (null pointer was passed).");
if (!widget) {
throw Base::ValueError(
"Can't create a gestures quarter input device without widget (null pointer was passed)."
);
}
this->widget = widget;
}
const SoEvent* GesturesDevice::translateEvent(QEvent* event)
{
if (event->type() == QEvent::Gesture
|| event->type() == QEvent::GestureOverride) {
if (event->type() == QEvent::Gesture || event->type() == QEvent::GestureOverride) {
auto gevent = static_cast<QGestureEvent*>(event);
auto zg = static_cast<QPinchGesture*>(gevent->gesture(Qt::PinchGesture));
if(zg){
gevent->setAccepted(Qt::PinchGesture,true);//prefer it over pan
return new SoGesturePinchEvent(zg,this->widget);
if (zg) {
gevent->setAccepted(Qt::PinchGesture, true); // prefer it over pan
return new SoGesturePinchEvent(zg, this->widget);
}
auto pg = static_cast<QPanGesture*>(gevent->gesture(Qt::PanGesture));
if(pg){
gevent->setAccepted(Qt::PanGesture,true);
return new SoGesturePanEvent(pg,this->widget);
if (pg) {
gevent->setAccepted(Qt::PanGesture, true);
return new SoGesturePanEvent(pg, this->widget);
}
auto sg = static_cast<QSwipeGesture*>(gevent->gesture(Qt::SwipeGesture));
if(sg){
gevent->setAccepted(Qt::SwipeGesture,true);
return new SoGesturePanEvent(pg,this->widget);
if (sg) {
gevent->setAccepted(Qt::SwipeGesture, true);
return new SoGesturePanEvent(pg, this->widget);
}
}
return nullptr;