Commit ab8b2113 authored by David Faure's avatar David Faure
Browse files

Port away from QWheelEvent deprecated API to fix compilation with Qt 5.14

parent 5e8e0364
......@@ -637,25 +637,30 @@ bool Agenda::eventFilter_wheel(QObject *object, QWheelEvent *e)
{
QPoint viewportPos;
bool accepted = false;
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
const QPoint pos = e->pos();
#else
const QPoint pos = e->position().toPoint();
#endif
if ((e->modifiers() & Qt::ShiftModifier) == Qt::ShiftModifier) {
if (object != this) {
viewportPos = ((QWidget *)object)->mapToParent(e->pos());
viewportPos = ((QWidget *)object)->mapToParent(pos);
} else {
viewportPos = e->pos();
viewportPos = pos;
}
//qCDebug(CALENDARVIEW_LOG) << type:" << e->type() << "delta:" << e->delta();
Q_EMIT zoomView(-e->delta(),
//qCDebug(CALENDARVIEW_LOG) << type:" << e->type() << "angleDelta:" << e->angleDelta();
Q_EMIT zoomView(-e->angleDelta().y(),
contentsToGrid(viewportPos), Qt::Horizontal);
accepted = true;
}
if ((e->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) {
if (object != this) {
viewportPos = ((QWidget *)object)->mapToParent(e->pos());
viewportPos = ((QWidget *)object)->mapToParent(pos);
} else {
viewportPos = e->pos();
viewportPos = pos;
}
Q_EMIT zoomView(-e->delta(), contentsToGrid(viewportPos), Qt::Vertical);
Q_EMIT zoomView(-e->angleDelta().y(), contentsToGrid(viewportPos), Qt::Vertical);
Q_EMIT mousePosSignal(gridToContents(contentsToGrid(viewportPos)));
accepted = true;
}
......
......@@ -361,9 +361,9 @@ void MonthView::updateView()
void MonthView::wheelEvent(QWheelEvent *event)
{
// invert direction to get scroll-like behaviour
if (event->delta() > 0) {
if (event->angleDelta().y() > 0) {
d->moveStartDate(-1, 0);
} else if (event->delta() < 0) {
} else if (event->angleDelta().y() < 0) {
d->moveStartDate(1, 0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment