zoemolly |
2015-04-07 18:56 |
qwt 坐标缩放到默认0-1000
开发环境:vs2008+Qt4.8.5+Qwt6.1.1 问题描述:在显示图像时,初始显示是正确的,当进行放大然后再缩小时,比例尺不会返回到图像的初始状态,而是回到一个固定的状态,X轴,y轴均是0-1000。如下图所示: 开始时: 此时图像显示是正确的; 点击右键缩放时: 此时比例尺不再是原来的比例尺,而变成了0-1000,有人遇到这个问题么?
相关代码的主要部分: measureDataCollect::measureDataCollect(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this);
//图像区域 ui.qwtPlot->setCanvasBackground( QColor( 29,100,141));
//图例 m_legend = new QwtLegend; m_legend->setDefaultItemMode( QwtLegendData::Checkable ); ui.qwtPlot->insertLegend(m_legend,QwtPlot::BottomLegend );
m_grid = new QwtPlotGrid(); m_grid->attach(ui.qwtPlot);
//缩放 QwtPlotZoomer* zoomer = new QwtPlotZoomer( ui.qwtPlot->canvas() ); zoomer->setMousePattern( QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier ); zoomer->setMousePattern( QwtEventPattern::MouseSelect3, Qt::RightButton );
//比例尺 ui.qwtPlot->setAxisScale( QwtPlot::xBottom, 0, 200 ); ui.qwtPlot->setAxisScale( QwtPlot::yLeft, 400, 800 );
QwtPlotCurve *curve = new QwtPlotCurve(); curve->setTitle("11111" ); /*curve->setOrientation( Qt::Vertical );*/ QPolygonF points; int i=10; points << QPointF( 0+i*10, 300+i*10 ) << QPointF( 2.0+i*10, 400+i*10 ) << QPointF( -(1.0+i*50), 312+i*10 ) << QPointF( 0.5+i*10, 446.8+i*10 ) << QPointF( 4.0+i*10, 557.9+i*10 ) << QPointF( 5.0+i*10, 670.1+i*10 ); curve->setSamples(points); curve->attach(ui.qwtPlot); }
楼主遇到同样的问题 求解决方法! |
|