KDE 4.5 PyKDE API Reference

- KDE's Python API

# KHTMLView Class Reference

`from PyKDE4.khtml import *`

Inherits: QScrollArea → QAbstractScrollArea → QFrame → QWidget → QObject

## Detailed Description

Renders and displays HTML in a QScrollArea.

Suitable for use as an application's main view.

## Enumerations
SmoothScrollingMode | { SSMDisabled, SSMWhenEfficient, SSMEnabled }
## Signals
| cleared ()
| findAheadActive (bool a0)
| finishedLayout ()
| hideAccessKeys ()
| repaintAccessKeys ()
| zoomView (int a0)
## Methods
| __init__ (self, KHTMLPart part, QWidget parent)
| addChild (self, QWidget child, int dx, int dy)
| clear (self)
| closeEvent (self, QCloseEvent a0)
int | contentsHeight (self)
QPoint | contentsToViewport (self, QPoint p)
int cx, int cy | contentsToViewport (self, int x, int y)
int | contentsWidth (self)
int | contentsX (self)
int | contentsY (self)
| displayAccessKeys (self)
| doAutoScroll (self)
| dragEnterEvent (self, QDragEnterEvent a0)
| dropEvent (self, QDropEvent a0)
bool | event (self, QEvent event)
bool | eventFilter (self, QObject a0, QEvent a1)
| focusInEvent (self, QFocusEvent a0)
bool | focusNextPrevChild (self, bool next)
| focusOutEvent (self, QFocusEvent a0)
int | frameWidth (self)
| hideEvent (self, QHideEvent a0)
| keyPressEvent (self, QKeyEvent _ke)
| keyReleaseEvent (self, QKeyEvent _ke)
| layout (self)
int | marginHeight (self)
int | marginWidth (self)
| mouseDoubleClickEvent (self, QMouseEvent a0)
| mouseMoveEvent (self, QMouseEvent a0)
| mousePressEvent (self, QMouseEvent a0)
| mouseReleaseEvent (self, QMouseEvent a0)
| paintEvent (self, QPaintEvent a0)
KHTMLPart | part (self)
| print_ (self, bool quick=0)
| repaintContents (self, QRect r)
| repaintContents (self, int x, int y, int w, int h)
| resizeContents (self, int w, int h)
| resizeEvent (self, QResizeEvent event)
| scrollBy (self, int x, int y)
| scrollContentsBy (self, int dx, int dy)
| setContentsPos (self, int x, int y)
| setHorizontalScrollBarPolicy (self, Qt::ScrollBarPolicy policy)
| setMarginHeight (self, int y)
| setMarginWidth (self, int x)
| setSmoothScrollingMode (self, KHTMLView.SmoothScrollingMode m)
| setSmoothScrollingModeDefault (self, KHTMLView.SmoothScrollingMode m)
| setVerticalScrollBarPolicy (self, Qt::ScrollBarPolicy policy)
| setZoomLevel (self, int percent)
| showEvent (self, QShowEvent a0)
| slotPaletteChanged (self)
KHTMLView.SmoothScrollingMode | smoothScrollingMode (self)
| timerEvent (self, QTimerEvent a0)
| updateContents (self, QRect r)
| updateContents (self, int x, int y, int w, int h)
bool | viewportEvent (self, QEvent e)
QPoint | viewportToContents (self, QPoint p)
int cx, int cy | viewportToContents (self, int x, int y)
int | visibleHeight (self)
int | visibleWidth (self)
| wheelEvent (self, QWheelEvent a0)
bool | widgetEvent (self, QEvent a0)
int | zoomLevel (self)

## Signal Documentation

cleared | ( |  | ) |

Signal syntax:
  `QObject.connect(source, SIGNAL("cleared()"), target_slot)`

findAheadActive | ( | bool | a0
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("findAheadActive(bool)"), target_slot)`

finishedLayout | ( |  | ) |

This signal is used for internal layouting. Don't use it to check if rendering finished. Use KHTMLPart completed() signal instead.

Signal syntax:
  `QObject.connect(source, SIGNAL("finishedLayout()"), target_slot)`

hideAccessKeys | ( |  | ) |

Signal syntax:
  `QObject.connect(source, SIGNAL("hideAccessKeys()"), target_slot)`

repaintAccessKeys | ( |  | ) |

Signal syntax:
  `QObject.connect(source, SIGNAL("repaintAccessKeys()"), target_slot)`

zoomView | ( | int | a0
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("zoomView(int)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | KHTMLPart | part,
|  | QWidget | parent
| ) |  |  |

Constructs a KHTMLView.

addChild | ( | self, |
|  | QWidget | child,
|  | int | dx,
|  | int | dy
| ) |  |  |

clear | ( |  | self ) |

closeEvent | ( | self, |
|  | QCloseEvent | a0
| ) |  |  |

int contentsHeight | ( |  | self ) |

Returns the contents area's height

QPoint contentsToViewport | ( | self, |
|  | QPoint | p
| ) |  |  |

Returns a point translated to viewport coordinates

Parameters:

  | x | x coordinate of contents area point to translate
  | y | y coordinate of contents area point to translate
  | cx | resulting x coordinate
  | cy | resulting y coordinate

int cx, int cy contentsToViewport | ( | self, |
|  | int | x,
|  | int | y
| ) |  |  |

Returns a point translated to viewport coordinates

Parameters:

  | x | x coordinate of contents area point to translate
  | y | y coordinate of contents area point to translate
  | cx | resulting x coordinate
  | cy | resulting y coordinate

int contentsWidth | ( |  | self ) |

Returns the contents area's width

int contentsX | ( |  | self ) |

Returns the x coordinate of the contents area point that is currently located at the top left in the viewport

int contentsY | ( |  | self ) |

Returns the y coordinate of the contents area point that is currently located at the top left in the viewport

displayAccessKeys | ( |  | self ) |

Display all accesskeys in small tooltips

doAutoScroll | ( |  | self ) |

dragEnterEvent | ( | self, |
|  | QDragEnterEvent | a0
| ) |  |  |

dropEvent | ( | self, |
|  | QDropEvent | a0
| ) |  |  |

bool event | ( | self, |
|  | QEvent | event
| ) |  |  |

bool eventFilter | ( | self, |
|  | QObject | a0,
|  | QEvent | a1
| ) |  |  |

focusInEvent | ( | self, |
|  | QFocusEvent | a0
| ) |  |  |

bool focusNextPrevChild | ( | self, |
|  | bool | next
| ) |  |  |

focusOutEvent | ( | self, |
|  | QFocusEvent | a0
| ) |  |  |

int frameWidth | ( |  | self ) |

hideEvent | ( | self, |
|  | QHideEvent | a0
| ) |  |  |

keyPressEvent | ( | self, |
|  | QKeyEvent | _ke
| ) |  |  |

keyReleaseEvent | ( | self, |
|  | QKeyEvent | _ke
| ) |  |  |

layout | ( |  | self ) |

ensure the display is up to date

int marginHeight | ( |  | self ) |

Returns the margin height.

A return value of -1 means the default value will be used.

int marginWidth | ( |  | self ) |

Returns the margin width.

A return value of -1 means the default value will be used.

mouseDoubleClickEvent | ( | self, |
|  | QMouseEvent | a0
| ) |  |  |

mouseMoveEvent | ( | self, |
|  | QMouseEvent | a0
| ) |  |  |

mousePressEvent | ( | self, |
|  | QMouseEvent | a0
| ) |  |  |

mouseReleaseEvent | ( | self, |
|  | QMouseEvent | a0
| ) |  |  |

paintEvent | ( | self, |
|  | QPaintEvent | a0
| ) |  |  |

KHTMLPart part | ( |  | self ) |

Returns a pointer to the KHTMLPart that is rendering the page.

print_ | ( | self, |
|  | bool | quick=0
| ) |  |  |

Prints the HTML document.

Parameters:

  | quick | if true, fully automated printing, without print dialog

repaintContents | ( | self, |
|  | QRect | r
| ) |  |  |

Requests an immediate repaint of the content area

Parameters:

  | r | the content area rectangle to repaint

repaintContents | ( | self, |
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h
| ) |  |  |

Requests an immediate repaint of the content area

Parameters:

  | r | the content area rectangle to repaint

resizeContents | ( | self, |
|  | int | w,
|  | int | h
| ) |  |  |

Resize the contents area

Parameters:

  | w | the new width
  | h | the new height

resizeEvent | ( | self, |
|  | QResizeEvent | event
| ) |  |  |

scrollBy | ( | self, |
|  | int | x,
|  | int | y
| ) |  |  |

Scrolls the content area by a given amount

Parameters:

  | x | x offset
  | y | y offset

scrollContentsBy | ( | self, |
|  | int | dx,
|  | int | dy
| ) |  |  |

setContentsPos | ( | self, |
|  | int | x,
|  | int | y
| ) |  |  |

Place the contents area point x/y at the top left of the viewport

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

Sets horizontal scrollbar mode.

WARNING: do not call this method on a base class pointer unless you specifically want QAbstractScrollArea's variant (not recommended). QAbstractScrollArea.setHorizontalScrollBarPolicy is *not* virtual.

setMarginHeight | ( | self, |
|  | int | y
| ) |  |  |

setMarginWidth | ( | self, |
|  | int | x
| ) |  |  |

Sets a margin in x direction.

setSmoothScrollingMode | ( | self, |
|  | KHTMLView.SmoothScrollingMode | m
| ) |  |  |

Set the smooth scrolling mode.

Smooth scrolling mode is normally controlled by the configuration file's SmoothScrolling key. Using this setter will override the configuration file's settings.

Since:
  4.1

setSmoothScrollingModeDefault | ( | self, |
|  | KHTMLView.SmoothScrollingMode | m
| ) |  |  |

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

Sets vertical scrollbar mode.

WARNING: do not call this method on a base class pointer unless you specifically want QAbstractScrollArea's variant (not recommended). QAbstractScrollArea.setVerticalScrollBarPolicy is *not* virtual.

setZoomLevel | ( | self, |
|  | int | percent
| ) |  |  |

Apply a zoom level to the content area

Parameters:

  | percent | a zoom level expressed as a percentage

showEvent | ( | self, |
|  | QShowEvent | a0
| ) |  |  |

slotPaletteChanged | ( |  | self ) |

KHTMLView.SmoothScrollingMode smoothScrollingMode | ( |  | self ) |

Retrieve the current smooth scrolling mode

Since:
  4.1

timerEvent | ( | self, |
|  | QTimerEvent | a0
| ) |  |  |

updateContents | ( | self, |
|  | QRect | r
| ) |  |  |

Requests an update of the content area

Parameters:

  | r | the content area rectangle to update

updateContents | ( | self, |
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h
| ) |  |  |

Requests an update of the content area

Parameters:

  | r | the content area rectangle to update

bool viewportEvent | ( | self, |
|  | QEvent | e
| ) |  |  |

QPoint viewportToContents | ( | self, |
|  | QPoint | p
| ) |  |  |

Returns a point translated to contents area coordinates

Parameters:

  | x | x coordinate of viewport point to translate
  | y | y coordinate of viewport point to translate
  | cx | resulting x coordinate
  | cy | resulting y coordinate

int cx, int cy viewportToContents | ( | self, |
|  | int | x,
|  | int | y
| ) |  |  |

Returns a point translated to contents area coordinates

Parameters:

  | x | x coordinate of viewport point to translate
  | y | y coordinate of viewport point to translate
  | cx | resulting x coordinate
  | cy | resulting y coordinate

int visibleHeight | ( |  | self ) |

Returns the height of the viewport

int visibleWidth | ( |  | self ) |

Returns the width of the viewport

wheelEvent | ( | self, |
|  | QWheelEvent | a0
| ) |  |  |

bool widgetEvent | ( | self, |
|  | QEvent | a0
| ) |  |  |

int zoomLevel | ( |  | self ) |

Retrieve the current zoom level

## Enumeration Documentation

SmoothScrollingMode

Smooth Scrolling Mode enumeration

- SSMDisabled smooth scrolling is disabled
- SSMWhenEfficient only use smooth scrolling on pages that do not require a full repaint of the content area when scrolling
- SSMAlways smooth scrolling is performed unconditionally

Enumerator:

  SSMDisabled = 0 |
  SSMWhenEfficient |
  SSMEnabled |