Default constructor
*/
Plot2d_Prs::Plot2d_Prs( bool theDelete )
-: mySecondY( false)
+: mySecondY( false), myIsAutoDel( theDelete )
{
- setAutoDel(theDelete);
}
/*!
Standard constructor
*/
Plot2d_Prs::Plot2d_Prs( const Plot2d_Curve* obj, bool theDelete )
-: mySecondY( false)
+: mySecondY( false), myIsAutoDel( theDelete )
{
- setAutoDel(theDelete);
AddObject( obj );
}
*/
Plot2d_Prs::~Plot2d_Prs()
{
+ if ( myIsAutoDel )
+ qDeleteAll( myCurves );
}
/*!
*/
void Plot2d_Prs::setAutoDel(bool theDel)
{
- //myCurves.setAutoDelete(theDel);
+ myIsAutoDel = theDel;
}
#include <QFontMetrics>
#include <QEvent>
+#include <QMouseEvent>
#include <qwt_plot.h>
#include <qwt_plot_canvas.h>
void Plot2d_ToolTip::onToolTip( QPoint p, QString& str, QFont& f, QRect& txtRect, QRect& rect )
{
- int pInd;//, dist;
+ int pInd;
double dist;
- //double x, y;
- //curInd = myPlot->closestCurve( p.x(), p.y(), dist, x, y, pInd );
-
- //if( dist>maxDist )
- // return;
-
- //Plot2d_Curve* c = myFrame->getCurves().find( curInd );
Plot2d_Curve* c = myPlot->getClosestCurve( p, dist, pInd );
if( dist>maxDist || !c )
bool res = QtxToolTip::eventFilter( o, e );
if( e && e->type() == QEvent::MouseMove )
{
- ///QMouseEvent* me = ( QMouseEvent* )e;
- ///if( me->state()==0 )
+ QMouseEvent* me = ( QMouseEvent* )e;
+ if( me->modifiers()==0 )
return true;
}
return res;
class QCustomEvent;
class QwtPlotCurve;
class QwtPlotGrid;
+class QwtPlotZoomer;
typedef QMultiHash<QwtPlotCurve*, Plot2d_Curve*> CurveDict;
void Erase( const Plot2d_Prs*, const bool = false );
Plot2d_Prs* CreatePrs( const char* entry = 0 );
+ virtual bool eventFilter(QObject* watched, QEvent* e);
+
/* operations */
void updateTitles();
void setTitle( const QString& title );
void eraseCurve( Plot2d_Curve* curve, bool update = false );
void eraseCurves( const curveList& curves, bool update = false );
int getCurves( curveList& clist );
- const CurveDict& getCurves();/// { return myPlot->getCurves(); }
- //int hasCurve( Plot2d_Curve* curve );
+ const CurveDict& getCurves();
bool isVisible( Plot2d_Curve* curve );
void updateCurve( Plot2d_Curve* curve, bool update = false );
void updateLegend( const Plot2d_Prs* prs );
virtual void wheelEvent( QWheelEvent* );
QwtPlotCurve* getPlotCurve( Plot2d_Curve* curve );
bool hasPlotCurve( Plot2d_Curve* curve );
+ void setCurveType( QwtPlotCurve* curve, int curveType );
public slots:
void onViewPan();
protected:
virtual void customEvent( QEvent* );
-
-protected slots:
void plotMousePressed( const QMouseEvent& );
- void plotMouseMoved( const QMouseEvent& );
+ bool plotMouseMoved( const QMouseEvent& );
void plotMouseReleased( const QMouseEvent& );
signals:
Plot2d_Plot2d* myPlot;
int myOperation;
QPoint myPnt;
- //CurveDict myCurves;
int myCurveType;
bool myShowLegend;
virtual QSize sizeHint() const;
virtual QSizePolicy sizePolicy() const;
virtual QSize minimumSizeHint() const;
+ void defaultPicker();
+ void setPickerMousePattern( int button, int state = Qt::NoButton );
bool polished() const { return myIsPolished; }
QwtPlotGrid* grid() { return myGrid; };
CurveDict& getCurves() { return myCurves; }
Plot2d_Curve* getClosestCurve( QPoint p, double& distance, int& index );
-signals:
- void plotMouseMoved( const QMouseEvent& );
- void plotMousePressed( const QMouseEvent& );
- void plotMouseReleased( const QMouseEvent& );
-
public slots:
virtual void polish();
protected:
bool existMarker( const QwtSymbol::Style typeMarker, const QColor& color, const Qt::PenStyle typeLine );
- virtual void mousePressEvent( QMouseEvent* event );
- virtual void mouseMoveEvent( QMouseEvent* event );
- virtual void mouseReleaseEvent( QMouseEvent* event );
protected:
CurveDict myCurves;
QwtPlotGrid* myGrid;
QList<QColor> myColors;
bool myIsPolished;
+ QwtPlotZoomer* myPlotZoomer;
};
#endif