Hi All,
I'm trying to follow this tutorial: http://www.informit.com/articles/art...74421&seqNum=4
Works pretty well until the point when I try to draw a line between my two rectangles. The position from my two nodes seem to be off.
I've recorded a video to explain the problem a little better ( Sorry for the video quality :/ ) :
Selecting 480p makes the text somewhat readable. The rectangle is always showing the current position in the scene, which is the same that is used to set the lines position.
Here's the code for setting the line:
void Link::trackNodes()
{
setLine
(QLineF(myFromNode
->pos
(), myToNode
->pos
()));
}
void Link::trackNodes()
{
setLine(QLineF(myFromNode->pos(), myToNode->pos()));
}
To copy to clipboard, switch view to plain text mode
And here's how I setup the scene:
//Set-up the scene
//Set-up the view
QRectF scene_rect
(0,
0,
300,
300);
scene_rect_item->setRect(scene_rect);
setSceneRect(scene_rect);
scene->addItem(scene_rect_item);
setContextMenuPolicy(Qt::ActionsContextMenu);
setScene(scene);
//Set-up the scene
QGraphicsScene* scene = new QGraphicsScene(this);
//Set-up the view
QGraphicsRectItem *scene_rect_item = new QGraphicsRectItem();
QRectF scene_rect(0,0, 300, 300);
scene_rect_item->setRect(scene_rect);
setSceneRect(scene_rect);
scene->addItem(scene_rect_item);
setDragMode(QGraphicsView::RubberBandDrag);
setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
setContextMenuPolicy(Qt::ActionsContextMenu);
setScene(scene);
To copy to clipboard, switch view to plain text mode
Any ideas what might cause this?
Thank you in advance!
Bookmarks