#include <PlotSelector.h>
List of all members.
Member Enumeration Documentation
Constructor & Destructor Documentation
PlotSelector::~PlotSelector |
( |
|
) |
[virtual] |
Member Function Documentation
bool PlotSelector::eventFilter |
( |
QObject * |
object, |
|
|
QEvent * |
event | |
|
) |
| | |
Reimplemented from QwtPicker.
{
if ( object == canvas() )
{
switch ( event->type() )
{
case QEvent::MouseButtonPress:
{
m_buttonPressed = true;
m_plotArea->setVisible( true );
m_beginPoint = trackerPosition();
if ( m_type == PlotSelector::Rect )
{
double xPos = plot()->canvasMap( QwtPlot::xBottom ).invTransform( m_beginPoint.x() );
double yPos = plot()->canvasMap( QwtPlot::yLeft ).invTransform( m_beginPoint.y() );
m_plotArea->setRect( xPos, yPos, xPos, yPos );
}
else if ( m_type == PlotSelector::XInterval )
{
double xPos = plot()->canvasMap( QwtPlot::xBottom ).invTransform( m_beginPoint.x() );
m_plotArea->setXInterval( xPos, xPos );
}
else if ( m_type == PlotSelector::YInterval )
{
double yPos = plot()->canvasMap( QwtPlot::yLeft ).invTransform( m_beginPoint.y() );
m_plotArea->setYInterval( yPos, yPos );
}
QTimer::singleShot(0, plot(), SLOT(replot()));
break;
}
case QEvent::MouseButtonRelease:
{
m_buttonPressed = false;
m_endPoint = trackerPosition();
if ( m_type == PlotSelector::Rect )
{
double xBegin = plot()->canvasMap( QwtPlot::xBottom ).invTransform( m_beginPoint.x() );
double yBegin = plot()->canvasMap( QwtPlot::yLeft ).invTransform( m_beginPoint.y() );
double xEnd = plot()->canvasMap( QwtPlot::xBottom ).invTransform( m_endPoint.x() );
double yEnd = plot()->canvasMap( QwtPlot::yLeft ).invTransform( m_endPoint.y() );
m_plotArea->setRect( xBegin, yBegin, xEnd, yEnd );
}
else if ( m_type == PlotSelector::XInterval )
{
double xBegin = plot()->canvasMap( QwtPlot::xBottom ).invTransform( m_beginPoint.x() );
double xEnd = plot()->canvasMap( QwtPlot::xBottom ).invTransform( m_endPoint.x() );
m_plotArea->setXInterval( xBegin, xEnd );
}
else if ( m_type == PlotSelector::YInterval )
{
double yBegin = plot()->canvasMap( QwtPlot::yLeft ).invTransform( m_beginPoint.y() );
double yEnd = plot()->canvasMap( QwtPlot::yLeft ).invTransform( m_endPoint.y() );
m_plotArea->setYInterval( yBegin, yEnd );
}
QTimer::singleShot(0, plot(), SLOT(replot()));
break;
}
case QEvent::MouseMove:
{
if ( m_buttonPressed == false ) break;
QPoint position = trackerPosition();
if ( m_type == PlotSelector::Rect )
{
double xBegin = plot()->canvasMap( QwtPlot::xBottom ).invTransform( m_beginPoint.x() );
double yBegin = plot()->canvasMap( QwtPlot::yLeft ).invTransform( m_beginPoint.y() );
double xPos = plot()->canvasMap( QwtPlot::xBottom ).invTransform( position.x() );
double yPos = plot()->canvasMap( QwtPlot::yLeft ).invTransform( position.y() );
m_plotArea->setRect( xBegin, yBegin, xPos, yPos );
}
else if ( m_type == PlotSelector::XInterval )
{
double xBegin = plot()->canvasMap( QwtPlot::xBottom ).invTransform( m_beginPoint.x() );
double xPos = plot()->canvasMap( QwtPlot::xBottom ).invTransform( position.x() );
m_plotArea->setXInterval( xBegin, xPos );
}
else if ( m_type == PlotSelector::YInterval )
{
double yBegin = plot()->canvasMap( QwtPlot::yLeft ).invTransform( m_beginPoint.y() );
double yPos = plot()->canvasMap( QwtPlot::yLeft ).invTransform( position.y() );
m_plotArea->setYInterval( yBegin, yPos );
}
QTimer::singleShot(0, plot(), SLOT(replot()));
break;
}
default:
break;
}
}
return QwtPlotPicker::eventFilter( object, event );
}
QRectF PlotSelector::rect |
( |
|
) |
const [inline] |
{ return m_plotArea->rect(); }
void PlotSelector::removeSelection |
( |
|
) |
|
QBrush PlotSelector::selectionBrush |
( |
|
) |
const [inline] |
{ return m_plotArea->brush(); }
void PlotSelector::setSelectionBrush |
( |
QBrush |
brush |
) |
[inline] |
void PlotSelector::setType |
( |
Type |
type |
) |
[inline] |
Type PlotSelector::type |
( |
|
) |
const [inline] |
double PlotSelector::xIntervalLowerBound |
( |
|
) |
const [inline] |
double PlotSelector::xIntervalUpperBound |
( |
|
) |
const [inline] |
double PlotSelector::yIntervalLowerBound |
( |
|
) |
const [inline] |
double PlotSelector::yIntervalUpperBound |
( |
|
) |
const [inline] |
The documentation for this class was generated from the following files: