Home · All Classes · Main Classes · Deprecated |
Base class which adds support for panning gesture. More...
Inherits MWidgetController.
Inherited by MPannableViewport.
Base class which adds support for panning gesture.
MPannableWidget creates a glass on top of itself and using the glass, intercepts events coming from QGraphicsScene onto its area and interprets them. If the events form a panning gesture, a physics class is used to create a natural Newtonian movement in the direction of panning. Panning position is provided as an overridable slot updatePosition(). If the events don't form a panning gesture, they are forwarded underneath the glass.
In order to change the current position of the viewport the user can call setPosition() method. When this is done, integration engine is started and in case that the position is outside specified bounds, the physics engine will start spring action to move the viewport to the allowed borders.
The physics engine object can be obtained by calling physics() method.
This enum contains possible values of a panning policy.
MPannableWidget::MPannableWidget | ( | QGraphicsItem * | parent = 0 |
) |
Constructs a pannable widget with a parent.
MPannableWidget::~MPannableWidget | ( | ) | [virtual] |
Destroys the pannable widget.
MPannableWidget::MPannableWidget | ( | MPannableWidgetPrivate * | dd, | |
MPannableWidgetModel * | model, | |||
QGraphicsItem * | parent | |||
) | [protected] |
Protected constructor for derived classes.
bool MPannableWidget::acceptGesturesFromAnyDirection | ( | ) | const |
PanningPolicy MPannableWidget::horizontalPanningPolicy | ( | ) | const |
Returns the interactivity policy of the pannable widget.
Qt::Orientations MPannableWidget::panDirection | ( | ) | const |
Returns the enabled panning directions.
A panning direction is enabled if the policy of panning for that direction is either PanningAlwaysOn or PanningAsNeeded.
By default, the panning is enabled in Qt::Vertical direction.
Qt::Orientations MPannableWidget::panDirection | ( | ) |
Returns the enabled panning directions.
A panning direction is enabled if the policy of panning for that direction is either PanningAlwaysOn or PanningAsNeeded.
By default, the panning is enabled in Qt::Vertical direction.
void MPannableWidget::panningStopped | ( | ) | [signal] |
Signals that the panning has stopped.
qreal MPannableWidget::panThreshold | ( | ) |
Deprecated since 0.20.
MPhysics2DPanning * MPannableWidget::physics | ( | ) | const |
Returns the physics class instance used in panning.
void MPannableWidget::physicsChanged | ( | ) | [signal] |
Signals that physics engine changed.
virtual QPointF MPannableWidget::position | ( | ) | const [virtual] |
Returns the current position of the panning.
void MPannableWidget::positionChanged | ( | const QPointF & | position | ) | [signal] |
This signal is emitted when the position of the viewport changes.
virtual QRectF MPannableWidget::range | ( | ) | const [virtual] |
Returns the range of panning.
The range of panning defines the allowed positions of the viewport over the panned widget. The panning range is smaller than the panned widget size by the size of the viewport.
void MPannableWidget::rangeChanged | ( | const QRectF & | range | ) | [signal] |
When panned range changes this signal is emitted.
void MPannableWidget::setAcceptGesturesFromAnyDirection | ( | bool | accept | ) |
Sets if pannable widget should accept pan gestures from all directions.
By default, the pan gesture is accepted only if its direction corresponds with the panning policies.
When enabled, all pan gestures are accepted. Useful when your pannable widget is not embedded in another one as it will be more responsive to user’s gestures. I.e. a vertical-only panning widget will work also if the user starts his gesture horizontally and then drags his finger vertically.
If disabled (its default value), only pan gestures whose initial direction is pannable (according to MPannableWidget’s panning policy) will be accepted. For instance: a pannable widget whose vertical panning policy is PanningAlwaysOn and horizontal panning policy is PanningAlwaysOff will accept pan gestures that start vertically but will ignore the ones that start horizontally. This is useful when you have nested pannable widgets of different directions (a horizontal panning widget embedded in a vertical panning one).
accept | accepts pan gestures from any direction. |
void MPannableWidget::setHorizontalPanningPolicy | ( | PanningPolicy | policy | ) |
Sets the horizontal panning policy of the pannable widget.
This method allows for finegrained control over the panning functionality in the MPannableWidget. The policy argument will define the result of a horizontal pan gesture executed over pannable widget.
This method does not reset vertical panning policy.
void MPannableWidget::setPanDirection | ( | const Qt::Orientations & | panDirection | ) | [virtual] |
Sets the enabled panning directions.
This method allows enabling or disabling panning directions of the pannable widget. It is an equivalent of methods for setting panning policies: enabling a panning direction has the same effect as setting PanningAlwaysOn policy for that direction.Disabling a panning direction is exactly the same as setting PanningAlwaysOff policy.
The accepted values are Qt::Horizontal and/or Qt::Vertical.
void MPannableWidget::setPanThreshold | ( | qreal | value | ) |
Deprecated since 0.20.
void MPannableWidget::setPhysics | ( | MPhysics2DPanning * | physics | ) |
Sets the physics engine object used when the widget is panning the view.
This method can be used to modify the behaviour of the widget so that the kinetic panning effect is different than default.
The MPannableWidget will take ownership of the physics engine object.
void MPannableWidget::setPosition | ( | const QPointF & | position | ) | [virtual] |
Sets the position of the panning.
If the new position is in the border, the border springs are activated.
By default, the position is QPointF(0,0).
void MPannableWidget::setRange | ( | const QRectF & | range | ) | [virtual] |
Sets the range of panning.
void MPannableWidget::setVerticalPanningPolicy | ( | PanningPolicy | policy | ) |
Sets the vertical panning policy of the pannable widget.
This method allows for finegrained control over the panning functionality in the MPannableWidget. The policy argument will define the result of a vertical pan gesture executed over pannable widget.
This method does not reset horizontal panning policy.
void MPannableWidget::updatePosition | ( | const QPointF & | position | ) | [virtual, slot] |
Virtual slot for receiving position changes from physics.
Reimplemented in MPannableViewport.
PanningPolicy MPannableWidget::verticalPanningPolicy | ( | ) | const |
Returns the vertical interactivity policy of the pannable widget.
bool MPannableWidget::acceptGesturesFromAnyDirection [read, write] |
Ignore panning direction flag.
MPannableWidget::PanningPolicy MPannableWidget::horizontalPanningPolicy [read, write] |
Horizontal panning policy status.
Qt::Orientations MPannableWidget::panDirection [read, write] |
Enabled panning directions.
qreal MPannableWidget::panThreshold [read, write] |
Panning threshold.
QPointF MPannableWidget::position [read, write] |
Panning position.
QRectF MPannableWidget::range [read, write] |
Panning range.
Reimplemented in MPannableViewport.
MPannableWidget::PanningPolicy MPannableWidget::verticalPanningPolicy [read, write] |
Vertical panning policy status.
Copyright © 2010 Nokia Corporation | MeeGo Touch |