summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/declarative/flickr/content/Slider.qml2
-rw-r--r--examples/declarative/dial/dial.qml2
-rw-r--r--examples/declarative/minehunt/Description.qml8
-rw-r--r--examples/declarative/mouseregion/mouse.qml4
-rw-r--r--examples/declarative/scrollbar/display.qml2
-rw-r--r--examples/declarative/slideswitch/Switch.qml2
-rw-r--r--examples/declarative/velocity/Day.qml8
-rw-r--r--src/declarative/fx/qfxmouseregion.cpp46
-rw-r--r--src/declarative/fx/qfxmouseregion.h26
-rw-r--r--src/declarative/fx/qfxmouseregion_p.h2
10 files changed, 74 insertions, 28 deletions
diff --git a/demos/declarative/flickr/content/Slider.qml b/demos/declarative/flickr/content/Slider.qml
index 51385bc..a2ec420 100644
--- a/demos/declarative/flickr/content/Slider.qml
+++ b/demos/declarative/flickr/content/Slider.qml
@@ -29,7 +29,7 @@ Item {
MouseRegion {
anchors.fill: parent; drag.target: parent
- drag.axis: "x"; drag.xmin: 2; drag.xmax: Slider.xMax+2
+ drag.axis: "x"; drag.minimumX: 2; drag.maximumX: Slider.xMax+2
onPositionChanged: { value = (maximum - minimum) * (Handle.x-2) / Slider.xMax + minimum; }
}
}
diff --git a/examples/declarative/dial/dial.qml b/examples/declarative/dial/dial.qml
index 3773bcc..75bd9b1 100644
--- a/examples/declarative/dial/dial.qml
+++ b/examples/declarative/dial/dial.qml
@@ -26,7 +26,7 @@ Rect {
}
MouseRegion {
anchors.fill: parent
- drag.target: parent; drag.axis: "x"; drag.xmin: 2; drag.xmax: 128
+ drag.target: parent; drag.axis: "x"; drag.minimumX: 2; drag.maximumX: 128
}
}
}
diff --git a/examples/declarative/minehunt/Description.qml b/examples/declarative/minehunt/Description.qml
index 9ad6522..cf02bff 100644
--- a/examples/declarative/minehunt/Description.qml
+++ b/examples/declarative/minehunt/Description.qml
@@ -8,10 +8,10 @@ Item {
anchors.fill: parent
drag.target: Page
drag.axis: "xy"
- drag.xmin: 0
- drag.xmax: 1000
- drag.ymin: 0
- drag.ymax: 1000
+ drag.minimumX: 0
+ drag.maximumX: 1000
+ drag.minimumY: 0
+ drag.maximumY: 1000
}
Rect {
radius: 10
diff --git a/examples/declarative/mouseregion/mouse.qml b/examples/declarative/mouseregion/mouse.qml
index d9db106..34c6e66 100644
--- a/examples/declarative/mouseregion/mouse.qml
+++ b/examples/declarative/mouseregion/mouse.qml
@@ -25,8 +25,8 @@ Rect {
MouseRegion {
drag.target: parent
drag.axis: "x"
- drag.xmin: 0
- drag.xmax: 150
+ drag.minimumX: 0
+ drag.maximumX: 150
onPressed: { print('press') }
onReleased: { print('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')') }
onClicked: { print('click' + '(wasHeld: ' + mouse.wasHeld + ')') }
diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml
index 03a40d3..d8bd187 100644
--- a/examples/declarative/scrollbar/display.qml
+++ b/examples/declarative/scrollbar/display.qml
@@ -44,6 +44,7 @@ Rect {
height: View.height-12
anchors.right: View.right
}
+ /*
ScrollBar {
id: SBH
opacity: 0
@@ -54,4 +55,5 @@ Rect {
width: View.width-12
anchors.bottom: View.bottom
}
+ */
}
diff --git a/examples/declarative/slideswitch/Switch.qml b/examples/declarative/slideswitch/Switch.qml
index 91627c7..b5de9ec 100644
--- a/examples/declarative/slideswitch/Switch.qml
+++ b/examples/declarative/slideswitch/Switch.qml
@@ -36,7 +36,7 @@ Item {
anchors.fill: Knob
onClicked: { toggle() }
onReleased: { dorelease() }
- drag.target: Knob; drag.axis: "x"; drag.xmin: 1; drag.xmax: 78
+ drag.target: Knob; drag.axis: "x"; drag.minimumX: 1; drag.maximumX: 78
}
states: [
State {
diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml
index 59a31af..c959b0c 100644
--- a/examples/declarative/velocity/Day.qml
+++ b/examples/declarative/velocity/Day.qml
@@ -71,10 +71,10 @@ Rect {
anchors.fill: parent
drag.target: StickyPage
drag.axis: "xy"
- drag.ymin: 0
- drag.ymax: 500
- drag.xmin: 0
- drag.xmax: 400
+ drag.minimumY: 0
+ drag.maximumY: 500
+ drag.minimumX: 0
+ drag.maximumX: 400
}
}
}
diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp
index 42e024d..22d64cb 100644
--- a/src/declarative/fx/qfxmouseregion.cpp
+++ b/src/declarative/fx/qfxmouseregion.cpp
@@ -296,7 +296,10 @@ bool QFxMouseRegion::isEnabled() const
void QFxMouseRegion::setEnabled(bool a)
{
Q_D(QFxMouseRegion);
- d->absorb = a;
+ if (a != d->absorb) {
+ d->absorb = a;
+ emit enabledChanged();
+ }
}
void QFxMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event)
@@ -473,9 +476,9 @@ void QFxMouseRegion::timerEvent(QTimerEvent *event)
\warning This property is only partially implemented -- it is only valid when the mouse is pressed, and not for hover events.
*/
-bool QFxMouseRegion::hovered()
+bool QFxMouseRegion::hovered() const
{
- Q_D(QFxMouseRegion);
+ Q_D(const QFxMouseRegion);
return d->hovered;
}
@@ -483,9 +486,9 @@ bool QFxMouseRegion::hovered()
\qmlproperty bool MouseRegion::pressed
This property holds whether the mouse region is currently pressed.
*/
-bool QFxMouseRegion::pressed()
+bool QFxMouseRegion::pressed() const
{
- Q_D(QFxMouseRegion);
+ Q_D(const QFxMouseRegion);
return d->pressed;
}
@@ -499,6 +502,39 @@ void QFxMouseRegion::setHovered(bool h)
}
}
+/*!
+ \qmlproperty Qt::MouseButtons MouseRegion::acceptedButtons
+ This property holds the mouse buttons that the mouse region reacts to.
+
+ The available buttons are:
+ \list
+ \o Qt.LeftButton
+ \o Qt.RightButton
+ \o Qt.MiddleButton
+ \endlist
+
+ To accept more than one button the flags can be combined with the
+ "|" (or) operator:
+
+ \code
+ MouseRegion { acceptedButtons: Qt.LeftButton | Qt.RightButton }
+ \endcode
+
+ The default is to accept the Left button.
+*/
+Qt::MouseButtons QFxMouseRegion::acceptedButtons() const
+{
+ return acceptedMouseButtons();
+}
+
+void QFxMouseRegion::setAcceptedButtons(Qt::MouseButtons buttons)
+{
+ if (buttons != acceptedMouseButtons()) {
+ setAcceptedMouseButtons(buttons);
+ emit acceptedButtonsChanged();
+ }
+}
+
void QFxMouseRegion::setPressed(bool p)
{
Q_D(QFxMouseRegion);
diff --git a/src/declarative/fx/qfxmouseregion.h b/src/declarative/fx/qfxmouseregion.h
index 418434a..f2d22d3 100644
--- a/src/declarative/fx/qfxmouseregion.h
+++ b/src/declarative/fx/qfxmouseregion.h
@@ -55,11 +55,12 @@ class Q_DECLARATIVE_EXPORT QFxDrag : public QObject
Q_OBJECT
Q_PROPERTY(QFxItem *target READ target WRITE setTarget)
- Q_PROPERTY(QString axis READ axis WRITE setAxis)
- 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)
+ Q_PROPERTY(QString axis READ axis WRITE setAxis) //### enum
+ Q_PROPERTY(qreal minimumX READ xmin WRITE setXmin)
+ Q_PROPERTY(qreal maximumX READ xmax WRITE setXmax)
+ Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin)
+ Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax)
+ //### consider drag and drop
public:
QFxDrag(QObject *parent=0);
~QFxDrag();
@@ -97,8 +98,10 @@ class Q_DECLARATIVE_EXPORT QFxMouseRegion : public QFxItem
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)
- Q_PROPERTY(QFxDrag *drag READ drag)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
+ Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged)
+ Q_PROPERTY(QFxDrag *drag READ drag) //### add flicking to QFxDrag or add a QFxFlick ???
+ //### trackingEnabled?
public:
QFxMouseRegion(QFxItem *parent=0);
~QFxMouseRegion();
@@ -109,17 +112,22 @@ public:
bool isEnabled() const;
void setEnabled(bool);
- bool hovered();
- bool pressed();
+ bool hovered() const;
+ bool pressed() const;
void setHovered(bool);
void setPressed(bool);
+ Qt::MouseButtons acceptedButtons() const;
+ void setAcceptedButtons(Qt::MouseButtons buttons);
+
QFxDrag *drag();
Q_SIGNALS:
void hoveredChanged();
void pressedChanged();
+ void enabledChanged();
+ void acceptedButtonsChanged();
void positionChanged(QFxMouseEvent *mouse);
void pressed(QFxMouseEvent *mouse);
diff --git a/src/declarative/fx/qfxmouseregion_p.h b/src/declarative/fx/qfxmouseregion_p.h
index f03c334..1501a81 100644
--- a/src/declarative/fx/qfxmouseregion_p.h
+++ b/src/declarative/fx/qfxmouseregion_p.h
@@ -73,7 +73,7 @@ public:
void init()
{
Q_Q(QFxMouseRegion);
- q->setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
+ q->setAcceptedMouseButtons(Qt::LeftButton);
q->setAcceptHoverEvents(true);
}