KDEUI
krichtextedit.h
Go to the documentation of this file.
00001 00024 #ifndef KRICHTEXTEDIT_H 00025 #define KRICHTEXTEDIT_H 00026 00027 #include <ktextedit.h> 00028 00029 class QMouseEvent; 00030 class QKeyEvent; 00031 00032 class KRichTextEditPrivate; 00033 00034 #include <kdeui_export.h> 00035 00063 class KDEUI_EXPORT KRichTextEdit : public KTextEdit 00064 { 00065 Q_OBJECT 00066 00067 public: 00068 00072 enum Mode { Plain, 00073 Rich 00074 }; 00075 00083 explicit KRichTextEdit(const QString& text, QWidget *parent = 0); 00084 00090 explicit KRichTextEdit(QWidget *parent = 0); 00091 00095 virtual ~KRichTextEdit(); 00096 00101 void enableRichTextMode(); 00102 00106 Mode textMode() const; 00107 00112 QString textOrHtml() const; 00113 00121 void setTextOrHtml(const QString &text); 00122 00123 00131 QString currentLinkText() const; 00132 00140 QString currentLinkUrl() const; 00141 00150 void selectLinkText(QTextCursor* cursor) const; 00151 00157 void selectLinkText() const; 00158 00170 void updateLink(const QString &linkUrl, const QString &linkText); 00171 00177 bool canIndentList() const; 00178 00184 bool canDedentList() const; 00185 00186 public Q_SLOTS: 00187 00191 void alignLeft(); 00192 00196 void alignCenter(); 00197 00201 void alignRight(); 00202 00206 void alignJustify(); 00207 00213 void makeRightToLeft(); 00214 00220 void makeLeftToRight(); 00221 00228 void setListStyle(int _styleIndex); 00229 00235 void indentListMore(); 00236 00242 void indentListLess(); 00243 00249 void setFontFamily(const QString &fontFamily); 00250 00256 void setFontSize(int size); 00257 00263 void setFont(const QFont &font); 00264 00271 void setTextBold(bool bold); 00272 00279 void setTextItalic(bool italic); 00280 00287 void setTextUnderline(bool underline); 00288 00295 void setTextStrikeOut(bool strikeOut); 00296 00302 void setTextForegroundColor(const QColor &color); 00303 00309 void setTextBackgroundColor(const QColor &color); 00310 00314 void insertHorizontalRule(); 00315 00320 void switchToPlainText(); 00321 00327 QString toCleanHtml() const; 00328 00335 void setTextSuperScript(bool superscript); 00336 00343 void setTextSubScript(bool subscript); 00344 00345 Q_SIGNALS: 00346 00352 void textModeChanged(KRichTextEdit::Mode mode); 00353 00357 void selectionFinished(); 00358 00359 protected: 00360 00365 virtual void keyPressEvent(QKeyEvent *event); 00366 00367 private: 00368 //@cond PRIVATE 00369 KRichTextEditPrivate *const d; 00370 friend class KRichTextEditPrivate; 00371 //@endcond 00372 }; 00373 00374 00375 00376 #endif
KDE 4.6 API Reference