Anchor bottom of the dive ruler editor ro items on the DivePlanner

This patch is a crude attempt to 'anchor' the bottom of the Dive
ruler editor ( the new graphics ) to the bottom of the scene.
since QGraphicsView doesn't have a good way to modify the origin
point of an item, I'v just shifted all other items up a bit, this
way the 0,0 point is in the bottom of the drawing and I can safely
move it around, making it bottom-anchorable. :D

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2013-11-18 21:13:05 -02:00 committed by Dirk Hohndel
parent 0c3eef1c4c
commit 4433830f55

View file

@ -140,7 +140,7 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
timeHandler->icon->setPixmap(QString(":icon_time"));
connect(timeHandler->increaseBtn, SIGNAL(clicked()), this, SLOT(increaseTime()));
connect(timeHandler->decreaseBtn, SIGNAL(clicked()), this, SLOT(decreaseTime()));
timeHandler->setPos(fromPercent(83, Qt::Horizontal), fromPercent(85, Qt::Vertical));
timeHandler->setPos(fromPercent(83, Qt::Horizontal), fromPercent(100, Qt::Vertical));
timeHandler->setZValue(-2);
scene()->addItem(timeHandler);
@ -150,7 +150,7 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
depthHandler->icon->setPixmap(QString(":icon_depth"));
connect(depthHandler->increaseBtn, SIGNAL(clicked()), this, SLOT(increaseDepth()));
connect(depthHandler->decreaseBtn, SIGNAL(clicked()), this, SLOT(decreaseDepth()));
depthHandler->setPos(fromPercent(0, Qt::Horizontal), fromPercent(85, Qt::Vertical));
depthHandler->setPos(fromPercent(0, Qt::Horizontal), fromPercent(100, Qt::Vertical));
depthHandler->setZValue(-2);
scene()->addItem(depthHandler);
@ -1489,5 +1489,11 @@ ExpanderGraphics::ExpanderGraphics(QGraphicsItem* parent): QGraphicsRectItem(par
decreaseBtn->setPos(leftWing->pos().x(), leftWing->pos().y() );
increaseBtn->setPos(rightWing->pos().x(), rightWing->pos().y() );
icon->setPos(bg->pos().x(), bg->pos().y() - 5);
setTransformOriginPoint(transformOriginPoint().x(), transformOriginPoint().y() - childrenBoundingRect().height());
//I need to bottom align the items, I need to make the 0,0 ( orgin ) to be
// the bottom of this item, so shift everything up.
QRectF r = childrenBoundingRect();
Q_FOREACH(QGraphicsItem *i, childItems()){
i->setPos(i->pos().x(), i->pos().y() - r.height());
}
}