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

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

See also:
QwtLegendButton, QwtPlot

Definition at line 158 of file qwt_legend.h.

Public Types

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

Public Member Functions

 QwtLegend (QWidget *parent=0, const char *name=0)
void setReadOnly (bool readOnly)
bool isReadOnly () const
void setDisplayPolicy (LegendDisplayPolicy policy, int mode=-1)
LegendDisplayPolicy 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 QWidgetIntDictIt 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 ()


Member Enumeration Documentation

enum QwtLegend::LegendDisplayPolicy
 

Display policy.

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

  • Auto
    each legend item is displayed with a mode that is a bitwise or of
    • QwtLegendItem::ShowLine (if its curve is drawn with a line) and
    • QwtLegendItem::ShowSymbol (if its curve is drawn with symbols) and
    • QwtLegendItem::ShowText (if the has a title).

Default is LegendDisplayPolicy::Auto.

See also:
QwtLegend::setDisplayPolicy, QwtLegend::displayPolicy, QwtLegendItem::IdentifierMode

Definition at line 187 of file qwt_legend.h.

Referenced by displayPolicy().


Constructor & Destructor Documentation

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

Parameters:
parent Parent widget
name Widget name

Definition at line 388 of file qwt_legend.cpp.


Member Function Documentation

void QwtLegend::clear  ) 
 

Remove all items.

Definition at line 565 of file qwt_legend.cpp.

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

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 481 of file qwt_legend.cpp.

QWidget * QwtLegend::contentsWidget  ) 
 

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

Definition at line 471 of file qwt_legend.cpp.

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

QwtLegend::LegendDisplayPolicy QwtLegend::displayPolicy  )  const
 

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

Definition at line 450 of file qwt_legend.cpp.

References LegendDisplayPolicy.

Referenced by QwtPlot::updateLegendItem().

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

Event filter.

Definition at line 662 of file qwt_legend.cpp.

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

const QWidget * QwtLegend::findItem long  key  )  const
 

Find the item for a given key.

Definition at line 537 of file qwt_legend.cpp.

QWidget * QwtLegend::findItem long  key  ) 
 

Find the item for a given key.

Definition at line 531 of file qwt_legend.cpp.

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 608 of file qwt_legend.cpp.

Referenced by QwtPlotLayout::minimumSizeHint().

int QwtLegend::identifierMode  )  const
 

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

Definition at line 462 of file qwt_legend.cpp.

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 493 of file qwt_legend.cpp.

References layoutContents().

Referenced by QwtPlot::insertLegendItem().

bool QwtLegend::isEmpty  )  const
 

Return TRUE, if there are no legend items.

Definition at line 239 of file qwt_legend.h.

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

bool QwtLegend::isReadOnly  )  const
 

A mode telling QwtPlot to insert read only items

See also:
setReadOnly

Definition at line 424 of file qwt_legend.cpp.

Referenced by QwtPlot::insertLegendItem().

uint QwtLegend::itemCount  )  const
 

Return the number of legend items.

Definition at line 245 of file qwt_legend.h.

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

QWidgetIntDictIt QwtLegend::itemIterator  )  const [virtual]
 

Return an item iterator.

Definition at line 591 of file qwt_legend.cpp.

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 553 of file qwt_legend.cpp.

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 629 of file qwt_legend.cpp.

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

Referenced by eventFilter(), and insertItem().

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

Set the legend display policy to:

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

Definition at line 437 of file qwt_legend.cpp.

Referenced by QwtPlot::setLegendDisplayPolicy().

void QwtLegend::setReadOnly bool  readOnly  ) 
 

A mode telling QwtPlot to insert read only items

See also:
isReadOnly

Definition at line 415 of file qwt_legend.cpp.

QSize QwtLegend::sizeHint  )  const [virtual]
 

Return a size hint.

Definition at line 597 of file qwt_legend.cpp.

Referenced by QwtPlotLayout::minimumSizeHint().

QWidget * QwtLegend::takeItem long  key  ) 
 

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

Definition at line 543 of file qwt_legend.cpp.

Referenced by eventFilter().

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

Resize the viewport() and post a QEvent::LayoutHint to QwtLegend::contentsWidget() to update the layout.

Definition at line 692 of file qwt_legend.cpp.


Generated on Sun Nov 21 11:12:51 2004 for Qwt User's Guide by doxygen 1.3.5