else
QT_LIB_DIR="-L$QTDIR/lib${LIB_LOCATION_SUFFIX}"
fi
- LIBS="$LIBS $QT_LIB_DIR -lQtCore"
+ LIBS="$LIBS $QT_LIB_DIR -lQtCore -lQtGui"
if test "x$QWTHOME" = "x/usr"
then
AC_CACHE_VAL(salome_cv_lib_qwt,[
AC_TRY_LINK(
-#include <qapplication.h>
+#include <QApplication>
#include <qwt_plot.h>
, int n;
char **s;
QApplication a(n, s);
QwtPlot* p;
+ p.resize( 600, 400 );
+ p.show();
a.exec();,
eval "salome_cv_lib_qwt=yes",eval "salome_cv_lib_qwt=no")
])
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "Plot2d_Curve.h"
-#include <qcolor.h>
+#include <QColor>
/*!
Constructor
aPoint.y = theY;
aPoint.text = txt;
- QValueList<Plot2d_Point>::iterator aIt;
+ QList<Plot2d_Point>::iterator aIt;
int aCurrent = 0;
for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
if (thePos == aCurrent) {
*/
void Plot2d_Curve::deletePoint(int thePos)
{
- QValueList<Plot2d_Point>::iterator aIt;
+ if ( thePos >= 0 && thePos < myPoints.count() )
+ myPoints.removeAt( thePos );
+ /*
+ QList<Plot2d_Point>::iterator aIt;
int aCurrent = 0;
for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
if (thePos == aCurrent) {
}
aCurrent++;
}
+ */
}
/*!
*/
double Plot2d_Curve::getMinX() const
{
- QValueList<Plot2d_Point>::const_iterator aIt;
+ QList<Plot2d_Point>::const_iterator aIt;
double aMinX = 1e150;
//int aCurrent = 0;
for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
*/
double Plot2d_Curve::getMinY() const
{
- QValueList<Plot2d_Point>::const_iterator aIt;
+ QList<Plot2d_Point>::const_iterator aIt;
double aMinY = 1e150;
//int aCurrent = 0;
for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
#define PLOT2D_CURVE_H
#include "Plot2d.h"
-#include <qvaluelist.h>
-#include <qptrlist.h>
+#include <QList>
#include <qwt_plot.h>
class QColor;
QString text;
} Plot2d_Point;
-typedef QValueList<Plot2d_Point> pointList;
+typedef QList<Plot2d_Point> pointList;
class PLOT2D_EXPORT Plot2d_Curve
{
pointList myPoints;
};
-typedef QPtrList<Plot2d_Curve> curveList;
+typedef QList<Plot2d_Curve*> curveList;
#endif
// $Header$
#include "Plot2d_FitDataDlg.h"
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qvalidator.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qbuttongroup.h>
-#include <qlineedit.h>
+#include <QLabel>
+#include <QLayout>
+#include <QValidator>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QGroupBox>
+#include <QLineEdit>
#define SPACING_SIZE 6
#define MARGIN_SIZE 11
*/
Plot2d_FitDataDlg::Plot2d_FitDataDlg( QWidget* parent, bool secondAxisY )
: QDialog( parent ? parent : 0,
- "Plot2d_FitDataDlg",
- true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
- myY2MinEdit( 0 ), myY2MaxEdit( 0 ), mySecondAxisY( secondAxisY )
+ Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+ myY2MinEdit( 0 ), myY2MaxEdit( 0 ), mySecondAxisY( secondAxisY )
{
- setCaption( tr( "FIT_DATA_TLT" ) );
+ setObjectName( "Plot2d_FitDataDlg" );
+ setModal( true );
+ setWindowTitle( tr( "FIT_DATA_TLT" ) );
setSizeGripEnabled( TRUE );
QGridLayout* topLayout = new QGridLayout( this );
topLayout->setSpacing( SPACING_SIZE );
topLayout->setMargin( MARGIN_SIZE );
// 'Range' group
- myRangeGrp = new QButtonGroup( this );
- myRangeGrp->setColumnLayout( 0, Qt::Vertical );
- myRangeGrp->layout()->setSpacing( 0 );
- myRangeGrp->layout()->setMargin( 0 );
- QGridLayout* aGridLayout = new QGridLayout( myRangeGrp->layout() );
+ myRangeGrp = new QGroupBox( this );
+ QGridLayout* aGridLayout = new QGridLayout( myRangeGrp );
+ myRangeGrp->setLayout( aGridLayout );
aGridLayout->setAlignment( Qt::AlignTop );
aGridLayout->setMargin( MARGIN_SIZE );
aGridLayout->setSpacing( SPACING_SIZE );
QFont font = horLab->font(); font.setBold( true );
horLab->setFont( font ); verLab->setFont( font );
- aGridLayout->addMultiCellLayout( aModeLayout, 0, 0, 0, 4 );
- aGridLayout->addMultiCellWidget( aHLine, 1, 1, 0, 4 );
- aGridLayout->addWidget ( horLab, 2, 0 );
- aGridLayout->addWidget ( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
- 2, 1 );
- aGridLayout->addWidget ( myXMinEdit, 2, 2 );
- aGridLayout->addWidget ( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
- 2, 3 );
- aGridLayout->addWidget ( myXMaxEdit, 2, 4 );
- aGridLayout->addWidget ( verLab, 3, 0 );
- aGridLayout->addWidget ( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
- 3, 1 );
- aGridLayout->addWidget ( myYMinEdit, 3, 2 );
- aGridLayout->addWidget ( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
- 3, 3 );
- aGridLayout->addWidget ( myYMaxEdit, 3, 4 );
+ aGridLayout->addLayout( aModeLayout, 0, 0, 1, 5 );
+ aGridLayout->addWidget( aHLine, 1, 0, 1, 5 );
+ aGridLayout->addWidget( horLab, 2, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 2, 1 );
+ aGridLayout->addWidget( myXMinEdit, 2, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 2, 3 );
+ aGridLayout->addWidget( myXMaxEdit, 2, 4 );
+ aGridLayout->addWidget( verLab, 3, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 3, 1 );
+ aGridLayout->addWidget( myYMinEdit, 3, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 3, 3 );
+ aGridLayout->addWidget( myYMaxEdit, 3, 4 );
if (mySecondAxisY) {
QLabel* ver2Lab = new QLabel(tr( "VERTICAL_RIGHT_AXIS" ), myRangeGrp );
ver2Lab->setFont( font );
- aGridLayout->addWidget ( ver2Lab, 4, 0 );
- aGridLayout->addWidget ( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
- 4, 1 );
- aGridLayout->addWidget ( myY2MinEdit, 4, 2 );
- aGridLayout->addWidget ( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
- 4, 3 );
- aGridLayout->addWidget ( myY2MaxEdit, 4, 4 );
+ aGridLayout->addWidget( ver2Lab, 4, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 4, 1 );
+ aGridLayout->addWidget( myY2MinEdit, 4, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 4, 3 );
+ aGridLayout->addWidget( myY2MaxEdit, 4, 4 );
}
// OK/Cancel buttons
- myOkBtn = new QPushButton( tr( "BUT_OK" ), this, "buttonOk" );
+ myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
+ myOkBtn->setObjectName( "buttonOk" );
myOkBtn->setAutoDefault( TRUE );
myOkBtn->setDefault( TRUE );
- myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this, "buttonCancel" );
+ myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
+ myCancelBtn->setObjectName( "buttonCancel" );
myCancelBtn->setAutoDefault( TRUE );
- topLayout->addMultiCellWidget( myRangeGrp, 0, 0, 0, 2 );
+ topLayout->addWidget( myRangeGrp, 0, 0, 1, 3 );
topLayout->addWidget( myOkBtn, 1, 0 );
- topLayout->setColStretch( 1, 5 );
+ topLayout->setColumnStretch( 1, 5 );
topLayout->addWidget( myCancelBtn, 1, 2 );
// connect signals
#define PLOT2D_FITDATADLG_H
#include "Plot2d.h"
-#include <qdialog.h>
+#include <QDialog>
-class QButtonGroup;
+class QGroupBox;
class QRadioButton;
class QLineEdit;
class QPushButton;
void onModeChanged(int);
private:
- QButtonGroup* myRangeGrp;
+ QGroupBox* myRangeGrp;
QRadioButton* myModeAllRB;
QRadioButton* myModeHorRB;
QRadioButton* myModeVerRB;
*/
void Plot2d_Prs::setAutoDel(bool theDel)
{
- myCurves.setAutoDelete(theDel);
+ //myCurves.setAutoDelete(theDel);
}
Constructor
*/
Plot2d_SetupCurveDlg::Plot2d_SetupCurveDlg( QWidget* parent )
- : QDialog( parent, "Plot2d_SetupCurveDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+ : QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint )
{
- setCaption( tr("TLT_SETUP_CURVE") );
+ setObjectName( "Plot2d_SetupCurveDlg" );
+ setModal( true );
+ setWindowTitle( tr("TLT_SETUP_CURVE") );
setSizeGripEnabled( TRUE );
QGridLayout* topLayout = new QGridLayout( this );
topLayout->setSpacing( SPACING_SIZE );
topLayout->setMargin( MARGIN_SIZE );
QGroupBox* TopGroup = new QGroupBox( this );
- TopGroup->setColumnLayout( 0, Qt::Vertical );
- TopGroup->layout()->setSpacing( 0 ); TopGroup->layout()->setMargin( 0 );
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
+ QGridLayout* TopGroupLayout = new QGridLayout( TopGroup );
+ TopGroup->setLayout( TopGroupLayout );
TopGroupLayout->setAlignment( Qt::AlignTop );
TopGroupLayout->setSpacing( SPACING_SIZE ); TopGroupLayout->setMargin( MARGIN_SIZE );
QLabel* aLineTypeLab = new QLabel( tr( "CURVE_LINE_TYPE_LAB" ), TopGroup );
- myLineCombo = new QComboBox( false, TopGroup );
+ myLineCombo = new QComboBox( TopGroup );
+ myLineCombo->setEditable( false );
myLineCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myLineCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myLineCombo->insertItem( tr( "NONE_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "SOLID_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DASH_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DOT_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DASHDOT_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DAHSDOTDOT_LINE_LBL" ) );
- myLineCombo->setCurrentItem( 1 ); // SOLID by default
+ myLineCombo->addItem( tr( "NONE_LINE_LBL" ) );
+ myLineCombo->addItem( tr( "SOLID_LINE_LBL" ) );
+ myLineCombo->addItem( tr( "DASH_LINE_LBL" ) );
+ myLineCombo->addItem( tr( "DOT_LINE_LBL" ) );
+ myLineCombo->addItem( tr( "DASHDOT_LINE_LBL" ) );
+ myLineCombo->addItem( tr( "DAHSDOTDOT_LINE_LBL" ) );
+ myLineCombo->setCurrentIndex( 1 ); // SOLID by default
QLabel* aLineWidthLab = new QLabel( tr( "CURVE_LINE_WIDTH_LAB" ), TopGroup );
- myLineSpin = new QSpinBox( 0, MAX_LINE_WIDTH, 1, TopGroup );
+ myLineSpin = new QSpinBox( TopGroup );
+ myLineSpin->setMinimum( 0 );
+ myLineSpin->setMaximum( MAX_LINE_WIDTH );
+ myLineSpin->setSingleStep( 1 );
myLineSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myLineSpin->setMinimumWidth( MIN_SPIN_WIDTH );
myLineSpin->setValue( 0 ); // default width is 0
QLabel* aMarkerLab = new QLabel( tr( "CURVE_MARKER_TYPE_LAB" ), TopGroup );
- myMarkerCombo = new QComboBox( false, TopGroup );
+ myMarkerCombo = new QComboBox( TopGroup );
+ myMarkerCombo->setEditable( false );
myMarkerCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myMarkerCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myMarkerCombo->insertItem( tr( "NONE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "CIRCLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "RECTANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "DIAMOND_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "DTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "UTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "LTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "RTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "CROSS_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "XCROSS_MARKER_LBL" ) );
- myMarkerCombo->setCurrentItem( 1 ); // CIRCLE by default
+ myMarkerCombo->addItem( tr( "NONE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( tr( "CIRCLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( tr( "RECTANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( tr( "DIAMOND_MARKER_LBL" ) );
+ myMarkerCombo->addItem( tr( "DTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( tr( "UTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( tr( "LTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( tr( "RTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( tr( "CROSS_MARKER_LBL" ) );
+ myMarkerCombo->addItem( tr( "XCROSS_MARKER_LBL" ) );
+ myMarkerCombo->setCurrentIndex( 1 ); // CIRCLE by default
QLabel* aColorLab = new QLabel( tr( "CURVE_COLOR_LAB" ), TopGroup );
myColorBtn = new QToolButton( TopGroup );
myColorBtn->setMinimumSize(25, 25);
TopGroupLayout->addWidget( aLineTypeLab, 0, 0 );
- TopGroupLayout->addMultiCellWidget( myLineCombo, 0, 0, 1, 2 );
+ TopGroupLayout->addWidget( myLineCombo, 0, 1, 1, 2 );
TopGroupLayout->addWidget( aLineWidthLab, 1, 0 );
- TopGroupLayout->addMultiCellWidget( myLineSpin, 1, 1, 1, 2 );
+ TopGroupLayout->addWidget( myLineSpin, 1, 1, 1, 2 );
TopGroupLayout->addWidget( aMarkerLab, 2, 0 );
- TopGroupLayout->addMultiCellWidget( myMarkerCombo, 2, 2, 1, 2 );
+ TopGroupLayout->addWidget( myMarkerCombo, 2, 1, 1, 2 );
TopGroupLayout->addWidget( aColorLab, 3, 0 );
TopGroupLayout->addWidget( myColorBtn, 3, 1 );
- TopGroupLayout->setColStretch( 2, 5 );
+ TopGroupLayout->setColumnStretch( 2, 5 );
QGroupBox* GroupButtons = new QGroupBox( this );
- GroupButtons->setColumnLayout( 0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 ); GroupButtons->layout()->setMargin( 0 );
- QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
+ QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
+ GroupButtons->setLayout( GroupButtonsLayout );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( SPACING_SIZE ); GroupButtonsLayout->setMargin( MARGIN_SIZE );
*/
void Plot2d_SetupCurveDlg::setLine( const int line, const int width )
{
- myLineCombo->setCurrentItem( line );
+ myLineCombo->setCurrentIndex( line );
myLineSpin->setValue( width );
}
/*!
*/
int Plot2d_SetupCurveDlg::getLine() const
{
- return myLineCombo->currentItem();
+ return myLineCombo->currentIndex();
}
/*!
Gets line width
*/
void Plot2d_SetupCurveDlg::setMarker( const int marker )
{
- myMarkerCombo->setCurrentItem( marker );
+ myMarkerCombo->setCurrentIndex( marker );
}
/*!
Gets marker style
*/
int Plot2d_SetupCurveDlg::getMarker() const
{
- return myMarkerCombo->currentItem();
+ return myMarkerCombo->currentIndex();
}
/*!
Sets color
void Plot2d_SetupCurveDlg::setColor( const QColor& color )
{
QPalette pal = myColorBtn->palette();
- QColorGroup ca = pal.active();
- ca.setColor( QColorGroup::Button, color );
- QColorGroup ci = pal.inactive();
- ci.setColor( QColorGroup::Button, color );
- pal.setActive( ca );
- pal.setInactive( ci );
+ pal.setColor( QPalette::Active, QPalette::Button, color );
+ pal.setColor( QPalette::Inactive, QPalette::Button, color );
+
myColorBtn->setPalette( pal );
}
/*!
*/
QColor Plot2d_SetupCurveDlg::getColor() const
{
- return myColorBtn->palette().active().button();
+ return myColorBtn->palette().color( QPalette::Active, QPalette::Button );
}
/*!
<Color> button slot, invokes color selection dialog box
#include "Plot2d_SetupViewDlg.h"
-#include <qcheckbox.h>
-#include <qlineedit.h>
-#include <qcombobox.h>
-#include <qspinbox.h>
-#include <qtoolbutton.h>
-#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qcolordialog.h>
-#include <qtabwidget.h>
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QComboBox>
+#include <QSpinBox>
+#include <QToolButton>
+#include <QLayout>
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QColorDialog>
+#include <QTabWidget>
#define MARGIN_SIZE 11
#define SPACING_SIZE 6
Constructor
*/
Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent, bool showDefCheck, bool secondAxisY )
- : QDialog( parent, "Plot2d_SetupViewDlg", true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+ : QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint )
{
+ setObjectName( "Plot2d_SetupViewDlg" );
+ setModal( true );
mySecondAxisY = secondAxisY;
- setCaption( tr("TLT_SETUP_PLOT2D_VIEW") );
+ setWindowTitle( tr("TLT_SETUP_PLOT2D_VIEW") );
setSizeGripEnabled( TRUE );
QGridLayout* topLayout = new QGridLayout( this );
topLayout->setSpacing( SPACING_SIZE );
myTitleEdit->setMinimumWidth( MIN_EDIT_WIDTH );
// curve type : points, lines, spline
QLabel* aCurveLab = new QLabel( tr( "PLOT2D_CURVE_TYPE_LBL" ), this );
- myCurveCombo = new QComboBox( false, this );
+ myCurveCombo = new QComboBox( this );
+ myCurveCombo->setEditable( false );
myCurveCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myCurveCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_POINTS" ) );
- myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_LINES" ) );
- myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_SPLINE" ) );
+ myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_POINTS" ) );
+ myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_LINES" ) );
+ myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_SPLINE" ) );
// legend
myLegendCheck = new QCheckBox( tr( "PLOT2D_ENABLE_LEGEND" ), this );
- myLegendCombo = new QComboBox( false, this );
+ myLegendCombo = new QComboBox( this );
+ myCurveCombo->setEditable( false );
myLegendCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myLegendCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_LEFT" ) );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_RIGHT" ) );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_TOP" ) );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOM" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_LEFT" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_RIGHT" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_TOP" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOM" ) );
// marker size
QLabel* aMarkerLab = new QLabel( tr( "PLOT2D_MARKER_SIZE_LBL" ), this );
- myMarkerSpin = new QSpinBox( 0, 100, 1, this );
+ myMarkerSpin = new QSpinBox( this );
+ myMarkerSpin->setMinimum( 0 );
+ myMarkerSpin->setMaximum( 100 );
+ myMarkerSpin->setSingleStep( 1 );
myMarkerSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myMarkerSpin->setMinimumWidth( MIN_SPIN_WIDTH );
// scale mode
QGroupBox* aScaleGrp = new QGroupBox( tr( "PLOT2D_SCALE_TLT" ), this );
- aScaleGrp->setColumnLayout(0, Qt::Vertical );
- aScaleGrp->layout()->setSpacing( 0 ); aScaleGrp->layout()->setMargin( 0 );
- QGridLayout* aScaleLayout = new QGridLayout( aScaleGrp->layout() );
+ QGridLayout* aScaleLayout = new QGridLayout( aScaleGrp );
aScaleLayout->setMargin( MARGIN_SIZE ); aScaleLayout->setSpacing( SPACING_SIZE );
+ aScaleGrp->setLayout( aScaleLayout );
QLabel* xScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_HOR" ), aScaleGrp );
- myXModeCombo = new QComboBox( false, aScaleGrp );
+ myXModeCombo = new QComboBox( aScaleGrp );
+ myCurveCombo->setEditable( false );
myXModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myXModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myXModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
- myXModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
+ myXModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
+ myXModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
QLabel* yScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_VER" ), aScaleGrp );
- myYModeCombo = new QComboBox( false, aScaleGrp );
+ myYModeCombo = new QComboBox( aScaleGrp );
+ myCurveCombo->setEditable( false );
myYModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myYModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myYModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
- myYModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
+ myYModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
+ myYModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
aScaleLayout->addWidget( xScaleLab, 0, 0 );
aScaleLayout->addWidget( myXModeCombo, 0, 1 );
aScaleLayout->addWidget( myYModeCombo, 0, 3 );
// tab widget for choose properties of axis
- QTabWidget* aTabWidget = new QTabWidget( this, "tabWidget" );
+ QTabWidget* aTabWidget = new QTabWidget( this );
+ aTabWidget->setObjectName( "tabWidget" );
// widget for parameters on Ox
QWidget* aXWidget = new QWidget(aTabWidget);
myTitleXEdit = new QLineEdit( aXWidget );
myTitleXEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myTitleXEdit->setMinimumWidth( MIN_EDIT_WIDTH );
- aXLayout->addWidget( myTitleXCheck, 1, 0 );
- aXLayout->addMultiCellWidget( myTitleXEdit, 1, 1, 1, 3 );
+ aXLayout->addWidget( myTitleXCheck,1, 0 );
+ aXLayout->addWidget( myTitleXEdit, 1, 1, 1, 3 );
// grid
QGroupBox* aGridGrpX = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aXWidget );
- aGridGrpX->setColumnLayout(0, Qt::Vertical );
- aGridGrpX->layout()->setSpacing( 0 ); aGridGrpX->layout()->setMargin( 0 );
- QGridLayout* aGridLayoutX = new QGridLayout( aGridGrpX->layout() );
+ QGridLayout* aGridLayoutX = new QGridLayout( aGridGrpX );
+ aGridGrpX->setLayout( aGridLayoutX );
aGridLayoutX->setMargin( MARGIN_SIZE ); aGridLayoutX->setSpacing( SPACING_SIZE );
myXGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MAJOR" ), aGridGrpX );
QLabel* aXMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
- myXGridSpin = new QSpinBox( 1, 100, 1, aGridGrpX );
+ myXGridSpin = new QSpinBox( aGridGrpX );
+ myXGridSpin->setMinimum( 1 );
+ myXGridSpin->setMaximum( 100 );
+ myXGridSpin->setSingleStep( 1 );
myXGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myXGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
myXMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MINOR" ), aGridGrpX );
QLabel* aXMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
- myXMinGridSpin = new QSpinBox( 1, 100, 1, aGridGrpX );
+ myXMinGridSpin = new QSpinBox( aGridGrpX );
+ myXMinGridSpin->setMinimum( 1 );
+ myXMinGridSpin->setMaximum( 100 );
+ myXMinGridSpin->setSingleStep( 1 );
myXMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myXMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
aGridLayoutX->addWidget( myXMinGridCheck, 1, 0 );
aGridLayoutX->addWidget( aXMinLbl, 1, 1 );
aGridLayoutX->addWidget( myXMinGridSpin, 1, 2 );
- aXLayout->addMultiCellWidget( aGridGrpX, 3, 3, 0, 3 );
+ aXLayout->addWidget( aGridGrpX, 3, 0, 1, 4 );
aTabWidget->addTab( aXWidget, tr( "INF_AXES_X" ) );
myTitleYEdit = new QLineEdit( aYWidget );
myTitleYEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myTitleYEdit->setMinimumWidth( MIN_EDIT_WIDTH );
- aYLayout->addWidget( myTitleYCheck, 1, 0 );
- aYLayout->addMultiCellWidget( myTitleYEdit, 1, 1, 1, 3 );
+ aYLayout->addWidget( myTitleYCheck,1, 0 );
+ aYLayout->addWidget( myTitleYEdit, 1, 1, 1, 3 );
// grid
QGroupBox* aGridGrpY = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget );
- aGridGrpY->setColumnLayout(0, Qt::Vertical );
- aGridGrpY->layout()->setSpacing( 0 ); aGridGrpY->layout()->setMargin( 0 );
- QGridLayout* aGridLayoutY = new QGridLayout( aGridGrpY->layout() );
+ QGridLayout* aGridLayoutY = new QGridLayout( aGridGrpY );
+ aGridGrpY->setLayout( aGridLayoutY );
aGridLayoutY->setMargin( MARGIN_SIZE ); aGridLayoutY->setSpacing( SPACING_SIZE );
myYGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY );
QLabel* aYMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
- myYGridSpin = new QSpinBox( 1, 100, 1, aGridGrpY );
+ myYGridSpin = new QSpinBox( aGridGrpY );
+ myYGridSpin->setMinimum( 1 );
+ myYGridSpin->setMaximum( 100 );
+ myYGridSpin->setSingleStep( 1 );
myYGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myYGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
myYMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY );
QLabel* aYMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
- myYMinGridSpin = new QSpinBox( 1, 100, 1, aGridGrpY );
+ myYMinGridSpin = new QSpinBox( aGridGrpY );
+ myYMinGridSpin->setMinimum( 1 );
+ myYMinGridSpin->setMaximum( 100 );
+ myYMinGridSpin->setSingleStep( 1 );
myYMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myYMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
aGridLayoutY->addWidget( myYMinGridCheck, 1, 0 );
aGridLayoutY->addWidget( aYMinLbl, 1, 1 );
aGridLayoutY->addWidget( myYMinGridSpin, 1, 2 );
- aYLayout->addMultiCellWidget( aGridGrpY, 3, 3, 0, 3 );
+ aYLayout->addWidget( aGridGrpY, 3, 0, 1, 4 );
aTabWidget->addTab( aYWidget, tr( "INF_AXES_Y_LEFT" ) );
myTitleY2Edit = new QLineEdit( aYWidget2 );
myTitleY2Edit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myTitleY2Edit->setMinimumWidth( MIN_EDIT_WIDTH );
- aYLayout2->addWidget( myTitleY2Check, 1, 0 );
- aYLayout2->addMultiCellWidget( myTitleY2Edit, 1, 1, 1, 3 );
+ aYLayout2->addWidget( myTitleY2Check,1, 0 );
+ aYLayout2->addWidget( myTitleY2Edit, 1, 1, 1, 3 );
// grid
QGroupBox* aGridGrpY2 = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget2 );
- aGridGrpY2->setColumnLayout(0, Qt::Vertical );
- aGridGrpY2->layout()->setSpacing( 0 ); aGridGrpY2->layout()->setMargin( 0 );
- QGridLayout* aGridLayoutY2 = new QGridLayout( aGridGrpY2->layout() );
+ QGridLayout* aGridLayoutY2 = new QGridLayout( aGridGrpY2 );
+ aGridGrpY2->setLayout( aGridLayoutY2 );
aGridLayoutY2->setMargin( MARGIN_SIZE ); aGridLayoutY2->setSpacing( SPACING_SIZE );
myY2GridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY2 );
QLabel* aY2MajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
- myY2GridSpin = new QSpinBox( 1, 100, 1, aGridGrpY2 );
+ myY2GridSpin = new QSpinBox( aGridGrpY2 );
+ myY2GridSpin->setMinimum( 1 );
+ myY2GridSpin->setMaximum( 100 );
+ myY2GridSpin->setSingleStep( 1 );
myY2GridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myY2GridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
myY2MinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY2 );
QLabel* aY2MinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
- myY2MinGridSpin = new QSpinBox( 1, 100, 1, aGridGrpY2 );
+ myY2MinGridSpin = new QSpinBox( aGridGrpY2 );
+ myY2MinGridSpin->setMinimum( 1 );
+ myY2MinGridSpin->setMaximum( 100 );
+ myY2MinGridSpin->setSingleStep( 1 );
myY2MinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myY2MinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
aGridLayoutY2->addWidget( myY2MinGridCheck, 1, 0 );
aGridLayoutY2->addWidget( aY2MinLbl, 1, 1 );
aGridLayoutY2->addWidget( myY2MinGridSpin, 1, 2 );
- aYLayout2->addMultiCellWidget( aGridGrpY2, 3, 3, 0, 3 );
+ aYLayout2->addWidget( aGridGrpY2, 3, 0, 1, 4 );
aTabWidget->addTab( aYWidget2, tr( "INF_AXES_Y_RIGHT" ) );
}
myY2MinGridSpin = 0;
myY2ModeCombo = 0;
}
- aTabWidget->setCurrentPage( 0 );
+ aTabWidget->setCurrentIndex( 0 );
/* "Set as default" check box */
myDefCheck = new QCheckBox( tr( "PLOT2D_SET_AS_DEFAULT_CHECK" ), this );
/* OK/Cancel buttons */
btnLayout->addWidget( myCancelBtn );
// layout widgets
- topLayout->addWidget( myTitleCheck, 0, 0 );
- topLayout->addMultiCellWidget( myTitleEdit, 0, 0, 1, 3 );
- topLayout->addWidget( aCurveLab, 1, 0 );
- topLayout->addWidget( myCurveCombo, 1, 1 );
- topLayout->addWidget( myLegendCheck, 1, 2 );
- topLayout->addWidget( myLegendCombo, 1, 3 );
- topLayout->addWidget( aMarkerLab, 2, 0 );
- topLayout->addWidget( myMarkerSpin, 2, 1 );
+ topLayout->addWidget( myTitleCheck, 0, 0 );
+ topLayout->addWidget( myTitleEdit, 0, 1, 1, 3 );
+ topLayout->addWidget( aCurveLab, 1, 0 );
+ topLayout->addWidget( myCurveCombo, 1, 1 );
+ topLayout->addWidget( myLegendCheck, 1, 2 );
+ topLayout->addWidget( myLegendCombo, 1, 3 );
+ topLayout->addWidget( aMarkerLab, 2, 0 );
+ topLayout->addWidget( myMarkerSpin, 2, 1 );
QHBoxLayout* bgLayout = new QHBoxLayout;
bgLayout->addWidget( myBackgroundBtn ); bgLayout->addStretch();
- topLayout->addWidget( aBGLab, 2, 2 );
- topLayout->addLayout( bgLayout, 2, 3 );
- topLayout->addMultiCellWidget( aScaleGrp, 3, 3, 0, 3 );
- topLayout->addMultiCellWidget( aTabWidget, 4, 4, 0, 3 );
- topLayout->addMultiCellWidget( myDefCheck, 5, 5, 0, 3 );
+ topLayout->addWidget( aBGLab, 2, 2 );
+ topLayout->addLayout( bgLayout, 2, 3 );
+ topLayout->addWidget( aScaleGrp, 3, 0, 1, 4 );
+ topLayout->addWidget( aTabWidget, 4, 0, 1, 4 );
+ topLayout->addWidget( myDefCheck, 5, 0, 1, 4 );
topLayout->setRowStretch( 5, 5 );
- topLayout->addMultiCellLayout( btnLayout, 6, 6, 0, 3 );
+ topLayout->addLayout( btnLayout, 6, 0, 1, 4 );
if ( !showDefCheck )
myDefCheck->hide();
*/
void Plot2d_SetupViewDlg::setCurveType( const int type )
{
- myCurveCombo->setCurrentItem( type );
+ myCurveCombo->setCurrentIndex( type );
}
/*!
Gets curve type : 0 - points, 1 - lines, 2 - splines
*/
int Plot2d_SetupViewDlg::getCurveType()
{
- return myCurveCombo->currentItem();
+ return myCurveCombo->currentIndex();
}
/*!
Sets legend attributes : pos = 0 - left, 1 - right, 2 - top, 3 - bottom
void Plot2d_SetupViewDlg::setLegend( bool enable, int pos )
{
myLegendCheck->setChecked( enable );
- myLegendCombo->setCurrentItem( pos );
+ myLegendCombo->setCurrentIndex( pos );
onLegendChecked();
}
/*!
*/
int Plot2d_SetupViewDlg::getLegendPos()
{
- return myLegendCombo->currentItem();
+ return myLegendCombo->currentIndex();
}
/*!
Sets marker size
void Plot2d_SetupViewDlg::setBackgroundColor( const QColor& color )
{
QPalette pal = myBackgroundBtn->palette();
- QColorGroup ca = pal.active();
- ca.setColor( QColorGroup::Button, color );
- QColorGroup ci = pal.inactive();
- ci.setColor( QColorGroup::Button, color );
- pal.setActive( ca );
- pal.setInactive( ci );
+ pal.setColor( QPalette::Active, QPalette::Button, color );
+ pal.setColor( QPalette::Inactive, QPalette::Button, color );
+
myBackgroundBtn->setPalette( pal );
}
/*!
*/
QColor Plot2d_SetupViewDlg::getBackgroundColor()
{
- return myBackgroundBtn->palette().active().button();
+ return myBackgroundBtn->palette().color( QPalette::Active, QPalette::Button );
}
/*!
Sets major grid parameters
*/
void Plot2d_SetupViewDlg::setScaleMode( const int xMode, const int yMode )
{
- myXModeCombo->setCurrentItem( xMode );
- myYModeCombo->setCurrentItem( yMode );
+ myXModeCombo->setCurrentIndex( xMode );
+ myYModeCombo->setCurrentIndex( yMode );
}
/*!
Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
*/
int Plot2d_SetupViewDlg::getXScaleMode()
{
- return myXModeCombo->currentItem();
+ return myXModeCombo->currentIndex();
}
/*!
Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
*/
int Plot2d_SetupViewDlg::getYScaleMode()
{
- return myYModeCombo->currentItem();
+ return myYModeCombo->currentIndex();
}
/*!
Slot, called when user clicks "Show main title" check box
#define PLOT2D_SETUPVIEWDLG_H
#include "Plot2d.h"
-#include <qdialog.h>
+#include <QDialog>
class QSpinBox;
class QCheckBox;
#include <Plot2d_ViewFrame.h>
#include <Plot2d_Curve.h>
-#include <qfontmetrics.h>
+#include <QFontMetrics>
+#include <QEvent>
#include <qwt_plot.h>
#include <qwt_plot_canvas.h>
void Plot2d_ToolTip::onToolTip( QPoint p, QString& str, QFont& f, QRect& txtRect, QRect& rect )
{
- int curInd, pInd, dist;
- double x, y;
- curInd = myPlot->closestCurve( p.x(), p.y(), dist, x, y, pInd );
+ int pInd;//, dist;
+ double dist;
+ //double x, y;
+ //curInd = myPlot->closestCurve( p.x(), p.y(), dist, x, y, pInd );
- if( dist>maxDist )
- return;
+ //if( dist>maxDist )
+ // return;
- Plot2d_Curve* c = myFrame->getCurves().find( curInd );
- if( !c )
+ //Plot2d_Curve* c = myFrame->getCurves().find( curInd );
+
+ Plot2d_Curve* c = myPlot->getClosestCurve( p, dist, pInd );
+ if( dist>maxDist || !c )
return;
str = c->text( pInd );
- if( !str )
+ if( str.isEmpty() )
return;
QFontMetrics m( f );
- QStringList lst = QStringList::split( "\n", str );
+ QStringList lst = str.split( "\n", QString::SkipEmptyParts );
QStringList::const_iterator anIt = lst.begin(), aLast = lst.end();
int w = 0, h = 0;
for( ; anIt!=aLast; anIt++ )
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->state()==0 )
return true;
}
return res;
Plot2d_ToolTip( Plot2d_ViewFrame*, Plot2d_Plot2d* );
virtual ~Plot2d_ToolTip();
+ virtual bool eventFilter( QObject*, QEvent* );
+
public slots:
void onToolTip( QPoint, QString&, QFont&, QRect&, QRect& );
-protected:
- virtual bool eventFilter( QObject*, QEvent* );
-
private:
Plot2d_ViewFrame* myFrame;
Plot2d_Plot2d* myPlot;
#include "SUIT_ResourceMgr.h"
#include "SUIT_Application.h"
-#include "qapplication.h"
-#include <qtoolbar.h>
-#include <qtoolbutton.h>
-#include <qcursor.h>
-#include <qcolordialog.h>
-#include <qptrlist.h>
-#include <qlayout.h>
-#include <qmap.h>
-#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
-#include <qevent.h>
+#include <QApplication>
+#include <QToolBar>
+#include <QToolButton>
+#include <QCursor>
+#include <QColorDialog>
+#include <QLayout>
+#include <QMap>
+#include <QPainter>
+#include <QPaintDevice>
+#include <QEvent>
+#include <QMouseEvent>
+#include <QContextMenuEvent>
+#include <QPrinter>
+#include <QPalette>
#include <qwt_math.h>
#include <qwt_plot_canvas.h>
+#include <qwt_scale_div.h>
+#include <qwt_plot_curve.h>
+#include <qwt_plot_grid.h>
+#include <qwt_scale_engine.h>
+
#include <iostream>
#include <stdlib.h>
#include <qprinter.h>
Constructor
*/
Plot2d_ViewFrame::Plot2d_ViewFrame( QWidget* parent, const QString& title )
- : QWidget (parent, title, 0),
+ : QWidget (parent, 0),
myOperation( NoOpId ),
myCurveType( 1 ),
myShowLegend( true ), myLegendPos( 1 ),
myMarkerSize( DEFAULT_MARKER_SIZE ),
myTitle( "" ), myXTitle( "" ), myYTitle( "" ), myY2Title( "" ),
- myBackground( white ),
+ myBackground( Qt::white ),
myTitleEnabled( true ), myXTitleEnabled( true ),
myYTitleEnabled( true ), myY2TitleEnabled (true),
myXGridMajorEnabled( true ), myYGridMajorEnabled( true ), myY2GridMajorEnabled( true ),
myXGridMaxMinor( 5 ), myYGridMaxMinor( 5 ), myY2GridMaxMinor( 5 ),
myXMode( 0 ), myYMode( 0 ), mySecondY( false )
{
+ setObjectName( title );
/* Plot 2d View */
QVBoxLayout* aLayout = new QVBoxLayout( this );
myPlot = new Plot2d_Plot2d( this );
this, SLOT( plotMousePressed( const QMouseEvent& ) ) );
connect( myPlot, SIGNAL( plotMouseReleased( const QMouseEvent& ) ),
this, SLOT( plotMouseReleased( const QMouseEvent& ) ) );
+
//connect( myPlot, SIGNAL( legendClicked( long ) ),
// this, SLOT( onLegendClicked( long ) ) );
if ( parent ) {
resize( (int)(0.8 * parent->width()), (int)(0.8 * parent->height()) );
}
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
- myXDistance = xMap.d2() - xMap.d1();
- myYDistance = yMap.d2() - yMap.d1();
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ myXDistance = xMap.p2() - xMap.p1();
+ myYDistance = yMap.p2() - yMap.p1();
myYDistance2 = 0;
if (mySecondY) {
- QwtDiMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
- myYDistance2 = yMap2.d2() - yMap2.d1();
+ QwtScaleMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
+ myYDistance2 = yMap2.p2() - yMap2.p1();
}
}
/*!
*/
void Plot2d_ViewFrame::DisplayAll()
{
- QList<Plot2d_Curve> clist;
+ QList<Plot2d_Curve*> clist;
getCurves( clist );
for ( int i = 0; i < (int)clist.count(); i++ ) {
updateCurve( clist.at( i ), false );
void Plot2d_ViewFrame::EraseAll()
{
myPlot->clear();
- myCurves.clear();
+ myPlot->getCurves().clear();
myPlot->replot();
}
/*!
myY2GridMaxMinor = resMgr->integerValue( "Plot2d", "VerMinorGridMax", myY2GridMaxMinor );
myXMode = resMgr->integerValue( "Plot2d", "HorScaleMode", myXMode );
- myXMode = QMAX( 0, QMIN( 1, myXMode ) );
+ myXMode = qMax( 0, qMin( 1, myXMode ) );
myYMode = resMgr->integerValue( "Plot2d", "VerScaleMode", myYMode );
- myYMode = QMAX( 0, QMIN( 1, myYMode ) );
+ myYMode = qMax( 0, qMin( 1, myYMode ) );
}
/*!
QString Plot2d_ViewFrame::getInfo( const QPoint& pnt )
{
int i;
+ QwtValueList aTicks;
bool xFound = false, yFound = false;
double xCoord, yCoord;
- const QwtScaleDiv* aXscale = myPlot->axisScale( QwtPlot::xBottom );
- for ( i = 0; i < aXscale->majCnt(); i++ ) {
- double majXmark = aXscale->majMark( i );
+ const QwtScaleDiv* aXscale = myPlot->axisScaleDiv( QwtPlot::xBottom );
+ aTicks = aXscale->ticks( QwtScaleDiv::MajorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double majXmark = aTicks[i];
int xmark = myPlot->transform( QwtPlot::xBottom, majXmark );
if ( xmark-2 == pnt.x() ) {
xCoord = majXmark;
}
}
if ( !xFound ) {
- for ( i = 0; i < aXscale->minCnt(); i++ ) {
- double minXmark = aXscale->minMark( i );
+ aTicks = aXscale->ticks( QwtScaleDiv::MinorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double minXmark = aTicks[i];
int xmark = myPlot->transform( QwtPlot::xBottom, minXmark );
if ( xmark-2 == pnt.x() ) {
xCoord = minXmark;
}
}
}
- const QwtScaleDiv* aYscale = myPlot->axisScale( QwtPlot::yLeft );
- for ( i = 0; i < aYscale->majCnt(); i++ ) {
- double majYmark = aYscale->majMark( i );
+ const QwtScaleDiv* aYscale = myPlot->axisScaleDiv( QwtPlot::yLeft );
+ aTicks = aYscale->ticks( QwtScaleDiv::MajorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double majYmark = aTicks[i];
int ymark = myPlot->transform( QwtPlot::yLeft, majYmark );
if ( ymark-2 == pnt.y() ) {
yCoord = majYmark;
}
}
if ( !yFound ) {
- for ( i = 0; i < aYscale->minCnt(); i++ ) {
- double minYmark = aYscale->minMark( i );
+ aTicks = aYscale->ticks( QwtScaleDiv::MinorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double minYmark = aTicks[i];
int ymark = myPlot->transform( QwtPlot::yLeft, minYmark );
if ( ymark-2 == pnt.y() ) {
yCoord = minYmark;
}
}
- QString strX = QString::number( xFound ? xCoord : myPlot->invTransform( QwtPlot::xBottom, pnt.x() ) ).stripWhiteSpace();
+ QString strX = QString::number( xFound ? xCoord : myPlot->invTransform( QwtPlot::xBottom, pnt.x() ) ).trimmed();
if ( strX == "-0" )
strX = "0";
- QString strY = QString::number( yFound ? yCoord : myPlot->invTransform( QwtPlot::yLeft, pnt.y() ) ).stripWhiteSpace();
+ QString strY = QString::number( yFound ? yCoord : myPlot->invTransform( QwtPlot::yLeft, pnt.y() ) ).trimmed();
if ( strY == "-0" )
strY = "0";
QString info = "";
bool yFound2 = false;
double yCoord2;
- const QwtScaleDiv* aYscale2 = myPlot->axisScale( QwtPlot::yRight );
- for ( i = 0; i < aYscale2->majCnt(); i++ ) {
- double majYmark = aYscale2->majMark( i );
+ const QwtScaleDiv* aYscale2 = myPlot->axisScaleDiv( QwtPlot::yRight );
+ aTicks = aYscale2->ticks( QwtScaleDiv::MajorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double majYmark = aTicks[i];
int ymark = myPlot->transform( QwtPlot::yRight, majYmark );
if ( ymark-2 == pnt.y() ) {
yCoord2 = majYmark;
}
}
if ( !yFound2 ) {
- for ( i = 0; i < aYscale2->minCnt(); i++ ) {
- double minYmark = aYscale2->minMark( i );
+ aTicks = aYscale2->ticks( QwtScaleDiv::MinorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double minYmark = aTicks[i];
int ymark = myPlot->transform( QwtPlot::yRight, minYmark );
if ( ymark-2 == pnt.y() ) {
yCoord2 = minYmark;
}
}
QString strY2 = QString::number( yFound2 ? yCoord2 :
- myPlot->invTransform( QwtPlot::yRight, pnt.y() ) ).stripWhiteSpace();
+ myPlot->invTransform( QwtPlot::yRight, pnt.y() ) ).trimmed();
if ( strY2 == "-0" )
strY2 = "0";
info = tr("INF_COORDINATES_SOME_Y").arg( strX ).arg( strY ).arg( strY2 );
*/
static QwtSymbol::Style plot2qwtMarker( Plot2d_Curve::MarkerType m )
{
- QwtSymbol::Style ms = QwtSymbol::None;
+ QwtSymbol::Style ms = QwtSymbol::NoSymbol;
switch ( m ) {
case Plot2d_Curve::Circle:
ms = QwtSymbol::Ellipse; break;
ms = QwtSymbol::XCross; break;
case Plot2d_Curve::None:
default:
- ms = QwtSymbol::None; break;
+ ms = QwtSymbol::NoSymbol; break;
}
return ms;
}
*/
static Plot2d_Curve::MarkerType qwt2plotMarker( QwtSymbol::Style m )
{
- Plot2d_Curve::MarkerType ms = Plot2d_Curve::None;
+ Plot2d_Curve::MarkerType ms = Plot2d_Curve::None;
switch ( m ) {
case QwtSymbol::Ellipse:
ms = Plot2d_Curve::Circle; break;
ms = Plot2d_Curve::Cross; break;
case QwtSymbol::XCross:
ms = Plot2d_Curve::XCross; break;
- case QwtSymbol::None:
+ case QwtSymbol::NoSymbol:
default:
- ms = Plot2d_Curve::None; break;
+ ms = Plot2d_Curve::None; break;
}
return ms;
}
if ( myYMode && curve->getMinY() <= 0. )
setVerScaleMode( 0, false );
- if ( hasCurve( curve ) ) {
+ if ( hasPlotCurve( curve ) ) {
updateCurve( curve, update );
}
else {
- long curveKey = myPlot->insertCurve( curve->getVerTitle() );
- myPlot->setCurveYAxis(curveKey, curve->getYAxis());
+ QwtPlotCurve* aPCurve = new QwtPlotCurve( curve->getVerTitle() );
+ aPCurve->attach( myPlot );
+ //long curveKey = myPlot->insertCurve( curve->getVerTitle() );
+ //myPlot->setCurveYAxis(curveKey, curve->getYAxis());
- myCurves.insert( curveKey, curve );
+ //myCurves.insert( curveKey, curve );
+ myPlot->getCurves().insert( aPCurve, curve );
if ( curve->isAutoAssign() ) {
QwtSymbol::Style typeMarker;
QColor color;
Qt::PenStyle typeLine;
+
myPlot->getNextMarker( typeMarker, color, typeLine );
- myPlot->setCurvePen( curveKey, QPen( color, DEFAULT_LINE_WIDTH, typeLine ) );
- myPlot->setCurveSymbol( curveKey, QwtSymbol( typeMarker,
+ aPCurve->setPen( QPen( color, DEFAULT_LINE_WIDTH, typeLine ) );
+ //myPlot->setCurvePen( curveKey, QPen( color, DEFAULT_LINE_WIDTH, typeLine ) );
+ aPCurve->setSymbol( QwtSymbol( typeMarker,
QBrush( color ),
QPen( color ),
QSize( myMarkerSize, myMarkerSize ) ) );
+ //myPlot->setCurveSymbol( curveKey, QwtSymbol( typeMarker,
+ // QBrush( color ),
+ // QPen( color ),
+ // QSize( myMarkerSize, myMarkerSize ) ) );
curve->setColor( color );
curve->setLine( qwt2plotLine( typeLine ) );
curve->setMarker( qwt2plotMarker( typeMarker ) );
else {
Qt::PenStyle ps = plot2qwtLine( curve->getLine() );
QwtSymbol::Style ms = plot2qwtMarker( curve->getMarker() );
- myPlot->setCurvePen( curveKey, QPen( curve->getColor(), curve->getLineWidth(), ps ) );
- myPlot->setCurveSymbol( curveKey, QwtSymbol( ms,
+ aPCurve->setPen( QPen( curve->getColor(), curve->getLineWidth(), ps ) );
+ //myPlot->setCurvePen( curveKey, QPen( curve->getColor(), curve->getLineWidth(), ps ) );
+ aPCurve->setSymbol( QwtSymbol( ms,
QBrush( curve->getColor() ),
QPen( curve->getColor() ),
QSize( myMarkerSize, myMarkerSize ) ) );
+ //myPlot->setCurveSymbol( curveKey, QwtSymbol( ms,
+ // QBrush( curve->getColor() ),
+ // QPen( curve->getColor() ),
+ // QSize( myMarkerSize, myMarkerSize ) ) );
}
if ( myCurveType == 0 )
- myPlot->setCurveStyle( curveKey, QwtCurve::NoCurve );
+ aPCurve->setStyle( QwtPlotCurve::NoCurve );
+ //myPlot->setCurveStyle( curveKey, QwtCurve::NoCurve );
else if ( myCurveType == 1 )
- myPlot->setCurveStyle( curveKey, QwtCurve::Lines );
+ aPCurve->setStyle( QwtPlotCurve::Lines );
+ //myPlot->setCurveStyle( curveKey, QwtCurve::Lines );
else if ( myCurveType == 2 )
- myPlot->setCurveStyle( curveKey, QwtCurve::Spline );
- myPlot->setCurveData( curveKey, curve->horData(), curve->verData(), curve->nbPoints() );
+ aPCurve->setStyle( QwtPlotCurve::Dots );
+ //myPlot->setCurveStyle( curveKey, QwtCurve::Spline );
+ aPCurve->setData( curve->horData(), curve->verData(), curve->nbPoints() );
+ //myPlot->setCurveData( curveKey, curve->horData(), curve->verData(), curve->nbPoints() );
}
updateTitles();
if ( update )
void Plot2d_ViewFrame::displayCurves( const curveList& curves, bool update )
{
myPlot->setUpdatesEnabled( false );
- QPtrListIterator<Plot2d_Curve> it(curves);
+ QList<Plot2d_Curve*>::const_iterator it = curves.begin();
Plot2d_Curve* aCurve;
- while( (aCurve = it.current()) ) {
+ for (; it != curves.end(); ++it ) {
+ aCurve = *it;
displayCurve( aCurve, false );
- ++it;
}
fitAll();
{
if ( !curve )
return;
- int curveKey = hasCurve( curve );
- if ( curveKey ) {
- myPlot->removeCurve( curveKey );
- myCurves.remove( curveKey );
+ if ( hasPlotCurve( curve ) ) {
+ QwtPlotCurve* aPCurve = getPlotCurve( curve );
+ aPCurve->hide();
+ aPCurve->detach();
+ //int curveKey = hasCurve( curve );
+ //if ( curveKey ) {
+ //myPlot->removeCurve( curveKey );
+ //myCurves.remove( curveKey );
+ myPlot->getCurves().remove( aPCurve );
updateTitles();
if ( update )
myPlot->replot();
*/
void Plot2d_ViewFrame::eraseCurves( const curveList& curves, bool update )
{
- QPtrListIterator<Plot2d_Curve> it(curves);
+ QList<Plot2d_Curve*>::const_iterator it = curves.begin();
Plot2d_Curve* aCurve;
- while( (aCurve = it.current()) ) {
+ for (; it != curves.end(); ++it ) {
+ aCurve = *it;
eraseCurve( aCurve, false );
- ++it;
}
// fitAll();
if ( update )
{
if ( !curve )
return;
- int curveKey = hasCurve( curve );
- if ( curveKey ) {
+ //int curveKey = hasCurve( curve );
+ //if ( curveKey ) {
+ if ( hasPlotCurve( curve ) ) {
+ QwtPlotCurve* aPCurve = getPlotCurve( curve );
if ( !curve->isAutoAssign() ) {
Qt::PenStyle ps = plot2qwtLine( curve->getLine() );
QwtSymbol::Style ms = plot2qwtMarker( curve->getMarker() );
- myPlot->setCurvePen( curveKey, QPen( curve->getColor(), curve->getLineWidth(), ps ) );
- myPlot->setCurveSymbol( curveKey, QwtSymbol( ms,
+ aPCurve->setPen ( QPen( curve->getColor(), curve->getLineWidth(), ps ) );
+ //myPlot->setCurvePen( curveKey, QPen( curve->getColor(), curve->getLineWidth(), ps ) );
+ aPCurve->setSymbol( QwtSymbol( ms,
QBrush( curve->getColor() ),
QPen( curve->getColor() ),
QSize( myMarkerSize, myMarkerSize ) ) );
- myPlot->setCurveData( curveKey, curve->horData(), curve->verData(), curve->nbPoints() );
+ //myPlot->setCurveSymbol( curveKey, QwtSymbol( ms,
+ // QBrush( curve->getColor() ),
+ // QPen( curve->getColor() ),
+ // QSize( myMarkerSize, myMarkerSize ) ) );
+ aPCurve->setData( curve->horData(), curve->verData(), curve->nbPoints() );
+ //myPlot->setCurveData( curveKey, curve->horData(), curve->verData(), curve->nbPoints() );
}
- myPlot->setCurveTitle( curveKey, curve->getVerTitle() );
- myPlot->curve( curveKey )->setEnabled( true );
+ aPCurve->setTitle( curve->getVerTitle() );
+ //myPlot->setCurveTitle( curveKey, curve->getVerTitle() );
+ aPCurve->setVisible( true );
+ //myPlot->curve( curveKey )->setEnabled( true );
if ( update )
myPlot->replot();
}
/*!
Returns curve key if is is displayed in the viewer and 0 otherwise
*/
-int Plot2d_ViewFrame::hasCurve( Plot2d_Curve* curve )
+/*int Plot2d_ViewFrame::hasCurve( Plot2d_Curve* curve )
{
QIntDictIterator<Plot2d_Curve> it( myCurves );
for ( ; it.current(); ++it ) {
}
return 0;
}
-
+*/
/*!
Gets lsit of displayed curves
*/
-int Plot2d_ViewFrame::getCurves( QList<Plot2d_Curve>& clist )
+int Plot2d_ViewFrame::getCurves( curveList& clist )
{
clist.clear();
- clist.setAutoDelete( false );
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; it.current(); ++it ) {
- clist.append( it.current() );
- }
+ //clist.setAutoDelete( false );
+
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ for ( ; it != myPlot->getCurves().end(); it++ )
+ clist.append( it.value() );
+ //QIntDictIterator<Plot2d_Curve> it( myCurves );
+ //for ( ; it.current(); ++it ) {
+ // clist.append( it.current() );
+ //}
return clist.count();
}
+const CurveDict& Plot2d_ViewFrame::getCurves()
+{
+ return myPlot->getCurves();
+}
+
/*!
Returns true if the curve is visible
*/
bool Plot2d_ViewFrame::isVisible( Plot2d_Curve* curve )
{
if(curve) {
- int key = hasCurve( curve );
- if ( key )
- return myPlot->curve( key )->enabled();
+ if ( hasPlotCurve( curve ) ) {
+ return getPlotCurve( curve )->isVisible();
+ }
+ //int key = hasCurve( curve );
+ //if ( key )
+ // return myPlot->curve( key )->enabled();
}
return false;
}
return;
curveList aCurves = prs->getCurves();
- QPtrListIterator<Plot2d_Curve> it(aCurves);
+ QList<Plot2d_Curve*>::iterator it = aCurves.begin();
Plot2d_Curve* aCurve;
- while( (aCurve = it.current()) ) {
- int curveKey = hasCurve( aCurve );
- if ( curveKey )
- myPlot->setCurveTitle( curveKey, aCurve->getVerTitle() );
- ++it;
+ for (; it != aCurves.end(); ++it ) {
+ aCurve = *it;
+ if ( hasPlotCurve( aCurve ) )
+ getPlotCurve( aCurve )->setTitle( aCurve->getVerTitle() );
+ //int curveKey = hasCurve( aCurve );
+ //if ( curveKey )
+ // myPlot->setCurveTitle( curveKey, aCurve->getVerTitle() );
}
}
// Postpone fitAll operation until QwtPlot geometry
// has been fully defined
if ( !myPlot->polished() ){
- QApplication::postEvent( this, new QCustomEvent( FITALL_EVENT ) );
+ QApplication::postEvent( this, new QEvent( (QEvent::Type)FITALL_EVENT ) );
return;
}
- QwtDiMap xMap1 = myPlot->canvasMap( QwtPlot::xBottom );
-
myPlot->setAxisAutoScale( QwtPlot::yLeft );
myPlot->setAxisAutoScale( QwtPlot::xBottom );
myPlot->replot();
// for existing grid
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, xMap.i1() ),
- myPlot->invTransform( QwtPlot::xBottom, xMap.i2() ) );
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.p1() ) ),
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.p2() ) ) );
myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, yMap.i1() ),
- myPlot->invTransform( QwtPlot::yLeft, yMap.i2() ) );
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.p1() ) ),
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.p2() ) ) );
if (mySecondY) {
myPlot->setAxisAutoScale( QwtPlot::yRight );
myPlot->replot();
- QwtDiMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
+ QwtScaleMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
myPlot->setAxisScale( QwtPlot::yRight,
- myPlot->invTransform( QwtPlot::yRight, yMap2.i1() ),
- myPlot->invTransform( QwtPlot::yRight, yMap2.i2() ) );
+ myPlot->invTransform( QwtPlot::yRight, yMap2.transform( yMap2.p1() ) ),
+ myPlot->invTransform( QwtPlot::yRight, yMap2.transform( yMap2.p2() ) ) );
}
myPlot->replot();
}
*/
void Plot2d_ViewFrame::fitArea( const QRect& area )
{
- QRect rect = area.normalize();
+ QRect rect = area.normalized();
if ( rect.width() < MIN_RECT_SIZE ) {
rect.setWidth( MIN_RECT_SIZE );
rect.setLeft( rect.left() - MIN_RECT_SIZE/2 );
double& yMin, double& yMax,
double& y2Min, double& y2Max)
{
- int ixMin = myPlot->canvasMap( QwtPlot::xBottom ).i1();
- int ixMax = myPlot->canvasMap( QwtPlot::xBottom ).i2();
- int iyMin = myPlot->canvasMap( QwtPlot::yLeft ).i1();
- int iyMax = myPlot->canvasMap( QwtPlot::yLeft ).i2();
+ double aP1 = myPlot->canvasMap( QwtPlot::xBottom ).p1();
+ double aP2 = myPlot->canvasMap( QwtPlot::xBottom ).p2();
+ double aS1 = myPlot->canvasMap( QwtPlot::xBottom ).s1();
+ double aS2 = myPlot->canvasMap( QwtPlot::xBottom ).s2();
+
+ int ixMin = myPlot->canvasMap( QwtPlot::xBottom ).transform( myPlot->canvasMap( QwtPlot::xBottom ).p1() );
+ int ixMax = myPlot->canvasMap( QwtPlot::xBottom ).transform( myPlot->canvasMap( QwtPlot::xBottom ).p2() );
+ int iyMin = myPlot->canvasMap( QwtPlot::yLeft ).transform( myPlot->canvasMap( QwtPlot::yLeft ).p1() );
+ int iyMax = myPlot->canvasMap( QwtPlot::yLeft ).transform( myPlot->canvasMap( QwtPlot::yLeft ).p2() );
xMin = myPlot->invTransform(QwtPlot::xBottom, ixMin);
xMax = myPlot->invTransform(QwtPlot::xBottom, ixMax);
yMin = myPlot->invTransform(QwtPlot::yLeft, iyMin);
y2Min = 0;
y2Max = 0;
if (mySecondY) {
- int iyMin = myPlot->canvasMap( QwtPlot::yRight ).i1();
- int iyMax = myPlot->canvasMap( QwtPlot::yRight ).i2();
+ int iyMin = myPlot->canvasMap( QwtPlot::yRight ).transform( myPlot->canvasMap( QwtPlot::yRight ).p1() );
+ int iyMax = myPlot->canvasMap( QwtPlot::yRight ).transform( myPlot->canvasMap( QwtPlot::yRight ).p2() );
y2Min = myPlot->invTransform(QwtPlot::yRight, iyMin);
y2Max = myPlot->invTransform(QwtPlot::yRight, iyMax);
}
*/
int Plot2d_ViewFrame::testOperation( const QMouseEvent& me )
{
- int btn = me.button() | me.state();
- const int zoomBtn = ControlButton | LeftButton;
- const int panBtn = ControlButton | MidButton;
- const int fitBtn = ControlButton | RightButton;
+ int btn = me.buttons(); // | me.state();
+ const int zoomBtn = Qt::ControlModifier | Qt::LeftButton;
+ const int panBtn = Qt::ControlModifier | Qt::MidButton;
+ const int fitBtn = Qt::ControlModifier | Qt::RightButton;
switch (btn)
{
void Plot2d_ViewFrame::setCurveType( int curveType, bool update )
{
myCurveType = curveType;
- QArray<long> keys = myPlot->curveKeys();
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ for ( ; it != myPlot->getCurves().end(); it++ ) {
+ QwtPlotCurve* crv = it.key();
+ if ( crv ) {
+ if ( myCurveType == 0 )
+ crv->setStyle( QwtPlotCurve::Dots );//QwtCurve::NoCurve
+ else if ( myCurveType == 1 )
+ crv->setStyle( QwtPlotCurve::Lines );
+ else if ( myCurveType == 2 )
+ crv->setStyle( QwtPlotCurve::Dots );//Spline );
+ }
+ }
+ /*
+ //QArray<long> keys = myPlot->curveKeys();
for ( int i = 0; i < (int)keys.count(); i++ ) {
if ( myCurveType == 0 )
myPlot->setCurveStyle( keys[i], QwtCurve::Dots );//QwtCurve::NoCurve
else if ( myCurveType == 2 )
myPlot->setCurveStyle( keys[i], QwtCurve::Spline );
}
+ */
if ( update )
myPlot->replot();
emit vpCurveChanged();
\param curveKey - curve id
\param title - new title
*/
-void Plot2d_ViewFrame::setCurveTitle( int curveKey, const QString& title )
+void Plot2d_ViewFrame::setCurveTitle( Plot2d_Curve* curve, const QString& title )
{
- if(myPlot) myPlot->setCurveTitle(curveKey, title);
+ if ( curve && hasPlotCurve( curve ) )
+ getPlotCurve( curve )->setTitle( title );
+ //if(myPlot) myPlot->setCurveTitle(curveKey, title);
}
/*!
void Plot2d_ViewFrame::showLegend( bool show, bool update )
{
myShowLegend = show;
- myPlot->setAutoLegend( myShowLegend );
- myPlot->enableLegend( myShowLegend );
+ if ( myShowLegend ) {
+ QwtLegend* legend = myPlot->legend();
+ if ( !legend )
+ legend = new QwtLegend();
+ myPlot->insertLegend( legend );
+ setLegendPos( myLegendPos );
+ }
+ else
+ myPlot->insertLegend( 0 );
+ //myPlot->setAutoLegend( myShowLegend );
+ //myPlot->enableLegend( myShowLegend );
if ( update )
myPlot->replot();
}
void Plot2d_ViewFrame::setLegendPos( int pos )
{
myLegendPos = pos;
+ QwtLegend* legend = myPlot->legend();
switch( pos ) {
case 0:
- myPlot->setLegendPos( Qwt::Left );
+ myPlot->insertLegend( legend, QwtPlot::LeftLegend );
break;
case 1:
- myPlot->setLegendPos( Qwt::Right );
+ myPlot->insertLegend( legend, QwtPlot::RightLegend );
break;
case 2:
- myPlot->setLegendPos( Qwt::Top );
+ myPlot->insertLegend( legend, QwtPlot::TopLegend );
break;
case 3:
- myPlot->setLegendPos( Qwt::Bottom );
+ myPlot->insertLegend( legend, QwtPlot::BottomLegend );
break;
}
}
if ( myMarkerSize != size )
{
myMarkerSize = size;
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ for ( ; it != myPlot->getCurves().end(); it++ ) {
+ QwtPlotCurve* crv = it.key();
+ if ( crv )
+ {
+ QwtSymbol aSymbol = crv->symbol();
+ aSymbol.setSize( myMarkerSize, myMarkerSize );
+ crv->setSymbol( aSymbol );
+ }
+ }
+ /*
QArray<long> keys = myPlot->curveKeys();
for ( int i = 0; i < (int)keys.count(); i++ )
{
myPlot->setCurveSymbol( keys[i], aSymbol );
}
}
+ */
if ( update )
myPlot->replot();
}
//myPlot->setCanvasBackground( myBackground );
myPlot->canvas()->setPalette( myBackground );
myPlot->setPalette( myBackground );
- QPalette aPal = myPlot->getLegend()->palette();
- for ( int i = 0; i < QPalette::NColorGroups; i++ ) {
- QPalette::ColorGroup cg = (QPalette::ColorGroup)i;
- aPal.setColor( cg, QColorGroup::Base, myBackground );
- aPal.setColor( cg, QColorGroup::Background, myBackground );
+ if ( myPlot->getLegend() ) {
+ QPalette aPal = myPlot->getLegend()->palette();
+ for ( int i = 0; i < QPalette::NColorGroups; i++ ) {
+ aPal.setColor( QPalette::Base, myBackground );
+ aPal.setColor( QPalette::Background, myBackground );
+ }
+ myPlot->getLegend()->setPalette( aPal );
}
- myPlot->getLegend()->setPalette( aPal );
Repaint();
}
/*!
myXGridMinorEnabled = xMinorEnabled;
myXGridMaxMajor = xMajorMax;
myXGridMaxMinor = xMinorMax;
+
myPlot->setAxisMaxMajor( QwtPlot::xBottom, myXGridMaxMajor );
myPlot->setAxisMaxMinor( QwtPlot::xBottom, myXGridMaxMinor );
- myPlot->setGridXAxis(QwtPlot::xBottom);
- myPlot->enableGridX( myXGridMajorEnabled );
- myPlot->enableGridXMin( myXGridMinorEnabled );
+
+ QwtPlotGrid* grid = myPlot->grid();
+ if ( myPlot->axisScaleDiv( QwtPlot::xBottom ) )
+ grid->setXDiv( *myPlot->axisScaleDiv( QwtPlot::xBottom ) );
+ grid->enableX( myXGridMajorEnabled );
+ grid->enableXMin( myXGridMinorEnabled );
+
if ( update )
myPlot->replot();
}
myPlot->setAxisMaxMinor( QwtPlot::yRight, myY2GridMaxMinor );
}
- myPlot->setGridYAxis(QwtPlot::yLeft);
+ QwtPlotGrid* grid = myPlot->grid();
+ if ( myPlot->axisScaleDiv( QwtPlot::yLeft ) )
+ grid->setYDiv( *myPlot->axisScaleDiv( QwtPlot::yLeft ) );
+ ///myPlot->setGridYAxis(QwtPlot::yLeft);
if (mySecondY) {
if (myYGridMajorEnabled) {
- myPlot->enableGridYMin(myYGridMinorEnabled);
- myPlot->enableGridY( myYGridMajorEnabled);
+ grid->enableY( myYGridMajorEnabled );
+ grid->enableYMin( myYGridMinorEnabled );
}
else if (myY2GridMajorEnabled) {
- myPlot->setGridYAxis(QwtPlot::yRight);
- myPlot->enableGridYMin(myY2GridMinorEnabled);
- myPlot->enableGridY(myY2GridMajorEnabled);
+ if ( myPlot->axisScaleDiv( QwtPlot::yRight ) )
+ grid->setYDiv( *myPlot->axisScaleDiv( QwtPlot::yRight ) );
+ grid->enableY( myY2GridMajorEnabled );
+ grid->enableYMin( myY2GridMinorEnabled );
}
else {
- myPlot->enableGridYMin(false);
- myPlot->enableGridY(false);
+ grid->enableY( false );
+ grid->enableYMin( false );
}
}
else {
- myPlot->enableGridY( myYGridMajorEnabled );
- myPlot->enableGridYMin( myYGridMinorEnabled );
+ grid->enableY( myYGridMajorEnabled );
+ grid->enableYMin( myYGridMinorEnabled );
}
if ( update )
myPlot->replot();
{
switch (type) {
case MainTitle:
- myPlot->setTitleFont(font);
+ myPlot->title().setFont(font);
+ //myPlot->setTitleFont(font);
break;
case XTitle:
- myPlot->setAxisTitleFont(QwtPlot::xBottom, font); break;
+ myPlot->axisTitle(QwtPlot::xBottom).setFont(font); break;
+ //myPlot->setAxisTitleFont(QwtPlot::xBottom, font); break;
case YTitle:
- myPlot->setAxisTitleFont(QwtPlot::yLeft, font); break;
+ myPlot->axisTitle(QwtPlot::yLeft).setFont(font); break;
+ //myPlot->setAxisTitleFont(QwtPlot::yLeft, font); break;
case Y2Title:
- myPlot->setAxisTitleFont(QwtPlot::yRight, font); break;
+ myPlot->axisTitle(QwtPlot::yRight).setFont(font); break;
+ //myPlot->setAxisTitleFont(QwtPlot::yRight, font); break;
case XAxis:
- myPlot->setAxisFont(QwtPlot::xBottom, font); break;
+ myPlot->setAxisFont(QwtPlot::xBottom, font); break;
case YAxis:
- myPlot->setAxisFont(QwtPlot::yLeft, font); break;
+ myPlot->setAxisFont(QwtPlot::yLeft, font); break;
case Y2Axis:
- myPlot->setAxisFont(QwtPlot::yRight, font); break;
+ myPlot->setAxisFont(QwtPlot::yRight, font); break;
}
if ( update )
myPlot->replot();
myXMode = mode;
- myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, myXMode != 0 );
+ myPlot->setLogScale(QwtPlot::xBottom, myXMode != 0);
+ //myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, myXMode != 0 );
if ( update )
fitAll();
}
myYMode = mode;
- myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, myYMode != 0 );
+ myPlot->setLogScale(QwtPlot::yLeft, myXMode != 0);
+ //myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, myYMode != 0 );
if (mySecondY)
- myPlot->changeAxisOptions( QwtPlot::yRight, QwtAutoScale::Logarithmic, myYMode != 0 );
+ myPlot->setLogScale( QwtPlot::yRight, myXMode != 0 );
+ //myPlot->changeAxisOptions( QwtPlot::yRight, QwtAutoScale::Logarithmic, myYMode != 0 );
if ( update )
fitAll();
/*!
Slot, called when user presses mouse button
*/
-void Plot2d_ViewFrame::plotMousePressed(const QMouseEvent& me )
+void Plot2d_ViewFrame::plotMousePressed( const QMouseEvent& me )
{
Plot2d_ViewWindow* aParent = dynamic_cast<Plot2d_ViewWindow*>(parent());
if (aParent)
if ( myOperation != NoOpId ) {
myPnt = me.pos();
if ( myOperation == FitAreaId ) {
- myPlot->setOutlineStyle( Qwt::Rect );
+ ///myPlot->setOutlineStyle( Qwt::Rect );
}
else if ( myOperation == GlPanId ) {
myPlot->setAxisScale( QwtPlot::yLeft,
}
}
else {
- int btn = me.button() | me.state();
- if (btn == RightButton) {
+ int btn = me.buttons();// | me.state();
+ if (btn == Qt::RightButton) {
QMouseEvent* aEvent = new QMouseEvent(QEvent::MouseButtonPress,
- me.pos(), btn, me.state());
+ me.pos(), me.button(), me.buttons(), Qt::KeypadModifier );//state());
// QMouseEvent 'me' has the 'MouseButtonDblClick' type. In this case we create new event 'aEvent'.
parent()->eventFilter(this, aEvent);
}
/*!
Slot, called when user moves mouse
*/
+
void Plot2d_ViewFrame::plotMouseMoved( const QMouseEvent& me )
{
int dx = me.pos().x() - myPnt.x();
*/
void Plot2d_ViewFrame::plotMouseReleased( const QMouseEvent& me )
{
- if ( myOperation == NoOpId && me.button() == RightButton )
+ if ( myOperation == NoOpId && me.button() == Qt::RightButton )
{
QContextMenuEvent aEvent( QContextMenuEvent::Mouse,
- me.pos(), me.globalPos(),
- me.state() );
+ me.pos(), me.globalPos() );//,
+ //me.buttons());//state() );
emit contextMenuRequested( &aEvent );
}
if ( myOperation == FitAreaId ) {
fitArea( rect );
}
myPlot->canvas()->setCursor( QCursor( Qt::CrossCursor ) );
- myPlot->setOutlineStyle( Qwt::Triangle );
+ ///myPlot->setOutlineStyle( Qwt::Triangle );
Plot2d_ViewWindow* aParent = dynamic_cast<Plot2d_ViewWindow*>(parent());
if (aParent)
double aDelta = event->delta();
double aScale = (aDelta < 0) ? 100./(-aDelta) : aDelta/100.;
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, yMap.i1() ),
- myPlot->invTransform( QwtPlot::yLeft, yMap.i2() )*aScale );
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( xMap.p1() ) ),
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( xMap.p2() ) )*aScale );
myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, xMap.i1() ),
- myPlot->invTransform( QwtPlot::xBottom, xMap.i2() )*aScale );
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.p1() ) ),
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.p2() ) )*aScale );
if (mySecondY) {
- QwtDiMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
+ QwtScaleMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
myPlot->setAxisScale( QwtPlot::yRight,
- myPlot->invTransform( QwtPlot::yRight, y2Map.i1() ),
- myPlot->invTransform( QwtPlot::yRight, y2Map.i2() )*aScale );
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.p1() ) ),
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.p2() ) )*aScale );
}
myPlot->replot();
myPnt = event->pos();
}
+
+/*!
+ Returns qwt plot curve if it is existed in map of curves and 0 otherwise
+*/
+QwtPlotCurve* Plot2d_ViewFrame::getPlotCurve( Plot2d_Curve* curve )
+{
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ for ( ; it != myPlot->getCurves().end(); it++ ) {
+ if ( it.value() == curve )
+ return it.key();
+ }
+ return 0;
+}
+/*!
+ Returns true if qwt plot curve is existed in map of curves and false otherwise
+*/
+bool Plot2d_ViewFrame::hasPlotCurve( Plot2d_Curve* curve )
+{
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ for ( ; it != myPlot->getCurves().end(); it++ ) {
+ if ( it.value() == curve )
+ return true;
+ }
+ return false;
+}
+
/*!
View operations : Pan view
*/
QPixmap globalPanPixmap (imageCrossCursor);
QCursor glPanCursor (globalPanPixmap);
myPlot->canvas()->setCursor( glPanCursor );
- myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, false );
- myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, false );
+ myPlot->setLogScale(QwtPlot::xBottom, false);
+ myPlot->setLogScale(QwtPlot::yLeft, false);
+ //myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, false );
+ //myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, false );
if (mySecondY)
- myPlot->changeAxisOptions( QwtPlot::yRight, QwtAutoScale::Logarithmic, false );
+ myPlot->setLogScale(QwtPlot::yRight, false);
+ //myPlot->changeAxisOptions( QwtPlot::yRight, QwtAutoScale::Logarithmic, false );
myPlot->replot();
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
- myXDistance = xMap.d2() - xMap.d1();
- myYDistance = yMap.d2() - yMap.d1();
+ myXDistance = xMap.p2() - xMap.p1();
+ myYDistance = yMap.p2() - yMap.p1();
if (mySecondY) {
- QwtDiMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
- myYDistance2 = yMap2.d2() - yMap2.d1();
+ QwtScaleMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
+ myYDistance2 = yMap2.p2() - yMap2.p1();
}
fitAll();
myOperation = GlPanId;
bool Plot2d_ViewFrame::isXLogEnabled() const
{
bool allPositive = true;
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; allPositive && it.current(); ++it ) {
- allPositive = ( it.current()->getMinX() > 0. );
- }
+ CurveDict::const_iterator it = myPlot->getCurves().begin();
+ for ( ; allPositive && it != myPlot->getCurves().end(); it++ )
+ allPositive = ( it.value()->getMinX() > 0. );
+ //QIntDictIterator<Plot2d_Curve> it( myCurves );
+ //for ( ; allPositive && it.current(); ++it ) {
+ // allPositive = ( it.current()->getMinX() > 0. );
+ //}
return allPositive;
}
bool Plot2d_ViewFrame::isYLogEnabled() const
{
bool allPositive = true;
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; allPositive && it.current(); ++it ) {
- allPositive = ( it.current()->getMinY() > 0. );
- }
+ CurveDict::const_iterator it = myPlot->getCurves().begin();
+ for ( ; allPositive && it != myPlot->getCurves().end(); it++ )
+ allPositive = ( it.value()->getMinY() > 0. );
+ //QIntDictIterator<Plot2d_Curve> it( myCurves );
+ //for ( ; allPositive && it.current(); ++it ) {
+ // allPositive = ( it.current()->getMinY() > 0. );
+ //}
return allPositive;
}
myIsPolished( false )
{
// outline
- enableOutline( true );
- setOutlineStyle( Qwt::Triangle );
- setOutlinePen( green );
+ ///enableOutline( true );
+ ///setOutlineStyle( Qwt::Triangle );
+ ///setOutlinePen( green );
// legend
- setAutoLegend( false );
- setLegendFrameStyle( QFrame::Box | QFrame::Sunken );
- enableLegend( false );
- // grid
- enableGridX( false );
- enableGridXMin( false );
- enableGridY( false );
- enableGridYMin( false );
+ ///setAutoLegend( false );
+ ///setLegendFrameStyle( QFrame::Box | QFrame::Sunken );
+ ///enableLegend( false );
+
// auto scaling by default
setAxisAutoScale( QwtPlot::yLeft );
setAxisAutoScale( QwtPlot::yRight );
setAxisAutoScale( QwtPlot::xBottom );
+ // grid
+ myGrid = new QwtPlotGrid();
+ QPen aMajPen = myGrid->majPen();
+ aMajPen.setStyle( Qt::DashLine );
+ myGrid->setPen( aMajPen );
+
+ myGrid->enableX( false );
+ myGrid->enableXMin( false );
+ myGrid->enableY( false );
+ myGrid->enableYMin( false );
+
+ myGrid->attach( this );
}
+
+/*!
+ \set axis scale engine - linear or log10
+*/
+void Plot2d_Plot2d::setLogScale( int axisId, bool log10 )
+{
+ if ( log10 )
+ setAxisScaleEngine( axisId, new QwtLog10ScaleEngine() );
+ else
+ setAxisScaleEngine( axisId, new QwtLinearScaleEngine() );
+}
+
/*!
Recalculates and redraws Plot 2d view
*/
*/
}
+void Plot2d_Plot2d::mousePressEvent ( QMouseEvent * me )
+{
+ QMouseEvent m( QEvent::MouseButtonPress, me->pos(), me->button(), me->buttons(), Qt::KeypadModifier );//state());
+ emit plotMousePressed( m );
+ QWidget::mousePressEvent( me );
+}
+
+void Plot2d_Plot2d::mouseMoveEvent( QMouseEvent* me )
+{
+ QMouseEvent m( QEvent::MouseButtonPress, me->pos(), me->button(), me->buttons(), Qt::KeypadModifier );//state());
+ emit plotMouseMoved( m );
+ QWidget::mousePressEvent( me );
+}
+
+void Plot2d_Plot2d::mouseReleaseEvent( QMouseEvent* me )
+{
+ QMouseEvent m( QEvent::MouseButtonPress, me->pos(), me->button(), me->buttons(), Qt::KeypadModifier );//state());
+ emit plotMouseReleased( m );
+ QWidget::mousePressEvent( me );
+}
+
/*!
\return the default layout behavior of the widget
*/
// QSize aSize = QwtPlot::minimumSizeHint();
// return QSize(aSize.width()*3/4, aSize.height());
}
+
+/*!
+ return closest curve if it exist, else 0
+*/
+Plot2d_Curve* Plot2d_Plot2d::getClosestCurve( QPoint p, double& distance, int& index )
+{
+ CurveDict::iterator it = getCurves().begin();
+ QwtPlotCurve* aCurve;
+ for ( ; it != getCurves().end(); it++ ) {
+ aCurve = it.key();
+ if ( !aCurve )
+ continue;
+ index = aCurve->closestPoint( p, &distance );
+ if ( index > -1 )
+ return it.value();
+ }
+ return 0;
+}
+
/*!
Checks if marker belongs to any enitity
*/
bool Plot2d_Plot2d::existMarker( const QwtSymbol::Style typeMarker, const QColor& color, const Qt::PenStyle typeLine )
{
// getting all curves
- QArray<long> keys = curveKeys();
+ ///QArray<long> keys = curveKeys();
//QColor aRgbColor;
-
- if ( closeColors( color, backgroundColor() ) )
+ QColor aColor = palette().color( QPalette::Background );
+ if ( closeColors( color, aColor ) )
return true;
- for ( int i = 0; i < (int)keys.count(); i++ )
+
+ CurveDict::iterator it = myCurves.begin();
+ for ( ; it != myCurves.end(); it++ ) {
+ QwtPlotCurve* crv = it.key();
+ if ( crv ) {
+ QwtSymbol::Style aStyle = crv->symbol().style();
+ QColor aColor = crv->pen().color();
+ Qt::PenStyle aLine = crv->pen().style();
+// if ( aStyle == typeMarker && aColor == color && aLine == typeLine )
+ if ( aStyle == typeMarker && closeColors( aColor,color ) && aLine == typeLine )
+ return true;
+ }
+ }
+ /*for ( int i = 0; i < (int)keys.count(); i++ )
{
QwtPlotCurve* crv = curve( keys[i] );
if ( crv ) {
if ( aStyle == typeMarker && closeColors( aColor,color ) && aLine == typeLine )
return true;
}
- }
+ }*/
return false;
}
#define BRACKETIZE(x) QString( "[ " ) + x + QString( " ]" )
void Plot2d_ViewFrame::updateTitles()
{
- QIntDictIterator<Plot2d_Curve> it( myCurves );
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ //QIntDictIterator<Plot2d_Curve> it( myCurves );
QStringList aXTitles;
QStringList aYTitles;
QStringList aXUnits;
QStringList aYUnits;
QStringList aTables;
int i = 0;
- while ( it.current() ) {
+
+ Plot2d_Curve* aCurve;
+ for ( ; it != myPlot->getCurves().end(); it++ ) {
+ //while ( it.current() ) {
// collect titles and units from all curves...
- QString xTitle = it.current()->getHorTitle().stripWhiteSpace();
- QString yTitle = it.current()->getVerTitle().stripWhiteSpace();
- QString xUnits = it.current()->getHorUnits().stripWhiteSpace();
- QString yUnits = it.current()->getVerUnits().stripWhiteSpace();
+ aCurve = it.value();
+ QString xTitle = aCurve->getHorTitle().trimmed();
+ QString yTitle = aCurve->getVerTitle().trimmed();
+ QString xUnits = aCurve->getHorUnits().trimmed();
+ QString yUnits = aCurve->getVerUnits().trimmed();
aYTitles.append( yTitle );
- if ( aXTitles.find( xTitle ) == aXTitles.end() )
+ if ( !aXTitles.contains( xTitle ) )//aXTitles.find( xTitle ) == aXTitles.end() )
aXTitles.append( xTitle );
- if ( aXUnits.find( xUnits ) == aXUnits.end() )
+ if ( !aXUnits.contains( xUnits ) )//aXUnits.find( xUnits ) == aXUnits.end() )
aXUnits.append( xUnits );
- if ( aYUnits.find( yUnits ) == aYUnits.end() )
+ if ( !aYUnits.contains( yUnits ) )//aYUnits.find( yUnits ) == aYUnits.end() )
aYUnits.append( yUnits );
- QString aName = it.current()->getTableTitle();
- if( !aName.isEmpty() && aTables.find( aName ) == aTables.end() )
+ QString aName = aCurve->getTableTitle();
+ if( !aName.isEmpty() && !aTables.contains( aName ) )//aTables.find( aName ) == aTables.end() )
aTables.append( aName );
-
- ++it;
++i;
}
// ... and update plot 2d view
{
QPrinter* pr = new QPrinter( QPrinter::HighResolution );
pr->setPageSize( QPrinter::A4 );
- pr->setOutputToFile( true );
+ ///pr->setOutputToFile( true );
pr->setOutputFileName( file );
pr->setPrintProgram( "" );
pd = pr;
*/
void Plot2d_ViewFrame::setVisualParameters( const QString& parameters )
{
- QStringList paramsLst = QStringList::split( '*', parameters, true );
+ QStringList paramsLst = parameters.split( '*' );
+ //QStringList::split( '*', parameters, true );
if ( paramsLst.size() == 9 ) {
double xmin, xmax, ymin, ymax, y2min, y2max;
myXMode = paramsLst[0].toInt();
setVerScaleMode( myYMode, /*update=*/false );
if (mySecondY) {
- QwtDiMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
- myYDistance2 = yMap2.d2() - yMap2.d1();
+ QwtScaleMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
+ myYDistance2 = yMap2.p2() - yMap2.p1();
}
fitData( 0, xmin, xmax, ymin, ymax, y2min, y2max );
Incremental zooming operation
*/
void Plot2d_ViewFrame::incrementalPan( const int incrX, const int incrY ) {
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, yMap.i1()-incrY ),
- myPlot->invTransform( QwtPlot::yLeft, yMap.i2()-incrY ) );
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.p1() )-incrY ),
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.p2() )-incrY ) );
myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, xMap.i1()-incrX ),
- myPlot->invTransform( QwtPlot::xBottom, xMap.i2()-incrX ) );
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.p1() )-incrX ),
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.p2() )-incrX ) );
if (mySecondY) {
- QwtDiMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
+ QwtScaleMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
myPlot->setAxisScale( QwtPlot::yRight,
- myPlot->invTransform( QwtPlot::yRight, y2Map.i1()-incrY ),
- myPlot->invTransform( QwtPlot::yRight, y2Map.i2()-incrY ) );
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.p1() )-incrY ),
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.p2() )-incrY ) );
}
myPlot->replot();
}
Incremental panning operation
*/
void Plot2d_ViewFrame::incrementalZoom( const int incrX, const int incrY ) {
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, yMap.i1() ),
- myPlot->invTransform( QwtPlot::yLeft, yMap.i2() + incrY ) );
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.p1() ) ),
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.p2() ) + incrY ) );
myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, xMap.i1() ),
- myPlot->invTransform( QwtPlot::xBottom, xMap.i2() - incrX ) );
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.p1() ) ),
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.p2() ) - incrX ) );
if (mySecondY) {
- QwtDiMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
+ QwtScaleMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
myPlot->setAxisScale( QwtPlot::yRight,
- myPlot->invTransform( QwtPlot::yRight, y2Map.i1() ),
- myPlot->invTransform( QwtPlot::yRight, y2Map.i2() + incrY ) );
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.p1() ) ),
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.p2() ) + incrY ) );
}
myPlot->replot();
}
event queue. This ensures that other important events (show, resize, etc.)
are processed first.
*/
-void Plot2d_ViewFrame::customEvent( QCustomEvent* ce )
+void Plot2d_ViewFrame::customEvent( QEvent* ce )
{
if ( ce->type() == FITALL_EVENT )
fitAll();
#define PLOT2D_VIEWFRAME_H
#include "Plot2d_Curve.h"
-#include <qwidget.h>
-#include <qintdict.h>
+#include <QWidget>
+#include <QMultiHash>
+#include <QList>
+#include <qwt_symbol.h>
class Plot2d_Plot2d;
class Plot2d_Prs;
class QCustomEvent;
+class QwtPlotCurve;
+class QwtPlotGrid;
-typedef QIntDict<Plot2d_Curve> CurveDict;
+typedef QMultiHash<QwtPlotCurve*, Plot2d_Curve*> CurveDict;
class PLOT2D_EXPORT Plot2d_ViewFrame : public QWidget
{
void eraseCurve( Plot2d_Curve* curve, bool update = false );
void eraseCurves( const curveList& curves, bool update = false );
int getCurves( curveList& clist );
- const CurveDict& getCurves() { return myCurves; }
- int hasCurve( Plot2d_Curve* curve );
+ const CurveDict& getCurves();/// { return myPlot->getCurves(); }
+ //int hasCurve( Plot2d_Curve* curve );
bool isVisible( Plot2d_Curve* curve );
void updateCurve( Plot2d_Curve* curve, bool update = false );
void updateLegend( const Plot2d_Prs* prs );
void copyPreferences( Plot2d_ViewFrame* );
void setCurveType( int curveType, bool update = true );
int getCurveType() const { return myCurveType; }
- void setCurveTitle( int curveKey, const QString& title );
+ void setCurveTitle( Plot2d_Curve* curve, const QString& title );
void showLegend( bool show, bool update = true );
void setLegendPos( int pos );
int getLegendPos() const { return myLegendPos; }
void writePreferences();
QString getInfo( const QPoint& pnt );
virtual void wheelEvent( QWheelEvent* );
+ QwtPlotCurve* getPlotCurve( Plot2d_Curve* curve );
+ bool hasPlotCurve( Plot2d_Curve* curve );
public slots:
void onViewPan();
void onZoomOut();
protected:
- virtual void customEvent( QCustomEvent* );
+ virtual void customEvent( QEvent* );
protected slots:
void plotMousePressed( const QMouseEvent& );
Plot2d_Plot2d* myPlot;
int myOperation;
QPoint myPnt;
- CurveDict myCurves;
+ //CurveDict myCurves;
int myCurveType;
bool myShowLegend;
public:
Plot2d_Plot2d( QWidget* parent );
+ void setLogScale( int axisId, bool log10 );
+
void replot();
void getNextMarker( QwtSymbol::Style& typeMarker, QColor& color, Qt::PenStyle& typeLine );
QwtLegend* getLegend() {
virtual QSize minimumSizeHint() const;
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:
- QValueList<QColor> myColors;
+ CurveDict myCurves;
+ QwtPlotGrid* myGrid;
+ QList<QColor> myColors;
bool myIsPolished;
};
#include "Plot2d_ViewFrame.h"
#include "Plot2d_Prs.h"
-#include <qpopupmenu.h>
+#include <QMenu>
+#include <QToolBar>
+#include <QVector>
/*!
Constructor
Adds custom items to popup menu
\param thePopup - popup menu
*/
-void Plot2d_Viewer::contextMenuPopup(QPopupMenu* thePopup)
+void Plot2d_Viewer::contextMenuPopup(QMenu* thePopup)
{
Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)(myViewManager->getActiveView());
if ( aView )
aView->contextMenuPopup(thePopup);
- if (thePopup->count() > 0) thePopup->insertSeparator();
- thePopup->insertItem( tr( "MNU_DUMP_VIEW" ), this, SLOT(onDumpView()));
- thePopup->insertItem( tr( "MEN_PLOT2D_CHANGE_BACKGROUND" ), this, SLOT(onChangeBgColor()));
+ if (!thePopup->isEmpty())
+ thePopup->addSeparator();
+ thePopup->addAction( tr( "MNU_DUMP_VIEW" ), this, SLOT(onDumpView()));
+ thePopup->addAction( tr( "MEN_PLOT2D_CHANGE_BACKGROUND" ), this, SLOT(onChangeBgColor()));
if ( aView ) {
if ( !aView->getToolBar()->isVisible() ) {
- if (thePopup->count() > 0) thePopup->insertSeparator();
- thePopup->insertItem("Show toolbar", this, SLOT(onShowToolbar()));
+ if (!thePopup->isEmpty())
+ thePopup->addSeparator();
+ thePopup->addAction("Show toolbar", this, SLOT(onShowToolbar()));
}
aView->RefreshDumpImage();
}
void Plot2d_Viewer::update()
{
SUIT_ViewManager* aMgr = getViewManager();
- QPtrVector<SUIT_ViewWindow> aViews = aMgr->getViews();
+ QVector<SUIT_ViewWindow*> aViews = aMgr->getViews();
unsigned int aSize = aViews.size();
for (uint i = 0; i < aSize; i++) {
Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)aViews[i];
void Plot2d_Viewer::clearPrs()
{
SUIT_ViewManager* aMgr = getViewManager();
- QPtrVector<SUIT_ViewWindow> aViews = aMgr->getViews();
+ QVector<SUIT_ViewWindow*> aViews = aMgr->getViews();
unsigned int aSize = aViews.size();
for (uint i = 0; i < aSize; i++) {
Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)aViews[i];
class Plot2d_ViewFrame;
class Plot2d_Prs;
class QString;
-class QPopupMenu;
+class QMenu;
class PLOT2D_EXPORT Plot2d_Viewer: public SUIT_ViewModel
{
virtual void setViewManager( SUIT_ViewManager* );
virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
virtual QString getType() const { return Type(); }
- virtual void contextMenuPopup(QPopupMenu*);
+ virtual void contextMenuPopup(QMenu*);
Plot2d_Prs* getPrs() const { return myPrs; };
void setPrs(Plot2d_Prs* thePrs);
void update();
#include "QtxAction.h"
-#include <qstatusbar.h>
-#include <qlayout.h>
-#include <qapplication.h>
-#include <qpopupmenu.h>
+#include <QStatusBar>
+#include <QLayout>
+#include <QApplication>
+#include <QMenu>
+#include <QImage>
+#include <QToolBar>
+#include <QPaintEvent>
/*!
Constructor
: SUIT_ViewWindow(theDesktop)
{
myModel = theModel;
-
myDumpImage = QImage();
myViewFrame = new Plot2d_ViewFrame(this, "plotView");
setCentralWidget(myViewFrame);
- myToolBar = new QToolBar(this);
- myToolBar->setCloseMode(QDockWindow::Undocked);
- myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
+ myToolBar = addToolBar( tr("LBL_TOOLBAR_LABEL") );
+ //myToolBar->setCloseMode(QDockWindow::Undocked); // toolbar has "Close" (X) button only if it's undocked, but there is no such functionality in Qt4
createActions();
createToolBar();
connect(myViewFrame, SIGNAL(contextMenuRequested( QContextMenuEvent * )),
this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) );
+ myViewFrame->installEventFilter( this );
}
/*!
void Plot2d_ViewWindow::putInfo(QString theMsg)
{
QStatusBar* aStatusBar = myDesktop->statusBar();
- aStatusBar->message(theMsg/*, 3000*/);
+ aStatusBar->showMessage(theMsg/*, 3000*/);
}
/*!
Fills popup menu with custom actions
\param popup - popup menu to be filled with
*/
-void Plot2d_ViewWindow::contextMenuPopup( QPopupMenu* thePopup )
+void Plot2d_ViewWindow::contextMenuPopup( QMenu* thePopup )
{
// scaling
- QPopupMenu* scalingPopup = new QPopupMenu( thePopup );
+ QMenu* scalingPopup = new QMenu( thePopup );
+ scalingPopup->addAction( myActionsMap[ PModeXLinearId ] );
myActionsMap[ PModeXLinearId ]->addTo( scalingPopup );
myActionsMap[ PModeXLogarithmicId ]->addTo( scalingPopup );
onChangeHorMode();
- scalingPopup->insertSeparator();
+ scalingPopup->addSeparator();
myActionsMap[ PModeYLinearId ]->addTo( scalingPopup );
myActionsMap[ PModeYLogarithmicId ]->addTo( scalingPopup );
- thePopup->insertItem( tr( "SCALING_POPUP" ), scalingPopup );
+ scalingPopup->setTitle( tr( "SCALING_POPUP" ) );
+ thePopup->addMenu( scalingPopup );
onChangeVerMode();
- thePopup->insertItem(tr("TOT_PLOT2D_FITDATA"), myViewFrame, SLOT(onFitData()));
+ thePopup->addAction(tr("TOT_PLOT2D_FITDATA"), myViewFrame, SLOT(onFitData()));
// curve type
- QPopupMenu* curTypePopup = new QPopupMenu( thePopup );
+ QMenu* curTypePopup = new QMenu( thePopup );
myActionsMap[ CurvPointsId ]->addTo( curTypePopup );
myActionsMap[ CurvLinesId ]->addTo( curTypePopup );
myActionsMap[ CurvSplinesId ]->addTo( curTypePopup );
- thePopup->insertItem( tr( "CURVE_TYPE_POPUP" ), curTypePopup );
+ curTypePopup->setTitle( tr( "CURVE_TYPE_POPUP" ) );
+ thePopup->addMenu( curTypePopup );
// legend
myActionsMap[ LegendId ]->addTo(thePopup);
tr("MEN_PLOT2D_CURVES_POINTS"), 0, this);
aAction->setStatusTip(tr("PRP_PLOT2D_CURVES_POINTS"));
connect(aAction, SIGNAL(activated()), this, SLOT(onCurves()));
- aAction->setToggleAction(true);
+ aAction->setCheckable(true);
myActionsMap[ CurvPointsId ] = aAction;
// Curve type - lines
tr("MEN_PLOT2D_CURVES_LINES"), 0, this);
aAction->setStatusTip(tr("PRP_PLOT2D_CURVES_LINES"));
connect(aAction, SIGNAL(activated()), this, SLOT(onCurves()));
- aAction->setToggleAction(true);
+ aAction->setCheckable(true);
myActionsMap[ CurvLinesId ] = aAction;
// Curve type - splines
tr("MEN_PLOT2D_CURVES_SPLINES"), 0, this);
aAction->setStatusTip(tr("PRP_PLOT2D_CURVES_SPLINES"));
connect(aAction, SIGNAL(activated()), this, SLOT(onCurves()));
- aAction->setToggleAction(true);
+ aAction->setCheckable(true);
myActionsMap[ CurvSplinesId ] = aAction;
// Mode for X (linear or logarithmic)
tr("MEN_PLOT2D_SHOW_LEGEND"), 0, this);
aAction->setStatusTip(tr("PRP_PLOT2D_SHOW_LEGEND"));
connect(aAction, SIGNAL(activated()), this, SLOT(onLegend()));
- aAction->setToggleAction(true);
+ aAction->setCheckable(true);
myActionsMap[ LegendId ] = aAction;
// Settings
aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LINEAR_HOR")),
tr("MEN_PLOT2D_MODE_LINEAR_HOR"), 0, this);
aAction->setStatusTip (tr("PRP_PLOT2D_MODE_LINEAR_HOR"));
- aAction->setToggleAction(true);
+ aAction->setCheckable(true);
myActionsMap[PModeXLinearId] = aAction;
connect(aAction, SIGNAL(activated()), this, SLOT(onViewHorMode()));
aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LOGARITHMIC_HOR")),
tr("MEN_PLOT2D_MODE_LOGARITHMIC_HOR"), 0, this);
aAction->setStatusTip(tr("PRP_PLOT2D_MODE_LOGARITHMIC_HOR"));
- aAction->setToggleAction(true);
+ aAction->setCheckable(true);
myActionsMap[PModeXLogarithmicId] = aAction;
connect(aAction, SIGNAL(activated()), this, SLOT(onViewHorMode()));
aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LINEAR_VER")),
tr("MEN_PLOT2D_MODE_LINEAR_VER" ), 0, this);
aAction->setStatusTip(tr("PRP_PLOT2D_MODE_LINEAR_VER"));
- aAction->setToggleAction(true);
+ aAction->setCheckable(true);
myActionsMap[PModeYLinearId] = aAction;
connect(aAction, SIGNAL(activated()), this, SLOT(onViewVerMode()));
aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LOGARITHMIC_VER")),
tr("MEN_PLOT2D_MODE_LOGARITHMIC_VER" ), 0, this);
aAction->setStatusTip(tr("PRP_PLOT2D_MODE_LOGARITHMIC_VER"));
- aAction->setToggleAction(true);
+ aAction->setCheckable(true);
myActionsMap[PModeYLogarithmicId] = aAction;
connect(aAction, SIGNAL(activated()), this, SLOT(onViewVerMode()));
-
}
/*!
aScaleBtn->AddAction(myActionsMap[FitAllId]);
aScaleBtn->AddAction(myActionsMap[FitRectId]);
aScaleBtn->AddAction(myActionsMap[ZoomId]);
+ myToolBar->addWidget( aScaleBtn );
SUIT_ToolButton* aPanBtn = new SUIT_ToolButton(myToolBar);
aPanBtn->AddAction(myActionsMap[PanId]);
aPanBtn->AddAction(myActionsMap[GlobalPanId]);
+ myToolBar->addWidget( aPanBtn );
myCurveBtn = new SUIT_ToolButton(myToolBar);
myCurveBtn->AddAction(myActionsMap[CurvPointsId]);
myCurveBtn->AddAction(myActionsMap[CurvLinesId]);
myCurveBtn->AddAction(myActionsMap[CurvSplinesId]);
- myActionsMap[CurvLinesId]->setOn(true);
+ myToolBar->addWidget( myCurveBtn );
+ myActionsMap[CurvLinesId]->setChecked(true);
onChangeCurveMode();
myActionsMap[HorId]->addTo(myToolBar);
bool aLinear = myViewFrame->isModeHorLinear();
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- myActionsMap[PModeXLinearId]->setOn( aLinear );
- myActionsMap[PModeXLogarithmicId]->setOn( !aLinear );
+ myActionsMap[PModeXLinearId]->setChecked( aLinear );
+ myActionsMap[PModeXLogarithmicId]->setChecked( !aLinear );
QPixmap pix = aResMgr->loadPixmap( "Plot2d", tr( aLinear ? "ICON_PLOT2D_MODE_LOGARITHMIC_HOR" :
"ICON_PLOT2D_MODE_LINEAR_HOR" ) );
- myActionsMap[HorId]->setIconSet( pix );
+ myActionsMap[HorId]->setIcon( pix );
myActionsMap[HorId]->setToolTip( tr( aLinear ? "TOT_PLOT2D_MODE_LOGARITHMIC_HOR" :
"TOT_PLOT2D_MODE_LINEAR_HOR" ) );
myActionsMap[HorId]->setStatusTip( tr( aLinear ? "PRP_PLOT2D_MODE_LOGARITHMIC_HOR" :
bool aLinear = myViewFrame->isModeVerLinear();
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- myActionsMap[PModeYLinearId]->setOn( aLinear );
- myActionsMap[PModeYLogarithmicId]->setOn( !aLinear );
+ myActionsMap[PModeYLinearId]->setChecked( aLinear );
+ myActionsMap[PModeYLogarithmicId]->setChecked( !aLinear );
QPixmap pix = aResMgr->loadPixmap( "Plot2d", tr( aLinear ? "ICON_PLOT2D_MODE_LOGARITHMIC_VER" :
"ICON_PLOT2D_MODE_LINEAR_VER" ) );
- myActionsMap[VerId]->setIconSet( pix );
+ myActionsMap[VerId]->setIcon( pix );
myActionsMap[VerId]->setToolTip( tr( aLinear ? "TOT_PLOT2D_MODE_LOGARITHMIC_VER" :
"TOT_PLOT2D_MODE_LINEAR_VER" ) );
myActionsMap[VerId]->setStatusTip( tr( aLinear ? "PRP_PLOT2D_MODE_LOGARITHMIC_VER" :
int aCurveType = myViewFrame->getCurveType();
myCurveBtn->SetItem(aCurveType);
- myActionsMap[CurvPointsId]->setOn(aCurveType == 0);
- myActionsMap[CurvLinesId]->setOn(aCurveType == 1);
- myActionsMap[CurvSplinesId]->setOn(aCurveType == 2);
+ myActionsMap[CurvPointsId]->setChecked(aCurveType == 0);
+ myActionsMap[CurvLinesId]->setChecked(aCurveType == 1);
+ myActionsMap[CurvSplinesId]->setChecked(aCurveType == 2);
}
/*!
*/
void Plot2d_ViewWindow::onChangeLegendMode()
{
- myActionsMap[ LegendId ]->setOn(myViewFrame->isLegendShow());
+ myActionsMap[ LegendId ]->setChecked(myViewFrame->isLegendShow());
}
/*!
*/
void Plot2d_ViewWindow::onDumpView()
{
- qApp->postEvent( myViewFrame, new QPaintEvent( QRect( 0, 0, myViewFrame->width(), myViewFrame->height() ), TRUE ) );
+ qApp->postEvent( myViewFrame, new QPaintEvent( QRect( 0, 0, myViewFrame->width(), myViewFrame->height() ) ) );
SUIT_ViewWindow::onDumpView();
}
*/
QImage Plot2d_ViewWindow::dumpView()
{
- if ( getToolBar()->hasMouse() || myDumpImage.isNull() )
+ if ( getToolBar()->underMouse() || myDumpImage.isNull() )
{
QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
- return px.convertToImage();
+ return px.toImage();
}
return myDumpImage;
void Plot2d_ViewWindow::RefreshDumpImage()
{
QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
- myDumpImage = px.convertToImage();
+ myDumpImage = px.toImage();
}
#include "Plot2d.h"
#include <SUIT_ViewWindow.h>
+#include <QMap>
-#include <qimage.h>
#ifdef WIN32
#pragma warning( disable:4251 )
class Plot2d_ViewFrame;
class QtxAction;
class SUIT_ToolButton;
+class QImage;
+class QMenu;
+class QToolBar;
class PLOT2D_EXPORT Plot2d_ViewWindow : public SUIT_ViewWindow
{
void putInfo(QString theMsg);
Plot2d_ViewFrame* getViewFrame() { return myViewFrame; };
QToolBar* getToolBar() { return myToolBar; };
- void contextMenuPopup( QPopupMenu* thePopup );
+ void contextMenuPopup( QMenu* thePopup );
virtual QString getVisualParameters();
virtual void setVisualParameters( const QString& parameters );
virtual void RefreshDumpImage();
+ virtual bool eventFilter(QObject* watched, QEvent* e);
protected:
virtual QImage dumpView();
virtual QString filter() const;
virtual bool dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
-private:
- bool eventFilter(QObject* watched, QEvent* e);
-
void createActions();
void createToolBar();