KDE 4.7 PyKDE API Reference

- KDE's Python API

# KTextBrowser Class Reference

`from PyKDE4.kdeui import *`

Inherits: QTextBrowser → QTextEdit → QAbstractScrollArea → QFrame → QWidget → QObject

## Detailed Description

Extended QTextBrowser.

An extended QTextBrowser.

By default it will invoke the system mailer or the system browser when a link is activated, or it can emit the signal urlClick() or mailClick() when a link is activated.

If the link starts with the text "whatsthis:" a QWhatsThis box will appear and then display the rest of the text.

"KDE Text Browser"

Author:
  Espen Sand (espensa@online.no)

## Signals
| mailClick (QString name, QString address)
| urlClick (QString url)
## Methods
| __init__ (self, QWidget parent=0, bool notifyClick=0)
| contextMenuEvent (self, QContextMenuEvent event)
bool | isNotifyClick (self)
| keyPressEvent (self, QKeyEvent event)
| setNotifyClick (self, bool notifyClick)
| setSource (self, QUrl name)
| wheelEvent (self, QWheelEvent event)

## Signal Documentation

mailClick | ( | QString | name,
|  | QString | address
| ) |  |  |

Emitted when a mail link has been activated and the widget has been configured to emit the signal.

Parameters:

  | name | The destination name. It is QString() at the moment.
  | address | The destination address.

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

urlClick | ( | QString | url
| ) |  |  |

Emitted if mailClick() is not emitted and the widget has been configured to emit the signal.

Parameters:

  | url | The destination address.

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

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0,
|  | bool | notifyClick=0
| ) |  |  |

Creates a new text browser.

Parameters:

  | parent | Parent of the widget.
  | notifyClick | true causes signals to be emitted.

contextMenuEvent | ( | self, |
|  | QContextMenuEvent | event
| ) |  |  |

Re-implemented for internal reasons. API not affected.

See QLineEdit.createPopupMenu().

bool isNotifyClick | ( |  | self ) |

Returns whether a click on a link should be handled internally or if a signal should be emitted.

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

Makes sure Key_Escape is ignored

setNotifyClick | ( | self, |
|  | bool | notifyClick
| ) |  |  |

Decide whether a click on a link should be handled internally or if a signal should be emitted.

Parameters:

  | notifyClick | true causes signals to be emitted.

setSource | ( | self, |
|  | QUrl | name
| ) |  |  |

Reimplemented to NOT set the source but to do the special handling of links being clicked. Do not call this.

If you need to set an initial source url in the text browser, call the QTextBrowser method explicitly, like this: <code>myTextBrowser->QTextBrowser.setSource(url)</code>

wheelEvent | ( | self, |
|  | QWheelEvent | event
| ) |  |  |

Reimplemented to support Qt2 behavior (Ctrl-Wheel = fast scroll)