aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-29 13:48:06 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-29 09:35:16 -0800
commit042c34df0962cec5e4557cfe6f61e747173778ad (patch)
treee55923f50c9d38c180333221d0fc7cc28005d837
parent354acb0fe62917291ce5c26f4d6696c858f78d49 (diff)
downloadsubsurface-042c34df0962cec5e4557cfe6f61e747173778ad.tar.gz
Fix positioning of many text items.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp2
-rw-r--r--qt-ui/profile/diveprofileitem.cpp19
-rw-r--r--qt-ui/profile/divetextitem.cpp2
3 files changed, 10 insertions, 13 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index 9a3c8242f..7c91281b4 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -137,7 +137,7 @@ void DiveCartesianAxis::updateTicks()
}
} else {
if(showText){
- label->setAlignment(Qt::AlignVCenter| Qt::AlignRight);
+ label->setAlignment(Qt::AlignVCenter| Qt::AlignLeft);
label->setPos(m.x1() - tickSize, scene()->sceneRect().height() + 10);
label->animateMoveTo(m.x1() - tickSize, childPos);
}
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index c3be684c7..335d5ecf6 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -151,12 +151,12 @@ void DiveProfileItem::modelDataChanged()
continue;
if ((entry == entry->max[2]) && entry->depth / 100 != last) {
- plot_depth_sample(entry, Qt::AlignHCenter | Qt::AlignTop, getColor(SAMPLE_DEEP));
+ plot_depth_sample(entry, Qt::AlignHCenter | Qt::AlignBottom, getColor(SAMPLE_DEEP));
last = entry->depth / 100;
}
if ((entry == entry->min[2]) && entry->depth / 100 != last) {
- plot_depth_sample(entry, Qt::AlignHCenter | Qt::AlignBottom, getColor(SAMPLE_SHALLOW));
+ plot_depth_sample(entry, Qt::AlignHCenter | Qt::AlignTop, getColor(SAMPLE_SHALLOW));
last = entry->depth / 100;
}
@@ -288,11 +288,8 @@ void DiveGasPressureItem::modelDataChanged()
polygons.last().push_back(point); // The polygon thta will be plotted.
}
setPolygon(boundingPoly);
-
- //TODO: Instead of deleting all texts, move the existing ones to it's new location.
qDeleteAll(texts);
texts.clear();
-
int mbar, cyl;
int seen_cyl[MAX_CYLINDERS] = { false, };
int last_pressure[MAX_CYLINDERS] = { 0, };
@@ -311,8 +308,8 @@ void DiveGasPressureItem::modelDataChanged()
if (cyl != entry->cylinderindex) {
cyl = entry->cylinderindex;
if (!seen_cyl[cyl]) {
- plot_pressure_value(mbar, entry->sec, Qt::AlignLeft | Qt::AlignBottom);
- plot_gas_value(mbar, entry->sec, Qt::AlignLeft | Qt::AlignTop,
+ plot_pressure_value(mbar, entry->sec, Qt::AlignRight | Qt::AlignTop);
+ plot_gas_value(mbar, entry->sec, Qt::AlignRight | Qt::AlignBottom,
get_o2(&dive->cylinder[cyl].gasmix),
get_he(&dive->cylinder[cyl].gasmix));
seen_cyl[cyl] = true;
@@ -324,7 +321,7 @@ void DiveGasPressureItem::modelDataChanged()
for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
if (last_time[cyl]) {
- plot_pressure_value(last_pressure[cyl], last_time[cyl], Qt::AlignHCenter | Qt::AlignTop);
+ plot_pressure_value(last_pressure[cyl], last_time[cyl], Qt::AlignRight | Qt::AlignTop);
}
}
}
@@ -334,7 +331,7 @@ void DiveGasPressureItem::plot_pressure_value(int mbar, int sec, QFlags<Qt::Alig
const char *unit;
int pressure = get_pressure_units(mbar, &unit);
DiveTextItem *text = new DiveTextItem(this);
- text->setPos(hAxis->posAtValue(sec), vAxis->posAtValue(mbar));
+ text->setPos(hAxis->posAtValue(sec), vAxis->posAtValue(mbar)-0.5);
text->setText(QString("%1 %2").arg(pressure).arg(unit));
text->setAlignment(flags);
text->setBrush(getColor(PRESSURE_TEXT));
@@ -376,6 +373,7 @@ DiveCalculatedCeiling::DiveCalculatedCeiling()
gradientFactor->setY(0);
gradientFactor->setBrush(getColor(PRESSURE_TEXT));
gradientFactor->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
+ preferencesChanged();
}
void DiveCalculatedCeiling::modelDataChanged()
@@ -401,9 +399,8 @@ void DiveCalculatedCeiling::modelDataChanged()
setPen(QPen(QBrush(Qt::NoBrush),0));
setBrush(pat);
- gradientFactor->setX(poly.boundingRect().width()/2);
+ gradientFactor->setX(poly.boundingRect().width()/2 + poly.boundingRect().x());
gradientFactor->setText(QString("GF %1/%2").arg(prefs.gflow).arg(prefs.gfhigh));
- qDebug() << gradientFactor->pos() << mapToScene(gradientFactor->pos());
}
void DiveCalculatedCeiling::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
diff --git a/qt-ui/profile/divetextitem.cpp b/qt-ui/profile/divetextitem.cpp
index 72ba480a9..b939c54fc 100644
--- a/qt-ui/profile/divetextitem.cpp
+++ b/qt-ui/profile/divetextitem.cpp
@@ -57,7 +57,7 @@ void DiveTextItem::updateText()
qreal xPos = 0, yPos = 0;
QRectF rect = fm.boundingRect(internalText);
- yPos = (internalAlignFlags & Qt::AlignTop) ? -rect.height() :
+ yPos = (internalAlignFlags & Qt::AlignTop) ? 0 :
(internalAlignFlags & Qt::AlignBottom) ? +rect.height() :
/*(internalAlignFlags & Qt::AlignVCenter ? */ +rect.height() / 4;