summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-07-29 01:32:10 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-07-29 01:32:10 (GMT)
commit499c7ff91b8fa004409e0959ba1eb70c06613b5a (patch)
treea11f78d81f13ca0c656bc3907addf2ff6cbbf5bd
parent4da7fd6e3b2b9af85401067612098f02182edc4d (diff)
downloadQt-499c7ff91b8fa004409e0959ba1eb70c06613b5a.zip
Qt-499c7ff91b8fa004409e0959ba1eb70c06613b5a.tar.gz
Qt-499c7ff91b8fa004409e0959ba1eb70c06613b5a.tar.bz2
Use real instead of int for MouseRegion.
-rw-r--r--src/declarative/fx/qfxmouseregion.cpp46
-rw-r--r--src/declarative/fx/qfxmouseregion.h40
-rw-r--r--src/declarative/fx/qfxmouseregion_p.h4
3 files changed, 45 insertions, 45 deletions
diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp
index d7bb7c9..bc19c23 100644
--- a/src/declarative/fx/qfxmouseregion.cpp
+++ b/src/declarative/fx/qfxmouseregion.cpp
@@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
-static const int DragThreshold = 5;
+static const qreal DragThreshold = 5;
static const int PressAndHoldDelay = 800;
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Drag,QFxDrag)
@@ -85,12 +85,12 @@ void QFxDrag::setAxis(const QString &a)
If x-axis dragging is enabled, xmin limits how far to the left the target can be dragged. If x-axis dragging is not enabled, this property has no effect.
*/
-int QFxDrag::xmin() const
+qreal QFxDrag::xmin() const
{
return _xmin;
}
-void QFxDrag::setXmin(int m)
+void QFxDrag::setXmin(qreal m)
{
_xmin = m;
}
@@ -101,12 +101,12 @@ void QFxDrag::setXmin(int m)
If x-axis dragging is enabled, xmax limits how far to the right the target can be dragged. If x-axis dragging is not enabled, this property has no effect.
*/
-int QFxDrag::xmax() const
+qreal QFxDrag::xmax() const
{
return _xmax;
}
-void QFxDrag::setXmax(int m)
+void QFxDrag::setXmax(qreal m)
{
_xmax = m;
}
@@ -117,12 +117,12 @@ void QFxDrag::setXmax(int m)
If y-axis dragging is enabled, ymin limits how far up the target can be dragged. If y-axis dragging is not enabled, this property has no effect.
*/
-int QFxDrag::ymin() const
+qreal QFxDrag::ymin() const
{
return _ymin;
}
-void QFxDrag::setYmin(int m)
+void QFxDrag::setYmin(qreal m)
{
_ymin = m;
}
@@ -133,12 +133,12 @@ void QFxDrag::setYmin(int m)
If y-axis dragging is enabled, ymax limits how far down the target can be dragged. If y-axis dragging is not enabled, this property has no effect.
*/
-int QFxDrag::ymax() const
+qreal QFxDrag::ymax() const
{
return _ymax;
}
-void QFxDrag::setYmax(int m)
+void QFxDrag::setYmax(qreal m)
{
_ymax = m;
}
@@ -266,21 +266,21 @@ QFxMouseRegion::~QFxMouseRegion()
}
/*!
- \qmlproperty int MouseRegion::mouseX
- \qmlproperty int MouseRegion::mouseY
+ \qmlproperty real MouseRegion::mouseX
+ \qmlproperty real MouseRegion::mouseY
The coordinates of the mouse while pressed. The coordinates are relative to the item that was pressed.
*/
-int QFxMouseRegion::mouseX() const
+qreal QFxMouseRegion::mouseX() const
{
Q_D(const QFxMouseRegion);
- return int(d->lastPos.x());
+ return d->lastPos.x();
}
-int QFxMouseRegion::mouseY() const
+qreal QFxMouseRegion::mouseY() const
{
Q_D(const QFxMouseRegion);
- return int(d->lastPos.y());
+ return d->lastPos.y();
}
/*!
@@ -342,8 +342,8 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (drag()->target()) {
if (!d->moved) {
- if (d->dragX) d->startX = int(drag()->target()->x()); //### change startX and startY to qreal?
- if (d->dragY) d->startY = int(drag()->target()->y());
+ if (d->dragX) d->startX = drag()->target()->x();
+ if (d->dragY) d->startY = drag()->target()->y();
}
QPointF startLocalPos;
@@ -356,8 +356,8 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
curLocalPos = event->scenePos();
}
- int dx = int(qAbs(curLocalPos.x() - startLocalPos.x()));
- int dy = int(qAbs(curLocalPos.y() - startLocalPos.y()));
+ qreal dx = qAbs(curLocalPos.x() - startLocalPos.x());
+ qreal dy = qAbs(curLocalPos.y() - startLocalPos.y());
if ((d->dragX && !(dx < DragThreshold)) || (d->dragY && !(dy < DragThreshold)))
d->dragged = true;
if (!keepMouseGrab()) {
@@ -530,10 +530,10 @@ QFxDrag *QFxMouseRegion::drag()
/*!
\qmlproperty Item MouseRegion::drag.target
\qmlproperty string MouseRegion::drag.axis
- \qmlproperty int MouseRegion::drag.xmin
- \qmlproperty int MouseRegion::drag.xmax
- \qmlproperty int MouseRegion::drag.ymin
- \qmlproperty int MouseRegion::drag.ymax
+ \qmlproperty real MouseRegion::drag.xmin
+ \qmlproperty real MouseRegion::drag.xmax
+ \qmlproperty real MouseRegion::drag.ymin
+ \qmlproperty real MouseRegion::drag.ymax
drag provides a convenient way to make an item draggable.
diff --git a/src/declarative/fx/qfxmouseregion.h b/src/declarative/fx/qfxmouseregion.h
index 47929be..6d85cea 100644
--- a/src/declarative/fx/qfxmouseregion.h
+++ b/src/declarative/fx/qfxmouseregion.h
@@ -56,10 +56,10 @@ class Q_DECLARATIVE_EXPORT QFxDrag : public QObject
Q_PROPERTY(QFxItem *target READ target WRITE setTarget)
Q_PROPERTY(QString axis READ axis WRITE setAxis)
- Q_PROPERTY(int xmin READ xmin WRITE setXmin)
- Q_PROPERTY(int xmax READ xmax WRITE setXmax)
- Q_PROPERTY(int ymin READ ymin WRITE setYmin)
- Q_PROPERTY(int ymax READ ymax WRITE setYmax)
+ Q_PROPERTY(qreal xmin READ xmin WRITE setXmin)
+ Q_PROPERTY(qreal xmax READ xmax WRITE setXmax)
+ Q_PROPERTY(qreal ymin READ ymin WRITE setYmin)
+ Q_PROPERTY(qreal ymax READ ymax WRITE setYmax)
public:
QFxDrag(QObject *parent=0);
~QFxDrag();
@@ -68,22 +68,22 @@ public:
void setTarget(QFxItem *);
QString axis() const;
void setAxis(const QString &);
- int xmin() const;
- void setXmin(int);
- int xmax() const;
- void setXmax(int);
- int ymin() const;
- void setYmin(int);
- int ymax() const;
- void setYmax(int);
+ qreal xmin() const;
+ void setXmin(qreal);
+ qreal xmax() const;
+ void setXmax(qreal);
+ qreal ymin() const;
+ void setYmin(qreal);
+ qreal ymax() const;
+ void setYmax(qreal);
private:
QFxItem *_target;
QString _axis;
- int _xmin;
- int _xmax;
- int _ymin;
- int _ymax;
+ qreal _xmin;
+ qreal _xmax;
+ qreal _ymin;
+ qreal _ymax;
Q_DISABLE_COPY(QFxDrag)
};
@@ -93,8 +93,8 @@ class Q_DECLARATIVE_EXPORT QFxMouseRegion : public QFxItem
{
Q_OBJECT
- Q_PROPERTY(int mouseX READ mouseX NOTIFY positionChanged)
- Q_PROPERTY(int mouseY READ mouseY NOTIFY positionChanged)
+ Q_PROPERTY(qreal mouseX READ mouseX NOTIFY positionChanged)
+ Q_PROPERTY(qreal mouseY READ mouseY NOTIFY positionChanged)
Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged)
Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
@@ -103,8 +103,8 @@ public:
QFxMouseRegion(QFxItem *parent=0);
~QFxMouseRegion();
- int mouseX() const;
- int mouseY() const;
+ qreal mouseX() const;
+ qreal mouseY() const;
bool isEnabled() const;
void setEnabled(bool);
diff --git a/src/declarative/fx/qfxmouseregion_p.h b/src/declarative/fx/qfxmouseregion_p.h
index a41f32a..70d78f3 100644
--- a/src/declarative/fx/qfxmouseregion_p.h
+++ b/src/declarative/fx/qfxmouseregion_p.h
@@ -95,8 +95,8 @@ public:
QFxDrag drag;
QPointF start;
QPointF startScene;
- int startX;
- int startY;
+ qreal startX;
+ qreal startY;
QPointF lastPos;
Qt::MouseButton lastButton;
Qt::MouseButtons lastButtons;