#include "q3textedit.h"
#include <private/q3richtext_p.h>
#include "qpainter.h"
#include "qpen.h"
#include "qbrush.h"
#include "qpixmap.h"
#include "qfont.h"
#include "qcolor.h"
#include "qstyle.h"
#include "qsize.h"
#include "qevent.h"
#include "qtimer.h"
#include "qapplication.h"
#include "q3listbox.h"
#include "qclipboard.h"
#include "qcolordialog.h"
#include "q3stylesheet.h"
#include "q3dragobject.h"
#include "qurl.h"
#include "qcursor.h"
#include "qregexp.h"
#include "q3popupmenu.h"
#include "qstack.h"
#include "qmetaobject.h"
#include "q3textbrowser.h"
#include "private/q3syntaxhighlighter_p.h"
#include "qtextformat.h"
#include <qinputcontext.h>
#include <qkeysequence.h>
Include dependency graph for q3textedit.cpp:

Go to the source code of this file.
Classes | |
| struct | QUndoRedoInfoPrivate |
| class | Q3TextEditPrivate |
| class | Q3RichTextDrag |
Defines | |
| #define | ACCEL_KEY(k) "\t" + QString(QKeySequence(Qt::CTRL | Qt::Key_ ## k)) |
| #define | LOGOFFSET(i) d->logOffset + i |
Enumerations | |
| enum | |
Functions | |
| static void | qSwap (int *a, int *b) |
| static int | qStrWidth (const QString &str, int tabWidth, const QFontMetrics &fm) |
| static void | qStripTags (QString *line) |
Variables | |
| static bool | block_set_alignment = false |
| static bool | qtextedit_ignore_readonly = false |
| #define ACCEL_KEY | ( | k | ) | "\t" + QString(QKeySequence(Qt::CTRL | Qt::Key_ ## k)) |
Definition at line 60 of file q3textedit.cpp.
| #define LOGOFFSET | ( | i | ) | d->logOffset + i |
Definition at line 66 of file q3textedit.cpp.
Referenced by Q3TextEdit::changeEvent(), Q3TextEdit::charAt(), Q3TextEdit::contentsMouseDoubleClickEvent(), Q3TextEdit::optimAppendTag(), Q3TextEdit::optimCheckLimit(), Q3TextEdit::optimDoAutoScroll(), Q3TextEdit::optimDrawContents(), Q3TextEdit::optimFind(), Q3TextEdit::optimInsert(), Q3TextEdit::optimInsertTag(), Q3TextEdit::optimMousePressEvent(), Q3TextEdit::optimMouseReleaseEvent(), Q3TextEdit::optimPreviousLeftTag(), Q3TextEdit::optimSelectAll(), Q3TextEdit::optimSelectedText(), Q3TextEdit::optimText(), Q3TextEdit::paragraphLength(), and Q3TextEdit::text().
| anonymous enum |
Definition at line 2086 of file q3textedit.cpp.
02086 { 02087 IdUndo = 0, 02088 IdRedo = 1, 02089 IdCut = 2, 02090 IdCopy = 3, 02091 IdPaste = 4, 02092 IdClear = 5, 02093 IdSelectAll = 6 02094 };
| static void qStripTags | ( | QString * | line | ) | [static] |
Definition at line 6384 of file q3textedit.cpp.
References c, i, l, len, QString::length(), QString::mid(), QString::remove(), and QString::replace().
Referenced by Q3TextEdit::optimInsert().
06385 { 06386 int len = line->length(); 06387 int i, startIndex = -1, endIndex = -1, escIndex = -1; 06388 int state = 0; // 0 = outside tag, 1 = inside tag 06389 bool tagOpen, tagClose; 06390 06391 for (i = 0; i < len; i++) { 06392 tagOpen = (*line)[i] == '<'; 06393 tagClose = (*line)[i] == '>'; 06394 06395 // handle '<' and '>' and '&' 06396 if ((*line)[i] == '&') { 06397 escIndex = i; 06398 continue; 06399 } else if (escIndex != -1 && (*line)[i] == ';') { 06400 QString esc = line->mid(escIndex, i - escIndex + 1); 06401 QString c; 06402 if (esc == "<") 06403 c = '<'; 06404 else if (esc == ">") 06405 c = '>'; 06406 else if (esc == "&") 06407 c = '&'; 06408 line->replace(escIndex, i - escIndex + 1, c); 06409 len = line->length(); 06410 i -= i-escIndex; 06411 escIndex = -1; 06412 continue; 06413 } 06414 06415 if (state == 0 && tagOpen) { 06416 state = 1; 06417 startIndex = i; 06418 continue; 06419 } 06420 if (state == 1 && tagClose) { 06421 state = 0; 06422 endIndex = i; 06423 if (startIndex != -1) { 06424 int l = (endIndex == -1) ? 06425 line->length() - startIndex : endIndex - startIndex; 06426 line->remove(startIndex, l+1); 06427 len = line->length(); 06428 i -= l+1; 06429 } 06430 continue; 06431 } 06432 } 06433 }
Here is the call graph for this function:

| static int qStrWidth | ( | const QString & | str, | |
| int | tabWidth, | |||
| const QFontMetrics & | fm | |||
| ) | [static] |
Definition at line 6298 of file q3textedit.cpp.
References QString::count(), u, and QFontMetrics::width().
Referenced by Q3TextEdit::optimAppend(), and Q3TextEdit::optimCharIndex().
06299 { 06300 int tabs = str.count('\t'); 06301 06302 if (!tabs) 06303 return fm.width(str); 06304 06305 int newIdx = 0; 06306 int lastIdx = 0; 06307 int strWidth = 0; 06308 int tn; 06309 for (tn = 1; tn <= tabs; ++tn) { 06310 newIdx = str.indexOf('\t', newIdx); 06311 strWidth += fm.width(str.mid(lastIdx, newIdx - lastIdx)); 06312 if (strWidth >= tn * tabWidth) { 06313 int u = tn; 06314 while (strWidth >= u * tabWidth) 06315 ++u; 06316 strWidth = u * tabWidth; 06317 } else { 06318 strWidth = tn * tabWidth; 06319 } 06320 lastIdx = ++newIdx; 06321 } 06322 if ((int)str.length() > newIdx) 06323 strWidth += fm.width(str.mid(newIdx)); 06324 return strWidth; 06325 }
Here is the call graph for this function:

| static void qSwap | ( | int * | a, | |
| int * | b | |||
| ) | [static] |
bool block_set_alignment = false [static] |
Definition at line 194 of file q3textedit.cpp.
Referenced by Q3TextEdit::handleMouseMove(), Q3TextEdit::setAlignment(), and Q3TextEdit::updateCurrentFormat().
bool qtextedit_ignore_readonly = false [static] |
Definition at line 1606 of file q3textedit.cpp.
Referenced by Q3TextEdit::doKeyboardAction(), and Q3TextEdit::insertParagraph().
1.5.1