mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Make the mean depth line follow the size of the axis.
When we move, shrink or expand the depth axis, the meandepth should also change it's position. this patch adds that. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0333de426f
commit
cc37d2e94a
3 changed files with 17 additions and 0 deletions
|
@ -534,6 +534,18 @@ void MeanDepthLine::setMeanDepth(int value)
|
|||
{
|
||||
leftText->setText(get_depth_string(value, false, false));
|
||||
rightText->setText(get_depth_string(value, false, false));
|
||||
meanDepth = value;
|
||||
}
|
||||
|
||||
void MeanDepthLine::setAxis(DiveCartesianAxis* a)
|
||||
{
|
||||
connect(a, SIGNAL(sizeChanged()), this, SLOT(axisLineChanged()));
|
||||
}
|
||||
|
||||
void MeanDepthLine::axisLineChanged()
|
||||
{
|
||||
DiveCartesianAxis *axis = qobject_cast<DiveCartesianAxis*>(sender());
|
||||
animateMoveTo(x(),axis->posAtValue(meanDepth));
|
||||
}
|
||||
|
||||
void PartialPressureGasItem::modelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight)
|
||||
|
|
|
@ -135,10 +135,14 @@ public:
|
|||
MeanDepthLine();
|
||||
void setMeanDepth(int value);
|
||||
void setLine(qreal x1, qreal y1, qreal x2, qreal y2);
|
||||
void setAxis(DiveCartesianAxis *a);
|
||||
public slots:
|
||||
void axisLineChanged();
|
||||
private:
|
||||
int meanDepth;
|
||||
DiveTextItem *leftText;
|
||||
DiveTextItem *rightText;
|
||||
DiveCartesianAxis *axis;
|
||||
};
|
||||
|
||||
class PartialPressureGasItem : public AbstractProfilePolygonItem{
|
||||
|
|
|
@ -145,6 +145,7 @@ void ProfileWidget2::setupItemOnScene()
|
|||
meanDepth->setX(3);
|
||||
meanDepth->setPen(QPen(QBrush(Qt::red), 0, Qt::SolidLine));
|
||||
meanDepth->setZValue(1);
|
||||
meanDepth->setAxis(profileYAxis);
|
||||
|
||||
cartesianPlane->setBottomAxis(timeAxis);
|
||||
cartesianPlane->setLeftAxis(profileYAxis);
|
||||
|
|
Loading…
Add table
Reference in a new issue