-2

DesignerのUIフォームにQGraphicsViewを追加しました。次に、このウィジェットに「クリック時イベント」を追加します。

4

1 に答える 1

1

Is it possible for you to subclass a QGraphicsView? If so you could easily handle the cases with something like that:

MyQGraphicsView.h

class MyQGraphicsView : public QGraphicsView
{
    void enterEvent(QEvent *event);
    void leaveEvent(QEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void wheelEvent(QWheelEvent *event);
}

MyQGraphicsView.cpp

void MyQGraphicsView::mouseMoveEvent(QMouseEvent *event)
{
    // Do what you want
}

//Do the same with all the events.
于 2012-06-22T12:25:42.097 に答える