QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Slots | Public Member Functions | Protected Member Functions | Properties | List of all members
QwtTextLabel Class Reference

A Widget which displays a QwtText. More...

#include <qwt_text_label.h>

Inheritance diagram for QwtTextLabel:
QwtLegendLabel

Classes

class  PrivateData
 

Public Slots

void setText (const QString &, QwtText::TextFormat textFormat=QwtText::AutoText)
 Change the label's text, keeping all other QwtText attributes.
 
virtual void setText (const QwtText &)
 Change the label's text.
 
void clear ()
 Clear the text and all QwtText attributes.
 

Public Member Functions

 QwtTextLabel (QWidget *parent=nullptr)
 Constructs an empty label.
 
 QwtTextLabel (const QwtText &, QWidget *parent=nullptr)
 Constructs a label that displays the text.
 
 ~QwtTextLabel () override
 Destructor.
 
void setPlainText (const QString &)
 Interface for the designer plugin - does the same as setText()
 
QString plainText () const
 Interface for the designer plugin.
 
const QwtTexttext () const
 Return the text.
 
int indent () const
 Return label's text indent in pixels.
 
void setIndent (int)
 Set label's text indent in pixels.
 
int margin () const
 Return label's margin in pixels.
 
void setMargin (int)
 Set label's margin in pixels.
 
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
 Return the preferred height for a given width.
 
QRect textRect () const
 Calculate geometry for the text in widget coordinates.
 
virtual void drawText (QPainter *, const QRectF &)
 Redraw the text.
 

Protected Member Functions

virtual void paintEvent (QPaintEvent *) override
 Paint event handler.
 
virtual void drawContents (QPainter *)
 Draw the contents.
 

Properties

int indent
 
int margin
 
QString plainText
 

Detailed Description

A Widget which displays a QwtText.

QwtTextLabel displays a text label supporting rich text formatting and rotated text. The text can be aligned horizontally and vertically.

See also
QwtText

Constructor & Destructor Documentation

◆ QwtTextLabel() [1/2]

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

Constructs an empty label.

Parameters
parentParent widget

◆ QwtTextLabel() [2/2]

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

Constructs a label that displays the text.

Parameters
parentParent widget
textText to display

Member Function Documentation

◆ clear

void QwtTextLabel::clear ( )
slot

Clear the text and all QwtText attributes.

See also
setText()

◆ drawContents()

void QwtTextLabel::drawContents ( QPainter *  painter)
protectedvirtual

Draw the contents.

Redraw the text and focus indicator.

◆ drawText()

void QwtTextLabel::drawText ( QPainter *  painter,
const QRectF &  textRect 
)
virtual

Redraw the text.

Parameters
painterPainter used for drawing
textRectRectangle where to draw the text
See also
drawContents()

◆ heightForWidth()

int QwtTextLabel::heightForWidth ( int  width) const
overridevirtual

Return the preferred height for a given width.

Parameters
widthGiven width
Returns
Preferred height for this widget, given the width
See also
sizeHint(), minimumSizeHint()

◆ indent()

int QwtTextLabel::indent ( ) const

Return label's text indent in pixels.

Returns
Indent in pixels
See also
setIndent()

◆ margin()

int QwtTextLabel::margin ( ) const

Return label's margin in pixels.

Returns
Margin in pixels
See also
setMargin()

◆ minimumSizeHint()

QSize QwtTextLabel::minimumSizeHint ( ) const
overridevirtual

Return a minimum size hint.

Returns
Minimum size hint
See also
sizeHint()

◆ paintEvent()

void QwtTextLabel::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

Paint event handler.

Qt paint event handler.

Parameters
eventPaint event
See also
drawContents(), paintEvent()

Reimplemented in QwtLegendLabel.

◆ plainText()

QString QwtTextLabel::plainText ( ) const

Interface for the designer plugin.

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

◆ setIndent()

void QwtTextLabel::setIndent ( int  indent)

Set label's text indent in pixels.

Parameters
indentIndentation in pixels
See also
indent()

◆ setMargin()

void QwtTextLabel::setMargin ( int  margin)

Set label's margin in pixels.

Parameters
marginMargin in pixels
See also
margin()

◆ setPlainText()

void QwtTextLabel::setPlainText ( const QString &  text)

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

Parameters
textPlain text to set
See also
plainText()

◆ 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

◆ setText [2/2]

void QwtTextLabel::setText ( const QwtText text)
virtualslot

Change the label's text.

Parameters
textNew text
See also
setText(), clear()

Reimplemented in QwtLegendLabel.

◆ sizeHint()

QSize QwtTextLabel::sizeHint ( ) const
overridevirtual

Return a size hint.

Returns
Size hint
See also
minimumSizeHint()

Reimplemented in QwtLegendLabel.

◆ text()

const QwtText & QwtTextLabel::text ( ) const

Return the text.

Returns
Current text
See also
setText(), plainText()

◆ textRect()

QRect QwtTextLabel::textRect ( ) const

Calculate geometry for the text in widget coordinates.

Returns
Geometry for the text
See also
drawText(), drawContents()

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