fusion44
20th April 2014, 19:35
Hi All,
I'm trying to follow this tutorial: http://www.informit.com/articles/article.aspx?p=1174421&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 :/ ) :
https://www.youtube.com/watch?v=j4f2n_TeZZM
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()));
}
And here's how I setup the 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);
Any ideas what might cause this?
Thank you in advance!
I'm trying to follow this tutorial: http://www.informit.com/articles/article.aspx?p=1174421&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 :/ ) :
https://www.youtube.com/watch?v=j4f2n_TeZZM
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()));
}
And here's how I setup the 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);
Any ideas what might cause this?
Thank you in advance!