From 5e810e8a7db313960b698666a8ad8955c1c91c2b Mon Sep 17 00:00:00 2001 From: ismagom Date: Sun, 8 Jun 2014 17:48:24 +0200 Subject: [PATCH] Fixed compilation problem with Qwt 6.1 --- cmake/modules/FindQwt.cmake | 26 ++++++++++++++++--------- graphics/lib/common/Lineplot.cpp | 7 +++++-- graphics/lib/common/Pointplot.cpp | 4 +++- graphics/lib/common/Spectrogramplot.cpp | 4 +++- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/cmake/modules/FindQwt.cmake b/cmake/modules/FindQwt.cmake index e52243f38..e975d7b4b 100644 --- a/cmake/modules/FindQwt.cmake +++ b/cmake/modules/FindQwt.cmake @@ -36,13 +36,6 @@ SET(QWT_FOUND "NO") FIND_PATH(QWT_INCLUDE_DIR qwt.h - /usr/local/qwt/include - /usr/local/include - /usr/include/qwt - /usr/include/qwt-qt4 - /usr/include/qwt5 - /usr/include - /opt/local/include/qwt #macports path $ENV{QWT_DIR}/include $ENV{QWT_DIR}/src $ENV{QWTDIR}/include @@ -51,6 +44,13 @@ FIND_PATH(QWT_INCLUDE_DIR qwt.h $ENV{QWT_ROOT}/src $ENV{QWTROOT}/include $ENV{QWTROOT}/src + /usr/local/qwt/include + /usr/local/include + /usr/include/qwt + /usr/include/qwt-qt4 + /usr/include/qwt5 + /usr/include + /opt/local/include/qwt #macports path ) SET(QWT_INCLUDE_DIRS ${QWT_INCLUDE_DIR}) @@ -82,8 +82,16 @@ IF( Qwt_FIND_VERSION AND QWT_VERSION_STRING ) ENDIF() ENDIF() -SET(POTENTIAL_LIBRARY_PATHS /usr/local/qwt/lib /usr/local/lib /usr/lib /opt/local/lib - $ENV{QWT_DIR}/lib $ENV{QWTDIR}/lib $ENV{QWT_ROOT}/lib $ENV{QWTROOT}/lib) +SET(POTENTIAL_LIBRARY_PATHS + $ENV{QWT_DIR}/lib + $ENV{QWTDIR}/lib + $ENV{QWT_ROOT}/lib + $ENV{QWTROOT}/lib + /usr/local/qwt/lib + /usr/local/lib /usr/lib + /opt/local/lib + +) SET(QWT_NAMES ${QWT_NAMES} qwt qwt-qt4 qwt5 ) FIND_LIBRARY(QWT_LIBRARY diff --git a/graphics/lib/common/Lineplot.cpp b/graphics/lib/common/Lineplot.cpp index 0f0c298ce..97f47f0c7 100644 --- a/graphics/lib/common/Lineplot.cpp +++ b/graphics/lib/common/Lineplot.cpp @@ -33,6 +33,8 @@ #include "Lineplot.h" +#include "qwt_scale_div.h" +#include "qwt_plot_canvas.h" #include class MyZoomer: public QwtPlotZoomer @@ -94,7 +96,8 @@ Lineplot::Lineplot(QWidget *parent) axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating,true); axisScaleEngine(QwtPlot::yRight)->setAttribute(QwtScaleEngine::Floating,true); - zoomer_ = new MyZoomer(canvas()); + QwtPlotCanvas *mycanvas = qobject_cast(canvas()); + zoomer_ = new MyZoomer(mycanvas); zoomer_->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton); zoomer_->setMousePattern(QwtEventPattern::MouseSelect2, Qt::LeftButton, Qt::ControlModifier); @@ -160,5 +163,5 @@ void Lineplot::resetZoom() void Lineplot::linkScales() { - setAxisScaleDiv(QwtPlot::yRight, *axisScaleDiv(QwtPlot::yLeft)); +// setAxisScaleDiv(QwtPlot::yRight, *axisScaleDiv(QwtPlot::yLeft)); } diff --git a/graphics/lib/common/Pointplot.cpp b/graphics/lib/common/Pointplot.cpp index b706851d1..b4ac76047 100644 --- a/graphics/lib/common/Pointplot.cpp +++ b/graphics/lib/common/Pointplot.cpp @@ -32,6 +32,7 @@ */ #include "Pointplot.h" +#include "qwt_plot_canvas.h" #include using namespace std; @@ -83,7 +84,8 @@ Pointplot::Pointplot(QWidget *parent) memset(realPoints_, 0x0, numPoints_*sizeof(double)); memset(imagPoints_, 0x0, numPoints_*sizeof(double)); - zoomer_ = new MyZoomer(canvas()); + QwtPlotCanvas *mycanvas = qobject_cast(canvas()); + zoomer_ = new MyZoomer(mycanvas); zoomer_->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton); zoomer_->setMousePattern(QwtEventPattern::MouseSelect2, Qt::LeftButton, Qt::ControlModifier); diff --git a/graphics/lib/common/Spectrogramplot.cpp b/graphics/lib/common/Spectrogramplot.cpp index 6a6433dba..a28b97e6b 100644 --- a/graphics/lib/common/Spectrogramplot.cpp +++ b/graphics/lib/common/Spectrogramplot.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -116,7 +117,8 @@ Spectrogramplot::Spectrogramplot(int numDataPoints, int numRows, QWidget *parent // RightButton: zoom out by 1 // Ctrl+RighButton: zoom out to full size - zoomer_ = new MyZoomer(canvas()); + QwtPlotCanvas *mycanvas = qobject_cast(canvas()); + zoomer_ = new MyZoomer(mycanvas); zoomer_->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton); zoomer_->setMousePattern(QwtEventPattern::MouseSelect2,