KDE 4.9 PyKDE API Reference

- KDE's Python API

# ScrollWidget Class Reference

`from PyKDE4.plasma import *`

Inherits: QGraphicsWidget → QObject
Namespace: Plasma

## Detailed Description

ScrollWidget plasma/widgets/ScrollWidget.h <Plasma/Widgets/ScrollWidget>

A container of widgets that can have scrollbars

A container of widgets that can have horizontal and vertical scrollbars if the content is bigger than the widget itself

Since:
  4.3

## Signals

| scrollStateChanged (QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
| viewportGeometryChanged (QRectF geomety)

## Methods

| __init__ (self, QGraphicsWidget parent=0)
Qt::Alignment | alignment (self)
QSizeF | contentsSize (self)
| ensureItemVisible (self, QGraphicsItem item)
| ensureRectVisible (self, QRectF rect)
bool | eventFilter (self, QObject watched, QEvent event)
| focusInEvent (self, QFocusEvent event)
bool | hasOverShoot (self)
Qt::ScrollBarPolicy | horizontalScrollBarPolicy (self)
| keyPressEvent (self, QKeyEvent event)
| mouseMoveEvent (self, QGraphicsSceneMouseEvent event)
| mousePressEvent (self, QGraphicsSceneMouseEvent event)
| mouseReleaseEvent (self, QGraphicsSceneMouseEvent event)
QWidget | nativeWidget (self)
bool | overflowBordersVisible (self)
| registerAsDragHandle (self, QGraphicsWidget item)
| resizeEvent (self, QGraphicsSceneResizeEvent event)
bool | sceneEventFilter (self, QGraphicsItem i, QEvent e)
QPointF | scrollPosition (self)
| setAlignment (self, Qt::Alignment align)
| setHorizontalScrollBarPolicy (self, Qt::ScrollBarPolicy policy)
| setOverShoot (self, bool enable)
| setOverflowBordersVisible (self, bool visible)
| setScrollPosition (self, QPointF position)
| setSnapSize (self, QSizeF size)
| setStyleSheet (self, QString stylesheet)
| setVerticalScrollBarPolicy (self, Qt::ScrollBarPolicy policy)
| setWidget (self, QGraphicsWidget widget)
QSizeF | sizeHint (self, Qt::SizeHint which, QSizeF constraint)
QSizeF | snapSize (self)
QString | styleSheet (self)
| unregisterAsDragHandle (self, QGraphicsWidget item)
Qt::ScrollBarPolicy | verticalScrollBarPolicy (self)
QRectF | viewportGeometry (self)
| wheelEvent (self, QGraphicsSceneWheelEvent event)
QGraphicsWidget | widget (self)

## Signal Documentation

scrollStateChanged | ( | QAbstractAnimation::State | newState,
|  | QAbstractAnimation::State | oldState
| ) |  |  |

The widget started or stopped an animated scroll

Since:
  4.4

Signal syntax:
  `QObject.connect(source, SIGNAL("scrollStateChanged(QAbstractAnimation::State, QAbstractAnimation::State)"), target_slot)`

viewportGeometryChanged | ( | QRectF | geomety
| ) |  |  |

The viewport geomety changed, for instance due a widget resize

Since:
  4.5

Signal syntax:
  `QObject.connect(source, SIGNAL("viewportGeometryChanged(const QRectF&)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QGraphicsWidget | parent=0
| ) |  |  |

Constructs a new ScrollWidget

Parameters:

  | parent | the parent of this widget

Qt::Alignment alignment | ( |  | self ) |

Returns:
  currently set alignment for the inner widget

Since:
  4.5

QSizeF contentsSize | ( |  | self ) |

Returns:
  the size of the internal widget

Since:
  4.4

ensureItemVisible | ( | self, |
|  | QGraphicsItem | item
| ) |  |  |

Scroll the view until the given item is visible

Parameters:

  | item | item we want visible

Since:
  4.4

ensureRectVisible | ( | self, |
|  | QRectF | rect
| ) |  |  |

Scroll the view until the given rectangle is visible

Parameters:

  | rect | rect we want visible, in coordinates mapped to the inner widget

Since:
  4.4

bool eventFilter | ( | self, |
|  | QObject | watched,
|  | QEvent | event
| ) |  |  |

focusInEvent | ( | self, |
|  | QFocusEvent | event
| ) |  |  |

bool hasOverShoot | ( |  | self ) |

Returns:
  true if overshoot is enabled

Since:
  4.5

Qt::ScrollBarPolicy horizontalScrollBarPolicy | ( |  | self ) |

Returns:
  the horizontal scrollbar policy

keyPressEvent | ( | self, |
|  | QKeyEvent | event
| ) |  |  |

mouseMoveEvent | ( | self, |
|  | QGraphicsSceneMouseEvent | event
| ) |  |  |

mousePressEvent | ( | self, |
|  | QGraphicsSceneMouseEvent | event
| ) |  |  |

mouseReleaseEvent | ( | self, |
|  | QGraphicsSceneMouseEvent | event
| ) |  |  |

QWidget nativeWidget | ( |  | self ) |

Returns:
  the native widget wrapped by this ScrollWidget

bool overflowBordersVisible | ( |  | self ) |

Returns:
  true if the widget shows borders when the inner widget is bigger than the viewport

Since:
  4.6

registerAsDragHandle | ( | self, |
|  | QGraphicsWidget | item
| ) |  |  |

Register an item as a drag handle, it means mouse events will pass trough it and will be possible to drag the view by dragging the item itself. The item will still receive mouse clicks if the mouse didn't move between press and release.

This function is no more necessary, since it's the authomatic behaviour for all children items, the implementation has now no effect

Parameters:

  | item | the drag handle item. widget() must be an ancestor if it in the parent hierarchy. if item doesn't accept mose press events it's not necessary to call this function.

Since:
  4.4

resizeEvent | ( | self, |
|  | QGraphicsSceneResizeEvent | event
| ) |  |  |

bool sceneEventFilter | ( | self, |
|  | QGraphicsItem | i,
|  | QEvent | e
| ) |  |  |

QPointF scrollPosition | ( |  | self ) |

Returns:
  the position of the internal widget relative to this widget

Since:
  4.4

setAlignment | ( | self, |
|  | Qt::Alignment | align
| ) |  |  |

Sets the alignment for the inner widget. It is only meaningful if the inner widget is smaller than the viewport.

Since:
  4.5

setHorizontalScrollBarPolicy | ( | self, |
|  | Qt::ScrollBarPolicy | policy
| ) |  |  |

Sets the horizontal scrollbar policy

Parameters:

  | policy | desired policy

setOverShoot | ( | self, |
|  | bool | enable
| ) |  |  |

Tells the scrollwidget whether the widget can scroll a little beyond its boundaries and then automatically snap back or whether the widget scrolling always stops at the edges.

Since:
  4.5

setOverflowBordersVisible | ( | self, |
|  | bool | visible
| ) |  |  |

Sets whether borders should be shown when the inner widget is bigger than the viewport

Parameters:

  | visible | true if the border should be visible when the inner widget overflows

Since:
  4.6

setScrollPosition | ( | self, |
|  | QPointF | position
| ) |  |  |

Sets the position of the internal widget relative to this widget

Since:
  4.4

setSnapSize | ( | self, |
|  | QSizeF | size
| ) |  |  |

Set the nap size of the kinetic scrolling: the scrolling will always stop at multiples of that size.

Parameters:

  | the | desired snap size

Since:
  4.5

setStyleSheet | ( | self, |
|  | QString | stylesheet
| ) |  |  |

Sets the stylesheet used to control the visual display of this ScrollWidget

Parameters:

  | stylesheet | a CSS string

setVerticalScrollBarPolicy | ( | self, |
|  | Qt::ScrollBarPolicy | policy
| ) |  |  |

Sets the vertical scrollbar policy

Parameters:

  | policy | desired policy

setWidget | ( | self, |
|  | QGraphicsWidget | widget
| ) |  |  |

Sets the widget this ScrollWidget will contain ownership is transferred to this scrollwidget, if an old one was already in, it will be deleted. If the widget size policy allows for horizontal and/or vertical expansion, it will be resized when possible, otherwise it will be kept to whichever width the widget resizes itself.

Parameters:

  | widget | the new main sub widget

QSizeF sizeHint | ( | self, |
|  | Qt::SizeHint | which,
|  | QSizeF | constraint
| ) |  |  |

QSizeF snapSize | ( |  | self ) |

Returns:
  the snap size of the kinetic scrolling

Since:
  4.5

QString styleSheet | ( |  | self ) |

Returns:
  the stylesheet currently used with this widget

unregisterAsDragHandle | ( | self, |
|  | QGraphicsWidget | item
| ) |  |  |

Unregister the given item as drag handle (if it was registered)

This function is no more necessary, since it's the authomatic behaviour for all children items, the implementation has now no effect

Since:
  4.4

Qt::ScrollBarPolicy verticalScrollBarPolicy | ( |  | self ) |

Returns:
  the vertical scrollbar policy

QRectF viewportGeometry | ( |  | self ) |

The geometry of the viewport.

Since:
  4.4

wheelEvent | ( | self, |
|  | QGraphicsSceneWheelEvent | event
| ) |  |  |

QGraphicsWidget widget | ( |  | self ) |

Returns:
  the main widget