summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-18 21:13:05 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-18 16:43:41 -0800
commit4433830f550f41f0c558786dfe219fcb0fcbd45f (patch)
treeb4384f5eebe17bced7a45bed709e4870a17a4b76 /qt-ui
parent0c3eef1c4c937553b88af8ad5b85484c155ff631 (diff)
downloadsubsurface-4433830f550f41f0c558786dfe219fcb0fcbd45f.tar.gz
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>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 937490cb6..7c9263adb 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -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());
+ }
}