EventFilter() private method

private EventFilter ( QObject arg1, Qyoto.QEvent arg2 ) : bool
arg1 QObject
arg2 Qyoto.QEvent
return bool
コード例 #1
0
ファイル: WindowMover.cs プロジェクト: jrudolph/synapse
        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);
        }
コード例 #2
0
ファイル: KeyPressEater.cs プロジェクト: jrudolph/synapse
 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);
 }