• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • widgets
krichtextedit.cpp
Go to the documentation of this file.
1/*
2 * krichtextedit
3 *
4 * Copyright 2007 Laurent Montel <montel@kde.org>
5 * Copyright 2008 Thomas McGuire <thomas.mcguire@gmx.net>
6 * Copyright 2008 Stephen Kelly <steveire@gmail.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23
24#include "krichtextedit.h"
25
26// Own includes
27#include "nestedlisthelper.h"
28#include "klinkdialog.h"
29
30// kdelibs includes
31#include <kcursor.h>
32#include <kcolorscheme.h>
33
34// Qt includes
35#include <QtGui/QTextDocumentFragment>
36#include <QtGui/QMouseEvent>
37
42//@cond PRIVATE
43class KRichTextEditPrivate : public QObject
44{
45public:
46 KRichTextEditPrivate(KRichTextEdit *parent)
47 : q(parent),
48 mMode(KRichTextEdit::Plain) {
49 nestedListHelper = new NestedListHelper(q);
50 }
51
52 ~KRichTextEditPrivate() {
53 delete nestedListHelper;
54 }
55
56 //
57 // Normal functions
58 //
59
60 // If the text under the cursor is a link, the cursor's selection is set to
61 // the complete link text. Otherwise selects the current word if there is no
62 // selection.
63 void selectLinkText() const;
64
65 void init();
66
67 // Switches to rich text mode and emits the mode changed signal if the
68 // mode really changed.
69 void activateRichText();
70
71 // Applies formatting to the current word if there is no selection.
72 void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
73
74 void setTextCursor(QTextCursor &cursor);
75
76
77 // Data members
78
79 KRichTextEdit *q;
80 KRichTextEdit::Mode mMode;
81
82 NestedListHelper *nestedListHelper;
83
84};
85
86void KRichTextEditPrivate::activateRichText()
87{
88 if (mMode == KRichTextEdit::Plain) {
89 q->setAcceptRichText(true);
90 mMode = KRichTextEdit::Rich;
91 emit q->textModeChanged(mMode);
92 }
93}
94
95void KRichTextEditPrivate::setTextCursor(QTextCursor &cursor)
96{
97 q->setTextCursor(cursor);
98}
99
100void KRichTextEditPrivate::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
101{
102 QTextCursor cursor = q->textCursor();
103 QTextCursor wordStart(cursor);
104 QTextCursor wordEnd(cursor);
105
106 wordStart.movePosition(QTextCursor::StartOfWord);
107 wordEnd.movePosition(QTextCursor::EndOfWord);
108
109 cursor.beginEditBlock();
110 if (!cursor.hasSelection() && cursor.position() != wordStart.position() && cursor.position() != wordEnd.position())
111 cursor.select(QTextCursor::WordUnderCursor);
112 cursor.mergeCharFormat(format);
113 q->mergeCurrentCharFormat(format);
114 cursor.endEditBlock();
115}
116//@endcond
117
118KRichTextEdit::KRichTextEdit(const QString& text, QWidget *parent)
119 : KTextEdit(text, parent), d(new KRichTextEditPrivate(this))
120{
121 d->init();
122}
123
124KRichTextEdit::KRichTextEdit(QWidget *parent)
125 : KTextEdit(parent), d(new KRichTextEditPrivate(this))
126{
127 d->init();
128}
129
130KRichTextEdit::~KRichTextEdit()
131{
132 delete d;
133}
134
135//@cond PRIVATE
136void KRichTextEditPrivate::init()
137{
138 q->setAcceptRichText(false);
139 KCursor::setAutoHideCursor(q, true, true);
140}
141//@endcond
142
143void KRichTextEdit::setListStyle(int _styleIndex)
144{
145 d->nestedListHelper->handleOnBulletType(-_styleIndex);
146 setFocus();
147 d->activateRichText();
148}
149
150void KRichTextEdit::indentListMore()
151{
152 d->nestedListHelper->handleOnIndentMore();
153 d->activateRichText();
154}
155
156void KRichTextEdit::indentListLess()
157{
158 d->nestedListHelper->handleOnIndentLess();
159}
160
161void KRichTextEdit::insertHorizontalRule()
162{
163 QTextCursor cursor = textCursor();
164 QTextBlockFormat bf = cursor.blockFormat();
165 QTextCharFormat cf = cursor.charFormat();
166
167 cursor.beginEditBlock();
168 cursor.insertHtml("<hr>");
169 cursor.insertBlock(bf, cf);
170 setTextCursor(cursor);
171 d->activateRichText();
172 cursor.endEditBlock();
173}
174
175void KRichTextEdit::alignLeft()
176{
177 setAlignment(Qt::AlignLeft);
178 setFocus();
179 d->activateRichText();
180}
181
182void KRichTextEdit::alignCenter()
183{
184 setAlignment(Qt::AlignHCenter);
185 setFocus();
186 d->activateRichText();
187}
188
189void KRichTextEdit::alignRight()
190{
191 setAlignment(Qt::AlignRight);
192 setFocus();
193 d->activateRichText();
194}
195
196void KRichTextEdit::alignJustify()
197{
198 setAlignment(Qt::AlignJustify);
199 setFocus();
200 d->activateRichText();
201}
202
203void KRichTextEdit::makeRightToLeft()
204{
205 QTextBlockFormat format;
206 format.setLayoutDirection(Qt::RightToLeft);
207 QTextCursor cursor = textCursor();
208 cursor.mergeBlockFormat(format);
209 setTextCursor(cursor);
210 setFocus();
211 d->activateRichText();
212}
213
214void KRichTextEdit::makeLeftToRight()
215{
216 QTextBlockFormat format;
217 format.setLayoutDirection(Qt::LeftToRight);
218 QTextCursor cursor = textCursor();
219 cursor.mergeBlockFormat(format);
220 setTextCursor(cursor);
221 setFocus();
222 d->activateRichText();
223}
224
225void KRichTextEdit::setTextBold(bool bold)
226{
227 QTextCharFormat fmt;
228 fmt.setFontWeight(bold ? QFont::Bold : QFont::Normal);
229 d->mergeFormatOnWordOrSelection(fmt);
230 setFocus();
231 d->activateRichText();
232}
233
234void KRichTextEdit::setTextItalic(bool italic)
235{
236 QTextCharFormat fmt;
237 fmt.setFontItalic(italic);
238 d->mergeFormatOnWordOrSelection(fmt);
239 setFocus();
240 d->activateRichText();
241}
242
243void KRichTextEdit::setTextUnderline(bool underline)
244{
245 QTextCharFormat fmt;
246 fmt.setFontUnderline(underline);
247 d->mergeFormatOnWordOrSelection(fmt);
248 setFocus();
249 d->activateRichText();
250}
251
252void KRichTextEdit::setTextStrikeOut(bool strikeOut)
253{
254 QTextCharFormat fmt;
255 fmt.setFontStrikeOut(strikeOut);
256 d->mergeFormatOnWordOrSelection(fmt);
257 setFocus();
258 d->activateRichText();
259}
260
261void KRichTextEdit::setTextForegroundColor(const QColor &color)
262{
263 QTextCharFormat fmt;
264 fmt.setForeground(color);
265 d->mergeFormatOnWordOrSelection(fmt);
266 setFocus();
267 d->activateRichText();
268}
269
270void KRichTextEdit::setTextBackgroundColor(const QColor &color)
271{
272 QTextCharFormat fmt;
273 fmt.setBackground(color);
274 d->mergeFormatOnWordOrSelection(fmt);
275 setFocus();
276 d->activateRichText();
277}
278
279void KRichTextEdit::setFontFamily(const QString &fontFamily)
280{
281 QTextCharFormat fmt;
282 fmt.setFontFamily(fontFamily);
283 d->mergeFormatOnWordOrSelection(fmt);
284 setFocus();
285 d->activateRichText();
286}
287
288void KRichTextEdit::setFontSize(int size)
289{
290 QTextCharFormat fmt;
291 fmt.setFontPointSize(size);
292 d->mergeFormatOnWordOrSelection(fmt);
293 setFocus();
294 d->activateRichText();
295}
296
297void KRichTextEdit::setFont(const QFont &font)
298{
299 QTextCharFormat fmt;
300 fmt.setFont(font);
301 d->mergeFormatOnWordOrSelection(fmt);
302 setFocus();
303 d->activateRichText();
304}
305
306void KRichTextEdit::switchToPlainText()
307{
308 if (d->mMode == Rich) {
309 d->mMode = Plain;
310 // TODO: Warn the user about this?
311 QMetaObject::invokeMethod(this, "insertPlainTextImplementation");
312 setAcceptRichText(false);
313 emit textModeChanged(d->mMode);
314 }
315}
316
317void KRichTextEdit::insertPlainTextImplementation()
318{
319 document()->setPlainText(document()->toPlainText());
320}
321
322void KRichTextEdit::setTextSuperScript(bool superscript)
323{
324 QTextCharFormat fmt;
325 fmt.setVerticalAlignment(superscript ? QTextCharFormat::AlignSuperScript : QTextCharFormat::AlignNormal);
326 d->mergeFormatOnWordOrSelection(fmt);
327 setFocus();
328 d->activateRichText();
329}
330
331void KRichTextEdit::setTextSubScript(bool subscript)
332{
333 QTextCharFormat fmt;
334 fmt.setVerticalAlignment(subscript ? QTextCharFormat::AlignSubScript : QTextCharFormat::AlignNormal);
335 d->mergeFormatOnWordOrSelection(fmt);
336 setFocus();
337 d->activateRichText();
338}
339
340void KRichTextEdit::enableRichTextMode()
341{
342 d->activateRichText();
343}
344
345KRichTextEdit::Mode KRichTextEdit::textMode() const
346{
347 return d->mMode;
348}
349
350QString KRichTextEdit::textOrHtml() const
351{
352 if (textMode() == Rich)
353 return toCleanHtml();
354 else
355 return toPlainText();
356}
357
358void KRichTextEdit::setTextOrHtml(const QString &text)
359{
360 // might be rich text
361 if (Qt::mightBeRichText(text)) {
362 if (d->mMode == KRichTextEdit::Plain) {
363 d->activateRichText();
364 }
365 setHtml(text);
366 } else {
367 setPlainText(text);
368 }
369}
370
371QString KRichTextEdit::currentLinkText() const
372{
373 QTextCursor cursor = textCursor();
374 selectLinkText(&cursor);
375 return cursor.selectedText();
376}
377
378void KRichTextEdit::selectLinkText() const
379{
380 QTextCursor cursor = textCursor();
381 selectLinkText(&cursor);
382 d->setTextCursor(cursor);
383}
384
385void KRichTextEdit::selectLinkText(QTextCursor *cursor) const
386{
387 // If the cursor is on a link, select the text of the link.
388 if (cursor->charFormat().isAnchor()) {
389 QString aHref = cursor->charFormat().anchorHref();
390
391 // Move cursor to start of link
392 while (cursor->charFormat().anchorHref() == aHref) {
393 if (cursor->atStart())
394 break;
395 cursor->setPosition(cursor->position() - 1);
396 }
397 if (cursor->charFormat().anchorHref() != aHref)
398 cursor->setPosition(cursor->position() + 1, QTextCursor::KeepAnchor);
399
400 // Move selection to the end of the link
401 while (cursor->charFormat().anchorHref() == aHref) {
402 if (cursor->atEnd())
403 break;
404 cursor->setPosition(cursor->position() + 1, QTextCursor::KeepAnchor);
405 }
406 if (cursor->charFormat().anchorHref() != aHref)
407 cursor->setPosition(cursor->position() - 1, QTextCursor::KeepAnchor);
408 } else if (cursor->hasSelection()) {
409 // Nothing to to. Using the currently selected text as the link text.
410 } else {
411
412 // Select current word
413 cursor->movePosition(QTextCursor::StartOfWord);
414 cursor->movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
415 }
416}
417
418QString KRichTextEdit::currentLinkUrl() const
419{
420 return textCursor().charFormat().anchorHref();
421}
422
423void KRichTextEdit::updateLink(const QString &linkUrl, const QString &linkText)
424{
425 selectLinkText();
426
427 QTextCursor cursor = textCursor();
428 cursor.beginEditBlock();
429
430 if (!cursor.hasSelection()) {
431 cursor.select(QTextCursor::WordUnderCursor);
432 }
433
434 QTextCharFormat format = cursor.charFormat();
435 // Save original format to create an extra space with the existing char
436 // format for the block
437 const QTextCharFormat originalFormat = format;
438 if (!linkUrl.isEmpty()) {
439 // Add link details
440 format.setAnchor(true);
441 format.setAnchorHref(linkUrl);
442 // Workaround for QTBUG-1814:
443 // Link formatting does not get applied immediately when setAnchor(true)
444 // is called. So the formatting needs to be applied manually.
445 format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
446 format.setUnderlineColor(KColorScheme(QPalette::Active, KColorScheme::View).foreground(KColorScheme::LinkText).color());
447 format.setForeground(KColorScheme(QPalette::Active, KColorScheme::View).foreground(KColorScheme::LinkText).color());
448 d->activateRichText();
449 } else {
450 // Remove link details
451 format.setAnchor(false);
452 format.setAnchorHref(QString());
453 // Workaround for QTBUG-1814:
454 // Link formatting does not get removed immediately when setAnchor(false)
455 // is called. So the formatting needs to be applied manually.
456 QTextDocument defaultTextDocument;
457 QTextCharFormat defaultCharFormat = defaultTextDocument.begin().charFormat();
458
459 format.setUnderlineStyle( defaultCharFormat.underlineStyle() );
460 format.setUnderlineColor( defaultCharFormat.underlineColor() );
461 format.setForeground( defaultCharFormat.foreground() );
462 }
463
464 // Insert link text specified in dialog, otherwise write out url.
465 QString _linkText;
466 if (!linkText.isEmpty()) {
467 _linkText = linkText;
468 } else {
469 _linkText = linkUrl;
470 }
471 cursor.insertText(_linkText, format);
472
473
474 // Insert a space after the link if at the end of the block so that
475 // typing some text after the link does not carry link formatting
476 if (!linkUrl.isEmpty() && cursor.atBlockEnd()) {
477 cursor.setPosition(cursor.selectionEnd());
478 cursor.setCharFormat(originalFormat);
479 cursor.insertText(QString(" "));
480 }
481
482 cursor.endEditBlock();
483}
484
485void KRichTextEdit::keyPressEvent(QKeyEvent *event)
486{
487 bool handled = false;
488 if (textCursor().currentList()) {
489 // handled is False if the key press event was not handled or not completely
490 // handled by the Helper class.
491 handled = d->nestedListHelper->handleBeforeKeyPressEvent(event);
492 }
493
494 if (!handled) {
495 KTextEdit::keyPressEvent(event);
496 }
497
498 if (textCursor().currentList()) {
499 d->nestedListHelper->handleAfterKeyPressEvent(event);
500 }
501 emit cursorPositionChanged();
502}
503
504// void KRichTextEdit::dropEvent(QDropEvent *event)
505// {
506// int dropSize = event->mimeData()->text().size();
507//
508// dropEvent( event );
509// QTextCursor cursor = textCursor();
510// int cursorPosition = cursor.position();
511// cursor.setPosition( cursorPosition - dropSize );
512// cursor.setPosition( cursorPosition, QTextCursor::KeepAnchor );
513// setTextCursor( cursor );
514// d->nestedListHelper->handleAfterDropEvent( event );
515// }
516
517
518bool KRichTextEdit::canIndentList() const
519{
520 return d->nestedListHelper->canIndent();
521}
522
523bool KRichTextEdit::canDedentList() const
524{
525 return d->nestedListHelper->canDedent();
526}
527
528QString KRichTextEdit::toCleanHtml() const
529{
530 QString result = toHtml();
531
532 static const QString EMPTYLINEHTML = QLatin1String(
533 "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; "
534 "margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \">&nbsp;</p>" );
535
536 // Qt inserts various style properties based on the current mode of the editor (underline,
537 // bold, etc), but only empty paragraphs *also* have qt-paragraph-type set to 'empty'.
538 static const QString EMPTYLINEREGEX = QLatin1String(
539 "<p style=\"-qt-paragraph-type:empty;(.*)</p>" );
540
541 static const QString OLLISTPATTERNQT = QLatin1String(
542 "<ol style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px;" );
543
544 static const QString ULLISTPATTERNQT = QLatin1String(
545 "<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px;" );
546
547 static const QString ORDEREDLISTHTML = QLatin1String(
548 "<ol style=\"margin-top: 0px; margin-bottom: 0px;" );
549
550 static const QString UNORDEREDLISTHTML = QLatin1String(
551 "<ul style=\"margin-top: 0px; margin-bottom: 0px;" );
552
553 // fix 1 - empty lines should show as empty lines - MS Outlook treats margin-top:0px; as
554 // a non-existing line.
555 // Although we can simply remove the margin-top style property, we still get unwanted results
556 // if you have three or more empty lines. It's best to replace empty <p> elements with <p>&nbsp;</p>.
557
558 QRegExp emptyLineFinder( EMPTYLINEREGEX );
559 emptyLineFinder.setMinimal( true );
560
561 // find the first occurance
562 int offset = emptyLineFinder.indexIn( result, 0 );
563 while (offset != -1) {
564 // replace all the matching text with the new line text
565 result.replace( offset, emptyLineFinder.matchedLength(), EMPTYLINEHTML );
566 // advance the search offset to just beyond the last replace
567 offset += EMPTYLINEHTML.length();
568 // find the next occurance
569 offset = emptyLineFinder.indexIn( result, offset );
570 }
571
572 // fix 2a - ordered lists - MS Outlook treats margin-left:0px; as
573 // a non-existing number; e.g: "1. First item" turns into "First Item"
574 result.replace(OLLISTPATTERNQT, ORDEREDLISTHTML);
575
576 // fix 2b - unordered lists - MS Outlook treats margin-left:0px; as
577 // a non-existing bullet; e.g: "* First bullet" turns into "First Bullet"
578 result.replace(ULLISTPATTERNQT, UNORDEREDLISTHTML);
579
580 return result;
581}
582
583#include "krichtextedit.moc"
KColorScheme
A set of methods used to work with colors.
Definition: kcolorscheme.h:71
KColorScheme::LinkText
@ LinkText
Fourth color; use for (unvisited) links.
Definition: kcolorscheme.h:221
KColorScheme::View
@ View
Views; for example, frames, input fields, etc.
Definition: kcolorscheme.h:87
KCursor::setAutoHideCursor
static void setAutoHideCursor(QWidget *w, bool enable, bool customEventFilter=false)
Sets auto-hiding the cursor for widget w.
Definition: kcursor.cpp:202
KRichTextEdit
The KRichTextEdit class provides a widget to edit and display rich text.
Definition: krichtextedit.h:66
KRichTextEdit::insertPlainTextImplementation
void insertPlainTextImplementation()
Definition: krichtextedit.cpp:317
KRichTextEdit::setTextStrikeOut
void setTextStrikeOut(bool strikeOut)
Toggles the strikeout formatting of the current word or selection at the current cursor position.
Definition: krichtextedit.cpp:252
KRichTextEdit::setTextSubScript
void setTextSubScript(bool subscript)
Toggles the subscript formatting of the current word or selection at the current cursor position.
Definition: krichtextedit.cpp:331
KRichTextEdit::alignRight
void alignRight()
Sets the alignment of the current block to Right Aligned.
Definition: krichtextedit.cpp:189
KRichTextEdit::setTextForegroundColor
void setTextForegroundColor(const QColor &color)
Sets the foreground color of the current word or selection to color.
Definition: krichtextedit.cpp:261
KRichTextEdit::setTextBackgroundColor
void setTextBackgroundColor(const QColor &color)
Sets the background color of the current word or selection to color.
Definition: krichtextedit.cpp:270
KRichTextEdit::insertHorizontalRule
void insertHorizontalRule()
Inserts a horizontal rule below the current block.
Definition: krichtextedit.cpp:161
KRichTextEdit::enableRichTextMode
void enableRichTextMode()
This enables rich text mode.
Definition: krichtextedit.cpp:340
KRichTextEdit::canDedentList
bool canDedentList() const
Returns true if the list item at the current position can be dedented.
Definition: krichtextedit.cpp:523
KRichTextEdit::currentLinkText
QString currentLinkText() const
Returns the text of the link at the current position or an empty string if the cursor is not on a lin...
Definition: krichtextedit.cpp:371
KRichTextEdit::setFont
void setFont(const QFont &font)
Sets the current word or selection to the font font.
Definition: krichtextedit.cpp:297
KRichTextEdit::selectLinkText
void selectLinkText(QTextCursor *cursor) const
If the cursor is on a link, sets the cursor to a selection of the text of the link.
Definition: krichtextedit.cpp:385
KRichTextEdit::alignJustify
void alignJustify()
Sets the alignment of the current block to Justified.
Definition: krichtextedit.cpp:196
KRichTextEdit::~KRichTextEdit
virtual ~KRichTextEdit()
Destructor.
Definition: krichtextedit.cpp:130
KRichTextEdit::switchToPlainText
void switchToPlainText()
This will switch the editor to plain text mode.
Definition: krichtextedit.cpp:306
KRichTextEdit::setTextOrHtml
void setTextOrHtml(const QString &text)
Replaces all the content of the text edit with the given string.
Definition: krichtextedit.cpp:358
KRichTextEdit::setTextUnderline
void setTextUnderline(bool underline)
Toggles the underline formatting of the current word or selection at the current cursor position.
Definition: krichtextedit.cpp:243
KRichTextEdit::textModeChanged
void textModeChanged(KRichTextEdit::Mode mode)
Emitted whenever the text mode is changed.
KRichTextEdit::toCleanHtml
QString toCleanHtml() const
This will clean some of the bad html produced by the underlying QTextEdit It walks over all lines and...
Definition: krichtextedit.cpp:528
KRichTextEdit::KRichTextEdit
KRichTextEdit(const QString &text, QWidget *parent=0)
Constructs a KRichTextEdit object.
Definition: krichtextedit.cpp:118
KRichTextEdit::textOrHtml
QString textOrHtml() const
Definition: krichtextedit.cpp:350
KRichTextEdit::selectLinkText
void selectLinkText() const
Convenience function to select the link text using the active cursor.
Definition: krichtextedit.cpp:378
KRichTextEdit::Mode
Mode
The mode the edit widget is in.
Definition: krichtextedit.h:74
KRichTextEdit::Plain
@ Plain
Plain text mode.
Definition: krichtextedit.h:74
KRichTextEdit::Rich
@ Rich
Rich text mode.
Definition: krichtextedit.h:75
KRichTextEdit::setFontSize
void setFontSize(int size)
Sets the current word or selection to the font size size.
Definition: krichtextedit.cpp:288
KRichTextEdit::indentListLess
void indentListLess()
Decreases the nesting level of the current block or selected blocks.
Definition: krichtextedit.cpp:156
KRichTextEdit::setFontFamily
void setFontFamily(const QString &fontFamily)
Sets the current word or selection to the font family fontFamily.
Definition: krichtextedit.cpp:279
KRichTextEdit::makeLeftToRight
void makeLeftToRight()
Sets the direction of the current block to Left-To-Right.
Definition: krichtextedit.cpp:214
KRichTextEdit::currentLinkUrl
QString currentLinkUrl() const
Returns the URL target (href) of the link at the current position or an empty string if the cursor is...
Definition: krichtextedit.cpp:418
KRichTextEdit::setListStyle
void setListStyle(int _styleIndex)
Sets the list style of the current list, or creates a new list using the current block.
Definition: krichtextedit.cpp:143
KRichTextEdit::indentListMore
void indentListMore()
Increases the nesting level of the current block or selected blocks.
Definition: krichtextedit.cpp:150
KRichTextEdit::alignLeft
void alignLeft()
Sets the alignment of the current block to Left Aligned.
Definition: krichtextedit.cpp:175
KRichTextEdit::setTextSuperScript
void setTextSuperScript(bool superscript)
Toggles the superscript formatting of the current word or selection at the current cursor position.
Definition: krichtextedit.cpp:322
KRichTextEdit::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
Reimplemented.
Definition: krichtextedit.cpp:485
KRichTextEdit::setTextBold
void setTextBold(bool bold)
Toggles the bold formatting of the current word or selection at the current cursor position.
Definition: krichtextedit.cpp:225
KRichTextEdit::setTextItalic
void setTextItalic(bool italic)
Toggles the italic formatting of the current word or selection at the current cursor position.
Definition: krichtextedit.cpp:234
KRichTextEdit::makeRightToLeft
void makeRightToLeft()
Sets the direction of the current block to Right-To-Left.
Definition: krichtextedit.cpp:203
KRichTextEdit::textMode
Mode textMode() const
Definition: krichtextedit.cpp:345
KRichTextEdit::canIndentList
bool canIndentList() const
Returns true if the list item at the current position can be indented.
Definition: krichtextedit.cpp:518
KRichTextEdit::alignCenter
void alignCenter()
Sets the alignment of the current block to Centered.
Definition: krichtextedit.cpp:182
KRichTextEdit::updateLink
void updateLink(const QString &linkUrl, const QString &linkText)
Replaces the current selection with a hyperlink with the link URL linkUrl and the link text linkText.
Definition: krichtextedit.cpp:423
KTextEdit
A KDE'ified QTextEdit.
Definition: ktextedit.h:91
KTextEdit::keyPressEvent
virtual void keyPressEvent(QKeyEvent *)
Reimplemented for internal reasons.
Definition: ktextedit.cpp:1121
QObject
QWidget
kcolorscheme.h
kcursor.h
klinkdialog.h
krichtextedit.h
Plain
Plain
nestedlisthelper.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal