示例#1
0
QVariant OperatorItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
    if(change == ItemSelectedHasChanged)
    {
        QPen currentPen = m_opRect->pen();

        if(isSelected())
            currentPen.setStyle(Qt::DashLine);
        else
            currentPen.setStyle(Qt::SolidLine);

        m_opRect->setPen(currentPen);
        
        return value;
    }
    if(change == ItemPositionHasChanged)
    {
        updateConnectionPositions();
    }

    return QGraphicsItem::itemChange(change, value);
}
void ProcessorPortGraphicsItem::addConnection(ConnectionGraphicsItem* connection) {
    connections_.push_back(connection);
    updateConnectionPositions();
    update(); // we need to repaint the connection
}
QVariant ProcessorPortGraphicsItem::itemChange(GraphicsItemChange change, const QVariant& value) {
    if (change == QGraphicsItem::ItemScenePositionHasChanged) {
        updateConnectionPositions();
    }
    return EditorGraphicsItem::itemChange(change, value);
}