Esempio n. 1
0
void GraphView::setNodeRadius(int radius)
{
    nodeRadius = radius;

    QListIterator<QGraphicsItem*> it(scene()->items());
    while (it.hasNext()) {
        GraphNode* node = dynamic_cast<GraphNode*>(it.next());

        if (node)
            node->setRadius(radius);
    }

    // After changing the radius of every node, we recalculate the edges
    it.toFront();
    while (it.hasNext()) {
        GraphEdge* edge = dynamic_cast<GraphEdge*>(it.next());

        if (edge)
            edge->updateDrawing();
    }

    scene()->update();
}