public new bool EventFilter(QObject obj, QEvent evnt) { var type = evnt.type(); if (type == QEvent.TypeOf.MouseButtonPress) { var mouseEvent = (QMouseEvent)evnt; if (mouseEvent.Button() == Qt.MouseButton.LeftButton) { m_Moving = true; m_OrigX = mouseEvent.X(); m_OrigY = mouseEvent.Y(); m_ParentWidget.Cursor = new QCursor(Qt.CursorShape.SizeAllCursor); } } else if (type == QEvent.TypeOf.MouseMove) { var mouseEvent = (QMouseEvent)evnt; if (m_Moving) { var pos = mouseEvent.GlobalPos(); m_ParentWidget.Move(pos.X() - m_OrigX, pos.Y() - m_OrigY); } } else if (type == QEvent.TypeOf.MouseButtonRelease) { var mouseEvent = (QMouseEvent)evnt; if (m_Moving && mouseEvent.Button() == Qt.MouseButton.LeftButton) { m_Moving = false; m_ParentWidget.Cursor = new QCursor(Qt.CursorShape.ArrowCursor); } } return obj.EventFilter(obj, evnt); }
public new bool EventFilter(QObject obj, QEvent evnt) { if (evnt.type() == QEvent.TypeOf.KeyPress) { if (KeyEvent != null) { if (KeyEvent((QKeyEvent)evnt)) { return true; } } } return obj.EventFilter(obj, evnt); }