mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
72b5bbce6e
commit
9d2344d01b
5 changed files with 71 additions and 29 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue