How to replace function `QWheelEvent::angleDelta()` in android for zoom in / zoom out function?
-
I was using the angleDelta() function from the QWheelEvent class to achieve the zoom in, zoom out. While using on windows, wheelEvent worked fine to zoom in and out by scrolling the mouse wheel.
void MapView::wheelEvent(QWheelEvent *event) { if(event->angleDelta().y() > 0) { if(m_scale < MAX_SCALE) { std::cout << m_scale << std::endl; this->scale(ZOOM_STEP, ZOOM_STEP); m_scale *= ZOOM_STEP; } } else if(event->angleDelta().y() < 0) { if(m_scale >= MIN_SCALE) { std::cout << m_scale << std::endl; this->scale(1/ZOOM_STEP, 1/ZOOM_STEP); m_scale *= 1/ZOOM_STEP; } } }
Now I am trying to run it in AVD and I don't want to use a mouse to zoom in and out. Looking for a solution to zoom in and out on android in the QT app.
-
I was using the angleDelta() function from the QWheelEvent class to achieve the zoom in, zoom out. While using on windows, wheelEvent worked fine to zoom in and out by scrolling the mouse wheel.
void MapView::wheelEvent(QWheelEvent *event) { if(event->angleDelta().y() > 0) { if(m_scale < MAX_SCALE) { std::cout << m_scale << std::endl; this->scale(ZOOM_STEP, ZOOM_STEP); m_scale *= ZOOM_STEP; } } else if(event->angleDelta().y() < 0) { if(m_scale >= MIN_SCALE) { std::cout << m_scale << std::endl; this->scale(1/ZOOM_STEP, 1/ZOOM_STEP); m_scale *= 1/ZOOM_STEP; } } }
Now I am trying to run it in AVD and I don't want to use a mouse to zoom in and out. Looking for a solution to zoom in and out on android in the QT app.
You just need to add some control in your UI that you can use to get absolute values that represent the zoom range, or some signals that represent zoom in & zoom out.
Just add a scrollbar, two buttons, capture swipe, or something else that fits in the UI design.