#include <qbigtextwidget.h>
Class diagram for QBigTextWidget:
Public Members | |||
![]() | ![]() | QBigTextWidget ( QWidget* parent = 0, const char* name = 0, WFlags f=0 ) | |
![]() | ![]() | ~QBigTextWidget () | |
Public Slots | |||
![]() | ![]() | void | setFontSize ( int ) |
![]() | ![]() | void | setFontFamily ( const char* ) |
![]() | ![]() | void | setFontColor ( QColor ) |
![]() | ![]() | void | setBgColor ( QColor ) |
![]() | ![]() | void | setDolarColor ( QColor ) |
![]() | ![]() | void | setText ( const char * ) |
![]() | ![]() | int | fontSize () const |
![]() | ![]() | const char* | fontFamily () const |
![]() | ![]() | QColor | fontColor () const |
![]() | ![]() | QColor | bgColor () const |
![]() | ![]() | QColor | dolarColor () const |
![]() | ![]() | const char* | text () const |
Protected Members | |||
![]() | ![]() | void | paintEvent ( QPaintEvent* ) |
![]() | ![]() | const char* | widget_text |
![]() | ![]() | int | font_size |
![]() | ![]() | QString | font_family |
![]() | ![]() | QColor | font_color |
![]() | ![]() | QColor | bg_color |
![]() | ![]() | QColor | dolar_color |
This class allows displaying any given text with a properties set through the following methods:
[text]
- the text within square brackets will be displayed in bold {text}
- the text in curly brackets will be displayed in italic _text_
- the text between underscores will be displayed as underlined. $text$
- the text between dolar signs will be displayed in a color specified with setDolarColor() function
[Just] {a[n te}st] text.
will be displayed as:
Just an test text.
QBigTextWidget::QBigTextWidget (QWidget * parent = 0, const char * name = 0, WFlags f = 0) |
Constructor.
The constructor doesn't really do anything special. The font is set by default to 20pt Arial with black color on light gray background. The default text is set to be: Example of the text.
QBigTextWidget::~QBigTextWidget () |
Destructor.
Does nothing.
void QBigTextWidget::setFontSize (int size) [slot]
|
Set the font size.
Sets the font size to a given value and updates the widget.
void QBigTextWidget::setFontFamily (const char * family) [slot]
|
Set the font family.
Sets the font family to a given value and updates the widget.
void QBigTextWidget::setFontColor (QColor color) [slot]
|
Set the font color.
Sets the font color to a given value and updates the widget.
void QBigTextWidget::setBgColor (QColor color) [slot]
|
Set the background color.
Sets the backgroun color to a given value and updates the widget.
void QBigTextWidget::setDolarColor (QColor color) [slot]
|
Set the color of the text in '$' scope.
Sets the dolar_color to a given value and updates the widget.
void QBigTextWidget::setText (const char * t) [slot]
|
Set the text to be displayed.
Sets the displayed text to a given value and updates the widget.
int QBigTextWidget::fontSize () const [inline, slot]
|
Returns font_size value.
const char * QBigTextWidget::fontFamily () const [inline, slot]
|
Returns font_family value.
QColor QBigTextWidget::fontColor () const [inline, slot]
|
Returns font_color value.
QColor QBigTextWidget::bgColor () const [inline, slot]
|
Returns bg_color value.
QColor QBigTextWidget::dolarColor () const [inline, slot]
|
const char * QBigTextWidget::text () const [inline, slot]
|
Returns widget_text value.
void QBigTextWidget::paintEvent (QPaintEvent *) [protected]
|
Overloaded from QWidget.
The painting of the text is where all the magic is done. In short: the text is split uzing whitespace and formatting delimiters and drawn token by token from the left edge of the widget to the right. If the token doesn't fit in the line it is drawn from the beginning of the next one.
BUG: The formatting delimiters are treaten as word delimiters and therefore a word may be split accross the lines if it contains formatting control sequences in the middle.
BUG2: The colouring information is lost at each new delimiter.
const char* QBigTextWidget::widget_text [protected]
|
The text to be displayed.
int QBigTextWidget::font_size [protected]
|
The size of the font in points.
QString QBigTextWidget::font_family [protected]
|
The family of the font.
QColor QBigTextWidget::font_color [protected]
|
The color of the font.
QColor QBigTextWidget::bg_color [protected]
|
The color of the background.
QColor QBigTextWidget::dolar_color [protected]
|
The color of the text in '$' scopes.