Eneboo - Documentación para desarrolladores
Slots públicos | Señales | Métodos públicos | Métodos protegidos | Propiedades
Referencia de la Clase QTextBrowser

The QTextBrowser class provides a rich text browser with hypertext navigation. Más...

#include <qtextbrowser.h>

Diagrama de herencias de QTextBrowser
QTextEdit QTextEdit QScrollView QScrollView QScrollView QScrollView QFrame QFrame QFrame QFrame QFrame QFrame QFrame QFrame

Lista de todos los miembros.

Slots públicos

virtual void setSource (const QString &name)
virtual void backward ()
virtual void forward ()
virtual void home ()
virtual void reload ()
void setText (const QString &txt)
virtual void setText (const QString &txt, const QString &context)
virtual void setSource (const QString &name)
virtual void backward ()
virtual void forward ()
virtual void home ()
virtual void reload ()
void setText (const QString &txt)
virtual void setText (const QString &txt, const QString &context)

Señales

void backwardAvailable (bool)
void forwardAvailable (bool)
void sourceChanged (const QString &)
void highlighted (const QString &)
void linkClicked (const QString &)
void anchorClicked (const QString &, const QString &)
void backwardAvailable (bool)
void forwardAvailable (bool)
void sourceChanged (const QString &)
void highlighted (const QString &)
void linkClicked (const QString &)
void anchorClicked (const QString &, const QString &)

Métodos públicos

 QTextBrowser (QWidget *parent=0, const char *name=0)
 ~QTextBrowser ()
QString source () const
 QTextBrowser (QWidget *parent=0, const char *name=0)
 ~QTextBrowser ()
QString source () const

Métodos protegidos

void keyPressEvent (QKeyEvent *e)
void keyPressEvent (QKeyEvent *e)

Propiedades

QString source
 the name of the displayed document.

Descripción detallada

The QTextBrowser class provides a rich text browser with hypertext navigation.

This class extends QTextEdit (in read-only mode), adding some navigation functionality so that users can follow links in hypertext documents. The contents of QTextEdit is set with setText(), but QTextBrowser has an additional function, setSource(), which makes it possible to set the text to a named document. The name is looked up in the text view's mime source factory. If a document name ends with an anchor (for example, "\c #anchor"), the text browser automatically scrolls to that position (using scrollToAnchor()). When the user clicks on a hyperlink, the browser will call setSource() itself, with the link's href value as argument. You can track the current source by connetion to the sourceChanged() signal.

QTextBrowser provides backward() and forward() slots which you can use to implement Back and Forward buttons. The home() slot sets the text to the very first document displayed. The linkClicked() signal is emitted when the user clicks a link.

By using QTextEdit::setMimeSourceFactory() you can provide your own subclass of QMimeSourceFactory. This makes it possible to access data from anywhere, for example from a network or from a database. See QMimeSourceFactory::data() for details.

If you intend using the mime factory to read the data directly from the file system, you may have to specify the encoding for the file extension you are using. For example:

    mimeSourceFactory()->setExtensionType("qml", "text/utf8");

This is to ensure that the factory is able to resolve the document names.

QTextBrowser interprets the tags it processes in accordance with the default style sheet. Change the style sheet with {setStyleSheet()}; see QStyleSheet for details.

If you want to provide your users with editable rich text use QTextEdit. If you want a text browser without hypertext navigation use QTextEdit, and use QTextEdit::setReadOnly() to disable editing. If you just need to display a small piece of rich text use QSimpleRichText or QLabel.

qtextbrowser-m.png
qtextbrowser-w.png

Documentación del constructor y destructor

QTextBrowser::QTextBrowser ( QWidget parent = 0,
const char *  name = 0 
)

Constructs an empty QTextBrowser called name, with parent parent.

QTextBrowser::~QTextBrowser ( )
QTextBrowser::QTextBrowser ( QWidget parent = 0,
const char *  name = 0 
)
QTextBrowser::~QTextBrowser ( )

Documentación de las funciones miembro

void QTextBrowser::anchorClicked ( const QString name,
const QString link 
) [signal]

This signal is emitted when the user clicks an anchor. The link is the value of the href i.e. the name of the target document. The name is the name of the anchor.

Ver también:
linkClicked()
void QTextBrowser::anchorClicked ( const QString ,
const QString  
) [signal]
virtual void QTextBrowser::backward ( ) [virtual, slot]
void QTextBrowser::backward ( ) [virtual, slot]

Changes the document displayed to the previous document in the list of documents built by navigating links. Does nothing if there is no previous document.

Ver también:
forward(), backwardAvailable()
void QTextBrowser::backwardAvailable ( bool  available) [signal]

This signal is emitted when the availability of backward() changes. available is FALSE when the user is at home(); otherwise it is TRUE.

void QTextBrowser::backwardAvailable ( bool  ) [signal]
void QTextBrowser::forward ( ) [virtual, slot]

Changes the document displayed to the next document in the list of documents built by navigating links. Does nothing if there is no next document.

Ver también:
backward(), forwardAvailable()
virtual void QTextBrowser::forward ( ) [virtual, slot]
void QTextBrowser::forwardAvailable ( bool  available) [signal]

This signal is emitted when the availability of forward() changes. available is TRUE after the user navigates backward() and FALSE when the user navigates or goes forward().

void QTextBrowser::forwardAvailable ( bool  ) [signal]
void QTextBrowser::highlighted ( const QString ) [signal]
void QTextBrowser::highlighted ( const QString link) [signal]

This signal is emitted when the user has selected but not activated a link in the document. link is the value of the href i.e. the name of the target document.

void QTextBrowser::home ( ) [virtual, slot]

Changes the document displayed to be the first document the browser displayed.

virtual void QTextBrowser::home ( ) [virtual, slot]
void QTextBrowser::keyPressEvent ( QKeyEvent e) [protected, virtual]

Processes the key event, e. By default key events are used to provide keyboard navigation and text editing.

Reimplementado de QTextEdit.

void QTextBrowser::keyPressEvent ( QKeyEvent e) [protected, virtual]

The event e is used to provide the following keyboard shortcuts: Keypress Action Alt+Left Arrow backward() Alt+Right Arrow forward() Alt+Up Arrow home()

Reimplementado de QTextEdit.

void QTextBrowser::linkClicked ( const QString ) [signal]
void QTextBrowser::linkClicked ( const QString link) [signal]

This signal is emitted when the user clicks a link. The link is the value of the href i.e. the name of the target document.

The link will be the absolute location of the document, based on the value of the anchor's href tag and the current context of the document.

Ver también:
anchorClicked(), context()
void QTextBrowser::reload ( ) [virtual, slot]

Reloads the current set source.

virtual void QTextBrowser::reload ( ) [virtual, slot]
virtual void QTextBrowser::setSource ( const QString name) [virtual, slot]
void QTextBrowser::setSource ( const QString name) [virtual, slot]
void QTextBrowser::setText ( const QString txt) [inline, slot]

Reimplementado de QTextEdit.

void QTextBrowser::setText ( const QString txt,
const QString context 
) [virtual, slot]

Reimplementado de QTextEdit.

void QTextBrowser::setText ( const QString txt) [inline, slot]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the text to txt.

Reimplementado de QTextEdit.

virtual void QTextBrowser::setText ( const QString text,
const QString context 
) [virtual, slot]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Changes the text of the text edit to the string text and the context to context. Any previous text is removed.

text may be interpreted either as plain text or as rich text, depending on the textFormat(). The default setting is AutoText, i.e. the text edit auto-detects the format from text.

For rich text the rendering style and available tags are defined by a styleSheet(); see QStyleSheet for details.

The optional context is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. (See {QTextEdit::QTextEdit()}.) It is passed to the text edit's QMimeSourceFactory when quering data.

Note that the undo/redo history is cleared by this function.

Ver también:
text(), setTextFormat()

Reimplementado de QTextEdit.

QString QTextBrowser::source ( ) const
QString QTextBrowser::source ( ) const
void QTextBrowser::sourceChanged ( const QString ) [signal]
void QTextBrowser::sourceChanged ( const QString src) [signal]

This signal is emitted when the mime source has changed, src being the new source.

Source changes happen both programmatically when calling setSource(), forward(), backword() or home() or when the user clicks on links or presses the equivalent key sequences.


Documentación de propiedades

QString QTextBrowser::source [read, write]

the name of the displayed document.

This is a QString::null if no document is displayed or if the source is unknown.

Setting this property uses the mimeSourceFactory() to lookup the named document. It also checks for optional anchors and scrolls the document accordingly.

If the first tag in the document is {<qt type="detail">}, the document is displayed as a popup rather than as new document in the browser window itself. Otherwise, the document is displayed normally in the text browser with the text set to the contents of the named document with setText().

If you are using the filesystem access capabilities of the mime source factory, you must ensure that the factory knows about the encoding of specified files; otherwise no data will be available. The default factory handles a couple of common file extensions such as *.html and *.txt with reasonable defaults. See QMimeSourceFactory::data() for details.


La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'