[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qtextedit.h:1 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>qtextedit.h Include File</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qtextedit.h</h1>
|
---|
| 33 |
|
---|
| 34 | <p>This is the verbatim text of the qtextedit.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
| 35 | <hr>
|
---|
| 36 | <pre>
|
---|
| 37 | /****************************************************************************
|
---|
| 38 | ** $Id: qtextedit-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
| 39 | **
|
---|
| 40 | ** Definition of the QTextEdit class
|
---|
| 41 | **
|
---|
| 42 | ** Created : 990101
|
---|
| 43 | **
|
---|
| 44 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
---|
| 45 | **
|
---|
| 46 | ** This file is part of the widgets module of the Qt GUI Toolkit.
|
---|
| 47 | **
|
---|
| 48 | ** This file may be distributed under the terms of the Q Public License
|
---|
| 49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
| 50 | ** LICENSE.QPL included in the packaging of this file.
|
---|
| 51 | **
|
---|
| 52 | ** This file may be distributed and/or modified under the terms of the
|
---|
| 53 | ** GNU General Public License version 2 as published by the Free Software
|
---|
| 54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 55 | ** packaging of this file.
|
---|
| 56 | **
|
---|
| 57 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
| 58 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
| 59 | ** Agreement provided with the Software.
|
---|
| 60 | **
|
---|
| 61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
| 62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 63 | **
|
---|
| 64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
| 65 | ** information about Qt Commercial License Agreements.
|
---|
| 66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
| 67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
| 68 | **
|
---|
| 69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
| 70 | ** not clear to you.
|
---|
| 71 | **
|
---|
| 72 | **********************************************************************/
|
---|
| 73 |
|
---|
| 74 | #ifndef QTEXTEDIT_H
|
---|
| 75 | #define QTEXTEDIT_H
|
---|
| 76 |
|
---|
| 77 | #ifndef QT_H
|
---|
| 78 | #include "qscrollview.h"
|
---|
| 79 | #include "qstylesheet.h"
|
---|
| 80 | #include "qptrvector.h"
|
---|
| 81 | #include "qvaluelist.h"
|
---|
| 82 | #include "qptrlist.h"
|
---|
| 83 | #endif // QT_H
|
---|
| 84 |
|
---|
| 85 | #ifndef QT_NO_TEXTEDIT
|
---|
| 86 | // uncomment below to enable optimization mode - also uncomment the
|
---|
| 87 | // optimDoAutoScroll() private slot since moc ignores #ifdefs..
|
---|
| 88 | #define QT_TEXTEDIT_OPTIMIZATION
|
---|
| 89 |
|
---|
| 90 | class QPainter;
|
---|
| 91 | class QTextDocument;
|
---|
| 92 | class QTextCursor;
|
---|
| 93 | class QKeyEvent;
|
---|
| 94 | class QResizeEvent;
|
---|
| 95 | class QMouseEvent;
|
---|
| 96 | class QTimer;
|
---|
| 97 | class QTextString;
|
---|
| 98 | class QTextCommand;
|
---|
| 99 | class QTextParagraph;
|
---|
| 100 | class QTextFormat;
|
---|
| 101 | class QFont;
|
---|
| 102 | class QColor;
|
---|
| 103 | class QTextEdit;
|
---|
| 104 | class QTextBrowser;
|
---|
| 105 | class QTextString;
|
---|
| 106 | struct QUndoRedoInfoPrivate;
|
---|
| 107 | class QPopupMenu;
|
---|
| 108 | class QTextEditPrivate;
|
---|
| 109 | class QSyntaxHighlighter;
|
---|
| 110 |
|
---|
| 111 | #ifdef QT_TEXTEDIT_OPTIMIZATION
|
---|
| 112 | class QTextEditOptimPrivate
|
---|
| 113 | {
|
---|
| 114 | public:
|
---|
| 115 | // Note: no left-tag has any value for leftTag or parent, and
|
---|
| 116 | // no right-tag has any formatting flags set.
|
---|
| 117 | enum TagType { Color = 0, Format = 1 };
|
---|
| 118 | struct Tag {
|
---|
| 119 | TagType type:2;
|
---|
| 120 | bool bold:1;
|
---|
| 121 | bool italic:1;
|
---|
| 122 | bool underline:1;
|
---|
| 123 | int line;
|
---|
| 124 | int index;
|
---|
| 125 | Tag * leftTag; // ptr to left-tag in a left-right tag pair
|
---|
| 126 | Tag * parent; // ptr to parent left-tag in a nested tag
|
---|
| 127 | Tag * prev;
|
---|
| 128 | Tag * next;
|
---|
| 129 | QString tag;
|
---|
| 130 | };
|
---|
| 131 | QTextEditOptimPrivate()
|
---|
| 132 | {
|
---|
| 133 | len = numLines = maxLineWidth = 0;
|
---|
| 134 | selStart.line = selStart.index = -1;
|
---|
| 135 | selEnd.line = selEnd.index = -1;
|
---|
| 136 | search.line = search.index = 0;
|
---|
| 137 | tags = lastTag = 0;
|
---|
| 138 | }
|
---|
| 139 | void clearTags()
|
---|
| 140 | {
|
---|
| 141 | Tag * itr = tags;
|
---|
| 142 | while ( tags ) {
|
---|
| 143 | itr = tags;
|
---|
| 144 | tags = tags->next;
|
---|
| 145 | delete itr;
|
---|
| 146 | }
|
---|
| 147 | tags = lastTag = 0;
|
---|
| 148 | tagIndex.clear();
|
---|
| 149 | }
|
---|
| 150 | ~QTextEditOptimPrivate()
|
---|
| 151 | {
|
---|
| 152 | clearTags();
|
---|
| 153 | }
|
---|
| 154 | int len;
|
---|
| 155 | int numLines;
|
---|
| 156 | int maxLineWidth;
|
---|
| 157 | struct Selection {
|
---|
| 158 | int line;
|
---|
| 159 | int index;
|
---|
| 160 | };
|
---|
| 161 | Selection selStart, selEnd, search;
|
---|
| 162 | Tag * tags, * lastTag;
|
---|
| 163 | QMap<int, QString> lines;
|
---|
| 164 | QMap<int, Tag *> tagIndex;
|
---|
| 165 | };
|
---|
| 166 | #endif
|
---|
| 167 |
|
---|
| 168 | class Q_EXPORT QTextEdit : public QScrollView
|
---|
| 169 | {
|
---|
| 170 | friend class QTextBrowser;
|
---|
| 171 | friend class QSyntaxHighlighter;
|
---|
| 172 |
|
---|
| 173 | Q_OBJECT
|
---|
| 174 | Q_ENUMS( WordWrap WrapPolicy )
|
---|
| 175 | Q_SETS( AutoFormatting )
|
---|
| 176 | Q_PROPERTY( TextFormat textFormat READ textFormat WRITE setTextFormat )
|
---|
| 177 | Q_PROPERTY( QString text READ text WRITE setText )
|
---|
| 178 | Q_PROPERTY( QBrush paper READ paper WRITE setPaper )
|
---|
| 179 | Q_PROPERTY( bool linkUnderline READ linkUnderline WRITE setLinkUnderline )
|
---|
| 180 | Q_PROPERTY( QString documentTitle READ documentTitle )
|
---|
| 181 | Q_PROPERTY( int length READ length )
|
---|
| 182 | Q_PROPERTY( WordWrap wordWrap READ wordWrap WRITE setWordWrap )
|
---|
| 183 | Q_PROPERTY( int wrapColumnOrWidth READ wrapColumnOrWidth WRITE setWrapColumnOrWidth )
|
---|
| 184 | Q_PROPERTY( WrapPolicy wrapPolicy READ wrapPolicy WRITE setWrapPolicy )
|
---|
| 185 | Q_PROPERTY( bool hasSelectedText READ hasSelectedText )
|
---|
| 186 | Q_PROPERTY( QString selectedText READ selectedText )
|
---|
| 187 | Q_PROPERTY( int undoDepth READ undoDepth WRITE setUndoDepth )
|
---|
| 188 | Q_PROPERTY( bool overwriteMode READ isOverwriteMode WRITE setOverwriteMode )
|
---|
| 189 | Q_PROPERTY( bool modified READ isModified WRITE setModified DESIGNABLE false )
|
---|
| 190 | Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
|
---|
| 191 | Q_PROPERTY( bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled )
|
---|
| 192 | Q_PROPERTY( int tabStopWidth READ tabStopWidth WRITE setTabStopWidth )
|
---|
| 193 | Q_PROPERTY( bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus )
|
---|
| 194 | Q_PROPERTY( AutoFormatting autoFormatting READ autoFormatting WRITE setAutoFormatting )
|
---|
| 195 |
|
---|
| 196 | public:
|
---|
| 197 | enum WordWrap {
|
---|
| 198 | NoWrap,
|
---|
| 199 | WidgetWidth,
|
---|
| 200 | FixedPixelWidth,
|
---|
| 201 | FixedColumnWidth
|
---|
| 202 | };
|
---|
| 203 |
|
---|
| 204 | enum WrapPolicy {
|
---|
| 205 | AtWordBoundary,
|
---|
| 206 | AtWhiteSpace = AtWordBoundary, // AtWhiteSpace is deprecated
|
---|
| 207 | Anywhere,
|
---|
| 208 | AtWordOrDocumentBoundary
|
---|
| 209 | };
|
---|
| 210 |
|
---|
| 211 | enum AutoFormatting {
|
---|
| 212 | AutoNone = 0,
|
---|
| 213 | AutoBulletList = 0x00000001,
|
---|
| 214 | AutoAll = 0xffffffff
|
---|
| 215 | };
|
---|
| 216 |
|
---|
| 217 | enum KeyboardAction {
|
---|
| 218 | ActionBackspace,
|
---|
| 219 | ActionDelete,
|
---|
| 220 | ActionReturn,
|
---|
| 221 | ActionKill,
|
---|
| 222 | ActionWordBackspace,
|
---|
| 223 | ActionWordDelete
|
---|
| 224 | };
|
---|
| 225 |
|
---|
| 226 | enum CursorAction {
|
---|
| 227 | MoveBackward,
|
---|
| 228 | MoveForward,
|
---|
| 229 | MoveWordBackward,
|
---|
| 230 | MoveWordForward,
|
---|
| 231 | MoveUp,
|
---|
| 232 | MoveDown,
|
---|
| 233 | MoveLineStart,
|
---|
| 234 | MoveLineEnd,
|
---|
| 235 | MoveHome,
|
---|
| 236 | MoveEnd,
|
---|
| 237 | MovePgUp,
|
---|
| 238 | MovePgDown
|
---|
| 239 | };
|
---|
| 240 |
|
---|
| 241 | enum VerticalAlignment {
|
---|
| 242 | AlignNormal,
|
---|
| 243 | AlignSuperScript,
|
---|
| 244 | AlignSubScript
|
---|
| 245 | };
|
---|
| 246 |
|
---|
| 247 | enum TextInsertionFlags {
|
---|
| 248 | RedoIndentation = 0x0001,
|
---|
| 249 | CheckNewLines = 0x0002,
|
---|
| 250 | RemoveSelected = 0x0004
|
---|
| 251 | };
|
---|
| 252 |
|
---|
| 253 | QTextEdit( const QString& text, const QString& context = QString::null,
|
---|
| 254 | QWidget* parent=0, const char* name=0);
|
---|
| 255 | QTextEdit( QWidget* parent=0, const char* name=0 );
|
---|
| 256 | virtual ~QTextEdit();
|
---|
| 257 | void setPalette( const QPalette & );
|
---|
| 258 |
|
---|
| 259 | QString text() const;
|
---|
| 260 | QString text( int para ) const;
|
---|
| 261 | TextFormat textFormat() const;
|
---|
| 262 | QString context() const;
|
---|
| 263 | QString documentTitle() const;
|
---|
| 264 |
|
---|
| 265 | void getSelection( int *paraFrom, int *indexFrom,
|
---|
| 266 | int *paraTo, int *indexTo, int selNum = 0 ) const;
|
---|
| 267 | virtual bool find( const QString &expr, bool cs, bool wo, bool forward = TRUE,
|
---|
| 268 | int *para = 0, int *index = 0 );
|
---|
| 269 |
|
---|
| 270 | int paragraphs() const;
|
---|
| 271 | int lines() const;
|
---|
| 272 | int linesOfParagraph( int para ) const;
|
---|
| 273 | int lineOfChar( int para, int chr );
|
---|
| 274 | int length() const;
|
---|
| 275 | QRect paragraphRect( int para ) const;
|
---|
| 276 | int paragraphAt( const QPoint &pos ) const;
|
---|
| 277 | int charAt( const QPoint &pos, int *para ) const;
|
---|
| 278 | int paragraphLength( int para ) const;
|
---|
| 279 |
|
---|
| 280 | QStyleSheet* styleSheet() const;
|
---|
| 281 | #ifndef QT_NO_MIME
|
---|
| 282 | QMimeSourceFactory* mimeSourceFactory() const;
|
---|
| 283 | #endif
|
---|
| 284 | QBrush paper() const;
|
---|
| 285 | bool linkUnderline() const;
|
---|
| 286 |
|
---|
| 287 | int heightForWidth( int w ) const;
|
---|
| 288 |
|
---|
| 289 | bool hasSelectedText() const;
|
---|
| 290 | QString selectedText() const;
|
---|
| 291 | bool isUndoAvailable() const;
|
---|
| 292 | bool isRedoAvailable() const;
|
---|
| 293 |
|
---|
| 294 | WordWrap wordWrap() const;
|
---|
| 295 | int wrapColumnOrWidth() const;
|
---|
| 296 | WrapPolicy wrapPolicy() const;
|
---|
| 297 |
|
---|
| 298 | int tabStopWidth() const;
|
---|
| 299 |
|
---|
| 300 | QString anchorAt( const QPoint& pos );
|
---|
| 301 | QString anchorAt( const QPoint& pos, AnchorAttribute a );
|
---|
| 302 |
|
---|
| 303 | QSize sizeHint() const;
|
---|
| 304 |
|
---|
| 305 | bool isReadOnly() const { return readonly; }
|
---|
| 306 |
|
---|
| 307 | void getCursorPosition( int *parag, int *index ) const;
|
---|
| 308 |
|
---|
| 309 | bool isModified() const;
|
---|
| 310 | bool italic() const;
|
---|
| 311 | bool bold() const;
|
---|
| 312 | bool underline() const;
|
---|
| 313 | QString family() const;
|
---|
| 314 | int pointSize() const;
|
---|
| 315 | QColor color() const;
|
---|
| 316 | QFont font() const;
|
---|
| 317 | QFont currentFont() const;
|
---|
| 318 | int alignment() const;
|
---|
| 319 | int undoDepth() const;
|
---|
| 320 |
|
---|
| 321 | // do not use, will go away
|
---|
| 322 | virtual bool getFormat( int para, int index, QFont *font, QColor *color, VerticalAlignment *verticalAlignment );
|
---|
| 323 | // do not use, will go away
|
---|
| 324 | virtual bool getParagraphFormat( int para, QFont *font, QColor *color,
|
---|
| 325 | VerticalAlignment *verticalAlignment, int *alignment,
|
---|
| 326 | QStyleSheetItem::DisplayMode *displayMode,
|
---|
| 327 | QStyleSheetItem::ListStyle *listStyle,
|
---|
| 328 | int *listDepth );
|
---|
| 329 |
|
---|
| 330 |
|
---|
| 331 | bool isOverwriteMode() const { return overWrite; }
|
---|
| 332 | QColor paragraphBackgroundColor( int para ) const;
|
---|
| 333 |
|
---|
| 334 | bool isUndoRedoEnabled() const;
|
---|
| 335 | bool eventFilter( QObject *o, QEvent *e );
|
---|
| 336 | bool tabChangesFocus() const;
|
---|
| 337 |
|
---|
| 338 | void setAutoFormatting( uint features );
|
---|
| 339 | uint autoFormatting() const;
|
---|
| 340 | QSyntaxHighlighter *syntaxHighlighter() const;
|
---|
| 341 |
|
---|
| 342 | public slots:
|
---|
| 343 | void setEnabled( bool );
|
---|
| 344 | #ifndef QT_NO_MIME
|
---|
| 345 | virtual void setMimeSourceFactory( QMimeSourceFactory* factory );
|
---|
| 346 | #endif
|
---|
| 347 | virtual void setStyleSheet( QStyleSheet* styleSheet );
|
---|
| 348 | virtual void scrollToAnchor( const QString& name );
|
---|
| 349 | virtual void setPaper( const QBrush& pap );
|
---|
| 350 | virtual void setLinkUnderline( bool );
|
---|
| 351 |
|
---|
| 352 | virtual void setWordWrap( WordWrap mode );
|
---|
| 353 | virtual void setWrapColumnOrWidth( int );
|
---|
| 354 | virtual void setWrapPolicy( WrapPolicy policy );
|
---|
| 355 |
|
---|
| 356 | virtual void copy();
|
---|
| 357 | virtual void append( const QString& text );
|
---|
| 358 |
|
---|
| 359 | void setText( const QString &txt ) { setText( txt, QString::null ); }
|
---|
| 360 | virtual void setText( const QString &txt, const QString &context );
|
---|
| 361 | virtual void setTextFormat( TextFormat f );
|
---|
| 362 |
|
---|
| 363 | virtual void selectAll( bool select = TRUE );
|
---|
| 364 | virtual void setTabStopWidth( int ts );
|
---|
| 365 | virtual void zoomIn( int range );
|
---|
| 366 | virtual void zoomIn() { zoomIn( 1 ); }
|
---|
| 367 | virtual void zoomOut( int range );
|
---|
| 368 | virtual void zoomOut() { zoomOut( 1 ); }
|
---|
| 369 | virtual void zoomTo( int size );
|
---|
| 370 |
|
---|
| 371 | virtual void sync();
|
---|
| 372 | virtual void setReadOnly( bool b );
|
---|
| 373 |
|
---|
| 374 | virtual void undo();
|
---|
| 375 | virtual void redo();
|
---|
| 376 | virtual void cut();
|
---|
| 377 | virtual void paste();
|
---|
| 378 | #ifndef QT_NO_CLIPBOARD
|
---|
| 379 | virtual void pasteSubType( const QCString &subtype );
|
---|
| 380 | #endif
|
---|
| 381 | virtual void clear();
|
---|
| 382 | virtual void del();
|
---|
| 383 | virtual void indent();
|
---|
| 384 | virtual void setItalic( bool b );
|
---|
| 385 | virtual void setBold( bool b );
|
---|
| 386 | virtual void setUnderline( bool b );
|
---|
| 387 | virtual void setFamily( const QString &f );
|
---|
| 388 | virtual void setPointSize( int s );
|
---|
| 389 | virtual void setColor( const QColor &c );
|
---|
| 390 | virtual void setFont( const QFont &f );
|
---|
| 391 | virtual void setVerticalAlignment( VerticalAlignment a );
|
---|
| 392 | virtual void setAlignment( int a );
|
---|
| 393 |
|
---|
| 394 | // do not use, will go away
|
---|
| 395 | virtual void setParagType( QStyleSheetItem::DisplayMode dm, QStyleSheetItem::ListStyle listStyle );
|
---|
| 396 |
|
---|
| 397 | virtual void setCursorPosition( int parag, int index );
|
---|
| 398 | virtual void setSelection( int parag_from, int index_from, int parag_to, int index_to, int selNum = 0 );
|
---|
| 399 | virtual void setSelectionAttributes( int selNum, const QColor &back, bool invertText );
|
---|
| 400 | virtual void setModified( bool m );
|
---|
| 401 | virtual void resetFormat();
|
---|
| 402 | virtual void setUndoDepth( int d );
|
---|
| 403 | virtual void setFormat( QTextFormat *f, int flags );
|
---|
| 404 | virtual void ensureCursorVisible();
|
---|
| 405 | virtual void placeCursor( const QPoint &pos, QTextCursor *c = 0 );
|
---|
| 406 | virtual void moveCursor( CursorAction action, bool select );
|
---|
| 407 | virtual void doKeyboardAction( KeyboardAction action );
|
---|
| 408 | virtual void removeSelectedText( int selNum = 0 );
|
---|
| 409 | virtual void removeSelection( int selNum = 0 );
|
---|
| 410 | virtual void setCurrentFont( const QFont &f );
|
---|
| 411 | virtual void setOverwriteMode( bool b ) { overWrite = b; }
|
---|
| 412 |
|
---|
| 413 | virtual void scrollToBottom();
|
---|
| 414 |
|
---|
| 415 | void insert( const QString &text, uint insertionFlags = CheckNewLines | RemoveSelected ); // ## virtual in 4.0
|
---|
| 416 |
|
---|
| 417 | // obsolete
|
---|
| 418 | virtual void insert( const QString &text, bool, bool = TRUE, bool = TRUE );
|
---|
| 419 |
|
---|
| 420 | virtual void insertAt( const QString &text, int para, int index );
|
---|
| 421 | virtual void removeParagraph( int para );
|
---|
| 422 | virtual void insertParagraph( const QString &text, int para );
|
---|
| 423 |
|
---|
| 424 | virtual void setParagraphBackgroundColor( int para, const QColor &bg );
|
---|
| 425 | virtual void clearParagraphBackground( int para );
|
---|
| 426 |
|
---|
| 427 | virtual void setUndoRedoEnabled( bool b );
|
---|
| 428 | void setTabChangesFocus( bool b ); // ### make virtual in 4.0
|
---|
| 429 |
|
---|
| 430 | #ifdef QT_TEXTEDIT_OPTIMIZATION
|
---|
| 431 | void polish();
|
---|
| 432 | void setMaxLogLines( int numLines );
|
---|
| 433 | int maxLogLines();
|
---|
| 434 | #endif
|
---|
| 435 |
|
---|
| 436 | signals:
|
---|
| 437 | void textChanged();
|
---|
| 438 | void selectionChanged();
|
---|
| 439 | void copyAvailable( bool );
|
---|
| 440 | void undoAvailable( bool yes );
|
---|
| 441 | void redoAvailable( bool yes );
|
---|
| 442 | void currentFontChanged( const QFont &f );
|
---|
| 443 | void currentColorChanged( const QColor &c );
|
---|
| 444 | void currentAlignmentChanged( int a );
|
---|
| 445 | void currentVerticalAlignmentChanged( VerticalAlignment a );
|
---|
| 446 | void cursorPositionChanged( QTextCursor *c );
|
---|
| 447 | void cursorPositionChanged( int para, int pos );
|
---|
| 448 | void returnPressed();
|
---|
| 449 | void modificationChanged( bool m );
|
---|
| 450 | void clicked( int parag, int index );
|
---|
| 451 | void doubleClicked( int parag, int index );
|
---|
| 452 |
|
---|
| 453 | protected:
|
---|
| 454 | void repaintChanged();
|
---|
| 455 | void updateStyles();
|
---|
| 456 | void drawContents( QPainter *p, int cx, int cy, int cw, int ch );
|
---|
| 457 | bool event( QEvent *e );
|
---|
| 458 | void keyPressEvent( QKeyEvent *e );
|
---|
| 459 | void resizeEvent( QResizeEvent *e );
|
---|
| 460 | void viewportResizeEvent( QResizeEvent* );
|
---|
| 461 | void contentsMousePressEvent( QMouseEvent *e );
|
---|
| 462 | void contentsMouseMoveEvent( QMouseEvent *e );
|
---|
| 463 | void contentsMouseReleaseEvent( QMouseEvent *e );
|
---|
| 464 | void contentsMouseDoubleClickEvent( QMouseEvent *e );
|
---|
| 465 | #ifndef QT_NO_WHEELEVENT
|
---|
| 466 | void contentsWheelEvent( QWheelEvent *e );
|
---|
| 467 | #endif
|
---|
| 468 | void imStartEvent( QIMEvent * );
|
---|
| 469 | void imComposeEvent( QIMEvent * );
|
---|
| 470 | void imEndEvent( QIMEvent * );
|
---|
| 471 | #ifndef QT_NO_DRAGANDDROP
|
---|
| 472 | void contentsDragEnterEvent( QDragEnterEvent *e );
|
---|
| 473 | void contentsDragMoveEvent( QDragMoveEvent *e );
|
---|
| 474 | void contentsDragLeaveEvent( QDragLeaveEvent *e );
|
---|
| 475 | void contentsDropEvent( QDropEvent *e );
|
---|
| 476 | #endif
|
---|
| 477 | void contentsContextMenuEvent( QContextMenuEvent *e );
|
---|
| 478 | bool focusNextPrevChild( bool next );
|
---|
| 479 | QTextDocument *document() const;
|
---|
| 480 | QTextCursor *textCursor() const;
|
---|
| 481 | void setDocument( QTextDocument *doc );
|
---|
| 482 | virtual QPopupMenu *createPopupMenu( const QPoint& pos );
|
---|
| 483 | virtual QPopupMenu *createPopupMenu();
|
---|
| 484 | void drawCursor( bool visible );
|
---|
| 485 |
|
---|
| 486 | void windowActivationChange( bool );
|
---|
| 487 |
|
---|
| 488 | protected slots:
|
---|
| 489 | virtual void doChangeInterval();
|
---|
| 490 | void sliderReleased(); // ### make virtual in 4.0
|
---|
| 491 | #if (QT_VERSION >= 0x040000)
|
---|
| 492 | #error "Some functions need to be changed to virtual for Qt 4.0"
|
---|
| 493 | #endif
|
---|
| 494 |
|
---|
| 495 | private slots:
|
---|
| 496 | void formatMore();
|
---|
| 497 | void doResize();
|
---|
| 498 | void autoScrollTimerDone();
|
---|
| 499 | void blinkCursor();
|
---|
| 500 | void setModified();
|
---|
| 501 | void startDrag();
|
---|
| 502 | void documentWidthChanged( int w );
|
---|
| 503 | void clipboardChanged();
|
---|
| 504 |
|
---|
| 505 | private:
|
---|
| 506 | struct Q_EXPORT UndoRedoInfo {
|
---|
| 507 | enum Type { Invalid, Insert, Delete, Backspace, Return, RemoveSelected, Format, Style, IME };
|
---|
| 508 |
|
---|
| 509 | UndoRedoInfo( QTextDocument *dc );
|
---|
| 510 | ~UndoRedoInfo();
|
---|
| 511 | void clear();
|
---|
| 512 | bool valid() const;
|
---|
| 513 |
|
---|
| 514 | QUndoRedoInfoPrivate *d;
|
---|
| 515 | int id;
|
---|
| 516 | int index;
|
---|
| 517 | int eid;
|
---|
| 518 | int eindex;
|
---|
| 519 | QTextFormat *format;
|
---|
| 520 | int flags;
|
---|
| 521 | Type type;
|
---|
| 522 | QTextDocument *doc;
|
---|
| 523 | QByteArray styleInformation;
|
---|
| 524 | };
|
---|
| 525 |
|
---|
| 526 | private:
|
---|
| 527 | void updateCursor( const QPoint & pos );
|
---|
| 528 | void handleMouseMove( const QPoint& pos );
|
---|
| 529 | void drawContents( QPainter * );
|
---|
| 530 | virtual bool linksEnabled() const { return FALSE; }
|
---|
| 531 | void init();
|
---|
| 532 | void checkUndoRedoInfo( UndoRedoInfo::Type t );
|
---|
| 533 | void updateCurrentFormat();
|
---|
| 534 | bool handleReadOnlyKeyEvent( QKeyEvent *e );
|
---|
| 535 | void makeParagVisible( QTextParagraph *p );
|
---|
| 536 | void normalCopy();
|
---|
| 537 | void copyToClipboard();
|
---|
| 538 | #ifndef QT_NO_MIME
|
---|
| 539 | QCString pickSpecial(QMimeSource* ms, bool always_ask, const QPoint&);
|
---|
| 540 | QTextDrag *dragObject( QWidget *parent = 0 ) const;
|
---|
| 541 | #endif
|
---|
| 542 | #ifndef QT_NO_MIMECLIPBOARD
|
---|
| 543 | void pasteSpecial(const QPoint&);
|
---|
| 544 | #endif
|
---|
| 545 | void setFontInternal( const QFont &f );
|
---|
| 546 |
|
---|
| 547 | virtual void emitHighlighted( const QString & ) {}
|
---|
| 548 | virtual void emitLinkClicked( const QString & ) {}
|
---|
| 549 |
|
---|
| 550 | void readFormats( QTextCursor &c1, QTextCursor &c2, QTextString &text, bool fillStyles = FALSE );
|
---|
| 551 | void clearUndoRedo();
|
---|
| 552 | void paintDocument( bool drawAll, QPainter *p, int cx = -1, int cy = -1, int cw = -1, int ch = -1 );
|
---|
| 553 | void moveCursor( CursorAction action );
|
---|
| 554 | void ensureFormatted( QTextParagraph *p );
|
---|
| 555 | void placeCursor( const QPoint &pos, QTextCursor *c, bool link );
|
---|
| 556 | void updateMicroFocusHint();
|
---|
| 557 |
|
---|
| 558 | #ifdef QT_TEXTEDIT_OPTIMIZATION
|
---|
| 559 | bool checkOptimMode();
|
---|
| 560 | QString optimText() const;
|
---|
| 561 | void optimSetText( const QString &str );
|
---|
| 562 | void optimAppend( const QString &str );
|
---|
| 563 | void optimInsert( const QString &str, int line, int index );
|
---|
| 564 | void optimDrawContents( QPainter * p, int cx, int cy, int cw, int ch );
|
---|
| 565 | void optimMousePressEvent( QMouseEvent * e );
|
---|
| 566 | void optimMouseReleaseEvent( QMouseEvent * e );
|
---|
| 567 | void optimMouseMoveEvent( QMouseEvent * e );
|
---|
| 568 | int optimCharIndex( const QString &str, int mx ) const;
|
---|
| 569 | void optimSelectAll();
|
---|
| 570 | void optimRemoveSelection();
|
---|
| 571 | void optimSetSelection( int startLine, int startIdx, int endLine,
|
---|
| 572 | int endIdx );
|
---|
| 573 | bool optimHasSelection() const;
|
---|
| 574 | QString optimSelectedText() const;
|
---|
| 575 | bool optimFind( const QString & str, bool, bool, bool, int *, int * );
|
---|
| 576 | void optimParseTags( QString * str, int lineNo = -1, int indexOffset = 0 );
|
---|
| 577 | QTextEditOptimPrivate::Tag * optimPreviousLeftTag( int line );
|
---|
| 578 | void optimSetTextFormat( QTextDocument *, QTextCursor *, QTextFormat * f,
|
---|
| 579 | int, int, QTextEditOptimPrivate::Tag * t );
|
---|
| 580 | QTextEditOptimPrivate::Tag * optimAppendTag( int index, const QString & tag );
|
---|
| 581 | QTextEditOptimPrivate::Tag * optimInsertTag( int line, int index, const QString & tag );
|
---|
| 582 | void optimCheckLimit( const QString& str );
|
---|
| 583 | bool optimHasBoldMetrics( int line );
|
---|
| 584 |
|
---|
| 585 | private slots:
|
---|
| 586 | void optimDoAutoScroll();
|
---|
| 587 | #endif // QT_TEXTEDIT_OPTIMIZATION
|
---|
| 588 |
|
---|
| 589 | private:
|
---|
| 590 | #ifndef QT_NO_CLIPBOARD
|
---|
| 591 | void pasteSubType( const QCString &subtype, QMimeSource *m );
|
---|
| 592 | #endif
|
---|
| 593 |
|
---|
| 594 | private:
|
---|
| 595 | QTextDocument *doc;
|
---|
| 596 | QTextCursor *cursor;
|
---|
| 597 | QTimer *formatTimer, *scrollTimer, *changeIntervalTimer, *blinkTimer, *dragStartTimer;
|
---|
| 598 | QTextParagraph *lastFormatted;
|
---|
| 599 | int interval;
|
---|
| 600 | UndoRedoInfo undoRedoInfo;
|
---|
| 601 | QTextFormat *currentFormat;
|
---|
| 602 | int currentAlignment;
|
---|
| 603 | QPoint oldMousePos, mousePos;
|
---|
| 604 | QPoint dragStartPos;
|
---|
| 605 | QString onLink;
|
---|
| 606 | WordWrap wrapMode;
|
---|
| 607 | WrapPolicy wPolicy;
|
---|
| 608 | int wrapWidth;
|
---|
| 609 | QString pressedLink;
|
---|
| 610 | QTextEditPrivate *d;
|
---|
| 611 | bool inDoubleClick : 1;
|
---|
| 612 | bool mousePressed : 1;
|
---|
| 613 | bool cursorVisible : 1;
|
---|
| 614 | bool blinkCursorVisible : 1;
|
---|
| 615 | bool readOnly : 1;
|
---|
| 616 | bool modified : 1;
|
---|
| 617 | bool mightStartDrag : 1;
|
---|
| 618 | bool inDnD : 1;
|
---|
| 619 | bool readonly : 1;
|
---|
| 620 | bool undoEnabled : 1;
|
---|
| 621 | bool overWrite : 1;
|
---|
| 622 |
|
---|
| 623 | private: // Disabled copy constructor and operator=
|
---|
| 624 | #if defined(Q_DISABLE_COPY)
|
---|
| 625 | QTextEdit( const QTextEdit & );
|
---|
| 626 | QTextEdit &operator=( const QTextEdit & );
|
---|
| 627 | #endif
|
---|
| 628 | };
|
---|
| 629 |
|
---|
| 630 | inline QTextDocument *QTextEdit::document() const
|
---|
| 631 | {
|
---|
| 632 | return doc;
|
---|
| 633 | }
|
---|
| 634 |
|
---|
| 635 | inline QTextCursor *QTextEdit::textCursor() const
|
---|
| 636 | {
|
---|
| 637 | return cursor;
|
---|
| 638 | }
|
---|
| 639 |
|
---|
| 640 | inline void QTextEdit::setCurrentFont( const QFont &f )
|
---|
| 641 | {
|
---|
| 642 | QTextEdit::setFontInternal( f );
|
---|
| 643 | }
|
---|
| 644 |
|
---|
| 645 | #endif //QT_NO_TEXTEDIT
|
---|
| 646 | #endif //QTEXTVIEW_H
|
---|
| 647 | </pre>
|
---|
| 648 | <!-- eof -->
|
---|
| 649 | <p><address><hr><div align=center>
|
---|
| 650 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 651 | <td>Copyright © 2007
|
---|
| 652 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 653 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 654 | </table></div></address></body>
|
---|
| 655 | </html>
|
---|