summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/divetextitem.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-19 17:19:00 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-19 21:36:55 -0800
commit9d2344d01b05dab1c1d5d59893b980366a041e17 (patch)
treed8cda80488a22c5c9e4d32b49bf82bef4aaee07e /qt-ui/profile/divetextitem.cpp
parent72b5bbce6e2f177af0b769dbafd0db17dd6a1899 (diff)
downloadsubsurface-9d2344d01b05dab1c1d5d59893b980366a041e17.tar.gz
Fix the positioning of the Labels using the new DiveTextItem
This uses a combination of items on the canvas which makes it easier to position it where I want. This also broke the other texts because I forgot about them. I will fix that on the next commit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/divetextitem.cpp')
-rw-r--r--qt-ui/profile/divetextitem.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/qt-ui/profile/divetextitem.cpp b/qt-ui/profile/divetextitem.cpp
index fcc0517f1..5ace46b5e 100644
--- a/qt-ui/profile/divetextitem.cpp
+++ b/qt-ui/profile/divetextitem.cpp
@@ -7,6 +7,7 @@
#include <QFontMetrics>
#include <QBrush>
#include <QPen>
+#include <QDebug>
DiveTextItem::DiveTextItem(QGraphicsItem* parent): QGraphicsItemGroup(parent),
textBackgroundItem(NULL),
@@ -50,10 +51,10 @@ void DiveTextItem::updateText()
QRectF rect = fm.boundingRect(text);
yPos = (internalAlignFlags & Qt::AlignTop) ? -rect.height() :
- (internalAlignFlags & Qt::AlignBottom) ? 0 :
- /*(internalAlignFlags & Qt::AlignVCenter ? */ -rect.height() / 2;
+ (internalAlignFlags & Qt::AlignBottom) ? +rect.height() :
+ /*(internalAlignFlags & Qt::AlignVCenter ? */ +rect.height() / 4;
- yPos = (internalAlignFlags & Qt::AlignLeft ) ? 0 :
+ xPos = (internalAlignFlags & Qt::AlignLeft ) ? +rect.width() :
(internalAlignFlags & Qt::AlignHCenter) ? -rect.width()/2 :
/* (internalAlignFlags & Qt::AlignRight) */ -rect.width();