|
From: Tapio V. <aa...@us...> - 2011-01-10 13:17:53
|
Module: editor Branch: master Commit: 1fb237f1533db535c82199348398563f7239aebc Author: Tapio Vierros <tap...@gm...> Date: Mon Jan 10 14:19:12 2011 +0200 Pixel-perfect note split. --- notegraphwidget.cc | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/notegraphwidget.cc b/notegraphwidget.cc index 17cf9f7..f5b38c0 100644 --- a/notegraphwidget.cc +++ b/notegraphwidget.cc @@ -141,10 +141,11 @@ void NoteGraphWidget::mousePressEvent(QMouseEvent *event) int cutpos = int(std::ceil(child->getText().length() * relRatio)); QString firstst = child->getText().left(cutpos); QString secondst = child->getText().right(child->getText().length() - cutpos); + int w1 = relRatio * child->width(); // Create new labels - NoteLabel *newLabel1 = new NoteLabel(firstst, this,child->pos()); - new NoteLabel(secondst, this, newLabel1->pos() + QPoint(newLabel1->width(), 0)); + NoteLabel *newLabel1 = new NoteLabel(firstst, this, child->pos(), QSize(w1, 0)); + new NoteLabel(secondst, this, newLabel1->pos() + QPoint(newLabel1->width(), 0), QSize(child->width() - w1, 0)); // Delete the old one child->close(); |