src/gui/widgets/qdial.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    57 #include <private/qabstractslider_p.h>
    57 #include <private/qabstractslider_p.h>
    58 #include <private/qmath_p.h>
    58 #include <private/qmath_p.h>
    59 #ifndef QT_NO_ACCESSIBILITY
    59 #ifndef QT_NO_ACCESSIBILITY
    60 #include "qaccessible.h"
    60 #include "qaccessible.h"
    61 #endif
    61 #endif
       
    62 #include <qmath.h>
    62 
    63 
    63 QT_BEGIN_NAMESPACE
    64 QT_BEGIN_NAMESPACE
    64 
    65 
    65 class QDialPrivate : public QAbstractSliderPrivate
    66 class QDialPrivate : public QAbstractSliderPrivate
    66 {
    67 {
   133 int QDialPrivate::valueFromPoint(const QPoint &p) const
   134 int QDialPrivate::valueFromPoint(const QPoint &p) const
   134 {
   135 {
   135     Q_Q(const QDial);
   136     Q_Q(const QDial);
   136     double yy = (double)q->height()/2.0 - p.y();
   137     double yy = (double)q->height()/2.0 - p.y();
   137     double xx = (double)p.x() - q->width()/2.0;
   138     double xx = (double)p.x() - q->width()/2.0;
   138     double a = (xx || yy) ? atan2(yy, xx) : 0;
   139     double a = (xx || yy) ? qAtan2(yy, xx) : 0;
   139 
   140 
   140     if (a < Q_PI / -2)
   141     if (a < Q_PI / -2)
   141         a = a + Q_PI * 2;
   142         a = a + Q_PI * 2;
   142 
   143 
   143     int dist = 0;
   144     int dist = 0;