Exemplo n.º 1
0
void FrameLabel::mouseMoveEvent(QMouseEvent *ev)
{
    // Save mouse cursor position
    setMouseCursorPos(ev->pos());
    // Update box width and height if box drawing is in progress
    if(drawBox)
    {
        box->setWidth(getMouseCursorPos().x()-startPoint.x());
        box->setHeight(getMouseCursorPos().y()-startPoint.y());
    }
    // Inform main window of mouse move event
    emit onMouseMoveEvent();
} // mouseMoveEvent()
Exemplo n.º 2
0
void FrameLabel::mouseReleaseEvent(QMouseEvent *ev)
{
    if(_image.isNull())
        return;
    // Update cursor position
    setMouseCursorPos(ev->pos());
    qDebug() << getMouseCursorPos() << Q_FUNC_INFO;
    // On left mouse button release
    if(ev->button()==Qt::LeftButton)
    {
        // Set leftButtonRelease flag to TRUE
        mouseData.leftButtonRelease=true;
        if(_draw)
        {
            // Stop drawing box
            _draw=false;
        }
    }
    // On right mouse button release
    else if(ev->button()==Qt::RightButton)
    {
        _draw=false;
        _varName.clear();
        _drawMode = nooba::noDraw;
        drawingLine = QLineF();
        _color = QColor(Qt::transparent);
    }
}