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

A widget representing an item on a QwtLegend. More...

#include <qwt_legend_label.h>

Inheritance diagram for QwtLegendLabel:
QwtTextLabel

Classes

class  PrivateData
 

Public Slots

void setChecked (bool on)
 Check/Uncheck the item.
 
- Public Slots inherited from QwtTextLabel
void setText (const QString &, QwtText::TextFormat textFormat=QwtText::AutoText)
 Change the label's text, keeping all other QwtText attributes.
 
void clear ()
 Clear the text and all QwtText attributes.
 

Signals

void clicked ()
 Signal emitted when the legend item has been clicked.
 
void pressed ()
 Signal emitted when the legend item has been pressed.
 
void released ()
 Signal emitted when the legend item has been released.
 
void checked (bool)
 Signal emitted when the legend item has been toggled.
 

Public Member Functions

 QwtLegendLabel (QWidget *parent=nullptr)
 Constructor for QwtLegendLabel.
 
void setData (const QwtLegendData &)
 Set the attributes of the legend label.
 
const QwtLegendDatadata () const
 Return the attributes of the label.
 
void setItemMode (QwtLegendData::Mode)
 Set the item mode.
 
QwtLegendData::Mode itemMode () const
 Return the item mode.
 
void setSpacing (int spacing)
 Change the spacing between icon and text.
 
int spacing () const
 Return the spacing between icon and text.
 
virtual void setText (const QwtText &) override
 Set the text to the legend item.
 
void setIcon (const QPixmap &)
 Assign the icon.
 
QPixmap icon () const
 Return the pixmap representing a plot item.
 
virtual QSize sizeHint () const override
 Return a size hint.
 
bool isChecked () const
 Return true if the item is checked.
 
- Public Member Functions inherited from QwtTextLabel
 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 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

void setDown (bool)
 Set whether the button is down (English only)
 
bool isDown () const
 Return whether the button is down (English only)
 
virtual void paintEvent (QPaintEvent *) override
 Handle paint events (English only)
 
virtual void mousePressEvent (QMouseEvent *) override
 Handle mouse press events (English only)
 
virtual void mouseReleaseEvent (QMouseEvent *) override
 Handle mouse release events (English only)
 
virtual void keyPressEvent (QKeyEvent *) override
 Handle key press events (English only)
 
virtual void keyReleaseEvent (QKeyEvent *) override
 Handle key release events (English only)
 
- Protected Member Functions inherited from QwtTextLabel
virtual void drawContents (QPainter *)
 Draw the contents.
 

Additional Inherited Members

- Properties inherited from QwtTextLabel
int indent
 
int margin
 
QString plainText
 

Detailed Description

A widget representing an item on a QwtLegend.

QwtLegendLabel is used to display legend items in a QwtLegend. It can show an icon and a text label, and supports different interaction modes (ReadOnly, Clickable, Checkable).

See also
QwtLegend, QwtLegendData

Constructor & Destructor Documentation

◆ QwtLegendLabel()

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

Constructor for QwtLegendLabel.

Parameters
parentParent widget

Destructor

Member Function Documentation

◆ checked

void QwtLegendLabel::checked ( bool  )
signal

Signal emitted when the legend item has been toggled.

Parameters
onTrue if checked, false otherwise

◆ data()

const QwtLegendData & QwtLegendLabel::data ( ) const

Return the attributes of the label.

Returns
Attributes of the label
See also
setData(), QwtPlotItem::legendData()

◆ icon()

QPixmap QwtLegendLabel::icon ( ) const

Return the pixmap representing a plot item.

Returns
Pixmap representing a plot item
See also
setIcon()

◆ isChecked()

bool QwtLegendLabel::isChecked ( ) const

Return true if the item is checked.

Returns
True if the item is checked

◆ isDown()

bool QwtLegendLabel::isDown ( ) const
protected

Return whether the button is down (English only)

Return true, if the item is down.

◆ itemMode()

QwtLegendData::Mode QwtLegendLabel::itemMode ( ) const

Return the item mode.

Returns
Item mode
See also
setItemMode()

◆ keyPressEvent()

void QwtLegendLabel::keyPressEvent ( QKeyEvent *  e)
overrideprotectedvirtual

Handle key press events (English only)

Handle key press events.

◆ keyReleaseEvent()

void QwtLegendLabel::keyReleaseEvent ( QKeyEvent *  e)
overrideprotectedvirtual

Handle key release events (English only)

Handle key release events.

◆ mousePressEvent()

void QwtLegendLabel::mousePressEvent ( QMouseEvent *  e)
overrideprotectedvirtual

Handle mouse press events (English only)

Handle mouse press events.

◆ mouseReleaseEvent()

void QwtLegendLabel::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotectedvirtual

Handle mouse release events (English only)

Handle mouse release events.

◆ paintEvent()

void QwtLegendLabel::paintEvent ( QPaintEvent *  e)
overrideprotectedvirtual

Handle paint events (English only)

Paint event.

Reimplemented from QwtTextLabel.

◆ setChecked

void QwtLegendLabel::setChecked ( bool  on)
slot

Check/Uncheck the item.

Parameters
oncheck/uncheck
See also
setItemMode()

◆ setData()

void QwtLegendLabel::setData ( const QwtLegendData legendData)

Set the attributes of the legend label.

Parameters
legendDataAttributes of the label
See also
data()

◆ setDown()

void QwtLegendLabel::setDown ( bool  down)
protected

Set whether the button is down (English only)

Set the item being down.

◆ setIcon()

void QwtLegendLabel::setIcon ( const QPixmap &  icon)

Assign the icon.

Parameters
iconPixmap representing a plot item
See also
icon(), QwtPlotItem::legendIcon()

◆ setItemMode()

void QwtLegendLabel::setItemMode ( QwtLegendData::Mode  mode)

Set the item mode.

The default is QwtLegendData::ReadOnly

Parameters
modeItem mode
See also
itemMode()

◆ setSpacing()

void QwtLegendLabel::setSpacing ( int  spacing)

Change the spacing between icon and text.

Parameters
spacingSpacing
See also
spacing(), QwtTextLabel::margin()

◆ setText()

void QwtLegendLabel::setText ( const QwtText text)
overridevirtual

Set the text to the legend item.

Parameters
textText label
See also
QwtTextLabel::text()

Reimplemented from QwtTextLabel.

◆ sizeHint()

QSize QwtLegendLabel::sizeHint ( ) const
overridevirtual

Return a size hint.

Returns
Size hint

Reimplemented from QwtTextLabel.

◆ spacing()

int QwtLegendLabel::spacing ( ) const

Return the spacing between icon and text.

Returns
Spacing between icon and text
See also
setSpacing(), QwtTextLabel::margin()

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