コード例 #1
0
ファイル: RNavigationAction.cpp プロジェクト: Alpha-Kand/qcad
void RNavigationAction::mousePressEvent(RMouseEvent& event) {
    if (event.button() == Qt::MidButton ||
        ( event.button() == Qt::LeftButton && 
          event.modifiers() == Qt::ControlModifier)) {
        panOrigin = event.getScreenPosition();
        panning = true;
        event.getGraphicsView().startPan();
    }
}
コード例 #2
0
ファイル: RGraphicsView.cpp プロジェクト: fallenwind/qcad
/**
 * This should be called by the mouse move event handler of a higher level
 * GUI toolkit. Events are forwarded to the scene and the navigation action
 * that is attached to this view.
 */
void RGraphicsView::handleMouseMoveEvent(RMouseEvent& event) {
    lastKnownModelPosition = event.getModelPosition();
    lastKnownScreenPosition = event.getScreenPosition();
    if (scene != NULL) {
        scene->handleMouseMoveEvent(event);
    }
    if (navigationAction != NULL) {
        navigationAction->mouseMoveEvent(event);
    }
}
コード例 #3
0
ファイル: RGraphicsView.cpp プロジェクト: fallenwind/qcad
/**
 * This should be called by the mouse double click event handler of a higher level
 * GUI toolkit. Events are forwarded to the scene and the navigation action
 * that is attached to this view.
 */
void RGraphicsView::handleMouseDoubleClickEvent(RMouseEvent& event) {
    lastKnownModelPosition = event.getModelPosition();
    lastKnownScreenPosition = event.getScreenPosition();
    if (scene == NULL) {
        return;
    }
    scene->handleMouseDoubleClickEvent(event);
    if (navigationAction!=NULL) {
        navigationAction->mouseDoubleClickEvent(event);
    }
}
コード例 #4
0
ファイル: RNavigationAction.cpp プロジェクト: Alpha-Kand/qcad
void RNavigationAction::mouseMoveEvent(RMouseEvent& event) {
    if (panning &&
        ( event.buttons() == Qt::MidButton ||
          ( event.buttons() == Qt::LeftButton &&
            event.modifiers() == Qt::ControlModifier )
        )) {

        RVector panTarget = event.getScreenPosition();
        RVector panDelta = panTarget - panOrigin;
        if (fabs(panDelta.x) > 1 || fabs(panDelta.y) > 1) {
            event.getGraphicsView().pan(panDelta);
            panOrigin = panTarget;
        }
    }
}
コード例 #5
0
ファイル: RGraphicsView.cpp プロジェクト: fallenwind/qcad
/**
 * This should be called by the mouse press event handler of a higher level
 * GUI toolkit. Events are forwarded to the scene and the navigation action
 * that is attached to this view.
 */
void RGraphicsView::handleMousePressEvent(RMouseEvent& event) {
    lastKnownModelPosition = event.getModelPosition();
    lastKnownScreenPosition = event.getScreenPosition();
    if (scene == NULL) {
        return;
    }
    scene->handleMousePressEvent(event);
    if (navigationAction!=NULL) {
        navigationAction->mousePressEvent(event);
    }

    // remember mouse press position to use for mouse release:
    //mousePressScreenPosition = event.getScreenPosition();
    //mousePressModelPosition = event.getModelPosition();
}
コード例 #6
0
ファイル: RGraphicsView.cpp プロジェクト: fallenwind/qcad
/**
 * This should be called by the mouse release event handler of a higher level
 * GUI toolkit. Events are forwarded to the scene and the navigation action
 * that is attached to this view.
 */
void RGraphicsView::handleMouseReleaseEvent(RMouseEvent& event) {
    // use mouse press position for release and final posisiton:
//    if (mousePressModelPosition.isValid()) {
//        event.setModelPosition(mousePressModelPosition);
//        mousePressModelPosition = RVector::invalid;
//    }
//    if (mousePressScreenPosition.isValid()) {
//        event.setScreenPosition(mousePressScreenPosition);
//        mousePressScreenPosition = RVector::invalid;
//    }

    lastKnownModelPosition = event.getModelPosition();
    lastKnownScreenPosition = event.getScreenPosition();
    if (scene == NULL) {
        return;
    }
    scene->handleMouseReleaseEvent(event);
    if (navigationAction!=NULL && !event.isAccepted()) {
        navigationAction->mouseReleaseEvent(event);
    }
}
コード例 #7
0
ファイル: RNavigationAction.cpp プロジェクト: Alpha-Kand/qcad
void RNavigationAction::mouseReleaseEvent(RMouseEvent& event) {
    if (event.button() == Qt::MidButton ||
        event.button() == Qt::LeftButton) {
        panning = false;
    }
}