KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
PlainTextEdit Class Reference

QPlainTextEdit subclass with HTML-formatted and color-styled append helpers. More...

#include <plaintextedit.h>

+ Inheritance diagram for PlainTextEdit:
+ Collaboration diagram for PlainTextEdit:

Public Types

enum  TextFlag { NoTextFlags = 0x0000 , BoldText = 0x0001 , StrongText = 0x0002 }
 Flags controlling text formatting for appendFormattedText(). More...
 

Public Member Functions

 PlainTextEdit (QWidget *parent=nullptr)
 Construct with an optional parent.
 
 PlainTextEdit (const QString &text, QWidget *parent=nullptr)
 Construct with initial text content.
 
void appendText (const QString &text, const QColor &foregroundColor=QColor(), const QColor &backgroundColor=QColor())
 Append a line of text with optional per-call colors.
 
void appendFormattedText (const QString &text, TextFlags flags, const QColor &foregroundColor=QColor(), const QColor &backgroundColor=QColor())
 Append a formatted line of text with flags and optional colors.
 

Detailed Description

QPlainTextEdit subclass with HTML-formatted and color-styled append helpers.

PlainTextEdit adds appendText() for appending plain text with optional per-call foreground and background colors, and appendFormattedText() which additionally accepts TextFlags for bold/strong formatting.

Definition at line 14 of file plaintextedit.h.

Member Enumeration Documentation

◆ TextFlag

Flags controlling text formatting for appendFormattedText().

Enumerator
NoTextFlags 

No formatting.

BoldText 

Render text in bold.

StrongText 

Render text wrapped in <strong>.

Definition at line 36 of file plaintextedit.h.

Constructor & Destructor Documentation

◆ PlainTextEdit() [1/2]

PlainTextEdit::PlainTextEdit ( QWidget *  parent = nullptr)
inlineexplicit

Construct with an optional parent.

Parameters
parentOptional QWidget parent

Definition at line 22 of file plaintextedit.h.

◆ PlainTextEdit() [2/2]

PlainTextEdit::PlainTextEdit ( const QString &  text,
QWidget *  parent = nullptr 
)
inlineexplicit

Construct with initial text content.

Parameters
textInitial plain text
parentOptional QWidget parent

Definition at line 30 of file plaintextedit.h.

Member Function Documentation

◆ appendFormattedText()

void PlainTextEdit::appendFormattedText ( const QString &  text,
TextFlags  flags,
const QColor &  foregroundColor = QColor(),
const QColor &  backgroundColor = QColor() 
)

Append a formatted line of text with flags and optional colors.

Parameters
textText to append
flagsCombination of TextFlag values
foregroundColorText color (invalid QColor = default)
backgroundColorBackground color (invalid QColor = default)

◆ appendText()

void PlainTextEdit::appendText ( const QString &  text,
const QColor &  foregroundColor = QColor(),
const QColor &  backgroundColor = QColor() 
)

Append a line of text with optional per-call colors.

Parameters
textText to append
foregroundColorText color (invalid QColor = default)
backgroundColorBackground color (invalid QColor = default)

The documentation for this class was generated from the following file: