diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-09-16 11:09:54 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-09-16 11:09:54 -0300 |
commit | 4e06c52f683abe426589035ce472d00b495e2eab (patch) | |
tree | 222b89f4bb56d75ec89c9eda7a9ef2fda78bf889 /qt-ui/diveplanner.cpp | |
parent | f5b33dede359dccc31fafa72e0e2550868d8edd2 (diff) | |
download | subsurface-4e06c52f683abe426589035ce472d00b495e2eab.tar.gz |
Position the X and Y labels of the Rulers
Position the X and Y labels of the rulers, this way
it's a bit more clear the deepness and the length
of the trip. It's still not the best approach, but
I'm getting close.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index ab7bda17d..5d0299c88 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -673,21 +673,38 @@ void DiveHandler::mousePressEvent(QGraphicsSceneMouseEvent* event) void Ruler::setMaximum(double maximum) { + maxText->setText(QString::number(maximum)); + if(orientation == Qt::Horizontal) + maxText->setPos( line().x2(), line().y2() -5 ); + else + maxText->setPos( line().x1() - 50, line().y2()); max = maximum; } void Ruler::setMinimum(double minimum) { + minText->setText(QString::number(minimum)); + if(orientation == Qt::Horizontal) + minText->setPos( line().x1(), line().y2() -5 ); + else + minText->setPos( line().x1() - 50, line().y1()); min = minimum; } -Ruler::Ruler() : orientation(Qt::Horizontal) +Ruler::Ruler() : orientation(Qt::Horizontal), +minText(new QGraphicsSimpleTextItem(this)), +maxText(new QGraphicsSimpleTextItem(this)) { + minText->setFlag(QGraphicsItem::ItemIgnoresTransformations); + maxText->setFlag(QGraphicsItem::ItemIgnoresTransformations); } void Ruler::setOrientation(Qt::Orientation o) { orientation = o; + // position the elements on the screen. + setMinimum(minimum()); + setMaximum(maximum()); } void Ruler::updateTicks() |