Qwt User's Guide  6.2.0
QwtTextLabel Class Reference

A Widget which displays a QwtText. More...

#include <qwt_text_label.h>

Inheritance diagram for QwtTextLabel:

Public Slots

void setText (const QString &, QwtText::TextFormat textFormat=QwtText::AutoText)
 
virtual void setText (const QwtText &)
 
void clear ()
 Clear the text and all QwtText attributes.
 

Public Member Functions

 QwtTextLabel (QWidget *parent=NULL)
 
 QwtTextLabel (const QwtText &, QWidget *parent=NULL)
 
virtual ~QwtTextLabel ()
 Destructor.
 
void setPlainText (const QString &)
 
QString plainText () const
 
const QwtTexttext () const
 Return the text.
 
int indent () const
 Return label's text indent in pixels.
 
void setIndent (int)
 
int margin () const
 Return label's text margin in pixels.
 
void setMargin (int)
 
virtual QSize sizeHint () const override
 Return a size hint.
 
virtual QSize minimumSizeHint () const override
 Return a minimum size hint.
 
virtual int heightForWidth (int) const override
 
QRect textRect () const
 
virtual void drawText (QPainter *, const QRectF &)
 Redraw the text.
 

Protected Member Functions

virtual void paintEvent (QPaintEvent *) override
 
virtual void drawContents (QPainter *)
 Redraw the text and focus indicator.
 

Detailed Description

A Widget which displays a QwtText.

Definition at line 26 of file qwt_text_label.h.

Constructor & Destructor Documentation

◆ QwtTextLabel() [1/2]

QwtTextLabel::QwtTextLabel ( QWidget *  parent = NULL)
explicit

Constructs an empty label.

Parameters
parentParent widget

Definition at line 39 of file qwt_text_label.cpp.

◆ QwtTextLabel() [2/2]

QwtTextLabel::QwtTextLabel ( const QwtText text,
QWidget *  parent = NULL 
)
explicit

Constructs a label that displays the text, text

Parameters
parentParent widget
textText

Definition at line 50 of file qwt_text_label.cpp.

Member Function Documentation

◆ heightForWidth()

int QwtTextLabel::heightForWidth ( int  width) const
overridevirtual
Parameters
widthWidth
Returns
Preferred height for this widget, given the width.

Definition at line 209 of file qwt_text_label.cpp.

◆ paintEvent()

void QwtTextLabel::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

Qt paint event

Parameters
eventPaint event

Reimplemented in QwtLegendLabel.

Definition at line 236 of file qwt_text_label.cpp.

◆ plainText()

QString QwtTextLabel::plainText ( ) const

Interface for the designer plugin

Returns
Text as plain text
See also
setPlainText(), text()

Definition at line 84 of file qwt_text_label.cpp.

◆ setIndent()

void QwtTextLabel::setIndent ( int  indent)

Set label's text indent in pixels

Parameters
indentIndentation in pixels

Definition at line 142 of file qwt_text_label.cpp.

◆ setMargin()

void QwtTextLabel::setMargin ( int  margin)

Set label's margin in pixels

Parameters
marginMargin in pixels

Definition at line 163 of file qwt_text_label.cpp.

◆ setPlainText()

void QwtTextLabel::setPlainText ( const QString &  text)

Interface for the designer plugin - does the same as setText()

See also
plainText()

Definition at line 73 of file qwt_text_label.cpp.

◆ setText [1/2]

void QwtTextLabel::setText ( const QString &  text,
QwtText::TextFormat  textFormat = QwtText::AutoText 
)
slot

Change the label's text, keeping all other QwtText attributes

Parameters
textNew text
textFormatFormat of text
See also
QwtText

Definition at line 96 of file qwt_text_label.cpp.

◆ setText [2/2]

void QwtTextLabel::setText ( const QwtText text)
virtualslot

Change the label's text

Parameters
textNew text

Reimplemented in QwtLegendLabel.

Definition at line 109 of file qwt_text_label.cpp.

◆ textRect()

QRect QwtTextLabel::textRect ( ) const

Calculate geometry for the text in widget coordinates

Returns
Geometry for the text

Definition at line 288 of file qwt_text_label.cpp.