From dc01602093b51e9338e12fa28219d4056c6d4368 Mon Sep 17 00:00:00 2001 From: Paul Sutton Date: Thu, 12 Jun 2014 09:59:21 +0100 Subject: [PATCH] Adding support for Qwt6.1 --- cmake/modules/FindQwt.cmake | 47 +++++++++++++++---------- graphics/lib/common/Lineplot.cpp | 6 +++- graphics/lib/common/Pointplot.cpp | 2 +- graphics/lib/common/Spectrogramplot.cpp | 3 +- graphics/lib/common/plot.cpp | 1 + 5 files changed, 38 insertions(+), 21 deletions(-) diff --git a/cmake/modules/FindQwt.cmake b/cmake/modules/FindQwt.cmake index e52243f38..3ed74cff7 100644 --- a/cmake/modules/FindQwt.cmake +++ b/cmake/modules/FindQwt.cmake @@ -35,22 +35,25 @@ SET(QWT_FOUND "NO") +SET(HINT_INCLUDE_PATHS $ENV{QWT_DIR}/include + $ENV{QWT_DIR}/src + $ENV{QWTDIR}/include + $ENV{QWTDIR}/src + $ENV{QWT_ROOT}/include + $ENV{QWT_ROOT}/src + $ENV{QWTROOT}/include + $ENV{QWTROOT}/src) +SET(POTENTIAL_INCLUDE_PATHS /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 + 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 - $ENV{QWTDIR}/src - $ENV{QWT_ROOT}/include - $ENV{QWT_ROOT}/src - $ENV{QWTROOT}/include - $ENV{QWTROOT}/src + HINTS ${HINT_INCLUDE_PATHS} + PATHS ${POTENTIAL_INCLUDE_PATHS} ) SET(QWT_INCLUDE_DIRS ${QWT_INCLUDE_DIR}) @@ -82,12 +85,19 @@ 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(QWT_NAMES ${QWT_NAMES} qwt qwt-qt4 qwt5 ) +SET(HINT_LIBRARY_PATHS $ENV{QWT_DIR}/lib + $ENV{QWTDIR}/lib + $ENV{QWT_ROOT}/lib + $ENV{QWTROOT}/lib) +SET(POTENTIAL_LIBRARY_PATHS /usr/local/qwt/lib + /usr/local/lib + /usr/lib + /opt/local/lib) + FIND_LIBRARY(QWT_LIBRARY NAMES ${QWT_NAMES} + HINTS ${HINT_LIBRARY_PATHS} PATHS ${POTENTIAL_LIBRARY_PATHS} ) MARK_AS_ADVANCED(QWT_LIBRARY) @@ -99,6 +109,7 @@ IF (QWT_LIBRARY) SET(QWT_NAMES_DEBUG qwtd qwtd-qt4 qwtd5 ) FIND_LIBRARY(QWT_LIBRARY_DEBUG NAMES ${QWT_NAMES_DEBUG} + HINTS ${HINT_LIBRARY_PATHS} PATHS ${POTENTIAL_LIBRARY_PATHS} ) MARK_AS_ADVANCED(QWT_LIBRARY_DEBUG) diff --git a/graphics/lib/common/Lineplot.cpp b/graphics/lib/common/Lineplot.cpp index 0f0c298ce..5fec806a9 100644 --- a/graphics/lib/common/Lineplot.cpp +++ b/graphics/lib/common/Lineplot.cpp @@ -94,7 +94,7 @@ Lineplot::Lineplot(QWidget *parent) axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating,true); axisScaleEngine(QwtPlot::yRight)->setAttribute(QwtScaleEngine::Floating,true); - zoomer_ = new MyZoomer(canvas()); + zoomer_ = new MyZoomer(qobject_cast(canvas())); zoomer_->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton); zoomer_->setMousePattern(QwtEventPattern::MouseSelect2, Qt::LeftButton, Qt::ControlModifier); @@ -160,5 +160,9 @@ void Lineplot::resetZoom() void Lineplot::linkScales() { +#if QWT_VERSION < 0x060100 setAxisScaleDiv(QwtPlot::yRight, *axisScaleDiv(QwtPlot::yLeft)); +#else // QWT_VERSION < 0x060100 + setAxisScaleDiv(QwtPlot::yRight, axisScaleDiv(QwtPlot::yLeft)); +#endif // QWT_VERSION < 0x060100 } diff --git a/graphics/lib/common/Pointplot.cpp b/graphics/lib/common/Pointplot.cpp index b706851d1..aeb7b9098 100644 --- a/graphics/lib/common/Pointplot.cpp +++ b/graphics/lib/common/Pointplot.cpp @@ -83,7 +83,7 @@ Pointplot::Pointplot(QWidget *parent) memset(realPoints_, 0x0, numPoints_*sizeof(double)); memset(imagPoints_, 0x0, numPoints_*sizeof(double)); - zoomer_ = new MyZoomer(canvas()); + zoomer_ = new MyZoomer(qobject_cast(canvas())); 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..596f888e0 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,7 @@ Spectrogramplot::Spectrogramplot(int numDataPoints, int numRows, QWidget *parent // RightButton: zoom out by 1 // Ctrl+RighButton: zoom out to full size - zoomer_ = new MyZoomer(canvas()); + zoomer_ = new MyZoomer(qobject_cast(canvas())); zoomer_->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton); zoomer_->setMousePattern(QwtEventPattern::MouseSelect2, diff --git a/graphics/lib/common/plot.cpp b/graphics/lib/common/plot.cpp index 08e2faae3..0b2b82834 100644 --- a/graphics/lib/common/plot.cpp +++ b/graphics/lib/common/plot.cpp @@ -61,5 +61,6 @@ void plot_exit() { if (plot_initiated) { pthread_cancel(thread); } + plot_initiated=0; }