QwtLegend Class Reference

List of all members.

Detailed Description

The legend widget.

The QwtLegend widget is a tabular arrangement of legend items. Legend items might be any type of widget, but in general they will be a QwtLegendItem.

See also:
QwtLegendItem, QwtLegendItemManager QwtPlot

Definition at line 36 of file qwt_legend.h.

Public Types

enum  LegendDisplayPolicy {
  NoIdentifier = 0,
  FixedIdentifier = 1,
  AutoIdentifier = 2
}
enum  LegendItemMode {
  ReadOnlyItem,
  ClickableItem,
  CheckableItem
}

Public Member Functions

 QwtLegend (QWidget *parent=NULL)
virtual ~QwtLegend ()
void setDisplayPolicy (LegendDisplayPolicy policy, int mode)
LegendDisplayPolicy displayPolicy () const
void setItemMode (LegendItemMode)
LegendItemMode itemMode () const
int identifierMode () const
QWidget * contentsWidget ()
const QWidget * contentsWidget () const
void insert (const QwtLegendItemManager *, QWidget *)
void remove (const QwtLegendItemManager *)
QWidget * find (const QwtLegendItemManager *) const
QwtLegendItemManagerfind (const QWidget *) const
virtual QList< QWidget * > legendItems () const
void clear ()
bool isEmpty () const
uint itemCount () const
virtual bool eventFilter (QObject *, QEvent *)
virtual QSize sizeHint () const
virtual int heightForWidth (int w) const
QScrollBar * horizontalScrollBar () const
QScrollBar * verticalScrollBar () const

Protected Member Functions

virtual void resizeEvent (QResizeEvent *)
virtual void layoutContents ()


Member Enumeration Documentation

enum QwtLegend::LegendDisplayPolicy

Display policy.

Default is AutoIdentifier.

See also:
setDisplayPolicy(), displayPolicy(), QwtLegendItem::IdentifierMode

Definition at line 62 of file qwt_legend.h.

enum QwtLegend::LegendItemMode

Interaction mode for the legend items.

Definition at line 70 of file qwt_legend.h.


Constructor & Destructor Documentation

QwtLegend::QwtLegend ( QWidget *  parent = NULL  )  [explicit]

Parameters:
parent Parent widget

Definition at line 258 of file qwt_legend.cpp.

QwtLegend::~QwtLegend (  )  [virtual]

Destructor.

Definition at line 283 of file qwt_legend.cpp.


Member Function Documentation

void QwtLegend::setDisplayPolicy ( LegendDisplayPolicy  policy,
int  mode 
)

Set the legend display policy to:

Parameters:
policy Legend display policy
mode Identifier mode (or'd ShowLine, ShowSymbol, ShowText)
See also:
displayPolicy, LegendDisplayPolicy

Definition at line 296 of file qwt_legend.cpp.

References QwtLegendItemManager::updateLegend().

QwtLegend::LegendDisplayPolicy QwtLegend::displayPolicy (  )  const

Returns:
the legend display policy. Default is LegendDisplayPolicy::Auto.
See also:
setDisplayPolicy, LegendDisplayPolicy

Definition at line 324 of file qwt_legend.cpp.

Referenced by QwtPlotCurve::updateLegend().

int QwtLegend::identifierMode (  )  const

Returns:
the IdentifierMode to be used in combination with LegendDisplayPolicy::Fixed.
Default is ShowLine | ShowSymbol | ShowText.

Definition at line 346 of file qwt_legend.cpp.

Referenced by QwtPlotCurve::updateLegend().

QWidget * QwtLegend::contentsWidget (  ) 

The contents widget is the only child of the viewport() and the parent widget of all legend items.

Definition at line 355 of file qwt_legend.cpp.

Referenced by insert(), and QwtPlot::printLegend().

const QWidget * QwtLegend::contentsWidget (  )  const

The contents widget is the only child of the viewport() and the parent widget of all legend items.

Definition at line 375 of file qwt_legend.cpp.

void QwtLegend::insert ( const QwtLegendItemManager plotItem,
QWidget *  legendItem 
)

Insert a new item for a plot item

Parameters:
plotItem Plot item
legendItem New legend item
Note:
The parent of item will be changed to QwtLegend::contentsWidget()

Definition at line 386 of file qwt_legend.cpp.

References contentsWidget(), and layoutContents().

Referenced by QwtPlotItem::updateLegend().

void QwtLegend::remove ( const QwtLegendItemManager plotItem  ) 

Find the corresponding item for a plotItem and remove it from the item list.

Parameters:
plotItem Plot item

Definition at line 482 of file qwt_legend.cpp.

QWidget * QwtLegend::find ( const QwtLegendItemManager plotItem  )  const

Find the widget that represents a plot item

Parameters:
plotItem Plot item
Returns:
Widget on the legend, or NULL

Definition at line 460 of file qwt_legend.cpp.

Referenced by QwtPlotPrintFilter::reset(), QwtPlotItem::updateLegend(), and QwtPlotCurve::updateLegend().

QwtLegendItemManager * QwtLegend::find ( const QWidget *  legendItem  )  const

Find the widget that represents a plot item

Parameters:
plotItem Plot item
Returns:
Widget on the legend, or NULL

Definition at line 471 of file qwt_legend.cpp.

void QwtLegend::clear (  ) 

Remove all items.

Definition at line 490 of file qwt_legend.cpp.

bool QwtLegend::isEmpty (  )  const

Return true, if there are no legend items.

Definition at line 617 of file qwt_legend.cpp.

Referenced by QwtPlotLayout::activate(), and QwtPlot::print().

uint QwtLegend::itemCount (  )  const

Return the number of legend items.

Definition at line 623 of file qwt_legend.cpp.

QSize QwtLegend::sizeHint (  )  const [virtual]

Return a size hint.

Definition at line 506 of file qwt_legend.cpp.

int QwtLegend::heightForWidth ( int  width  )  const [virtual]

Returns:
The preferred height, for the width w.
Parameters:
width Width

Definition at line 518 of file qwt_legend.cpp.

void QwtLegend::resizeEvent ( QResizeEvent *  e  )  [protected, virtual]

Resize event

Parameters:
e Event

Definition at line 654 of file qwt_legend.cpp.

void QwtLegend::layoutContents (  )  [protected, virtual]

Adjust contents widget and item layout to the size of the viewport().

Definition at line 543 of file qwt_legend.cpp.

Referenced by eventFilter(), and insert().


Generated on Sun Mar 22 16:54:34 2009 for Qwt User's Guide by  doxygen 1.5.0