summaryrefslogtreecommitdiffhomepage
path: root/spline
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-08-01 11:22:41 +0200
committerStanislaw Halik <sthalik@misaki.pl>2019-08-01 11:22:41 +0200
commitb930dd608bf95ecc3f89007313ba8ab8b1935ee5 (patch)
tree649ddba90caa1de65ad1c53be23afeb635121e73 /spline
parente71f7af1d619d02667c2bfb9f5fd0d925e534230 (diff)
video: reuse working dpi check
Diffstat (limited to 'spline')
-rw-r--r--spline/spline-widget.cpp9
-rw-r--r--spline/spline-widget.hpp5
2 files changed, 2 insertions, 12 deletions
diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp
index 0ae3766d..e182e45a 100644
--- a/spline/spline-widget.cpp
+++ b/spline/spline-widget.cpp
@@ -258,15 +258,6 @@ void spline_widget::drawFunction()
}
}
-double spline_widget::screen_dpi() const
-{
-#ifdef _WIN32
- return std::max(devicePixelRatioF(), 1.);
-#else
- return std::max(std::max(logicalDpiX()/(double)physicalDpiX(), devicePixelRatioF()), 1.);
-#endif
-}
-
QSize spline_widget::minimumSizeHint() const
{
const double dpi = screen_dpi();
diff --git a/spline/spline-widget.hpp b/spline/spline-widget.hpp
index f1523361..610baf43 100644
--- a/spline/spline-widget.hpp
+++ b/spline/spline-widget.hpp
@@ -11,6 +11,7 @@
#include "spline.hpp"
#include "api/plugin-api.hpp"
+#include "compat/qt-dpi.hpp"
#include "options/options.hpp"
#include "export.hpp"
@@ -26,7 +27,7 @@ namespace spline_detail {
using namespace options;
-class OTR_SPLINE_EXPORT spline_widget final : public QWidget
+class OTR_SPLINE_EXPORT spline_widget final : public QWidget, public screen_dpi_mixin<spline_widget>
{
Q_OBJECT
Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier)
@@ -81,8 +82,6 @@ private:
void update_range();
void changeEvent(QEvent* e) override;
- double screen_dpi() const;
-
QPointF pixel_to_point(const QPointF& point);
QPointF point_to_pixel(const QPointF& point);