Fixed display of arrow on point details widget when no values there.

This commit is contained in:
23rd 2023-10-21 11:14:49 +03:00
parent b7a9aa9a0e
commit ec8c634e9c
2 changed files with 5 additions and 2 deletions

View file

@ -306,7 +306,8 @@ void PointDetailsWidget::setXIndex(int xIndex) {
_lines.push_back(std::move(textLine)); _lines.push_back(std::move(textLine));
} }
const auto clickable = _zoomEnabled && hasPositiveValues; const auto clickable = _zoomEnabled && hasPositiveValues;
setAttribute( _hasPositiveValues = hasPositiveValues;
QWidget::setAttribute(
Qt::WA_TransparentForMouseEvents, Qt::WA_TransparentForMouseEvents,
!clickable); !clickable);
invalidateCache(); invalidateCache();
@ -424,7 +425,7 @@ void PointDetailsWidget::paintEvent(QPaintEvent *e) {
line.value.draw(p, valueContext); line.value.draw(p, valueContext);
} }
if (_zoomEnabled) { if (_zoomEnabled && _hasPositiveValues) {
const auto s = _arrow.size() / style::DevicePixelRatio(); const auto s = _arrow.size() / style::DevicePixelRatio();
const auto x = rect::right(_textRect) - s.width(); const auto x = rect::right(_textRect) - s.width();
const auto y = _textRect.y() const auto y = _textRect.y()

View file

@ -65,6 +65,8 @@ private:
float64 alpha = 1.; float64 alpha = 1.;
}; };
bool _hasPositiveValues = true;
int _maxPercentageWidth = 0; int _maxPercentageWidth = 0;
QRect _innerRect; QRect _innerRect;