45 #include <QtGui/qabstractscrollarea.h> 46 #include <QtGui/qtextdocument.h> 47 #include <QtGui/qtextoption.h> 48 #include <QtGui/qtextcursor.h> 49 #include <QtGui/qtextformat.h> 51 #ifndef QT_NO_TEXTEDIT 54 #include <QtGui/qtextobject.h> 55 #include <QtGui/qtextlayout.h> 76 AutoFormatting autoFormatting;
82 int lineWrapColumnOrWidth;
84 #ifndef QT_NO_TEXTHTMLPARSER 103 AutoBulletList = 0x00000001,
109 #if defined(QT3_SUPPORT) 123 #if !defined(Q_MOC_RUN) 125 MovePgUp = MovePageUp,
126 MovePgDown = MovePageDown
141 bool isReadOnly()
const;
142 void setReadOnly(
bool ro);
144 void setTextInteractionFlags(Qt::TextInteractionFlags flags);
145 Qt::TextInteractionFlags textInteractionFlags()
const;
147 qreal fontPointSize()
const;
149 int fontWeight()
const;
150 bool fontUnderline()
const;
151 bool fontItalic()
const;
153 QColor textBackgroundColor()
const;
154 QFont currentFont()
const;
155 Qt::Alignment alignment()
const;
162 AutoFormatting autoFormatting()
const;
163 void setAutoFormatting(AutoFormatting features);
165 bool tabChangesFocus()
const;
166 void setTabChangesFocus(
bool b);
181 int lineWrapColumnOrWidth()
const;
182 void setLineWrapColumnOrWidth(
int w);
187 bool find(
const QString &exp, QTextDocument::FindFlags options = 0);
191 #ifndef QT_NO_TEXTHTMLPARSER 193 {
return document()->
toHtml(); }
196 void ensureCursorVisible();
199 #ifndef QT_NO_CONTEXTMENU 200 QMenu *createStandardContextMenu();
206 QRect cursorRect()
const;
210 bool overwriteMode()
const;
211 void setOverwriteMode(
bool overwrite);
213 int tabStopWidth()
const;
214 void setTabStopWidth(
int width);
216 int cursorWidth()
const;
217 void setCursorWidth(
int width);
219 bool acceptRichText()
const;
220 void setAcceptRichText(
bool accept);
232 bool canPaste()
const;
234 #ifndef QT_NO_PRINTER 235 void print(
QPrinter *printer)
const;
239 void setFontPointSize(
qreal s);
240 void setFontFamily(
const QString &fontFamily);
241 void setFontWeight(
int w);
242 void setFontUnderline(
bool b);
243 void setFontItalic(
bool b);
244 void setTextColor(
const QColor &
c);
245 void setTextBackgroundColor(
const QColor &
c);
246 void setCurrentFont(
const QFont &f);
247 void setAlignment(Qt::Alignment
a);
249 void setPlainText(
const QString &text);
250 #ifndef QT_NO_TEXTHTMLPARSER 251 void setHtml(
const QString &text);
253 void setText(
const QString &text);
255 #ifndef QT_NO_CLIPBOARD 267 void insertPlainText(
const QString &text);
268 #ifndef QT_NO_TEXTHTMLPARSER 269 void insertHtml(
const QString &text);
270 #endif // QT_NO_TEXTHTMLPARSER 272 void append(
const QString &text);
274 void scrollToAnchor(
const QString &name);
276 void zoomIn(
int range = 1);
277 void zoomOut(
int range = 1);
281 void undoAvailable(
bool b);
282 void redoAvailable(
bool b);
284 void copyAvailable(
bool b);
285 void selectionChanged();
286 void cursorPositionChanged();
291 virtual void keyPressEvent(
QKeyEvent *e);
292 virtual void keyReleaseEvent(
QKeyEvent *e);
298 virtual void mouseDoubleClickEvent(
QMouseEvent *e);
299 virtual bool focusNextPrevChild(
bool next);
300 #ifndef QT_NO_CONTEXTMENU 303 #ifndef QT_NO_DRAGANDDROP 312 virtual void changeEvent(
QEvent *e);
313 #ifndef QT_NO_WHEELEVENT 317 virtual QMimeData *createMimeDataFromSelection()
const;
318 virtual bool canInsertFromMimeData(
const QMimeData *source)
const;
319 virtual void insertFromMimeData(
const QMimeData *source);
326 virtual void scrollContentsBy(
int dx,
int dy);
335 inline QT3_SUPPORT
bool find(
const QString &exp,
bool cs,
bool wo)
337 QTextDocument::FindFlags flags = 0;
342 return find(exp, flags);
345 inline QT3_SUPPORT
void sync() {}
350 enum KeyboardAction {
359 QT3_SUPPORT
void doKeyboardAction(KeyboardAction action);
366 inline QT3_SUPPORT
void setUnderline(
bool b) { setFontUnderline(b); }
367 inline QT3_SUPPORT
void setItalic(
bool i) { setFontItalic(i); }
368 inline QT3_SUPPORT
void setFamily(
const QString &family) { setFontFamily(family); }
369 inline QT3_SUPPORT
void setPointSize(
int size) { setFontPointSize(size); }
371 inline QT3_SUPPORT
bool italic()
const {
return fontItalic(); }
372 inline QT3_SUPPORT
bool bold()
const {
return fontWeight() >=
QFont::Bold; }
373 inline QT3_SUPPORT
bool underline()
const {
return fontUnderline(); }
374 inline QT3_SUPPORT
QString family()
const {
return fontFamily(); }
375 inline QT3_SUPPORT
int pointSize()
const {
return (
int)(fontPointSize()+0.5); }
377 inline QT3_SUPPORT
bool hasSelectedText()
const 379 inline QT3_SUPPORT
QString selectedText()
const 382 inline QT3_SUPPORT
bool isUndoAvailable()
const 384 inline QT3_SUPPORT
bool isRedoAvailable()
const 387 inline QT3_SUPPORT
void insert(
const QString &text)
388 { insertPlainText(text); }
390 inline QT3_SUPPORT
bool isModified()
const 393 inline QT3_SUPPORT
QColor color()
const 394 {
return textColor(); }
400 inline QT3_SUPPORT
void undo()
const 401 { document()->
undo(); }
402 inline QT3_SUPPORT
void redo()
const 403 { document()->
redo(); }
428 #endif // QT_NO_TEXTEDIT 430 #endif // QTEXTEDIT_H The QVariant class acts like a union for the most common Qt data types.
bool acceptRichText
whether the text edit accepts rich text insertions by the user
The QColor class provides colors based on RGB, HSV or CMYK values.
The QKeyEvent class describes a key event.
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
#define QT_END_NAMESPACE
This macro expands to.
#define QDOC_PROPERTY(text)
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
void setDocumentTitle(const QString &title)
Qt::TextInteractionFlags textInteractionFlags
Specifies how the widget should interact with user input.
The QWheelEvent class contains parameters that describe a wheel event.
void setModified(bool m=true)
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
WrapMode
This enum describes how text is wrapped in a document.
static void clear(QVariant::Private *d)
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *)
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
#define Q_PRIVATE_SLOT(d, signature)
long ASN1_INTEGER_get ASN1_INTEGER * a
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress...
QString selectedText() const
Returns the current selection's text (which may be empty).
QString toPlainText() const
Returns the plain text contained in the document.
QString documentTitle() const
void setMetaInformation(MetaInformation info, const QString &)
Sets the document's meta information of the type specified by info to the given string.
static QCursor * moveCursor
QString toPlainText() const
Returns the text of the text edit as plain text.
#define QT_BEGIN_NAMESPACE
This macro expands to.
MoveMode
If the anchor() is kept where it is and the position() is moved, the text in between will be selected...
The QRectF class defines a rectangle in the plane using floating point precision. ...
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
bool hasSelection() const
Returns true if the cursor contains a selection; otherwise returns false.
bool isUndoRedoEnabled() const
The QTextCursor class offers an API to access and modify QTextDocuments.
void undo(QTextCursor *cursor)
Undoes the last editing operation on the document if undo is available.
The QPrinter class is a paint device that paints on a printer.
bool isUndoRedoEnabled() const
bool overwriteMode
whether text entered by the user will overwrite existing text
The QResizeEvent class contains event parameters for resize events.
The QDragLeaveEvent class provides an event that is sent to a widget when a drag and drop action leav...
The QShowEvent class provides an event that is sent when a widget is shown.
The QMimeData class provides a container for data that records information about its MIME type...
bool isUndoAvailable() const
Returns true if undo is available; otherwise returns false.
void redo(QTextCursor *cursor)
Redoes the last editing operation on the document if redo is available.
int cursorWidth
This property specifies the width of the cursor in pixels.
The QMouseEvent class contains parameters that describe a mouse event.
int tabStopWidth
the tab stop width in pixels
QString html
This property provides an HTML interface to the text of the text edit.
The QDropEvent class provides an event which is sent when a drag and drop action is completed...
The QTimerEvent class contains parameters that describe a timer event.
The QFont class specifies a font used for drawing text.
The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action ent...
QString metaInformation(MetaInformation info) const
Returns meta information about the document of the type specified by info.
The QPoint class defines a point in the plane using integer precision.
void setUndoRedoEnabled(bool enable)
The QRect class defines a rectangle in the plane using integer precision.
The QTextOption class provides a description of general rich text properties.
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
QString plainText
This property gets and sets the text editor's contents as plain text.
#define Q_DECLARE_PRIVATE(Class)
void setUndoRedoEnabled(bool enable)
The QPaintEvent class contains event parameters for paint events.
The QEvent class is the base class of all event classes.
static float pointSize(const QFontDef &fd, int dpi)
QString toHtml(const QByteArray &encoding=QByteArray()) const
Returns a string containing an HTML representation of the document.
The QFocusEvent class contains event parameters for widget focus events.
The QTextEdit class provides a widget that is used to edit and display both plain and rich text...
bool isRedoAvailable() const
Returns true if redo is available; otherwise returns false.
The QList class is a template class that provides lists.