UI: Fix warnings for Qt 5.15

AllDockWidgetFeatures is now deprecated. Use underlying values instead.

Use default QFlags constructor instead of nullptr/0.

Use QWheelEvent::angleDelta() in place of orientation() and delta(), and
position() in place of x() and y().
This commit is contained in:
jpark37
2020-06-07 15:31:13 -07:00
parent b1d03ae367
commit c2ddc428b0
10 changed files with 46 additions and 27 deletions

View File

@@ -314,22 +314,32 @@ bool OBSBasicInteraction::HandleMouseWheelEvent(QWheelEvent *event)
int xDelta = 0;
int yDelta = 0;
const QPoint angleDelta = event->angleDelta();
if (!event->pixelDelta().isNull()) {
if (event->orientation() == Qt::Horizontal)
if (angleDelta.x())
xDelta = event->pixelDelta().x();
else
yDelta = event->pixelDelta().y();
} else {
if (event->orientation() == Qt::Horizontal)
xDelta = event->delta();
if (angleDelta.x())
xDelta = angleDelta.x();
else
yDelta = event->delta();
yDelta = angleDelta.y();
}
if (GetSourceRelativeXY(event->x(), event->y(), mouseEvent.x,
mouseEvent.y))
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QPointF position = event->position();
const int x = position.x();
const int y = position.y();
#else
const int x = event->x();
const int y = event->y();
#endif
if (GetSourceRelativeXY(x, y, mouseEvent.x, mouseEvent.y)) {
obs_source_send_mouse_wheel(source, &mouseEvent, xDelta,
yDelta);
}
return true;
}