KDE 4.4 PyKDE API Reference

- KDE's Python API

# ScrollWidget Class Reference

`from PyKDE4.plasma import *`

Inherits: QGraphicsWidget → QObject
Namespace: Plasma.ScrollWidget

## 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)
## Methods
| __init__ (self, QGraphicsWidget parent=0)
QSizeF | contentsSize (self)
| ensureItemVisible (self, QGraphicsItem item)
| ensureRectVisible (self, QRectF rect)
bool | eventFilter (self, QObject watched, QEvent event)
| focusInEvent (self, QFocusEvent event)
Qt::ScrollBarPolicy | horizontalScrollBarPolicy (self)
| mouseMoveEvent (self, QGraphicsSceneMouseEvent event)
| mousePressEvent (self, QGraphicsSceneMouseEvent event)
| mouseReleaseEvent (self, QGraphicsSceneMouseEvent event)
QWidget | nativeWidget (self)
| registerAsDragHandle (self, QGraphicsWidget item)
| resizeEvent (self, QGraphicsSceneResizeEvent event)
QPointF | scrollPosition (self)
| scrollStateChanged (self, QAbstractAnimation.State newState, QAbstractAnimation.State oldState)
| setHorizontalScrollBarPolicy (self, Qt::ScrollBarPolicy policy)
| setScrollPosition (self, QPointF position)
| setStyleSheet (self, QString stylesheet)
| setVerticalScrollBarPolicy (self, Qt::ScrollBarPolicy policy)
| setWidget (self, QGraphicsWidget widget)
QSizeF | sizeHint (self, Qt::SizeHint which, QSizeF constraint)
QString | styleSheet (self)
| unregisterAsDragHandle (self, QGraphicsWidget item)
Qt::ScrollBarPolicy | verticalScrollBarPolicy (self)
QRectF | viewportGeometry (self)
| wheelEvent (self, QGraphicsSceneWheelEvent event)
QGraphicsWidget | widget (self)

## Method Documentation

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

Constructs a new ScrollWidget

@arg parent the parent of this widget

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
| ) |  |  |

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

Returns:
  the horizontal scrollbar policy

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

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

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

QWidget nativeWidget | ( |  | self ) |

Returns:
  the native widget wrapped by this ScrollWidget

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.

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
| ) |  |  |

QPointF scrollPosition | ( |  | self ) |

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

Since:
  4.4

scrollStateChanged | ( | self, |
|  | QAbstractAnimation.State | newState,
|  | QAbstractAnimation.State | oldState
| ) |  |  |

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

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

Sets the horizontal scrollbar policy

@arg policy desired policy

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

Sets the position of the internal widget relative to this widget

Since:
  4.4

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

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

@arg stylesheet a CSS string

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

Sets the vertical scrollbar policy

@arg 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 will have an horizontal expand direction, it will be resized when possible, otherwise it will be keps to whichever width the widget resizes itself. The same thing it's true for the vertical size hint.

@arg widget the new main sub widget

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

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)

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