summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-19 18:31:26 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-19 21:37:48 -0800
commitcd3867d46abdc3c19368b7370b4fa1c3b71d0e1d (patch)
tree7c59be400f1aa43994896d8deefd34288e237616
parent592ee31326115750bb9208d992164cb16221f6ec (diff)
downloadsubsurface-cd3867d46abdc3c19368b7370b4fa1c3b71d0e1d.tar.gz
Remove the ticks on the Axis, we never used them on the old profile.
This patch just cleans a bit the Cartesian Axis, we never used ticks on it, just the grid lines ( that I need to animate a bit. ) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp36
-rw-r--r--qt-ui/profile/divecartesianaxis.h1
2 files changed, 3 insertions, 34 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index ea5e97f14..4c7b608f8 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -50,24 +50,11 @@ void DiveCartesianAxis::updateTicks()
double steps = (max - min) / interval;
double currValue = min;
- if (!showTicks && !ticks.empty()){
- qDeleteAll(ticks);
- ticks.clear();
- }
-
if(!showText && !labels.empty()){
qDeleteAll(labels);
labels.clear();
}
- // Remove the uneeded Ticks / Texts.
- if (showTicks && !ticks.isEmpty() && ticks.size() > steps) {
- while (ticks.size() > steps) {
- DiveLineItem *removedLine = ticks.takeLast();
- removedLine->animatedHide();
- }
- }
-
if (!labels.isEmpty() && labels.size() > steps) {
while (labels.size() > steps) {
DiveTextItem *removedText = labels.takeLast();
@@ -92,7 +79,7 @@ void DiveCartesianAxis::updateTicks()
}
stepSize = stepSize / steps;
- for (int i = 0, count = ticks.size(); i < count; i++, currValue += interval) {
+ for (int i = 0, count = labels.size(); i < count; i++, currValue += interval) {
qreal childPos;
if (orientation == TopToBottom || orientation == LeftToRight) {
childPos = begin + i * stepSize;
@@ -101,30 +88,22 @@ void DiveCartesianAxis::updateTicks()
}
labels[i]->setText(textForValue(currValue));
if ( orientation == LeftToRight || orientation == RightToLeft) {
- ticks[i]->animateMoveTo(childPos, m.y1() + tickSize);
labels[i]->animateMoveTo(childPos, m.y1() + tickSize);
} else {
- ticks[i]->animateMoveTo(m.x1() - tickSize, childPos);
labels[i]->animateMoveTo(m.x1() - tickSize, childPos);
}
}
// Add's the rest of the needed Ticks / Text.
- for (int i = ticks.size(); i < steps; i++, currValue += interval) {
+ for (int i = labels.size(); i < steps; i++, currValue += interval) {
qreal childPos;
if (orientation == TopToBottom || orientation == LeftToRight) {
childPos = begin + i * stepSize;
} else {
childPos = begin - i * stepSize;
}
- DiveLineItem *item = NULL;
DiveTextItem *label = NULL;
- if (showTicks){
- item = new DiveLineItem(this);
- item->setPen(pen());
- ticks.push_back(item);
- }
if (showText){
label = new DiveTextItem(this);
label->setText(textForValue(currValue));
@@ -132,22 +111,13 @@ void DiveCartesianAxis::updateTicks()
}
labels.push_back(label);
if (orientation == RightToLeft || orientation == LeftToRight) {
- if (showTicks){
- item->setLine(0, 0, 0, tickSize);
- item->setPos(scene()->sceneRect().width() + 10, m.y1() + tickSize); // position it outside of the scene
- item->animateMoveTo(childPos, m.y1() + tickSize); // anim it to scene.
- }
+
if(showText){
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
label->setPos(scene()->sceneRect().width() + 10, m.y1() + tickSize); // position it outside of the scene);
label->animateMoveTo(childPos, m.y1() + tickSize);
}
} else {
- if(showTicks){
- item->setLine(0, 0, tickSize, 0);
- item->setPos(m.x1() - tickSize, scene()->sceneRect().height() + 10);
- item->animateMoveTo(m.x1() - tickSize, childPos);
- }
if(showText){
label->setAlignment(Qt::AlignVCenter| Qt::AlignRight);
label->setPos(m.x1() - tickSize, scene()->sceneRect().height() + 10);
diff --git a/qt-ui/profile/divecartesianaxis.h b/qt-ui/profile/divecartesianaxis.h
index 13de9edec..e03df04e3 100644
--- a/qt-ui/profile/divecartesianaxis.h
+++ b/qt-ui/profile/divecartesianaxis.h
@@ -38,7 +38,6 @@ protected:
virtual QString textForValue(double value);
Orientation orientation;
- QList<DiveLineItem*> ticks;
QList<DiveTextItem*> labels;
double min;
double max;