Loading...
Searching...
No Matches
qwt_plot.cpp
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#include "qwt_plot.h"
#include "qwt_plot_dict.h"
#include "qwt_plot_layout.h"
#include "qwt_scale_widget.h"
#include "qwt_scale_engine.h"
#include "qwt_scale_map.h"
#include "qwt_text_label.h"
#include "qwt_legend.h"
#include "qwt_legend_data.h"
#include "qwt_plot_canvas.h"
#include "qwt_math.h"
#include <qpainter.h>
#include <qpointer.h>
#include <qapplication.h>
#include <qcoreevent.h>
static inline void qwtEnableLegendItems( QwtPlot* plot, bool on )
{
// gcc seems to have problems with const char sig[] in combination with certain options
const char* sig = SIGNAL(legendDataChanged(QVariant,QList<QwtLegendData>));
const char* slot = SLOT(updateLegendItems(QVariant,QList<QwtLegendData>));
if ( on )
QObject::connect( plot, sig, plot, slot );
else
QObject::disconnect( plot, sig, plot, slot );
}
static void qwtSetTabOrder(
QWidget* first, QWidget* second, bool withChildren )
{
QList< QWidget* > tabChain;
tabChain += first;
tabChain += second;
if ( withChildren )
{
QList< QWidget* > children = second->findChildren< QWidget* >();
QWidget* w = second->nextInFocusChain();
while ( children.contains( w ) )
{
children.removeAll( w );
tabChain += w;
w = w->nextInFocusChain();
}
}
for ( int i = 0; i < tabChain.size() - 1; i++ )
{
QWidget* from = tabChain[i];
QWidget* to = tabChain[i + 1];
const Qt::FocusPolicy policy1 = from->focusPolicy();
const Qt::FocusPolicy policy2 = to->focusPolicy();
QWidget* proxy1 = from->focusProxy();
QWidget* proxy2 = to->focusProxy();
from->setFocusPolicy( Qt::TabFocus );
from->setFocusProxy( NULL);
to->setFocusPolicy( Qt::TabFocus );
to->setFocusProxy( NULL);
QWidget::setTabOrder( from, to );
from->setFocusPolicy( policy1 );
from->setFocusProxy( proxy1);
to->setFocusPolicy( policy2 );
to->setFocusProxy( proxy2 );
}
}
class QwtPlot::PrivateData
{
public:
QPointer< QwtTextLabel > titleLabel;
QPointer< QwtTextLabel > footerLabel;
QPointer< QWidget > canvas;
QPointer< QwtAbstractLegend > legend;
QwtPlotLayout* layout;
bool autoReplot;
};
QwtPlot::QwtPlot( QWidget* parent )
: QFrame( parent )
{
initPlot( QwtText() );
}
QwtPlot::QwtPlot( const QwtText& title, QWidget* parent )
: QFrame( parent )
{
initPlot( title );
}
QwtPlot::~QwtPlot()
{
setAutoReplot( false );
detachItems( QwtPlotItem::Rtti_PlotItem, autoDelete() );
delete m_data->layout;
deleteAxesData();
delete m_data;
}
void QwtPlot::initPlot( const QwtText& title )
{
m_data = new PrivateData;
m_data->layout = new QwtPlotLayout;
m_data->autoReplot = false;
// title
m_data->titleLabel = new QwtTextLabel( this );
m_data->titleLabel->setObjectName( "QwtPlotTitle" );
m_data->titleLabel->setFont( QFont( fontInfo().family(), 14, QFont::Bold ) );
QwtText text( title );
text.setRenderFlags( Qt::AlignCenter | Qt::TextWordWrap );
m_data->titleLabel->setText( text );
// footer
m_data->footerLabel = new QwtTextLabel( this );
m_data->footerLabel->setObjectName( "QwtPlotFooter" );
QwtText footer;
footer.setRenderFlags( Qt::AlignCenter | Qt::TextWordWrap );
m_data->footerLabel->setText( footer );
// legend
m_data->legend = NULL;
// axes
initAxesData();
// canvas
m_data->canvas = new QwtPlotCanvas( this );
m_data->canvas->setObjectName( "QwtPlotCanvas" );
m_data->canvas->installEventFilter( this );
setSizePolicy( QSizePolicy::MinimumExpanding,
QSizePolicy::MinimumExpanding );
resize( 200, 200 );
using namespace QwtAxis;
QList< QWidget* > focusChain;
focusChain << this << m_data->titleLabel << axisWidget( XTop )
<< axisWidget( YLeft ) << m_data->canvas
<< axisWidget( YRight ) << axisWidget( XBottom )
<< m_data->footerLabel;
for ( int i = 0; i < focusChain.size() - 1; i++ )
qwtSetTabOrder( focusChain[i], focusChain[i + 1], false );
qwtEnableLegendItems( this, true );
}
void QwtPlot::setCanvas( QWidget* canvas )
{
if ( canvas == m_data->canvas )
return;
delete m_data->canvas;
m_data->canvas = canvas;
if ( canvas )
{
canvas->setParent( this );
canvas->installEventFilter( this );
if ( isVisible() )
canvas->show();
}
}
bool QwtPlot::event( QEvent* event )
{
bool ok = QFrame::event( event );
switch ( event->type() )
{
case QEvent::LayoutRequest:
updateLayout();
break;
case QEvent::PolishRequest:
replot();
break;
default:;
}
return ok;
}
bool QwtPlot::eventFilter( QObject* object, QEvent* event )
{
if ( object == m_data->canvas )
{
if ( event->type() == QEvent::Resize )
{
updateCanvasMargins();
}
else if ( event->type() == QEvent::ContentsRectChange )
{
updateLayout();
}
}
return QFrame::eventFilter( object, event );
}
void QwtPlot::autoRefresh()
{
if ( m_data->autoReplot )
replot();
}
void QwtPlot::setAutoReplot( bool tf )
{
m_data->autoReplot = tf;
}
bool QwtPlot::autoReplot() const
{
return m_data->autoReplot;
}
void QwtPlot::setTitle( const QString& title )
{
if ( title != m_data->titleLabel->text().text() )
{
m_data->titleLabel->setText( title );
updateLayout();
}
}
void QwtPlot::setTitle( const QwtText& title )
{
if ( title != m_data->titleLabel->text() )
{
m_data->titleLabel->setText( title );
updateLayout();
}
}
QwtText QwtPlot::title() const
{
return m_data->titleLabel->text();
}
QwtTextLabel* QwtPlot::titleLabel()
{
return m_data->titleLabel;
}
const QwtTextLabel* QwtPlot::titleLabel() const
{
return m_data->titleLabel;
}
void QwtPlot::setFooter( const QString& text )
{
if ( text != m_data->footerLabel->text().text() )
{
m_data->footerLabel->setText( text );
updateLayout();
}
}
void QwtPlot::setFooter( const QwtText& text )
{
if ( text != m_data->footerLabel->text() )
{
m_data->footerLabel->setText( text );
updateLayout();
}
}
QwtText QwtPlot::footer() const
{
return m_data->footerLabel->text();
}
QwtTextLabel* QwtPlot::footerLabel()
{
return m_data->footerLabel;
}
const QwtTextLabel* QwtPlot::footerLabel() const
{
return m_data->footerLabel;
}
void QwtPlot::setPlotLayout( QwtPlotLayout* layout )
{
if ( layout != m_data->layout )
{
delete m_data->layout;
m_data->layout = layout;
updateLayout();
}
}
QwtPlotLayout* QwtPlot::plotLayout()
{
return m_data->layout;
}
const QwtPlotLayout* QwtPlot::plotLayout() const
{
return m_data->layout;
}
QwtAbstractLegend* QwtPlot::legend()
{
return m_data->legend;
}
const QwtAbstractLegend* QwtPlot::legend() const
{
return m_data->legend;
}
QWidget* QwtPlot::canvas()
{
return m_data->canvas;
}
const QWidget* QwtPlot::canvas() const
{
return m_data->canvas;
}
QSize QwtPlot::sizeHint() const
{
int dw = 0;
int dh = 0;
for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
{
{
const QwtAxisId axisId( axisPos );
if ( isAxisVisible( axisId ) )
{
const int niceDist = 40;
const QwtScaleWidget* scaleWidget = axisWidget( axisId );
const QwtScaleDiv& scaleDiv = scaleWidget->scaleDraw()->scaleDiv();
const int majCnt = scaleDiv.ticks( QwtScaleDiv::MajorTick ).count();
const QSize hint = scaleWidget->minimumSizeHint();
if ( QwtAxis::isYAxis( axisPos ) )
{
const int hDiff = ( majCnt - 1 ) * niceDist - hint.height();
dh = qMax( dh, hDiff );
}
else
{
const int wDiff = ( majCnt - 1 ) * niceDist - hint.width();
dw = qMax( dw, wDiff );
}
}
}
}
return minimumSizeHint() + QSize( dw, dh );
}
QSize QwtPlot::minimumSizeHint() const
{
QSize hint = m_data->layout->minimumSizeHint( this );
hint += QSize( 2 * frameWidth(), 2 * frameWidth() );
return hint;
}
void QwtPlot::resizeEvent( QResizeEvent* e )
{
QFrame::resizeEvent( e );
updateLayout();
}
void QwtPlot::replot()
{
bool doAutoReplot = autoReplot();
setAutoReplot( false );
updateAxes();
/*
Maybe the layout needs to be updated, because of changed
axes labels. We need to process them here before painting
to avoid that scales and canvas get out of sync.
*/
QApplication::sendPostedEvents( this, QEvent::LayoutRequest );
if ( m_data->canvas )
{
const bool ok = QMetaObject::invokeMethod(
m_data->canvas, "replot", Qt::DirectConnection );
if ( !ok )
{
// fallback, when canvas has no a replot method
m_data->canvas->update( m_data->canvas->contentsRect() );
}
}
setAutoReplot( doAutoReplot );
}
void QwtPlot::updateLayout()
{
QwtPlotLayout* layout = m_data->layout;
layout->activate( this, contentsRect() );
const QRect titleRect = layout->titleRect().toRect();
const QRect footerRect = layout->footerRect().toRect();
const QRect legendRect = layout->legendRect().toRect();
const QRect canvasRect = layout->canvasRect().toRect();
// resize and show the visible widgets
if ( !m_data->titleLabel->text().isEmpty() )
{
m_data->titleLabel->setGeometry( titleRect );
if ( !m_data->titleLabel->isVisibleTo( this ) )
m_data->titleLabel->show();
}
else
m_data->titleLabel->hide();
if ( !m_data->footerLabel->text().isEmpty() )
{
m_data->footerLabel->setGeometry( footerRect );
if ( !m_data->footerLabel->isVisibleTo( this ) )
m_data->footerLabel->show();
}
else
{
m_data->footerLabel->hide();
}
for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
{
{
const QwtAxisId axisId( axisPos );
QwtScaleWidget* scaleWidget = axisWidget( axisId );
if ( isAxisVisible( axisId ) )
{
const QRect scaleRect = layout->scaleRect( axisId ).toRect();
if ( scaleRect != scaleWidget->geometry() )
{
scaleWidget->setGeometry( scaleRect );
int startDist, endDist;
scaleWidget->getBorderDistHint( startDist, endDist );
scaleWidget->setBorderDist( startDist, endDist );
}
if ( !scaleWidget->isVisibleTo( this ) )
scaleWidget->show();
}
else
{
scaleWidget->hide();
}
}
}
if ( m_data->legend )
{
if ( m_data->legend->isEmpty() )
{
m_data->legend->hide();
}
else
{
m_data->legend->setGeometry( legendRect );
m_data->legend->show();
}
}
m_data->canvas->setGeometry( canvasRect );
}
void QwtPlot::getCanvasMarginsHint(
const QwtScaleMap maps[], const QRectF& canvasRect,
double& left, double& top, double& right, double& bottom) const
{
left = top = right = bottom = -1.0;
const QwtPlotItemList& itmList = itemList();
for ( QwtPlotItemIterator it = itmList.begin();
it != itmList.end(); ++it )
{
const QwtPlotItem* item = *it;
if ( item->testItemAttribute( QwtPlotItem::Margins ) )
{
using namespace QwtAxis;
double m[ AxisPositions ];
item->getCanvasMarginHint(
maps[ item->xAxis() ], maps[ item->yAxis() ],
canvasRect, m[YLeft], m[XTop], m[YRight], m[XBottom] );
left = qwtMaxF( left, m[YLeft] );
top = qwtMaxF( top, m[XTop] );
right = qwtMaxF( right, m[YRight] );
bottom = qwtMaxF( bottom, m[XBottom] );
}
}
}
void QwtPlot::updateCanvasMargins()
{
using namespace QwtAxis;
QwtScaleMap maps[ AxisPositions ];
for ( int axisId = 0; axisId < AxisPositions; axisId++ )
maps[axisId] = canvasMap( axisId );
double margins[AxisPositions];
getCanvasMarginsHint( maps, canvas()->contentsRect(),
margins[YLeft], margins[XTop], margins[YRight], margins[XBottom] );
bool doUpdate = false;
for ( int axisPos = 0; axisPos < AxisPositions; axisPos++ )
{
if ( margins[axisPos] >= 0.0 )
{
const int m = qwtCeil( margins[axisPos] );
plotLayout()->setCanvasMargin( m, axisPos);
doUpdate = true;
}
}
if ( doUpdate )
updateLayout();
}
void QwtPlot::drawCanvas( QPainter* painter )
{
QwtScaleMap maps[ QwtAxis::AxisPositions ];
for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
maps[axisPos] = canvasMap( axisPos );
drawItems( painter, m_data->canvas->contentsRect(), maps );
}
void QwtPlot::drawItems( QPainter* painter, const QRectF& canvasRect,
const QwtScaleMap maps[ QwtAxis::AxisPositions ] ) const
{
const QwtPlotItemList& itmList = itemList();
for ( QwtPlotItemIterator it = itmList.begin();
it != itmList.end(); ++it )
{
QwtPlotItem* item = *it;
if ( item && item->isVisible() )
{
const QwtAxisId xAxis = item->xAxis();
const QwtAxisId yAxis = item->yAxis();
painter->save();
painter->setRenderHint( QPainter::Antialiasing,
item->testRenderHint( QwtPlotItem::RenderAntialiased ) );
#if QT_VERSION < 0x050100
painter->setRenderHint( QPainter::HighQualityAntialiasing,
item->testRenderHint( QwtPlotItem::RenderAntialiased ) );
#endif
item->draw( painter, maps[xAxis], maps[yAxis], canvasRect );
painter->restore();
}
}
}
QwtScaleMap QwtPlot::canvasMap( QwtAxisId axisId ) const
{
QwtScaleMap map;
if ( !m_data->canvas )
return map;
map.setTransformation( axisScaleEngine( axisId )->transformation() );
const QwtScaleDiv& sd = axisScaleDiv( axisId );
map.setScaleInterval( sd.lowerBound(), sd.upperBound() );
if ( isAxisVisible( axisId ) )
{
const QwtScaleWidget* s = axisWidget( axisId );
if ( QwtAxis::isYAxis( axisId ) )
{
double y = s->y() + s->startBorderDist() - m_data->canvas->y();
double h = s->height() - s->startBorderDist() - s->endBorderDist();
map.setPaintInterval( y + h, y );
}
else
{
double x = s->x() + s->startBorderDist() - m_data->canvas->x();
double w = s->width() - s->startBorderDist() - s->endBorderDist();
map.setPaintInterval( x, x + w );
}
}
else
{
using namespace QwtAxis;
const QRect& canvasRect = m_data->canvas->contentsRect();
if ( isYAxis( axisId ) )
{
int top = 0;
if ( !plotLayout()->alignCanvasToScale( XTop ) )
top = plotLayout()->canvasMargin( XTop );
int bottom = 0;
if ( !plotLayout()->alignCanvasToScale( XBottom ) )
bottom = plotLayout()->canvasMargin( XBottom );
map.setPaintInterval( canvasRect.bottom() - bottom,
canvasRect.top() + top );
}
else
{
int left = 0;
if ( !plotLayout()->alignCanvasToScale( YLeft ) )
left = plotLayout()->canvasMargin( YLeft );
int right = 0;
if ( !plotLayout()->alignCanvasToScale( YRight ) )
right = plotLayout()->canvasMargin( YRight );
map.setPaintInterval( canvasRect.left() + left,
canvasRect.right() - right );
}
}
return map;
}
void QwtPlot::setCanvasBackground( const QBrush& brush )
{
QPalette pal = m_data->canvas->palette();
pal.setBrush( QPalette::Window, brush );
canvas()->setPalette( pal );
}
QBrush QwtPlot::canvasBackground() const
{
return canvas()->palette().brush(
QPalette::Normal, QPalette::Window );
}
void QwtPlot::insertLegend( QwtAbstractLegend* legend,
QwtPlot::LegendPosition pos, double ratio )
{
m_data->layout->setLegendPosition( pos, ratio );
if ( legend != m_data->legend )
{
if ( m_data->legend && m_data->legend->parent() == this )
delete m_data->legend;
m_data->legend = legend;
if ( m_data->legend )
{
connect(
this, SIGNAL(legendDataChanged(QVariant,QList<QwtLegendData>)),
m_data->legend, SLOT(updateLegend(QVariant,QList<QwtLegendData>))
);
if ( m_data->legend->parent() != this )
m_data->legend->setParent( this );
qwtEnableLegendItems( this, false );
updateLegend();
qwtEnableLegendItems( this, true );
QwtLegend* lgd = qobject_cast< QwtLegend* >( legend );
if ( lgd )
{
switch ( m_data->layout->legendPosition() )
{
case LeftLegend:
case RightLegend:
{
if ( lgd->maxColumns() == 0 )
lgd->setMaxColumns( 1 ); // 1 column: align vertical
break;
}
case TopLegend:
case BottomLegend:
{
lgd->setMaxColumns( 0 ); // unlimited
break;
}
default:
break;
}
}
QWidget* previousInChain = NULL;
switch ( m_data->layout->legendPosition() )
{
case LeftLegend:
{
const QwtAxisId axisId( QwtAxis::XTop );
previousInChain = axisWidget( axisId );
break;
}
case TopLegend:
{
previousInChain = this;
break;
}
case RightLegend:
{
const QwtAxisId axisId( QwtAxis::YRight );
previousInChain = axisWidget( axisId );
break;
}
case BottomLegend:
{
previousInChain = footerLabel();
break;
}
}
if ( previousInChain )
qwtSetTabOrder( previousInChain, legend, true );
}
}
updateLayout();
}
void QwtPlot::updateLegend()
{
const QwtPlotItemList& itmList = itemList();
for ( QwtPlotItemIterator it = itmList.begin();
it != itmList.end(); ++it )
{
updateLegend( *it );
}
}
void QwtPlot::updateLegend( const QwtPlotItem* plotItem )
{
if ( plotItem == NULL )
return;
QList< QwtLegendData > legendData;
if ( plotItem->testItemAttribute( QwtPlotItem::Legend ) )
legendData = plotItem->legendData();
const QVariant itemInfo = itemToInfo( const_cast< QwtPlotItem* >( plotItem ) );
Q_EMIT legendDataChanged( itemInfo, legendData );
}
void QwtPlot::updateLegendItems( const QVariant& itemInfo,
const QList< QwtLegendData >& legendData )
{
QwtPlotItem* plotItem = infoToItem( itemInfo );
if ( plotItem )
{
const QwtPlotItemList& itmList = itemList();
for ( QwtPlotItemIterator it = itmList.begin();
it != itmList.end(); ++it )
{
QwtPlotItem* item = *it;
if ( item->testItemInterest( QwtPlotItem::LegendInterest ) )
item->updateLegend( plotItem, legendData );
}
}
}
void QwtPlot::attachItem( QwtPlotItem* plotItem, bool on )
{
if ( plotItem->testItemInterest( QwtPlotItem::LegendInterest ) )
{
// plotItem is some sort of legend
const QwtPlotItemList& itmList = itemList();
for ( QwtPlotItemIterator it = itmList.begin();
it != itmList.end(); ++it )
{
QwtPlotItem* item = *it;
QList< QwtLegendData > legendData;
if ( on && item->testItemAttribute( QwtPlotItem::Legend ) )
{
legendData = item->legendData();
plotItem->updateLegend( item, legendData );
}
}
}
if ( on )
insertItem( plotItem );
else
removeItem( plotItem );
Q_EMIT itemAttached( plotItem, on );
if ( plotItem->testItemAttribute( QwtPlotItem::Legend ) )
{
// the item wants to be represented on the legend
if ( on )
{
updateLegend( plotItem );
}
else
{
const QVariant itemInfo = itemToInfo( plotItem );
Q_EMIT legendDataChanged( itemInfo, QList< QwtLegendData >() );
}
}
autoRefresh();
}
QVariant QwtPlot::itemToInfo( QwtPlotItem* plotItem ) const
{
return QVariant::fromValue( plotItem );
}
QwtPlotItem* QwtPlot::infoToItem( const QVariant& itemInfo ) const
{
if ( itemInfo.canConvert< QwtPlotItem* >() )
return qvariant_cast< QwtPlotItem* >( itemInfo );
return NULL;
}
#include "moc_qwt_plot.cpp"
QList
Definition qwt_abstract_legend.h:17
QwtAbstractLegend
Abstract base class for legend widgets.
Definition qwt_abstract_legend.h:35
QwtAbstractScaleDraw::scaleDiv
const QwtScaleDiv & scaleDiv() const
Definition qwt_abstract_scale_draw.cpp:133
QwtLegend
The legend widget.
Definition qwt_legend.h:32
QwtLegend::maxColumns
uint maxColumns() const
Definition qwt_legend.cpp:310
QwtLegend::setMaxColumns
void setMaxColumns(uint numColums)
Set the maximum number of entries in a row.
Definition qwt_legend.cpp:296
QwtPlotCanvas
Canvas of a QwtPlot.
Definition qwt_plot_canvas.h:30
QwtPlotDict::insertItem
void insertItem(QwtPlotItem *)
Definition qwt_plot_dict.cpp:115
QwtPlotDict::itemList
const QwtPlotItemList & itemList() const
A QwtPlotItemList of all attached plot items.
Definition qwt_plot_dict.cpp:166
QwtPlotDict::autoDelete
bool autoDelete() const
Definition qwt_plot_dict.cpp:104
QwtPlotDict::removeItem
void removeItem(QwtPlotItem *)
Definition qwt_plot_dict.cpp:126
QwtPlotDict::detachItems
void detachItems(int rtti=QwtPlotItem::Rtti_PlotItem, bool autoDelete=true)
Definition qwt_plot_dict.cpp:138
QwtPlot
A 2-D plotting widget.
Definition qwt_plot.h:79
QwtPlot::insertLegend
void insertLegend(QwtAbstractLegend *, LegendPosition=QwtPlot::RightLegend, double ratio=-1.0)
Insert a legend.
Definition qwt_plot.cpp:927
QwtPlot::eventFilter
virtual bool eventFilter(QObject *, QEvent *) override
Event filter.
Definition qwt_plot.cpp:271
QwtPlot::setPlotLayout
void setPlotLayout(QwtPlotLayout *)
Assign a new plot layout.
Definition qwt_plot.cpp:418
QwtPlot::itemAttached
void itemAttached(QwtPlotItem *plotItem, bool on)
QwtPlot::updateAxes
void updateAxes()
Rebuild the axes scales.
Definition qwt_plot_axis.cpp:670
QwtPlot::~QwtPlot
virtual ~QwtPlot()
Destructor.
Definition qwt_plot.cpp:121
QwtPlot::setFooter
void setFooter(const QString &)
Definition qwt_plot.cpp:372
QwtPlot::LegendPosition
LegendPosition
Definition qwt_plot.h:94
QwtPlot::TopLegend
@ TopLegend
The legend will be above the title.
Definition qwt_plot.h:105
QwtPlot::LeftLegend
@ LeftLegend
The legend will be left from the QwtAxis::YLeft axis.
Definition qwt_plot.h:96
QwtPlot::RightLegend
@ RightLegend
The legend will be right from the QwtAxis::YRight axis.
Definition qwt_plot.h:99
QwtPlot::BottomLegend
@ BottomLegend
The legend will be below the footer.
Definition qwt_plot.h:102
QwtPlot::getCanvasMarginsHint
virtual void getCanvasMarginsHint(const QwtScaleMap maps[], const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const
Calculate the canvas margins.
Definition qwt_plot.cpp:670
QwtPlot::axisScaleEngine
QwtScaleEngine * axisScaleEngine(QwtAxisId)
Definition qwt_plot_axis.cpp:190
QwtPlot::autoReplot
bool autoReplot() const
Definition qwt_plot.cpp:319
QwtPlot::itemToInfo
virtual QVariant itemToInfo(QwtPlotItem *) const
Build an information, that can be used to identify a plot item on the legend.
Definition qwt_plot.cpp:1139
QwtPlot::drawItems
virtual void drawItems(QPainter *, const QRectF &, const QwtScaleMap maps[QwtAxis::AxisPositions]) const
Definition qwt_plot.cpp:764
QwtPlot::event
virtual bool event(QEvent *) override
Adds handling of layout requests.
Definition qwt_plot.cpp:237
QwtPlot::canvas
QWidget * canvas()
Definition qwt_plot.cpp:463
QwtPlot::footerLabel
QwtTextLabel * footerLabel()
Definition qwt_plot.cpp:401
QwtPlot::isAxisVisible
bool isAxisVisible(QwtAxisId) const
Definition qwt_plot_axis.cpp:225
QwtPlot::replot
virtual void replot()
Redraw the plot.
Definition qwt_plot.cpp:545
QwtPlot::plotLayout
QwtPlotLayout * plotLayout()
Definition qwt_plot.cpp:430
QwtPlot::setTitle
void setTitle(const QString &)
Definition qwt_plot.cpp:328
QwtPlot::updateLegend
void updateLegend()
Definition qwt_plot.cpp:1016
QwtPlot::minimumSizeHint
virtual QSize minimumSizeHint() const override
Return a minimum size hint.
Definition qwt_plot.cpp:518
QwtPlot::infoToItem
virtual QwtPlotItem * infoToItem(const QVariant &) const
Identify the plot item according to an item info object, that has bee generated from itemToInfo().
Definition qwt_plot.cpp:1159
QwtPlot::canvasBackground
QBrush canvasBackground() const
Definition qwt_plot.cpp:888
QwtPlot::setAutoReplot
void setAutoReplot(bool=true)
Set or reset the autoReplot option.
Definition qwt_plot.cpp:310
QwtPlot::legend
QwtAbstractLegend * legend()
Definition qwt_plot.cpp:445
QwtPlot::axisWidget
const QwtScaleWidget * axisWidget(QwtAxisId) const
Definition qwt_plot_axis.cpp:141
QwtPlot::footer
QwtText footer() const
Definition qwt_plot.cpp:395
QwtPlot::titleLabel
QwtTextLabel * titleLabel()
Definition qwt_plot.cpp:357
QwtPlot::canvasMap
virtual QwtScaleMap canvasMap(QwtAxisId) const
Definition qwt_plot.cpp:800
QwtPlot::QwtPlot
QwtPlot(QWidget *=NULL)
Constructor.
Definition qwt_plot.cpp:103
QwtPlot::resizeEvent
virtual void resizeEvent(QResizeEvent *) override
Definition qwt_plot.cpp:530
QwtPlot::legendDataChanged
void legendDataChanged(const QVariant &itemInfo, const QList< QwtLegendData > &data)
QwtPlot::updateLayout
virtual void updateLayout()
Adjust plot content to its current size.
Definition qwt_plot.cpp:577
QwtPlot::setCanvasBackground
void setCanvasBackground(const QBrush &)
Change the background of the plotting area.
Definition qwt_plot.cpp:873
QwtPlot::drawCanvas
virtual void drawCanvas(QPainter *)
Definition qwt_plot.cpp:742
QwtPlot::setCanvas
void setCanvas(QWidget *)
Set the drawing canvas of the plot widget.
Definition qwt_plot.cpp:213
QwtPlot::autoRefresh
void autoRefresh()
Replots the plot if autoReplot() is true.
Definition qwt_plot.cpp:289
QwtPlot::axisScaleDiv
const QwtScaleDiv & axisScaleDiv(QwtAxisId) const
Return the scale division of a specified axis.
Definition qwt_plot_axis.cpp:283
QwtPlot::updateCanvasMargins
void updateCanvasMargins()
Update the canvas margins.
Definition qwt_plot.cpp:706
QwtPlot::sizeHint
virtual QSize sizeHint() const override
Definition qwt_plot.cpp:480
QwtPlot::title
QwtText title() const
Definition qwt_plot.cpp:351
QwtPlotItem
Base class for items on the plot canvas.
Definition qwt_plot_item.h:67
QwtPlotItem::yAxis
QwtAxisId yAxis() const
Return yAxis.
Definition qwt_plot_item.cpp:559
QwtPlotItem::draw
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
Draw the item.
QwtPlotItem::isVisible
bool isVisible() const
Definition qwt_plot_item.cpp:470
QwtPlotItem::legendData
virtual QList< QwtLegendData > legendData() const
Return all information, that is needed to represent the item on the legend.
Definition qwt_plot_item.cpp:626
QwtPlotItem::xAxis
QwtAxisId xAxis() const
Return xAxis.
Definition qwt_plot_item.cpp:553
QwtPlotItem::testItemInterest
bool testItemInterest(ItemInterest) const
Definition qwt_plot_item.cpp:299
QwtPlotItem::Rtti_PlotItem
@ Rtti_PlotItem
Unspecific value, that can be used, when it doesn't matter.
Definition qwt_plot_item.h:78
QwtPlotItem::RenderAntialiased
@ RenderAntialiased
Enable antialiasing.
Definition qwt_plot_item.h:206
QwtPlotItem::testItemAttribute
bool testItemAttribute(ItemAttribute) const
Definition qwt_plot_item.cpp:266
QwtPlotItem::testRenderHint
bool testRenderHint(RenderHint) const
Definition qwt_plot_item.cpp:332
QwtPlotItem::Legend
@ Legend
The item is represented on the legend.
Definition qwt_plot_item.h:150
QwtPlotItem::Margins
@ Margins
Definition qwt_plot_item.h:164
QwtPlotItem::getCanvasMarginHint
virtual void getCanvasMarginHint(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const
Calculate a hint for the canvas margin.
Definition qwt_plot_item.cpp:595
QwtPlotItem::updateLegend
virtual void updateLegend(const QwtPlotItem *, const QList< QwtLegendData > &)
Update the item to changes of the legend info.
Definition qwt_plot_item.cpp:690
QwtPlotItem::LegendInterest
@ LegendInterest
Definition qwt_plot_item.h:197
QwtPlotLayout
Layout engine for QwtPlot.
Definition qwt_plot_layout.h:28
QwtPlotLayout::titleRect
QRectF titleRect() const
Definition qwt_plot_layout.cpp:1282
QwtPlotLayout::setCanvasMargin
void setCanvasMargin(int margin, int axis=-1)
Definition qwt_plot_layout.cpp:1066
QwtPlotLayout::setLegendPosition
void setLegendPosition(QwtPlot::LegendPosition pos, double ratio)
Specify the position of the legend.
Definition qwt_plot_layout.cpp:1183
QwtPlotLayout::footerRect
QRectF footerRect() const
Definition qwt_plot_layout.cpp:1304
QwtPlotLayout::canvasMargin
int canvasMargin(int axisId) const
Definition qwt_plot_layout.cpp:1089
QwtPlotLayout::legendRect
QRectF legendRect() const
Definition qwt_plot_layout.cpp:1328
QwtPlotLayout::legendPosition
QwtPlot::LegendPosition legendPosition() const
Definition qwt_plot_layout.cpp:1237
QwtPlotLayout::minimumSizeHint
virtual QSize minimumSizeHint(const QwtPlot *) const
Definition qwt_plot_layout.cpp:1404
QwtPlotLayout::scaleRect
QRectF scaleRect(QwtAxisId) const
Definition qwt_plot_layout.cpp:1355
QwtPlotLayout::canvasRect
QRectF canvasRect() const
Definition qwt_plot_layout.cpp:1380
QwtPlotLayout::activate
virtual void activate(const QwtPlot *, const QRectF &plotRect, Options options=Options())
Recalculate the geometry of all components.
Definition qwt_plot_layout.cpp:1508
QwtScaleDiv
A class representing a scale division.
Definition qwt_scale_div.h:34
QwtScaleDiv::lowerBound
double lowerBound() const
Definition qwt_scale_div.cpp:131
QwtScaleDiv::upperBound
double upperBound() const
Definition qwt_scale_div.cpp:151
QwtScaleDiv::ticks
QList< double > ticks(int tickType) const
Definition qwt_scale_div.cpp:309
QwtScaleDiv::MajorTick
@ MajorTick
Major ticks.
Definition qwt_scale_div.h:49
QwtScaleMap
A scale map.
Definition qwt_scale_map.h:27
QwtScaleMap::setPaintInterval
void setPaintInterval(double p1, double p2)
Specify the borders of the paint device interval.
Definition qwt_scale_map.cpp:119
QwtScaleMap::setScaleInterval
void setScaleInterval(double s1, double s2)
Specify the borders of the scale interval.
Definition qwt_scale_map.cpp:100
QwtScaleMap::setTransformation
void setTransformation(QwtTransform *)
Definition qwt_scale_map.cpp:76
QwtScaleWidget
A Widget which contains a scale.
Definition qwt_scale_widget.h:35
QwtScaleWidget::startBorderDist
int startBorderDist() const
Definition qwt_scale_widget.cpp:381
QwtScaleWidget::scaleDraw
const QwtScaleDraw * scaleDraw() const
Definition qwt_scale_widget.cpp:354
QwtScaleWidget::endBorderDist
int endBorderDist() const
Definition qwt_scale_widget.cpp:390
QwtScaleWidget::getBorderDistHint
void getBorderDistHint(int &start, int &end) const
Calculate a hint for the border distances.
Definition qwt_scale_widget.cpp:815
QwtScaleWidget::setBorderDist
void setBorderDist(int dist1, int dist2)
Definition qwt_scale_widget.cpp:251
QwtScaleWidget::minimumSizeHint
virtual QSize minimumSizeHint() const override
Definition qwt_scale_widget.cpp:733
QwtText
A class representing a text.
Definition qwt_text.h:52
QwtText::setRenderFlags
void setRenderFlags(int)
Change the render flags.
Definition qwt_text.cpp:304
QwtTextLabel
A Widget which displays a QwtText.
Definition qwt_text_label.h:27
QwtAxis
Definition qwt_axis.h:19
QwtAxis::isYAxis
bool isYAxis(int axisPos)
Definition qwt_axis.h:57
QwtAxis::YRight
@ YRight
Y axis right of the canvas.
Definition qwt_axis.h:27
QwtAxis::XTop
@ XTop
X axis above the canvas.
Definition qwt_axis.h:33