From 9cca4ffd9987352e43119d9c4dea0ce84c2c448f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 5 Oct 2018 15:59:58 +0200 Subject: silly busywork --- spline/spline-widget.cpp | 27 ++++++++------------------- spline/spline-widget.hpp | 4 ++-- 2 files changed, 10 insertions(+), 21 deletions(-) (limited to 'spline') diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp index 8849d45d..a4b9534f 100644 --- a/spline/spline-widget.cpp +++ b/spline/spline-widget.cpp @@ -15,13 +15,10 @@ #include #include #include -#include #include #include -#include "compat/timer.hpp" - using namespace spline_detail; spline_widget::spline_widget(QWidget *parent) : QWidget(parent) @@ -187,15 +184,6 @@ void spline_widget::drawFunction() painter.setPen(QPen(color_, 1.75, Qt::SolidLine, Qt::FlatCap)); -//#define DEBUG_TIMINGS -#ifdef DEBUG_TIMINGS - static Timer t; - static unsigned cnt = 0; - static time_units::ms total { 0 }; - cnt++; - t.start(); -#endif - const double dpr = devicePixelRatioF(); const double line_length_pixels = std::fmax(1, 2 * dpr); const double step = std::fmax(.1, line_length_pixels / c.x()); @@ -245,11 +233,6 @@ void spline_widget::drawFunction() } #endif -#ifdef DEBUG_TIMINGS - total += t.elapsed(); - qDebug() << "avg" << total.count() / cnt; -#endif - const QRect r1(pixel_bounds.left(), 0, width() - pixel_bounds.left(), pixel_bounds.top()), r2(pixel_bounds.right(), 0, width() - pixel_bounds.right(), pixel_bounds.bottom()); @@ -531,8 +514,14 @@ void spline_widget::show_tooltip(const QPoint& pos, const QPointF& value_) if (std::fabs(y_ - y) < 1e-3) y = y_; - static const bool is_fusion = QStringLiteral("fusion") == QApplication::style()->objectName(); - // no fusion means OSX + // the style on OSX has different offsets + static const bool is_fusion = +#if defined __APPLE__ + true; +#else + false; +#endif + const int off_x = (is_fusion ? 25 : 0), off_y = (is_fusion ? 15 : 0); const QPoint pix(pos.x() + off_x, pos.y() + off_y); diff --git a/spline/spline-widget.hpp b/spline/spline-widget.hpp index 70071c28..737b29f1 100644 --- a/spline/spline-widget.hpp +++ b/spline/spline-widget.hpp @@ -36,8 +36,8 @@ class OTR_SPLINE_EXPORT spline_widget final : public QWidget using points_t = spline::points_t; public: - spline_widget(QWidget *parent = 0); - ~spline_widget(); + explicit spline_widget(QWidget *parent = nullptr); + ~spline_widget() override; void setConfig(base_spline* spl); -- cgit v1.2.3