Beispiel #1
0
void CommentController::
        enableCommentAdder(bool active)
{
    tool_selector_->setCurrentTool( this, active );
    graphicsview_->setToolFocus( active );

    if (active)
    {
        comment_ = createNewComment();
        setVisible( true );

        setMouseTracking( true );
        mouseMoveEvent(new QMouseEvent(
                QEvent::MouseMove,
                mapFromGlobal(graphicsview_->mapFromGlobal( QCursor::pos())),
                Qt::NoButton,
                Qt::MouseButtons(),
                Qt::KeyboardModifiers()));
    }
    else
    {
        if (comment_)
        {
            // didn't place new comment before tool was disabled
            QGraphicsProxyWidget* proxy = comment_->getProxy();
            proxy->deleteLater();
            comment_ = 0;
            setVisible( false );
        }
    }
}
Beispiel #2
0
void UiAPI::DeleteCallingWidgetOnClose()
{
    QGraphicsProxyWidget *proxy = dynamic_cast<QGraphicsProxyWidget *>(sender());
    if (proxy && !proxy->isVisible())
        proxy->deleteLater();
}