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

Method eventFilter

DSView/pv/mainframe.cpp:407–590  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405}
406
407bool MainFrame::eventFilter(QObject *object, QEvent *event)
408{
409 const QEvent::Type type = event->type();
410 const QMouseEvent *const mouse_event = (QMouseEvent*)event;
411 int newWidth = 0;
412 int newHeight = 0;
413 int newLeft = 0;
414 int newTop = 0;
415
416#ifdef _WIN32
417 if (_parentNativeWidget != NULL){
418 return QFrame::eventFilter(object, event);
419 }
420#endif
421
422 if (type != QEvent::MouseMove
423 && type != QEvent::MouseButtonPress
424 && type != QEvent::MouseButtonRelease
425 && type != QEvent::Leave){
426 return QFrame::eventFilter(object, event);
427 }
428
429 //when window is maximized, or is moving, call return
430 if (IsMaxsized() || IsMoving()){
431 return QFrame::eventFilter(object, event);
432 }
433
434 if (!_bDraging && type == QEvent::MouseMove && (!(mouse_event->buttons() | Qt::NoButton))){
435 if (object == _top_left) {
436 _hit_border = TopLeft;
437 setCursor(Qt::SizeFDiagCursor);
438 } else if (object == _bottom_right) {
439 _hit_border = BottomRight;
440 setCursor(Qt::SizeFDiagCursor);
441 } else if (object == _top_right) {
442 _hit_border = TopRight;
443 setCursor(Qt::SizeBDiagCursor);
444 } else if (object == _bottom_left) {
445 _hit_border = BottomLeft;
446 setCursor(Qt::SizeBDiagCursor);
447 } else if (object == _left) {
448 _hit_border = Left;
449 setCursor(Qt::SizeHorCursor);
450 } else if (object == _right) {
451 _hit_border = Right;
452 setCursor(Qt::SizeHorCursor);
453 } else if (object == _bottom) {
454 _hit_border = Bottom;
455 setCursor(Qt::SizeVerCursor);
456 } else if (object == _top) {
457 _hit_border = Top;
458 setCursor(Qt::SizeVerCursor);
459 } else {
460 _hit_border = None;
461 setCursor(Qt::ArrowCursor);
462 }
463
464 return QFrame::eventFilter(object, event);

Callers

nothing calls this directly

Calls 3

typeMethod · 0.80
startMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected