Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

QwtLegend Class Reference

The legend widget. More...

#include <qwt_legend.h>

List of all members.

Public Types

enum  LegendDisplayPolicy { None = 0, Fixed = 1, Auto = 2 }

Public Member Functions

 QwtLegend (QWidget *parent=0, const char *name=0)
void setDisplayPolicy (int policy, int mode=-1)
int displayPolicy () const
int identifierMode () const
QWidget * contentsWidget ()
const QWidget * contentsWidget () const
void insertItem (QWidget *, long key)
QWidget * findItem (long key)
const QWidget * findItem (long key) const
QWidget * takeItem (long key)
virtual QIntDictIterator<
QWidget > 
itemIterator () const
long key (const QWidget *) const
void clear ()
bool isEmpty () const
uint itemCount () const
virtual bool eventFilter (QObject *, QEvent *)
virtual QSize sizeHint () const
virtual int heightForWidth (int w) const

Protected Member Functions

virtual void viewportResizeEvent (QResizeEvent *)
virtual void layoutContents ()

Private Attributes

int d_displayPolicy
int d_identifierMode
QIntDict< QWidget > d_items
QWidget * d_contentsWidget


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 QwtLegendButton.

See also:
QwtLegendButton, QwtPlot

Definition at line 107 of file qwt_legend.h.


Member Enumeration Documentation

enum QwtLegend::LegendDisplayPolicy
 

Enumeration values:
None 
Fixed 
Auto 

Definition at line 113 of file qwt_legend.h.


Constructor & Destructor Documentation

QwtLegend::QwtLegend QWidget *  parent = 0,
const char *  name = 0
 

Parameters:
parent Parent widget
name Widget name

Definition at line 317 of file qwt_legend.cpp.

References d_contentsWidget.


Member Function Documentation

void QwtLegend::clear  ) 
 

Remove all items.

Definition at line 411 of file qwt_legend.cpp.

References d_items.

Referenced by QwtPlot::clear(), QwtPlot::enableLegend(), and QwtPlot::removeCurves().

const QWidget* QwtLegend::contentsWidget  )  const [inline]
 

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

Definition at line 159 of file qwt_legend.h.

QWidget* QwtLegend::contentsWidget  )  [inline]
 

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

Definition at line 154 of file qwt_legend.h.

Referenced by QwtPlot::insertLegendItem(), QwtPlot::printLegend(), QwtPlot::setLegendPos(), and QwtPlot::updateTabOrder().

int QwtLegend::displayPolicy  )  const [inline]
 

Return the legend display policy. Default is LegendDisplayPolicy::Auto.

Definition at line 143 of file qwt_legend.h.

Referenced by QwtPlot::updateLegendItem().

bool QwtLegend::eventFilter QObject *  ,
QEvent * 
[virtual]
 

Definition at line 507 of file qwt_legend.cpp.

References d_contentsWidget, key(), layoutContents(), and takeItem().

const QWidget* QwtLegend::findItem long  key  )  const [inline]
 

Find the item for a given key.

Definition at line 167 of file qwt_legend.h.

QWidget* QwtLegend::findItem long  key  )  [inline]
 

Find the item for a given key.

Definition at line 164 of file qwt_legend.h.

Referenced by QwtPlot::enableLegend(), QwtPlot::legendEnabled(), QwtPlot::removeCurve(), and QwtPlot::updateLegendItem().

int QwtLegend::heightForWidth int  w  )  const [virtual]
 

Returns:
The preferred height, for the width w.

Definition at line 454 of file qwt_legend.cpp.

References d_contentsWidget.

Referenced by QwtPlotLayoutData::init(), and QwtPlotLayout::minimumSizeHint().

int QwtLegend::identifierMode  )  const [inline]
 

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

Definition at line 149 of file qwt_legend.h.

Referenced by QwtPlot::updateLegendItem().

void QwtLegend::insertItem QWidget *  item,
long  key
 

Insert a new item for a specific key.

Parameters:
item New legend item
key Unique key. Key must be >= 0.
Note:
The parent of item will be changed to QwtLegend::contentsWidget()

In case of key < 0, nothing will be inserted.

Definition at line 357 of file qwt_legend.cpp.

References d_contentsWidget, d_items, and layoutContents().

Referenced by QwtPlot::insertLegendItem().

bool QwtLegend::isEmpty  )  const [inline]
 

Returns:
TRUE, if there are no legend items.

Definition at line 179 of file qwt_legend.h.

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

uint QwtLegend::itemCount  )  const [inline]
 

Returns:
Number of legend items.

Definition at line 182 of file qwt_legend.h.

Referenced by QwtPlot::enableLegend(), and QwtPlot::updateLayout().

QIntDictIterator< QWidget > QwtLegend::itemIterator  )  const [virtual]
 

Return an item iterator.

Definition at line 437 of file qwt_legend.cpp.

References d_items.

Referenced by QwtPlotPrintFilter::apply(), and QwtPlotPrintFilter::reset().

long QwtLegend::key const QWidget *  item  )  const
 

Return the key of an legend item.

Parameters:
item Legend item
Returns:
key of the item, or -1 if the item can't be found.

Definition at line 399 of file qwt_legend.cpp.

References d_items.

Referenced by eventFilter(), and QwtPlot::lgdClicked().

void QwtLegend::layoutContents  )  [protected, virtual]
 

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

Definition at line 475 of file qwt_legend.cpp.

References d_contentsWidget, QwtDynGridLayout::heightForWidth(), and QwtDynGridLayout::maxItemWidth().

Referenced by eventFilter(), and insertItem().

void QwtLegend::setDisplayPolicy int  policy,
int  mode = -1
 

Set the legend display policy to:

  • LegendDisplayPolicy::None
    the client code is responsible how to display of each legend item. The Qwt library will not interfere.

Definition at line 343 of file qwt_legend.cpp.

References d_displayPolicy, and d_identifierMode.

Referenced by QwtPlot::setLegendDisplayPolicy().

QSize QwtLegend::sizeHint  )  const [virtual]
 

Return a size hint.

Definition at line 443 of file qwt_legend.cpp.

References d_contentsWidget.

Referenced by QwtPlotLayoutData::init(), and QwtPlotLayout::minimumSizeHint().

QWidget* QwtLegend::takeItem long  key  )  [inline]
 

Find the item for a given key and remove it from the item list.

Definition at line 170 of file qwt_legend.h.

Referenced by eventFilter().

void QwtLegend::viewportResizeEvent QResizeEvent *   )  [protected, virtual]
 

Definition at line 537 of file qwt_legend.cpp.

References d_contentsWidget.


Member Data Documentation

QWidget* QwtLegend::d_contentsWidget [private]
 

Definition at line 197 of file qwt_legend.h.

Referenced by eventFilter(), heightForWidth(), insertItem(), layoutContents(), QwtLegend(), sizeHint(), and viewportResizeEvent().

int QwtLegend::d_displayPolicy [private]
 

Definition at line 194 of file qwt_legend.h.

Referenced by setDisplayPolicy().

int QwtLegend::d_identifierMode [private]
 

Definition at line 195 of file qwt_legend.h.

Referenced by setDisplayPolicy().

QIntDict<QWidget> QwtLegend::d_items [private]
 

Definition at line 196 of file qwt_legend.h.

Referenced by clear(), insertItem(), itemIterator(), and key().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 14:11:48 2003 for Qwt Developer's Guide by doxygen 1.3.2