How do you represent each note? How is the boundingRect() defined for the class representing the note? What is the parent object of each note?
How do you represent each note? How is the boundingRect() defined for the class representing the note? What is the parent object of each note?
Each note is a standard QGraphpicEllipseItem. I have not subclassed it at this point so the bounding rect should be pure standard issue. I have not assigned a specific parent to each note.
So how do you create those items? What rectangles do you pass for the ellipses?
Note* myNote = new Note;
myNote->setRect(gridX-(w/2), (y-(h/2)), w, h); // w= width, h == height, gridX is a grid-altered x location, y is the location on the staff vertically.
Also, I stated something wrong earlier. I have a class called Note that is of QObject and QGraphicsEllipseItem. I create a new Note and set that rect using the above line. I hope this is more helpful.
Last edited by devdon; 19th September 2011 at 22:57.
I do not call setpos on the ellipses.
So position of all your items is (0,0) and the value returned in your code snippet is correct. I guess you are incorrectly assuming that pos of your item should be equal to the centre of the item's bounding rect (gridX, y). That is not the case. To get that, create your items with rects (-w/2, -h/2, w, h) and then call setPos(gridX, y).
Bookmarks