| 300 | } |
| 301 | |
| 302 | void Header::wheelEvent(QWheelEvent *event) |
| 303 | { |
| 304 | assert(event); |
| 305 | |
| 306 | int x = 0; |
| 307 | int y = 0; |
| 308 | int delta = 0; |
| 309 | bool isVertical = true; |
| 310 | QPoint pos; |
| 311 | (void)x; |
| 312 | (void)y; |
| 313 | |
| 314 | #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) |
| 315 | x = (int)event->position().x(); |
| 316 | y = (int)event->position().y(); |
| 317 | int anglex = event->angleDelta().x(); |
| 318 | int angley = event->angleDelta().y(); |
| 319 | |
| 320 | pos.setX(x); |
| 321 | pos.setY(y); |
| 322 | |
| 323 | if (anglex == 0 || ABS_VAL(angley) >= ABS_VAL(anglex)){ |
| 324 | delta = angley; |
| 325 | isVertical = true; |
| 326 | } |
| 327 | else{ |
| 328 | delta = anglex; |
| 329 | isVertical = false; //hori direction |
| 330 | } |
| 331 | #else |
| 332 | x = event->x(); |
| 333 | delta = event->delta(); |
| 334 | isVertical = event->orientation() == Qt::Vertical; |
| 335 | pos = event->pos(); |
| 336 | #endif |
| 337 | |
| 338 | if (isVertical) |
| 339 | { |
| 340 | std::vector<Trace*> traces; |
| 341 | _view.get_traces(ALL_VIEW, traces); |
| 342 | // Vertical scrolling |
| 343 | double shift = 0; |
| 344 | |
| 345 | #ifdef Q_OS_DARWIN |
| 346 | static bool active = true; |
| 347 | static int64_t last_time; |
| 348 | if (event->source() == Qt::MouseEventSynthesizedBySystem) |
| 349 | { |
| 350 | if (active) |
| 351 | { |
| 352 | last_time = QDateTime::currentMSecsSinceEpoch(); |
| 353 | shift = delta > 1.5 ? -1 : delta < -1.5 ? 1 : 0; |
| 354 | } |
| 355 | int64_t cur_time = QDateTime::currentMSecsSinceEpoch(); |
| 356 | if (cur_time - last_time > 100) |
| 357 | active = true; |
| 358 | else |
| 359 | active = false; |
nothing calls this directly
no test coverage detected