Your problem is that mapToScene() processing an integer, not a floating-point. The rounding error is always indicated the same for a specific viewport size, so you always add some delta.
Do you want to directly change the scrollbar property value or send the event to a horizontal scrollbar. I implemented the latter, it is quite simple.
On a Mac, you must completely disable the inertia of the scroll bar for your application. Otherwise, as soon as you release the modifier and pull your finger off the trackpad / scroll wheel, vertical scrolling will continue due to inertia. That would make Mac users suck, and they hate you for that :)

gview-scroll.pro
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = gview-scroll TEMPLATE = app macx { LIBS += -framework Foundation OBJECTIVE_SOURCES += helper.m } SOURCES += main.cpp
helper.m
//helper.m #include <Foundation/NSUserDefaults.h> #include <Foundation/NSDictionary.h> #include <Foundation/NSString.h> void disableMomentumScroll(void) { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"AppleMomentumScrollSupported"]; [defaults registerDefaults:appDefaults]; }
main.cpp
//main.cpp #include <QApplication> #include <QGraphicsScene> #include <QGraphicsView> #include <QtCore/qmath.h> #include <QScrollBar> #include <QWheelEvent> #include <QDebug> class View : public QGraphicsView { public: void zoom(int delta) { double factor = qPow(1.2, delta/qAbs(delta)); scale(factor, factor); } void wheelEvent(QWheelEvent *event) { if (event->modifiers() & Qt::ControlModifier) { zoom(event->delta()); } else if (event->modifiers() & Qt::ShiftModifier) { horizontalScrollBar()->event(event); } else { QGraphicsView::wheelEvent(event); } } public: explicit View(QWidget *parent=0) : QGraphicsView(parent) {} explicit View(QGraphicsScene *scene, QWidget *parent=0) : QGraphicsView(scene, parent) {} }; #ifndef Q_OS_MAC void disableMomentumScroll() {} #else extern "C" { void disableMomentumScroll(); } #endif int main(int argc, char *argv[]) { QApplication a(argc, argv); disableMomentumScroll(); QGraphicsScene s; s.addEllipse(-50, -50, 100, 100, QPen(Qt::red), QBrush(Qt::gray)); View w(&s); w.show(); return a.exec(); }
source share