--- /dev/null
+
+#include "Plot2d_Legend.h"
+
+#include <qwt_plot.h>
+#include <qwt_legend.h>
+#include <qwt_plot_layout.h>
+#include <qwt_plot_canvas.h>
+#include <qwt_dyngrid_layout.h>
+
+#include <QGridLayout>
+#include <QLayout>
+#include <QScrollArea>
+#include <QScrollBar>
+#include <QEvent>
+#include <QMouseEvent>
+
+/**
+ Constructor
+ @param thePlot the plot that the axis should be assigned to
+*/
+Plot2d_Legend::Plot2d_Legend( QwtPlot* thePlot )
+: QwtLegend( thePlot ),
+ myIsEnabled( false ),
+ myIsOnCanvas( false ),
+ myPosition( Bottom )
+{
+ init();
+ setPlot( thePlot );
+ QwtPlotCanvas* aCanvas = myPlot->canvas();
+ if ( aCanvas )
+ aCanvas->installEventFilter( this );
+}
+
+/**
+ Destructor
+*/
+Plot2d_Legend::~Plot2d_Legend()
+{
+}
+
+/**
+ Fill the initial state of the legend
+*/
+void Plot2d_Legend::init()
+{
+ setFrameStyle( QFrame::Box );
+ setWindowTitle( tr( "LEGEND_TLT" ) );
+}
+
+/**
+ Return the legend position type
+ @return the legend position type
+*/
+Plot2d_Legend::LegendPosition Plot2d_Legend::getPositionType() const
+{
+ return myPosition;
+}
+
+/**
+ Set the legend position type
+ @param thePositionType legend position type
+*/
+void Plot2d_Legend::setPositionType( const LegendPosition& thePositionType )
+{
+ myPosition = thePositionType;
+}
+
+/**
+ Set the legend position type (Embedded or external)
+ @param thePositionType legend position type
+*/
+void Plot2d_Legend::setOnCanvas( bool isOnCanvas )
+{
+ myIsOnCanvas = isOnCanvas;
+}
+
+/**
+ Return true if the legend is shown on plot2d
+ @return true if the legend shown
+*/
+bool Plot2d_Legend::isEnabled() const
+{
+ return myIsEnabled;
+}
+
+/**
+ Show or hide legend
+ @param isEnable if true the legend will be shown
+ @param isUpdate if true the plot2d will be updated
+*/
+void Plot2d_Legend::setEnabled( bool isEnable )
+{
+ myIsEnabled = isEnable;
+ if( myPlot )
+ {
+ if ( myIsEnabled )
+ insertLegend();
+ else if ( myIsOnCanvas ) {
+ hide();
+ } else {
+ myPlot->insertLegend( 0 );
+ }
+ }
+}
+
+
+void Plot2d_Legend::setPlot( QwtPlot* thePlot )
+{
+ if( myPlot )
+ disconnect( myPlot );
+ if( thePlot != NULL )
+ connect( thePlot, SIGNAL(destroyed(QObject*)), this, SLOT(onPlotDestroyed() ) );
+ myPlot = thePlot;
+}
+
+/**
+ SLOT: called when registered plot is destroyed
+*/
+void Plot2d_Legend::onPlotDestroyed()
+{
+ setPlot(NULL);
+ deleteLater();
+}
+
+/*!
+ Adjust contents widget and item layout to the size of the viewport().
+*/
+void Plot2d_Legend::layoutContents()
+{
+ QWidget* aContents = contentsWidget();
+ if ( !aContents )
+ return;
+
+ // the qwt functionality of calculation the content of the legend use visible size and the legend could not be
+ // less than the visible size, so the legend's size is grown but can not be reduced. The behaviour is corrected here.
+ QSize aPrevSize = size();
+ const QLayout* aLay = aContents->layout();
+ if ( aLay && aLay->inherits( "QwtDynGridLayout" ) ) {
+ const QwtDynGridLayout* aDynLay = ( const QwtDynGridLayout* )aLay;
+ int aWidth = int( aDynLay->maxItemWidth() ) + 2*aDynLay->margin();
+ QSize aSize = QSize( aWidth, aDynLay->heightForWidth( aWidth ) );
+ aContents->resize( aSize );
+
+ if ( !aSize.isEmpty() )
+ aSize = correctContentSize( aSize );
+ resize( aSize );
+ updateLegendPosition();
+ }
+}
+
+/**
+ Return if the given point belongs to axis
+ @param thePoint the point to be checked
+ @return if point belongs to axis
+*/
+bool Plot2d_Legend::pick( const QPoint& thePoint ) const
+{
+ if( !myPlot || !isEnabled() )
+ return false;
+
+ return frameRect().contains( thePoint );
+}
+
+/**
+ Return the parent class for the legend to be attached to in the standard position type
+ @return legend font
+*/
+QWidget* Plot2d_Legend::parentToAttach() const
+{
+ return myPlot ? myPlot->canvas() : NULL;
+}
+
+/**
+ Insert legend in the plot widget
+*/
+void Plot2d_Legend::insertLegend()
+{
+ if( !myPlot )
+ return;
+
+ //It's workaround - the legend should totaly rebuilded
+ //But if the plot is the same the legend doesn't rebuilded
+ if( myIsOnCanvas ) {
+ myPlot->insertLegend( this, QwtPlot::ExternalLegend );
+ setParent( parentToAttach() );
+ layoutContents();
+ updateLegendPosition();
+ show();
+ } else {
+ setParent( myPlot );
+ myPlot->insertLegend( this, qwtLegendPosition() );
+ }
+}
+
+/**
+ Update legend position taking into account the position type
+*/
+void Plot2d_Legend::updateLegendPosition()
+{
+ if ( !parentWidget() )
+ return;
+
+ QRect aRect = parentWidget()->contentsRect();
+ int aX = aRect.x();
+ int anY = aRect.y();
+ switch( myPosition ) {
+ case TopLeft:
+ break;
+ case BottomLeft:
+ anY = anY + aRect.height() - height();
+ break;
+ case Top:
+ case Bottom: {
+ aX = aX + aRect.width()/2 - width()/2;
+ if ( myPosition == Bottom )
+ anY = anY + aRect.height() - height();
+ }
+ break;
+ case TopRight:
+ case BottomRight: {
+ aX = aX + aRect.width() - width();
+ if ( myPosition == BottomRight )
+ anY = anY + aRect.height() - height();
+ }
+ break;
+ case Left:
+ case Right: {
+ anY = anY + aRect.height()/2 - height()/2;
+ if ( myPosition == Right )
+ aX = aX + aRect.width() - width();
+ }
+ break;
+ default:
+ break;
+ }
+ move( aX, anY );
+}
+
+/**
+ Correct the content size according to the parent widget size
+ @param theSize the size to be corrected
+ @return the rectangle
+*/
+QSize Plot2d_Legend::correctContentSize( const QSize& theSize ) const
+{
+ if ( !myPlot || theSize.width() <=0 || theSize.height() <= 0 )
+ return theSize;
+
+ QWidget* aCont = const_cast<QWidget*>( contentsWidget() );
+ if ( !myPlot || !aCont )
+ return theSize;
+
+ int aWidth = theSize.width();
+ int aHeight = theSize.height();
+
+ if ( parentWidget() ) {
+ int aCw = theSize.width();
+ int aCh = theSize.height();
+
+ QRect aBoundRect = parentWidget()->contentsRect();
+ int aPw = aBoundRect.width();
+ int aPh = aBoundRect.height();
+
+ aWidth = qMin( aPw, aCw );
+ aHeight = qMin( aPh, aCh );
+
+ // correction the legend width
+ if ( aPw > aCw ) {
+ aWidth = aCw;
+ if ( aCh > aPh ) {
+ QScrollBar* aScroll = new QScrollBar( Qt::Horizontal );
+ aWidth += aScroll->sizeHint().height();
+ aHeight = aPh;
+ delete aScroll;
+ }
+ }
+ // correction the legend height
+ if ( aPh > aCh ) {
+ aHeight = aCh;
+ if ( aCw > aPw ) {
+ QScrollBar* aScroll = new QScrollBar( Qt::Vertical );
+ aHeight += aScroll->sizeHint().width();
+ aWidth = aPw;
+ delete aScroll;
+ }
+ }
+ }
+ int aFrameW = 2*frameWidth();
+ aWidth += aFrameW;
+ aHeight += aFrameW;
+
+ return QSize( aWidth, aHeight );
+}
+
+QwtPlot::LegendPosition Plot2d_Legend::qwtLegendPosition()
+{
+ QwtPlot::LegendPosition result;
+ switch ( myPosition ) {
+ case Plot2d_Legend::Left:
+ result = QwtPlot::LeftLegend;
+ break;
+ case Plot2d_Legend::Right:
+ result = QwtPlot::RightLegend;
+ break;
+ case Plot2d_Legend::Top:
+ result = QwtPlot::TopLegend;
+ break;
+ case Plot2d_Legend::Bottom:
+ result = QwtPlot::BottomLegend;
+ break;
+ default:
+ result = QwtPlot::BottomLegend;
+ break;
+ }
+ return result;
+}
+
+/**
+ Reimplementation of event filter (cavas actions process to calculate position of the legend)
+ @param theObj the object whose events are handled
+ @param theEvent the event instance
+ @return if event if handled by this event filter
+*/
+bool Plot2d_Legend::eventFilter( QObject *theObj, QEvent *theEvent )
+{
+ bool isProcessed = QwtLegend::eventFilter( theObj, theEvent );
+ if ( myPlot && myIsOnCanvas && theObj == parentToAttach() ) {
+ if ( theEvent->type() == QEvent::Resize ) {
+ layoutContents();
+ updateLegendPosition();
+ }
+ }
+ return isProcessed;
+}
--- /dev/null
+
+#ifndef PLOT2D_LEGEND_H
+#define PLOT2D_LEGEND_H
+
+#include "Plot2d.h"
+#include <qwt_legend.h>
+#include <qwt_plot.h>
+
+class QAction;
+
+class PLOT2D_EXPORT Plot2d_Legend : public QwtLegend
+{
+ Q_OBJECT
+
+public:
+ /** The legend position relative to the canvas */
+ enum LegendPosition { Bottom = 0, Top = 1, Right = 2, Left = 3,
+ TopLeft = 4, TopRight = 5, BottomLeft = 6, BottomRight = 7 };
+
+ Plot2d_Legend( QwtPlot* thePlot );
+ virtual ~Plot2d_Legend();
+
+ void init();
+
+ LegendPosition getPositionType() const;
+ void setPositionType( const LegendPosition& thePosition );
+
+ bool isEnabled() const;
+ void setEnabled( bool isEnable );
+
+ void setOnCanvas( bool );
+
+ virtual void setPlot( QwtPlot* thePlot );
+
+ virtual bool eventFilter( QObject* theObj, QEvent* theEvent );
+
+protected slots:
+ void onPlotDestroyed();
+
+protected:
+ virtual void layoutContents();
+
+ virtual bool pick( const QPoint& thePoint ) const;
+
+ QWidget* parentToAttach() const;
+
+ void insertLegend();
+ void updateLegendPosition();
+ QSize correctContentSize( const QSize& theSize ) const;
+
+private:
+ QwtPlot::LegendPosition qwtLegendPosition();
+
+private:
+ bool myIsEnabled;
+ bool myIsOnCanvas;
+ LegendPosition myPosition;
+ QwtPlot* myPlot;
+};
+
+#endif
// legend
myLegendCheck = new QCheckBox( tr( "PLOT2D_ENABLE_LEGEND" ), this );
+ myLegendTypeCombo = new QComboBox( this );
+ myLegendTypeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myLegendTypeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
+ myLegendTypeCombo->addItem( tr("PLOT2D_EXTERNAL") );
+ myLegendTypeCombo->addItem( tr("PLOT2D_EMBEDDED") );
myLegendCombo = new QComboBox( this );
myLegendCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myLegendCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- 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" ) );
+ onLegendTypeChanged();
// marker size
QLabel* aMarkerLab = new QLabel( tr( "PLOT2D_MARKER_SIZE_LBL" ), this );
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 );
+ topLayout->addWidget( myLegendCheck, 2, 0 );
+ topLayout->addWidget( myLegendTypeCombo, 2, 1 );
+ topLayout->addWidget( myLegendCombo, 2, 2, 1, 1 );
+ topLayout->addWidget( aMarkerLab, 3, 0 );
+ topLayout->addWidget( myMarkerSpin, 3, 1 );
QHBoxLayout* bgLayout = new QHBoxLayout;
- bgLayout->addWidget( myBackgroundBtn ); bgLayout->addStretch();
- 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 );
+ bgLayout->addWidget( myBackgroundBtn );
+ bgLayout->addStretch();
+ topLayout->addWidget( aBGLab, 3, 2 );
+ topLayout->addLayout( bgLayout, 3, 3 );
+ topLayout->addWidget( aScaleGrp, 4, 0, 1, 4 );
+ topLayout->addWidget( aTabWidget, 5, 0, 1, 4 );
+ topLayout->addWidget( myDefCheck, 6, 0, 1, 4 );
topLayout->setRowStretch( 5, 5 );
- topLayout->addLayout( btnLayout, 6, 0, 1, 4 );
+ topLayout->addLayout( btnLayout, 7, 0, 1, 4 );
if ( !showDefCheck )
myDefCheck->hide();
connect( myY2GridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMajorChecked() ) );
connect( myY2MinGridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMinorChecked() ) );
}
+ connect( myLegendTypeCombo, SIGNAL( activated ( int ) ), this, SLOT( onLegendTypeChanged() ) );
+
// init fields
setBackgroundColor( Qt::gray );
onLegendChecked();
}
+/*!
+ \brief Set legend on canvas.
+ \param if \c true legend is on canvas (embedded)
+ \sa isLegendEnabled(), getLegendPos()
+*/
+void Plot2d_SetupViewDlg::setLegendOnCanvas( bool isOn )
+{
+ myLegendTypeCombo->setCurrentIndex( isOn ? 1 /*Embedded*/ : 0 /*External*/ );
+ onLegendTypeChanged();
+}
+
+bool Plot2d_SetupViewDlg::isLegendOnCanvas()
+{
+ return myLegendTypeCombo->currentIndex() == 1;
+}
+
+
/*!
\brief Check if legend is enabled.
\return \c true if legend is enabled
void Plot2d_SetupViewDlg::onLegendChecked()
{
myLegendCombo->setEnabled( myLegendCheck->isChecked() );
+ myLegendTypeCombo->setEnabled( myLegendCheck->isChecked() );
}
/*!
{
}
+void Plot2d_SetupViewDlg::onLegendTypeChanged()
+{
+ if( !myLegendTypeCombo )
+ return;
+ int idx = myLegendCombo->currentIndex();
+ myLegendCombo->clear();
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOM" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_TOP" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_RIGHT" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_LEFT" ) );
+ if( myLegendTypeCombo->currentIndex() == 1 ) { //Embedded
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_TOPLEFT" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_TOPRIGHT" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOMLEFT" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOMRIGHT" ) );
+ }
+ if( idx >= myLegendCombo->count() )
+ idx = 0;
+ myLegendCombo->setCurrentIndex( idx );
+}
+
/*!
\brief Get "Set settings as default" check box value.
\return \c true if "Set settings as default" check box is on
void setLegend( bool, int );
bool isLegendEnabled();
+ void setLegendOnCanvas( bool );
+ bool isLegendOnCanvas();
int getLegendPos();
void setMarkerSize( const int );
void onYGridMinorChecked();
void onY2GridMinorChecked();
void onHelp();
+ void onLegendTypeChanged();
private:
QCheckBox* myTitleCheck;
QSpinBox* myY2MinGridSpin;
QComboBox* myCurveCombo;
QCheckBox* myLegendCheck;
+ QComboBox* myLegendTypeCombo;
QComboBox* myLegendCombo;
QSpinBox* myMarkerSpin;
QComboBox* myXModeCombo;
#include "Plot2d_ViewWindow.h"
#include "Plot2d_SetupViewDlg.h"
#include "Plot2d_ToolTip.h"
+#include "Plot2d_Legend.h"
#include "SUIT_Tools.h"
#include "SUIT_Session.h"
: QWidget (parent, 0),
myOperation( NoOpId ),
myCurveType( 1 ),
- myShowLegend( true ), myLegendPos( 1 ),
+ myShowLegend( true ), myLegendPos( 1 ), myIsLegendOnCanvas( false ),
myMarkerSize( DEFAULT_MARKER_SIZE ),
myBackground( Qt::white ),
myTitle( "" ), myXTitle( "" ), myYTitle( "" ), myY2Title( "" ),
setVerScaleMode( myYMode, false );
setBackgroundColor( myBackground );
setLegendPos( myLegendPos );
- showLegend( myShowLegend, false );
+ showLegend( myShowLegend, true );
myPlot->replot();
if ( parent ) {
setCurveType( resMgr->integerValue( "Plot2d", "CurveType", myCurveType ) );
myShowLegend = resMgr->booleanValue( "Plot2d", "ShowLegend", myShowLegend );
+ myIsLegendOnCanvas = resMgr->booleanValue( "Plot2d", "IsLegendOnCanvas", myIsLegendOnCanvas );
myLegendPos = resMgr->integerValue( "Plot2d", "LegendPos", myLegendPos );
myMarkerSize = resMgr->integerValue( "Plot2d", "MarkerSize", myMarkerSize );
myBackground = resMgr->colorValue( "Plot2d", "Background", myBackground );
resMgr->setValue( "Plot2d", "CurveType", myCurveType );
resMgr->setValue( "Plot2d", "ShowLegend", myShowLegend );
+ resMgr->setValue( "Plot2d", "IsLegendOnCanvas", myIsLegendOnCanvas );
resMgr->setValue( "Plot2d", "LegendPos", myLegendPos );
resMgr->setValue( "Plot2d", "MarkerSize", myMarkerSize );
resMgr->setValue( "Plot2d", "Background", myBackground );
if (mySecondY)
dlg->setY2Title( myY2TitleEnabled, myY2Title );
dlg->setCurveType( myCurveType );
+ dlg->setLegendOnCanvas( myIsLegendOnCanvas );
dlg->setLegend( myShowLegend, myLegendPos );
dlg->setMarkerSize( myMarkerSize );
dlg->setBackgroundColor( myBackground );
myYGridMinorEnabled, myPlot->axisMaxMinor( QwtPlot::yLeft ),
myY2GridMinorEnabled, myPlot->axisMaxMinor( QwtPlot::yRight ) );
if ( dlg->exec() == QDialog::Accepted ) {
+
// horizontal axis title
setTitle( dlg->isXTitleEnabled(), dlg->getXTitle(), XTitle, false );
// vertical left axis title
if ( myCurveType != dlg->getCurveType() ) {
setCurveType( dlg->getCurveType(), false );
}
- // legend
- if ( myShowLegend != dlg->isLegendEnabled() ) {
- showLegend( dlg->isLegendEnabled(), false );
- }
- if ( myLegendPos != dlg->getLegendPos() ) {
- setLegendPos( dlg->getLegendPos() );
- }
+
+ // Set legend props
+ myIsLegendOnCanvas = dlg->isLegendOnCanvas();
+ setLegendPos( dlg->getLegendPos() );
+ //Show/Hide or just update it
+ showLegend( dlg->isLegendEnabled(), true );
+
// marker size
if ( myMarkerSize != dlg->getMarkerSize() ) {
setMarkerSize( dlg->getMarkerSize(), false );
void Plot2d_ViewFrame::showLegend( bool show, bool update )
{
myShowLegend = show;
- if ( myShowLegend ) {
- QwtLegend* legend = myPlot->legend();
- if ( !legend ) {
- legend = new QwtLegend( myPlot );
- legend->setFrameStyle( QFrame::Box | QFrame::Sunken );
+ Plot2d_Legend* aLegend = myPlot->getLegend();
+ if( !aLegend ) {
+ QwtLegend* anOldLegend = myPlot->legend();
+ if( anOldLegend ){
+ myPlot->insertLegend(0);
+ anOldLegend->deleteLater();
}
- legend->setItemMode( QwtLegend::ClickableItem );
- myPlot->insertLegend( legend );
- setLegendPos( myLegendPos );
+ aLegend = new Plot2d_Legend( myPlot );
+ aLegend->setItemMode( Plot2d_Legend::ClickableItem );
}
- else
- myPlot->insertLegend( 0 );
+ if( !myIsLegendOnCanvas )
+ myPlot->insertLegend( aLegend );
+ setLegendPos( myLegendPos );
+ aLegend->setEnabled( show );
+
if ( update )
myPlot->replot();
}
/*!
- Sets legend position : 0 - left, 1 - right, 2 - top, 3 - bottom
+ Sets legend position : Bottom 0, Top = 1, Right = 2, Left = 3,
+ TopLeft = 4, TopRight = 5, BottomLeft = 6, BottomRight = 7
*/
void Plot2d_ViewFrame::setLegendPos( int pos )
{
myLegendPos = pos;
- QwtLegend* legend = myPlot->legend();
- switch( pos ) {
- case 0:
- myPlot->insertLegend( legend, QwtPlot::LeftLegend );
- break;
- case 1:
- myPlot->insertLegend( legend, QwtPlot::RightLegend );
- break;
- case 2:
- myPlot->insertLegend( legend, QwtPlot::TopLegend );
- break;
- case 3:
- myPlot->insertLegend( legend, QwtPlot::BottomLegend );
- break;
- }
+ Plot2d_Legend* legend = myPlot->getLegend();
+ if( !legend )
+ return;
+ legend->setOnCanvas( myIsLegendOnCanvas );
+ legend->setPositionType( static_cast<Plot2d_Legend::LegendPosition>( pos ) );
}
/*!
QwtPlot::replot();
}
+/*
+ * Returns legend.
+ */
+Plot2d_Legend* Plot2d_Plot2d::getLegend()
+{
+#if QWT_VERSION < 0x040200
+ return d_legend;
+#else
+ return dynamic_cast<Plot2d_Legend*>( legend() );
+#endif
+}
+
/*!
\return the default layout behavior of the widget
*/
myCurveType = vf->myCurveType;
myShowLegend = vf->myShowLegend;
+ myIsLegendOnCanvas = vf->myIsLegendOnCanvas;
myLegendPos = vf->myLegendPos;
myMarkerSize = vf->myMarkerSize;
myBackground = vf->myBackground;
if ( ce->type() == FITALL_EVENT )
fitAll();
}
+
+
class Plot2d_Plot2d;
class Plot2d_Prs;
class Plot2d_SetupViewDlg;
+class Plot2d_Legend;
class QCustomEvent;
class QwtPlotCurve;
class QwtPlotGrid;
void vpCurveChanged();
void contextMenuRequested( QContextMenuEvent *e );
+private:
+ void setExternalLegendPos( int );
+
protected:
Plot2d_Plot2d* myPlot;
int myOperation;
int myCurveType;
bool myShowLegend;
+ bool myIsLegendOnCanvas;
int myLegendPos;
int myMarkerSize;
QColor myBackground;
void setLogScale( int axisId, bool log10 );
- void replot();
- QwtLegend* getLegend() {
-#if QWT_VERSION < 0x040200
- return d_legend;
-#else
- return legend(); /* mpv: porting to the Qwt 4.2.0 */
-#endif
- }
+ void replot();
+ Plot2d_Legend* getLegend();
+
virtual QSize sizeHint() const;
virtual QSizePolicy sizePolicy() const;
virtual QSize minimumSizeHint() const;
<source>PLOT2D_LEGEND_POSITION_RIGHT</source>
<translation>Right</translation>
</message>
+ <message>
+ <source>PLOT2D_LEGEND_POSITION_TOPLEFT</source>
+ <translation>Top Left</translation>
+ </message>
+ <message>
+ <source>PLOT2D_LEGEND_POSITION_TOPRIGHT</source>
+ <translation>Top Right</translation>
+ </message>
+ <message>
+ <source>PLOT2D_LEGEND_POSITION_BOTTOMLEFT</source>
+ <translation>Bottom Left</translation>
+ </message>
+ <message>
+ <source>PLOT2D_LEGEND_POSITION_BOTTOMRIGHT</source>
+ <translation>Bottom Right</translation>
+ </message>
+ <message>
+ <source>PLOT2D_EXTERNAL</source>
+ <translation>External</translation>
+ </message>
+ <message>
+ <source>PLOT2D_EMBEDDED</source>
+ <translation>Embedded</translation>
+ </message>
<message>
<source>DSC_DUMP_VIEW</source>
<translation>Saves the active view in the image file</translation>