| 192 | } |
| 193 | |
| 194 | QVariant GraphItem::itemChange( GraphicsItemChange change, const QVariant& value ) |
| 195 | { |
| 196 | if ( change == ItemPositionChange ) { |
| 197 | if ( this->note ) { |
| 198 | QRectF rect = this->boundingRect(); |
| 199 | QRectF noteRect = this->note->boundingRect(); |
| 200 | QPointF pos = value.toPointF(); |
| 201 | QPointF posRect = QPointF( pos.x() + (rect.width() - noteRect.width()) / 2, pos.y() + rect.height() - 10); |
| 202 | |
| 203 | this->note->setPos(posRect); |
| 204 | } |
| 205 | } |
| 206 | else if ( change == ItemPositionHasChanged ) { |
| 207 | this->adjust(); |
| 208 | } |
| 209 | |
| 210 | return QGraphicsItem::itemChange( change, value ); |
| 211 | } |