MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / wheelEvent

Method wheelEvent

DSView/pv/view/viewport.cpp:1329–1432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1327}
1328
1329void Viewport::wheelEvent(QWheelEvent *event)
1330{
1331 assert(event);
1332
1333 if (_view.header_is_draging()){
1334 return;
1335 }
1336
1337 int x = 0; //mouse x pos
1338 int delta = 0;
1339 bool isVertical = true;
1340
1341#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1342 x = (int)event->position().x();
1343 int anglex = event->angleDelta().x();
1344 int angley = event->angleDelta().y();
1345
1346 if (anglex == 0 || ABS_VAL(angley) >= ABS_VAL(anglex)){
1347 delta = angley;
1348 isVertical = true;
1349 }
1350 else{
1351 delta = anglex;
1352 isVertical = false; //hori direction
1353 }
1354#else
1355 x = event->x();
1356 delta = event->delta();
1357 isVertical = event->orientation() == Qt::Vertical;
1358#endif
1359
1360 double zoom_scale = delta / 80;
1361
1362 if (ABS_VAL(delta) <= 80){
1363 zoom_scale = delta > 0 ? 1.5 : -1.5;
1364 }
1365
1366 if (_type == FFT_VIEW)
1367 {
1368 for (auto t : _view.session().get_spectrum_traces())
1369 {
1370 if (t->enabled())
1371 {
1372 t->zoom(zoom_scale, x);
1373 break;
1374 }
1375 }
1376 }
1377 else if (_type == TIME_VIEW)
1378 {
1379 static bool bLstTime = false;
1380
1381 if (isVertical)
1382 {
1383 // Vertical scrolling is interpreted as zooming in/out
1384#ifdef Q_OS_DARWIN
1385 static int64_t last_time;
1386

Callers

nothing calls this directly

Calls 9

header_is_dragingMethod · 0.80
sessionMethod · 0.80
set_scale_offsetMethod · 0.80
scaleMethod · 0.80
offsetMethod · 0.80
signal_typeMethod · 0.80
enabledMethod · 0.45
zoomMethod · 0.45
auto_endMethod · 0.45

Tested by

no test coverage detected