Home · All Classes · Main Classes · Deprecated
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties

MPannableWidget Class Reference

Base class which adds support for panning gesture. More...

Inherits MWidgetController.

Inherited by MPannableViewport.

List of all members.

Public Types

enum  PanningPolicy { PanningAlwaysOn, PanningAlwaysOff, PanningAsNeeded }

Public Slots

virtual void updatePosition (const QPointF &position)

Signals

void positionChanged (const QPointF &position)
void rangeChanged (const QRectF &range)
void panningStopped ()
void physicsChanged ()

Public Member Functions

 MPannableWidget (QGraphicsItem *parent=0)
virtual ~MPannableWidget ()
MPhysics2DPanningphysics () const
void setPhysics (MPhysics2DPanning *physics)
void setVerticalPanningPolicy (PanningPolicy policy)
void setHorizontalPanningPolicy (PanningPolicy policy)
PanningPolicy verticalPanningPolicy () const
PanningPolicy horizontalPanningPolicy () const
virtual void setRange (const QRectF &range)
virtual QRectF range () const
virtual void setPosition (const QPointF &position)
virtual QPointF position () const
virtual void setPanDirection (const Qt::Orientations &panDirection)
Qt::Orientations panDirection ()
Qt::Orientations panDirection () const
void setPanThreshold (qreal value)
qreal panThreshold ()

Protected Member Functions

 MPannableWidget (MPannableWidgetPrivate *dd, MPannableWidgetModel *model, QGraphicsItem *parent)

Properties

PanningPolicy verticalPanningPolicy
PanningPolicy horizontalPanningPolicy
Qt::Orientations panDirection
QRectF range
QPointF position
qreal panThreshold

Detailed Description

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.

See also:
MPhysics2DPanning, MPannableViewport

Member Enumeration Documentation

This enum contains possible values of a panning policy.

  • PanningAlwaysOn - the pannable widget will always react to pan gesture
  • PanningAlwaysOff - the pannable widget will never react to pan gesture
  • PanningAsNeeded - the pannable widget will only react to pan gesture if the panned widget is bigger than the viewport.
See also:
setHorizontalPanningPolicy, setVerticalPanningPolicy.
Enumerator:
PanningAlwaysOn 
PanningAlwaysOff 
PanningAsNeeded 

Constructor & Destructor Documentation

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.


Member Function Documentation

PanningPolicy MPannableWidget::horizontalPanningPolicy (  )  const

Returns the interactivity policy of the pannable widget.

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.

Deprecated:
Please use const version instead. Since 0.20.50
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.

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.

Note:
When range is zero along some axis, user can still make a panning gesture on that direction but the position snaps back to 0.0. If the range is shrank so that the current position goes to border, the border springs are activated.
void MPannableWidget::rangeChanged ( const QRectF range  )  [signal]

When panned range changes this signal is emitted.

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.

See also:
horizontalPanningPolicy and setPanDirection.
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.

See also:
setVerticalPanningPolicy and setHorizontalPanningPolicy.
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.

See also:
range.
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.

See also:
verticalPanningPolicy and setPanDirection.
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.


Property Documentation

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