Qt:Документация 4.3.2/q3textedit

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] Q3TextEdit Class Reference
[ Qt3Support module]

The Q3TextEdit widget provides a powerful single-page rich text editor. Далее...

 #include <Q3TextEdit>

This class is part of the Qt 3 support library. It is provided to keep old source code working. Мы настоятельно не рекомендуем использовать этот класс в новом коде. See Porting to Qt 4 for more information.

Inherits Q3ScrollView.

Inherited by Q3MultiLineEdit, Q3TextBrowser, and Q3TextView.

[править] Открытые типы

  • flags AutoFormatting
  • enum AutoFormattingFlag { AutoNone, AutoBulletList, AutoAll }
  • enum CursorAction { MoveBackward, MoveWordBackward, MoveForward, MoveWordForward, ..., MovePgDown }
  • enum KeyboardAction { ActionBackspace, ActionDelete, ActionReturn, ActionKill, ActionWordBackspace, ActionWordDelete }
  • enum VerticalAlignment { AlignNormal, AlignSuperScript, AlignSubScript }
  • enum WordWrap { NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth }
  • enum WrapPolicy { AtWhiteSpace, Anywhere, AtWordBoundary, AtWordOrDocumentBoundary }

[править] Свойства

  • 10 properties inherited from Q3ScrollView
  • 2 properties inherited from Q3Frame
  • 6 свойств, унаследованных от QFrame
  • 56 свойств, унаследованных от QWidget
  • 1 свойство, унаследованное от QObject

[править] Открытые функции

  • 46 public functions inherited from Q3ScrollView
  • 4 public functions inherited from Q3Frame
  • 13 открытых функций, унаследованных от QFrame
  • 201 свойство, унаследованное от QWidget
  • 29 открытых функций, унаследованных от QObject
  • 12 открытых функций, унаследованных от QPaintDevice

[править] Открытые слоты

  • 8 public slots inherited from Q3ScrollView
  • 19 открытых слотов, унаследованных от QWidget
  • 1 открытый слот, унаследованный от QObject

[править] Сигналы

  • 5 signals inherited from Q3ScrollView
  • 1 сигнал, унаследованный от QWidget
  • 1 сигнал, унаследованный от QObject

[править] Защищенные функции

  • 17 protected functions inherited from Q3ScrollView
  • 5 protected functions inherited from Q3Frame
  • 38 защищенных функций, унаследованных от QWidget
  • 7 защищенных функций, унаследованных от QObject
  • 1 защищенная функция, унаследованных от QPaintDevice

[править] Дополнительные унаследованные члены

  • 4 статических открытых члена, унаследованных от QWidget
  • 5 статических открытых членов, унаследованных от QObject
  • 1 защищенный слот, унаследованый от QWidget

[править] Подробное описание

The Q3TextEdit widget provides a powerful single-page rich text editor.

[править] Introduction and Concepts

Q3TextEdit is an advanced WYSIWYG viewer/editor supporting rich text formatting using HTML-style tags. It is optimized to handle large documents and to respond quickly to user input.

Q3TextEdit has four modes of operation:


Mode Command Notes
Plain Text Editor setTextFormat( Qt::PlainText) Set text with setText(); text() returns plain text. Text attributes (e.g. colors) can be set, but plain text is always returned.
Rich Text Editor setTextFormat( Qt::RichText) Set text with setText(); text() returns rich text. Rich text editing is fairly limited. You can't set margins or insert images for example (although you can read and correctly display files that have margins set and that include images). This mode is mostly useful for editing small amounts of rich text.
Text Viewer setReadOnly(true) Set text with setText() or append() (which has no undo history so is faster and uses less memory); text() returns plain or rich text depending on the textFormat(). This mode can correctly display a large subset of HTML tags.
Log Viewer setTextFormat( Qt::LogText) Append text using append(). The widget is set to be read only and rich text support is disabled although a few HTML tags (for color, bold, italic and underline) may be used. (See Qt::LogText mode for details.)

Q3TextEdit can be used as a syntax highlighting editor when used in conjunction with QSyntaxHighlighter.

We recommend that you always call setTextFormat() to set the mode you want to use. If you use Qt::AutoText then setText() and append() will try to determine whether the text they are given is plain text or rich text. If you use Qt::RichText then setText() and append() will assume that the text they are given is rich text. insert() simply inserts the text it is given.

Q3TextEdit works on paragraphs and characters. A paragraph is a formatted string which is word-wrapped to fit into the width of the widget. By default when reading plain text, one newline signify a paragraph. A document consists of zero or more paragraphs, indexed from 0. Characters are indexed on a per-paragraph basis, also indexed from 0. The words in the paragraph are aligned in accordance with the paragraph's alignment(). Paragraphs are separated by hard line breaks. Each character within a paragraph has its own attributes, for example, font and color.

The text edit documentation uses the following concepts:

  • current format -- this is the format at the current cursor position, and it is the format of the selected text if any.
  • current paragraph -- the paragraph which contains the cursor.

Q3TextEdit can display images (using Q3MimeSourceFactory), lists and tables. If the text is too large to view within the text edit's viewport, scroll bars will appear. The text edit can load both plain text and HTML files (a subset of HTML 3.2 and 4). The rendering style and the set of valid tags are defined by a styleSheet(). Custom tags can be created and placed in a custom style sheet. Change the style sheet with setStyleSheet(); see Q3StyleSheet for details. The images identified by image tags are displayed if they can be interpreted using the text edit's Q3MimeSourceFactory; see setMimeSourceFactory().

If you want a text browser with more navigation use QTextBrowser. If you just need to display a small piece of rich text use QLabel or QSimpleRichText.

If you create a new Q3TextEdit, and want to allow the user to edit rich text, call setTextFormat( Qt::RichText) to ensure that the text is treated as rich text. (Rich text uses HTML tags to set text formatting attributes. See Q3StyleSheet for information on the HTML tags that are supported.). If you don't call setTextFormat() explicitly the text edit will guess from the text itself whether it is rich text or plain text. This means that if the text looks like HTML or XML it will probably be interpreted as rich text, so you should call setTextFormat( Qt::PlainText) to preserve such text.

Note that we do not intend to add a full-featured web browser widget to Qt (because that would easily double Qt's size and only a few applications would benefit from it). The rich text support in Qt is designed to provide a fast, portable and efficient way to add reasonable online help facilities to applications, and to provide a basis for rich text editors.

[править] Using Q3TextEdit as a Display Widget

Q3TextEdit can display a large HTML subset, including tables and images.

The text is set or replaced using setText() which deletes any existing text and replaces it with the text passed in the setText() call. If you call setText() with legacy HTML (with setTextFormat( Qt::RichText) in force), and then call text(), the text that is returned may have different markup, but will render the same. Text can be inserted with insert(), paste(), pasteSubType() and append(). Text that is appended does not go into the undo history; this makes append() faster and consumes less memory. Text can also be cut(). The entire text is deleted with clear() and the selected text is deleted with removeSelectedText(). Selected (marked) text can also be deleted with del() (which will delete the character to the right of the cursor if no text is selected).

Loading and saving text is achieved using setText() and text(), for example:

 QFile file(fileName); // Read the text from a file
 if (file.open(IO_ReadOnly)) {
     QTextStream stream(&amp;file);
     textEdit->setText(stream.read());
 }
 
 QFile file(fileName); // Write the text to a file
 if (file.open(IO_WriteOnly)) {
     QTextStream stream(&amp;file);
     stream << textEdit->text();
     textEdit->setModified(false);
 }

By default the text edit wraps words at whitespace to fit within the text edit widget. The setWordWrap() function is used to specify the kind of word wrap you want, or NoWrap if you don't want any wrapping. Call setWordWrap() to set a fixed pixel width FixedPixelWidth, or character column (e.g. 80 column) FixedColumnWidth with the pixels or columns specified with setWrapColumnOrWidth(). If you use word wrap to the widget's width WidgetWidth, you can specify whether to break on whitespace or anywhere with setWrapPolicy().

The background color is set differently than other widgets, using setPaper(). You specify a brush style which could be a plain color or a complex pixmap.

Hypertext links are automatically underlined; this can be changed with setLinkUnderline(). The tab stop width is set with setTabStopWidth().

The zoomIn() and zoomOut() functions can be used to resize the text by increasing (decreasing for zoomOut()) the point size used. Images are not affected by the zoom functions.

The lines() function returns the number of lines in the text and paragraphs() returns the number of paragraphs. The number of lines within a particular paragraph is returned by linesOfParagraph(). The length of the entire text in characters is returned by length().

You can scroll to an anchor in the text, e.g. <a name="anchor"> with scrollToAnchor(). The find() function can be used to find and select a given string within the text.

A read-only Q3TextEdit provides the same functionality as the (obsolete) QTextView. ( QTextView is still supplied for compatibility with old code.)

[править] Read-only key bindings

When Q3TextEdit is used read-only the key-bindings are limited to navigation, and text may only be selected with the mouse:


Keypresses Action
Qt::UpArrow Move one line up
Qt::DownArrow Move one line down
Qt::LeftArrow Move one character left
Qt::RightArrow Move one character right
PageUp Move one (viewport) page up
PageDown Move one (viewport) page down
Home Move to the beginning of the text
End Move to the end of the text
Shift+Wheel Scroll the page horizontally (the Wheel is the mouse wheel)
Ctrl+Wheel Zoom the text

The text edit may be able to provide some meta-information. For example, the documentTitle() function will return the text from within HTML <title> tags.

The text displayed in a text edit has a context. The context is a path which the text edit's Q3MimeSourceFactory uses to resolve the locations of files and images. It is passed to the mimeSourceFactory() when quering data. (See Q3TextEdit() and context().)

[править] Using Q3TextEdit in Qt::LogText Mode

Setting the text format to Qt::LogText puts the widget in a special mode which is optimized for very large texts. In this mode editing and rich text support are disabled (the widget is explicitly set to read-only mode). This allows the text to be stored in a different, more memory efficient manner. However, a certain degree of text formatting is supported through the use of formatting tags. A tag is delimited by < and >. The characters <, > and & are escaped by using &lt;, &gt; and &amp;. A tag pair consists of a left and a right tag (or open/close tags). Left-tags mark the starting point for formatting, while right-tags mark the ending point. A right-tag always start with a / before the tag keyword. For example </tt> and <tt> are a tag pair. Tags can be nested, but they have to be closed in the same order as they are opened. For example, is valid, while </b></tt> will output an error message.

By using tags it is possible to change the color, bold, italic and underline settings for a piece of text. A color can be specified by using the HTML font tag <tt></tt>. The color name can be one of the color names from the X11 color database, or a RGB hex value (e.g <tt>#00ff00</tt>). Example of valid color tags: <tt></tt>, <tt></tt>,<tt></tt>. Bold, italic and underline settings can be specified by the tags <tt><b></tt>, <tt></tt> and <tt></tt>. Note that a tag does not necessarily have to be closed. A valid example:

 This is <font color=red>red</font> while <b>this</b> is <font color=blue>blue</font>.
 <font color=green><font color=yellow>Yellow,</font> and <u>green</u>.

Stylesheets can also be used in Qt::LogText mode. To create and use a custom tag, you could do the following:

 Q3TextEdit * log = new Q3TextEdit(this);
 log->setTextFormat(Qt::LogText);
 Q3StyleSheetItem * item = new Q3StyleSheetItem(log->styleSheet(), "mytag");
 item->setColor("red");
 item->setFontWeight(QFont::Bold);
 item->setFontUnderline(true);
 log->append("This is a <mytag>custom tag</mytag>!");

Note that only the color, bold, underline and italic attributes of a Q3StyleSheetItem is used in Qt::LogText mode.

Note that you can use setMaxLogLines() to limit the number of lines the widget can hold in Qt::LogText mode.

There are a few things that you need to be aware of when the widget is in this mode:

  • Functions that deal with rich text formatting and cursor movement will not work or return anything valid.
  • Lines are equivalent to paragraphs.

[править] Using Q3TextEdit as an Editor

All the information about using Q3TextEdit as a display widget also applies here.

The current format's attributes are set with setItalic(), setBold(), setUnderline(), setFamily() (font family), setPointSize(), setColor() and setCurrentFont(). The current paragraph's alignment is set with setAlignment().

Use setSelection() to select text. The setSelectionAttributes() function is used to indicate how selected text should be displayed. Use hasSelectedText() to find out if any text is selected. The currently selected text's position is available using getSelection() and the selected text itself is returned by selectedText(). The selection can be copied to the clipboard with copy(), or cut to the clipboard with cut(). It can be deleted with removeSelectedText(). The entire text can be selected (or unselected) using selectAll(). Q3TextEdit supports multiple selections. Most of the selection functions operate on the default selection, selection 0. If the user presses a non-selecting key, e.g. a cursor key without also holding down Shift, all selections are cleared.

Set and get the position of the cursor with setCursorPosition() and getCursorPosition() respectively. When the cursor is moved, the signals currentFontChanged(), currentColorChanged() and currentAlignmentChanged() are emitted to reflect the font, color and alignment at the new cursor position.

If the text changes, the textChanged() signal is emitted, and if the user inserts a new line by pressing Return or Enter, returnPressed() is emitted. The isModified() function will return true if the text has been modified.

Q3TextEdit provides command-based undo and redo. To set the depth of the command history use setUndoDepth() which defaults to 100 steps. To undo or redo the last operation call undo() or redo(). The signals undoAvailable() and redoAvailable() indicate whether the undo and redo operations can be executed.

[править] Editing key bindings

The list of key-bindings which are implemented for editing:


Keypresses Action
Backspace Delete the character to the left of the cursor
Delete Delete the character to the right of the cursor
Ctrl+A Move the cursor to the beginning of the line
Ctrl+B Move the cursor one character left
Ctrl+C Copy the marked text to the clipboard (also Ctrl+Insert under Windows)
Ctrl+D Delete the character to the right of the cursor
Ctrl+E Move the cursor to the end of the line
Ctrl+F Move the cursor one character right
Ctrl+H Delete the character to the left of the cursor
Ctrl+K Delete to end of line
Ctrl+N Move the cursor one line down
Ctrl+P Move the cursor one line up
Ctrl+V Paste the clipboard text into line edit (also Shift+Insert under Windows)
Ctrl+X Cut the marked text, copy to clipboard (also Shift+Delete under Windows)
Ctrl+Z Undo the last operation
Ctrl+Y Redo the last operation
Qt::LeftArrow Move the cursor one character left
Ctrl+ Qt::LeftArrow Move the cursor one word left
Qt::RightArrow Move the cursor one character right
Ctrl+ Qt::RightArrow Move the cursor one word right
Qt::UpArrow Move the cursor one line up
Ctrl+ Qt::UpArrow Move the cursor one word up
Qt::DownArrow Move the cursor one line down
Ctrl+Down Arrow Move the cursor one word down
PageUp Move the cursor one page up
PageDown Move the cursor one page down
Home Move the cursor to the beginning of the line
Ctrl+Home Move the cursor to the beginning of the text
End Move the cursor to the end of the line
Ctrl+End Move the cursor to the end of the text
Shift+Wheel Scroll the page horizontally (the Wheel is the mouse wheel)
Ctrl+Wheel Zoom the text

To select (mark) text hold down the Shift key whilst pressing one of the movement keystrokes, for example, Shift+Right Arrow will select the character to the right, and Shift+Ctrl+Right Arrow will select the word to the right, etc.

By default the text edit widget operates in insert mode so all text that the user enters is inserted into the text edit and any text to the right of the cursor is moved out of the way. The mode can be changed to overwrite, where new text overwrites any text to the right of the cursor, using setOverwriteMode().


[править] Описание типов

[править]
enum Q3TextEdit::AutoFormattingFlag
flags Q3TextEdit::AutoFormatting

Константа Значение Описание
<tt>Q3TextEdit::AutoNone</tt> <tt>0</tt> Do not perform any automatic formatting
<tt>Q3TextEdit::AutoBulletList</tt> <tt>0x00000001</tt> Only automatically format bulletted lists
<tt>Q3TextEdit::AutoAll</tt> <tt>0xffffffff</tt> Apply all available autoformatting

The AutoFormatting type is a typedef for QFlags<AutoFormattingFlag>. It stores an OR combination of AutoFormattingFlag values.

[править]
enum Q3TextEdit::CursorAction

This enum is used by moveCursor() to specify in which direction the cursor should be moved:


Константа Значение Описание
<tt>Q3TextEdit::MoveBackward</tt> <tt>0</tt> Moves the cursor one character backward
<tt>Q3TextEdit::MoveWordBackward</tt> <tt>2</tt> Moves the cursor one word backward
<tt>Q3TextEdit::MoveForward</tt> <tt>1</tt> Moves the cursor one character forward
<tt>Q3TextEdit::MoveWordForward</tt> <tt>3</tt> Moves the cursor one word forward
<tt>Q3TextEdit::MoveUp</tt> <tt>4</tt> Moves the cursor up one line
<tt>Q3TextEdit::MoveDown</tt> <tt>5</tt> Moves the cursor down one line
<tt>Q3TextEdit::MoveLineStart</tt> <tt>6</tt> Moves the cursor to the beginning of the line
<tt>Q3TextEdit::MoveLineEnd</tt> <tt>7</tt> Moves the cursor to the end of the line
<tt>Q3TextEdit::MoveHome</tt> <tt>8</tt> Moves the cursor to the beginning of the document
<tt>Q3TextEdit::MoveEnd</tt> <tt>9</tt> Moves the cursor to the end of the document
<tt>Q3TextEdit::MovePgUp</tt> <tt>10</tt> Moves the cursor one viewport page up
<tt>Q3TextEdit::MovePgDown</tt> <tt>11</tt> Moves the cursor one viewport page down

[править]
enum Q3TextEdit::KeyboardAction

This enum is used by doKeyboardAction() to specify which action should be executed:


Константа Значение Описание
<tt>Q3TextEdit::ActionBackspace</tt> <tt>0</tt> Delete the character to the left of the cursor.
<tt>Q3TextEdit::ActionDelete</tt> <tt>1</tt> Delete the character to the right of the cursor.
<tt>Q3TextEdit::ActionReturn</tt> <tt>2</tt> Split the paragraph at the cursor position.
<tt>Q3TextEdit::ActionKill</tt> <tt>3</tt> If the cursor is not at the end of the paragraph, delete the text from the cursor position until the end of the paragraph. If the cursor is at the end of the paragraph, delete the hard line break at the end of the paragraph: this will cause this paragraph to be joined with the following paragraph.
<tt>Q3TextEdit::ActionWordBackspace</tt> <tt>4</tt> Delete the word to the left of the cursor position.
<tt>Q3TextEdit::ActionWordDelete</tt> <tt>5</tt> Delete the word to the right of the cursor position

[править]
enum Q3TextEdit::VerticalAlignment

This enum is used to set the vertical alignment of the text.


Константа Значение Описание
<tt>Q3TextEdit::AlignNormal</tt> <tt>0</tt> Normal alignment
<tt>Q3TextEdit::AlignSuperScript</tt> <tt>1</tt> Superscript
<tt>Q3TextEdit::AlignSubScript</tt> <tt>2</tt> Subscript

[править]
enum Q3TextEdit::WordWrap

This enum defines the Q3TextEdit's word wrap modes.


Константа Значение Описание
<tt>Q3TextEdit::NoWrap</tt> <tt>0</tt> Do not wrap the text.
<tt>Q3TextEdit::WidgetWidth</tt> <tt>1</tt> Wrap the text at the current width of the widget (this is the default). Wrapping is at whitespace by default; this can be changed with setWrapPolicy().
<tt>Q3TextEdit::FixedPixelWidth</tt> <tt>2</tt> Wrap the text at a fixed number of pixels from the widget's left side. The number of pixels is set with wrapColumnOrWidth().
<tt>Q3TextEdit::FixedColumnWidth</tt> <tt>3</tt> Wrap the text at a fixed number of character columns from the widget's left side. The number of characters is set with wrapColumnOrWidth(). This is useful if you need formatted text that can also be displayed gracefully on devices with monospaced fonts, for example a standard VT100 terminal, where you might set wrapColumnOrWidth() to 80.

See also setWordWrap() and wordWrap().

[править]
enum Q3TextEdit::WrapPolicy

This enum defines where text can be wrapped in word wrap mode.


Константа Значение Описание
<tt>Q3TextEdit::AtWhiteSpace</tt> <tt>AtWordBoundary</tt> Don't use this deprecated value (it is a synonym for <tt>AtWordBoundary</tt> which you should use instead).
<tt>Q3TextEdit::Anywhere</tt>  ? Break anywhere, including within words.
<tt>Q3TextEdit::AtWordBoundary</tt> <tt>0</tt> Break lines at word boundaries, e.g. spaces or newlines
<tt>Q3TextEdit::AtWordOrDocumentBoundary</tt>  ? Break lines at whitespace, e.g. spaces or newlines if possible. Break it anywhere otherwise.

See also setWrapPolicy().


[править] Описание cвойств

[править]
autoFormatting : AutoFormattingFlag

This property holds the enabled set of auto formatting features.

The value can be any combination of the values in the <tt>AutoFormattingFlag</tt> enum. The default is <tt>AutoAll</tt>. Choose <tt>AutoNone</tt> to disable all automatic formatting.

Currently, the only automatic formatting feature provided is <tt>AutoBulletList</tt>; future versions of Qt may offer more.

Функции доступа:

  • AutoFormatting autoFormatting () const
  • void setAutoFormatting ( AutoFormatting )

[править]
documentTitle : const QString

This property holds the title of the document parsed from the text.

For Qt::PlainText the title will be an empty string. For <tt>Qt::RichText</tt> the title will be the text between the <tt><title></tt> tags, if present, otherwise an empty string.

Функции доступа:

  • QString documentTitle () const

[править]
hasSelectedText : const bool

This property holds whether some text is selected in selection 0.

Функции доступа:

  • bool hasSelectedText () const

[править]
length : const int

This property holds the number of characters in the text.

Функции доступа:

  • int length () const

[править]
linkUnderline : bool

This property holds whether hypertext links will be underlined.

If true (the default) hypertext links will be displayed underlined. If false links will not be displayed underlined.

Функции доступа:

  • bool linkUnderline () const
  • virtual void setLinkUnderline ( bool )

[править]
modified : bool

This property holds whether the document has been modified by the user.

Функции доступа:

  • bool isModified () const
  • virtual void setModified ( bool m )

[править]
overwriteMode : bool

This property holds the text edit's overwrite mode.

If false (the default) characters entered by the user are inserted with any characters to the right being moved out of the way. If true, the editor is in overwrite mode, i.e. characters entered by the user overwrite any characters to the right of the cursor position.

Функции доступа:

  • bool isOverwriteMode () const
  • virtual void setOverwriteMode ( bool b )

[править]
paper : QBrush

This property holds the background (paper) brush.

The brush that is currently used to draw the background of the text edit. The initial setting is an empty brush.

Функции доступа:

  • QBrush paper () const
  • virtual void setPaper ( const QBrush & pap )

[править]
readOnly : bool

This property holds whether the text edit is read-only.

In a read-only text edit the user can only navigate through the text and select text; modifying the text is not possible.

This property's default is false.

Функции доступа:

  • bool isReadOnly () const
  • virtual void setReadOnly ( bool b )

[править]
selectedText : const QString

This property holds the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0).

The text is always returned as Qt::PlainText if the textFormat() is Qt::PlainText or Qt::AutoText, otherwise it is returned as HTML.

Функции доступа:

  • QString selectedText () const

See also hasSelectedText.

[править]
tabChangesFocus : bool

This property holds whether TAB changes focus or is accepted as input.

In some occasions text edits should not allow the user to input tabulators or change indentation using the TAB key, as this breaks the focus chain. По умолчанию равно false.

Функции доступа:

  • bool tabChangesFocus () const
  • virtual void setTabChangesFocus ( bool b )

[править]
tabStopWidth : int

This property holds the tab stop width in pixels.

Функции доступа:

  • int tabStopWidth () const
  • virtual void setTabStopWidth ( int ts )

[править]
text : QString

This property holds the text edit's text.

Текст по умолчанию не определён.

On setting, any previous text is deleted.

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

For richtext, calling text() on an editable Q3TextEdit will cause the text to be regenerated from the textedit. This may mean that the QString returned may not be exactly the same as the one that was set.

Функции доступа:

  • QString text () const
  • QString text ( int para ) const
  • void setText ( const QString & txt )
  • virtual void setText ( const QString & text, const QString & context )

See also textFormat.

[править]
textFormat : Qt::TextFormat

This property holds the text format: rich text, plain text, log text or auto text.

The text format is one of the following:

Функции доступа:

  • Qt::TextFormat textFormat () const
  • virtual void setTextFormat ( Qt::TextFormat f )

[править]
undoDepth : int

This property holds the depth of the undo history.

The maximum number of steps in the undo/redo history. The default is 100.

Функции доступа:

  • int undoDepth () const
  • virtual void setUndoDepth ( int d )

See also undo() and redo().

[править]
undoRedoEnabled : bool

This property holds whether undo/redo is enabled.

When changing this property, the undo/redo history is cleared.

The default is true.

Функции доступа:

  • bool isUndoRedoEnabled () const
  • virtual void setUndoRedoEnabled ( bool b )

[править]
wordWrap : WordWrap

This property holds the word wrap mode.

The default mode is <tt>WidgetWidth</tt> which causes words to be wrapped at the right edge of the text edit. Wrapping occurs at whitespace, keeping whole words intact. If you want wrapping to occur within words use setWrapPolicy(). If you set a wrap mode of <tt>FixedPixelWidth</tt> or <tt>FixedColumnWidth</tt> you should also call setWrapColumnOrWidth() with the width you want.

Функции доступа:

  • WordWrap wordWrap () const
  • virtual void setWordWrap ( Q3TextEdit::WordWrap mode )

See also WordWrap, wrapColumnOrWidth, and wrapPolicy.

[править]
wrapColumnOrWidth : int

This property holds the position (in pixels or columns depending on the wrap mode) where text will be wrapped.

If the wrap mode is <tt>FixedPixelWidth</tt>, the value is the number of pixels from the left edge of the text edit at which text should be wrapped. If the wrap mode is <tt>FixedColumnWidth</tt>, the value is the column number (in character columns) from the left edge of the text edit at which text should be wrapped.

Функции доступа:

  • int wrapColumnOrWidth () const
  • virtual void setWrapColumnOrWidth ( int )

See also wordWrap.

[править]
wrapPolicy : WrapPolicy

This property holds the word wrap policy, at whitespace or anywhere.

Defines where text can be wrapped when word wrap mode is not <tt>NoWrap</tt>. The choices are <tt>AtWordBoundary</tt> (the default), <tt>Anywhere</tt> and <tt>AtWordOrDocumentBoundary</tt>

Функции доступа:

  • WrapPolicy wrapPolicy () const
  • virtual void setWrapPolicy ( Q3TextEdit::WrapPolicy policy )

See also wordWrap.


[править] Описание функций-членов

[править]
Q3TextEdit::Q3TextEdit ( const QString & text, const QString & context = QString(), QWidget * parent = 0, const char * name = 0 )

Constructs a Q3TextEdit called name, with parent parent. The text edit will display the text text using context context.

The context is a path which the text edit's Q3MimeSourceFactory uses to resolve the locations of files and images. It is passed to the mimeSourceFactory() when quering data.

For example if the text contains an image tag, <tt><img src="image.png"></tt>, and the context is "path/to/look/in", the Q3MimeSourceFactory will try to load the image from "path/to/look/in/image.png". If the tag was <tt><img src="/image.png"></tt>, the context will not be used (because Q3MimeSourceFactory recognizes that we have used an absolute path) and will try to load "/image.png". The context is applied in exactly the same way to hrefs, for example, <tt><a href="target.html">Target</a></tt>, would resolve to "path/to/look/in/target.html".

[править]
Q3TextEdit::Q3TextEdit ( QWidget * parent = 0, const char * name = 0 )

Constructs an empty Q3TextEdit called name, with parent parent.

[править]
Q3TextEdit::~Q3TextEdit () <tt> [virtual]</tt>

Деструктор.

[править]
int Q3TextEdit::alignment () const

Returns the alignment of the current paragraph.

See also setAlignment().

[править]
QString Q3TextEdit::anchorAt ( const QPoint & pos, Qt::AnchorAttribute attr = Qt::AnchorHref )

Returns the text for the attribute attr ( Qt::AnchorHref by default) if there is an anchor at position pos (in contents coordinates); otherwise returns an empty string.

[править]
void Q3TextEdit::append ( const QString & text ) <tt> [virtual slot]</tt>

Appends a new paragraph with text to the end of the text edit. Note that the undo/redo history is cleared by this function, and no undo history is kept for appends which makes them faster than insert()s. If you want to append text which is added to the undo/redo history as well, use insertParagraph().

[править]
bool Q3TextEdit::bold () const

Returns true if the current format is bold; otherwise returns false.

See also setBold().

[править]
int Q3TextEdit::charAt ( const QPoint & pos, int * para ) const

Returns the index of the character (relative to its paragraph) at position pos (in contents coordinates). If para is not 0, <tt>*</tt>para is set to the character's paragraph.

[править]
void Q3TextEdit::clear () <tt> [virtual slot]</tt>

Deletes all the text in the text edit.

See also cut(), removeSelectedText(), and setText().

[править]
void Q3TextEdit::clearParagraphBackground ( int para ) <tt> [virtual slot]</tt>

Clears the background color of the paragraph para, so that the default color is used again.

[править]
void Q3TextEdit::clicked ( int para, int pos ) <tt> [signal]</tt>

This signal is emitted when the mouse is clicked on the paragraph para at character position pos.

See also doubleClicked().

[править]
QColor Q3TextEdit::color () const

Returns the color of the current format.

See also setColor() and setPaper().

[править]
QString Q3TextEdit::context () const

Returns the context of the text edit. The context is a path which the text edit's Q3MimeSourceFactory uses to resolve the locations of files and images.

See also text.

[править]
void Q3TextEdit::copy () <tt> [virtual slot]</tt>

Copies any selected text (from selection 0) to the clipboard.

See also hasSelectedText() and copyAvailable().

[править]
void Q3TextEdit::copyAvailable ( bool yes ) <tt> [signal]</tt>

This signal is emitted when text is selected or de-selected in the text edit.

When text is selected this signal will be emitted with yes set to true. If no text has been selected or if the selected text is de-selected this signal is emitted with yes set to false.

If yes is true then copy() can be used to copy the selection to the clipboard. If yes is false then copy() does nothing.

See also selectionChanged().

[править]
Q3PopupMenu * Q3TextEdit::createPopupMenu ( const QPoint & pos ) <tt> [virtual protected]</tt>

This function is called to create a right mouse button popup menu at the document position pos. If you want to create a custom popup menu, reimplement this function and return the created popup menu. Ownership of the popup menu is transferred to the caller.

Warning: The QPopupMenu ID values 0-7 are reserved, and they map to the standard operations. When inserting items into your custom popup menu, be sure to specify ID values larger than 7.

[править]
Q3PopupMenu * Q3TextEdit::createPopupMenu () <tt> [virtual protected]</tt>

Эта перегруженная функция предоставлена для удобства.

This function is called to create a right mouse button popup menu. If you want to create a custom popup menu, reimplement this function and return the created popup menu. Ownership of the popup menu is transferred to the caller.

This function is only called if createPopupMenu(const QPoint &) returns 0.

[править]
void Q3TextEdit::currentAlignmentChanged ( int a ) <tt> [signal]</tt>

This signal is emitted if the alignment of the current paragraph has changed.

The new alignment is a.

See also setAlignment().

[править]
void Q3TextEdit::currentColorChanged ( const QColor & c ) <tt> [signal]</tt>

This signal is emitted if the color of the current format has changed.

The new color is c.

Смотрите также setColor().

[править]
QFont Q3TextEdit::currentFont () const

Returns the font of the current format.

See also setCurrentFont(), setFamily(), and setPointSize().

[править]
void Q3TextEdit::currentFontChanged ( const QFont & f ) <tt> [signal]</tt>

This signal is emitted if the font of the current format has changed.

The new font is f.

See also setCurrentFont().

[править]
void Q3TextEdit::currentVerticalAlignmentChanged ( Q3TextEdit::VerticalAlignment a ) <tt> [signal]</tt>

This signal is emitted if the vertical alignment of the current format has changed.

The new vertical alignment is a.

[править]
void Q3TextEdit::cursorPositionChanged ( int para, int pos ) <tt> [signal]</tt>

This signal is emitted if the position of the cursor has changed. para contains the paragraph index and pos contains the character position within the paragraph.

See also setCursorPosition().

[править]
void Q3TextEdit::cut () <tt> [virtual slot]</tt>

Copies the selected text (from selection 0) to the clipboard and deletes it from the text edit.

If there is no selected text (in selection 0) nothing happens.

See also Q3TextEdit::copy(), paste(), and pasteSubType().

[править]
void Q3TextEdit::del () <tt> [virtual slot]</tt>

If there is some selected text (in selection 0) it is deleted. If there is no selected text (in selection 0) the character to the right of the text cursor is deleted.

See also removeSelectedText() and cut().

[править]
void Q3TextEdit::doKeyboardAction ( Q3TextEdit::KeyboardAction action ) <tt> [virtual slot]</tt>

Executes keyboard action action. This is normally called by a key event handler.

[править]
void Q3TextEdit::doubleClicked ( int para, int pos ) <tt> [signal]</tt>

This signal is emitted when the mouse is double-clicked on the paragraph para at character position pos.

See also clicked().

[править]
void Q3TextEdit::ensureCursorVisible () <tt> [virtual slot]</tt>

Ensures that the cursor is visible by scrolling the text edit if necessary.

See also setCursorPosition().

[править]
QString Q3TextEdit::family () const

Returns the font family of the current format.

See also setFamily(), setCurrentFont(), and setPointSize().

[править]
bool Q3TextEdit::find ( const QString & expr, bool cs, bool wo, bool forward = true, int * para = 0, int * index = 0 ) <tt> [virtual]</tt>

Finds the next occurrence of the string, expr. Returns true if expr was found; otherwise returns false.

If para and index are both 0 the search begins from the current cursor position. If para and index are both not 0, the search begins from the <tt>*</tt>index character position in the <tt>*</tt>para paragraph.

If cs is true the search is case sensitive, otherwise it is case insensitive. If wo is true the search looks for whole word matches only; otherwise it searches for any matching text. If forward is true (the default) the search works forward from the starting position to the end of the text, otherwise it works backwards to the beginning of the text.

If expr is found the function returns true. If index and para are not 0, the number of the paragraph in which the first character of the match was found is put into <tt>*</tt>para, and the index position of that character within the paragraph is put into <tt>*</tt>index.

If expr is not found the function returns false. If index and para are not 0 and expr is not found, <tt>*</tt>index and <tt>*</tt>para are undefined.

Please note that this function will make the next occurrence of the string (if found) the current selection, and will thus modify the cursor position.

Using the para and index parameters will not work correctly in case the document contains tables.

[править]
bool Q3TextEdit::focusNextPrevChild ( bool n ) <tt> [virtual protected]</tt>

Reimplemented to allow tabbing through links. If n is true the tab moves the focus to the next child; if n is false the tab moves the focus to the previous child. Returns true if the focus was moved; otherwise returns false.

Reimplemented from QWidget.

[править]
QFont Q3TextEdit::font () const

Returns Q3ScrollView::font()

Warning: In previous versions this function returned the font of the current format. This lead to confusion. Please use currentFont() instead.

[править]
void Q3TextEdit::getCursorPosition ( int * para, int * index ) const

This function sets the <tt>*</tt>para and <tt>*</tt>index parameters to the current cursor position. para and index must not be 0.

See also setCursorPosition().

[править]
void Q3TextEdit::getSelection ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const

If there is a selection, <tt>*</tt>paraFrom is set to the number of the paragraph in which the selection begins and <tt>*</tt>paraTo is set to the number of the paragraph in which the selection ends. (They could be the same.) <tt>*</tt>indexFrom is set to the index at which the selection begins within <tt>*</tt>paraFrom, and <tt>*</tt>indexTo is set to the index at which the selection ends within <tt>*</tt>paraTo.

If there is no selection, <tt>*</tt>paraFrom, <tt>*</tt>indexFrom, <tt>*</tt>paraTo and <tt>*</tt>indexTo are all set to -1.

If paraFrom, indexFrom, paraTo or indexTo is 0 this function does nothing.

The selNum is the number of the selection (multiple selections are supported). It defaults to 0 (the default selection).

See also setSelection() and selectedText.

[править]
int Q3TextEdit::heightForWidth ( int w ) const <tt> [virtual]</tt>

Returns how many pixels high the text edit needs to be to display all the text if the text edit is w pixels wide.

Reimplemented from QWidget.

[править]
void Q3TextEdit::insert ( const QString & text, uint insertionFlags = CheckNewLines | RemoveSelected ) <tt> [virtual slot]</tt>

Inserts text at the current cursor position.

The insertionFlags define how the text is inserted. If <tt>RedoIndentation</tt> is set, the paragraph is re-indented. If <tt>CheckNewLines</tt> is set, newline characters in text result in hard line breaks (i.e. new paragraphs). If <tt>checkNewLine</tt> is not set, the behavior of the editor is undefined if the text contains newlines. (It is not possible to change Q3TextEdit's newline handling behavior, but you can use QString::replace() to preprocess text before inserting it.) If <tt>RemoveSelected</tt> is set, any selected text (in selection 0) is removed before the text is inserted.

The default flags are <tt>CheckNewLines</tt> | <tt>RemoveSelected</tt>.

If the widget is in Qt::LogText mode this function will do nothing.

See also paste() and pasteSubType().

[править]
void Q3TextEdit::insert ( const QString & text, bool indent, bool checkNewLine = true, bool removeSelected = true ) <tt> [virtual slot]</tt>

Эта перегруженная функция предоставлена для удобства.

Inserts the given text. If indent is true the paragraph that contains the text is reindented; if checkNewLine is true the text is checked for newlines and relaid out. If removeSelected is true and there is a selection, the insertion replaces the selected text.

[править]
void Q3TextEdit::insertAt ( const QString & text, int para, int index ) <tt> [virtual slot]</tt>

Inserts text in the paragraph para at position index.

[править]
void Q3TextEdit::insertParagraph ( const QString & text, int para ) <tt> [virtual slot]</tt>

Inserts text as a new paragraph at position para. If para is -1, the text is appended. Use append() if the append operation is performance critical.

[править]
bool Q3TextEdit::isRedoAvailable () const

Returns true if redo is available; otherwise returns false.

[править]
bool Q3TextEdit::isUndoAvailable () const

Returns true if undo is available; otherwise returns false.

[править]
bool Q3TextEdit::italic () const

Returns true if the current format is italic; otherwise returns false.

See also setItalic().

[править]
void Q3TextEdit::keyPressEvent ( QKeyEvent * e ) <tt> [virtual protected]</tt>

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

Reimplemented from QWidget.

[править]
int Q3TextEdit::lineOfChar ( int para, int index )

Returns the line number of the line in paragraph para in which the character at position index appears. The index position is relative to the beginning of the paragraph. If there is no such paragraph or no such character at the index position (e.g. the index is out of range) -1 is returned.

[править]
int Q3TextEdit::lines () const

Returns the number of lines in the text edit; this could be 0.

Warning: This function may be slow. Lines change all the time during word wrapping, so this function has to iterate over all the paragraphs and get the number of lines from each one individually.

[править]
int Q3TextEdit::linesOfParagraph ( int para ) const

Returns the number of lines in paragraph para, or -1 if there is no paragraph with index para.

[править]
Q3MimeSourceFactory * Q3TextEdit::mimeSourceFactory () const

Returns the Q3MimeSourceFactory which is being used by this text edit.

See also setMimeSourceFactory().

[править]
void Q3TextEdit::modificationChanged ( bool m ) <tt> [signal]</tt>

This signal is emitted when the modification status of the document has changed. If m is true, the document was modified, otherwise the modification state has been reset to unmodified.

See also modified.

[править]
void Q3TextEdit::moveCursor ( Q3TextEdit::CursorAction action, bool select ) <tt> [virtual slot]</tt>

Moves the text cursor according to action. This is normally used by some key event handler. select specifies whether the text between the current cursor position and the new position should be selected.

[править]
int Q3TextEdit::paragraphAt ( const QPoint & pos ) const

Returns the paragraph which is at position pos (in contents coordinates).

[править]
QColor Q3TextEdit::paragraphBackgroundColor ( int para ) const

Returns the background color of the paragraph para or an invalid color if para is out of range or the paragraph has no background set

See also setParagraphBackgroundColor().

[править]
int Q3TextEdit::paragraphLength ( int para ) const

Returns the length of the paragraph para (i.e. the number of characters), or -1 if there is no paragraph with index para.

This function ignores newlines.

[править]
QRect Q3TextEdit::paragraphRect ( int para ) const

Returns the rectangle of the paragraph para in contents coordinates, or an invalid rectangle if para is out of range.

[править]
int Q3TextEdit::paragraphs () const

Returns the number of paragraphs in the text; an empty textedit is always considered to have one paragraph, so 1 is returned in this case.

[править]
void Q3TextEdit::paste () <tt> [virtual slot]</tt>

Pastes the text from the clipboard into the text edit at the current cursor position. Only plain text is pasted.

If there is no text in the clipboard nothing happens.

See also pasteSubType(), cut(), and Q3TextEdit::copy().

[править]
void Q3TextEdit::pasteSubType ( const QByteArray & subtype ) <tt> [virtual slot]</tt>

Pastes the text with format subtype from the clipboard into the text edit at the current cursor position. The subtype can be "plain" or "html".

If there is no text with format subtype in the clipboard nothing happens.

See also paste(), cut(), and Q3TextEdit::copy().

[править]
void Q3TextEdit::placeCursor ( const QPoint & pos, Q3TextCursor * c = 0 ) <tt> [virtual slot]</tt>

Places the cursor c at the character which is closest to position pos (in contents coordinates). If c is 0, the default text cursor is used.

See also setCursorPosition().

[править]
int Q3TextEdit::pointSize () const

Returns the point size of the font of the current format.

See also setFamily(), setCurrentFont(), and setPointSize().

[править]
void Q3TextEdit::redo () <tt> [virtual slot]</tt>

Redoes the last operation.

If there is no operation to redo, i.e. there is no redo step in the undo/redo history, nothing happens.

See also redoAvailable(), undo(), and undoDepth().

[править]
void Q3TextEdit::redoAvailable ( bool yes ) <tt> [signal]</tt>

This signal is emitted when the availability of redo changes. If yes is true, then redo() will work until redoAvailable(false) is next emitted.

See also redo() and undoDepth().

[править]
void Q3TextEdit::removeParagraph ( int para ) <tt> [virtual slot]</tt>

Removes the paragraph para.

[править]
void Q3TextEdit::removeSelectedText ( int selNum = 0 ) <tt> [virtual slot]</tt>

Deletes the text of selection selNum (by default, the default selection, 0). If there is no selected text nothing happens.

See also selectedText and removeSelection().

[править]
void Q3TextEdit::removeSelection ( int selNum = 0 ) <tt> [virtual slot]</tt>

Removes the selection selNum (by default 0). This does not remove the selected text.

See also removeSelectedText().

[править]
void Q3TextEdit::repaintChanged () <tt> [protected]</tt>

Repaints any paragraphs that have changed.

Although used extensively internally you shouldn't need to call this yourself.

[править]
void Q3TextEdit::returnPressed () <tt> [signal]</tt>

This signal is emitted if the user pressed the Return or the Enter key.

[править]
void Q3TextEdit::scrollToAnchor ( const QString & name ) <tt> [virtual slot]</tt>

Scrolls the text edit to make the text at the anchor called name visible, if it can be found in the document. If the anchor isn't found no scrolling will occur. An anchor is defined using the HTML anchor tag, e.g. <tt><a name="target"></tt>.

[править]
void Q3TextEdit::scrollToBottom () <tt> [virtual slot]</tt>

Scrolls to the bottom of the document and does formatting if required.

[править]
void Q3TextEdit::selectAll ( bool select = true ) <tt> [virtual slot]</tt>

If select is true (the default), all the text is selected as selection 0. If select is false any selected text is unselected, i.e. the default selection (selection 0) is cleared.

See also selectedText.

[править]
void Q3TextEdit::selectionChanged () <tt> [signal]</tt>

This signal is emitted whenever the selection changes.

See also setSelection() and copyAvailable().

[править]
void Q3TextEdit::setAlignment ( int a ) <tt> [virtual slot]</tt>

Sets the alignment of the current paragraph to a. Valid alignments are Qt::AlignLeft, Qt::AlignRight, Qt::AlignJustify and Qt::AlignCenter (which centers horizontally).

See also alignment().

[править]
void Q3TextEdit::setBold ( bool b ) <tt> [virtual slot]</tt>

If b is true sets the current format to bold; otherwise sets the current format to non-bold.

See also bold().

[править]
void Q3TextEdit::setColor ( const QColor & c ) <tt> [virtual slot]</tt>

Sets the color of the current format, i.e. of the text, to c.

See also color() and setPaper().

[править]
void Q3TextEdit::setCurrentFont ( const QFont & f ) <tt> [virtual slot]</tt>

Sets the font of the current format to f.

If the widget is in Qt::LogText mode this function will do nothing. Use setFont() instead.

See also currentFont(), setPointSize(), and setFamily().

[править]
void Q3TextEdit::setCursorPosition ( int para, int index ) <tt> [virtual slot]</tt>

Sets the cursor to position index in paragraph para.

See also getCursorPosition().

[править]
void Q3TextEdit::setFamily ( const QString & fontFamily ) <tt> [virtual slot]</tt>

Sets the font family of the current format to fontFamily.

See also family() and setCurrentFont().

[править]
void Q3TextEdit::setItalic ( bool b ) <tt> [virtual slot]</tt>

If b is true sets the current format to italic; otherwise sets the current format to non-italic.

See also italic().

[править]
void Q3TextEdit::setMimeSourceFactory ( Q3MimeSourceFactory * factory ) <tt> [virtual slot]</tt>

Sets the text edit's mimesource factory to factory. See Q3MimeSourceFactory for further details.

See also mimeSourceFactory().

[править]
void Q3TextEdit::setParagraphBackgroundColor ( int para, const QColor & bg ) <tt> [virtual slot]</tt>

Sets the background color of the paragraph para to bg.

See also paragraphBackgroundColor().

[править]
void Q3TextEdit::setPointSize ( int s ) <tt> [virtual slot]</tt>

Sets the point size of the current format to s.

Note that if s is zero or negative, the behavior of this function is not defined.

See also pointSize(), setCurrentFont(), and setFamily().

[править]
void Q3TextEdit::setSelection ( int paraFrom, int indexFrom, int paraTo, int indexTo, int selNum = 0 ) <tt> [virtual slot]</tt>

Sets a selection which starts at position indexFrom in paragraph paraFrom and ends at position indexTo in paragraph paraTo.

Any existing selections which have a different id (selNum) are left alone, but if an existing selection has the same id as selNum it is removed and replaced by this selection.

Uses the selection settings of selection selNum. If selNum is 0, this is the default selection.

The cursor is moved to the end of the selection if selNum is 0, otherwise the cursor position remains unchanged.

See also getSelection() and selectedText.

[править]
void Q3TextEdit::setSelectionAttributes ( int selNum, const QColor & back, bool invertText ) <tt> [virtual slot]</tt>

Sets the background color of selection number selNum to back and specifies whether the text of this selection should be inverted with invertText.

This only works for selNum > 0. The default selection (selNum == 0) gets its attributes from the text edit's palette().

[править]
void Q3TextEdit::setStyleSheet ( Q3StyleSheet * styleSheet ) <tt> [virtual slot]</tt>

Sets the stylesheet to use with this text edit to styleSheet. Changes will only take effect for new text added with setText() or append().

See also styleSheet().

[править]
void Q3TextEdit::setUnderline ( bool b ) <tt> [virtual slot]</tt>

If b is true sets the current format to underline; otherwise sets the current format to non-underline.

See also underline().

[править]
void Q3TextEdit::setVerticalAlignment ( Q3TextEdit::VerticalAlignment a ) <tt> [virtual slot]</tt>

Sets the vertical alignment of the current format, i.e. of the text, to a.

See also verticalAlignment(), color(), and setPaper().

[править]
Q3StyleSheet * Q3TextEdit::styleSheet () const

Returns the Q3StyleSheet which is being used by this text edit.

See also setStyleSheet().

[править]
void Q3TextEdit::sync () <tt> [virtual slot]</tt>

Q3TextEdit is optimized for large amounts text. One of its optimizations is to format only the visible text, formatting the rest on demand, e.g. as the user scrolls, so you don't usually need to call this function.

In some situations you may want to force the whole text to be formatted. For example, if after calling setText(), you wanted to know the height of the document (using contentsHeight()), you would call this function first.

[править]
Q3SyntaxHighlighter * Q3TextEdit::syntaxHighlighter () const

Returns the QSyntaxHighlighter set on this Q3TextEdit. 0 is returned if no syntax highlighter is set.

[править]
void Q3TextEdit::textChanged () <tt> [signal]</tt>

This signal is emitted whenever the text in the text edit changes.

See also setText() and append().

[править]
Q3TextCursor * Q3TextEdit::textCursor () const <tt> [protected]</tt>

Returns the text edit's text cursor.

Warning: Q3TextCursor is not in the public API, but in special circumstances you might wish to use it.

[править]
bool Q3TextEdit::underline () const

Returns true if the current format is underlined; otherwise returns false.

See also setUnderline().

[править]
void Q3TextEdit::undo () <tt> [virtual slot]</tt>

Undoes the last operation.

If there is no operation to undo, i.e. there is no undo step in the undo/redo history, nothing happens.

See also undoAvailable(), redo(), and undoDepth().

[править]
void Q3TextEdit::undoAvailable ( bool yes ) <tt> [signal]</tt>

This signal is emitted when the availability of undo changes. If yes is true, then undo() will work until undoAvailable(false) is next emitted.

See also undo() and undoDepth().

[править]
VerticalAlignment Q3TextEdit::verticalAlignment () const

Returns the vertical alignment of the current format.

See also setVerticalAlignment().

[править]
void Q3TextEdit::zoomIn ( int range ) <tt> [virtual slot]</tt>

Zooms in on the text by making the base font size range points larger and recalculating all font sizes to be the new size. This does not change the size of any images.

See also zoomOut().

[править]
void Q3TextEdit::zoomIn () <tt> [virtual slot]</tt>

Эта перегруженная функция предоставлена для удобства.

Zooms in on the text by making the base font size one point larger and recalculating all font sizes to be the new size. This does not change the size of any images.

See also zoomOut().

[править]
void Q3TextEdit::zoomOut ( int range ) <tt> [virtual slot]</tt>

Zooms out on the text by making the base font size range points smaller and recalculating all font sizes to be the new size. This does not change the size of any images.

See also zoomIn().

[править]
void Q3TextEdit::zoomOut () <tt> [virtual slot]</tt>

Эта перегруженная функция предоставлена для удобства.

Zooms out on the text by making the base font size one point smaller and recalculating all font sizes to be the new size. This does not change the size of any images.

See also zoomIn().

[править]
void Q3TextEdit::zoomTo ( int size ) <tt> [virtual slot]</tt>

Zooms the text by making the base font size size points and recalculating all font sizes to be the new size. This does not change the size of any images.



Copyright © 2007 Trolltech Trademarks
Qt 4.3.2