mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Fixed slider issues
This commit is contained in:
parent
7993e4dcb3
commit
d48a2aac93
@ -219,8 +219,8 @@ void GraphView::redraw(const QSizeF &size)
|
|||||||
_scene->addItem(_yAxis);
|
_scene->addItem(_yAxis);
|
||||||
|
|
||||||
_slider->setArea(r);
|
_slider->setArea(r);
|
||||||
_scene->addItem(_slider);
|
|
||||||
updateSliderPosition();
|
updateSliderPosition();
|
||||||
|
_scene->addItem(_slider);
|
||||||
|
|
||||||
r = _scene->itemsBoundingRect();
|
r = _scene->itemsBoundingRect();
|
||||||
_info->setPos(r.topLeft() + QPointF(r.width()/2
|
_info->setPos(r.topLeft() + QPointF(r.width()/2
|
||||||
@ -308,11 +308,14 @@ static qreal yAtX(const QPainterPath &path, qreal x)
|
|||||||
|
|
||||||
void GraphView::updateSliderPosition()
|
void GraphView::updateSliderPosition()
|
||||||
{
|
{
|
||||||
Q_ASSERT(_sliderPos <= _bounds.right() && _sliderPos >= _bounds.left());
|
Q_ASSERT(_bounds.width() > 0);
|
||||||
|
|
||||||
_slider->setPos((_sliderPos / _bounds.width()) * _slider->area().width(),
|
if (_sliderPos <= _bounds.right() && _sliderPos >= _bounds.left()) {
|
||||||
_slider->area().bottom());
|
_slider->setPos((_sliderPos / _bounds.width()) * _slider->area().width(),
|
||||||
//_slider->setVisible(false);
|
_slider->area().bottom());
|
||||||
|
_slider->setVisible(true);
|
||||||
|
} else
|
||||||
|
_slider->setVisible(false);
|
||||||
|
|
||||||
updateSliderInfo();
|
updateSliderInfo();
|
||||||
}
|
}
|
||||||
@ -345,8 +348,7 @@ void GraphView::updateSliderInfo()
|
|||||||
|
|
||||||
void GraphView::emitSliderPositionChanged(const QPointF &pos)
|
void GraphView::emitSliderPositionChanged(const QPointF &pos)
|
||||||
{
|
{
|
||||||
if (_graphs.isEmpty())
|
Q_ASSERT(_slider->area().width() > 0);
|
||||||
return;
|
|
||||||
|
|
||||||
_sliderPos = (pos.x() / _slider->area().width()) * _bounds.width();
|
_sliderPos = (pos.x() / _slider->area().width()) * _bounds.width();
|
||||||
|
|
||||||
@ -360,9 +362,7 @@ void GraphView::setSliderPosition(qreal pos)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_sliderPos = pos;
|
_sliderPos = pos;
|
||||||
|
|
||||||
updateSliderPosition();
|
updateSliderPosition();
|
||||||
emit sliderPositionChanged(_sliderPos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::newSliderPosition(const QPointF &pos)
|
void GraphView::newSliderPosition(const QPointF &pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user