Index: /trunk/BNC/CHANGELOG.md
===================================================================
--- /trunk/BNC/CHANGELOG.md	(revision 11157)
+++ /trunk/BNC/CHANGELOG.md	(revision 11158)
@@ -83,4 +83,8 @@
 - CHANGED: Linux build with stack protector, bounds-checked std containers (_GLIBCXX_ASSERTIONS) and read-only relocations, independent of the distribution's compiler defaults
 - ADDED: Option 'Credentials files' (key credentialsFile): passwords of Ntrip Broadcasters can be kept in credentials files instead of the configuration file, in netrc format ('machine host[:port] login user password secret', default $NETRC or ~/.netrc) or BNC format ('host port|* user|- password'); several users per host, URLs without user stay anonymous, passwords in the configuration file are used as before
+- FIXED: Ephemerides read from RINEX navigation files (GPS, QZSS, NavIC, Galileo, SBAS, BDS): fields not contained in the record type (e.g. IODE of GPS CNAV) were not initialized; depending on memory content, data sets could be rated WRONG in the RINEX QC
+- CHANGED: Deprecated Qt functions replaced (QRegExp, QFontMetrics::width, QLayout::setMargin, QPrinter::pageRect/paperRect, recursive QMutex); BNC is built with QT_DISABLE_DEPRECATED_BEFORE=0x050F00
+- CHANGED: Qwt updated from 6.1.6 to 6.3.0, which includes the polar plots (separate QwtPolar 1.1.1 library removed); Qwt is used unmodified
+- FIXED: Environment variables in paths: only one ${NAME} per path was replaced correctly (e.g. '${HOME}/${STATION}' failed); now all of them, BNC's placeholders ${V3PROD}, ${V3OBS} and ${GPSWD} are kept
 
 ## 2.13.7 (2026-07-31)
Index: /trunk/BNC/bnc.pro
===================================================================
--- /trunk/BNC/bnc.pro	(revision 11157)
+++ /trunk/BNC/bnc.pro	(revision 11158)
@@ -9,4 +9,3 @@
 SUBDIRS = newmat   \
           qwt      \
-          qwtpolar \
           src
Index: /trunk/BNC/bnc_plugin.pro
===================================================================
--- /trunk/BNC/bnc_plugin.pro	(revision 11157)
+++ /trunk/BNC/bnc_plugin.pro	(revision 11158)
@@ -6,4 +6,3 @@
 SUBDIRS = newmat   \
           qwt      \
-          qwtpolar \
           src/src_plugin.pro
Index: /trunk/BNC/docker/Dockerfile.alpine
===================================================================
--- /trunk/BNC/docker/Dockerfile.alpine	(revision 11157)
+++ /trunk/BNC/docker/Dockerfile.alpine	(revision 11158)
@@ -6,5 +6,4 @@
 COPY newmat /tmp/BNC/newmat/
 COPY qwt /tmp/BNC/qwt/
-COPY qwtpolar /tmp/BNC/qwtpolar/
 COPY src /tmp/BNC/src/
 
Index: /trunk/BNC/docker/Dockerfile.bookworm
===================================================================
--- /trunk/BNC/docker/Dockerfile.bookworm	(revision 11157)
+++ /trunk/BNC/docker/Dockerfile.bookworm	(revision 11158)
@@ -16,5 +16,4 @@
 COPY newmat /tmp/BNC/newmat/
 COPY qwt /tmp/BNC/qwt/
-COPY qwtpolar /tmp/BNC/qwtpolar/
 COPY src /tmp/BNC/src/
 
Index: /trunk/BNC/docker/Dockerfile.bullseye
===================================================================
--- /trunk/BNC/docker/Dockerfile.bullseye	(revision 11157)
+++ /trunk/BNC/docker/Dockerfile.bullseye	(revision 11158)
@@ -16,5 +16,4 @@
 COPY newmat /tmp/BNC/newmat/
 COPY qwt /tmp/BNC/qwt/
-COPY qwtpolar /tmp/BNC/qwtpolar/
 COPY src /tmp/BNC/src/
 
Index: /trunk/BNC/docker/Dockerfile.buster
===================================================================
--- /trunk/BNC/docker/Dockerfile.buster	(revision 11157)
+++ /trunk/BNC/docker/Dockerfile.buster	(revision 11158)
@@ -16,5 +16,4 @@
 COPY newmat /tmp/BNC/newmat/
 COPY qwt /tmp/BNC/qwt/
-COPY qwtpolar /tmp/BNC/qwtpolar/
 COPY src /tmp/BNC/src/
 
Index: /trunk/BNC/docker/Dockerfile.centos7
===================================================================
--- /trunk/BNC/docker/Dockerfile.centos7	(revision 11157)
+++ /trunk/BNC/docker/Dockerfile.centos7	(revision 11158)
@@ -12,5 +12,4 @@
 COPY newmat /tmp/BNC/newmat/
 COPY qwt /tmp/BNC/qwt/
-COPY qwtpolar /tmp/BNC/qwtpolar/
 COPY src /tmp/BNC/src/
 
Index: /trunk/BNC/docker/Dockerfile.leap
===================================================================
--- /trunk/BNC/docker/Dockerfile.leap	(revision 11157)
+++ /trunk/BNC/docker/Dockerfile.leap	(revision 11158)
@@ -13,5 +13,4 @@
 COPY newmat /tmp/BNC/newmat/
 COPY qwt /tmp/BNC/qwt/
-COPY qwtpolar /tmp/BNC/qwtpolar/
 COPY src /tmp/BNC/src/
 
Index: /trunk/BNC/docker/Dockerfile.rocky9
===================================================================
--- /trunk/BNC/docker/Dockerfile.rocky9	(revision 11157)
+++ /trunk/BNC/docker/Dockerfile.rocky9	(revision 11158)
@@ -12,5 +12,4 @@
 COPY newmat /tmp/BNC/newmat/
 COPY qwt /tmp/BNC/qwt/
-COPY qwtpolar /tmp/BNC/qwtpolar/
 COPY src /tmp/BNC/src/
 
Index: /trunk/BNC/docker/Dockerfile.trixie
===================================================================
--- /trunk/BNC/docker/Dockerfile.trixie	(revision 11157)
+++ /trunk/BNC/docker/Dockerfile.trixie	(revision 11158)
@@ -15,5 +15,4 @@
 COPY newmat /tmp/BNC/newmat/
 COPY qwt /tmp/BNC/qwt/
-COPY qwtpolar /tmp/BNC/qwtpolar/
 COPY src /tmp/BNC/src/
 
Index: /trunk/BNC/docker/Dockerfile.ubi8
===================================================================
--- /trunk/BNC/docker/Dockerfile.ubi8	(revision 11157)
+++ /trunk/BNC/docker/Dockerfile.ubi8	(revision 11158)
@@ -12,5 +12,4 @@
 COPY newmat /tmp/BNC/newmat/
 COPY qwt /tmp/BNC/qwt/
-COPY qwtpolar /tmp/BNC/qwtpolar/
 COPY src /tmp/BNC/src/
 
Index: /trunk/BNC/qwt/qwt.cpp
===================================================================
--- /trunk/BNC/qwt/qwt.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt.cpp	(revision 11158)
@@ -0,0 +1,28 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt.h"
+#include <qapplication.h>
+
+#define QWT_GLOBAL_STRUT
+
+#if QT_VERSION >= 0x050000
+    #if QT_VERSION >= 0x060000 || !QT_DEPRECATED_SINCE(5, 15)
+        #undef QWT_GLOBAL_STRUT
+    #endif
+#endif
+
+QSize qwtExpandedToGlobalStrut( const QSize& size )
+{
+#ifdef QWT_GLOBAL_STRUT
+    return size.expandedTo( QApplication::globalStrut() );
+#else
+    return size;
+#endif
+}
Index: /trunk/BNC/qwt/qwt.h
===================================================================
--- /trunk/BNC/qwt/qwt.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,10 +13,14 @@
 #include "qwt_global.h"
 
+class QSize;
+
 /*!
-  Some constants for use within Qwt.
-*/
+   Some constants for use within Qwt.
+ */
 namespace Qwt
 {
 }
 
+QWT_EXPORT QSize qwtExpandedToGlobalStrut( const QSize& );
+
 #endif
Index: /trunk/BNC/qwt/qwt.pro
===================================================================
--- /trunk/BNC/qwt/qwt.pro	(revision 11157)
+++ /trunk/BNC/qwt/qwt.pro	(revision 11158)
@@ -7,5 +7,5 @@
 CONFIG -= debug
 CONFIG += release
-QWT_CONFIG = QwtPlot QwtWidgets QwtSvg
+QWT_CONFIG = QwtPlot QwtPolar QwtWidgets QwtSvg
 
 OBJECTS_DIR = .obj
Index: /trunk/BNC/qwt/qwt_abstract_legend.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_abstract_legend.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_abstract_legend.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,12 +9,13 @@
 
 #include "qwt_abstract_legend.h"
+#include "qwt_legend_data.h"
 
 /*!
-  Constructor
+   Constructor
 
-  \param parent Parent widget
-*/
-QwtAbstractLegend::QwtAbstractLegend( QWidget *parent ):
-    QFrame( parent )
+   \param parent Parent widget
+ */
+QwtAbstractLegend::QwtAbstractLegend( QWidget* parent )
+    : QFrame( parent )
 {
 }
@@ -31,5 +32,5 @@
    \param orientation Orientation
    \return Extent of the corresponding scroll element
-*/
+ */
 int QwtAbstractLegend::scrollExtent( Qt::Orientation orientation ) const
 {
@@ -37,2 +38,4 @@
     return 0;
 }
+
+#include "moc_qwt_abstract_legend.cpp"
Index: /trunk/BNC/qwt/qwt_abstract_legend.h
===================================================================
--- /trunk/BNC/qwt/qwt_abstract_legend.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_abstract_legend.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,17 +12,17 @@
 
 #include "qwt_global.h"
-#include "qwt_legend_data.h"
 #include <qframe.h>
-#include <qlist.h>
 
+class QwtLegendData;
+template< typename T > class QList;
 class QVariant;
 
 /*!
-  \brief Abstract base class for legend widgets
+   \brief Abstract base class for legend widgets
 
-  Legends, that need to be under control of the QwtPlot layout system
-  need to be derived from QwtAbstractLegend.
+   Legends, that need to be under control of the QwtPlot layout system
+   need to be derived from QwtAbstractLegend.
 
-  \note Other type of legends can be implemented by connecting to
+   \note Other type of legends can be implemented by connecting to
         the QwtPlot::legendDataChanged() signal. But as these legends
         are unknown to the plot layout system the layout code
@@ -30,5 +30,5 @@
         in application code.
 
-  \sa QwtLegend
+   \sa QwtLegend
  */
 class QWT_EXPORT QwtAbstractLegend : public QFrame
@@ -36,19 +36,19 @@
     Q_OBJECT
 
-public:
-    explicit QwtAbstractLegend( QWidget *parent = NULL );
+  public:
+    explicit QwtAbstractLegend( QWidget* parent = NULL );
     virtual ~QwtAbstractLegend();
 
     /*!
-      Render the legend into a given rectangle.
+       Render the legend into a given rectangle.
 
-      \param painter Painter
-      \param rect Bounding rectangle
-      \param fillBackground When true, fill rect with the widget background
+       \param painter Painter
+       \param rect Bounding rectangle
+       \param fillBackground When true, fill rect with the widget background
 
-      \sa renderLegend() is used by QwtPlotRenderer
-    */
-    virtual void renderLegend( QPainter *painter,
-        const QRectF &rect, bool fillBackground ) const = 0;
+       \sa renderLegend() is used by QwtPlotRenderer
+     */
+    virtual void renderLegend( QPainter* painter,
+        const QRectF& rect, bool fillBackground ) const = 0;
 
     //! \return True, when no plot item is inserted
@@ -57,14 +57,14 @@
     virtual int scrollExtent( Qt::Orientation ) const;
 
-public Q_SLOTS:
+  public Q_SLOTS:
 
     /*!
-      \brief Update the entries for a plot item
+       \brief Update the entries for a plot item
 
-      \param itemInfo Info about an item
-      \param data List of legend entry attributes for the  item
+       \param itemInfo Info about an item
+       \param data List of legend entry attributes for the  item
      */
-    virtual void updateLegend( const QVariant &itemInfo,
-        const QList<QwtLegendData> &data ) = 0;
+    virtual void updateLegend( const QVariant& itemInfo,
+        const QList< QwtLegendData >& data ) = 0;
 };
 
Index: /trunk/BNC/qwt/qwt_abstract_scale.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_abstract_scale.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_abstract_scale.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -15,7 +15,9 @@
 #include "qwt_interval.h"
 
+#include <qcoreevent.h>
+
 class QwtAbstractScale::PrivateData
 {
-public:
+  public:
     PrivateData():
         maxMajor( 5 ),
@@ -33,6 +35,6 @@
     }
 
-    QwtScaleEngine *scaleEngine;
-    QwtAbstractScaleDraw *scaleDraw;
+    QwtScaleEngine* scaleEngine;
+    QwtAbstractScaleDraw* scaleDraw;
 
     int maxMajor;
@@ -42,20 +44,20 @@
 
 /*!
-  Constructor
-
-  \param parent Parent widget
-
-  Creates a default QwtScaleDraw and a QwtLinearScaleEngine.
-  The initial scale boundaries are set to [ 0.0, 100.0 ]
-
-  The scaleStepSize() is initialized to 0.0, scaleMaxMajor() to 5
-  and scaleMaxMajor to 3.
-*/
-
-QwtAbstractScale::QwtAbstractScale( QWidget *parent ):
-    QWidget( parent )
-{
-    d_data = new PrivateData;
-    rescale( 0.0, 100.0, d_data->stepSize );
+   Constructor
+
+   \param parent Parent widget
+
+   Creates a default QwtScaleDraw and a QwtLinearScaleEngine.
+   The initial scale boundaries are set to [ 0.0, 100.0 ]
+
+   The scaleStepSize() is initialized to 0.0, scaleMaxMajor() to 5
+   and scaleMaxMajor to 3.
+ */
+
+QwtAbstractScale::QwtAbstractScale( QWidget* parent )
+    : QWidget( parent )
+{
+    m_data = new PrivateData;
+    rescale( 0.0, 100.0, m_data->stepSize );
 }
 
@@ -63,16 +65,16 @@
 QwtAbstractScale::~QwtAbstractScale()
 {
-    delete d_data;
-}
-
-/*!
-  Set the lower bound of the scale
-
-  \param value Lower bound
-
-  \sa lowerBound(), setScale(), setUpperBound()
-  \note For inverted scales the lower bound
+    delete m_data;
+}
+
+/*!
+   Set the lower bound of the scale
+
+   \param value Lower bound
+
+   \sa lowerBound(), setScale(), setUpperBound()
+   \note For inverted scales the lower bound
         is greater than the upper bound
-*/
+ */
 void QwtAbstractScale::setLowerBound( double value )
 {
@@ -81,21 +83,21 @@
 
 /*!
-  \return Lower bound of the scale
-  \sa setLowerBound(), setScale(), upperBound()
-*/
+   \return Lower bound of the scale
+   \sa setLowerBound(), setScale(), upperBound()
+ */
 double QwtAbstractScale::lowerBound() const
 {
-    return d_data->scaleDraw->scaleDiv().lowerBound();
-}
-
-/*!
-  Set the upper bound of the scale
-
-  \param value Upper bound
-
-  \sa upperBound(), setScale(), setLowerBound()
-  \note For inverted scales the lower bound
+    return m_data->scaleDraw->scaleDiv().lowerBound();
+}
+
+/*!
+   Set the upper bound of the scale
+
+   \param value Upper bound
+
+   \sa upperBound(), setScale(), setLowerBound()
+   \note For inverted scales the lower bound
         is greater than the upper bound
-*/
+ */
 void QwtAbstractScale::setUpperBound( double value )
 {
@@ -104,42 +106,42 @@
 
 /*!
-  \return Upper bound of the scale
-  \sa setUpperBound(), setScale(), lowerBound()
-*/
+   \return Upper bound of the scale
+   \sa setUpperBound(), setScale(), lowerBound()
+ */
 double QwtAbstractScale::upperBound() const
 {
-    return d_data->scaleDraw->scaleDiv().upperBound();
-}
-
-/*!
-  \brief Specify a scale.
-
-  Define a scale by an interval
-
-  The ticks are calculated using scaleMaxMinor(),
-  scaleMaxMajor() and scaleStepSize().
-
-  \param lowerBound lower limit of the scale interval
-  \param upperBound upper limit of the scale interval
-
-  \note For inverted scales the lower bound
+    return m_data->scaleDraw->scaleDiv().upperBound();
+}
+
+/*!
+   \brief Specify a scale.
+
+   Define a scale by an interval
+
+   The ticks are calculated using scaleMaxMinor(),
+   scaleMaxMajor() and scaleStepSize().
+
+   \param lowerBound lower limit of the scale interval
+   \param upperBound upper limit of the scale interval
+
+   \note For inverted scales the lower bound
         is greater than the upper bound
-*/
+ */
 void QwtAbstractScale::setScale( double lowerBound, double upperBound )
 {
-    rescale( lowerBound, upperBound, d_data->stepSize );
-}
-
-/*!
-  \brief Specify a scale.
-
-  Define a scale by an interval
-
-  The ticks are calculated using scaleMaxMinor(),
-  scaleMaxMajor() and scaleStepSize().
-
-  \param interval Interval
-*/
-void QwtAbstractScale::setScale( const QwtInterval &interval )
+    rescale( lowerBound, upperBound, m_data->stepSize );
+}
+
+/*!
+   \brief Specify a scale.
+
+   Define a scale by an interval
+
+   The ticks are calculated using scaleMaxMinor(),
+   scaleMaxMajor() and scaleStepSize().
+
+   \param interval Interval
+ */
+void QwtAbstractScale::setScale( const QwtInterval& interval )
 {
     setScale( interval.minValue(), interval.maxValue() );
@@ -147,24 +149,24 @@
 
 /*!
-  \brief Specify a scale.
-
-  scaleMaxMinor(), scaleMaxMajor() and scaleStepSize() and have no effect.
-
-  \param scaleDiv Scale division
-  \sa setAutoScale()
-*/
-void QwtAbstractScale::setScale( const QwtScaleDiv &scaleDiv )
-{
-    if ( scaleDiv != d_data->scaleDraw->scaleDiv() )
+   \brief Specify a scale.
+
+   scaleMaxMinor(), scaleMaxMajor() and scaleStepSize() and have no effect.
+
+   \param scaleDiv Scale division
+   \sa setAutoScale()
+ */
+void QwtAbstractScale::setScale( const QwtScaleDiv& scaleDiv )
+{
+    if ( scaleDiv != m_data->scaleDraw->scaleDiv() )
     {
 #if 1
-        if ( d_data->scaleEngine )
+        if ( m_data->scaleEngine )
         {
-            d_data->scaleDraw->setTransformation(
-                d_data->scaleEngine->transformation() );
+            m_data->scaleDraw->setTransformation(
+                m_data->scaleEngine->transformation() );
         }
 #endif
 
-        d_data->scaleDraw->setScaleDiv( scaleDiv );
+        m_data->scaleDraw->setScaleDiv( scaleDiv );
 
         scaleChange();
@@ -173,21 +175,21 @@
 
 /*!
-  \brief Set the maximum number of major tick intervals.
-
-  The scale's major ticks are calculated automatically such that
-  the number of major intervals does not exceed ticks.
-
-  The default value is 5.
-
-  \param ticks Maximal number of major ticks.
-
-  \sa scaleMaxMajor(), setScaleMaxMinor(),
+   \brief Set the maximum number of major tick intervals.
+
+   The scale's major ticks are calculated automatically such that
+   the number of major intervals does not exceed ticks.
+
+   The default value is 5.
+
+   \param ticks Maximal number of major ticks.
+
+   \sa scaleMaxMajor(), setScaleMaxMinor(),
       setScaleStepSize(), QwtScaleEngine::divideInterval()
-*/
+ */
 void QwtAbstractScale::setScaleMaxMajor( int ticks )
 {
-    if ( ticks != d_data->maxMajor )
-    {
-        d_data->maxMajor = ticks;
+    if ( ticks != m_data->maxMajor )
+    {
+        m_data->maxMajor = ticks;
         updateScaleDraw();
     }
@@ -195,29 +197,29 @@
 
 /*!
-  \return Maximal number of major tick intervals
-  \sa setScaleMaxMajor(), scaleMaxMinor()
-*/
+   \return Maximal number of major tick intervals
+   \sa setScaleMaxMajor(), scaleMaxMinor()
+ */
 int QwtAbstractScale::scaleMaxMajor() const
 {
-    return d_data->maxMajor;
-}
-
-/*!
-  \brief Set the maximum number of minor tick intervals
-
-  The scale's minor ticks are calculated automatically such that
-  the number of minor intervals does not exceed ticks.
-  The default value is 3.
-
-  \param ticks Maximal number of minor ticks.
-
-  \sa scaleMaxMajor(), setScaleMaxMinor(),
+    return m_data->maxMajor;
+}
+
+/*!
+   \brief Set the maximum number of minor tick intervals
+
+   The scale's minor ticks are calculated automatically such that
+   the number of minor intervals does not exceed ticks.
+   The default value is 3.
+
+   \param ticks Maximal number of minor ticks.
+
+   \sa scaleMaxMajor(), setScaleMaxMinor(),
       setScaleStepSize(), QwtScaleEngine::divideInterval()
-*/
+ */
 void QwtAbstractScale::setScaleMaxMinor( int ticks )
 {
-    if ( ticks != d_data->maxMinor )
-    {
-        d_data->maxMinor = ticks;
+    if ( ticks != m_data->maxMinor )
+    {
+        m_data->maxMinor = ticks;
         updateScaleDraw();
     }
@@ -225,10 +227,10 @@
 
 /*!
-  \return Maximal number of minor tick intervals
-  \sa setScaleMaxMinor(), scaleMaxMajor()
-*/
+   \return Maximal number of minor tick intervals
+   \sa setScaleMaxMinor(), scaleMaxMajor()
+ */
 int QwtAbstractScale::scaleMaxMinor() const
 {
-    return d_data->maxMinor;
+    return m_data->maxMinor;
 }
 
@@ -246,10 +248,10 @@
    \note Position and distance between the major ticks also
          depends on scaleMaxMajor().
-*/
+ */
 void QwtAbstractScale::setScaleStepSize( double stepSize )
 {
-    if ( stepSize != d_data->stepSize )
-    {
-        d_data->stepSize = stepSize;
+    if ( stepSize != m_data->stepSize )
+    {
+        m_data->stepSize = stepSize;
         updateScaleDraw();
     }
@@ -257,30 +259,30 @@
 
 /*!
-  \return Hint for the step size of the scale
-  \sa setScaleStepSize(), QwtScaleEngine::divideScale()
-*/
+   \return Hint for the step size of the scale
+   \sa setScaleStepSize(), QwtScaleEngine::divideScale()
+ */
 double QwtAbstractScale::scaleStepSize() const
 {
-    return d_data->stepSize;
-}
-
-/*!
-  \brief Set a scale draw
-
-  scaleDraw has to be created with new and will be deleted in
-  the destructor or the next call of setAbstractScaleDraw().
-
-  \sa abstractScaleDraw()
-*/
-void QwtAbstractScale::setAbstractScaleDraw( QwtAbstractScaleDraw *scaleDraw )
-{
-    if ( scaleDraw == NULL || scaleDraw == d_data->scaleDraw )
+    return m_data->stepSize;
+}
+
+/*!
+   \brief Set a scale draw
+
+   scaleDraw has to be created with new and will be deleted in
+   the destructor or the next call of setAbstractScaleDraw().
+
+   \sa abstractScaleDraw()
+ */
+void QwtAbstractScale::setAbstractScaleDraw( QwtAbstractScaleDraw* scaleDraw )
+{
+    if ( scaleDraw == NULL || scaleDraw == m_data->scaleDraw )
         return;
 
-    if ( d_data->scaleDraw != NULL )
-        scaleDraw->setScaleDiv( d_data->scaleDraw->scaleDiv() );
-
-    delete d_data->scaleDraw;
-    d_data->scaleDraw = scaleDraw;
+    if ( m_data->scaleDraw != NULL )
+        scaleDraw->setScaleDiv( m_data->scaleDraw->scaleDiv() );
+
+    delete m_data->scaleDraw;
+    m_data->scaleDraw = scaleDraw;
 }
 
@@ -288,8 +290,8 @@
     \return Scale draw
     \sa setAbstractScaleDraw()
-*/
-QwtAbstractScaleDraw *QwtAbstractScale::abstractScaleDraw()
-{
-    return d_data->scaleDraw;
+ */
+QwtAbstractScaleDraw* QwtAbstractScale::abstractScaleDraw()
+{
+    return m_data->scaleDraw;
 }
 
@@ -297,116 +299,116 @@
     \return Scale draw
     \sa setAbstractScaleDraw()
-*/
-const QwtAbstractScaleDraw *QwtAbstractScale::abstractScaleDraw() const
-{
-    return d_data->scaleDraw;
-}
-
-/*!
-  \brief Set a scale engine
-
-  The scale engine is responsible for calculating the scale division
-  and provides a transformation between scale and widget coordinates.
-
-  scaleEngine has to be created with new and will be deleted in
-  the destructor or the next call of setScaleEngine.
-*/
-void QwtAbstractScale::setScaleEngine( QwtScaleEngine *scaleEngine )
-{
-    if ( scaleEngine != NULL && scaleEngine != d_data->scaleEngine )
-    {
-        delete d_data->scaleEngine;
-        d_data->scaleEngine = scaleEngine;
-    }
-}
-
-/*!
-  \return Scale engine
-  \sa setScaleEngine()
-*/
-const QwtScaleEngine *QwtAbstractScale::scaleEngine() const
-{
-    return d_data->scaleEngine;
-}
-
-/*!
-  \return Scale engine
-  \sa setScaleEngine()
-*/
-QwtScaleEngine *QwtAbstractScale::scaleEngine()
-{
-    return d_data->scaleEngine;
-}
-
-/*!
-  \return Scale boundaries and positions of the ticks
-
-  The scale division might have been assigned explicitly
-  or calculated implicitly by rescale().
- */
-const QwtScaleDiv &QwtAbstractScale::scaleDiv() const
-{
-    return d_data->scaleDraw->scaleDiv();
-}
-
-/*!
-  \return Map to translate between scale and widget coordinates
- */
-const QwtScaleMap &QwtAbstractScale::scaleMap() const
-{
-    return d_data->scaleDraw->scaleMap();
-}
-
-/*!
-  Translate a scale value into a widget coordinate
-
-  \param value Scale value
-  \return Corresponding widget coordinate for value
-  \sa scaleMap(), invTransform()
+ */
+const QwtAbstractScaleDraw* QwtAbstractScale::abstractScaleDraw() const
+{
+    return m_data->scaleDraw;
+}
+
+/*!
+   \brief Set a scale engine
+
+   The scale engine is responsible for calculating the scale division
+   and provides a transformation between scale and widget coordinates.
+
+   scaleEngine has to be created with new and will be deleted in
+   the destructor or the next call of setScaleEngine.
+ */
+void QwtAbstractScale::setScaleEngine( QwtScaleEngine* scaleEngine )
+{
+    if ( scaleEngine != NULL && scaleEngine != m_data->scaleEngine )
+    {
+        delete m_data->scaleEngine;
+        m_data->scaleEngine = scaleEngine;
+    }
+}
+
+/*!
+   \return Scale engine
+   \sa setScaleEngine()
+ */
+const QwtScaleEngine* QwtAbstractScale::scaleEngine() const
+{
+    return m_data->scaleEngine;
+}
+
+/*!
+   \return Scale engine
+   \sa setScaleEngine()
+ */
+QwtScaleEngine* QwtAbstractScale::scaleEngine()
+{
+    return m_data->scaleEngine;
+}
+
+/*!
+   \return Scale boundaries and positions of the ticks
+
+   The scale division might have been assigned explicitly
+   or calculated implicitly by rescale().
+ */
+const QwtScaleDiv& QwtAbstractScale::scaleDiv() const
+{
+    return m_data->scaleDraw->scaleDiv();
+}
+
+/*!
+   \return Map to translate between scale and widget coordinates
+ */
+const QwtScaleMap& QwtAbstractScale::scaleMap() const
+{
+    return m_data->scaleDraw->scaleMap();
+}
+
+/*!
+   Translate a scale value into a widget coordinate
+
+   \param value Scale value
+   \return Corresponding widget coordinate for value
+   \sa scaleMap(), invTransform()
  */
 int QwtAbstractScale::transform( double value ) const
 {
-    return qRound( d_data->scaleDraw->scaleMap().transform( value ) );
-}
-
-/*!
-  Translate a widget coordinate into a scale value
-
-  \param value Widget coordinate
-  \return Corresponding scale coordinate for value
-  \sa scaleMap(), transform()
+    return qRound( m_data->scaleDraw->scaleMap().transform( value ) );
+}
+
+/*!
+   Translate a widget coordinate into a scale value
+
+   \param value Widget coordinate
+   \return Corresponding scale coordinate for value
+   \sa scaleMap(), transform()
  */
 double QwtAbstractScale::invTransform( int value ) const
 {
-    return d_data->scaleDraw->scaleMap().invTransform( value );
-}
-
-/*!
-  \return True, when the scale is increasing in opposite direction
+    return m_data->scaleDraw->scaleMap().invTransform( value );
+}
+
+/*!
+   \return True, when the scale is increasing in opposite direction
           to the widget coordinates
  */
 bool QwtAbstractScale::isInverted() const
 {
-    return d_data->scaleDraw->scaleMap().isInverting();
-}
-
-/*!
-  \return The boundary with the smaller value
-  \sa maximum(), lowerBound(), upperBound()
+    return m_data->scaleDraw->scaleMap().isInverting();
+}
+
+/*!
+   \return The boundary with the smaller value
+   \sa maximum(), lowerBound(), upperBound()
  */
 double QwtAbstractScale::minimum() const
 {
-    return qMin( d_data->scaleDraw->scaleDiv().lowerBound(),
-        d_data->scaleDraw->scaleDiv().upperBound() );
-}
-
-/*!
-  \return The boundary with the larger value
-  \sa minimum(), lowerBound(), upperBound()
+    return qMin( m_data->scaleDraw->scaleDiv().lowerBound(),
+        m_data->scaleDraw->scaleDiv().upperBound() );
+}
+
+/*!
+   \return The boundary with the larger value
+   \sa minimum(), lowerBound(), upperBound()
  */
 double QwtAbstractScale::maximum() const
 {
-    return qMax( d_data->scaleDraw->scaleDiv().lowerBound(),
-        d_data->scaleDraw->scaleDiv().upperBound() );
+    return qMax( m_data->scaleDraw->scaleDiv().lowerBound(),
+        m_data->scaleDraw->scaleDiv().upperBound() );
 }
 
@@ -417,33 +419,54 @@
 
 /*!
-  Recalculate the scale division and update the scale.
-
-  \param lowerBound Lower limit of the scale interval
-  \param upperBound Upper limit of the scale interval
-  \param stepSize Major step size
-
-  \sa scaleChange()
-*/
+   Recalculate the scale division and update the scale.
+
+   \param lowerBound Lower limit of the scale interval
+   \param upperBound Upper limit of the scale interval
+   \param stepSize Major step size
+
+   \sa scaleChange()
+ */
 void QwtAbstractScale::rescale(
     double lowerBound, double upperBound, double stepSize )
 {
-    const QwtScaleDiv scaleDiv = d_data->scaleEngine->divideScale(
-        lowerBound, upperBound, d_data->maxMajor, d_data->maxMinor, stepSize );
-
-    if ( scaleDiv != d_data->scaleDraw->scaleDiv() )
+    const QwtScaleDiv scaleDiv = m_data->scaleEngine->divideScale(
+        lowerBound, upperBound, m_data->maxMajor, m_data->maxMinor, stepSize );
+
+    if ( scaleDiv != m_data->scaleDraw->scaleDiv() )
     {
 #if 1
-        d_data->scaleDraw->setTransformation(
-            d_data->scaleEngine->transformation() );
+        m_data->scaleDraw->setTransformation(
+            m_data->scaleEngine->transformation() );
 #endif
 
-        d_data->scaleDraw->setScaleDiv( scaleDiv );
+        m_data->scaleDraw->setScaleDiv( scaleDiv );
         scaleChange();
     }
 }
 
+/*!
+   Change Event handler
+   \param event Change event
+
+   Invalidates internal caches if necessary
+ */
+void QwtAbstractScale::changeEvent( QEvent* event )
+{
+    if ( event->type() == QEvent::LocaleChange )
+    {
+        m_data->scaleDraw->invalidateCache();
+    }
+
+    QWidget::changeEvent( event );
+}
+
+/*!
+   Recalculate ticks and scale boundaries.
+ */
 void QwtAbstractScale::updateScaleDraw()
 {
-    rescale( d_data->scaleDraw->scaleDiv().lowerBound(),
-        d_data->scaleDraw->scaleDiv().upperBound(), d_data->stepSize );
-}
+    rescale( m_data->scaleDraw->scaleDiv().lowerBound(),
+        m_data->scaleDraw->scaleDiv().upperBound(), m_data->stepSize );
+}
+
+#include "moc_qwt_abstract_scale.cpp"
Index: /trunk/BNC/qwt/qwt_abstract_scale.h
===================================================================
--- /trunk/BNC/qwt/qwt_abstract_scale.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_abstract_scale.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -21,18 +21,18 @@
 
 /*!
-  \brief An abstract base class for widgets having a scale
+   \brief An abstract base class for widgets having a scale
 
-  The scale of an QwtAbstractScale is determined by a QwtScaleDiv
-  definition, that contains the boundaries and the ticks of the scale.
-  The scale is painted using a QwtScaleDraw object.
+   The scale of an QwtAbstractScale is determined by a QwtScaleDiv
+   definition, that contains the boundaries and the ticks of the scale.
+   The scale is painted using a QwtScaleDraw object.
 
-  The scale division might be assigned explicitly - but usually
-  it is calculated from the boundaries using a QwtScaleEngine.
+   The scale division might be assigned explicitly - but usually
+   it is calculated from the boundaries using a QwtScaleEngine.
 
-  The scale engine also decides the type of transformation of the scale
-  ( linear, logarithmic ... ).
-*/
+   The scale engine also decides the type of transformation of the scale
+   ( linear, logarithmic ... ).
+ */
 
-class QWT_EXPORT QwtAbstractScale: public QWidget
+class QWT_EXPORT QwtAbstractScale : public QWidget
 {
     Q_OBJECT
@@ -46,11 +46,11 @@
     Q_PROPERTY( double scaleStepSize READ scaleStepSize WRITE setScaleStepSize )
 
-public:
-    QwtAbstractScale( QWidget *parent = NULL );
+  public:
+    explicit QwtAbstractScale( QWidget* parent = NULL );
     virtual ~QwtAbstractScale();
 
     void setScale( double lowerBound, double upperBound );
-    void setScale( const QwtInterval & );
-    void setScale( const QwtScaleDiv & );
+    void setScale( const QwtInterval& );
+    void setScale( const QwtScaleDiv& );
 
     const QwtScaleDiv& scaleDiv() const;
@@ -71,7 +71,7 @@
     int scaleMaxMajor() const;
 
-    void setScaleEngine( QwtScaleEngine * );
-    const QwtScaleEngine *scaleEngine() const;
-    QwtScaleEngine *scaleEngine();
+    void setScaleEngine( QwtScaleEngine* );
+    const QwtScaleEngine* scaleEngine() const;
+    QwtScaleEngine* scaleEngine();
 
     int transform( double ) const;
@@ -83,22 +83,23 @@
     double maximum() const;
 
-    const QwtScaleMap &scaleMap() const;
+    const QwtScaleMap& scaleMap() const;
 
-protected:
+  protected:
+    virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
+
     void rescale( double lowerBound,
         double upperBound, double stepSize );
 
-    void setAbstractScaleDraw( QwtAbstractScaleDraw * );
+    void setAbstractScaleDraw( QwtAbstractScaleDraw* );
 
-    const QwtAbstractScaleDraw *abstractScaleDraw() const;
-    QwtAbstractScaleDraw *abstractScaleDraw();
+    const QwtAbstractScaleDraw* abstractScaleDraw() const;
+    QwtAbstractScaleDraw* abstractScaleDraw();
 
+    void updateScaleDraw();
     virtual void scaleChange();
 
-private:
-    void updateScaleDraw();
-
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_abstract_scale_draw.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_abstract_scale_draw.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_abstract_scale_draw.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,19 +9,21 @@
 
 #include "qwt_abstract_scale_draw.h"
-#include "qwt_math.h"
 #include "qwt_text.h"
 #include "qwt_painter.h"
 #include "qwt_scale_map.h"
+#include "qwt_math.h"
+
 #include <qpainter.h>
 #include <qpalette.h>
 #include <qmap.h>
+#include <qlist.h>
 #include <qlocale.h>
 
 class QwtAbstractScaleDraw::PrivateData
 {
-public:
+  public:
     PrivateData():
         spacing( 4.0 ),
-        penWidth( 0 ),
+        penWidthF( 0.0 ),
         minExtent( 0.0 )
     {
@@ -42,21 +44,21 @@
     double spacing;
     double tickLength[QwtScaleDiv::NTickTypes];
-    int penWidth;
+    qreal penWidthF;
 
     double minExtent;
 
-    QMap<double, QwtText> labelCache;
+    QMap< double, QwtText > labelCache;
 };
 
 /*!
-  \brief Constructor
-
-  The range of the scale is initialized to [0, 100],
-  The spacing (distance between ticks and labels) is
-  set to 4, the tick lengths are set to 4,6 and 8 pixels
-*/
+   \brief Constructor
+
+   The range of the scale is initialized to [0, 100],
+   The spacing (distance between ticks and labels) is
+   set to 4, the tick lengths are set to 4,6 and 8 pixels
+ */
 QwtAbstractScaleDraw::QwtAbstractScaleDraw()
 {
-    d_data = new QwtAbstractScaleDraw::PrivateData;
+    m_data = new QwtAbstractScaleDraw::PrivateData;
 }
 
@@ -64,67 +66,66 @@
 QwtAbstractScaleDraw::~QwtAbstractScaleDraw()
 {
-    delete d_data;
-}
-
-/*!
-  En/Disable a component of the scale
-
-  \param component Scale component
-  \param enable On/Off
-
-  \sa hasComponent()
-*/
+    delete m_data;
+}
+
+/*!
+   En/Disable a component of the scale
+
+   \param component Scale component
+   \param enable On/Off
+
+   \sa hasComponent()
+ */
 void QwtAbstractScaleDraw::enableComponent(
     ScaleComponent component, bool enable )
 {
     if ( enable )
-        d_data->components |= component;
+        m_data->components |= component;
     else
-        d_data->components &= ~component;
-}
-
-/*!
-  Check if a component is enabled
-
-  \param component Component type
-  \return true, when component is enabled
-  \sa enableComponent()
-*/
+        m_data->components &= ~component;
+}
+
+/*!
+   Check if a component is enabled
+
+   \param component Component type
+   \return true, when component is enabled
+   \sa enableComponent()
+ */
 bool QwtAbstractScaleDraw::hasComponent( ScaleComponent component ) const
 {
-    return ( d_data->components & component );
-}
-
-/*!
-  Change the scale division
-  \param scaleDiv New scale division
-*/
-void QwtAbstractScaleDraw::setScaleDiv( const QwtScaleDiv &scaleDiv )
-{
-    d_data->scaleDiv = scaleDiv;
-    d_data->map.setScaleInterval( scaleDiv.lowerBound(), scaleDiv.upperBound() );
-    d_data->labelCache.clear();
-}
-
-/*!
-  Change the transformation of the scale
-  \param transformation New scale transformation
-*/
-void QwtAbstractScaleDraw::setTransformation(
-    QwtTransform *transformation )
-{
-    d_data->map.setTransformation( transformation );
+    return ( m_data->components & component );
+}
+
+/*!
+   Change the scale division
+   \param scaleDiv New scale division
+ */
+void QwtAbstractScaleDraw::setScaleDiv( const QwtScaleDiv& scaleDiv )
+{
+    m_data->scaleDiv = scaleDiv;
+    m_data->map.setScaleInterval( scaleDiv.lowerBound(), scaleDiv.upperBound() );
+    m_data->labelCache.clear();
+}
+
+/*!
+   Change the transformation of the scale
+   \param transformation New scale transformation
+ */
+void QwtAbstractScaleDraw::setTransformation( QwtTransform* transformation )
+{
+    m_data->map.setTransformation( transformation );
 }
 
 //! \return Map how to translate between scale and pixel values
-const QwtScaleMap &QwtAbstractScaleDraw::scaleMap() const
-{
-    return d_data->map;
+const QwtScaleMap& QwtAbstractScaleDraw::scaleMap() const
+{
+    return m_data->map;
 }
 
 //! \return Map how to translate between scale and pixel values
-QwtScaleMap &QwtAbstractScaleDraw::scaleMap()
-{
-    return d_data->map;
+QwtScaleMap& QwtAbstractScaleDraw::scaleMap()
+{
+    return m_data->map;
 }
 
@@ -132,19 +133,19 @@
 const QwtScaleDiv& QwtAbstractScaleDraw::scaleDiv() const
 {
-    return d_data->scaleDiv;
-}
-
-/*!
-  \brief Specify the width of the scale pen
-  \param width Pen width
-  \sa penWidth()
-*/
-void QwtAbstractScaleDraw::setPenWidth( int width )
-{
-    if ( width < 0 )
-        width = 0;
-
-    if ( width != d_data->penWidth )
-        d_data->penWidth = width;
+    return m_data->scaleDiv;
+}
+
+/*!
+   \brief Specify the width of the scale pen
+   \param width Pen width
+
+   \sa penWidth()
+ */
+void QwtAbstractScaleDraw::setPenWidthF( qreal width )
+{
+    if ( width < 0.0 )
+        width = 0.0;
+
+    m_data->penWidthF = width;
 }
 
@@ -152,19 +153,19 @@
     \return Scale pen width
     \sa setPenWidth()
-*/
-int QwtAbstractScaleDraw::penWidth() const
-{
-    return d_data->penWidth;
-}
-
-/*!
-  \brief Draw the scale
-
-  \param painter    The painter
-
-  \param palette    Palette, text color is used for the labels,
+ */
+qreal QwtAbstractScaleDraw::penWidthF() const
+{
+    return m_data->penWidthF;
+}
+
+/*!
+   \brief Draw the scale
+
+   \param painter    The painter
+
+   \param palette    Palette, text color is used for the labels,
                     foreground color for ticks and backbone
-*/
-void QwtAbstractScaleDraw::draw( QPainter *painter,
+ */
+void QwtAbstractScaleDraw::draw( QPainter* painter,
     const QPalette& palette ) const
 {
@@ -172,6 +173,6 @@
 
     QPen pen = painter->pen();
-    pen.setWidth( d_data->penWidth );
-    pen.setCosmetic( false );
+    pen.setWidthF( m_data->penWidthF );
+
     painter->setPen( pen );
 
@@ -181,11 +182,11 @@
         painter->setPen( palette.color( QPalette::Text ) ); // ignore pen style
 
-        const QList<double> &majorTicks =
-            d_data->scaleDiv.ticks( QwtScaleDiv::MajorTick );
+        const QList< double >& majorTicks =
+            m_data->scaleDiv.ticks( QwtScaleDiv::MajorTick );
 
         for ( int i = 0; i < majorTicks.count(); i++ )
         {
             const double v = majorTicks[i];
-            if ( d_data->scaleDiv.contains( v ) )
+            if ( m_data->scaleDiv.contains( v ) )
                 drawLabel( painter, v );
         }
@@ -207,13 +208,13 @@
             tickType < QwtScaleDiv::NTickTypes; tickType++ )
         {
-            const double tickLen = d_data->tickLength[tickType];
+            const double tickLen = m_data->tickLength[tickType];
             if ( tickLen <= 0.0 )
                 continue;
 
-            const QList<double> &ticks = d_data->scaleDiv.ticks( tickType );
+            const QList< double >& ticks = m_data->scaleDiv.ticks( tickType );
             for ( int i = 0; i < ticks.count(); i++ )
             {
                 const double v = ticks[i];
-                if ( d_data->scaleDiv.contains( v ) )
+                if ( m_data->scaleDiv.contains( v ) )
                     drawTick( painter, v, tickLen );
             }
@@ -242,13 +243,13 @@
 
 /*!
-  \brief Set the spacing between tick and labels
-
-  The spacing is the distance between ticks and labels.
-  The default spacing is 4 pixels.
-
-  \param spacing Spacing
-
-  \sa spacing()
-*/
+   \brief Set the spacing between tick and labels
+
+   The spacing is the distance between ticks and labels.
+   The default spacing is 4 pixels.
+
+   \param spacing Spacing
+
+   \sa spacing()
+ */
 void QwtAbstractScaleDraw::setSpacing( double spacing )
 {
@@ -256,34 +257,34 @@
         spacing = 0;
 
-    d_data->spacing = spacing;
-}
-
-/*!
-  \brief Get the spacing
-
-  The spacing is the distance between ticks and labels.
-  The default spacing is 4 pixels.
-
-  \return Spacing
-  \sa setSpacing()
-*/
+    m_data->spacing = spacing;
+}
+
+/*!
+   \brief Get the spacing
+
+   The spacing is the distance between ticks and labels.
+   The default spacing is 4 pixels.
+
+   \return Spacing
+   \sa setSpacing()
+ */
 double QwtAbstractScaleDraw::spacing() const
 {
-    return d_data->spacing;
-}
-
-/*!
-  \brief Set a minimum for the extent
-
-  The extent is calculated from the components of the
-  scale draw. In situations, where the labels are
-  changing and the layout depends on the extent (f.e scrolling
-  a scale), setting an upper limit as minimum extent will
-  avoid jumps of the layout.
-
-  \param minExtent Minimum extent
-
-  \sa extent(), minimumExtent()
-*/
+    return m_data->spacing;
+}
+
+/*!
+   \brief Set a minimum for the extent
+
+   The extent is calculated from the components of the
+   scale draw. In situations, where the labels are
+   changing and the layout depends on the extent (f.e scrolling
+   a scale), setting an upper limit as minimum extent will
+   avoid jumps of the layout.
+
+   \param minExtent Minimum extent
+
+   \sa extent(), minimumExtent()
+ */
 void QwtAbstractScaleDraw::setMinimumExtent( double minExtent )
 {
@@ -291,25 +292,25 @@
         minExtent = 0.0;
 
-    d_data->minExtent = minExtent;
-}
-
-/*!
-  Get the minimum extent
-  \return Minimum extent
-  \sa extent(), setMinimumExtent()
-*/
+    m_data->minExtent = minExtent;
+}
+
+/*!
+   Get the minimum extent
+   \return Minimum extent
+   \sa extent(), setMinimumExtent()
+ */
 double QwtAbstractScaleDraw::minimumExtent() const
 {
-    return d_data->minExtent;
-}
-
-/*!
-  Set the length of the ticks
-
-  \param tickType Tick type
-  \param length New length
-
-  \warning the length is limited to [0..1000]
-*/
+    return m_data->minExtent;
+}
+
+/*!
+   Set the length of the ticks
+
+   \param tickType Tick type
+   \param length New length
+
+   \warning the length is limited to [0..1000]
+ */
 void QwtAbstractScaleDraw::setTickLength(
     QwtScaleDiv::TickType tickType, double length )
@@ -328,5 +329,5 @@
         length = maxTickLen;
 
-    d_data->tickLength[tickType] = length;
+    m_data->tickLength[tickType] = length;
 }
 
@@ -334,5 +335,5 @@
     \return Length of the ticks
     \sa setTickLength(), maxTickLength()
-*/
+ */
 double QwtAbstractScaleDraw::tickLength( QwtScaleDiv::TickType tickType ) const
 {
@@ -343,5 +344,5 @@
     }
 
-    return d_data->tickLength[tickType];
+    return m_data->tickLength[tickType];
 }
 
@@ -351,10 +352,10 @@
    Useful for layout calculations
    \sa tickLength(), setTickLength()
-*/
+ */
 double QwtAbstractScaleDraw::maxTickLength() const
 {
     double length = 0.0;
     for ( int i = 0; i < QwtScaleDiv::NTickTypes; i++ )
-        length = qMax( length, d_data->tickLength[i] );
+        length = qwtMaxF( length, m_data->tickLength[i] );
 
     return length;
@@ -362,14 +363,14 @@
 
 /*!
-  \brief Convert a value into its representing label
-
-  The value is converted to a plain text using
-  QLocale().toString(value).
-  This method is often overloaded by applications to have individual
-  labels.
-
-  \param value Value
-  \return Label string.
-*/
+   \brief Convert a value into its representing label
+
+   The value is converted to a plain text using
+   QLocale().toString(value).
+   This method is often overloaded by applications to have individual
+   labels.
+
+   \param value Value
+   \return Label string.
+ */
 QwtText QwtAbstractScaleDraw::label( double value ) const
 {
@@ -389,10 +390,10 @@
 
    \return Tick label
-*/
-const QwtText &QwtAbstractScaleDraw::tickLabel(
-    const QFont &font, double value ) const
-{
-    QMap<double, QwtText>::const_iterator it1 = d_data->labelCache.constFind( value );
-    if ( it1 != d_data->labelCache.constEnd() )
+ */
+const QwtText& QwtAbstractScaleDraw::tickLabel(
+    const QFont& font, double value ) const
+{
+    QMap< double, QwtText >::const_iterator it1 = m_data->labelCache.constFind( value );
+    if ( it1 != m_data->labelCache.constEnd() )
         return *it1;
 
@@ -403,5 +404,5 @@
     ( void )lbl.textSize( font ); // initialize the internal cache
 
-    QMap<double, QwtText>::iterator it2 = d_data->labelCache.insert( value, lbl );
+    QMap< double, QwtText >::iterator it2 = m_data->labelCache.insert( value, lbl );
     return *it2;
 }
@@ -413,7 +414,7 @@
    the labels need to be changed. while the same QwtScaleDiv is set,
    invalidateCache() needs to be called manually.
-*/
+ */
 void QwtAbstractScaleDraw::invalidateCache()
 {
-    d_data->labelCache.clear();
-}
+    m_data->labelCache.clear();
+}
Index: /trunk/BNC/qwt/qwt_abstract_scale_draw.h
===================================================================
--- /trunk/BNC/qwt/qwt_abstract_scale_draw.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_abstract_scale_draw.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,6 +13,6 @@
 #include "qwt_global.h"
 #include "qwt_scale_div.h"
-#include "qwt_text.h"
 
+class QwtText;
 class QPalette;
 class QPainter;
@@ -22,19 +22,19 @@
 
 /*!
-  \brief A abstract base class for drawing scales
+   \brief A abstract base class for drawing scales
 
-  QwtAbstractScaleDraw can be used to draw linear or logarithmic scales.
+   QwtAbstractScaleDraw can be used to draw linear or logarithmic scales.
 
-  After a scale division has been specified as a QwtScaleDiv object
-  using setScaleDiv(), the scale can be drawn with the draw() member.
-*/
+   After a scale division has been specified as a QwtScaleDiv object
+   using setScaleDiv(), the scale can be drawn with the draw() member.
+ */
 class QWT_EXPORT QwtAbstractScaleDraw
 {
-public:
+  public:
 
     /*!
        Components of a scale
        \sa enableComponent(), hasComponent
-    */
+     */
     enum ScaleComponent
     {
@@ -49,16 +49,15 @@
     };
 
-    //! Scale components
-    typedef QFlags<ScaleComponent> ScaleComponents;
+    Q_DECLARE_FLAGS( ScaleComponents, ScaleComponent )
 
     QwtAbstractScaleDraw();
     virtual ~QwtAbstractScaleDraw();
 
-    void setScaleDiv( const QwtScaleDiv & );
+    void setScaleDiv( const QwtScaleDiv& );
     const QwtScaleDiv& scaleDiv() const;
 
-    void setTransformation( QwtTransform * );
-    const QwtScaleMap &scaleMap() const;
-    QwtScaleMap &scaleMap();
+    void setTransformation( QwtTransform* );
+    const QwtScaleMap& scaleMap() const;
+    QwtScaleMap& scaleMap();
 
     void enableComponent( ScaleComponent, bool enable = true );
@@ -72,29 +71,31 @@
     double spacing() const;
 
-    void setPenWidth( int width );
-    int penWidth() const;
+    void setPenWidthF( qreal width );
+    qreal penWidthF() const;
 
-    virtual void draw( QPainter *, const QPalette & ) const;
+    virtual void draw( QPainter*, const QPalette& ) const;
 
     virtual QwtText label( double ) const;
 
     /*!
-      Calculate the extent
+       Calculate the extent
 
-      The extent is the distance from the baseline to the outermost
-      pixel of the scale draw in opposite to its orientation.
-      It is at least minimumExtent() pixels.
+       The extent is the distance from the baseline to the outermost
+       pixel of the scale draw in opposite to its orientation.
+       It is at least minimumExtent() pixels.
 
-      \param font Font used for drawing the tick labels
-      \return Number of pixels
+       \param font Font used for drawing the tick labels
+       \return Number of pixels
 
-      \sa setMinimumExtent(), minimumExtent()
-    */
-    virtual double extent( const QFont &font ) const = 0;
+       \sa setMinimumExtent(), minimumExtent()
+     */
+    virtual double extent( const QFont& font ) const = 0;
 
     void setMinimumExtent( double );
     double minimumExtent() const;
 
-protected:
+    void invalidateCache();
+
+  protected:
     /*!
        Draw a tick
@@ -105,14 +106,14 @@
 
        \sa drawBackbone(), drawLabel()
-    */
-    virtual void drawTick( QPainter *painter, double value, double len ) const = 0;
+     */
+    virtual void drawTick( QPainter* painter, double value, double len ) const = 0;
 
     /*!
-      Draws the baseline of the scale
-      \param painter Painter
+       Draws the baseline of the scale
+       \param painter Painter
 
-      \sa drawTick(), drawLabel()
-    */
-    virtual void drawBackbone( QPainter *painter ) const = 0;
+       \sa drawTick(), drawLabel()
+     */
+    virtual void drawBackbone( QPainter* painter ) const = 0;
 
     /*!
@@ -123,16 +124,14 @@
 
         \sa drawTick(), drawBackbone()
-    */
-    virtual void drawLabel( QPainter *painter, double value ) const = 0;
+     */
+    virtual void drawLabel( QPainter* painter, double value ) const = 0;
 
-    void invalidateCache();
-    const QwtText &tickLabel( const QFont &, double value ) const;
+    const QwtText& tickLabel( const QFont&, double value ) const;
 
-private:
-    QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
-    QwtAbstractScaleDraw &operator=( const QwtAbstractScaleDraw & );
+  private:
+    Q_DISABLE_COPY(QwtAbstractScaleDraw)
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_abstract_slider.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_abstract_slider.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_abstract_slider.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,17 +9,14 @@
 
 #include "qwt_abstract_slider.h"
-#include "qwt_abstract_scale_draw.h"
+#include "qwt_scale_map.h"
+#include "qwt_scale_div.h"
 #include "qwt_math.h"
-#include "qwt_scale_map.h"
+
 #include <qevent.h>
 
-#if QT_VERSION < 0x040601
-#define qFabs(x) ::fabs(x)
-#endif
-
 static double qwtAlignToScaleDiv(
-    const QwtAbstractSlider *slider, double value )
-{
-    const QwtScaleDiv &sd = slider->scaleDiv();
+    const QwtAbstractSlider* slider, double value )
+{
+    const QwtScaleDiv& sd = slider->scaleDiv();
 
     const int tValue = slider->transform( value );
@@ -33,5 +30,5 @@
     for ( int i = 0; i < QwtScaleDiv::NTickTypes; i++ )
     {
-        const QList<double> ticks = sd.ticks( i );
+        const QList< double > ticks = sd.ticks( i );
         for ( int j = 0; j < ticks.size(); j++ )
         {
@@ -46,18 +43,18 @@
 class QwtAbstractSlider::PrivateData
 {
-public:
-    PrivateData():
-        isScrolling( false ),
-        isTracking( true ),
-        pendingValueChanged( false ),
-        readOnly( false ),
-        totalSteps( 100 ),
-        singleSteps( 1 ),
-        pageSteps( 10 ),
-        stepAlignment( true ),
-        isValid( false ),
-        value( 0.0 ),
-        wrapping( false ),
-        invertedControls( false )
+  public:
+    PrivateData()
+        : isScrolling( false )
+        , isTracking( true )
+        , pendingValueChanged( false )
+        , readOnly( false )
+        , totalSteps( 100 )
+        , singleSteps( 1 )
+        , pageSteps( 10 )
+        , stepAlignment( true )
+        , isValid( false )
+        , value( 0.0 )
+        , wrapping( false )
+        , invertedControls( false )
     {
     }
@@ -82,18 +79,18 @@
 
 /*!
-  \brief Constructor
-
-  The scale is initialized to [0.0, 100.0], the
-  number of steps is set to 100 with 1 and 10 and single
-  an page step sizes. Step alignment is enabled.
-
-  The initial value is invalid.
-
-  \param parent Parent widget
-*/
-QwtAbstractSlider::QwtAbstractSlider( QWidget *parent ):
-    QwtAbstractScale( parent )
-{
-    d_data = new QwtAbstractSlider::PrivateData;
+   \brief Constructor
+
+   The scale is initialized to [0.0, 100.0], the
+   number of steps is set to 100 with 1 and 10 and single
+   an page step sizes. Step alignment is enabled.
+
+   The initial value is invalid.
+
+   \param parent Parent widget
+ */
+QwtAbstractSlider::QwtAbstractSlider( QWidget* parent )
+    : QwtAbstractScale( parent )
+{
+    m_data = new QwtAbstractSlider::PrivateData;
 
     setScale( 0.0, 100.0 );
@@ -104,22 +101,22 @@
 QwtAbstractSlider::~QwtAbstractSlider()
 {
-    delete d_data;
-}
-
-/*!
-  Set the value to be valid/invalid
-
-  \param on When true, the value is invalidated
-
-  \sa setValue()
-*/
+    delete m_data;
+}
+
+/*!
+   Set the value to be valid/invalid
+
+   \param on When true, the value is invalidated
+
+   \sa setValue()
+ */
 void QwtAbstractSlider::setValid( bool on )
 {
-    if ( on != d_data->isValid )
-    {
-        d_data->isValid = on;
+    if ( on != m_data->isValid )
+    {
+        m_data->isValid = on;
         sliderChange();
 
-        Q_EMIT valueChanged( d_data->value );
+        Q_EMIT valueChanged( m_data->value );
     }
 }
@@ -128,23 +125,23 @@
 bool QwtAbstractSlider::isValid() const
 {
-    return d_data->isValid;
-}
-
-/*!
-  En/Disable read only mode
-
-  In read only mode the slider can't be controlled by mouse
-  or keyboard.
-
-  \param on Enables in case of true
-  \sa isReadOnly()
-
-  \warning The focus policy is set to Qt::StrongFocus or Qt::NoFocus
-*/
+    return m_data->isValid;
+}
+
+/*!
+   En/Disable read only mode
+
+   In read only mode the slider can't be controlled by mouse
+   or keyboard.
+
+   \param on Enables in case of true
+   \sa isReadOnly()
+
+   \warning The focus policy is set to Qt::StrongFocus or Qt::NoFocus
+ */
 void QwtAbstractSlider::setReadOnly( bool on )
 {
-    if ( d_data->readOnly != on )
-    {
-        d_data->readOnly = on;
+    if ( m_data->readOnly != on )
+    {
+        m_data->readOnly = on;
         setFocusPolicy( on ? Qt::StrongFocus : Qt::NoFocus );
 
@@ -154,40 +151,40 @@
 
 /*!
-  In read only mode the slider can't be controlled by mouse
-  or keyboard.
-
-  \return true if read only
-  \sa setReadOnly()
-*/
+   In read only mode the slider can't be controlled by mouse
+   or keyboard.
+
+   \return true if read only
+   \sa setReadOnly()
+ */
 bool QwtAbstractSlider::isReadOnly() const
 {
-    return d_data->readOnly;
-}
-
-/*!
-  \brief Enables or disables tracking.
-
-  If tracking is enabled, the slider emits the valueChanged()
-  signal while the movable part of the slider is being dragged.
-  If tracking is disabled, the slider emits the valueChanged() signal
-  only when the user releases the slider.
-
-  Tracking is enabled by default.
-  \param on \c true (enable) or \c false (disable) tracking.
-
-  \sa isTracking(), sliderMoved()
-*/
+    return m_data->readOnly;
+}
+
+/*!
+   \brief Enables or disables tracking.
+
+   If tracking is enabled, the slider emits the valueChanged()
+   signal while the movable part of the slider is being dragged.
+   If tracking is disabled, the slider emits the valueChanged() signal
+   only when the user releases the slider.
+
+   Tracking is enabled by default.
+   \param on \c true (enable) or \c false (disable) tracking.
+
+   \sa isTracking(), sliderMoved()
+ */
 void QwtAbstractSlider::setTracking( bool on )
 {
-    d_data->isTracking = on;
-}
-
-/*!
-  \return True, when tracking has been enabled
-  \sa setTracking()
-*/
+    m_data->isTracking = on;
+}
+
+/*!
+   \return True, when tracking has been enabled
+   \sa setTracking()
+ */
 bool QwtAbstractSlider::isTracking() const
 {
-    return d_data->isTracking;
+    return m_data->isTracking;
 }
 
@@ -195,6 +192,6 @@
    Mouse press event handler
    \param event Mouse event
-*/
-void QwtAbstractSlider::mousePressEvent( QMouseEvent *event )
+ */
+void QwtAbstractSlider::mousePressEvent( QMouseEvent* event )
 {
     if ( isReadOnly() )
@@ -204,12 +201,12 @@
     }
 
-    if ( !d_data->isValid || lowerBound() == upperBound() )
+    if ( !m_data->isValid || lowerBound() == upperBound() )
         return;
 
-    d_data->isScrolling = isScrollPosition( event->pos() );
-
-    if ( d_data->isScrolling )
-    {
-        d_data->pendingValueChanged = false;
+    m_data->isScrolling = isScrollPosition( event->pos() );
+
+    if ( m_data->isScrolling )
+    {
+        m_data->pendingValueChanged = false;
 
         Q_EMIT sliderPressed();
@@ -220,6 +217,6 @@
    Mouse Move Event handler
    \param event Mouse event
-*/
-void QwtAbstractSlider::mouseMoveEvent( QMouseEvent *event )
+ */
+void QwtAbstractSlider::mouseMoveEvent( QMouseEvent* event )
 {
     if ( isReadOnly() )
@@ -229,12 +226,12 @@
     }
 
-    if ( d_data->isValid && d_data->isScrolling )
+    if ( m_data->isValid && m_data->isScrolling )
     {
         double value = scrolledTo( event->pos() );
-        if ( value != d_data->value )
+        if ( value != m_data->value )
         {
             value = boundedValue( value );
 
-            if ( d_data->stepAlignment )
+            if ( m_data->stepAlignment )
             {
                 value = alignedValue( value );
@@ -245,16 +242,16 @@
             }
 
-            if ( value != d_data->value )
+            if ( value != m_data->value )
             {
-                d_data->value = value;
+                m_data->value = value;
 
                 sliderChange();
 
-                Q_EMIT sliderMoved( d_data->value );
-
-                if ( d_data->isTracking )
-                    Q_EMIT valueChanged( d_data->value );
+                Q_EMIT sliderMoved( m_data->value );
+
+                if ( m_data->isTracking )
+                    Q_EMIT valueChanged( m_data->value );
                 else
-                    d_data->pendingValueChanged = true;
+                    m_data->pendingValueChanged = true;
             }
         }
@@ -265,6 +262,6 @@
    Mouse Release Event handler
    \param event Mouse event
-*/
-void QwtAbstractSlider::mouseReleaseEvent( QMouseEvent *event )
+ */
+void QwtAbstractSlider::mouseReleaseEvent( QMouseEvent* event )
 {
     if ( isReadOnly() )
@@ -274,10 +271,10 @@
     }
 
-    if ( d_data->isScrolling && d_data->isValid )
-    {
-        d_data->isScrolling = false;
-
-        if ( d_data->pendingValueChanged )
-            Q_EMIT valueChanged( d_data->value );
+    if ( m_data->isScrolling && m_data->isValid )
+    {
+        m_data->isScrolling = false;
+
+        if ( m_data->pendingValueChanged )
+            Q_EMIT valueChanged( m_data->value );
 
         Q_EMIT sliderReleased();
@@ -296,6 +293,6 @@
 
    \param event Wheel event
-*/
-void QwtAbstractSlider::wheelEvent( QWheelEvent *event )
+ */
+void QwtAbstractSlider::wheelEvent( QWheelEvent* event )
 {
     if ( isReadOnly() )
@@ -305,63 +302,71 @@
     }
 
-    if ( !d_data->isValid || d_data->isScrolling )
+    if ( !m_data->isValid || m_data->isScrolling )
         return;
 
+#if QT_VERSION < 0x050000
+    const int wheelDelta = event->delta();
+#else
+    const QPoint delta = event->angleDelta();
+    const int wheelDelta = ( qAbs( delta.x() ) > qAbs( delta.y() ) )
+        ? delta.x() : delta.y();
+#endif
+
     int numSteps = 0;
 
-    if ( ( event->modifiers() & Qt::ControlModifier) ||
+    if ( ( event->modifiers() & Qt::ControlModifier ) ||
         ( event->modifiers() & Qt::ShiftModifier ) )
     {
         // one page regardless of delta
-        numSteps = d_data->pageSteps;
-        if ( event->delta() < 0 )
+        numSteps = m_data->pageSteps;
+        if ( wheelDelta < 0 )
             numSteps = -numSteps;
     }
     else
     {
-        const int numTurns = ( event->delta() / 120 );
-        numSteps = numTurns * d_data->singleSteps;
-    }
-
-    if ( d_data->invertedControls )
+        const int numTurns = ( wheelDelta / 120 );
+        numSteps = numTurns * m_data->singleSteps;
+    }
+
+    if ( m_data->invertedControls )
         numSteps = -numSteps;
 
-    const double value = incrementedValue( d_data->value, numSteps );
-    if ( value != d_data->value )
-    {
-        d_data->value = value;
+    const double value = incrementedValue( m_data->value, numSteps );
+    if ( value != m_data->value )
+    {
+        m_data->value = value;
         sliderChange();
 
-        Q_EMIT sliderMoved( d_data->value );
-        Q_EMIT valueChanged( d_data->value );
-    }
-}
-
-/*!
-  Handles key events
-
-  QwtAbstractSlider handles the following keys:
-
-  - Qt::Key_Left\n
+        Q_EMIT sliderMoved( m_data->value );
+        Q_EMIT valueChanged( m_data->value );
+    }
+}
+
+/*!
+   Handles key events
+
+   QwtAbstractSlider handles the following keys:
+
+   - Qt::Key_Left\n
     Add/Subtract singleSteps() in direction to lowerBound();
-  - Qt::Key_Right\n
+   - Qt::Key_Right\n
     Add/Subtract singleSteps() in direction to upperBound();
-  - Qt::Key_Down\n
+   - Qt::Key_Down\n
     Subtract singleSteps(), when invertedControls() is false
-  - Qt::Key_Up\n
+   - Qt::Key_Up\n
     Add singleSteps(), when invertedControls() is false
-  - Qt::Key_PageDown\n
+   - Qt::Key_PageDown\n
     Subtract pageSteps(), when invertedControls() is false
-  - Qt::Key_PageUp\n
+   - Qt::Key_PageUp\n
     Add pageSteps(), when invertedControls() is false
-  - Qt::Key_Home\n
+   - Qt::Key_Home\n
     Set the value to the minimum()
-  - Qt::Key_End\n
+   - Qt::Key_End\n
     Set the value to the maximum()
 
-  \param event Key event
-  \sa isReadOnly()
-*/
-void QwtAbstractSlider::keyPressEvent( QKeyEvent *event )
+   \param event Key event
+   \sa isReadOnly()
+ */
+void QwtAbstractSlider::keyPressEvent( QKeyEvent* event )
 {
     if ( isReadOnly() )
@@ -371,9 +376,9 @@
     }
 
-    if ( !d_data->isValid || d_data->isScrolling )
+    if ( !m_data->isValid || m_data->isScrolling )
         return;
 
     int numSteps = 0;
-    double value = d_data->value;
+    double value = m_data->value;
 
     switch ( event->key() )
@@ -381,5 +386,5 @@
         case Qt::Key_Left:
         {
-            numSteps = -static_cast<int>( d_data->singleSteps );
+            numSteps = -static_cast< int >( m_data->singleSteps );
             if ( isInverted() )
                 numSteps = -numSteps;
@@ -389,5 +394,5 @@
         case Qt::Key_Right:
         {
-            numSteps = d_data->singleSteps;
+            numSteps = m_data->singleSteps;
             if ( isInverted() )
                 numSteps = -numSteps;
@@ -397,6 +402,6 @@
         case Qt::Key_Down:
         {
-            numSteps = -static_cast<int>( d_data->singleSteps );
-            if ( d_data->invertedControls )
+            numSteps = -static_cast< int >( m_data->singleSteps );
+            if ( m_data->invertedControls )
                 numSteps = -numSteps;
             break;
@@ -404,6 +409,6 @@
         case Qt::Key_Up:
         {
-            numSteps = d_data->singleSteps;
-            if ( d_data->invertedControls )
+            numSteps = m_data->singleSteps;
+            if ( m_data->invertedControls )
                 numSteps = -numSteps;
 
@@ -412,6 +417,6 @@
         case Qt::Key_PageUp:
         {
-            numSteps = d_data->pageSteps;
-            if ( d_data->invertedControls )
+            numSteps = m_data->pageSteps;
+            if ( m_data->invertedControls )
                 numSteps = -numSteps;
             break;
@@ -419,6 +424,6 @@
         case Qt::Key_PageDown:
         {
-            numSteps = -static_cast<int>( d_data->pageSteps );
-            if ( d_data->invertedControls )
+            numSteps = -static_cast< int >( m_data->pageSteps );
+            if ( m_data->invertedControls )
                 numSteps = -numSteps;
             break;
@@ -434,5 +439,5 @@
             break;
         }
-        default:;
+        default:
         {
             event->ignore();
@@ -442,138 +447,138 @@
     if ( numSteps != 0 )
     {
-        value = incrementedValue( d_data->value, numSteps );
-    }
-
-    if ( value != d_data->value )
-    {
-        d_data->value = value;
+        value = incrementedValue( m_data->value, numSteps );
+    }
+
+    if ( value != m_data->value )
+    {
+        m_data->value = value;
         sliderChange();
 
-        Q_EMIT sliderMoved( d_data->value );
-        Q_EMIT valueChanged( d_data->value );
-    }
-}
-
-/*!
-  \brief Set the number of steps
-
-  The range of the slider is divided into a number of steps from
-  which the value increments according to user inputs depend.
-
-  The default setting is 100.
-
-  \param stepCount Number of steps
-
-  \sa totalSteps(), setSingleSteps(), setPageSteps()
+        Q_EMIT sliderMoved( m_data->value );
+        Q_EMIT valueChanged( m_data->value );
+    }
+}
+
+/*!
+   \brief Set the number of steps
+
+   The range of the slider is divided into a number of steps from
+   which the value increments according to user inputs depend.
+
+   The default setting is 100.
+
+   \param stepCount Number of steps
+
+   \sa totalSteps(), setSingleSteps(), setPageSteps()
  */
 void QwtAbstractSlider::setTotalSteps( uint stepCount )
 {
-    d_data->totalSteps = stepCount;
-}
-
-/*!
-  \return Number of steps
-  \sa setTotalSteps(), singleSteps(), pageSteps()
+    m_data->totalSteps = stepCount;
+}
+
+/*!
+   \return Number of steps
+   \sa setTotalSteps(), singleSteps(), pageSteps()
  */
 uint QwtAbstractSlider::totalSteps() const
 {
-    return d_data->totalSteps;
-}
-
-/*!
-  \brief Set the number of steps for a single increment
-
-  The range of the slider is divided into a number of steps from
-  which the value increments according to user inputs depend.
-
-  \param stepCount Number of steps
-
-  \sa singleSteps(), setTotalSteps(), setPageSteps()
+    return m_data->totalSteps;
+}
+
+/*!
+   \brief Set the number of steps for a single increment
+
+   The range of the slider is divided into a number of steps from
+   which the value increments according to user inputs depend.
+
+   \param stepCount Number of steps
+
+   \sa singleSteps(), setTotalSteps(), setPageSteps()
  */
 
 void QwtAbstractSlider::setSingleSteps( uint stepCount )
 {
-    d_data->singleSteps = stepCount;
-}
-
-/*!
-  \return Number of steps
-  \sa setSingleSteps(), totalSteps(), pageSteps()
+    m_data->singleSteps = stepCount;
+}
+
+/*!
+   \return Number of steps
+   \sa setSingleSteps(), totalSteps(), pageSteps()
  */
 uint QwtAbstractSlider::singleSteps() const
 {
-    return d_data->singleSteps;
-}
-
-/*!
-  \brief Set the number of steps for a page increment
-
-  The range of the slider is divided into a number of steps from
-  which the value increments according to user inputs depend.
-
-  \param stepCount Number of steps
-
-  \sa pageSteps(), setTotalSteps(), setSingleSteps()
+    return m_data->singleSteps;
+}
+
+/*!
+   \brief Set the number of steps for a page increment
+
+   The range of the slider is divided into a number of steps from
+   which the value increments according to user inputs depend.
+
+   \param stepCount Number of steps
+
+   \sa pageSteps(), setTotalSteps(), setSingleSteps()
  */
 
 void QwtAbstractSlider::setPageSteps( uint stepCount )
 {
-    d_data->pageSteps = stepCount;
-}
-
-/*!
-  \return Number of steps
-  \sa setPageSteps(), totalSteps(), singleSteps()
+    m_data->pageSteps = stepCount;
+}
+
+/*!
+   \return Number of steps
+   \sa setPageSteps(), totalSteps(), singleSteps()
  */
 uint QwtAbstractSlider::pageSteps() const
 {
-    return d_data->pageSteps;
-}
-
-/*!
-  \brief Enable step alignment
-
-  When step alignment is enabled values resulting from slider
-  movements are aligned to the step size.
-
-  \param on Enable step alignment when true
-  \sa stepAlignment()
-*/
+    return m_data->pageSteps;
+}
+
+/*!
+   \brief Enable step alignment
+
+   When step alignment is enabled values resulting from slider
+   movements are aligned to the step size.
+
+   \param on Enable step alignment when true
+   \sa stepAlignment()
+ */
 void QwtAbstractSlider::setStepAlignment( bool on )
 {
-    if ( on != d_data->stepAlignment )
-    {
-        d_data->stepAlignment = on;
-    }
-}
-
-/*!
-  \return True, when step alignment is enabled
-  \sa setStepAlignment()
+    if ( on != m_data->stepAlignment )
+    {
+        m_data->stepAlignment = on;
+    }
+}
+
+/*!
+   \return True, when step alignment is enabled
+   \sa setStepAlignment()
  */
 bool QwtAbstractSlider::stepAlignment() const
 {
-    return d_data->stepAlignment;
-}
-
-/*!
-  Set the slider to the specified value
-
-  \param value New value
-  \sa setValid(), sliderChange(), valueChanged()
-*/
+    return m_data->stepAlignment;
+}
+
+/*!
+   Set the slider to the specified value
+
+   \param value New value
+   \sa setValid(), sliderChange(), valueChanged()
+ */
 void QwtAbstractSlider::setValue( double value )
 {
     value = qBound( minimum(), value, maximum() );
 
-    const bool changed = ( d_data->value != value ) || !d_data->isValid;
-
-    d_data->value = value;
-    d_data->isValid = true;
+    const bool changed = ( m_data->value != value ) || !m_data->isValid;
+
+    m_data->value = value;
+    m_data->isValid = true;
 
     if ( changed )
     {
         sliderChange();
-        Q_EMIT valueChanged( d_data->value );
+        Q_EMIT valueChanged( m_data->value );
     }
 }
@@ -582,73 +587,73 @@
 double QwtAbstractSlider::value() const
 {
-    return d_data->value;
-}
-
-/*!
-  If wrapping is true stepping up from upperBound() value will
-  take you to the minimum() value and vice versa.
-
-  \param on En/Disable wrapping
-  \sa wrapping()
-*/
+    return m_data->value;
+}
+
+/*!
+   If wrapping is true stepping up from upperBound() value will
+   take you to the minimum() value and vice versa.
+
+   \param on En/Disable wrapping
+   \sa wrapping()
+ */
 void QwtAbstractSlider::setWrapping( bool on )
 {
-    d_data->wrapping = on;
-}
-
-/*!
-  \return True, when wrapping is set
-  \sa setWrapping()
+    m_data->wrapping = on;
+}
+
+/*!
+   \return True, when wrapping is set
+   \sa setWrapping()
  */
 bool QwtAbstractSlider::wrapping() const
 {
-    return d_data->wrapping;
-}
-
-/*!
-  Invert wheel and key events
-
-  Usually scrolling the mouse wheel "up" and using keys like page
-  up will increase the slider's value towards its maximum.
-  When invertedControls() is enabled the value is scrolled
-  towards its minimum.
-
-  Inverting the controls might be f.e. useful for a vertical slider
-  with an inverted scale ( decreasing from top to bottom ).
-
-  \param on Invert controls, when true
-
-  \sa invertedControls(), keyEvent(), wheelEvent()
+    return m_data->wrapping;
+}
+
+/*!
+   Invert wheel and key events
+
+   Usually scrolling the mouse wheel "up" and using keys like page
+   up will increase the slider's value towards its maximum.
+   When invertedControls() is enabled the value is scrolled
+   towards its minimum.
+
+   Inverting the controls might be f.e. useful for a vertical slider
+   with an inverted scale ( decreasing from top to bottom ).
+
+   \param on Invert controls, when true
+
+   \sa invertedControls(), keyEvent(), wheelEvent()
  */
 void QwtAbstractSlider::setInvertedControls( bool on )
 {
-    d_data->invertedControls = on;
-}
-
-/*!
- \return True, when the controls are inverted
- \sa setInvertedControls()
+    m_data->invertedControls = on;
+}
+
+/*!
+   \return True, when the controls are inverted
+   \sa setInvertedControls()
  */
 bool QwtAbstractSlider::invertedControls() const
 {
-    return d_data->invertedControls;
-}
-
-/*!
-  Increment the slider
-
-  The step size depends on the number of totalSteps()
-
-  \param stepCount Number of steps
-  \sa setTotalSteps(), incrementedValue()
+    return m_data->invertedControls;
+}
+
+/*!
+   Increment the slider
+
+   The step size depends on the number of totalSteps()
+
+   \param stepCount Number of steps
+   \sa setTotalSteps(), incrementedValue()
  */
 void QwtAbstractSlider::incrementValue( int stepCount )
 {
     const double value = incrementedValue(
-        d_data->value, stepCount );
-
-    if ( value != d_data->value )
-    {
-        d_data->value = value;
+        m_data->value, stepCount );
+
+    if ( value != m_data->value )
+    {
+        m_data->value = value;
         sliderChange();
     }
@@ -656,18 +661,18 @@
 
 /*!
-  Increment a value
-
-  \param value Value
-  \param stepCount Number of steps
-
-  \return Incremented value
+   Increment a value
+
+   \param value Value
+   \param stepCount Number of steps
+
+   \return Incremented value
  */
 double QwtAbstractSlider::incrementedValue(
     double value, int stepCount ) const
 {
-    if ( d_data->totalSteps == 0 )
+    if ( m_data->totalSteps == 0 )
         return value;
 
-    const QwtTransform *transformation =
+    const QwtTransform* transformation =
         scaleMap().transformation();
 
@@ -675,22 +680,22 @@
     {
         const double range = maximum() - minimum();
-        value += stepCount * range / d_data->totalSteps;
+        value += stepCount * range / m_data->totalSteps;
     }
     else
     {
         QwtScaleMap map = scaleMap();
-        map.setPaintInterval( 0, d_data->totalSteps );
-
-        // we need equidant steps according to
+        map.setPaintInterval( 0, m_data->totalSteps );
+
+        // we need equidistant steps according to
         // paint device coordinates
         const double range = transformation->transform( maximum() )
             - transformation->transform( minimum() );
 
-        const double stepSize = range / d_data->totalSteps;
+        const double stepSize = range / m_data->totalSteps;
 
         double v = transformation->transform( value );
 
         v = qRound( v / stepSize ) * stepSize;
-        v += stepCount * range / d_data->totalSteps;
+        v += stepCount * range / m_data->totalSteps;
 
         value = transformation->invTransform( v );
@@ -699,5 +704,5 @@
     value = boundedValue( value );
 
-    if ( d_data->stepAlignment )
+    if ( m_data->stepAlignment )
         value = alignedValue( value );
 
@@ -710,21 +715,26 @@
     const double vmax = maximum();
 
-    if ( d_data->wrapping && vmin != vmax )
-    {
-        const int fullCircle = 360 * 16;
-
-        const double pd = scaleMap().pDist();
-        if ( int( pd / fullCircle ) * fullCircle == pd )
+    if ( m_data->wrapping && vmin != vmax )
+    {
+        if ( qFuzzyCompare( scaleMap().pDist(), 360.0 ) )
         {
             // full circle scales: min and max are the same
-            const double range = vmax - vmin;
-
-            if ( value < vmin )
+
+            if ( qFuzzyCompare( value, vmax ) )
             {
-                value += ::ceil( ( vmin - value ) / range ) * range;
+                value = vmin;
             }
-            else if ( value > vmax )
+            else
             {
-                value -= ::ceil( ( value - vmax ) / range ) * range;
+                const double range = vmax - vmin;
+
+                if ( value < vmin )
+                {
+                    value += std::ceil( ( vmin - value ) / range ) * range;
+                }
+                else if ( value > vmax )
+                {
+                    value -= std::ceil( ( value - vmax ) / range ) * range;
+                }
             }
         }
@@ -747,5 +757,5 @@
 double QwtAbstractSlider::alignedValue( double value ) const
 {
-    if ( d_data->totalSteps == 0 )
+    if ( m_data->totalSteps == 0 )
         return value;
 
@@ -754,5 +764,5 @@
     if ( scaleMap().transformation() == NULL )
     {
-        stepSize = ( maximum() - minimum() ) / d_data->totalSteps;
+        stepSize = ( maximum() - minimum() ) / m_data->totalSteps;
         if ( stepSize > 0.0 )
         {
@@ -763,5 +773,5 @@
     else
     {
-        stepSize = ( scaleMap().p2() - scaleMap().p1() ) / d_data->totalSteps;
+        stepSize = ( scaleMap().p2() - scaleMap().p1() ) / m_data->totalSteps;
 
         if ( stepSize > 0.0 )
@@ -797,18 +807,18 @@
 
 /*!
-  Update the slider according to modifications of the scale
+   Update the slider according to modifications of the scale
  */
 void QwtAbstractSlider::scaleChange()
 {
-    const double value = qBound( minimum(), d_data->value, maximum() );
-
-    const bool changed = ( value != d_data->value );
+    const double value = qBound( minimum(), m_data->value, maximum() );
+
+    const bool changed = ( value != m_data->value );
     if ( changed )
     {
-        d_data->value = value;
-    }
-
-    if ( d_data->isValid || changed )
-        Q_EMIT valueChanged( d_data->value );
+        m_data->value = value;
+    }
+
+    if ( m_data->isValid || changed )
+        Q_EMIT valueChanged( m_data->value );
 
     updateGeometry();
@@ -821,2 +831,4 @@
     update();
 }
+
+#include "moc_qwt_abstract_slider.cpp"
Index: /trunk/BNC/qwt/qwt_abstract_slider.h
===================================================================
--- /trunk/BNC/qwt/qwt_abstract_slider.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_abstract_slider.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -15,24 +15,24 @@
 
 /*!
-  \brief An abstract base class for slider widgets with a scale
+   \brief An abstract base class for slider widgets with a scale
 
-  A slider widget displays a value according to a scale.
-  The class is designed as a common super class for widgets like
-  QwtKnob, QwtDial and QwtSlider.
+   A slider widget displays a value according to a scale.
+   The class is designed as a common super class for widgets like
+   QwtKnob, QwtDial and QwtSlider.
 
-  When the slider is nor readOnly() its value can be modified
-  by keyboard, mouse and wheel inputs.
+   When the slider is nor readOnly() its value can be modified
+   by keyboard, mouse and wheel inputs.
 
-  The range of the slider is divided into a number of steps from
-  which the value increments according to user inputs depend.
-  Only for linear scales the number of steps correspond with
-  a fixed step size.
-*/
+   The range of the slider is divided into a number of steps from
+   which the value increments according to user inputs depend.
+   Only for linear scales the number of steps correspond with
+   a fixed step size.
+ */
 
-class QWT_EXPORT QwtAbstractSlider: public QwtAbstractScale
+class QWT_EXPORT QwtAbstractSlider : public QwtAbstractScale
 {
     Q_OBJECT
 
-    Q_PROPERTY( double value READ value WRITE setValue )
+    Q_PROPERTY( double value READ value WRITE setValue NOTIFY valueChanged USER true )
 
     Q_PROPERTY( uint totalSteps READ totalSteps WRITE setTotalSteps )
@@ -47,6 +47,6 @@
     Q_PROPERTY( bool invertedControls READ invertedControls WRITE setInvertedControls )
 
-public:
-    explicit QwtAbstractSlider( QWidget *parent = NULL );
+  public:
+    explicit QwtAbstractSlider( QWidget* parent = NULL );
     virtual ~QwtAbstractSlider();
 
@@ -80,76 +80,76 @@
     bool invertedControls() const;
 
-public Q_SLOTS:
+  public Q_SLOTS:
     void setValue( double value );
 
-Q_SIGNALS:
+  Q_SIGNALS:
 
     /*!
-      \brief Notify a change of value.
+       \brief Notify a change of value.
 
-      When tracking is enabled (default setting),
-      this signal will be emitted every time the value changes.
+       When tracking is enabled (default setting),
+       this signal will be emitted every time the value changes.
 
-      \param value New value
+       \param value New value
 
-      \sa setTracking(), sliderMoved()
-    */
+       \sa setTracking(), sliderMoved()
+     */
     void valueChanged( double value );
 
     /*!
-      This signal is emitted when the user presses the
-      movable part of the slider.
-    */
+       This signal is emitted when the user presses the
+       movable part of the slider.
+     */
     void sliderPressed();
 
     /*!
-      This signal is emitted when the user releases the
-      movable part of the slider.
-    */
+       This signal is emitted when the user releases the
+       movable part of the slider.
+     */
     void sliderReleased();
 
     /*!
-      This signal is emitted when the user moves the
-      slider with the mouse.
+       This signal is emitted when the user moves the
+       slider with the mouse.
 
-      \param value New value
+       \param value New value
 
-      \sa valueChanged()
-    */
+       \sa valueChanged()
+     */
     void sliderMoved( double value );
 
-protected:
-    virtual void mousePressEvent( QMouseEvent * );
-    virtual void mouseReleaseEvent( QMouseEvent * );
-    virtual void mouseMoveEvent( QMouseEvent * );
-    virtual void keyPressEvent( QKeyEvent * );
-    virtual void wheelEvent( QWheelEvent * );
+  protected:
+    virtual void mousePressEvent( QMouseEvent* ) QWT_OVERRIDE;
+    virtual void mouseReleaseEvent( QMouseEvent* ) QWT_OVERRIDE;
+    virtual void mouseMoveEvent( QMouseEvent* ) QWT_OVERRIDE;
+    virtual void keyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
+    virtual void wheelEvent( QWheelEvent* ) QWT_OVERRIDE;
 
     /*!
-      \brief Determine what to do when the user presses a mouse button.
+       \brief Determine what to do when the user presses a mouse button.
 
-      \param pos Mouse position
+       \param pos Mouse position
 
-      \retval True, when pos is a valid scroll position
-      \sa scrolledTo()
-    */
-    virtual bool isScrollPosition( const QPoint &pos ) const = 0;
+       \retval True, when pos is a valid scroll position
+       \sa scrolledTo()
+     */
+    virtual bool isScrollPosition( const QPoint& pos ) const = 0;
 
     /*!
-      \brief Determine the value for a new position of the
+       \brief Determine the value for a new position of the
              movable part of the slider
 
-      \param pos Mouse position
+       \param pos Mouse position
 
-      \return Value for the mouse position
-      \sa isScrollPosition()
-    */
-    virtual double scrolledTo( const QPoint &pos ) const = 0;
+       \return Value for the mouse position
+       \sa isScrollPosition()
+     */
+    virtual double scrolledTo( const QPoint& pos ) const = 0;
 
     void incrementValue( int stepCount );
 
-    virtual void scaleChange();
+    virtual void scaleChange() QWT_OVERRIDE;
 
-protected:
+  protected:
     virtual void sliderChange();
 
@@ -157,10 +157,10 @@
         double value, int stepCount ) const;
 
-private:
+  private:
     double alignedValue( double ) const;
     double boundedValue( double ) const;
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_analog_clock.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_analog_clock.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_analog_clock.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,39 +9,46 @@
 
 #include "qwt_analog_clock.h"
+#include "qwt_dial_needle.h"
 #include "qwt_round_scale_draw.h"
-#include <qmath.h>
+#include "qwt_text.h"
+#include "qwt_math.h"
+
 #include <qlocale.h>
-
-class QwtAnalogClockScaleDraw: public QwtRoundScaleDraw
-{
-public:
-    QwtAnalogClockScaleDraw()
-    {
-        setSpacing( 8 );
-
-        enableComponent( QwtAbstractScaleDraw::Backbone, false );
-
-        setTickLength( QwtScaleDiv::MinorTick, 2 );
-        setTickLength( QwtScaleDiv::MediumTick, 4 );
-        setTickLength( QwtScaleDiv::MajorTick, 8 );
-
-        setPenWidth( 1 );
-    }
-
-    virtual QwtText label( double value ) const
-    {
-        if ( qFuzzyCompare( value + 1.0, 1.0 ) )
-            value = 60.0 * 60.0 * 12.0;
-
-        return QLocale().toString( qRound( value / ( 60.0 * 60.0 ) ) );
-    }
-};
-
-/*!
-  Constructor
-  \param parent Parent widget
-*/
-QwtAnalogClock::QwtAnalogClock( QWidget *parent ):
-    QwtDial( parent )
+#include <qdatetime.h>
+
+namespace
+{
+    class QwtAnalogClockScaleDraw QWT_FINAL : public QwtRoundScaleDraw
+    {
+      public:
+        QwtAnalogClockScaleDraw()
+        {
+            setSpacing( 8 );
+
+            enableComponent( QwtAbstractScaleDraw::Backbone, false );
+
+            setTickLength( QwtScaleDiv::MinorTick, 2 );
+            setTickLength( QwtScaleDiv::MediumTick, 4 );
+            setTickLength( QwtScaleDiv::MajorTick, 8 );
+
+            setPenWidthF( 1.0 );
+        }
+
+        virtual QwtText label( double value ) const QWT_OVERRIDE
+        {
+            if ( qFuzzyCompare( value + 1.0, 1.0 ) )
+                value = 60.0 * 60.0 * 12.0;
+
+            return QLocale().toString( qRound( value / ( 60.0 * 60.0 ) ) );
+        }
+    };
+}
+
+/*!
+   Constructor
+   \param parent Parent widget
+ */
+QwtAnalogClock::QwtAnalogClock( QWidget* parent )
+    : QwtDial( parent )
 {
     setWrapping( true );
@@ -55,6 +62,6 @@
     const int secondsPerHour = 60.0 * 60.0;
 
-    QList<double> majorTicks;
-    QList<double> minorTicks;
+    QList< double > majorTicks;
+    QList< double > minorTicks;
 
     for ( int i = 0; i < 12; i++ )
@@ -91,10 +98,10 @@
         }
 
-        QwtDialSimpleNeedle *hand = new QwtDialSimpleNeedle(
+        QwtDialSimpleNeedle* hand = new QwtDialSimpleNeedle(
             QwtDialSimpleNeedle::Arrow, true, handColor, knobColor );
         hand->setWidth( width );
 
-        d_hand[i] = NULL;
-        setHand( static_cast<Hand>( i ), hand );
+        m_hand[i] = NULL;
+        setHand( static_cast< Hand >( i ), hand );
     }
 }
@@ -104,12 +111,12 @@
 {
     for ( int i = 0; i < NHands; i++ )
-        delete d_hand[i];
-}
-
-/*!
-  Nop method, use setHand() instead
-  \sa setHand()
-*/
-void QwtAnalogClock::setNeedle( QwtDialNeedle * )
+        delete m_hand[i];
+}
+
+/*!
+   Nop method, use setHand() instead
+   \sa setHand()
+ */
+void QwtAnalogClock::setNeedle( QwtDialNeedle* )
 {
     // no op
@@ -122,40 +129,40 @@
    \param needle Hand
    \sa hand()
-*/
-void QwtAnalogClock::setHand( Hand hand, QwtDialNeedle *needle )
+ */
+void QwtAnalogClock::setHand( Hand hand, QwtDialNeedle* needle )
 {
     if ( hand >= 0 && hand < NHands )
     {
-        delete d_hand[hand];
-        d_hand[hand] = needle;
-    }
-}
-
-/*!
-  \return Clock hand
-  \param hd Specifies the type of hand
-  \sa setHand()
-*/
-QwtDialNeedle *QwtAnalogClock::hand( Hand hd )
+        delete m_hand[hand];
+        m_hand[hand] = needle;
+    }
+}
+
+/*!
+   \return Clock hand
+   \param hd Specifies the type of hand
+   \sa setHand()
+ */
+QwtDialNeedle* QwtAnalogClock::hand( Hand hd )
 {
     if ( hd < 0 || hd >= NHands )
         return NULL;
 
-    return d_hand[hd];
-}
-
-/*!
-  \return Clock hand
-  \param hd Specifies the type of hand
-  \sa setHand()
-*/
-const QwtDialNeedle *QwtAnalogClock::hand( Hand hd ) const
-{
-    return const_cast<QwtAnalogClock *>( this )->hand( hd );
-}
-
-/*!
-  \brief Set the current time
-*/
+    return m_hand[hd];
+}
+
+/*!
+   \return Clock hand
+   \param hd Specifies the type of hand
+   \sa setHand()
+ */
+const QwtDialNeedle* QwtAnalogClock::hand( Hand hd ) const
+{
+    return const_cast< QwtAnalogClock* >( this )->hand( hd );
+}
+
+/*!
+   \brief Set the current time
+ */
 void QwtAnalogClock::setCurrentTime()
 {
@@ -164,8 +171,8 @@
 
 /*!
-  Set a time
-  \param time Time to display
-*/
-void QwtAnalogClock::setTime( const QTime &time )
+   Set a time
+   \param time Time to display
+ */
+void QwtAnalogClock::setTime( const QTime& time )
 {
     if ( time.isValid() )
@@ -179,22 +186,22 @@
 
 /*!
-  \brief Draw the needle
-
-  A clock has no single needle but three hands instead. drawNeedle()
-  translates value() into directions for the hands and calls
-  drawHand().
-
-  \param painter Painter
-  \param center Center of the clock
-  \param radius Maximum length for the hands
-  \param dir Dummy, not used.
-  \param colorGroup ColorGroup
-
-  \sa drawHand()
-*/
-void QwtAnalogClock::drawNeedle( QPainter *painter, const QPointF &center,
-    double radius, double dir, QPalette::ColorGroup colorGroup ) const
-{
-    Q_UNUSED( dir );
+   \brief Draw the needle
+
+   A clock has no single needle but three hands instead. drawNeedle()
+   translates value() into directions for the hands and calls
+   drawHand().
+
+   \param painter Painter
+   \param center Center of the clock
+   \param radius Maximum length for the hands
+   \param direction Dummy, not used.
+   \param colorGroup ColorGroup
+
+   \sa drawHand()
+ */
+void QwtAnalogClock::drawNeedle( QPainter* painter, const QPointF& center,
+    double radius, double direction, QPalette::ColorGroup colorGroup ) const
+{
+    Q_UNUSED( direction );
 
     if ( isValid() )
@@ -202,7 +209,7 @@
         const double hours = value() / ( 60.0 * 60.0 );
         const double minutes =
-            ( value() - qFloor(hours) * 60.0 * 60.0 ) / 60.0;
-        const double seconds = value() - qFloor(hours) * 60.0 * 60.0
-            - qFloor(minutes) * 60.0;
+            ( value() - std::floor(hours) * 60.0 * 60.0 ) / 60.0;
+        const double seconds = value() - std::floor(hours) * 60.0 * 60.0
+            - std::floor(minutes) * 60.0;
 
         double angle[NHands];
@@ -214,5 +221,5 @@
         {
             const double d = 360.0 - angle[hand] - origin();
-            drawHand( painter, static_cast<Hand>( hand ),
+            drawHand( painter, static_cast< Hand >( hand ),
                 center, radius, d, colorGroup );
         }
@@ -221,18 +228,18 @@
 
 /*!
-  Draw a clock hand
-
-  \param painter Painter
-  \param hd Specify the type of hand
-  \param center Center of the clock
-  \param radius Maximum length for the hands
-  \param direction Direction of the hand in degrees, counter clockwise
-  \param cg ColorGroup
-*/
-void QwtAnalogClock::drawHand( QPainter *painter, Hand hd,
-    const QPointF &center, double radius, double direction,
+   Draw a clock hand
+
+   \param painter Painter
+   \param hd Specify the type of hand
+   \param center Center of the clock
+   \param radius Maximum length for the hands
+   \param direction Direction of the hand in degrees, counter clockwise
+   \param cg ColorGroup
+ */
+void QwtAnalogClock::drawHand( QPainter* painter, Hand hd,
+    const QPointF& center, double radius, double direction,
     QPalette::ColorGroup cg ) const
 {
-    const QwtDialNeedle *needle = hand( hd );
+    const QwtDialNeedle* needle = hand( hd );
     if ( needle )
     {
@@ -243,2 +250,4 @@
     }
 }
+
+#include "moc_qwt_analog_clock.cpp"
Index: /trunk/BNC/qwt/qwt_analog_clock.h
===================================================================
--- /trunk/BNC/qwt/qwt_analog_clock.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_analog_clock.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,41 +13,41 @@
 #include "qwt_global.h"
 #include "qwt_dial.h"
-#include "qwt_dial_needle.h"
-#include <qdatetime.h>
+
+class QwtDialNeedle;
 
 /*!
-  \brief An analog clock
+   \brief An analog clock
 
-  \image html analogclock.png
+   \image html analogclock.png
 
-  \par Example
-  \code
-  #include <qwt_analog_clock.h>
+   \par Example
+   \code
+ #include <qwt_analog_clock.h>
 
-  QwtAnalogClock *clock = new QwtAnalogClock(...);
-  clock->scaleDraw()->setPenWidth(3);
-  clock->setLineWidth(6);
-  clock->setFrameShadow(QwtDial::Sunken);
-  clock->setTime();
+   QwtAnalogClock *clock = new QwtAnalogClock(...);
+   clock->scaleDraw()->setPenWidth(3);
+   clock->setLineWidth(6);
+   clock->setFrameShadow(QwtDial::Sunken);
+   clock->setTime();
 
-  // update the clock every second
-  QTimer *timer = new QTimer(clock);
-  timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime()));
-  timer->start(1000);
+   // update the clock every second
+   QTimer *timer = new QTimer(clock);
+   timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime()));
+   timer->start(1000);
 
-  \endcode
+   \endcode
 
-  \note The examples/dials example shows how to use QwtAnalogClock.
-*/
+   \note The examples/dials example shows how to use QwtAnalogClock.
+ */
 
-class QWT_EXPORT QwtAnalogClock: public QwtDial
+class QWT_EXPORT QwtAnalogClock : public QwtDial
 {
     Q_OBJECT
 
-public:
+  public:
     /*!
         Hand type
         \sa setHand(), hand()
-    */
+     */
     enum Hand
     {
@@ -68,25 +68,25 @@
     virtual ~QwtAnalogClock();
 
-    void setHand( Hand, QwtDialNeedle * );
+    void setHand( Hand, QwtDialNeedle* );
 
-    const QwtDialNeedle *hand( Hand ) const;
-    QwtDialNeedle *hand( Hand );
+    const QwtDialNeedle* hand( Hand ) const;
+    QwtDialNeedle* hand( Hand );
 
-public Q_SLOTS:
+  public Q_SLOTS:
     void setCurrentTime();
-    void setTime( const QTime & );
+    void setTime( const QTime& );
 
-protected:
-    virtual void drawNeedle( QPainter *, const QPointF &,
+  protected:
+    virtual void drawNeedle( QPainter*, const QPointF&, double radius,
+        double direction, QPalette::ColorGroup ) const QWT_OVERRIDE;
+
+    virtual void drawHand( QPainter*, Hand, const QPointF&,
         double radius, double direction, QPalette::ColorGroup ) const;
 
-    virtual void drawHand( QPainter *, Hand, const QPointF &,
-        double radius, double direction, QPalette::ColorGroup ) const;
+  private:
+    // use setHand instead
+    void setNeedle( QwtDialNeedle* );
 
-private:
-    // use setHand instead
-    void setNeedle( QwtDialNeedle * );
-
-    QwtDialNeedle *d_hand[NHands];
+    QwtDialNeedle* m_hand[NHands];
 };
 
Index: /trunk/BNC/qwt/qwt_arrow_button.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_arrow_button.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_arrow_button.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,10 +9,10 @@
 
 #include "qwt_arrow_button.h"
-#include "qwt_math.h"
+#include "qwt.h"
+
 #include <qpainter.h>
 #include <qstyle.h>
 #include <qstyleoption.h>
 #include <qevent.h>
-#include <qapplication.h>
 
 static const int MaxNum = 3;
@@ -22,5 +22,5 @@
 class QwtArrowButton::PrivateData
 {
-public:
+  public:
     int num;
     Qt::ArrowType arrowType;
@@ -30,5 +30,5 @@
 {
     QStyleOptionButton option;
-    option.init( btn );
+    option.initFrom( btn );
     option.features = QStyleOptionButton::None;
     if ( btn->isFlat() )
@@ -49,20 +49,19 @@
 
 /*!
-  \param num Number of arrows
-  \param arrowType see Qt::ArrowType in the Qt docs.
-  \param parent Parent widget
-*/
-QwtArrowButton::QwtArrowButton( int num,
-        Qt::ArrowType arrowType, QWidget *parent ):
-    QPushButton( parent )
-{
-    d_data = new PrivateData;
-    d_data->num = qBound( 1, num, MaxNum );
-    d_data->arrowType = arrowType;
+   \param num Number of arrows
+   \param arrowType see Qt::ArrowType in the Qt docs.
+   \param parent Parent widget
+ */
+QwtArrowButton::QwtArrowButton( int num, Qt::ArrowType arrowType, QWidget* parent )
+    : QPushButton( parent )
+{
+    m_data = new PrivateData;
+    m_data->num = qBound( 1, num, MaxNum );
+    m_data->arrowType = arrowType;
 
     setAutoRepeat( true );
     setAutoDefault( false );
 
-    switch ( d_data->arrowType )
+    switch ( m_data->arrowType )
     {
         case Qt::LeftArrow:
@@ -80,27 +79,27 @@
 QwtArrowButton::~QwtArrowButton()
 {
-    delete d_data;
-    d_data = NULL;
-}
-
-/*!
-  \brief The direction of the arrows
-*/
+    delete m_data;
+    m_data = NULL;
+}
+
+/*!
+   \brief The direction of the arrows
+ */
 Qt::ArrowType QwtArrowButton::arrowType() const
 {
-    return d_data->arrowType;
-}
-
-/*!
-  \brief The number of arrows
-*/
+    return m_data->arrowType;
+}
+
+/*!
+   \brief The number of arrows
+ */
 int QwtArrowButton::num() const
 {
-    return d_data->num;
-}
-
-/*!
-  \return the bounding rectangle for the label
-*/
+    return m_data->num;
+}
+
+/*!
+   \return the bounding rectangle for the label
+ */
 QRect QwtArrowButton::labelRect() const
 {
@@ -128,6 +127,6 @@
    Paint event handler
    \param event Paint event
-*/
-void QwtArrowButton::paintEvent( QPaintEvent *event )
+ */
+void QwtArrowButton::paintEvent( QPaintEvent* event )
 {
     QPushButton::paintEvent( event );
@@ -137,13 +136,13 @@
 
 /*!
-  \brief Draw the button label
-
-  \param painter Painter
-  \sa The Qt Manual for QPushButton
-*/
-void QwtArrowButton::drawButtonLabel( QPainter *painter )
-{
-    const bool isVertical = d_data->arrowType == Qt::UpArrow ||
-        d_data->arrowType == Qt::DownArrow;
+   \brief Draw the button label
+
+   \param painter Painter
+   \sa The Qt Manual for QPushButton
+ */
+void QwtArrowButton::drawButtonLabel( QPainter* painter )
+{
+    const bool isVertical = m_data->arrowType == Qt::UpArrow ||
+        m_data->arrowType == Qt::DownArrow;
 
     const QRect r = labelRect();
@@ -162,8 +161,8 @@
 
     QRect contentsSize; // aligned rect where to paint all arrows
-    if ( d_data->arrowType == Qt::LeftArrow || d_data->arrowType == Qt::RightArrow )
-    {
-        contentsSize.setWidth( d_data->num * arrow.width()
-            + ( d_data->num - 1 ) * Spacing );
+    if ( m_data->arrowType == Qt::LeftArrow || m_data->arrowType == Qt::RightArrow )
+    {
+        contentsSize.setWidth( m_data->num * arrow.width()
+            + ( m_data->num - 1 ) * Spacing );
         contentsSize.setHeight( arrow.height() );
     }
@@ -171,6 +170,6 @@
     {
         contentsSize.setWidth( arrow.width() );
-        contentsSize.setHeight( d_data->num * arrow.height()
-            + ( d_data->num - 1 ) * Spacing );
+        contentsSize.setHeight( m_data->num * arrow.height()
+            + ( m_data->num - 1 ) * Spacing );
     }
 
@@ -180,7 +179,7 @@
 
     painter->save();
-    for ( int i = 0; i < d_data->num; i++ )
-    {
-        drawArrow( painter, arrowRect, d_data->arrowType );
+    for ( int i = 0; i < m_data->num; i++ )
+    {
+        drawArrow( painter, arrowRect, m_data->arrowType );
 
         int dx = 0;
@@ -199,5 +198,5 @@
     {
         QStyleOptionFocusRect option;
-        option.init( this );
+        option.initFrom( this );
         option.backgroundColor = palette().color( QPalette::Window );
 
@@ -213,7 +212,7 @@
     \param r Rectangle where to paint the arrow
     \param arrowType Arrow type
-*/
-void QwtArrowButton::drawArrow( QPainter *painter,
-    const QRect &r, Qt::ArrowType arrowType ) const
+ */
+void QwtArrowButton::drawArrow( QPainter* painter,
+    const QRect& r, Qt::ArrowType arrowType ) const
 {
     QPolygon pa( 3 );
@@ -256,15 +255,15 @@
 
 /*!
-  \return a size hint
-*/
+   \return a size hint
+ */
 QSize QwtArrowButton::sizeHint() const
 {
     const QSize hint = minimumSizeHint();
-    return hint.expandedTo( QApplication::globalStrut() );
-}
-
-/*!
-  \brief Return a minimum size hint
-*/
+    return qwtExpandedToGlobalStrut( hint );
+}
+
+/*!
+   \brief Return a minimum size hint
+ */
 QSize QwtArrowButton::minimumSizeHint() const
 {
@@ -274,11 +273,11 @@
         2 * Margin + ( MaxNum - 1 ) * Spacing + MaxNum * asz.width(),
         2 * Margin + asz.height()
-    );
-
-    if ( d_data->arrowType == Qt::UpArrow || d_data->arrowType == Qt::DownArrow )
+        );
+
+    if ( m_data->arrowType == Qt::UpArrow || m_data->arrowType == Qt::DownArrow )
         sz.transpose();
 
     QStyleOption styleOption;
-    styleOption.init( this );
+    styleOption.initFrom( this );
 
     sz = style()->sizeFromContents( QStyle::CT_PushButton,
@@ -294,7 +293,7 @@
    \param boundingSize Bounding size
    \return Size of the arrow
-*/
+ */
 QSize QwtArrowButton::arrowSize( Qt::ArrowType arrowType,
-    const QSize &boundingSize ) const
+    const QSize& boundingSize ) const
 {
     QSize bs = boundingSize;
@@ -323,7 +322,7 @@
 
 /*!
-  \brief autoRepeat for the space keys
-*/
-void QwtArrowButton::keyPressEvent( QKeyEvent *event )
+   \brief autoRepeat for the space keys
+ */
+void QwtArrowButton::keyPressEvent( QKeyEvent* event )
 {
     if ( event->isAutoRepeat() && event->key() == Qt::Key_Space )
Index: /trunk/BNC/qwt/qwt_arrow_button.h
===================================================================
--- /trunk/BNC/qwt/qwt_arrow_button.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_arrow_button.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -15,14 +15,14 @@
 
 /*!
-  \brief Arrow Button
+   \brief Arrow Button
 
-  A push button with one or more filled triangles on its front.
-  An Arrow button can have 1 to 3 arrows in a row, pointing
-  up, down, left or right.
-*/
+   A push button with one or more filled triangles on its front.
+   An Arrow button can have 1 to 3 arrows in a row, pointing
+   up, down, left or right.
+ */
 class QWT_EXPORT QwtArrowButton : public QPushButton
 {
-public:
-    explicit QwtArrowButton ( int num, Qt::ArrowType, QWidget *parent = NULL );
+  public:
+    explicit QwtArrowButton ( int num, Qt::ArrowType, QWidget* parent = NULL );
     virtual ~QwtArrowButton();
 
@@ -30,22 +30,21 @@
     int num() const;
 
-    virtual QSize sizeHint() const;
-    virtual QSize minimumSizeHint() const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
+    virtual QSize minimumSizeHint() const QWT_OVERRIDE;
 
-protected:
-    virtual void paintEvent( QPaintEvent *event );
+  protected:
+    virtual void paintEvent( QPaintEvent*) QWT_OVERRIDE;
+    virtual void keyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
 
-    virtual void drawButtonLabel( QPainter * );
-    virtual void drawArrow( QPainter *,
-        const QRect &, Qt::ArrowType ) const;
+    virtual void drawButtonLabel( QPainter* );
+    virtual void drawArrow( QPainter*,
+        const QRect&, Qt::ArrowType ) const;
     virtual QRect labelRect() const;
     virtual QSize arrowSize( Qt::ArrowType,
-        const QSize &boundingSize ) const;
+        const QSize& boundingSize ) const;
 
-    virtual void keyPressEvent( QKeyEvent * );
-
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_axis.h
===================================================================
--- /trunk/BNC/qwt/qwt_axis.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_axis.h	(revision 11158)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_AXIS_H
+#define QWT_AXIS_H
+
+#include "qwt_global.h"
+
+/*!
+   Enums and methods for axes
+ */
+namespace QwtAxis
+{
+    //! \brief Axis position
+    enum Position
+    {
+        //! Y axis left of the canvas
+        YLeft,
+
+        //! Y axis right of the canvas
+        YRight,
+
+        //! X axis below the canvas
+        XBottom,
+
+        //! X axis above the canvas
+        XTop
+    };
+
+    //! \brief Number of axis positions
+    enum { AxisPositions = XTop + 1 };
+
+    bool isValid( int axisPos );
+    bool isYAxis( int axisPos );
+    bool isXAxis( int axisPos );
+}
+
+//! \return true, when axisPos is in the valid range [ YLeft, XTop ]
+inline bool QwtAxis::isValid( int axisPos )
+{
+    return ( axisPos >= 0 && axisPos < AxisPositions );
+}
+
+//! \return true, when axisPos is XBottom or XTop
+inline bool QwtAxis::isXAxis( int axisPos )
+{
+    return ( axisPos == XBottom ) || ( axisPos == XTop );
+}
+
+//! \return true, when axisPos is YLeft or YRight
+inline bool QwtAxis::isYAxis( int axisPos )
+{
+    return ( axisPos == YLeft ) || ( axisPos == YRight );
+}
+
+#endif
Index: /trunk/BNC/qwt/qwt_axis_id.h
===================================================================
--- /trunk/BNC/qwt/qwt_axis_id.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_axis_id.h	(revision 11158)
@@ -0,0 +1,28 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_AXIS_ID_H
+#define QWT_AXIS_ID_H
+
+#include "qwt_global.h"
+#include "qwt_axis.h"
+
+/*!
+    \brief Axis identifier
+
+    An axis id is one of values of QwtAxis::Position.
+
+    QwtAxisId is a placeholder for future releases ( -> multiaxes branch ),
+    where it is possible to have more than one axis at each side of a plot.
+
+    \sa QwtAxis
+ */
+typedef int QwtAxisId;
+
+#endif
Index: /trunk/BNC/qwt/qwt_bezier.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_bezier.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_bezier.cpp	(revision 11158)
@@ -0,0 +1,252 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_bezier.h"
+#include "qwt_math.h"
+
+#include <qpolygon.h>
+#include <qstack.h>
+
+namespace
+{
+    class BezierData
+    {
+      public:
+        inline BezierData()
+        {
+            // default constructor with uninitialized points
+        }
+
+        inline BezierData( const QPointF& p1, const QPointF& cp1,
+                const QPointF& cp2, const QPointF& p2 ):
+            m_x1( p1.x() ),
+            m_y1( p1.y() ),
+            m_cx1( cp1.x() ),
+            m_cy1( cp1.y() ),
+            m_cx2( cp2.x() ),
+            m_cy2( cp2.y() ),
+            m_x2( p2.x() ),
+            m_y2( p2.y() )
+        {
+        }
+
+        static inline double minFlatness( double tolerance )
+        {
+            // we can simplify the tolerance criterion check in
+            // the subdivision loop, by precalculating some
+            // flatness value.
+
+            return 16 * ( tolerance * tolerance );
+        }
+
+        inline double flatness() const
+        {
+            // algo by Roger Willcocks ( http://www.rops.org )
+
+            const double ux = 3.0 * m_cx1 - 2.0 * m_x1 - m_x2;
+            const double uy = 3.0 * m_cy1 - 2.0 * m_y1 - m_y2;
+            const double vx = 3.0 * m_cx2 - 2.0 * m_x2 - m_x1;
+            const double vy = 3.0 * m_cy2 - 2.0 * m_y2 - m_y1;
+
+            const double ux2 = ux * ux;
+            const double uy2 = uy * uy;
+
+            const double vx2 = vx * vx;
+            const double vy2 = vy * vy;
+
+            return qwtMaxF( ux2, vx2 ) + qwtMaxF( uy2, vy2 );
+        }
+
+        inline BezierData subdivided()
+        {
+            BezierData bz;
+
+            const double c1 = midValue( m_cx1, m_cx2 );
+
+            bz.m_cx1 = midValue( m_x1, m_cx1 );
+            m_cx2 = midValue( m_cx2, m_x2 );
+            bz.m_x1 = m_x1;
+            bz.m_cx2 = midValue( bz.m_cx1, c1 );
+            m_cx1 = midValue( c1, m_cx2 );
+            bz.m_x2 = m_x1 = midValue( bz.m_cx2, m_cx1 );
+
+            const double c2 = midValue( m_cy1, m_cy2 );
+
+            bz.m_cy1 = midValue( m_y1, m_cy1 );
+            m_cy2 = midValue( m_cy2, m_y2 );
+            bz.m_y1 = m_y1;
+            bz.m_cy2 = midValue( bz.m_cy1, c2 );
+            m_cy1 = midValue( m_cy2, c2 );
+            bz.m_y2 = m_y1 = midValue( bz.m_cy2, m_cy1 );
+
+            return bz;
+        }
+
+        inline QPointF p2() const
+        {
+            return QPointF( m_x2, m_y2 );
+        }
+
+      private:
+        inline double midValue( double v1, double v2 )
+        {
+            return 0.5 * ( v1 + v2 );
+        }
+
+        double m_x1, m_y1;
+        double m_cx1, m_cy1;
+        double m_cx2, m_cy2;
+        double m_x2, m_y2;
+    };
+}
+
+/*!
+   \brief Constructor
+
+   \param tolerance Termination criterion for the subdivision
+   \sa setTolerance()
+ */
+
+QwtBezier::QwtBezier( double tolerance )
+    : m_tolerance( qwtMaxF( tolerance, 0.0 ) )
+    , m_flatness( BezierData::minFlatness( m_tolerance ) )
+{
+}
+
+//! Destructor
+QwtBezier::~QwtBezier()
+{
+}
+
+/*!
+   Set the tolerance
+
+   The tolerance is a measurement for the flatness of a curve.
+   A curve with a flatness below the tolerance is considered as being flat
+   terminating the subdivision algorithm.
+
+   When interpolating a Bezier curve to render it as a sequence of lines
+   to some sort of raster ( f.e to screen ) a value of 0.5 of the pixel size
+   is a good value for the tolerance.
+
+   \param tolerance Termination criterion for the subdivision
+   \sa tolerance()
+ */
+void QwtBezier::setTolerance( double tolerance )
+{
+    m_tolerance = qwtMaxF( tolerance, 0.0 );
+    m_flatness = BezierData::minFlatness( m_tolerance );
+}
+
+/*!
+   \brief Interpolate a Bézier curve by a polygon
+
+   \param p1 Start point
+   \param cp1 First control point
+   \param cp2 Second control point
+   \param p2 End point
+
+   \return Interpolating polygon
+ */
+QPolygonF QwtBezier::toPolygon( const QPointF& p1,
+    const QPointF& cp1, const QPointF& cp2, const QPointF& p2 ) const
+{
+    QPolygonF polygon;
+
+    if ( m_flatness > 0.0 )
+    {
+        // a flatness of 0.0 is not achievable
+        appendToPolygon( p1, cp1, cp2, p2, polygon );
+    }
+
+    return polygon;
+}
+
+/*!
+   \brief Interpolate a Bézier curve by a polygon
+
+   appendToPolygon() is tailored for cumulating points from a sequence
+   of bezier curves like being created by a spline interpolation.
+
+   \param p1 Start point
+   \param cp1 First control point
+   \param cp2 Second control point
+   \param p2 End point
+   \param polygon Polygon, where the interpolating points are added
+
+   \note If the last point of the incoming polygon matches p1 it won't be
+        inserted a second time.
+ */
+void QwtBezier::appendToPolygon( const QPointF& p1, const QPointF& cp1,
+    const QPointF& cp2, const QPointF& p2, QPolygonF& polygon ) const
+{
+    if ( m_flatness <= 0.0 )
+    {
+        // a flatness of 0.0 is not achievable
+        return;
+    }
+
+    if ( polygon.isEmpty() || polygon.last() != p1 )
+        polygon += p1;
+
+    // to avoid deep stacks we convert the recursive algo
+    // to something iterative, where the parameters of the
+    // recursive class are pushed to a stack instead
+
+    QStack< BezierData > stack;
+    stack.push( BezierData( p1, cp1, cp2, p2 ) );
+
+    while( true )
+    {
+        BezierData& bz = stack.top();
+
+        if ( bz.flatness() < m_flatness )
+        {
+            if ( stack.size() == 1 )
+            {
+                polygon += p2;
+                return;
+            }
+
+            polygon += bz.p2();
+            stack.pop();
+        }
+        else
+        {
+            stack.push( bz.subdivided() );
+        }
+    }
+
+}
+
+/*!
+   Find a point on a Bézier Curve
+
+   \param p1 Start point
+   \param cp1 First control point
+   \param cp2 Second control point
+   \param p2 End point
+   \param t Parameter value, something between [0,1]
+
+   \return Point on the curve
+ */
+QPointF QwtBezier::pointAt( const QPointF& p1,
+    const QPointF& cp1, const QPointF& cp2, const QPointF& p2, double t )
+{
+    const double d1 = 3.0 * t;
+    const double d2 = 3.0 * t * t;
+    const double d3 = t * t * t;
+    const double s = 1.0 - t;
+
+    const double x = ( ( s * p1.x() + d1 * cp1.x() ) * s + d2 * cp2.x() ) * s + d3 * p2.x();
+    const double y = ( ( s * p1.y() + d1 * cp1.y() ) * s + d2 * cp2.y() ) * s + d3 * p2.y();
+
+    return QPointF( x, y );
+}
+
Index: /trunk/BNC/qwt/qwt_bezier.h
===================================================================
--- /trunk/BNC/qwt/qwt_bezier.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_bezier.h	(revision 11158)
@@ -0,0 +1,61 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_BEZIER_H
+#define QWT_BEZIER_H
+
+#include "qwt_global.h"
+
+class QPointF;
+class QPolygonF;
+
+/*!
+   \brief An implementation of the de Casteljau’s Algorithm for interpolating
+         Bézier curves
+
+   The flatness criterion for terminating the subdivision is based on
+   "Piecewise Linear Approximation of Bézier Curves" by
+   Roger Willcocks ( http://www.rops.org )
+
+   This article explains the maths behind in a very nice way:
+   https://jeremykun.com/2013/05/11/bezier-curves-and-picasso
+ */
+class QWT_EXPORT QwtBezier
+{
+  public:
+    QwtBezier( double tolerance = 0.5 );
+    ~QwtBezier();
+
+    void setTolerance( double tolerance );
+    double tolerance() const;
+
+    QPolygonF toPolygon( const QPointF& p1, const QPointF& cp1,
+        const QPointF& cp2, const QPointF& p2 ) const;
+
+    void appendToPolygon( const QPointF& p1, const QPointF& cp1,
+        const QPointF& cp2, const QPointF& p2, QPolygonF& polygon ) const;
+
+    static QPointF pointAt( const QPointF& p1, const QPointF& cp1,
+        const QPointF& cp2, const QPointF& p2, double t );
+
+  private:
+    double m_tolerance;
+    double m_flatness;
+};
+
+/*!
+   \return Tolerance, that is used as criterion for the subdivision
+   \sa setTolerance()
+ */
+inline double QwtBezier::tolerance() const
+{
+    return m_tolerance;
+}
+
+#endif
Index: /trunk/BNC/qwt/qwt_clipper.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_clipper.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_clipper.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,302 +10,219 @@
 #include "qwt_clipper.h"
 #include "qwt_point_polar.h"
+#include "qwt_interval.h"
+#include "qwt_math.h"
+
+#include <qpolygon.h>
 #include <qrect.h>
-#include <string.h>
-#include <stdlib.h>
-
-#if QT_VERSION < 0x040601
-#define qAtan(x) ::atan(x)
-#endif
+
+#include <algorithm>
 
 namespace QwtClip
 {
     // some templates used for inlining
-    template <class Point, typename T> class LeftEdge;
-    template <class Point, typename T> class RightEdge;
-    template <class Point, typename T> class TopEdge;
-    template <class Point, typename T> class BottomEdge;
-
-    template <class Point> class PointBuffer;
-}
-
-template <class Point, typename Value>
+    template< class Point, typename T > class LeftEdge;
+    template< class Point, typename T > class RightEdge;
+    template< class Point, typename T > class TopEdge;
+    template< class Point, typename T > class BottomEdge;
+}
+
+template< class Point, typename Value >
 class QwtClip::LeftEdge
 {
-public:
+  public:
     inline LeftEdge( Value x1, Value, Value, Value ):
-        d_x1( x1 )
-    {
-    }
-
-    inline bool isInside( const Point &p  ) const
-    {
-        return p.x() >= d_x1;
-    }
-
-    inline Point intersection( const Point &p1, const Point &p2 ) const
+        m_x1( x1 )
+    {
+    }
+
+    inline bool isInside( const Point& p  ) const
+    {
+        return p.x() >= m_x1;
+    }
+
+    inline Point intersection( const Point& p1, const Point& p2 ) const
     {
         double dy = ( p1.y() - p2.y() ) / double( p1.x() - p2.x() );
-        return Point( d_x1, static_cast< Value >( p2.y() + ( d_x1 - p2.x() ) * dy ) );
-    }
-private:
-    const Value d_x1;
-};
-
-template <class Point, typename Value>
+        return Point( m_x1, static_cast< Value >( p2.y() + ( m_x1 - p2.x() ) * dy ) );
+    }
+  private:
+    const Value m_x1;
+};
+
+template< class Point, typename Value >
 class QwtClip::RightEdge
 {
-public:
+  public:
     inline RightEdge( Value, Value x2, Value, Value ):
-        d_x2( x2 )
-    {
-    }
-
-    inline bool isInside( const Point &p  ) const
-    {
-        return p.x() <= d_x2;
-    }
-
-    inline Point intersection( const Point &p1, const Point &p2 ) const
+        m_x2( x2 )
+    {
+    }
+
+    inline bool isInside( const Point& p  ) const
+    {
+        return p.x() <= m_x2;
+    }
+
+    inline Point intersection( const Point& p1, const Point& p2 ) const
     {
         double dy = ( p1.y() - p2.y() ) / double( p1.x() - p2.x() );
-        return Point( d_x2, static_cast<Value>( p2.y() + ( d_x2 - p2.x() ) * dy ) );
-    }
-
-private:
-    const Value d_x2;
-};
-
-template <class Point, typename Value>
+        return Point( m_x2, static_cast< Value >( p2.y() + ( m_x2 - p2.x() ) * dy ) );
+    }
+
+  private:
+    const Value m_x2;
+};
+
+template< class Point, typename Value >
 class QwtClip::TopEdge
 {
-public:
+  public:
     inline TopEdge( Value, Value, Value y1, Value ):
-        d_y1( y1 )
-    {
-    }
-
-    inline bool isInside( const Point &p  ) const
-    {
-        return p.y() >= d_y1;
-    }
-
-    inline Point intersection( const Point &p1, const Point &p2 ) const
+        m_y1( y1 )
+    {
+    }
+
+    inline bool isInside( const Point& p  ) const
+    {
+        return p.y() >= m_y1;
+    }
+
+    inline Point intersection( const Point& p1, const Point& p2 ) const
     {
         double dx = ( p1.x() - p2.x() ) / double( p1.y() - p2.y() );
-        return Point( static_cast<Value>( p2.x() + ( d_y1 - p2.y() ) * dx ), d_y1 );
-    }
-
-private:
-    const Value d_y1;
-};
-
-template <class Point, typename Value>
+        return Point( static_cast< Value >( p2.x() + ( m_y1 - p2.y() ) * dx ), m_y1 );
+    }
+
+  private:
+    const Value m_y1;
+};
+
+template< class Point, typename Value >
 class QwtClip::BottomEdge
 {
-public:
+  public:
     inline BottomEdge( Value, Value, Value, Value y2 ):
-        d_y2( y2 )
-    {
-    }
-
-    inline bool isInside( const Point &p ) const
-    {
-        return p.y() <= d_y2;
-    }
-
-    inline Point intersection( const Point &p1, const Point &p2 ) const
+        m_y2( y2 )
+    {
+    }
+
+    inline bool isInside( const Point& p ) const
+    {
+        return p.y() <= m_y2;
+    }
+
+    inline Point intersection( const Point& p1, const Point& p2 ) const
     {
         double dx = ( p1.x() - p2.x() ) / double( p1.y() - p2.y() );
-        return Point( static_cast<Value>( p2.x() + ( d_y2 - p2.y() ) * dx ), d_y2 );
-    }
-
-private:
-    const Value d_y2;
-};
-
-template<class Point>
-class QwtClip::PointBuffer
-{
-public:
-    PointBuffer( int capacity = 0 ):
-        m_capacity( 0 ),
-        m_size( 0 ),
-        m_buffer( NULL )
-    {
-        if ( capacity > 0 )
-            reserve( capacity );
-    }
-
-    ~PointBuffer()
-    {
-        if ( m_buffer )
-            ::free( m_buffer );
-    }
-
-    inline void setPoints( int numPoints, const Point *points )
-    {
-        reserve( numPoints );
-
-        m_size = numPoints;
-        ::memcpy( m_buffer, points, m_size * sizeof( Point ) );
-    }
-
-    inline void reset()
-    {
-        m_size = 0;
-    }
-
-    inline int size() const
-    {
-        return m_size;
-    }
-
-    inline Point *data() const
-    {
-        return m_buffer;
-    }
-
-    inline Point &operator[]( int i )
-    {
-        return m_buffer[i];
-    }
-
-    inline const Point &operator[]( int i ) const
-    {
-        return m_buffer[i];
-    }
-
-    inline void add( const Point &point )
-    {
-        if ( m_capacity <= m_size )
-            reserve( m_size + 1 );
-
-        m_buffer[m_size++] = point;
-    }
-
-private:
-    inline void reserve( int size )
-    {
-        if ( m_capacity == 0 )
-            m_capacity = 1;
-
-        while ( m_capacity < size )
-            m_capacity *= 2;
-
-        m_buffer = static_cast<Point *>(
-            ::realloc( m_buffer, m_capacity * sizeof( Point ) ) );
-    }
-
-    int m_capacity;
-    int m_size;
-    Point *m_buffer;
+        return Point( static_cast< Value >( p2.x() + ( m_y2 - p2.y() ) * dx ), m_y2 );
+    }
+
+  private:
+    const Value m_y2;
 };
 
 using namespace QwtClip;
 
-template <class Polygon, class Rect, class Point, typename T>
+template< class Polygon, class Rect, typename T >
 class QwtPolygonClipper
 {
-public:
-    QwtPolygonClipper( const Rect &clipRect ):
-        d_clipRect( clipRect )
-    {
-    }
-
-    Polygon clipPolygon( const Polygon &polygon, bool closePolygon ) const
+    typedef typename Polygon::value_type Point;
+  public:
+    explicit QwtPolygonClipper( const Rect& clipRect ):
+        m_clipRect( clipRect )
+    {
+    }
+
+    void clipPolygon( Polygon& points1, bool closePolygon ) const
     {
 #if 0
-        if ( d_clipRect.contains( polygon.boundingRect() ) )
+        if ( m_clipRect.contains( points1.boundingRect() ) )
             return polygon;
 #endif
 
-        PointBuffer<Point> points1;
-        PointBuffer<Point> points2( qMin( 256, polygon.size() ) );
-
-        points1.setPoints( polygon.size(), polygon.data() );
-
-        clipEdge< LeftEdge<Point, T> >( closePolygon, points1, points2 );
-        clipEdge< RightEdge<Point, T> >( closePolygon, points2, points1 );
-        clipEdge< TopEdge<Point, T> >( closePolygon, points1, points2 );
-        clipEdge< BottomEdge<Point, T> >( closePolygon, points2, points1 );
-
-        Polygon p;
-        p.resize( points1.size() );
-        ::memcpy( p.data(), points1.data(), points1.size() * sizeof( Point ) );
-
-        return p;
-    }
-
-private:
-    template <class Edge>
+        Polygon points2;
+        points2.reserve( qMin( 256, points1.size() ) );
+
+        clipEdge< LeftEdge< Point, T > >( closePolygon, points1, points2 );
+        clipEdge< RightEdge< Point, T > >( closePolygon, points2, points1 );
+        clipEdge< TopEdge< Point, T > >( closePolygon, points1, points2 );
+        clipEdge< BottomEdge< Point, T > >( closePolygon, points2, points1 );
+    }
+
+  private:
+    template< class Edge >
     inline void clipEdge( bool closePolygon,
-        PointBuffer<Point> &points, PointBuffer<Point> &clippedPoints ) const
-    {
-        clippedPoints.reset();
+        const Polygon& points, Polygon& clippedPoints ) const
+    {
+        clippedPoints.clear();
 
         if ( points.size() < 2 )
         {
             if ( points.size() == 1 )
-                clippedPoints.add( points[0] );
+                clippedPoints += points[0];
+
             return;
         }
 
-        const Edge edge( d_clipRect.x(), d_clipRect.x() + d_clipRect.width(),
-            d_clipRect.y(), d_clipRect.y() + d_clipRect.height() );
-
-        int lastPos, start;
-        if ( closePolygon )
-        {
-            start = 0;
-            lastPos = points.size() - 1;
+        const Edge edge( m_clipRect.x(), m_clipRect.x() + m_clipRect.width(),
+            m_clipRect.y(), m_clipRect.y() + m_clipRect.height() );
+
+        if ( !closePolygon )
+        {
+            const Point& p1 = points.first();
+
+            if ( edge.isInside( p1 ) )
+                clippedPoints += p1;
         }
         else
         {
-            start = 1;
-            lastPos = 0;
-
-            if ( edge.isInside( points[0] ) )
-                clippedPoints.add( points[0] );
-        }
-
-        const uint nPoints = points.size();
-        for ( uint i = start; i < nPoints; i++ )
-        {
-            const Point &p1 = points[i];
-            const Point &p2 = points[lastPos];
+            const Point& p1 = points.first();
+            const Point& p2 = points.last();
 
             if ( edge.isInside( p1 ) )
             {
-                if ( edge.isInside( p2 ) )
-                {
-                    clippedPoints.add( p1 );
-                }
-                else
-                {
-                    clippedPoints.add( edge.intersection( p1, p2 ) );
-                    clippedPoints.add( p1 );
-                }
+                if ( !edge.isInside( p2 ) )
+                    clippedPoints += edge.intersection( p1, p2 );
+
+                clippedPoints += p1;
             }
-            else
+            else if ( edge.isInside( p2 ) )
             {
-                if ( edge.isInside( p2 ) )
-                {
-                    clippedPoints.add( edge.intersection( p1, p2 ) );
-                }
+                clippedPoints += edge.intersection( p1, p2 );
             }
-            lastPos = i;
-        }
-    }
-
-    const Rect d_clipRect;
+        }
+
+        const uint nPoints = points.size();
+        const Point* p = points.constData();
+
+        for ( uint i = 1; i < nPoints; i++ )
+        {
+            const Point& p1 = p[i];
+            const Point& p2 = p[i - 1];
+
+            if ( edge.isInside( p1 ) )
+            {
+                if ( !edge.isInside( p2 ) )
+                    clippedPoints += edge.intersection( p1, p2 );
+
+                clippedPoints += p1;
+            }
+            else if ( edge.isInside( p2 ) )
+            {
+                clippedPoints += edge.intersection( p1, p2 );
+            }
+        }
+    }
+
+    const Rect m_clipRect;
 };
 
 class QwtCircleClipper
 {
-public:
-    QwtCircleClipper( const QRectF &r );
-    QVector<QwtInterval> clipCircle( const QPointF &, double radius ) const;
-
-private:
+  public:
+    explicit QwtCircleClipper( const QRectF& r );
+    QVector< QwtInterval > clipCircle( const QPointF&, double radius ) const;
+
+  private:
     enum Edge
     {
@@ -318,52 +235,59 @@
     };
 
-    QList<QPointF> cuttingPoints(
-        Edge, const QPointF &pos, double radius ) const;
-
-    double toAngle( const QPointF &, const QPointF & ) const;
-
-    const QRectF d_rect;
-};
-
-
-QwtCircleClipper::QwtCircleClipper( const QRectF &r ):
-    d_rect( r )
-{
-}
-
-QVector<QwtInterval> QwtCircleClipper::clipCircle(
-    const QPointF &pos, double radius ) const
-{
-    QList<QPointF> points;
+    QVector< QPointF > cuttingPoints(
+        Edge, const QPointF& pos, double radius ) const;
+
+    double toAngle( const QPointF&, const QPointF& ) const;
+
+    const QRectF m_rect;
+};
+
+
+QwtCircleClipper::QwtCircleClipper( const QRectF& r )
+    : m_rect( r )
+{
+}
+
+QVector< QwtInterval > QwtCircleClipper::clipCircle(
+    const QPointF& pos, double radius ) const
+{
+    // using QVarLengthArray TODO ...
+
+    QVector< QPointF > points;
     for ( int edge = 0; edge < NEdges; edge++ )
-        points += cuttingPoints( static_cast<Edge>(edge), pos, radius );
-
-    QVector<QwtInterval> intv;
+        points += cuttingPoints( static_cast< Edge >( edge ), pos, radius );
+
+    QVector< QwtInterval > intv;
     if ( points.size() <= 0 )
     {
         QRectF cRect( 0, 0, 2 * radius, 2 * radius );
         cRect.moveCenter( pos );
-        if ( d_rect.contains( cRect ) )
+        if ( m_rect.contains( cRect ) )
             intv += QwtInterval( 0.0, 2 * M_PI );
     }
     else
     {
-        QList<double> angles;
+        QVector< double > angles;
+        angles.reserve( points.size() );
+
         for ( int i = 0; i < points.size(); i++ )
             angles += toAngle( pos, points[i] );
-        qSort( angles );
-
-        const int in = d_rect.contains( qwtPolar2Pos( pos, radius,
+
+        std::sort( angles.begin(), angles.end() );
+
+        const int in = m_rect.contains( qwtPolar2Pos( pos, radius,
             angles[0] + ( angles[1] - angles[0] ) / 2 ) );
 
+        intv.reserve( angles.size() / 2 );
         if ( in )
         {
             for ( int i = 0; i < angles.size() - 1; i += 2 )
-                intv += QwtInterval( angles[i], angles[i+1] );
+                intv += QwtInterval( angles[i], angles[i + 1] );
         }
         else
         {
             for ( int i = 1; i < angles.size() - 1; i += 2 )
-                intv += QwtInterval( angles[i], angles[i+1] );
+                intv += QwtInterval( angles[i], angles[i + 1] );
+
             intv += QwtInterval( angles.last(), angles.first() );
         }
@@ -374,5 +298,5 @@
 
 double QwtCircleClipper::toAngle(
-    const QPointF &from, const QPointF &to ) const
+    const QPointF& from, const QPointF& to ) const
 {
     if ( from.x() == to.x() )
@@ -381,5 +305,5 @@
     const double m = qAbs( ( to.y() - from.y() ) / ( to.x() - from.x() ) );
 
-    double angle = qAtan( m );
+    double angle = std::atan( m );
     if ( to.x() > from.x() )
     {
@@ -398,21 +322,21 @@
 }
 
-QList<QPointF> QwtCircleClipper::cuttingPoints(
-    Edge edge, const QPointF &pos, double radius ) const
-{
-    QList<QPointF> points;
+QVector< QPointF > QwtCircleClipper::cuttingPoints(
+    Edge edge, const QPointF& pos, double radius ) const
+{
+    QVector< QPointF > points;
 
     if ( edge == Left || edge == Right )
     {
-        const double x = ( edge == Left ) ? d_rect.left() : d_rect.right();
+        const double x = ( edge == Left ) ? m_rect.left() : m_rect.right();
         if ( qAbs( pos.x() - x ) < radius )
         {
-            const double off = qSqrt( qwtSqr( radius ) - qwtSqr( pos.x() - x ) );
+            const double off = std::sqrt( qwtSqr( radius ) - qwtSqr( pos.x() - x ) );
             const double m_y1 = pos.y() + off;
-            if ( m_y1 >= d_rect.top() && m_y1 <= d_rect.bottom() )
+            if ( m_y1 >= m_rect.top() && m_y1 <= m_rect.bottom() )
                 points += QPointF( x, m_y1 );
 
             const double m_y2 = pos.y() - off;
-            if ( m_y2 >= d_rect.top() && m_y2 <= d_rect.bottom() )
+            if ( m_y2 >= m_rect.top() && m_y2 <= m_rect.bottom() )
                 points += QPointF( x, m_y2 );
         }
@@ -420,14 +344,14 @@
     else
     {
-        const double y = ( edge == Top ) ? d_rect.top() : d_rect.bottom();
+        const double y = ( edge == Top ) ? m_rect.top() : m_rect.bottom();
         if ( qAbs( pos.y() - y ) < radius )
         {
-            const double off = qSqrt( qwtSqr( radius ) - qwtSqr( pos.y() - y ) );
+            const double off = std::sqrt( qwtSqr( radius ) - qwtSqr( pos.y() - y ) );
             const double x1 = pos.x() + off;
-            if ( x1 >= d_rect.left() && x1 <= d_rect.right() )
+            if ( x1 >= m_rect.left() && x1 <= m_rect.right() )
                 points += QPointF( x1, y );
 
             const double m_x2 = pos.x() - off;
-            if ( m_x2 >= d_rect.left() && m_x2 <= d_rect.right() )
+            if ( m_x2 >= m_rect.left() && m_x2 <= m_rect.right() )
                 points += QPointF( m_x2, y );
         }
@@ -440,11 +364,9 @@
 
    \param clipRect Clip rectangle
-   \param polygon Polygon
-   \param closePolygon True, when the polygon is closed
-
-   \return Clipped polygon
-*/
-QPolygon QwtClipper::clipPolygon(
-    const QRectF &clipRect, const QPolygon &polygon, bool closePolygon )
+   \param polygon Polygon IN/OUT
+   \param closePolygon True, when the polygon is closed
+ */
+void QwtClipper::clipPolygon(
+    const QRectF& clipRect, QPolygon& polygon, bool closePolygon )
 {
     const int minX = qCeil( clipRect.left() );
@@ -455,7 +377,36 @@
     const QRect r( minX, minY, maxX - minX, maxY - minY );
 
-    QwtPolygonClipper<QPolygon, QRect, QPoint, int> clipper( r );
-    return clipper.clipPolygon( polygon, closePolygon );
-}
+    QwtPolygonClipper< QPolygon, QRect, int > clipper( r );
+    clipper.clipPolygon( polygon, closePolygon );
+}
+
+/*!
+   Sutherland-Hodgman polygon clipping
+
+   \param clipRect Clip rectangle
+   \param polygon Polygon IN/OUT
+   \param closePolygon True, when the polygon is closed
+ */
+void QwtClipper::clipPolygon(
+    const QRect& clipRect, QPolygon& polygon, bool closePolygon )
+{
+    QwtPolygonClipper< QPolygon, QRect, int > clipper( clipRect );
+    clipper.clipPolygon( polygon, closePolygon );
+}
+
+/*!
+   Sutherland-Hodgman polygon clipping
+
+   \param clipRect Clip rectangle
+   \param polygon Polygon IN/OUT
+   \param closePolygon True, when the polygon is closed
+ */
+void QwtClipper::clipPolygonF(
+    const QRectF& clipRect, QPolygonF& polygon, bool closePolygon )
+{
+    QwtPolygonClipper< QPolygonF, QRectF, double > clipper( clipRect );
+    clipper.clipPolygon( polygon, closePolygon );
+}
+
 /*!
    Sutherland-Hodgman polygon clipping
@@ -466,12 +417,13 @@
 
    \return Clipped polygon
-*/
-QPolygon QwtClipper::clipPolygon(
-    const QRect &clipRect, const QPolygon &polygon, bool closePolygon )
-{
-    QwtPolygonClipper<QPolygon, QRect, QPoint, int> clipper( clipRect );
-    return clipper.clipPolygon( polygon, closePolygon );
-}
-
+ */
+QPolygon QwtClipper::clippedPolygon(
+    const QRectF& clipRect, const QPolygon& polygon, bool closePolygon )
+{
+    QPolygon points( polygon );
+    clipPolygon( clipRect, points, closePolygon );
+
+    return points;
+}
 /*!
    Sutherland-Hodgman polygon clipping
@@ -482,10 +434,30 @@
 
    \return Clipped polygon
-*/
-QPolygonF QwtClipper::clipPolygonF(
-    const QRectF &clipRect, const QPolygonF &polygon, bool closePolygon )
-{
-    QwtPolygonClipper<QPolygonF, QRectF, QPointF, double> clipper( clipRect );
-    return clipper.clipPolygon( polygon, closePolygon );
+ */
+QPolygon QwtClipper::clippedPolygon(
+    const QRect& clipRect, const QPolygon& polygon, bool closePolygon )
+{
+    QPolygon points( polygon );
+    clipPolygon( clipRect, points, closePolygon );
+
+    return points;
+}
+
+/*!
+   Sutherland-Hodgman polygon clipping
+
+   \param clipRect Clip rectangle
+   \param polygon Polygon
+   \param closePolygon True, when the polygon is closed
+
+   \return Clipped polygon
+ */
+QPolygonF QwtClipper::clippedPolygonF(
+    const QRectF& clipRect, const QPolygonF& polygon, bool closePolygon )
+{
+    QPolygonF points( polygon );
+    clipPolygonF( clipRect, points, closePolygon );
+
+    return points;
 }
 
@@ -502,7 +474,7 @@
 
    \return Arcs of the circle
-*/
-QVector<QwtInterval> QwtClipper::clipCircle( const QRectF &clipRect,
-    const QPointF &center, double radius )
+ */
+QVector< QwtInterval > QwtClipper::clipCircle( const QRectF& clipRect,
+    const QPointF& center, double radius )
 {
     QwtCircleClipper clipper( clipRect );
Index: /trunk/BNC/qwt/qwt_clipper.h
===================================================================
--- /trunk/BNC/qwt/qwt_clipper.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_clipper.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,28 +12,42 @@
 
 #include "qwt_global.h"
-#include "qwt_interval.h"
-#include <qpolygon.h>
-#include <qvector.h>
 
+class QwtInterval;
+class QPointF;
 class QRect;
 class QRectF;
+class QPolygon;
+class QPolygonF;
+
+#if QT_VERSION < 0x060000
+template< typename T > class QVector;
+#endif
 
 /*!
-  \brief Some clipping algorithms
-*/
+   \brief Some clipping algorithms
+ */
 
-class QWT_EXPORT QwtClipper
+namespace QwtClipper
 {
-public:
-    static QPolygon clipPolygon( const QRect &,
-        const QPolygon &, bool closePolygon = false );
-    static QPolygon clipPolygon( const QRectF &,
-        const QPolygon &, bool closePolygon = false );
+    QWT_EXPORT void clipPolygon( const QRect&,
+        QPolygon&, bool closePolygon = false );
 
-    static QPolygonF clipPolygonF( const QRectF &,
-        const QPolygonF &, bool closePolygon = false );
+    QWT_EXPORT void clipPolygon( const QRectF&,
+        QPolygon&, bool closePolygon = false );
 
-    static QVector<QwtInterval> clipCircle(
-        const QRectF &, const QPointF &, double radius );
+    QWT_EXPORT void clipPolygonF( const QRectF&,
+        QPolygonF&, bool closePolygon = false );
+
+    QWT_EXPORT QPolygon clippedPolygon( const QRect&,
+        const QPolygon&, bool closePolygon = false );
+
+    QWT_EXPORT QPolygon clippedPolygon( const QRectF&,
+        const QPolygon&, bool closePolygon = false );
+
+    QWT_EXPORT QPolygonF clippedPolygonF( const QRectF&,
+        const QPolygonF&, bool closePolygon = false );
+
+    QWT_EXPORT QVector< QwtInterval > clipCircle(
+        const QRectF&, const QPointF&, double radius );
 };
 
Index: /trunk/BNC/qwt/qwt_color_map.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_color_map.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_color_map.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,27 +9,73 @@
 
 #include "qwt_color_map.h"
-#include "qwt_math.h"
 #include "qwt_interval.h"
-#include <qnumeric.h>
+
+#include <qvector.h>
+
+static inline QRgb qwtHsvToRgb( int h, int s, int v, int a )
+{
+#if 0
+    return QColor::fromHsv( h, s, v, a ).rgb();
+#else
+
+    const double vs = v * s / 255.0;
+    const int p = v - qRound( vs );
+
+    switch( h / 60 )
+    {
+        case 0:
+        {
+            const double r = ( 60 - h ) / 60.0;
+            return qRgba( v, v - qRound( r * vs ), p, a );
+        }
+        case 1:
+        {
+            const double r = ( h - 60 ) / 60.0;
+            return qRgba( v - qRound( r * vs ), v, p, a );
+        }
+        case 2:
+        {
+            const double r = ( 180 - h ) / 60.0;
+            return qRgba( p, v, v - qRound( r * vs ), a );
+        }
+        case 3:
+        {
+            const double r = ( h - 180 ) / 60.0;
+            return qRgba( p, v - qRound( r * vs ), v, a );
+        }
+        case 4:
+        {
+            const double r = ( 300 - h ) / 60.0;
+            return qRgba( v - qRound( r * vs ), p, v, a );
+        }
+        case 5:
+        default:
+        {
+            const double r = ( h - 300 ) / 60.0;
+            return qRgba( v, p, v - qRound( r * vs ), a );
+        }
+    }
+#endif
+}
 
 class QwtLinearColorMap::ColorStops
 {
-public:
+  public:
     ColorStops():
-        d_doAlpha( false )
-    {
-        d_stops.reserve( 256 );
-    }
-
-    void insert( double pos, const QColor &color );
+        m_doAlpha( false )
+    {
+        m_stops.reserve( 256 );
+    }
+
+    void insert( double pos, const QColor& color );
     QRgb rgb( QwtLinearColorMap::Mode, double pos ) const;
 
-    QVector<double> stops() const;
-
-private:
+    QVector< double > stops() const;
+
+  private:
 
     class ColorStop
     {
-    public:
+      public:
         ColorStop():
             pos( 0.0 ),
@@ -38,5 +84,5 @@
         };
 
-        ColorStop( double p, const QColor &c ):
+        ColorStop( double p, const QColor& c ):
             pos( p ),
             rgb( c.rgba() )
@@ -48,5 +94,5 @@
 
             /*
-                when mapping a value to rgb we will have to calcualate:
+                when mapping a value to rgb we will have to calculate:
                    - const int v = int( ( s1.v0 + ratio * s1.vStep ) + 0.5 );
 
@@ -62,5 +108,5 @@
         }
 
-        void updateSteps( const ColorStop &nextStop )
+        void updateSteps( const ColorStop& nextStop )
         {
             rStep = nextStop.r - r;
@@ -82,9 +128,9 @@
 
     inline int findUpper( double pos ) const;
-    QVector<ColorStop> d_stops;
-    bool d_doAlpha;
+    QVector< ColorStop > m_stops;
+    bool m_doAlpha;
 };
 
-void QwtLinearColorMap::ColorStops::insert( double pos, const QColor &color )
+void QwtLinearColorMap::ColorStops::insert( double pos, const QColor& color )
 {
     // Lookups need to be very fast, insertions are not so important.
@@ -95,37 +141,37 @@
 
     int index;
-    if ( d_stops.size() == 0 )
+    if ( m_stops.size() == 0 )
     {
         index = 0;
-        d_stops.resize( 1 );
+        m_stops.resize( 1 );
     }
     else
     {
         index = findUpper( pos );
-        if ( index == d_stops.size() ||
-                qAbs( d_stops[index].pos - pos ) >= 0.001 )
-        {
-            d_stops.resize( d_stops.size() + 1 );
-            for ( int i = d_stops.size() - 1; i > index; i-- )
-                d_stops[i] = d_stops[i-1];
-        }
-    }
-
-    d_stops[index] = ColorStop( pos, color );
+        if ( index == m_stops.size() ||
+            qAbs( m_stops[index].pos - pos ) >= 0.001 )
+        {
+            m_stops.resize( m_stops.size() + 1 );
+            for ( int i = m_stops.size() - 1; i > index; i-- )
+                m_stops[i] = m_stops[i - 1];
+        }
+    }
+
+    m_stops[index] = ColorStop( pos, color );
     if ( color.alpha() != 255 )
-        d_doAlpha = true;
+        m_doAlpha = true;
 
     if ( index > 0 )
-        d_stops[index-1].updateSteps( d_stops[index] );
-
-    if ( index < d_stops.size() - 1 )
-        d_stops[index].updateSteps( d_stops[index+1] );
-}
-
-inline QVector<double> QwtLinearColorMap::ColorStops::stops() const
-{
-    QVector<double> positions( d_stops.size() );
-    for ( int i = 0; i < d_stops.size(); i++ )
-        positions[i] = d_stops[i].pos;
+        m_stops[index - 1].updateSteps( m_stops[index] );
+
+    if ( index < m_stops.size() - 1 )
+        m_stops[index].updateSteps( m_stops[index + 1] );
+}
+
+inline QVector< double > QwtLinearColorMap::ColorStops::stops() const
+{
+    QVector< double > positions( m_stops.size() );
+    for ( int i = 0; i < m_stops.size(); i++ )
+        positions[i] = m_stops[i].pos;
     return positions;
 }
@@ -134,7 +180,7 @@
 {
     int index = 0;
-    int n = d_stops.size();
-
-    const ColorStop *stops = d_stops.data();
+    int n = m_stops.size();
+
+    const ColorStop* stops = m_stops.data();
 
     while ( n > 0 )
@@ -159,16 +205,16 @@
 {
     if ( pos <= 0.0 )
-        return d_stops[0].rgb;
+        return m_stops[0].rgb;
     if ( pos >= 1.0 )
-        return d_stops[ d_stops.size() - 1 ].rgb;
+        return m_stops[ m_stops.size() - 1 ].rgb;
 
     const int index = findUpper( pos );
     if ( mode == FixedColors )
     {
-        return d_stops[index-1].rgb;
+        return m_stops[index - 1].rgb;
     }
     else
     {
-        const ColorStop &s1 = d_stops[index-1];
+        const ColorStop& s1 = m_stops[index - 1];
 
         const double ratio = ( pos - s1.pos ) / ( s1.posStep );
@@ -178,5 +224,5 @@
         const int b = int( s1.b0 + ratio * s1.bStep );
 
-        if ( d_doAlpha )
+        if ( m_doAlpha )
         {
             if ( s1.aStep )
@@ -197,7 +243,10 @@
 }
 
-//! Constructor
-QwtColorMap::QwtColorMap( Format format ):
-    d_format( format )
+/*!
+   Constructor
+   \param format Format of the color map
+ */
+QwtColorMap::QwtColorMap( Format format )
+    : m_format( format )
 {
 }
@@ -209,4 +258,41 @@
 
 /*!
+   Set the format of the color map
+
+   \param format Format of the color map
+ */
+void QwtColorMap::setFormat( Format format )
+{
+    m_format = format;
+}
+
+/*!
+   \brief Map a value of a given interval into a color index
+
+   \param numColors Number of colors
+   \param interval Range for all values
+   \param value Value to map into a color index
+
+   \return Index, between 0 and numColors - 1, or -1 for an invalid value
+ */
+uint QwtColorMap::colorIndex( int numColors,
+    const QwtInterval& interval, double value ) const
+{
+    const double width = interval.width();
+    if ( width <= 0.0 )
+        return 0;
+
+    if ( value <= interval.minValue() )
+        return 0;
+
+    const int maxIndex = numColors - 1;
+    if ( value >= interval.maxValue() )
+        return maxIndex;
+
+    const double v = maxIndex * ( ( value - interval.minValue() ) / width );
+    return static_cast< unsigned int >( v + 0.5 );
+}
+
+/*!
    Build and return a color map of 256 colors
 
@@ -214,24 +300,43 @@
    with using colorIndex().
 
-   \param interval Range for the values
    \return A color table, that can be used for a QImage
-*/
-QVector<QRgb> QwtColorMap::colorTable( const QwtInterval &interval ) const
-{
-    QVector<QRgb> table( 256 );
-
-    if ( interval.isValid() )
-    {
-        const double step = interval.width() / ( table.size() - 1 );
-        for ( int i = 0; i < table.size(); i++ )
-            table[i] = rgb( interval, interval.minValue() + step * i );
-    }
+ */
+QVector< QRgb > QwtColorMap::colorTable256() const
+{
+    QVector< QRgb > table( 256 );
+
+    const QwtInterval interval( 0, 256 );
+
+    for ( int i = 0; i < 256; i++ )
+        table[i] = rgb( interval, i );
 
     return table;
 }
 
+/*!
+   Build and return a color map of arbitrary number of colors
+
+   The color table is needed for rendering indexed images in combination
+   with using colorIndex().
+
+   \param numColors Number of colors
+   \return A color table
+ */
+QVector< QRgb > QwtColorMap::colorTable( int numColors ) const
+{
+    QVector< QRgb > table( numColors );
+
+    const QwtInterval interval( 0.0, 1.0 );
+
+    const double step = 1.0 / ( numColors - 1 );
+    for ( int i = 0; i < numColors; i++ )
+        table[i] = rgb( interval, step * i );
+
+    return table;
+}
+
 class QwtLinearColorMap::PrivateData
 {
-public:
+  public:
     ColorStops colorStops;
     QwtLinearColorMap::Mode mode;
@@ -243,10 +348,10 @@
 
    \param format Preferred format of the color map
-*/
+ */
 QwtLinearColorMap::QwtLinearColorMap( QwtColorMap::Format format ):
     QwtColorMap( format )
 {
-    d_data = new PrivateData;
-    d_data->mode = ScaledColors;
+    m_data = new PrivateData;
+    m_data->mode = ScaledColors;
 
     setColorInterval( Qt::blue, Qt::yellow );
@@ -259,11 +364,11 @@
    \param color2 Color used for the maximum value of the value interval
    \param format Preferred format for the color map
-*/
-QwtLinearColorMap::QwtLinearColorMap( const QColor &color1,
-        const QColor &color2, QwtColorMap::Format format ):
-    QwtColorMap( format )
-{
-    d_data = new PrivateData;
-    d_data->mode = ScaledColors;
+ */
+QwtLinearColorMap::QwtLinearColorMap( const QColor& color1,
+        const QColor& color2, QwtColorMap::Format format )
+    : QwtColorMap( format )
+{
+    m_data = new PrivateData;
+    m_data->mode = ScaledColors;
     setColorInterval( color1, color2 );
 }
@@ -272,5 +377,5 @@
 QwtLinearColorMap::~QwtLinearColorMap()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -283,8 +388,8 @@
 
    \sa mode()
-*/
+ */
 void QwtLinearColorMap::setMode( Mode mode )
 {
-    d_data->mode = mode;
+    m_data->mode = mode;
 }
 
@@ -292,8 +397,8 @@
    \return Mode of the color map
    \sa setMode()
-*/
+ */
 QwtLinearColorMap::Mode QwtLinearColorMap::mode() const
 {
-    return d_data->mode;
+    return m_data->mode;
 }
 
@@ -307,11 +412,11 @@
 
    \sa color1(), color2()
-*/
+ */
 void QwtLinearColorMap::setColorInterval(
-    const QColor &color1, const QColor &color2 )
-{
-    d_data->colorStops = ColorStops();
-    d_data->colorStops.insert( 0.0, color1 );
-    d_data->colorStops.insert( 1.0, color2 );
+    const QColor& color1, const QColor& color2 )
+{
+    m_data->colorStops = ColorStops();
+    m_data->colorStops.insert( 0.0, color1 );
+    m_data->colorStops.insert( 1.0, color2 );
 }
 
@@ -325,51 +430,48 @@
    \param value Value between [0.0, 1.0]
    \param color Color stop
-*/
+ */
 void QwtLinearColorMap::addColorStop( double value, const QColor& color )
 {
     if ( value >= 0.0 && value <= 1.0 )
-        d_data->colorStops.insert( value, color );
+        m_data->colorStops.insert( value, color );
 }
 
 /*!
    \return Positions of color stops in increasing order
-*/
-QVector<double> QwtLinearColorMap::colorStops() const
-{
-    return d_data->colorStops.stops();
-}
-
-/*!
-  \return the first color of the color range
-  \sa setColorInterval()
-*/
+ */
+QVector< double > QwtLinearColorMap::colorStops() const
+{
+    return m_data->colorStops.stops();
+}
+
+/*!
+   \return the first color of the color range
+   \sa setColorInterval()
+ */
 QColor QwtLinearColorMap::color1() const
 {
-    return QColor::fromRgba( d_data->colorStops.rgb( d_data->mode, 0.0 ) );
-}
-
-/*!
-  \return the second color of the color range
-  \sa setColorInterval()
-*/
+    return QColor::fromRgba( m_data->colorStops.rgb( m_data->mode, 0.0 ) );
+}
+
+/*!
+   \return the second color of the color range
+   \sa setColorInterval()
+ */
 QColor QwtLinearColorMap::color2() const
 {
-    return QColor::fromRgba( d_data->colorStops.rgb( d_data->mode, 1.0 ) );
-}
-
-/*!
-  Map a value of a given interval into a RGB value
-
-  \param interval Range for all values
-  \param value Value to map into a RGB value
-
-  \return RGB value for value
-*/
+    return QColor::fromRgba( m_data->colorStops.rgb( m_data->mode, 1.0 ) );
+}
+
+/*!
+   Map a value of a given interval into a RGB value
+
+   \param interval Range for all values
+   \param value Value to map into a RGB value
+
+   \return RGB value for value
+ */
 QRgb QwtLinearColorMap::rgb(
-    const QwtInterval &interval, double value ) const
-{
-    if ( qIsNaN(value) )
-        return 0u;
-
+    const QwtInterval& interval, double value ) const
+{
     const double width = interval.width();
     if ( width <= 0.0 )
@@ -377,42 +479,49 @@
 
     const double ratio = ( value - interval.minValue() ) / width;
-    return d_data->colorStops.rgb( d_data->mode, ratio );
-}
-
-/*!
-  \brief Map a value of a given interval into a color index
-
-  \param interval Range for all values
-  \param value Value to map into a color index
-
-  \return Index, between 0 and 255
-*/
-unsigned char QwtLinearColorMap::colorIndex(
-    const QwtInterval &interval, double value ) const
+    return m_data->colorStops.rgb( m_data->mode, ratio );
+}
+
+/*!
+   \brief Map a value of a given interval into a color index
+
+   \param numColors Size of the color table
+   \param interval Range for all values
+   \param value Value to map into a color index
+
+   \return Index, between 0 and 255
+   \note NaN values are mapped to 0
+ */
+uint QwtLinearColorMap::colorIndex( int numColors,
+    const QwtInterval& interval, double value ) const
 {
     const double width = interval.width();
-
-    if ( qIsNaN(value) || width <= 0.0 || value <= interval.minValue() )
+    if ( width <= 0.0 )
         return 0;
 
+    if ( value <= interval.minValue() )
+        return 0;
+
     if ( value >= interval.maxValue() )
-        return 255;
-
-    const double ratio = ( value - interval.minValue() ) / width;
-
-    unsigned char index;
-    if ( d_data->mode == FixedColors )
-        index = static_cast<unsigned char>( ratio * 255 ); // always floor
-    else
-        index = static_cast<unsigned char>( ratio * 255 + 0.5 );
-
-    return index;
+        return numColors - 1;
+
+    const double v = ( numColors - 1 ) * ( value - interval.minValue() ) / width;
+    return static_cast< unsigned int >( ( m_data->mode == FixedColors ) ? v : v + 0.5 );
 }
 
 class QwtAlphaColorMap::PrivateData
 {
-public:
+  public:
+    PrivateData()
+        : alpha1(0)
+        , alpha2(255)
+    {
+    }
+
+    int alpha1, alpha2;
+
     QColor color;
     QRgb rgb;
+
+    QRgb rgbMin;
     QRgb rgbMax;
 };
@@ -420,11 +529,16 @@
 
 /*!
-   Constructor
+   \brief Constructor
+
+   The alpha interval is initialized by 0 to 255.
+
    \param color Color of the map
-*/
-QwtAlphaColorMap::QwtAlphaColorMap( const QColor &color ):
-    QwtColorMap( QwtColorMap::RGB )
-{
-    d_data = new PrivateData;
+
+   \sa setColor(), setAlphaInterval()
+ */
+QwtAlphaColorMap::QwtAlphaColorMap( const QColor& color )
+    : QwtColorMap( QwtColorMap::RGB )
+{
+    m_data = new PrivateData;
     setColor( color );
 }
@@ -433,5 +547,5 @@
 QwtAlphaColorMap::~QwtAlphaColorMap()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -441,35 +555,71 @@
    \param color Color
    \sa color()
-*/
-void QwtAlphaColorMap::setColor( const QColor &color )
-{
-    d_data->color = color;
-    d_data->rgb = color.rgb() & qRgba( 255, 255, 255, 0 );
-    d_data->rgbMax = d_data->rgb | ( 255 << 24 );
-}
-
-/*!
-  \return the color
-  \sa setColor()
-*/
+ */
+void QwtAlphaColorMap::setColor( const QColor& color )
+{
+    m_data->color = color;
+    m_data->rgb = color.rgb() & qRgba( 255, 255, 255, 0 );
+
+    m_data->rgbMin = m_data->rgb | ( m_data->alpha1 << 24 );
+    m_data->rgbMax = m_data->rgb | ( m_data->alpha2 << 24 );
+}
+
+/*!
+   \return the color
+   \sa setColor()
+ */
 QColor QwtAlphaColorMap::color() const
 {
-    return d_data->color;
-}
-
-/*!
-  \brief Map a value of a given interval into a alpha value
-
-  alpha := (value - interval.minValue()) / interval.width();
-
-  \param interval Range for all values
-  \param value Value to map into a RGB value
-  \return RGB value, with an alpha value
-*/
-QRgb QwtAlphaColorMap::rgb( const QwtInterval &interval, double value ) const
-{
-    if ( qIsNaN(value) )
-        return 0u;
-
+    return m_data->color;
+}
+
+/*!
+   Set the interval for the alpha coordinate
+
+   alpha1/alpha2 need to be in the range 0 to 255,
+   where 255 means opaque and 0 means transparent.
+
+   \param alpha1 First alpha coordinate
+   \param alpha2 Second alpha coordinate
+
+   \sa alpha1(), alpha2()
+ */
+void QwtAlphaColorMap::setAlphaInterval( int alpha1, int alpha2 )
+{
+    m_data->alpha1 = qBound( 0, alpha1, 255 );
+    m_data->alpha2 = qBound( 0, alpha2, 255 );
+
+    m_data->rgbMin = m_data->rgb | ( alpha1 << 24 );
+    m_data->rgbMax = m_data->rgb | ( alpha2 << 24 );
+}
+
+/*!
+   \return First alpha coordinate
+   \sa setAlphaInterval()
+ */
+int QwtAlphaColorMap::alpha1() const
+{
+    return m_data->alpha1;
+}
+
+/*!
+   \return Second alpha coordinate
+   \sa setAlphaInterval()
+ */
+int QwtAlphaColorMap::alpha2() const
+{
+    return m_data->alpha2;
+}
+
+/*!
+   \brief Map a value of a given interval into a alpha value
+
+   \param interval Range for all values
+   \param value Value to map into a RGB value
+
+   \return RGB value, with an alpha value
+ */
+QRgb QwtAlphaColorMap::rgb( const QwtInterval& interval, double value ) const
+{
     const double width = interval.width();
     if ( width <= 0.0 )
@@ -477,23 +627,577 @@
 
     if ( value <= interval.minValue() )
-        return d_data->rgb;
+        return m_data->rgb;
 
     if ( value >= interval.maxValue() )
-        return d_data->rgbMax;
+        return m_data->rgbMax;
 
     const double ratio = ( value - interval.minValue() ) / width;
-    return d_data->rgb | ( qRound( 255 * ratio ) << 24 );
-}
-
-/*!
-  Dummy function, needed to be implemented as it is pure virtual
-  in QwtColorMap. Color indices make no sense in combination with
-  an alpha channel.
-
-  \return Always 0
-*/
-unsigned char QwtAlphaColorMap::colorIndex(
-    const QwtInterval &, double ) const
-{
-    return 0;
-}
+    const int alpha = m_data->alpha1 + qRound( ratio * ( m_data->alpha2 - m_data->alpha1 ) );
+
+    return m_data->rgb | ( alpha << 24 );
+}
+
+class QwtHueColorMap::PrivateData
+{
+  public:
+    PrivateData();
+
+    void updateTable();
+
+    int hue1, hue2;
+    int saturation;
+    int value;
+    int alpha;
+
+    QRgb rgbMin;
+    QRgb rgbMax;
+
+    QRgb rgbTable[360];
+};
+
+QwtHueColorMap::PrivateData::PrivateData()
+    : hue1(0)
+    , hue2(359)
+    , saturation(255)
+    , value(255)
+    , alpha(255)
+{
+    updateTable();
+}
+
+void QwtHueColorMap::PrivateData::updateTable()
+{
+    const int p = qRound( value * ( 255 - saturation ) / 255.0 );
+    const double vs = value * saturation / 255.0;
+
+    for ( int i = 0; i < 60; i++ )
+    {
+        const double r = ( 60 - i ) / 60.0;
+        rgbTable[i] = qRgba( value, qRound( value - r * vs ), p, alpha );
+    }
+
+    for ( int i = 60; i < 120; i++ )
+    {
+        const double r = ( i - 60 ) / 60.0;
+        rgbTable[i] = qRgba( qRound( value - r * vs ), value, p, alpha );
+    }
+
+    for ( int i = 120; i < 180; i++ )
+    {
+        const double r = ( 180 - i ) / 60.0;
+        rgbTable[i] = qRgba( p, value, qRound( value - r * vs ), alpha );
+    }
+
+    for ( int i = 180; i < 240; i++ )
+    {
+        const double r = ( i - 180 ) / 60.0;
+        rgbTable[i] = qRgba( p, qRound( value - r * vs ), value, alpha );
+    }
+
+    for ( int i = 240; i < 300; i++ )
+    {
+        const double r = ( 300 - i ) / 60.0;
+        rgbTable[i] = qRgba( qRound( value - r * vs ), p, value, alpha );
+    }
+
+    for ( int i = 300; i < 360; i++ )
+    {
+        const double r = ( i - 300 ) / 60.0;
+        rgbTable[i] = qRgba( value, p, qRound( value - r * vs ), alpha );
+    }
+
+    rgbMin = rgbTable[ hue1 % 360 ];
+    rgbMax = rgbTable[ hue2 % 360 ];
+}
+
+/*!
+   \brief Constructor
+
+   The hue interval is initialized by 0 to 359. All other coordinates
+   are set to 255.
+
+   \param format Format of the color map
+
+   \sa setHueInterval(), setSaturation(), setValue(), setValue()
+ */
+QwtHueColorMap::QwtHueColorMap( QwtColorMap::Format format )
+    : QwtColorMap( format )
+{
+    m_data = new PrivateData;
+}
+
+//! Destructor
+QwtHueColorMap::~QwtHueColorMap()
+{
+    delete m_data;
+}
+
+/*!
+   Set the interval for the hue coordinate
+
+   hue1/hue2 need to be positive number and can be > 360 to define cycles.
+   F.e. 420 to 240 defines a map yellow/red/magenta/blue.
+
+   \param hue1 First hue coordinate
+   \param hue2 Second hue coordinate
+
+   \sa hue1(), hue2()
+ */
+void QwtHueColorMap::setHueInterval( int hue1, int hue2 )
+{
+    m_data->hue1 = qMax( hue1, 0 );
+    m_data->hue2 = qMax( hue2, 0 );
+
+    m_data->rgbMin = m_data->rgbTable[ hue1 % 360 ];
+    m_data->rgbMax = m_data->rgbTable[ hue2 % 360 ];
+}
+
+/*!
+   \brief Set the the saturation coordinate
+
+   saturation needs to be in the range 0 to 255,
+
+   \param saturation Saturation coordinate
+
+   \sa saturation()
+ */
+void QwtHueColorMap::setSaturation( int saturation )
+{
+    saturation = qBound( 0, saturation, 255 );
+
+    if ( saturation != m_data->saturation )
+    {
+        m_data->saturation = saturation;
+        m_data->updateTable();
+    }
+}
+
+/*!
+   \brief Set the the value coordinate
+
+   value needs to be in the range 0 to 255,
+
+   \param value Value coordinate
+
+   \sa value()
+ */
+void QwtHueColorMap::setValue( int value )
+{
+    value = qBound( 0, value, 255 );
+
+    if ( value != m_data->value )
+    {
+        m_data->value = value;
+        m_data->updateTable();
+    }
+}
+
+/*!
+   \brief Set the the alpha coordinate
+
+   alpha needs to be in the range 0 to 255,
+   where 255 means opaque and 0 means transparent.
+
+   \param alpha Alpha coordinate
+
+   \sa alpha()
+ */
+void QwtHueColorMap::setAlpha( int alpha )
+{
+    alpha = qBound( 0, alpha, 255 );
+
+    if ( alpha != m_data->alpha )
+    {
+        m_data->alpha = alpha;
+        m_data->updateTable();
+    }
+}
+
+/*!
+   \return First hue coordinate
+   \sa setHueInterval()
+ */
+int QwtHueColorMap::hue1() const
+{
+    return m_data->hue1;
+}
+
+/*!
+   \return Second hue coordinate
+   \sa setHueInterval()
+ */
+int QwtHueColorMap::hue2() const
+{
+    return m_data->hue2;
+}
+
+/*!
+   \return Saturation coordinate
+   \sa setSaturation()
+ */
+int QwtHueColorMap::saturation() const
+{
+    return m_data->saturation;
+}
+
+/*!
+   \return Value coordinate
+   \sa setValue()
+ */
+int QwtHueColorMap::value() const
+{
+    return m_data->value;
+}
+
+/*!
+   \return Alpha coordinate
+   \sa setAlpha()
+ */
+int QwtHueColorMap::alpha() const
+{
+    return m_data->alpha;
+}
+
+/*!
+   Map a value of a given interval into a RGB value
+
+   \param interval Range for all values
+   \param value Value to map into a RGB value
+
+   \return RGB value for value
+ */
+QRgb QwtHueColorMap::rgb( const QwtInterval& interval, double value ) const
+{
+    const double width = interval.width();
+    if ( width <= 0 )
+        return 0u;
+
+    if ( value <= interval.minValue() )
+        return m_data->rgbMin;
+
+    if ( value >= interval.maxValue() )
+        return m_data->rgbMax;
+
+    const double ratio = ( value - interval.minValue() ) / width;
+
+    int hue = m_data->hue1 + qRound( ratio * ( m_data->hue2 - m_data->hue1 ) );
+    if ( hue >= 360 )
+    {
+        hue -= 360;
+
+        if ( hue >= 360 )
+            hue = hue % 360;
+    }
+
+    return m_data->rgbTable[hue];
+}
+
+class QwtSaturationValueColorMap::PrivateData
+{
+  public:
+    PrivateData()
+        : hue(0)
+        , sat1(255)
+        , sat2(255)
+        , value1(0)
+        , value2(255)
+        , alpha(255)
+        , tableType(Invalid)
+    {
+        updateTable();
+    }
+
+    void updateTable()
+    {
+        tableType = Invalid;
+
+        if ( ( value1 == value2 ) && ( sat1 != sat2 ) )
+        {
+            rgbTable.resize( 256 );
+
+            for ( int i = 0; i < 256; i++ )
+                rgbTable[i] = qwtHsvToRgb( hue, i, value1, alpha );
+
+            tableType = Saturation;
+        }
+        else if ( ( value1 != value2 ) && ( sat1 == sat2 ) )
+        {
+            rgbTable.resize( 256 );
+
+            for ( int i = 0; i < 256; i++ )
+                rgbTable[i] = qwtHsvToRgb( hue, sat1, i, alpha );
+
+            tableType = Value;
+        }
+        else
+        {
+            rgbTable.resize( 256 * 256 );
+
+            for ( int s = 0; s < 256; s++ )
+            {
+                const int v0 = s * 256;
+
+                for ( int v = 0; v < 256; v++ )
+                    rgbTable[v0 + v] = qwtHsvToRgb( hue, s, v, alpha );
+            }
+        }
+    }
+
+    int hue;
+    int sat1, sat2;
+    int value1, value2;
+    int alpha;
+
+    enum
+    {
+        Invalid,
+        Value,
+        Saturation
+
+    } tableType;
+
+    QVector< QRgb > rgbTable;
+};
+
+/*!
+   \brief Constructor
+
+   The value interval is initialized by 0 to 255,
+   saturation by 255 to 255. Hue to 0 and alpha to 255.
+
+   So the default setting interpolates the value coordinate only.
+
+   \sa setHueInterval(), setSaturation(), setValue(), setValue()
+ */
+QwtSaturationValueColorMap::QwtSaturationValueColorMap()
+{
+    m_data = new PrivateData;
+}
+
+//! Destructor
+QwtSaturationValueColorMap::~QwtSaturationValueColorMap()
+{
+    delete m_data;
+}
+
+/*!
+   \brief Set the the hue coordinate
+
+   Hue coordinates outside 0 to 359 will be interpreted as hue % 360..
+
+   \param hue Hue coordinate
+
+   \sa hue()
+ */
+void QwtSaturationValueColorMap::setHue( int hue )
+{
+    hue = hue % 360;
+
+    if ( hue != m_data->hue )
+    {
+        m_data->hue = hue;
+        m_data->updateTable();
+    }
+}
+
+/*!
+   \brief Set the interval for the saturation coordinate
+
+   When saturation1 == saturation2 the map interpolates between
+   the value coordinates only
+
+   saturation1/saturation2 need to be in the range 0 to 255.
+
+   \param saturation1 First saturation
+   \param saturation2 Second saturation
+
+   \sa saturation1(), saturation2(), setValueInterval()
+ */
+void QwtSaturationValueColorMap::setSaturationInterval(
+    int saturation1, int saturation2 )
+{
+    saturation1 = qBound( 0, saturation1, 255 );
+    saturation2 = qBound( 0, saturation2, 255 );
+
+    if ( ( saturation1 != m_data->sat1 ) || ( saturation2 != m_data->sat2 ) )
+    {
+        m_data->sat1 = saturation1;
+        m_data->sat2 = saturation2;
+
+        m_data->updateTable();
+    }
+}
+
+/*!
+   \brief Set the interval for the value coordinate
+
+   When value1 == value2 the map interpolates between the saturation coordinates only.
+
+   value1/value2 need to be in the range 0 to 255.
+
+   \param value1 First value
+   \param value2 Second value
+
+   \sa value1(), value2(), setSaturationInterval()
+ */
+void QwtSaturationValueColorMap::setValueInterval( int value1, int value2 )
+{
+    value1 = qBound( 0, value1, 255 );
+    value2 = qBound( 0, value2, 255 );
+
+    if ( ( value1 != m_data->value1 ) || ( value2 != m_data->value2 ) )
+    {
+        m_data->value1 = value1;
+        m_data->value2 = value2;
+
+        m_data->updateTable();
+    }
+}
+
+/*!
+   \brief Set the the alpha coordinate
+
+   alpha needs to be in the range 0 to 255,
+   where 255 means opaque and 0 means transparent.
+
+   \param alpha Alpha coordinate
+
+   \sa alpha()
+ */
+void QwtSaturationValueColorMap::setAlpha( int alpha )
+{
+    alpha = qBound( 0, alpha, 255 );
+
+    if ( alpha != m_data->alpha )
+    {
+        m_data->alpha = alpha;
+        m_data->updateTable();
+    }
+}
+
+/*!
+   \return Hue coordinate
+   \sa setHue()
+ */
+int QwtSaturationValueColorMap::hue() const
+{
+    return m_data->hue;
+}
+
+/*!
+   \return First saturation coordinate
+   \sa setSaturationInterval()
+ */
+int QwtSaturationValueColorMap::saturation1() const
+{
+    return m_data->sat1;
+}
+
+/*!
+   \return Second saturation coordinate
+   \sa setSaturationInterval()
+ */
+int QwtSaturationValueColorMap::saturation2() const
+{
+    return m_data->sat2;
+}
+
+/*!
+   \return First value coordinate
+   \sa setValueInterval()
+ */
+int QwtSaturationValueColorMap::value1() const
+{
+    return m_data->value1;
+}
+
+/*!
+   \return Second value coordinate
+   \sa setValueInterval()
+ */
+int QwtSaturationValueColorMap::value2() const
+{
+    return m_data->value2;
+}
+
+/*!
+   \return Alpha coordinate
+   \sa setAlpha()
+ */
+int QwtSaturationValueColorMap::alpha() const
+{
+    return m_data->alpha;
+}
+
+/*!
+   Map a value of a given interval into a RGB value
+
+   \param interval Range for all values
+   \param value Value to map into a RGB value
+
+   \return RGB value for value
+ */
+QRgb QwtSaturationValueColorMap::rgb(
+    const QwtInterval& interval, double value ) const
+{
+    const double width = interval.width();
+    if ( width <= 0 )
+        return 0u;
+
+    const QRgb* rgbTable = m_data->rgbTable.constData();
+
+    switch( m_data->tableType )
+    {
+        case PrivateData::Saturation:
+        {
+            if ( value <= interval.minValue() )
+                return m_data->rgbTable[m_data->sat1];
+
+            if ( value >= interval.maxValue() )
+                return m_data->rgbTable[m_data->sat2];
+
+            const double ratio = ( value - interval.minValue() ) / width;
+            const int sat = m_data->sat1
+                + qRound( ratio * ( m_data->sat2 - m_data->sat1 ) );
+
+            return rgbTable[sat];
+        }
+        case PrivateData::Value:
+        {
+            if ( value <= interval.minValue() )
+                return m_data->rgbTable[m_data->value1];
+
+            if ( value >= interval.maxValue() )
+                return m_data->rgbTable[m_data->value2];
+
+            const double ratio = ( value - interval.minValue() ) / width;
+            const int v = m_data->value1 +
+                qRound( ratio * ( m_data->value2 - m_data->value1 ) );
+
+            return rgbTable[ v ];
+        }
+        default:
+        {
+            int s, v;
+            if ( value <= interval.minValue() )
+            {
+                s = m_data->sat1;
+                v = m_data->value1;
+            }
+            else if ( value >= interval.maxValue() )
+            {
+                s = m_data->sat2;
+                v = m_data->value2;
+            }
+            else
+            {
+                const double ratio = ( value - interval.minValue() ) / width;
+
+                v = m_data->value1 + qRound( ratio * ( m_data->value2 - m_data->value1 ) );
+                s = m_data->sat1 + qRound( ratio * ( m_data->sat2 - m_data->sat1 ) );
+            }
+
+            return rgbTable[ 256 * s + v ];
+        }
+    }
+}
Index: /trunk/BNC/qwt/qwt_color_map.h
===================================================================
--- /trunk/BNC/qwt/qwt_color_map.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_color_map.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,30 +12,34 @@
 
 #include "qwt_global.h"
-#include "qwt_interval.h"
 #include <qcolor.h>
-#include <qvector.h>
-
-/*!
-  \brief QwtColorMap is used to map values into colors.
-
-  For displaying 3D data on a 2D plane the 3rd dimension is often
-  displayed using colors, like f.e in a spectrogram.
-
-  Each color map is optimized to return colors for only one of the
-  following image formats:
-
-  - QImage::Format_Indexed8\n
-  - QImage::Format_ARGB32\n
-
-  \sa QwtPlotSpectrogram, QwtScaleWidget
-*/
+
+class QwtInterval;
+
+#if QT_VERSION < 0x060000
+template< typename T > class QVector;
+#endif
+
+/*!
+   \brief QwtColorMap is used to map values into colors.
+
+   For displaying 3D data on a 2D plane the 3rd dimension is often
+   displayed using colors, like f.e in a spectrogram.
+
+   Each color map is optimized to return colors for only one of the
+   following image formats:
+
+   - QImage::Format_Indexed8\n
+   - QImage::Format_ARGB32\n
+
+   \sa QwtPlotSpectrogram, QwtScaleWidget
+ */
 
 class QWT_EXPORT QwtColorMap
 {
-public:
+  public:
     /*!
         Format for color mapping
         \sa rgb(), colorIndex(), colorTable()
-    */
+     */
 
     enum Format
@@ -45,13 +49,20 @@
 
         /*!
-          The map is intended to map into 8 bit values, that
-          are indices into the color table.
+           Map values into 8 bit values, that
+           are used as indexes into the color table.
+
+           Indexed color maps are used to generate QImage::Format_Indexed8
+           images. The calculation of the color index is usually faster
+           and the resulting image has a lower memory footprint.
+
+           \sa colorIndex(), colorTable()
          */
         Indexed
     };
 
-    QwtColorMap( Format = QwtColorMap::RGB );
+    explicit QwtColorMap( Format = QwtColorMap::RGB );
     virtual ~QwtColorMap();
 
+    void setFormat( Format );
     Format format() const;
 
@@ -62,39 +73,34 @@
        \param value Value
        \return RGB value, corresponding to value
-    */
-    virtual QRgb rgb( const QwtInterval &interval,
-        double value ) const = 0;
-
-    /*!
-       Map a value of a given interval into a color index
-
-       \param interval Range for the values
-       \param value Value
-       \return color index, corresponding to value
      */
-    virtual unsigned char colorIndex(
-        const QwtInterval &interval, double value ) const = 0;
-
-    QColor color( const QwtInterval &, double value ) const;
-    virtual QVector<QRgb> colorTable( const QwtInterval & ) const;
-
-private:
-    Format d_format;
-};
-
-/*!
-  \brief QwtLinearColorMap builds a color map from color stops.
-
-  A color stop is a color at a specific position. The valid
-  range for the positions is [0.0, 1.0]. When mapping a value
-  into a color it is translated into this interval according to mode().
-*/
-class QWT_EXPORT QwtLinearColorMap: public QwtColorMap
-{
-public:
+    virtual QRgb rgb( const QwtInterval& interval, double value ) const = 0;
+
+    virtual uint colorIndex( int numColors,
+        const QwtInterval& interval, double value ) const;
+
+    QColor color( const QwtInterval&, double value ) const;
+    virtual QVector< QRgb > colorTable( int numColors ) const;
+    virtual QVector< QRgb > colorTable256() const;
+
+  private:
+    Q_DISABLE_COPY(QwtColorMap)
+
+    Format m_format;
+};
+
+/*!
+   \brief QwtLinearColorMap builds a color map from color stops.
+
+   A color stop is a color at a specific position. The valid
+   range for the positions is [0.0, 1.0]. When mapping a value
+   into a color it is translated into this interval according to mode().
+ */
+class QWT_EXPORT QwtLinearColorMap : public QwtColorMap
+{
+  public:
     /*!
        Mode of color map
        \sa setMode(), mode()
-    */
+     */
     enum Mode
     {
@@ -106,6 +112,7 @@
     };
 
-    QwtLinearColorMap( QwtColorMap::Format = QwtColorMap::RGB );
-    QwtLinearColorMap( const QColor &color1, const QColor &color2,
+    explicit QwtLinearColorMap( QwtColorMap::Format = QwtColorMap::RGB );
+
+    QwtLinearColorMap( const QColor& from, const QColor& to,
         QwtColorMap::Format = QwtColorMap::RGB );
 
@@ -115,51 +122,119 @@
     Mode mode() const;
 
-    void setColorInterval( const QColor &color1, const QColor &color2 );
+    void setColorInterval( const QColor& color1, const QColor& color2 );
     void addColorStop( double value, const QColor& );
-    QVector<double> colorStops() const;
+    QVector< double > colorStops() const;
 
     QColor color1() const;
     QColor color2() const;
 
-    virtual QRgb rgb( const QwtInterval &, double value ) const;
-    virtual unsigned char colorIndex(
-        const QwtInterval &, double value ) const;
+    virtual QRgb rgb( const QwtInterval&,
+        double value ) const QWT_OVERRIDE;
+
+    virtual uint colorIndex( int numColors,
+        const QwtInterval&, double value ) const QWT_OVERRIDE;
 
     class ColorStops;
 
-private:
-    // Disabled copy constructor and operator=
-    QwtLinearColorMap( const QwtLinearColorMap & );
-    QwtLinearColorMap &operator=( const QwtLinearColorMap & );
-
-    class PrivateData;
-    PrivateData *d_data;
-};
-
-/*!
-  \brief QwtAlphaColorMap varies the alpha value of a color
-*/
-class QWT_EXPORT QwtAlphaColorMap: public QwtColorMap
-{
-public:
-    QwtAlphaColorMap( const QColor & = QColor( Qt::gray ) );
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+/*!
+   \brief QwtAlphaColorMap varies the alpha value of a color
+ */
+class QWT_EXPORT QwtAlphaColorMap : public QwtColorMap
+{
+  public:
+    explicit QwtAlphaColorMap( const QColor& = QColor( Qt::gray ) );
     virtual ~QwtAlphaColorMap();
 
-    void setColor( const QColor & );
+    void setAlphaInterval( int alpha1, int alpha2 );
+
+    int alpha1() const;
+    int alpha2() const;
+
+    void setColor( const QColor& );
     QColor color() const;
 
-    virtual QRgb rgb( const QwtInterval &, double value ) const;
-
-private:
-    QwtAlphaColorMap( const QwtAlphaColorMap & );
-    QwtAlphaColorMap &operator=( const QwtAlphaColorMap & );
-
-    virtual unsigned char colorIndex(
-        const QwtInterval &, double value ) const;
-
-    class PrivateData;
-    PrivateData *d_data;
-};
-
+    virtual QRgb rgb( const QwtInterval&,
+        double value ) const QWT_OVERRIDE;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+/*!
+   \brief QwtHueColorMap varies the hue value of the HSV color model.
+
+   QwtHueColorMap can be used to set up a color map easily, that runs cyclic over
+   all colors. Each cycle has 360 different steps.
+
+   The values for value and saturation are in the range of 0 to 255 and doesn't
+   depend on the data value to be mapped.
+
+   \sa QwtSaturationValueColorMap
+ */
+class QWT_EXPORT QwtHueColorMap : public QwtColorMap
+{
+  public:
+    explicit QwtHueColorMap( QwtColorMap::Format = QwtColorMap::RGB );
+    virtual ~QwtHueColorMap();
+
+    void setHueInterval( int hue1, int hue2 ); // direction ?
+    void setSaturation( int saturation );
+    void setValue( int value );
+    void setAlpha( int alpha );
+
+    int hue1() const;
+    int hue2() const;
+    int saturation() const;
+    int value() const;
+    int alpha() const;
+
+    virtual QRgb rgb( const QwtInterval&,
+        double value ) const QWT_OVERRIDE;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+/*!
+   \brief QwtSaturationValueColorMap varies the saturation and/or value for a given
+         hue in the HSV color model.
+
+   Value and saturation are in the range of 0 to 255 while hue is in the range
+   of 0 to 259.
+
+   \sa QwtHueColorMap
+ */
+class QWT_EXPORT QwtSaturationValueColorMap : public QwtColorMap
+{
+  public:
+    QwtSaturationValueColorMap();
+    virtual ~QwtSaturationValueColorMap();
+
+    void setHue( int hue );
+    void setSaturationInterval( int sat1, int sat2 );
+    void setValueInterval( int value1, int value2 );
+    void setAlpha( int alpha );
+
+    int hue() const;
+    int saturation1() const;
+    int saturation2() const;
+    int value1() const;
+    int value2() const;
+    int alpha() const;
+
+    virtual QRgb rgb( const QwtInterval&,
+        double value ) const QWT_OVERRIDE;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
 
 /*!
@@ -170,23 +245,8 @@
 
    \return Color corresponding to value
-
-   \warning This method is slow for Indexed color maps. If it is
-            necessary to map many values, its better to get the
-            color table once and find the color using colorIndex().
-*/
-inline QColor QwtColorMap::color(
-    const QwtInterval &interval, double value ) const
-{
-    if ( d_format == RGB )
-    {
-        return QColor::fromRgba( rgb( interval, value ) );
-    }
-    else
-    {
-        const unsigned int index = colorIndex( interval, value );
-
-        const QVector<QRgb> rgbTable = colorTable( interval );
-        return rgbTable[index]; // slow
-    }
+ */
+inline QColor QwtColorMap::color( const QwtInterval& interval, double value ) const
+{
+    return QColor::fromRgba( rgb( interval, value ) );
 }
 
@@ -194,8 +254,8 @@
    \return Intended format of the color map
    \sa Format
-*/
+ */
 inline QwtColorMap::Format QwtColorMap::format() const
 {
-    return d_format;
+    return m_format;
 }
 
Index: /trunk/BNC/qwt/qwt_column_symbol.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_column_symbol.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_column_symbol.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,11 +9,12 @@
 
 #include "qwt_column_symbol.h"
+#include "qwt_painter.h"
 #include "qwt_math.h"
-#include "qwt_painter.h"
+
 #include <qpainter.h>
 #include <qpalette.h>
 
-static void qwtDrawBox( QPainter *p, const QRectF &rect,
-    const QPalette &pal, double lw )
+static void qwtDrawBox( QPainter* p, const QRectF& rect,
+    const QPalette& pal, double lw )
 {
     if ( lw > 0.0 )
@@ -33,12 +34,11 @@
         }
 
-        lw = qMin( lw, rect.height() / 2.0 - 1.0 );
-        lw = qMin( lw, rect.width() / 2.0 - 1.0 );
+        lw = qwtMinF( lw, rect.height() / 2.0 - 1.0 );
+        lw = qwtMinF( lw, rect.width() / 2.0 - 1.0 );
 
         const QRectF outerRect = rect.adjusted( 0, 0, 1, 1 );
         QPolygonF polygon( outerRect );
 
-        if ( outerRect.width() > 2 * lw &&
-                outerRect.height() > 2 * lw )
+        if ( outerRect.width() > 2 * lw && outerRect.height() > 2 * lw )
         {
             const QRectF innerRect = outerRect.adjusted( lw, lw, -lw, -lw );
@@ -57,6 +57,6 @@
 }
 
-static void qwtDrawPanel( QPainter *painter, const QRectF &rect,
-    const QPalette &pal, double lw )
+static void qwtDrawPanel( QPainter* painter, const QRectF& rect,
+    const QPalette& pal, double lw )
 {
     if ( lw > 0.0 )
@@ -76,6 +76,6 @@
         }
 
-        lw = qMin( lw, rect.height() / 2.0 - 1.0 );
-        lw = qMin( lw, rect.width() / 2.0 - 1.0 );
+        lw = qwtMinF( lw, rect.height() / 2.0 - 1.0 );
+        lw = qwtMinF( lw, rect.width() / 2.0 - 1.0 );
 
         const QRectF outerRect = rect.adjusted( 0, 0, 1, 1 );
@@ -111,10 +111,10 @@
 class QwtColumnSymbol::PrivateData
 {
-public:
-    PrivateData():
-        style( QwtColumnSymbol::Box ),
-        frameStyle( QwtColumnSymbol::Raised ),
-        palette( Qt::gray ),
-        lineWidth( 2 )
+  public:
+    PrivateData()
+        : style( QwtColumnSymbol::Box )
+        , frameStyle( QwtColumnSymbol::Raised )
+        , palette( Qt::gray )
+        , lineWidth( 2 )
     {
     }
@@ -128,13 +128,13 @@
 
 /*!
-  Constructor
-
-  \param style Style of the symbol
-  \sa setStyle(), style(), Style
-*/
+   Constructor
+
+   \param style Style of the symbol
+   \sa setStyle(), style(), Style
+ */
 QwtColumnSymbol::QwtColumnSymbol( Style style )
 {
-    d_data = new PrivateData();
-    d_data->style = style;
+    m_data = new PrivateData();
+    m_data->style = style;
 }
 
@@ -142,45 +142,45 @@
 QwtColumnSymbol::~QwtColumnSymbol()
 {
-    delete d_data;
-}
-
-/*!
-  Specify the symbol style
-
-  \param style Style
-  \sa style(), setPalette()
-*/
+    delete m_data;
+}
+
+/*!
+   Specify the symbol style
+
+   \param style Style
+   \sa style(), setPalette()
+ */
 void QwtColumnSymbol::setStyle( Style style )
 {
-    d_data->style = style;
-}
-
-/*!
-  \return Current symbol style
-  \sa setStyle()
-*/
+    m_data->style = style;
+}
+
+/*!
+   \return Current symbol style
+   \sa setStyle()
+ */
 QwtColumnSymbol::Style QwtColumnSymbol::style() const
 {
-    return d_data->style;
-}
-
-/*!
-  Assign a palette for the symbol
-
-  \param palette Palette
-  \sa palette(), setStyle()
-*/
-void QwtColumnSymbol::setPalette( const QPalette &palette )
-{
-    d_data->palette = palette;
-}
-
-/*!
-  \return Current palette
-  \sa setPalette()
-*/
+    return m_data->style;
+}
+
+/*!
+   Assign a palette for the symbol
+
+   \param palette Palette
+   \sa palette(), setStyle()
+ */
+void QwtColumnSymbol::setPalette( const QPalette& palette )
+{
+    m_data->palette = palette;
+}
+
+/*!
+   \return Current palette
+   \sa setPalette()
+ */
 const QPalette& QwtColumnSymbol::palette() const
 {
-    return d_data->palette;
+    return m_data->palette;
 }
 
@@ -190,17 +190,17 @@
    \param frameStyle Frame style
    \sa frameStyle(), setLineWidth(), setStyle()
-*/
+ */
 void QwtColumnSymbol::setFrameStyle( FrameStyle frameStyle )
 {
-    d_data->frameStyle = frameStyle;
-}
-
-/*!
-  \return Current frame style, that is used for the Box style.
-  \sa setFrameStyle(), lineWidth(), setStyle()
-*/
+    m_data->frameStyle = frameStyle;
+}
+
+/*!
+   \return Current frame style, that is used for the Box style.
+   \sa setFrameStyle(), lineWidth(), setStyle()
+ */
 QwtColumnSymbol::FrameStyle QwtColumnSymbol::frameStyle() const
 {
-    return d_data->frameStyle;
+    return m_data->frameStyle;
 }
 
@@ -210,5 +210,5 @@
    \param width Width
    \sa lineWidth(), setFrameStyle()
-*/
+ */
 void QwtColumnSymbol::setLineWidth( int width )
 {
@@ -216,30 +216,30 @@
         width = 0;
 
-    d_data->lineWidth = width;
-}
-
-/*!
-  \return Line width of the frame, that is used for the Box style.
-  \sa setLineWidth(), frameStyle(), setStyle()
-*/
+    m_data->lineWidth = width;
+}
+
+/*!
+   \return Line width of the frame, that is used for the Box style.
+   \sa setLineWidth(), frameStyle(), setStyle()
+ */
 int QwtColumnSymbol::lineWidth() const
 {
-    return d_data->lineWidth;
-}
-
-/*!
-  Draw the symbol depending on its style.
-
-  \param painter Painter
-  \param rect Directed rectangle
-
-  \sa drawBox()
-*/
-void QwtColumnSymbol::draw( QPainter *painter,
-    const QwtColumnRect &rect ) const
+    return m_data->lineWidth;
+}
+
+/*!
+   Draw the symbol depending on its style.
+
+   \param painter Painter
+   \param rect Directed rectangle
+
+   \sa drawBox()
+ */
+void QwtColumnSymbol::draw( QPainter* painter,
+    const QwtColumnRect& rect ) const
 {
     painter->save();
 
-    switch ( d_data->style )
+    switch ( m_data->style )
     {
         case QwtColumnSymbol::Box:
@@ -255,13 +255,13 @@
 
 /*!
-  Draw the symbol when it is in Box style.
-
-  \param painter Painter
-  \param rect Directed rectangle
-
-  \sa draw()
-*/
-void QwtColumnSymbol::drawBox( QPainter *painter,
-    const QwtColumnRect &rect ) const
+   Draw the symbol when it is in Box style.
+
+   \param painter Painter
+   \param rect Directed rectangle
+
+   \sa draw()
+ */
+void QwtColumnSymbol::drawBox( QPainter* painter,
+    const QwtColumnRect& rect ) const
 {
     QRectF r = rect.toRect();
@@ -274,20 +274,45 @@
     }
 
-    switch ( d_data->frameStyle )
+    switch ( m_data->frameStyle )
     {
         case QwtColumnSymbol::Raised:
         {
-            qwtDrawPanel( painter, r, d_data->palette, d_data->lineWidth );
+            qwtDrawPanel( painter, r, m_data->palette, m_data->lineWidth );
             break;
         }
         case QwtColumnSymbol::Plain:
         {
-            qwtDrawBox( painter, r, d_data->palette, d_data->lineWidth );
+            qwtDrawBox( painter, r, m_data->palette, m_data->lineWidth );
             break;
         }
         default:
         {
-            painter->fillRect( r.adjusted( 0, 0, 1, 1 ), d_data->palette.window() );
-        }
-    }
-}
+            painter->fillRect( r.adjusted( 0, 0, 1, 1 ), m_data->palette.window() );
+        }
+    }
+}
+
+//! \return A normalized QRect built from the intervals
+QRectF QwtColumnRect::toRect() const
+{
+    QRectF r( hInterval.minValue(), vInterval.minValue(),
+        hInterval.maxValue() - hInterval.minValue(),
+        vInterval.maxValue() - vInterval.minValue() );
+
+    r = r.normalized();
+
+    if ( hInterval.borderFlags() & QwtInterval::ExcludeMinimum )
+        r.adjust( 1, 0, 0, 0 );
+
+    if ( hInterval.borderFlags() & QwtInterval::ExcludeMaximum )
+        r.adjust( 0, 0, -1, 0 );
+
+    if ( vInterval.borderFlags() & QwtInterval::ExcludeMinimum )
+        r.adjust( 0, 1, 0, 0 );
+
+    if ( vInterval.borderFlags() & QwtInterval::ExcludeMaximum )
+        r.adjust( 0, 0, 0, -1 );
+
+    return r;
+}
+
Index: /trunk/BNC/qwt/qwt_column_symbol.h
===================================================================
--- /trunk/BNC/qwt/qwt_column_symbol.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_column_symbol.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,20 +13,18 @@
 #include "qwt_global.h"
 #include "qwt_interval.h"
-#include <qpen.h>
-#include <qsize.h>
-#include <qrect.h>
+
+#include <qnamespace.h>
 
 class QPainter;
 class QPalette;
-class QRect;
-class QwtText;
+class QRectF;
 
 /*!
     \brief Directed rectangle representing bounding rectangle and orientation
     of a column.
-*/
+ */
 class QWT_EXPORT QwtColumnRect
 {
-public:
+  public:
     //! Direction of the column
     enum Direction
@@ -46,28 +44,11 @@
 
     //! Build an rectangle with invalid intervals directed BottomToTop.
-    QwtColumnRect():
-        direction( BottomToTop )
+    QwtColumnRect()
+        : direction( BottomToTop )
     {
     }
 
     //! \return A normalized QRect built from the intervals
-    QRectF toRect() const
-    {
-        QRectF r( hInterval.minValue(), vInterval.minValue(),
-            hInterval.maxValue() - hInterval.minValue(),
-            vInterval.maxValue() - vInterval.minValue() );
-        r = r.normalized();
-
-        if ( hInterval.borderFlags() & QwtInterval::ExcludeMinimum )
-            r.adjust( 1, 0, 0, 0 );
-        if ( hInterval.borderFlags() & QwtInterval::ExcludeMaximum )
-            r.adjust( 0, 0, -1, 0 );
-        if ( vInterval.borderFlags() & QwtInterval::ExcludeMinimum )
-            r.adjust( 0, 1, 0, 0 );
-        if ( vInterval.borderFlags() & QwtInterval::ExcludeMaximum )
-            r.adjust( 0, 0, 0, -1 );
-
-        return r;
-    }
+    QRectF toRect() const;
 
     //! \return Orientation
@@ -93,9 +74,9 @@
 class QWT_EXPORT QwtColumnSymbol
 {
-public:
+  public:
     /*!
-      Style
-      \sa setStyle(), style()
-    */
+       Style
+       \sa setStyle(), style()
+     */
     enum Style
     {
@@ -104,13 +85,13 @@
 
         /*!
-          The column is painted with a frame depending on the frameStyle()
-          and lineWidth() using the palette().
+           The column is painted with a frame depending on the frameStyle()
+           and lineWidth() using the palette().
          */
         Box,
 
         /*!
-          Styles >= QwtColumnSymbol::UserStyle are reserved for derived
-          classes of QwtColumnSymbol that overload draw() with
-          additional application specific symbol types.
+           Styles >= QwtColumnSymbol::UserStyle are reserved for derived
+           classes of QwtColumnSymbol that overload draw() with
+           additional application specific symbol types.
          */
         UserStyle = 1000
@@ -118,6 +99,6 @@
 
     /*!
-      Frame Style used in Box style().
-      \sa Style, setFrameStyle(), frameStyle(), setStyle(), setPalette()
+       Frame Style used in Box style().
+       \sa Style, setFrameStyle(), frameStyle(), setStyle(), setPalette()
      */
     enum FrameStyle
@@ -133,6 +114,6 @@
     };
 
-public:
-    QwtColumnSymbol( Style = NoStyle );
+  public:
+    explicit QwtColumnSymbol( Style = NoStyle );
     virtual ~QwtColumnSymbol();
 
@@ -143,18 +124,20 @@
     int lineWidth() const;
 
-    void setPalette( const QPalette & );
-    const QPalette &palette() const;
+    void setPalette( const QPalette& );
+    const QPalette& palette() const;
 
     void setStyle( Style );
     Style style() const;
 
-    virtual void draw( QPainter *, const QwtColumnRect & ) const;
+    virtual void draw( QPainter*, const QwtColumnRect& ) const;
 
-protected:
-    void drawBox( QPainter *, const QwtColumnRect & ) const;
+  protected:
+    void drawBox( QPainter*, const QwtColumnRect& ) const;
 
-private:
+  private:
+    Q_DISABLE_COPY(QwtColumnSymbol)
+
     class PrivateData;
-    PrivateData* d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_compass.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_compass.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_compass.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,93 +10,107 @@
 #include "qwt_compass.h"
 #include "qwt_compass_rose.h"
-#include "qwt_math.h"
-#include "qwt_scale_draw.h"
-#include "qwt_painter.h"
-#include "qwt_dial_needle.h"
-#include <qpainter.h>
-#include <qpixmap.h>
+#include "qwt_text.h"
+
 #include <qevent.h>
-
-/*!
-  \brief Constructor
-
-  Initializes a label map for multiples of 45 degrees
+#include <qmap.h>
+
+class QwtCompassScaleDraw::PrivateData
+{
+  public:
+    QMap< double, QString > labelMap;
+};
+
+/*!
+   \brief Constructor
+
+   Initializes a label map for multiples of 45 degrees
  */
 QwtCompassScaleDraw::QwtCompassScaleDraw()
 {
+    m_data = new PrivateData;
+
     enableComponent( QwtAbstractScaleDraw::Backbone, false );
     enableComponent( QwtAbstractScaleDraw::Ticks, false );
 
-    d_labelMap.insert( 0.0, QString::fromLatin1( "N" ) );
-    d_labelMap.insert( 45.0, QString::fromLatin1( "NE" ) );
-    d_labelMap.insert( 90.0, QString::fromLatin1( "E" ) );
-    d_labelMap.insert( 135.0, QString::fromLatin1( "SE" ) );
-    d_labelMap.insert( 180.0, QString::fromLatin1( "S" ) );
-    d_labelMap.insert( 225.0, QString::fromLatin1( "SW" ) );
-    d_labelMap.insert( 270.0, QString::fromLatin1( "W" ) );
-    d_labelMap.insert( 315.0, QString::fromLatin1( "NW" ) );
+    QMap< double, QString >& map = m_data->labelMap;
+
+    map.insert( 0.0, QString::fromLatin1( "N" ) );
+    map.insert( 45.0, QString::fromLatin1( "NE" ) );
+    map.insert( 90.0, QString::fromLatin1( "E" ) );
+    map.insert( 135.0, QString::fromLatin1( "SE" ) );
+    map.insert( 180.0, QString::fromLatin1( "S" ) );
+    map.insert( 225.0, QString::fromLatin1( "SW" ) );
+    map.insert( 270.0, QString::fromLatin1( "W" ) );
+    map.insert( 315.0, QString::fromLatin1( "NW" ) );
 
 #if 0
-    d_labelMap.insert( 22.5, QString::fromLatin1( "NNE" ) );
-    d_labelMap.insert( 67.5, QString::fromLatin1( "NEE" ) );
-    d_labelMap.insert( 112.5, QString::fromLatin1( "SEE" ) );
-    d_labelMap.insert( 157.5, QString::fromLatin1( "SSE" ) );
-    d_labelMap.insert( 202.5, QString::fromLatin1( "SSW" ) );
-    d_labelMap.insert( 247.5, QString::fromLatin1( "SWW" ) );
-    d_labelMap.insert( 292.5, QString::fromLatin1( "NWW" ) );
-    d_labelMap.insert( 337.5, QString::fromLatin1( "NNW" ) );
+    map.insert( 22.5, QString::fromLatin1( "NNE" ) );
+    map.insert( 67.5, QString::fromLatin1( "NEE" ) );
+    map.insert( 112.5, QString::fromLatin1( "SEE" ) );
+    map.insert( 157.5, QString::fromLatin1( "SSE" ) );
+    map.insert( 202.5, QString::fromLatin1( "SSW" ) );
+    map.insert( 247.5, QString::fromLatin1( "SWW" ) );
+    map.insert( 292.5, QString::fromLatin1( "NWW" ) );
+    map.insert( 337.5, QString::fromLatin1( "NNW" ) );
 #endif
 }
 
 /*!
-  \brief Constructor
-
-  \param map Value to label map
- */
-QwtCompassScaleDraw::QwtCompassScaleDraw( const QMap<double, QString> &map ):
-    d_labelMap( map )
-{
+   \brief Constructor
+
+   \param map Value to label map
+ */
+QwtCompassScaleDraw::QwtCompassScaleDraw( const QMap< double, QString >& map )
+{
+    m_data = new PrivateData;
+    m_data->labelMap = map;
+
     enableComponent( QwtAbstractScaleDraw::Backbone, false );
     enableComponent( QwtAbstractScaleDraw::Ticks, false );
 }
 
-/*!
-  \brief Set a map, mapping values to labels
-  \param map Value to label map
-
-  The values of the major ticks are found by looking into this
-  map. The default map consists of the labels N, NE, E, SE, S, SW, W, NW.
-
-  \warning The map will have no effect for values that are no major
+//!  Destructor
+QwtCompassScaleDraw::~QwtCompassScaleDraw()
+{
+    delete m_data;
+}
+
+/*!
+   \brief Set a map, mapping values to labels
+   \param map Value to label map
+
+   The values of the major ticks are found by looking into this
+   map. The default map consists of the labels N, NE, E, SE, S, SW, W, NW.
+
+   \warning The map will have no effect for values that are no major
            tick values. Major ticks can be changed by QwtScaleDraw::setScale
 
-  \sa labelMap(), scaleDraw(), setScale()
-*/
-void QwtCompassScaleDraw::setLabelMap( const QMap<double, QString> &map )
-{
-    d_labelMap = map;
-}
-
-
-/*!
-  \return map, mapping values to labels
-  \sa setLabelMap()
-*/
-QMap<double, QString> QwtCompassScaleDraw::labelMap() const
-{
-    return d_labelMap;
-}
-
-/*!
-  Map a value to a corresponding label
-
-  \param value Value that will be mapped
-
-  label() looks in the labelMap() for a corresponding label for value
-  or returns an null text.
-
-  \return Label
-  \sa labelMap(), setLabelMap()
-*/
+   \sa labelMap(), scaleDraw(), setScale()
+ */
+void QwtCompassScaleDraw::setLabelMap( const QMap< double, QString >& map )
+{
+    m_data->labelMap = map;
+}
+
+/*!
+   \return map, mapping values to labels
+   \sa setLabelMap()
+ */
+QMap< double, QString > QwtCompassScaleDraw::labelMap() const
+{
+    return m_data->labelMap;
+}
+
+/*!
+   Map a value to a corresponding label
+
+   \param value Value that will be mapped
+
+   label() looks in the labelMap() for a corresponding label for value
+   or returns an null text.
+
+   \return Label
+   \sa labelMap(), setLabelMap()
+ */
 
 QwtText QwtCompassScaleDraw::label( double value ) const
@@ -108,6 +122,9 @@
         value += 360.0;
 
-    if ( d_labelMap.contains( value ) )
-        return d_labelMap[value];
+    QMap< double, QString >::const_iterator it =
+        m_data->labelMap.constFind( value );
+
+    if ( it != m_data->labelMap.constEnd() )
+        return *it;
 
     return QwtText();
@@ -116,5 +133,5 @@
 class QwtCompass::PrivateData
 {
-public:
+  public:
     PrivateData():
         rose( NULL )
@@ -127,20 +144,20 @@
     }
 
-    QwtCompassRose *rose;
+    QwtCompassRose* rose;
 };
 
 /*!
-  \brief Constructor
-  \param parent Parent widget
-
-  Create a compass widget with a scale, no needle and no rose.
-  The default origin is 270.0 with no valid value. It accepts
-  mouse and keyboard inputs and has no step size. The default mode
-  is QwtDial::RotateNeedle.
-*/
-QwtCompass::QwtCompass( QWidget* parent ):
-    QwtDial( parent )
-{
-    d_data = new PrivateData;
+   \brief Constructor
+   \param parent Parent widget
+
+   Create a compass widget with a scale, no needle and no rose.
+   The default origin is 270.0 with no valid value. It accepts
+   mouse and keyboard inputs and has no step size. The default mode
+   is QwtDial::RotateNeedle.
+ */
+QwtCompass::QwtCompass( QWidget* parent )
+    : QwtDial( parent )
+{
+    m_data = new PrivateData;
 
     setScaleDraw( new QwtCompassScaleDraw() );
@@ -159,5 +176,5 @@
 QwtCompass::~QwtCompass()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -169,7 +186,7 @@
    \param center Center of the content circle
    \param radius Radius of the content circle
-*/
-void QwtCompass::drawScaleContents( QPainter *painter,
-    const QPointF &center, double radius ) const
+ */
+void QwtCompass::drawScaleContents( QPainter* painter,
+    const QPointF& center, double radius ) const
 {
     QPalette::ColorGroup cg;
@@ -191,34 +208,34 @@
 
 /*!
-  Draw the compass rose
-
-  \param painter Painter
-  \param center Center of the compass
-  \param radius of the circle, where to paint the rose
-  \param north Direction pointing north, in degrees counter clockwise
-  \param cg Color group
-*/
-void QwtCompass::drawRose( QPainter *painter, const QPointF &center,
+   Draw the compass rose
+
+   \param painter Painter
+   \param center Center of the compass
+   \param radius of the circle, where to paint the rose
+   \param north Direction pointing north, in degrees counter clockwise
+   \param cg Color group
+ */
+void QwtCompass::drawRose( QPainter* painter, const QPointF& center,
     double radius, double north, QPalette::ColorGroup cg ) const
 {
-    if ( d_data->rose )
-        d_data->rose->draw( painter, center, radius, north,  cg );
-}
-
-/*!
-  Set a rose for the compass
-  \param rose Compass rose
-  \warning The rose will be deleted, when a different rose is
+    if ( m_data->rose )
+        m_data->rose->draw( painter, center, radius, north,  cg );
+}
+
+/*!
+   Set a rose for the compass
+   \param rose Compass rose
+   \warning The rose will be deleted, when a different rose is
     set or in ~QwtCompass
-  \sa rose()
-*/
-void QwtCompass::setRose( QwtCompassRose *rose )
-{
-    if ( rose != d_data->rose )
-    {
-        if ( d_data->rose )
-            delete d_data->rose;
-
-        d_data->rose = rose;
+   \sa rose()
+ */
+void QwtCompass::setRose( QwtCompassRose* rose )
+{
+    if ( rose != m_data->rose )
+    {
+        if ( m_data->rose )
+            delete m_data->rose;
+
+        m_data->rose = rose;
         update();
     }
@@ -226,31 +243,31 @@
 
 /*!
-  \return rose
-  \sa setRose()
-*/
-const QwtCompassRose *QwtCompass::rose() const
-{
-    return d_data->rose;
-}
-
-/*!
-  \return rose
-  \sa setRose()
-*/
-QwtCompassRose *QwtCompass::rose()
-{
-    return d_data->rose;
-}
-
-/*!
-  Handles key events
-
-  Beside the keys described in QwtDial::keyPressEvent numbers
-  from 1-9 (without 5) set the direction according to their
-  position on the num pad.
-
-  \sa isReadOnly()
-*/
-void QwtCompass::keyPressEvent( QKeyEvent *kev )
+   \return rose
+   \sa setRose()
+ */
+const QwtCompassRose* QwtCompass::rose() const
+{
+    return m_data->rose;
+}
+
+/*!
+   \return rose
+   \sa setRose()
+ */
+QwtCompassRose* QwtCompass::rose()
+{
+    return m_data->rose;
+}
+
+/*!
+   Handles key events
+
+   Beside the keys described in QwtDial::keyPressEvent numbers
+   from 1-9 (without 5) set the direction according to their
+   position on the num pad.
+
+   \sa isReadOnly()
+ */
+void QwtCompass::keyPressEvent( QKeyEvent* kev )
 {
     if ( isReadOnly() )
@@ -307,2 +324,4 @@
     }
 }
+
+#include "moc_qwt_compass.cpp"
Index: /trunk/BNC/qwt/qwt_compass.h
===================================================================
--- /trunk/BNC/qwt/qwt_compass.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_compass.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,74 +9,78 @@
 
 #ifndef QWT_COMPASS_H
-#define QWT_COMPASS_H 1
+#define QWT_COMPASS_H
 
 #include "qwt_global.h"
 #include "qwt_dial.h"
 #include "qwt_round_scale_draw.h"
-#include <qstring.h>
-#include <qmap.h>
 
 class QwtCompassRose;
+class QString;
+template< class Key, class T > class QMap;
+
 
 /*!
-  \brief A special scale draw made for QwtCompass
+   \brief A special scale draw made for QwtCompass
 
-  QwtCompassScaleDraw maps values to strings using
-  a special map, that can be modified by the application
+   QwtCompassScaleDraw maps values to strings using
+   a special map, that can be modified by the application
 
-  The default map consists of the labels N, NE, E, SE, S, SW, W, NW.
+   The default map consists of the labels N, NE, E, SE, S, SW, W, NW.
 
-  \sa QwtCompass
-*/
-class QWT_EXPORT QwtCompassScaleDraw: public QwtRoundScaleDraw
+   \sa QwtCompass
+ */
+class QWT_EXPORT QwtCompassScaleDraw : public QwtRoundScaleDraw
 {
-public:
+  public:
     explicit QwtCompassScaleDraw();
-    explicit QwtCompassScaleDraw( const QMap<double, QString> &map );
+    explicit QwtCompassScaleDraw( const QMap< double, QString >& map );
 
-    void setLabelMap( const QMap<double, QString> &map );
-    QMap<double, QString> labelMap() const;
+    virtual ~QwtCompassScaleDraw();
 
-    virtual QwtText label( double value ) const;
+    void setLabelMap( const QMap< double, QString >& map );
+    QMap< double, QString > labelMap() const;
 
-private:
-    QMap<double, QString> d_labelMap;
+    virtual QwtText label( double value ) const QWT_OVERRIDE;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
 };
 
 /*!
-  \brief A Compass Widget
+   \brief A Compass Widget
 
-  QwtCompass is a widget to display and enter directions. It consists
-  of a scale, an optional needle and rose.
+   QwtCompass is a widget to display and enter directions. It consists
+   of a scale, an optional needle and rose.
 
-  \image html dials1.png
+   \image html dials1.png
 
-  \note The examples/dials example shows how to use QwtCompass.
-*/
+   \note The examples/dials example shows how to use QwtCompass.
+ */
 
-class QWT_EXPORT QwtCompass: public QwtDial
+class QWT_EXPORT QwtCompass : public QwtDial
 {
     Q_OBJECT
 
-public:
+  public:
     explicit QwtCompass( QWidget* parent = NULL );
     virtual ~QwtCompass();
 
-    void setRose( QwtCompassRose *rose );
-    const QwtCompassRose *rose() const;
-    QwtCompassRose *rose();
+    void setRose( QwtCompassRose* rose );
+    const QwtCompassRose* rose() const;
+    QwtCompassRose* rose();
 
-protected:
-    virtual void drawRose( QPainter *, const QPointF &center,
+  protected:
+    virtual void drawRose( QPainter*, const QPointF& center,
         double radius, double north, QPalette::ColorGroup ) const;
 
-    virtual void drawScaleContents( QPainter *,
-        const QPointF &center, double radius ) const;
+    virtual void drawScaleContents( QPainter*,
+        const QPointF& center, double radius ) const QWT_OVERRIDE;
 
-    virtual void keyPressEvent( QKeyEvent * );
+    virtual void keyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_compass_rose.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_compass_rose.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_compass_rose.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,5 +10,5 @@
 #include "qwt_compass_rose.h"
 #include "qwt_point_polar.h"
-#include "qwt_painter.h"
+
 #include <qpainter.h>
 #include <qpainterpath.h>
@@ -21,5 +21,9 @@
 
     QPointF pos;
+#if QT_VERSION >= 0x050e00
+    if ( line1.intersects( line2, &pos ) == QLineF::NoIntersection )
+#else
     if ( line1.intersect( line2, &pos ) == QLineF::NoIntersection )
+#endif
         return QPointF();
 
@@ -27,12 +31,34 @@
 }
 
+//! Constructor
+QwtCompassRose::QwtCompassRose()
+{
+}
+
+//! Destructor
+QwtCompassRose::~QwtCompassRose()
+{
+}
+
+//! Assign a palette
+void QwtCompassRose::setPalette( const QPalette& p )
+{
+    m_palette = p;
+}
+
+//! \return Current palette
+const QPalette& QwtCompassRose::palette() const
+{
+    return m_palette;
+}
+
 class QwtSimpleCompassRose::PrivateData
 {
-public:
-    PrivateData():
-        width( 0.2 ),
-        numThorns( 8 ),
-        numThornLevels( -1 ),
-        shrinkFactor( 0.9 )
+  public:
+    PrivateData()
+        : width( 0.2 )
+        , numThorns( 8 )
+        , numThornLevels( -1 )
+        , shrinkFactor( 0.9 )
     {
     }
@@ -49,11 +75,11 @@
    \param numThorns Number of thorns
    \param numThornLevels Number of thorn levels
-*/
+ */
 QwtSimpleCompassRose::QwtSimpleCompassRose(
     int numThorns, int numThornLevels )
 {
-    d_data = new PrivateData();
-    d_data->numThorns = numThorns;
-    d_data->numThornLevels = numThornLevels;
+    m_data = new PrivateData();
+    m_data->numThorns = numThorns;
+    m_data->numThornLevels = numThornLevels;
 
     const QColor dark( 128, 128, 255 );
@@ -70,26 +96,26 @@
 QwtSimpleCompassRose::~QwtSimpleCompassRose()
 {
-    delete d_data;
-}
-
-/*!
-  Set the Factor how to shrink the thorns with each level
-  The default value is 0.9.
-
-  \param factor Shrink factor
-  \sa shrinkFactor()
-*/
+    delete m_data;
+}
+
+/*!
+   Set the Factor how to shrink the thorns with each level
+   The default value is 0.9.
+
+   \param factor Shrink factor
+   \sa shrinkFactor()
+ */
 void QwtSimpleCompassRose::setShrinkFactor( double factor )
 {
-    d_data->shrinkFactor = factor;
-}
-
-/*!
-  \return Factor how to shrink the thorns with each level
-  \sa setShrinkFactor()
-*/
+    m_data->shrinkFactor = factor;
+}
+
+/*!
+   \return Factor how to shrink the thorns with each level
+   \sa setShrinkFactor()
+ */
 double QwtSimpleCompassRose::shrinkFactor() const
 {
-    return d_data->shrinkFactor;
+    return m_data->shrinkFactor;
 }
 
@@ -102,6 +128,6 @@
    \param north Position
    \param cg Color group
-*/
-void QwtSimpleCompassRose::draw( QPainter *painter, const QPointF &center,
+ */
+void QwtSimpleCompassRose::draw( QPainter* painter, const QPointF& center,
     double radius, double north, QPalette::ColorGroup cg ) const
 {
@@ -109,6 +135,6 @@
     pal.setCurrentColorGroup( cg );
 
-    drawRose( painter, pal, center, radius, north, d_data->width,
-        d_data->numThorns, d_data->numThornLevels, d_data->shrinkFactor );
+    drawRose( painter, pal, center, radius, north, m_data->width,
+        m_data->numThorns, m_data->numThornLevels, m_data->shrinkFactor );
 }
 
@@ -125,9 +151,9 @@
    \param numThornLevels Number of thorn levels
    \param shrinkFactor Factor to shrink the thorns with each level
-*/
+ */
 void QwtSimpleCompassRose::drawRose(
-    QPainter *painter,
-    const QPalette &palette,
-    const QPointF &center, double radius, double north, double width,
+    QPainter* painter,
+    const QPalette& palette,
+    const QPointF& center, double radius, double north, double width,
     int numThorns, int numThornLevels, double shrinkFactor )
 {
@@ -153,5 +179,5 @@
     for ( int j = 1; j <= numThornLevels; j++ )
     {
-        double step =  qPow( 2.0, j ) * M_PI / numThorns;
+        double step = std::pow( 2.0, j ) * M_PI / numThorns;
         if ( step > M_PI_2 )
             break;
@@ -203,31 +229,31 @@
 
    \param width Width
-*/
+ */
 void QwtSimpleCompassRose::setWidth( double width )
 {
-    d_data->width = width;
-    if ( d_data->width < 0.03 )
-        d_data->width = 0.03;
-
-    if ( d_data->width > 0.4 )
-        d_data->width = 0.4;
-}
-
-/*!
-  \return Width of the rose
-  \sa setWidth()
+    m_data->width = width;
+    if ( m_data->width < 0.03 )
+        m_data->width = 0.03;
+
+    if ( m_data->width > 0.4 )
+        m_data->width = 0.4;
+}
+
+/*!
+   \return Width of the rose
+   \sa setWidth()
  */
 double QwtSimpleCompassRose::width() const
 {
-    return d_data->width;
-}
-
-/*!
-  Set the number of thorns on one level
-  The number is aligned to a multiple of 4, with a minimum of 4
-
-  \param numThorns Number of thorns
-  \sa numThorns(), setNumThornLevels()
-*/
+    return m_data->width;
+}
+
+/*!
+   Set the number of thorns on one level
+   The number is aligned to a multiple of 4, with a minimum of 4
+
+   \param numThorns Number of thorns
+   \sa numThorns(), setNumThornLevels()
+ */
 void QwtSimpleCompassRose::setNumThorns( int numThorns )
 {
@@ -238,5 +264,5 @@
         numThorns += 4 - numThorns % 4;
 
-    d_data->numThorns = numThorns;
+    m_data->numThorns = numThorns;
 }
 
@@ -244,19 +270,19 @@
    \return Number of thorns
    \sa setNumThorns(), setNumThornLevels()
-*/
+ */
 int QwtSimpleCompassRose::numThorns() const
 {
-    return d_data->numThorns;
-}
-
-/*!
-  Set the of thorns levels
-
-  \param numThornLevels Number of thorns levels
-  \sa setNumThorns(), numThornLevels()
-*/
+    return m_data->numThorns;
+}
+
+/*!
+   Set the of thorns levels
+
+   \param numThornLevels Number of thorns levels
+   \sa setNumThorns(), numThornLevels()
+ */
 void QwtSimpleCompassRose::setNumThornLevels( int numThornLevels )
 {
-    d_data->numThornLevels = numThornLevels;
+    m_data->numThornLevels = numThornLevels;
 }
 
@@ -264,7 +290,7 @@
    \return Number of thorn levels
    \sa setNumThorns(), setNumThornLevels()
-*/
+ */
 int QwtSimpleCompassRose::numThornLevels() const
 {
-    return d_data->numThornLevels;
-}
+    return m_data->numThornLevels;
+}
Index: /trunk/BNC/qwt/qwt_compass_rose.h
===================================================================
--- /trunk/BNC/qwt/qwt_compass_rose.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_compass_rose.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,5 +9,5 @@
 
 #ifndef QWT_COMPASS_ROSE_H
-#define QWT_COMPASS_ROSE_H 1
+#define QWT_COMPASS_ROSE_H
 
 #include "qwt_global.h"
@@ -17,23 +17,14 @@
 
 /*!
-  \brief Abstract base class for a compass rose
-*/
+   \brief Abstract base class for a compass rose
+ */
 class QWT_EXPORT QwtCompassRose
 {
-public:
-    //! Destructor
-    virtual ~QwtCompassRose() {};
+  public:
+    QwtCompassRose();
+    virtual ~QwtCompassRose();
 
-    //! Assign a palette
-    virtual void setPalette( const QPalette &p )
-    {
-        d_palette = p;
-    }
-
-    //! \return Current palette
-    const QPalette &palette() const
-    {
-        return d_palette;
-    }
+    virtual void setPalette( const QPalette& );
+    const QPalette& palette() const;
 
     /*!
@@ -46,18 +37,20 @@
         \param colorGroup Color group
      */
-    virtual void draw( QPainter *painter,
-        const QPointF &center, double radius, double north,
+    virtual void draw( QPainter* painter,
+        const QPointF& center, double radius, double north,
         QPalette::ColorGroup colorGroup = QPalette::Active ) const = 0;
 
-private:
-    QPalette d_palette;
+  private:
+    Q_DISABLE_COPY(QwtCompassRose)
+
+    QPalette m_palette;
 };
 
 /*!
-  \brief A simple rose for QwtCompass
-*/
-class QWT_EXPORT QwtSimpleCompassRose: public QwtCompassRose
+   \brief A simple rose for QwtCompass
+ */
+class QWT_EXPORT QwtSimpleCompassRose : public QwtCompassRose
 {
-public:
+  public:
     QwtSimpleCompassRose( int numThorns = 8, int numThornLevels = -1 );
     virtual ~QwtSimpleCompassRose();
@@ -75,14 +68,15 @@
     double shrinkFactor() const;
 
-    virtual void draw( QPainter *, const QPointF &center, double radius,
-        double north, QPalette::ColorGroup = QPalette::Active ) const;
+    virtual void draw( QPainter*,
+        const QPointF& center, double radius, double north,
+        QPalette::ColorGroup = QPalette::Active ) const QWT_OVERRIDE;
 
-    static void drawRose( QPainter *, const QPalette &,
-        const QPointF &center, double radius, double north, double width,
+    static void drawRose( QPainter*, const QPalette&,
+        const QPointF& center, double radius, double north, double width,
         int numThorns, int numThornLevels, double shrinkFactor );
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: unk/BNC/qwt/qwt_compat.h
===================================================================
--- /trunk/BNC/qwt/qwt_compat.h	(revision 11157)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
- * Qwt Widget Library
- * Copyright (C) 1997   Josef Wilgen
- * Copyright (C) 2002   Uwe Rathmann
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the Qwt License, Version 1.0
- *****************************************************************************/
-
-#ifndef _QWT_COMPAT_H_
-#define _QWT_COMPAT_H_
-
-#include "qwt_global.h"
-#include "qwt_interval.h"
-#include "qwt_point_3d.h"
-#include <qlist.h>
-#include <qvector.h>
-#include <qpoint.h>
-#include <qsize.h>
-#include <qrect.h>
-#include <qpolygon.h>
-
-// A couple of definition for Qwt5 compatibility
-
-#define qwtMax qMax
-#define qwtMin qMin
-#define qwtAbs qAbs
-#define qwtRound qRound
-
-#define QwtArray QVector
-
-typedef QList<double> QwtValueList;
-typedef QPointF QwtDoublePoint;
-typedef QSizeF QwtDoubleSize;
-typedef QRectF QwtDoubleRect;
-
-typedef QPolygon QwtPolygon;
-typedef QPolygonF QwtPolygonF;
-typedef QwtInterval QwtDoubleInterval;
-typedef QwtPoint3D QwtDoublePoint3D;
-
-#endif
Index: /trunk/BNC/qwt/qwt_counter.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_counter.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_counter.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,6 +9,8 @@
 
 #include "qwt_arrow_button.h"
+#include "qwt_counter.h"
+#include "qwt_painter.h"
 #include "qwt_math.h"
-#include "qwt_counter.h"
+
 #include <qlayout.h>
 #include <qlineedit.h>
@@ -19,12 +21,12 @@
 class QwtCounter::PrivateData
 {
-public:
-    PrivateData():
-        minimum( 0.0 ),
-        maximum( 0.0 ),
-        singleStep( 1.0 ),
-        isValid( false ),
-        value( 0.0 ),
-        wrapping( false )
+  public:
+    PrivateData()
+        : minimum( 0.0 )
+        , maximum( 0.0 )
+        , singleStep( 1.0 )
+        , isValid( false )
+        , value( 0.0 )
+        , wrapping( false )
     {
         increment[Button1] = 1;
@@ -33,7 +35,7 @@
     }
 
-    QwtArrowButton *buttonDown[ButtonCnt];
-    QwtArrowButton *buttonUp[ButtonCnt];
-    QLineEdit *valueEdit;
+    QwtArrowButton* buttonDown[ButtonCnt];
+    QwtArrowButton* buttonUp[ButtonCnt];
+    QLineEdit* valueEdit;
 
     int increment[ButtonCnt];
@@ -51,16 +53,16 @@
 
 /*!
-  The counter is initialized with a range is set to [0.0, 1.0] with
-  0.01 as single step size. The value is invalid.
-
-  The default number of buttons is set to 2. The default increments are:
-  \li Button 1: 1 step
-  \li Button 2: 10 steps
-  \li Button 3: 100 steps
-
-  \param parent
- */
-QwtCounter::QwtCounter( QWidget *parent ):
-    QWidget( parent )
+   The counter is initialized with a range is set to [0.0, 1.0] with
+   0.01 as single step size. The value is invalid.
+
+   The default number of buttons is set to 2. The default increments are:
+   \li Button 1: 1 step
+   \li Button 2: 10 steps
+   \li Button 3: 100 steps
+
+   \param parent
+ */
+QwtCounter::QwtCounter( QWidget* parent )
+    : QWidget( parent )
 {
     initCounter();
@@ -69,16 +71,15 @@
 void QwtCounter::initCounter()
 {
-    d_data = new PrivateData;
-
-    QHBoxLayout *layout = new QHBoxLayout( this );
+    m_data = new PrivateData;
+
+    QHBoxLayout* layout = new QHBoxLayout( this );
     layout->setSpacing( 0 );
-    layout->setMargin( 0 );
+    layout->setContentsMargins( QMargins() );
 
     for ( int i = ButtonCnt - 1; i >= 0; i-- )
     {
-        QwtArrowButton *btn =
+        QwtArrowButton* btn =
             new QwtArrowButton( i + 1, Qt::DownArrow, this );
         btn->setFocusPolicy( Qt::NoFocus );
-        btn->installEventFilter( this );
         layout->addWidget( btn );
 
@@ -86,22 +87,21 @@
         connect( btn, SIGNAL(clicked()), SLOT(btnClicked()) );
 
-        d_data->buttonDown[i] = btn;
-    }
-
-    d_data->valueEdit = new QLineEdit( this );
-    d_data->valueEdit->setReadOnly( false );
-    d_data->valueEdit->setValidator( new QDoubleValidator( d_data->valueEdit ) );
-    layout->addWidget( d_data->valueEdit );
-
-    connect( d_data->valueEdit, SIGNAL(editingFinished()), SLOT(textChanged()) );
-
-    layout->setStretchFactor( d_data->valueEdit, 10 );
+        m_data->buttonDown[i] = btn;
+    }
+
+    m_data->valueEdit = new QLineEdit( this );
+    m_data->valueEdit->setReadOnly( false );
+    m_data->valueEdit->setValidator( new QDoubleValidator( m_data->valueEdit ) );
+    layout->addWidget( m_data->valueEdit );
+
+    connect( m_data->valueEdit, SIGNAL(editingFinished()), SLOT(textChanged()) );
+
+    layout->setStretchFactor( m_data->valueEdit, 10 );
 
     for ( int i = 0; i < ButtonCnt; i++ )
     {
-        QwtArrowButton *btn =
+        QwtArrowButton* btn =
             new QwtArrowButton( i + 1, Qt::UpArrow, this );
         btn->setFocusPolicy( Qt::NoFocus );
-        btn->installEventFilter( this );
         layout->addWidget( btn );
 
@@ -109,5 +109,5 @@
         connect( btn, SIGNAL(clicked()), SLOT(btnClicked()) );
 
-        d_data->buttonUp[i] = btn;
+        m_data->buttonUp[i] = btn;
     }
 
@@ -120,5 +120,5 @@
         QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );
 
-    setFocusProxy( d_data->valueEdit );
+    setFocusProxy( m_data->valueEdit );
     setFocusPolicy( Qt::StrongFocus );
 }
@@ -127,26 +127,26 @@
 QwtCounter::~QwtCounter()
 {
-    delete d_data;
-}
-
-/*!
-  Set the counter to be in valid/invalid state
-
-  When the counter is set to invalid, no numbers are displayed and
-  the buttons are disabled.
-
-  \param on If true the counter will be set as valid
-
-  \sa setValue(), isValid()
-*/
+    delete m_data;
+}
+
+/*!
+   Set the counter to be in valid/invalid state
+
+   When the counter is set to invalid, no numbers are displayed and
+   the buttons are disabled.
+
+   \param on If true the counter will be set as valid
+
+   \sa setValue(), isValid()
+ */
 void QwtCounter::setValid( bool on )
 {
-    if ( on != d_data->isValid )
-    {
-        d_data->isValid = on;
+    if ( on != m_data->isValid )
+    {
+        m_data->isValid = on;
 
         updateButtons();
 
-        if ( d_data->isValid )
+        if ( m_data->isValid )
         {
             showNumber( value() );
@@ -155,60 +155,60 @@
         else
         {
-            d_data->valueEdit->setText( QString() );
-        }
-    }
-}
-
-/*!
-  \return True, if the value is valid
-  \sa setValid(), setValue()
+            m_data->valueEdit->setText( QString() );
+        }
+    }
+}
+
+/*!
+   \return True, if the value is valid
+   \sa setValid(), setValue()
  */
 bool QwtCounter::isValid() const
 {
-    return d_data->isValid;
-}
-
-/*!
-  \brief Allow/disallow the user to manually edit the value
-
-  \param on True disable editing
-  \sa isReadOnly()
-*/
+    return m_data->isValid;
+}
+
+/*!
+   \brief Allow/disallow the user to manually edit the value
+
+   \param on True disable editing
+   \sa isReadOnly()
+ */
 void QwtCounter::setReadOnly( bool on )
 {
-    d_data->valueEdit->setReadOnly( on );
+    m_data->valueEdit->setReadOnly( on );
 }
 
 /*!
    \return True, when the line line edit is read only. (default is no)
-  \sa setReadOnly()
+   \sa setReadOnly()
  */
 bool QwtCounter::isReadOnly() const
 {
-    return d_data->valueEdit->isReadOnly();
-}
-
-/*!
-  \brief Set a new value without adjusting to the step raster
-
-  The state of the counter is set to be valid.
-
-  \param value New value
-
-  \sa isValid(), value(), valueChanged()
-  \warning The value is clipped when it lies outside the range.
-*/
+    return m_data->valueEdit->isReadOnly();
+}
+
+/*!
+   \brief Set a new value without adjusting to the step raster
+
+   The state of the counter is set to be valid.
+
+   \param value New value
+
+   \sa isValid(), value(), valueChanged()
+   \warning The value is clipped when it lies outside the range.
+ */
 
 void QwtCounter::setValue( double value )
 {
-    const double vmin = qMin( d_data->minimum, d_data->maximum );
-    const double vmax = qMax( d_data->minimum, d_data->maximum );
+    const double vmin = qwtMinF( m_data->minimum, m_data->maximum );
+    const double vmax = qwtMaxF( m_data->minimum, m_data->maximum );
 
     value = qBound( vmin, value, vmax );
 
-    if ( !d_data->isValid || value != d_data->value )
-    {
-        d_data->isValid = true;
-        d_data->value = value;
+    if ( !m_data->isValid || value != m_data->value )
+    {
+        m_data->isValid = true;
+        m_data->value = value;
 
         showNumber( value );
@@ -220,42 +220,42 @@
 
 /*!
-  \return Current value of the counter
-  \sa setValue(), valueChanged()
+   \return Current value of the counter
+   \sa setValue(), valueChanged()
  */
 double QwtCounter::value() const
 {
-    return d_data->value;
-}
-
-/*!
-  \brief Set the minimum and maximum values
-
-  The maximum is adjusted if necessary to ensure that the range remains valid.
-  The value might be modified to be inside of the range.
-
-  \param min Minimum value
-  \param max Maximum value
-
-  \sa minimum(), maximum()
+    return m_data->value;
+}
+
+/*!
+   \brief Set the minimum and maximum values
+
+   The maximum is adjusted if necessary to ensure that the range remains valid.
+   The value might be modified to be inside of the range.
+
+   \param min Minimum value
+   \param max Maximum value
+
+   \sa minimum(), maximum()
  */
 void QwtCounter::setRange( double min, double max )
 {
-    max = qMax( min, max );
-
-    if ( d_data->maximum == max && d_data->minimum == min )
+    max = qwtMaxF( min, max );
+
+    if ( m_data->maximum == max && m_data->minimum == min )
         return;
 
-    d_data->minimum = min;
-    d_data->maximum = max;
+    m_data->minimum = min;
+    m_data->maximum = max;
 
     setSingleStep( singleStep() );
 
-    const double value = qBound( min, d_data->value, max );
-
-    if ( value != d_data->value )
-    {
-        d_data->value = value;
-
-        if ( d_data->isValid )
+    const double value = qBound( min, m_data->value, max );
+
+    if ( value != m_data->value )
+    {
+        m_data->value = value;
+
+        if ( m_data->isValid )
         {
             showNumber( value );
@@ -268,11 +268,11 @@
 
 /*!
-  Set the minimum value of the range
-
-  \param value Minimum value
-  \sa setRange(), setMaximum(), minimum()
-
-  \note The maximum is adjusted if necessary to ensure that the range remains valid.
-*/
+   Set the minimum value of the range
+
+   \param value Minimum value
+   \sa setRange(), setMaximum(), minimum()
+
+   \note The maximum is adjusted if necessary to ensure that the range remains valid.
+ */
 void QwtCounter::setMinimum( double value )
 {
@@ -281,18 +281,18 @@
 
 /*!
-  \return The minimum of the range
-  \sa setRange(), setMinimum(), maximum()
-*/
+   \return The minimum of the range
+   \sa setRange(), setMinimum(), maximum()
+ */
 double QwtCounter::minimum() const
 {
-    return d_data->minimum;
-}
-
-/*!
-  Set the maximum value of the range
-
-  \param value Maximum value
-  \sa setRange(), setMinimum(), maximum()
-*/
+    return m_data->minimum;
+}
+
+/*!
+   Set the maximum value of the range
+
+   \param value Maximum value
+   \sa setRange(), setMinimum(), maximum()
+ */
 void QwtCounter::setMaximum( double value )
 {
@@ -301,63 +301,63 @@
 
 /*!
-  \return The maximum of the range
-  \sa setRange(), setMaximum(), minimum()
-*/
+   \return The maximum of the range
+   \sa setRange(), setMaximum(), minimum()
+ */
 double QwtCounter::maximum() const
 {
-    return d_data->maximum;
-}
-
-/*!
-  \brief Set the step size of the counter
-
-  A value <= 0.0 disables stepping
-
-  \param stepSize Single step size
-  \sa singleStep()
-*/
+    return m_data->maximum;
+}
+
+/*!
+   \brief Set the step size of the counter
+
+   A value <= 0.0 disables stepping
+
+   \param stepSize Single step size
+   \sa singleStep()
+ */
 void QwtCounter::setSingleStep( double stepSize )
 {
-    d_data->singleStep = qMax( stepSize, 0.0 );
-}
-
-/*!
-  \return Single step size
-  \sa setSingleStep()
+    m_data->singleStep = qwtMaxF( stepSize, 0.0 );
+}
+
+/*!
+   \return Single step size
+   \sa setSingleStep()
  */
 double QwtCounter::singleStep() const
 {
-    return d_data->singleStep;
-}
-
-/*!
-  \brief En/Disable wrapping
-
-  If wrapping is true stepping up from maximum() value will take
-  you to the minimum() value and vice versa.
-
-  \param on En/Disable wrapping
-  \sa wrapping()
+    return m_data->singleStep;
+}
+
+/*!
+   \brief En/Disable wrapping
+
+   If wrapping is true stepping up from maximum() value will take
+   you to the minimum() value and vice versa.
+
+   \param on En/Disable wrapping
+   \sa wrapping()
  */
 void QwtCounter::setWrapping( bool on )
 {
-    d_data->wrapping = on;
-}
-
-/*!
-  \return True, when wrapping is set
-  \sa setWrapping()
+    m_data->wrapping = on;
+}
+
+/*!
+   \return True, when wrapping is set
+   \sa setWrapping()
  */
 bool QwtCounter::wrapping() const
 {
-    return d_data->wrapping;
-}
-
-/*!
-  Specify the number of buttons on each side of the label
-
-  \param numButtons Number of buttons
-  \sa numButtons()
-*/
+    return m_data->wrapping;
+}
+
+/*!
+   Specify the number of buttons on each side of the label
+
+   \param numButtons Number of buttons
+   \sa numButtons()
+ */
 void QwtCounter::setNumButtons( int numButtons )
 {
@@ -369,53 +369,53 @@
         if ( i < numButtons )
         {
-            d_data->buttonDown[i]->show();
-            d_data->buttonUp[i]->show();
+            m_data->buttonDown[i]->show();
+            m_data->buttonUp[i]->show();
         }
         else
         {
-            d_data->buttonDown[i]->hide();
-            d_data->buttonUp[i]->hide();
-        }
-    }
-
-    d_data->numButtons = numButtons;
-}
-
-/*!
-  \return The number of buttons on each side of the widget.
-  \sa setNumButtons()
-*/
+            m_data->buttonDown[i]->hide();
+            m_data->buttonUp[i]->hide();
+        }
+    }
+
+    m_data->numButtons = numButtons;
+}
+
+/*!
+   \return The number of buttons on each side of the widget.
+   \sa setNumButtons()
+ */
 int QwtCounter::numButtons() const
 {
-    return d_data->numButtons;
-}
-
-/*!
-  Specify the number of steps by which the value
-  is incremented or decremented when a specified button
-  is pushed.
-
-  \param button Button index
-  \param numSteps Number of steps
-
-  \sa incSteps()
-*/
+    return m_data->numButtons;
+}
+
+/*!
+   Specify the number of steps by which the value
+   is incremented or decremented when a specified button
+   is pushed.
+
+   \param button Button index
+   \param numSteps Number of steps
+
+   \sa incSteps()
+ */
 void QwtCounter::setIncSteps( QwtCounter::Button button, int numSteps )
 {
     if ( button >= 0 && button < QwtCounter::ButtonCnt )
-        d_data->increment[ button ] = numSteps;
-}
-
-/*!
-  \return The number of steps by which a specified button increments the value
+        m_data->increment[ button ] = numSteps;
+}
+
+/*!
+   \return The number of steps by which a specified button increments the value
           or 0 if the button is invalid.
-  \param button Button index
-
-  \sa setIncSteps()
-*/
+   \param button Button index
+
+   \sa setIncSteps()
+ */
 int QwtCounter::incSteps( QwtCounter::Button button ) const
 {
     if ( button >= 0 && button < QwtCounter::ButtonCnt )
-        return d_data->increment[ button ];
+        return m_data->increment[ button ];
 
     return 0;
@@ -424,7 +424,7 @@
 
 /*!
-  Set the number of increment steps for button 1
-  \param nSteps Number of steps
-*/
+   Set the number of increment steps for button 1
+   \param nSteps Number of steps
+ */
 void QwtCounter::setStepButton1( int nSteps )
 {
@@ -439,7 +439,7 @@
 
 /*!
-  Set the number of increment steps for button 2
-  \param nSteps Number of steps
-*/
+   Set the number of increment steps for button 2
+   \param nSteps Number of steps
+ */
 void QwtCounter::setStepButton2( int nSteps )
 {
@@ -454,7 +454,7 @@
 
 /*!
-  Set the number of increment steps for button 3
-  \param nSteps Number of steps
-*/
+   Set the number of increment steps for button 3
+   \param nSteps Number of steps
+ */
 void QwtCounter::setStepButton3( int nSteps )
 {
@@ -473,5 +473,5 @@
     bool converted = false;
 
-    const double value = d_data->valueEdit->text().toDouble( &converted );
+    const double value = m_data->valueEdit->text().toDouble( &converted );
     if ( converted )
         setValue( value );
@@ -482,14 +482,16 @@
    \param event Event
    \return see QWidget::event()
-*/
-bool QwtCounter::event( QEvent *event )
+ */
+bool QwtCounter::event( QEvent* event )
 {
     if ( event->type() == QEvent::PolishRequest )
     {
-        const int w = d_data->valueEdit->fontMetrics().width( "W" ) + 8;
+        const QFontMetrics fm = m_data->valueEdit->fontMetrics();
+
+        const int w = QwtPainter::horizontalAdvance( fm, "W" ) + 8;
         for ( int i = 0; i < ButtonCnt; i++ )
         {
-            d_data->buttonDown[i]->setMinimumWidth( w );
-            d_data->buttonUp[i]->setMinimumWidth( w );
+            m_data->buttonDown[i]->setMinimumWidth( w );
+            m_data->buttonUp[i]->setMinimumWidth( w );
         }
     }
@@ -499,26 +501,26 @@
 
 /*!
-  Handle key events
-
-  - Ctrl + Qt::Key_Home\n
+   Handle key events
+
+   - Ctrl + Qt::Key_Home\n
     Step to minimum()
-  - Ctrl + Qt::Key_End\n
+   - Ctrl + Qt::Key_End\n
     Step to maximum()
-  - Qt::Key_Up\n
+   - Qt::Key_Up\n
     Increment by incSteps(QwtCounter::Button1)
-  - Qt::Key_Down\n
+   - Qt::Key_Down\n
     Decrement by incSteps(QwtCounter::Button1)
-  - Qt::Key_PageUp\n
+   - Qt::Key_PageUp\n
     Increment by incSteps(QwtCounter::Button2)
-  - Qt::Key_PageDown\n
+   - Qt::Key_PageDown\n
     Decrement by incSteps(QwtCounter::Button2)
-  - Shift + Qt::Key_PageUp\n
+   - Shift + Qt::Key_PageUp\n
     Increment by incSteps(QwtCounter::Button3)
-  - Shift + Qt::Key_PageDown\n
+   - Shift + Qt::Key_PageDown\n
     Decrement by incSteps(QwtCounter::Button3)
 
-  \param event Key event
-*/
-void QwtCounter::keyPressEvent ( QKeyEvent *event )
+   \param event Key event
+ */
+void QwtCounter::keyPressEvent ( QKeyEvent* event )
 {
     bool accepted = true;
@@ -544,10 +546,10 @@
         case Qt::Key_Up:
         {
-            incrementValue( d_data->increment[0] );
+            incrementValue( m_data->increment[0] );
             break;
         }
         case Qt::Key_Down:
         {
-            incrementValue( -d_data->increment[0] );
+            incrementValue( -m_data->increment[0] );
             break;
         }
@@ -555,11 +557,11 @@
         case Qt::Key_PageDown:
         {
-            int increment = d_data->increment[0];
-            if ( d_data->numButtons >= 2 )
-                increment = d_data->increment[1];
-            if ( d_data->numButtons >= 3 )
+            int increment = m_data->increment[0];
+            if ( m_data->numButtons >= 2 )
+                increment = m_data->increment[1];
+            if ( m_data->numButtons >= 3 )
             {
                 if ( event->modifiers() & Qt::ShiftModifier )
-                    increment = d_data->increment[2];
+                    increment = m_data->increment[2];
             }
             if ( event->key() == Qt::Key_PageDown )
@@ -584,63 +586,66 @@
 
 /*!
-  Handle wheel events
-  \param event Wheel event
-*/
-void QwtCounter::wheelEvent( QWheelEvent *event )
+   Handle wheel events
+   \param event Wheel event
+ */
+void QwtCounter::wheelEvent( QWheelEvent* event )
 {
     event->accept();
 
-    if ( d_data->numButtons <= 0 )
+    if ( m_data->numButtons <= 0 )
         return;
 
-    int increment = d_data->increment[0];
-    if ( d_data->numButtons >= 2 )
+    int increment = m_data->increment[0];
+    if ( m_data->numButtons >= 2 )
     {
         if ( event->modifiers() & Qt::ControlModifier )
-            increment = d_data->increment[1];
-    }
-    if ( d_data->numButtons >= 3 )
+            increment = m_data->increment[1];
+    }
+    if ( m_data->numButtons >= 3 )
     {
         if ( event->modifiers() & Qt::ShiftModifier )
-            increment = d_data->increment[2];
-    }
-
-    for ( int i = 0; i < d_data->numButtons; i++ )
-    {
-        if ( d_data->buttonDown[i]->geometry().contains( event->pos() ) ||
-            d_data->buttonUp[i]->geometry().contains( event->pos() ) )
-        {
-            increment = d_data->increment[i];
-        }
-    }
-
-    const int wheel_delta = 120;
+            increment = m_data->increment[2];
+    }
+
+#if QT_VERSION < 0x050e00
+    const QPoint wheelPos = event->pos();
+    const int wheelDelta = event->delta();
+#else
+    const QPoint wheelPos = event->position().toPoint();
+
+    const QPoint delta = event->angleDelta();
+    const int wheelDelta = ( qAbs( delta.x() ) > qAbs( delta.y() ) )
+        ? delta.x() : delta.y();
+#endif
+
+    for ( int i = 0; i < m_data->numButtons; i++ )
+    {
+        if ( m_data->buttonDown[i]->geometry().contains( wheelPos ) ||
+            m_data->buttonUp[i]->geometry().contains( wheelPos ) )
+        {
+            increment = m_data->increment[i];
+        }
+    }
+
+    incrementValue( wheelDelta / 120 * increment );
+}
+
+void QwtCounter::incrementValue( int numSteps )
+{
+    const double min = m_data->minimum;
+    const double max = m_data->maximum;
+    double stepSize = m_data->singleStep;
+
+    if ( !m_data->isValid || min >= max || stepSize <= 0.0 )
+        return;
+
 
 #if 1
-    int delta = event->delta();
-    if ( delta >= 2 * wheel_delta )
-        delta /= 2; // Never saw an abs(delta) < 240
+    stepSize = qwtMaxF( stepSize, 1.0e-10 * ( max - min ) );
 #endif
 
-    incrementValue( delta / wheel_delta * increment );
-}
-
-void QwtCounter::incrementValue( int numSteps )
-{
-    const double min = d_data->minimum;
-    const double max = d_data->maximum;
-    double stepSize = d_data->singleStep;
-
-    if ( !d_data->isValid || min >= max || stepSize <= 0.0 )
-        return;
-
-
-#if 1
-    stepSize = qMax( stepSize, 1.0e-10 * ( max - min ) );
-#endif
-
-    double value = d_data->value + numSteps * stepSize;
-
-    if ( d_data->wrapping )
+    double value = m_data->value + numSteps * stepSize;
+
+    if ( m_data->wrapping )
     {
         const double range = max - min;
@@ -648,9 +653,9 @@
         if ( value < min )
         {
-            value += ::ceil( ( min - value ) / range ) * range;
+            value += std::ceil( ( min - value ) / range ) * range;
         }
         else if ( value > max )
         {
-            value -= ::ceil( ( value - max ) / range ) * range;
+            value -= std::ceil( ( value - max ) / range ) * range;
         }
     }
@@ -676,26 +681,26 @@
     }
 
-    if ( value != d_data->value )
-    {
-        d_data->value = value;
-        showNumber( d_data->value );
+    if ( value != m_data->value )
+    {
+        m_data->value = value;
+        showNumber( m_data->value );
         updateButtons();
 
-        Q_EMIT valueChanged( d_data->value );
-    }
-}
-
-
-/*!
-  \brief Update buttons according to the current value
-
-  When the QwtCounter under- or over-flows, the focus is set to the smallest
-  up- or down-button and counting is disabled.
-
-  Counting is re-enabled on a button release event (mouse or space bar).
-*/
+        Q_EMIT valueChanged( m_data->value );
+    }
+}
+
+
+/*!
+   \brief Update buttons according to the current value
+
+   When the QwtCounter under- or over-flows, the focus is set to the smallest
+   up- or down-button and counting is disabled.
+
+   Counting is re-enabled on a button release event (mouse or space bar).
+ */
 void QwtCounter::updateButtons()
 {
-    if ( d_data->isValid )
+    if ( m_data->isValid )
     {
         // 1. save enabled state of the smallest down- and up-button
@@ -704,6 +709,6 @@
         for ( int i = 0; i < QwtCounter::ButtonCnt; i++ )
         {
-            d_data->buttonDown[i]->setEnabled( value() > minimum() );
-            d_data->buttonUp[i]->setEnabled( value() < maximum() );
+            m_data->buttonDown[i]->setEnabled( value() > minimum() );
+            m_data->buttonUp[i]->setEnabled( value() < maximum() );
         }
     }
@@ -712,14 +717,14 @@
         for ( int i = 0; i < QwtCounter::ButtonCnt; i++ )
         {
-            d_data->buttonDown[i]->setEnabled( false );
-            d_data->buttonUp[i]->setEnabled( false );
-        }
-    }
-}
-/*!
-  Display number string
-
-  \param number Number
-*/
+            m_data->buttonDown[i]->setEnabled( false );
+            m_data->buttonUp[i]->setEnabled( false );
+        }
+    }
+}
+/*!
+   Display number string
+
+   \param number Number
+ */
 void QwtCounter::showNumber( double number )
 {
@@ -727,7 +732,7 @@
     text.setNum( number );
 
-    const int cursorPos = d_data->valueEdit->cursorPosition();
-    d_data->valueEdit->setText( text );
-    d_data->valueEdit->setCursorPosition( cursorPos );
+    const int cursorPos = m_data->valueEdit->cursorPosition();
+    m_data->valueEdit->setText( text );
+    m_data->valueEdit->setCursorPosition( cursorPos );
 }
 
@@ -737,9 +742,9 @@
     for ( int i = 0; i < ButtonCnt; i++ )
     {
-        if ( d_data->buttonUp[i] == sender() )
-            incrementValue( d_data->increment[i] );
-
-        if ( d_data->buttonDown[i] == sender() )
-            incrementValue( -d_data->increment[i] );
+        if ( m_data->buttonUp[i] == sender() )
+            incrementValue( m_data->increment[i] );
+
+        if ( m_data->buttonDown[i] == sender() )
+            incrementValue( -m_data->increment[i] );
     }
 }
@@ -769,16 +774,19 @@
     tmp.fill( '9', w );
 
-    QFontMetrics fm( d_data->valueEdit->font() );
-    w = fm.width( tmp ) + 2;
-    if ( d_data->valueEdit->hasFrame() )
+    w = QwtPainter::horizontalAdvance( m_data->valueEdit->fontMetrics(), tmp ) + 2;
+
+    if ( m_data->valueEdit->hasFrame() )
         w += 2 * style()->pixelMetric( QStyle::PM_DefaultFrameWidth );
 
-    // Now we replace default sizeHint contribution of d_data->valueEdit by
+    // Now we replace default sizeHint contribution of m_data->valueEdit by
     // what we really need.
 
-    w += QWidget::sizeHint().width() - d_data->valueEdit->sizeHint().width();
+    w += QWidget::sizeHint().width() - m_data->valueEdit->sizeHint().width();
 
     const int h = qMin( QWidget::sizeHint().height(),
-        d_data->valueEdit->minimumSizeHint().height() );
+        m_data->valueEdit->minimumSizeHint().height() );
+
     return QSize( w, h );
 }
+
+#include "moc_qwt_counter.cpp"
Index: /trunk/BNC/qwt/qwt_counter.h
===================================================================
--- /trunk/BNC/qwt/qwt_counter.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_counter.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -15,33 +15,33 @@
 
 /*!
-  \brief The Counter Widget
+   \brief The Counter Widget
 
-  A Counter consists of a label displaying a number and
-  one ore more (up to three) push buttons on each side
-  of the label which can be used to increment or decrement
-  the counter's value.
+   A Counter consists of a label displaying a number and
+   one ore more (up to three) push buttons on each side
+   of the label which can be used to increment or decrement
+   the counter's value.
 
-  A counter has a range from a minimum value to a maximum value
-  and a step size. When the wrapping property is set
-  the counter is circular.
+   A counter has a range from a minimum value to a maximum value
+   and a step size. When the wrapping property is set
+   the counter is circular.
 
-  The number of steps by which a button increments or decrements the value
-  can be specified using setIncSteps(). The number of buttons can be
-  changed with setNumButtons().
+   The number of steps by which a button increments or decrements the value
+   can be specified using setIncSteps(). The number of buttons can be
+   changed with setNumButtons().
 
-  Example:
-\code
-#include <qwt_counter.h>
+   Example:
+   \code
+ #include <qwt_counter.h>
 
-QwtCounter *counter = new QwtCounter(parent);
+   QwtCounter *counter = new QwtCounter(parent);
 
-counter->setRange(0.0, 100.0);                  // From 0.0 to 100
-counter->setSingleStep( 1.0 );                  // Step size 1.0
-counter->setNumButtons(2);                      // Two buttons each side
-counter->setIncSteps(QwtCounter::Button1, 1);   // Button 1 increments 1 step
-counter->setIncSteps(QwtCounter::Button2, 20);  // Button 2 increments 20 steps
+   counter->setRange(0.0, 100.0);                  // From 0.0 to 100
+   counter->setSingleStep( 1.0 );                  // Step size 1.0
+   counter->setNumButtons(2);                      // Two buttons each side
+   counter->setIncSteps(QwtCounter::Button1, 1);   // Button 1 increments 1 step
+   counter->setIncSteps(QwtCounter::Button2, 20);  // Button 2 increments 20 steps
 
-connect(counter, SIGNAL(valueChanged(double)), myClass, SLOT(newValue(double)));
-\endcode
+   connect(counter, SIGNAL(valueChanged(double)), myClass, SLOT(newValue(double)));
+   \endcode
  */
 
@@ -50,5 +50,5 @@
     Q_OBJECT
 
-    Q_PROPERTY( double value READ value WRITE setValue )
+    Q_PROPERTY( double value READ value WRITE setValue NOTIFY valueChanged USER true )
     Q_PROPERTY( double minimum READ minimum WRITE setMinimum )
     Q_PROPERTY( double maximum READ maximum WRITE setMaximum )
@@ -63,5 +63,5 @@
     Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
 
-public:
+  public:
     //! Button index
     enum Button
@@ -80,5 +80,5 @@
     };
 
-    explicit QwtCounter( QWidget *parent = NULL );
+    explicit QwtCounter( QWidget* parent = NULL );
     virtual ~QwtCounter();
 
@@ -98,5 +98,5 @@
     int incSteps( QwtCounter::Button ) const;
 
-    virtual QSize sizeHint() const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
 
     double singleStep() const;
@@ -122,13 +122,13 @@
     double value() const;
 
-public Q_SLOTS:
+  public Q_SLOTS:
     void setValue( double );
 
 
-Q_SIGNALS:
+  Q_SIGNALS:
     /*!
         This signal is emitted when a button has been released
         \param value The new value
-    */
+     */
     void buttonReleased ( double value );
 
@@ -136,18 +136,18 @@
         This signal is emitted when the counter's value has changed
         \param value The new value
-    */
+     */
     void valueChanged ( double value );
 
-protected:
-    virtual bool event( QEvent * );
-    virtual void wheelEvent( QWheelEvent * );
-    virtual void keyPressEvent( QKeyEvent * );
+  protected:
+    virtual bool event( QEvent* ) QWT_OVERRIDE;
+    virtual void wheelEvent( QWheelEvent* ) QWT_OVERRIDE;
+    virtual void keyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
 
-private Q_SLOTS:
+  private Q_SLOTS:
     void btnReleased();
     void btnClicked();
     void textChanged();
 
-private:
+  private:
     void incrementValue( int numSteps );
     void initCounter();
@@ -156,5 +156,5 @@
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_curve_fitter.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_curve_fitter.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_curve_fitter.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,15 +9,11 @@
 
 #include "qwt_curve_fitter.h"
-#include "qwt_math.h"
-#include "qwt_spline.h"
-#include <qstack.h>
-#include <qvector.h>
 
-#if QT_VERSION < 0x040601
-#define qFabs(x) ::fabs(x)
-#endif
-
-//! Constructor
-QwtCurveFitter::QwtCurveFitter()
+/*!
+   Constructor
+   \param mode Preferred fitting mode
+ */
+QwtCurveFitter::QwtCurveFitter( Mode mode )
+    : m_mode( mode )
 {
 }
@@ -28,427 +24,7 @@
 }
 
-class QwtSplineCurveFitter::PrivateData
+//! \return Preferred fitting mode
+QwtCurveFitter::Mode QwtCurveFitter::mode() const
 {
-public:
-    PrivateData():
-        fitMode( QwtSplineCurveFitter::Auto ),
-        splineSize( 250 )
-    {
-    }
-
-    QwtSpline spline;
-    QwtSplineCurveFitter::FitMode fitMode;
-    int splineSize;
-};
-
-//! Constructor
-QwtSplineCurveFitter::QwtSplineCurveFitter()
-{
-    d_data = new PrivateData;
+    return m_mode;
 }
-
-//! Destructor
-QwtSplineCurveFitter::~QwtSplineCurveFitter()
-{
-    delete d_data;
-}
-
-/*!
-  Select the algorithm used for building the spline
-
-  \param mode Mode representing a spline algorithm
-  \sa fitMode()
-*/
-void QwtSplineCurveFitter::setFitMode( FitMode mode )
-{
-    d_data->fitMode = mode;
-}
-
-/*!
-  \return Mode representing a spline algorithm
-  \sa setFitMode()
-*/
-QwtSplineCurveFitter::FitMode QwtSplineCurveFitter::fitMode() const
-{
-    return d_data->fitMode;
-}
-
-/*!
-  Assign a spline
-
-  \param spline Spline
-  \sa spline()
-*/
-void QwtSplineCurveFitter::setSpline( const QwtSpline &spline )
-{
-    d_data->spline = spline;
-    d_data->spline.reset();
-}
-
-/*!
-  \return Spline
-  \sa setSpline()
-*/
-const QwtSpline &QwtSplineCurveFitter::spline() const
-{
-    return d_data->spline;
-}
-
-/*!
-  \return Spline
-  \sa setSpline()
-*/
-QwtSpline &QwtSplineCurveFitter::spline()
-{
-    return d_data->spline;
-}
-
-/*!
-   Assign a spline size ( has to be at least 10 points )
-
-   \param splineSize Spline size
-   \sa splineSize()
-*/
-void QwtSplineCurveFitter::setSplineSize( int splineSize )
-{
-    d_data->splineSize = qMax( splineSize, 10 );
-}
-
-/*!
-  \return Spline size
-  \sa setSplineSize()
-*/
-int QwtSplineCurveFitter::splineSize() const
-{
-    return d_data->splineSize;
-}
-
-/*!
-  Find a curve which has the best fit to a series of data points
-
-  \param points Series of data points
-  \return Curve points
-*/
-QPolygonF QwtSplineCurveFitter::fitCurve( const QPolygonF &points ) const
-{
-    const int size = points.size();
-    if ( size <= 2 )
-        return points;
-
-    FitMode fitMode = d_data->fitMode;
-    if ( fitMode == Auto )
-    {
-        fitMode = Spline;
-
-        const QPointF *p = points.data();
-        for ( int i = 1; i < size; i++ )
-        {
-            if ( p[i].x() <= p[i-1].x() )
-            {
-                fitMode = ParametricSpline;
-                break;
-            }
-        };
-    }
-
-    if ( fitMode == ParametricSpline )
-        return fitParametric( points );
-    else
-        return fitSpline( points );
-}
-
-QPolygonF QwtSplineCurveFitter::fitSpline( const QPolygonF &points ) const
-{
-    d_data->spline.setPoints( points );
-    if ( !d_data->spline.isValid() )
-        return points;
-
-    QPolygonF fittedPoints( d_data->splineSize );
-
-    const double x1 = points[0].x();
-    const double x2 = points[int( points.size() - 1 )].x();
-    const double dx = x2 - x1;
-    const double delta = dx / ( d_data->splineSize - 1 );
-
-    for ( int i = 0; i < d_data->splineSize; i++ )
-    {
-        QPointF &p = fittedPoints[i];
-
-        const double v = x1 + i * delta;
-        const double sv = d_data->spline.value( v );
-
-        p.setX( v );
-        p.setY( sv );
-    }
-    d_data->spline.reset();
-
-    return fittedPoints;
-}
-
-QPolygonF QwtSplineCurveFitter::fitParametric( const QPolygonF &points ) const
-{
-    int i;
-    const int size = points.size();
-
-    QPolygonF fittedPoints( d_data->splineSize );
-    QPolygonF splinePointsX( size );
-    QPolygonF splinePointsY( size );
-
-    const QPointF *p = points.data();
-    QPointF *spX = splinePointsX.data();
-    QPointF *spY = splinePointsY.data();
-
-    double param = 0.0;
-    for ( i = 0; i < size; i++ )
-    {
-        const double x = p[i].x();
-        const double y = p[i].y();
-        if ( i > 0 )
-        {
-            const double delta = qSqrt( qwtSqr( x - spX[i-1].y() )
-                      + qwtSqr( y - spY[i-1].y() ) );
-            param += qMax( delta, 1.0 );
-        }
-        spX[i].setX( param );
-        spX[i].setY( x );
-        spY[i].setX( param );
-        spY[i].setY( y );
-    }
-
-    d_data->spline.setPoints( splinePointsX );
-    if ( !d_data->spline.isValid() )
-        return points;
-
-    const double deltaX =
-        splinePointsX[size - 1].x() / ( d_data->splineSize - 1 );
-    for ( i = 0; i < d_data->splineSize; i++ )
-    {
-        const double dtmp = i * deltaX;
-        fittedPoints[i].setX( d_data->spline.value( dtmp ) );
-    }
-
-    d_data->spline.setPoints( splinePointsY );
-    if ( !d_data->spline.isValid() )
-        return points;
-
-    const double deltaY =
-        splinePointsY[size - 1].x() / ( d_data->splineSize - 1 );
-    for ( i = 0; i < d_data->splineSize; i++ )
-    {
-        const double dtmp = i * deltaY;
-        fittedPoints[i].setY( d_data->spline.value( dtmp ) );
-    }
-
-    return fittedPoints;
-}
-
-class QwtWeedingCurveFitter::PrivateData
-{
-public:
-    PrivateData():
-        tolerance( 1.0 ),
-        chunkSize( 0 )
-    {
-    }
-
-    double tolerance;
-    uint chunkSize;
-};
-
-class QwtWeedingCurveFitter::Line
-{
-public:
-    Line( int i1 = 0, int i2 = 0 ):
-        from( i1 ),
-        to( i2 )
-    {
-    }
-
-    int from;
-    int to;
-};
-
-/*!
-   Constructor
-
-   \param tolerance Tolerance
-   \sa setTolerance(), tolerance()
-*/
-QwtWeedingCurveFitter::QwtWeedingCurveFitter( double tolerance )
-{
-    d_data = new PrivateData;
-    setTolerance( tolerance );
-}
-
-//! Destructor
-QwtWeedingCurveFitter::~QwtWeedingCurveFitter()
-{
-    delete d_data;
-}
-
-/*!
- Assign the tolerance
-
- The tolerance is the maximum distance, that is acceptable
- between the original curve and the smoothed curve.
-
- Increasing the tolerance will reduce the number of the
- resulting points.
-
- \param tolerance Tolerance
-
- \sa tolerance()
-*/
-void QwtWeedingCurveFitter::setTolerance( double tolerance )
-{
-    d_data->tolerance = qMax( tolerance, 0.0 );
-}
-
-/*!
-  \return Tolerance
-  \sa setTolerance()
-*/
-double QwtWeedingCurveFitter::tolerance() const
-{
-    return d_data->tolerance;
-}
-
-/*!
- Limit the number of points passed to a run of the algorithm
-
- The runtime of the Douglas Peucker algorithm increases non linear
- with the number of points. For a chunk size > 0 the polygon
- is split into pieces passed to the algorithm one by one.
-
- \param numPoints Maximum for the number of points passed to the algorithm
-
- \sa chunkSize()
-*/
-void QwtWeedingCurveFitter::setChunkSize( uint numPoints )
-{
-    if ( numPoints > 0 )
-        numPoints = qMax( numPoints, 3U );
-
-    d_data->chunkSize = numPoints;
-}
-
-/*!
-  \return Maximum for the number of points passed to a run
-          of the algorithm - or 0, when unlimited
-  \sa setChunkSize()
-*/
-uint QwtWeedingCurveFitter::chunkSize() const
-{
-    return d_data->chunkSize;
-}
-
-/*!
-  \param points Series of data points
-  \return Curve points
-*/
-QPolygonF QwtWeedingCurveFitter::fitCurve( const QPolygonF &points ) const
-{
-    if ( points.isEmpty() )
-        return points;
-
-    QPolygonF fittedPoints;
-    if ( d_data->chunkSize == 0 )
-    {
-        fittedPoints = simplify( points );
-    }
-    else
-    {
-        for ( int i = 0; i < points.size(); i += d_data->chunkSize )
-        {
-            const QPolygonF p = points.mid( i, d_data->chunkSize );
-            fittedPoints += simplify( p );
-        }
-    }
-
-    return fittedPoints;
-}
-
-QPolygonF QwtWeedingCurveFitter::simplify( const QPolygonF &points ) const
-{
-    const double toleranceSqr = d_data->tolerance * d_data->tolerance;
-
-    QStack<Line> stack;
-    stack.reserve( 500 );
-
-    const QPointF *p = points.data();
-    const int nPoints = points.size();
-
-    QVector<bool> usePoint( nPoints, false );
-
-    stack.push( Line( 0, nPoints - 1 ) );
-
-    while ( !stack.isEmpty() )
-    {
-        const Line r = stack.pop();
-
-        // initialize line segment
-        const double vecX = p[r.to].x() - p[r.from].x();
-        const double vecY = p[r.to].y() - p[r.from].y();
-
-        const double vecLength = qSqrt( vecX * vecX + vecY * vecY );
-
-        const double unitVecX = ( vecLength != 0.0 ) ? vecX / vecLength : 0.0;
-        const double unitVecY = ( vecLength != 0.0 ) ? vecY / vecLength : 0.0;
-
-        double maxDistSqr = 0.0;
-        int nVertexIndexMaxDistance = r.from + 1;
-        for ( int i = r.from + 1; i < r.to; i++ )
-        {
-            //compare to anchor
-            const double fromVecX = p[i].x() - p[r.from].x();
-            const double fromVecY = p[i].y() - p[r.from].y();
-
-            double distToSegmentSqr;
-            if ( fromVecX * unitVecX + fromVecY * unitVecY < 0.0 )
-            {
-                distToSegmentSqr = fromVecX * fromVecX + fromVecY * fromVecY;
-            }
-            else
-            {
-                const double toVecX = p[i].x() - p[r.to].x();
-                const double toVecY = p[i].y() - p[r.to].y();
-                const double toVecLength = toVecX * toVecX + toVecY * toVecY;
-
-                const double s = toVecX * ( -unitVecX ) + toVecY * ( -unitVecY );
-                if ( s < 0.0 )
-                {
-                    distToSegmentSqr = toVecLength;
-                }
-                else
-                {
-                    distToSegmentSqr = qFabs( toVecLength - s * s );
-                }
-            }
-
-            if ( maxDistSqr < distToSegmentSqr )
-            {
-                maxDistSqr = distToSegmentSqr;
-                nVertexIndexMaxDistance = i;
-            }
-        }
-        if ( maxDistSqr <= toleranceSqr )
-        {
-            usePoint[r.from] = true;
-            usePoint[r.to] = true;
-        }
-        else
-        {
-            stack.push( Line( r.from, nVertexIndexMaxDistance ) );
-            stack.push( Line( nVertexIndexMaxDistance, r.to ) );
-        }
-    }
-
-    QPolygonF stripped;
-    for ( int i = 0; i < nPoints; i++ )
-    {
-        if ( usePoint[i] )
-            stripped += p[i];
-    }
-
-    return stripped;
-}
Index: /trunk/BNC/qwt/qwt_curve_fitter.h
===================================================================
--- /trunk/BNC/qwt/qwt_curve_fitter.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_curve_fitter.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,16 +12,44 @@
 
 #include "qwt_global.h"
-#include <qpolygon.h>
-#include <qrect.h>
 
-class QwtSpline;
+class QPainterPath;
+class QPolygonF;
 
 /*!
-  \brief Abstract base class for a curve fitter
-*/
+   \brief Abstract base class for a curve fitter
+ */
 class QWT_EXPORT QwtCurveFitter
 {
-public:
+  public:
+    /*!
+       \brief Preferred mode of the fitting algorithm
+
+       Even if a QPainterPath can always be created from a QPolygonF
+       the overhead of the conversion can be avoided by indicating
+       the preference of the implementation to the application
+       code.
+     */
+    enum Mode
+    {
+        /*!
+           The fitting algorithm creates a polygon - the implementation
+           of fitCurvePath() simply wraps the polygon into a path.
+
+           \sa QwtWeedingCurveFitter
+         */
+        Polygon,
+
+        /*!
+           The fitting algorithm creates a painter path - the implementation
+           of fitCurve() extracts a polygon from the path.
+
+           \sa QwtSplineCurveFitter
+         */
+        Path
+    };
+
     virtual ~QwtCurveFitter();
+
+    Mode mode() const;
 
     /*!
@@ -30,109 +58,26 @@
         \param polygon Series of data points
         \return Curve points
+
+        \sa fitCurvePath()
      */
-    virtual QPolygonF fitCurve( const QPolygonF &polygon ) const = 0;
+    virtual QPolygonF fitCurve( const QPolygonF& polygon ) const = 0;
 
-protected:
-    QwtCurveFitter();
+    /*!
+        Find a curve path which has the best fit to a series of data points
 
-private:
-    QwtCurveFitter( const QwtCurveFitter & );
-    QwtCurveFitter &operator=( const QwtCurveFitter & );
-};
+        \param polygon Series of data points
+        \return Curve path
 
-/*!
-  \brief A curve fitter using cubic splines
-*/
-class QWT_EXPORT QwtSplineCurveFitter: public QwtCurveFitter
-{
-public:
-    /*!
-      Spline type
-      The default setting is Auto
-      \sa setFitMode(), FitMode()
+        \sa fitCurve()
      */
-    enum FitMode
-    {
-        /*!
-          Use the default spline algorithm for polygons with
-          increasing x values ( p[i-1] < p[i] ), otherwise use
-          a parametric spline algorithm.
-         */
-        Auto,
+    virtual QPainterPath fitCurvePath( const QPolygonF& polygon ) const = 0;
 
-        //! Use a default spline algorithm
-        Spline,
+  protected:
+    explicit QwtCurveFitter( Mode mode );
 
-        //! Use a parametric spline algorithm
-        ParametricSpline
-    };
+  private:
+    Q_DISABLE_COPY(QwtCurveFitter)
 
-    QwtSplineCurveFitter();
-    virtual ~QwtSplineCurveFitter();
-
-    void setFitMode( FitMode );
-    FitMode fitMode() const;
-
-    void setSpline( const QwtSpline& );
-    const QwtSpline &spline() const;
-    QwtSpline &spline();
-
-    void setSplineSize( int );
-    int splineSize() const;
-
-    virtual QPolygonF fitCurve( const QPolygonF & ) const;
-
-private:
-    QPolygonF fitSpline( const QPolygonF & ) const;
-    QPolygonF fitParametric( const QPolygonF & ) const;
-
-    class PrivateData;
-    PrivateData *d_data;
-};
-
-/*!
-  \brief A curve fitter implementing Douglas and Peucker algorithm
-
-  The purpose of the Douglas and Peucker algorithm is that given a 'curve'
-  composed of line segments to find a curve not too dissimilar but that
-  has fewer points. The algorithm defines 'too dissimilar' based on the
-  maximum distance (tolerance) between the original curve and the
-  smoothed curve.
-
-  The runtime of the algorithm increases non linear ( worst case O( n*n ) )
-  and might be very slow for huge polygons. To avoid performance issues
-  it might be useful to split the polygon ( setChunkSize() ) and to run the algorithm
-  for these smaller parts. The disadvantage of having no interpolation
-  at the borders is for most use cases irrelevant.
-
-  The smoothed curve consists of a subset of the points that defined the
-  original curve.
-
-  In opposite to QwtSplineCurveFitter the Douglas and Peucker algorithm reduces
-  the number of points. By adjusting the tolerance parameter according to the
-  axis scales QwtSplineCurveFitter can be used to implement different
-  level of details to speed up painting of curves of many points.
-*/
-class QWT_EXPORT QwtWeedingCurveFitter: public QwtCurveFitter
-{
-public:
-    QwtWeedingCurveFitter( double tolerance = 1.0 );
-    virtual ~QwtWeedingCurveFitter();
-
-    void setTolerance( double );
-    double tolerance() const;
-
-    void setChunkSize( uint );
-    uint chunkSize() const;
-
-    virtual QPolygonF fitCurve( const QPolygonF & ) const;
-
-private:
-    virtual QPolygonF simplify( const QPolygonF & ) const;
-
-    class Line;
-
-    class PrivateData;
-    PrivateData *d_data;
+    const Mode m_mode;
 };
 
Index: /trunk/BNC/qwt/qwt_date.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_date.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_date.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,9 +9,10 @@
 
 #include "qwt_date.h"
+#include "qwt_math.h"
+
 #include <qdebug.h>
 #include <qlocale.h>
-#include <math.h>
+
 #include <limits>
-#include <limits.h>
 
 #if QT_VERSION >= 0x050000
@@ -24,14 +25,15 @@
 
 // QDate stores the Julian day as unsigned int, but
-// but it is QDate::fromJulianDay( int ). That's why
+// there is QDate::fromJulianDay( int ). That's why
 // we have the range [ 1, INT_MAX ]
+
 typedef int QwtJulianDay;
 static const QwtJulianDay minJulianDayD = 1;
-static const QwtJulianDay maxJulianDayD = std::numeric_limits<int>::max();
+static const QwtJulianDay maxJulianDayD = std::numeric_limits< int >::max();
 
 #endif
 
-static QString qwtExpandedFormat( const QString & format,
-    const QDateTime &dateTime, QwtDate::Week0Type week0Type )
+static QString qwtExpandedFormat( const QString& format,
+    const QDateTime& dateTime, QwtDate::Week0Type week0Type )
 {
     const int week = QwtDate::weekNumber( dateTime.date(), week0Type );
@@ -42,11 +44,11 @@
     QString weekNoWW;
     if ( weekNo.length() == 1 )
-        weekNoWW += "0";
+        weekNoWW += QLatin1Char( '0' );
 
     weekNoWW += weekNo;
 
     QString fmt = format;
-    fmt.replace( "ww", weekNoWW );
-    fmt.replace( "w", weekNo );
+    fmt.replace( QLatin1String( "ww" ), weekNoWW );
+    fmt.replace( QLatin1Char( 'w' ), weekNo );
 
     if ( week == 1 && dateTime.date().month() != 1 )
@@ -54,6 +56,6 @@
         // in case of week 1, we might need to increment the year
 
-        static QString s_yyyy = "yyyy";
-        static QString s_yy = "yy";
+        QLatin1String s_yyyy( "yyyy" );
+        QLatin1String s_yy( "yy" );
 
         // week 1 might start in the previous year
@@ -100,12 +102,13 @@
         {
             const QDate dt( dateTime.date().year() + 1, 1, 1 );
+            const QString dtString = QLocale().toString( dt, s_yyyy );
 
             if ( fmt.contains( s_yyyy ) )
             {
-                fmt.replace( s_yyyy, dt.toString( s_yyyy ) );
+                fmt.replace( s_yyyy, dtString );
             }
             else
             {
-                fmt.replace( s_yy, dt.toString( s_yyyy ) );
+                fmt.replace( s_yy, dtString );
             }
         }
@@ -117,84 +120,9 @@
 static inline Qt::DayOfWeek qwtFirstDayOfWeek()
 {
-#if QT_VERSION >= 0x040800
     return QLocale().firstDayOfWeek();
-#else
-
-    switch( QLocale().country() )
-    {
-        case QLocale::Maldives:
-            return Qt::Friday;
-
-        case QLocale::Afghanistan:
-        case QLocale::Algeria:
-        case QLocale::Bahrain:
-        case QLocale::Djibouti:
-        case QLocale::Egypt:
-        case QLocale::Eritrea:
-        case QLocale::Ethiopia:
-        case QLocale::Iran:
-        case QLocale::Iraq:
-        case QLocale::Jordan:
-        case QLocale::Kenya:
-        case QLocale::Kuwait:
-        case QLocale::LibyanArabJamahiriya:
-        case QLocale::Morocco:
-        case QLocale::Oman:
-        case QLocale::Qatar:
-        case QLocale::SaudiArabia:
-        case QLocale::Somalia:
-        case QLocale::Sudan:
-        case QLocale::Tunisia:
-        case QLocale::Yemen:
-            return Qt::Saturday;
-
-        case QLocale::AmericanSamoa:
-        case QLocale::Argentina:
-        case QLocale::Azerbaijan:
-        case QLocale::Botswana:
-        case QLocale::Canada:
-        case QLocale::China:
-        case QLocale::FaroeIslands:
-        case QLocale::Georgia:
-        case QLocale::Greenland:
-        case QLocale::Guam:
-        case QLocale::HongKong:
-        case QLocale::Iceland:
-        case QLocale::India:
-        case QLocale::Ireland:
-        case QLocale::Israel:
-        case QLocale::Jamaica:
-        case QLocale::Japan:
-        case QLocale::Kyrgyzstan:
-        case QLocale::Lao:
-        case QLocale::Malta:
-        case QLocale::MarshallIslands:
-        case QLocale::Macau:
-        case QLocale::Mongolia:
-        case QLocale::NewZealand:
-        case QLocale::NorthernMarianaIslands:
-        case QLocale::Pakistan:
-        case QLocale::Philippines:
-        case QLocale::RepublicOfKorea:
-        case QLocale::Singapore:
-        case QLocale::SyrianArabRepublic:
-        case QLocale::Taiwan:
-        case QLocale::Thailand:
-        case QLocale::TrinidadAndTobago:
-        case QLocale::UnitedStates:
-        case QLocale::UnitedStatesMinorOutlyingIslands:
-        case QLocale::USVirginIslands:
-        case QLocale::Uzbekistan:
-        case QLocale::Zimbabwe:
-            return Qt::Sunday;
-
-        default:
-            return Qt::Monday;
-    }
-#endif
 }
 
 static inline void qwtFloorTime(
-    QwtDate::IntervalType intervalType, QDateTime &dt )
+    QwtDate::IntervalType intervalType, QDateTime& dt )
 {
     // when dt is inside the special hour where DST is ending
@@ -234,5 +162,5 @@
 
 static inline QDateTime qwtToTimeSpec(
-    const QDateTime &dt, Qt::TimeSpec spec )
+    const QDateTime& dt, Qt::TimeSpec spec )
 {
     if ( dt.timeSpec() == spec )
@@ -240,5 +168,5 @@
 
     const qint64 jd = dt.date().toJulianDay();
-    if ( jd < 0 || jd >= INT_MAX )
+    if ( jd < 0 || jd >= std::numeric_limits< int >::max() )
     {
         // the conversion between local time and UTC
@@ -264,8 +192,8 @@
     const int m1 = ( month - 14 ) / 12;
     const int m2 = ( 367 * ( month - 2 - 12 * m1 ) ) / 12;
-    const double y1 = ::floor( ( 4900.0 + year + m1 ) / 100 );
-
-    return ::floor( ( 1461.0 * ( year + 4800 + m1 ) ) / 4 ) + m2
-            - ::floor( ( 3 * y1 ) / 4 ) + day - 32075;
+    const double y1 = std::floor( ( 4900.0 + year + m1 ) / 100 );
+
+    return std::floor( ( 1461.0 * ( year + 4800 + m1 ) ) / 4 ) + m2
+           - std::floor( ( 3 * y1 ) / 4 ) + day - 32075;
 }
 
@@ -300,8 +228,8 @@
         const int m1 = ( month - 14 ) / 12;
         const int m2 = ( 367 * ( month - 2 - 12 * m1 ) ) / 12;
-        const double y1 = ::floor( ( 4900.0 + year + m1 ) / 100 );
-
-        const double jd = ::floor( ( 1461.0 * ( year + 4800 + m1 ) ) / 4 ) + m2
-            - ::floor( ( 3 * y1 ) / 4 ) + day - 32075;
+        const double y1 = std::floor( ( 4900.0 + year + m1 ) / 100 );
+
+        const double jd = std::floor( ( 1461.0 * ( year + 4800 + m1 ) ) / 4 ) + m2
+            - std::floor( ( 3 * y1 ) / 4 ) + day - 32075;
 
         if ( jd > maxJulianDayD )
@@ -311,5 +239,5 @@
         }
 
-        return QDate::fromJulianDay( static_cast<QwtJulianDay>( jd ) );
+        return QDate::fromJulianDay( static_cast< QwtJulianDay >( jd ) );
     }
     else
@@ -321,13 +249,13 @@
 
 /*!
-  Translate from double to QDateTime
-
-  \param value Number of milliseconds since the epoch,
+   Translate from double to QDateTime
+
+   \param value Number of milliseconds since the epoch,
                1970-01-01T00:00:00 UTC
-  \param timeSpec Time specification
-  \return Datetime value
-
-  \sa toDouble(), QDateTime::setMSecsSinceEpoch()
-  \note The return datetime for Qt::OffsetFromUTC will be Qt::UTC
+   \param timeSpec Time specification
+   \return Datetime value
+
+   \sa toDouble(), QDateTime::setMSecsSinceEpoch()
+   \note The return datetime for Qt::OffsetFromUTC will be Qt::UTC
  */
 QDateTime QwtDate::toDateTime( double value, Qt::TimeSpec timeSpec )
@@ -335,5 +263,5 @@
     const int msecsPerDay = 86400000;
 
-    const double days = static_cast<qint64>( ::floor( value / msecsPerDay ) );
+    const double days = static_cast< qint64 >( std::floor( value / msecsPerDay ) );
 
     const double jd = QwtDate::JulianDayForEpoch + days;
@@ -344,7 +272,7 @@
     }
 
-    const QDate d = QDate::fromJulianDay( static_cast<QwtJulianDay>( jd ) );
-
-    const int msecs = static_cast<int>( value - days * msecsPerDay );
+    const QDate d = QDate::fromJulianDay( static_cast< QwtJulianDay >( jd ) );
+
+    const int msecs = static_cast< int >( value - days * msecsPerDay );
 
     static const QTime timeNull( 0, 0, 0, 0 );
@@ -359,14 +287,14 @@
 
 /*!
-  Translate from QDateTime to double
-
-  \param dateTime Datetime value
-  \return Number of milliseconds since 1970-01-01T00:00:00 UTC has passed.
-
-  \sa toDateTime(), QDateTime::toMSecsSinceEpoch()
-  \warning For values very far below or above 1970-01-01 UTC rounding errors
+   Translate from QDateTime to double
+
+   \param dateTime Datetime value
+   \return Number of milliseconds since 1970-01-01T00:00:00 UTC has passed.
+
+   \sa toDateTime(), QDateTime::toMSecsSinceEpoch()
+   \warning For values very far below or above 1970-01-01 UTC rounding errors
            will happen due to the limited significance of a double.
  */
-double QwtDate::toDouble( const QDateTime &dateTime )
+double QwtDate::toDouble( const QDateTime& dateTime )
 {
     const int msecsPerDay = 86400000;
@@ -384,14 +312,14 @@
 
 /*!
-  Ceil a datetime according the interval type
-
-  \param dateTime Datetime value
-  \param intervalType Interval type, how to ceil.
+   Ceil a datetime according the interval type
+
+   \param dateTime Datetime value
+   \param intervalType Interval type, how to ceil.
                       F.e. when intervalType = QwtDate::Months, the result
                       will be ceiled to the next beginning of a month
-  \return Ceiled datetime
-  \sa floor()
- */
-QDateTime QwtDate::ceil( const QDateTime &dateTime, IntervalType intervalType )
+   \return Ceiled datetime
+   \sa floor()
+ */
+QDateTime QwtDate::ceil( const QDateTime& dateTime, IntervalType intervalType )
 {
     if ( dateTime.date() >= QwtDate::maxDate() )
@@ -485,15 +413,15 @@
 
 /*!
-  Floor a datetime according the interval type
-
-  \param dateTime Datetime value
-  \param intervalType Interval type, how to ceil.
+   Floor a datetime according the interval type
+
+   \param dateTime Datetime value
+   \param intervalType Interval type, how to ceil.
                       F.e. when intervalType = QwtDate::Months,
                       the result will be ceiled to the next
                       beginning of a month
-  \return Floored datetime
-  \sa floor()
- */
-QDateTime QwtDate::floor( const QDateTime &dateTime,
+   \return Floored datetime
+   \sa floor()
+ */
+QDateTime QwtDate::floor( const QDateTime& dateTime,
     IntervalType intervalType )
 {
@@ -558,14 +486,14 @@
 
 /*!
-  Minimum for the supported date range
-
-  The range of valid dates depends on how QDate stores the
-  Julian day internally.
-
-  - For Qt4 it is "Tue Jan 2 -4713"
-  - For Qt5 it is "Thu Jan 1 -2147483648"
-
-  \return minimum of the date range
-  \sa maxDate()
+   Minimum for the supported date range
+
+   The range of valid dates depends on how QDate stores the
+   Julian day internally.
+
+   - For Qt4 it is "Tue Jan 2 -4713"
+   - For Qt5 it is "Thu Jan 1 -2147483648"
+
+   \return minimum of the date range
+   \sa maxDate()
  */
 QDate QwtDate::minDate()
@@ -579,15 +507,15 @@
 
 /*!
-  Maximum for the supported date range
-
-  The range of valid dates depends on how QDate stores the
-  Julian day internally.
-
-  - For Qt4 it is "Tue Jun 3 5874898"
-  - For Qt5 it is "Tue Dec 31 2147483647"
-
-  \return maximum of the date range
-  \sa minDate()
-  \note The maximum differs between Qt4 and Qt5
+   Maximum for the supported date range
+
+   The range of valid dates depends on how QDate stores the
+   Julian day internally.
+
+   - For Qt4 it is "Tue Jun 3 5874898"
+   - For Qt5 it is "Tue Dec 31 2147483647"
+
+   \return maximum of the date range
+   \sa minDate()
+   \note The maximum differs between Qt4 and Qt5
  */
 QDate QwtDate::maxDate()
@@ -601,14 +529,14 @@
 
 /*!
-  \brief Date of the first day of the first week for a year
-
-  The first day of a week depends on the current locale
-  ( QLocale::firstDayOfWeek() ).
-
-  \param year Year
-  \param type Option how to identify the first week
-  \return First day of week 0
-
-  \sa QLocale::firstDayOfWeek(), weekNumber()
+   \brief Date of the first day of the first week for a year
+
+   The first day of a week depends on the current locale
+   ( QLocale::firstDayOfWeek() ).
+
+   \param year Year
+   \param type Option how to identify the first week
+   \return First day of week 0
+
+   \sa QLocale::firstDayOfWeek(), weekNumber()
  */
 QDate QwtDate::dateOfWeek0( int year, Week0Type type )
@@ -628,5 +556,5 @@
     {
         // according to ISO 8601 the first week is defined
-        // by the first thursday.
+        // by the first Thursday.
 
         int d = Qt::Thursday - firstDayOfWeek;
@@ -642,18 +570,18 @@
 
 /*!
-  Find the week number of a date
-
-  - QwtDate::FirstThursday\n
+   Find the week number of a date
+
+   - QwtDate::FirstThursday\n
     Corresponding to ISO 8601 ( see QDate::weekNumber() ).
 
-  - QwtDate::FirstDay\n
+   - QwtDate::FirstDay\n
     Number of weeks that have begun since dateOfWeek0().
 
-  \param date Date
-  \param type Option how to identify the first week
-
-  \return Week number, starting with 1
- */
-int QwtDate::weekNumber( const QDate &date, Week0Type type )
+   \param date Date
+   \param type Option how to identify the first week
+
+   \return Week number, starting with 1
+ */
+int QwtDate::weekNumber( const QDate& date, Week0Type type )
 {
     int weekNo;
@@ -695,5 +623,5 @@
      0, dateTime has no offset
    - Qt::OffsetFromUTC
-     returns dateTime.utcOffset()
+     returns dateTime.offsetFromUtc()
    - Qt::LocalTime:
      number of seconds from the UTC
@@ -705,5 +633,5 @@
    \return Offset in seconds
  */
-int QwtDate::utcOffset( const QDateTime &dateTime )
+int QwtDate::utcOffset( const QDateTime& dateTime )
 {
     int seconds = 0;
@@ -717,5 +645,9 @@
         case Qt::OffsetFromUTC:
         {
+#if QT_VERSION >= 0x050200
+            seconds = dateTime.offsetFromUtc();
+#else
             seconds = dateTime.utcOffset();
+#endif
             break;
         }
@@ -731,27 +663,27 @@
 
 /*!
-  Translate a datetime into a string
-
-  Beside the format expressions documented in QDateTime::toString()
-  the following expressions are supported:
-
-  - w\n
+   Translate a datetime into a string
+
+   Beside the format expressions documented in QDateTime::toString()
+   the following expressions are supported:
+
+   - w\n
     week number: ( 1 - 53 )
-  - ww\n
+   - ww\n
     week number with a leading zero ( 01 - 53 )
 
-  As week 1 usually starts in the previous year a special rule
-  is applied for formats, where the year is expected to match the
-  week number - even if the date belongs to the previous year.
-
-  \param dateTime Datetime value
-  \param format Format string
-  \param week0Type Specification of week 0
-
-  \return Datetime string
-  \sa QDateTime::toString(), weekNumber(), QwtDateScaleDraw
- */
-QString QwtDate::toString( const QDateTime &dateTime,
-    const QString & format, Week0Type week0Type )
+   As week 1 usually starts in the previous year a special rule
+   is applied for formats, where the year is expected to match the
+   week number - even if the date belongs to the previous year.
+
+   \param dateTime Datetime value
+   \param format Format string
+   \param week0Type Specification of week 0
+
+   \return Datetime string
+   \sa QDateTime::toString(), weekNumber(), QwtDateScaleDraw
+ */
+QString QwtDate::toString( const QDateTime& dateTime,
+    const QString& format, Week0Type week0Type )
 {
     QString fmt = format;
@@ -761,4 +693,4 @@
     }
 
-    return dateTime.toString( fmt );
-}
+    return QLocale().toString( dateTime, fmt );
+}
Index: /trunk/BNC/qwt/qwt_date.h
===================================================================
--- /trunk/BNC/qwt/qwt_date.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_date.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -8,6 +8,6 @@
  *****************************************************************************/
 
-#ifndef _QWT_DATE_H_
-#define _QWT_DATE_H_
+#ifndef QWT_DATE_H
+#define QWT_DATE_H
 
 #include "qwt_global.h"
@@ -15,32 +15,32 @@
 
 /*!
-  \brief A collection of methods around date/time values
+   \brief A collection of methods around date/time values
 
-  Qt offers convenient classes for dealing with date/time values,
-  but Qwt uses coordinate systems that are based on doubles.
-  QwtDate offers methods to translate from QDateTime to double and v.v.
+   Qt offers convenient classes for dealing with date/time values,
+   but Qwt uses coordinate systems that are based on doubles.
+   QwtDate offers methods to translate from QDateTime to double and v.v.
 
-  A double is interpreted as the number of milliseconds since
-  1970-01-01T00:00:00 Universal Coordinated Time - also known
-  as "The Epoch".
+   A double is interpreted as the number of milliseconds since
+   1970-01-01T00:00:00 Universal Coordinated Time - also known
+   as "The Epoch".
 
-  While the range of the Julian day in Qt4 is limited to [0, MAX_INT],
-  Qt5 stores it as qint64 offering a huge range of valid dates.
-  As the significance of a double is below this ( assuming a
-  fraction of 52 bits ) the translation is not
-  bijective with rounding errors for dates very far from Epoch.
-  For a resolution of 1 ms those start to happen for dates above the
-  year 144683.
+   While the range of the Julian day in Qt4 is limited to [0, MAX_INT],
+   Qt5 stores it as qint64 offering a huge range of valid dates.
+   As the significance of a double is below this ( assuming a
+   fraction of 52 bits ) the translation is not
+   bijective with rounding errors for dates very far from Epoch.
+   For a resolution of 1 ms those start to happen for dates above the
+   year 144683.
 
-  An axis for a date/time interval is expected to be aligned
-  and divided in time/date units like seconds, minutes, ...
-  QwtDate offers several algorithms that are needed to
-  calculate these axes.
+   An axis for a date/time interval is expected to be aligned
+   and divided in time/date units like seconds, minutes, ...
+   QwtDate offers several algorithms that are needed to
+   calculate these axes.
 
-  \sa QwtDateScaleEngine, QwtDateScaleDraw, QDate, QTime
-*/
+   \sa QwtDateScaleEngine, QwtDateScaleDraw, QDate, QTime
+ */
 class QWT_EXPORT QwtDate
 {
-public:
+  public:
     /*!
        How to identify the first week of year differs between
@@ -55,5 +55,5 @@
            FirstThursday corresponds to the numbering that is
            implemented in QDate::weekNumber().
-        */
+         */
         FirstThursday,
 
@@ -63,13 +63,13 @@
             In the U.S. this definition is more common than
             FirstThursday.
-        */
+         */
         FirstDay
     };
 
     /*!
-      Classification of an time interval
+       Classification of an time interval
 
-      Time intervals needs to be classified to decide how to
-      align and divide it.
+       Time intervals needs to be classified to decide how to
+       align and divide it.
      */
     enum IntervalType
@@ -112,16 +112,16 @@
         Qt::TimeSpec = Qt::UTC );
 
-    static double toDouble( const QDateTime & );
+    static double toDouble( const QDateTime& );
 
-    static QDateTime ceil( const QDateTime &, IntervalType );
-    static QDateTime floor( const QDateTime &, IntervalType );
+    static QDateTime ceil( const QDateTime&, IntervalType );
+    static QDateTime floor( const QDateTime&, IntervalType );
 
     static QDate dateOfWeek0( int year, Week0Type );
-    static int weekNumber( const QDate &, Week0Type );
+    static int weekNumber( const QDate&, Week0Type );
 
-    static int utcOffset( const QDateTime & );
+    static int utcOffset( const QDateTime& );
 
-    static QString toString( const QDateTime &,
-        const QString & format, Week0Type );
+    static QString toString( const QDateTime&,
+        const QString& format, Week0Type );
 };
 
Index: /trunk/BNC/qwt/qwt_date_scale_draw.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_date_scale_draw.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_date_scale_draw.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,12 +9,13 @@
 
 #include "qwt_date_scale_draw.h"
+#include "qwt_text.h"
 
 class QwtDateScaleDraw::PrivateData
 {
-public:
-    PrivateData( Qt::TimeSpec spec ):
-        timeSpec( spec ),
-        utcOffset( 0 ),
-        week0Type( QwtDate::FirstThursday )
+  public:
+    explicit PrivateData( Qt::TimeSpec spec )
+        : timeSpec( spec )
+        , utcOffset( 0 )
+        , week0Type( QwtDate::FirstThursday )
     {
         dateFormats[ QwtDate::Millisecond ] = "hh:mm:ss:zzz\nddd dd MMM yyyy";
@@ -35,17 +36,17 @@
 
 /*!
-  \brief Constructor
-
-  The default setting is to display tick labels for the
-  given time specification. The first week of a year is defined like
-  for QwtDate::FirstThursday.
-
-  \param timeSpec Time specification
-
-  \sa setTimeSpec(), setWeek0Type()
+   \brief Constructor
+
+   The default setting is to display tick labels for the
+   given time specification. The first week of a year is defined like
+   for QwtDate::FirstThursday.
+
+   \param timeSpec Time specification
+
+   \sa setTimeSpec(), setWeek0Type()
  */
 QwtDateScaleDraw::QwtDateScaleDraw( Qt::TimeSpec timeSpec )
 {
-    d_data = new PrivateData( timeSpec );
+    m_data = new PrivateData( timeSpec );
 }
 
@@ -53,99 +54,99 @@
 QwtDateScaleDraw::~QwtDateScaleDraw()
 {
-    delete d_data;
-}
-
-/*!
-  Set the time specification used for the tick labels
-
-  \param timeSpec Time specification
-  \sa timeSpec(), setUtcOffset(), toDateTime()
+    delete m_data;
+}
+
+/*!
+   Set the time specification used for the tick labels
+
+   \param timeSpec Time specification
+   \sa timeSpec(), setUtcOffset(), toDateTime()
  */
 void QwtDateScaleDraw::setTimeSpec( Qt::TimeSpec timeSpec )
 {
-    d_data->timeSpec = timeSpec;
-}
-
-/*!
-  \return Time specification used for the tick labels
-  \sa setTimeSpec(), utcOffset(), toDateTime()
+    m_data->timeSpec = timeSpec;
+}
+
+/*!
+   \return Time specification used for the tick labels
+   \sa setTimeSpec(), utcOffset(), toDateTime()
  */
 Qt::TimeSpec QwtDateScaleDraw::timeSpec() const
 {
-    return d_data->timeSpec;
-}
-
-/*!
-  Set the offset in seconds from Coordinated Universal Time
-
-  \param seconds Offset in seconds
-
-  \note The offset has no effect beside for the time specification
+    return m_data->timeSpec;
+}
+
+/*!
+   Set the offset in seconds from Coordinated Universal Time
+
+   \param seconds Offset in seconds
+
+   \note The offset has no effect beside for the time specification
         Qt::OffsetFromUTC.
 
-  \sa QDate::utcOffset(), setTimeSpec(), toDateTime()
+   \sa QDate::utcOffset(), setTimeSpec(), toDateTime()
  */
 void QwtDateScaleDraw::setUtcOffset( int seconds )
 {
-    d_data->utcOffset = seconds;
-}
-
-/*!
-  \return Offset in seconds from Coordinated Universal Time
-  \note The offset has no effect beside for the time specification
+    m_data->utcOffset = seconds;
+}
+
+/*!
+   \return Offset in seconds from Coordinated Universal Time
+   \note The offset has no effect beside for the time specification
         Qt::OffsetFromUTC.
 
-  \sa QDate::setUtcOffset(), setTimeSpec(), toDateTime()
+   \sa QDate::setUtcOffset(), setTimeSpec(), toDateTime()
  */
 int QwtDateScaleDraw::utcOffset() const
 {
-    return d_data->utcOffset;
-}
-
-/*!
-  Sets how to identify the first week of a year.
-
-  \param week0Type Mode how to identify the first week of a year
-
-  \sa week0Type().
-  \note week0Type has no effect beside for intervals classified as
+    return m_data->utcOffset;
+}
+
+/*!
+   Sets how to identify the first week of a year.
+
+   \param week0Type Mode how to identify the first week of a year
+
+   \sa week0Type().
+   \note week0Type has no effect beside for intervals classified as
         QwtDate::Week.
  */
 void QwtDateScaleDraw::setWeek0Type( QwtDate::Week0Type week0Type )
 {
-    d_data->week0Type = week0Type;
-}
-
-/*!
-  \return Setting how to identify the first week of a year.
-  \sa setWeek0Type()
+    m_data->week0Type = week0Type;
+}
+
+/*!
+   \return Setting how to identify the first week of a year.
+   \sa setWeek0Type()
  */
 QwtDate::Week0Type QwtDateScaleDraw::week0Type() const
 {
-    return d_data->week0Type;
-}
-
-/*!
-  Set the default format string for an datetime interval type
-
-  \param intervalType Interval type
-  \param format Default format string
-
-  \sa dateFormat(), dateFormatOfDate(), QwtDate::toString()
+    return m_data->week0Type;
+}
+
+/*!
+   Set the default format string for an datetime interval type
+
+   \param intervalType Interval type
+   \param format Default format string
+
+   \sa dateFormat(), dateFormatOfDate(), QwtDate::toString()
  */
 void QwtDateScaleDraw::setDateFormat(
-    QwtDate::IntervalType intervalType, const QString &format )
+    QwtDate::IntervalType intervalType, const QString& format )
 {
     if ( intervalType >= QwtDate::Millisecond &&
         intervalType <= QwtDate::Year )
     {
-        d_data->dateFormats[ intervalType ] = format;
-    }
-}
-
-/*!
-  \param intervalType Interval type
-  \return Default format string for an datetime interval type
-  \sa setDateFormat(), dateFormatOfDate()
+        m_data->dateFormats[ intervalType ] = format;
+    }
+}
+
+/*!
+   \param intervalType Interval type
+   \return Default format string for an datetime interval type
+   \sa setDateFormat(), dateFormatOfDate()
  */
 QString QwtDateScaleDraw::dateFormat(
@@ -155,5 +156,5 @@
         intervalType <= QwtDate::Year )
     {
-        return d_data->dateFormats[ intervalType ];
+        return m_data->dateFormats[ intervalType ];
     }
 
@@ -162,20 +163,20 @@
 
 /*!
-  Format string for the representation of a datetime
-
-  dateFormatOfDate() is intended to be overloaded for
-  situations, where formats are individual for specific
-  datetime values.
-
-  The default setting ignores dateTime and return
-  the default format for the interval type.
-
-  \param dateTime Datetime value
-  \param intervalType Interval type
-  \return Format string
-
-  \sa setDateFormat(), QwtDate::toString()
- */
-QString QwtDateScaleDraw::dateFormatOfDate( const QDateTime &dateTime,
+   Format string for the representation of a datetime
+
+   dateFormatOfDate() is intended to be overloaded for
+   situations, where formats are individual for specific
+   datetime values.
+
+   The default setting ignores dateTime and return
+   the default format for the interval type.
+
+   \param dateTime Datetime value
+   \param intervalType Interval type
+   \return Format string
+
+   \sa setDateFormat(), QwtDate::toString()
+ */
+QString QwtDateScaleDraw::dateFormatOfDate( const QDateTime& dateTime,
     QwtDate::IntervalType intervalType ) const
 {
@@ -185,21 +186,21 @@
         intervalType <= QwtDate::Year )
     {
-        return d_data->dateFormats[ intervalType ];
-    }
-
-    return d_data->dateFormats[ QwtDate::Second ];
-}
-
-/*!
-  \brief Convert a value into its representing label
-
-  The value is converted to a datetime value using toDateTime()
-  and converted to a plain text using QwtDate::toString().
-
-  \param value Value
-  \return Label string.
-
-  \sa dateFormatOfDate()
-*/
+        return m_data->dateFormats[ intervalType ];
+    }
+
+    return m_data->dateFormats[ QwtDate::Second ];
+}
+
+/*!
+   \brief Convert a value into its representing label
+
+   The value is converted to a datetime value using toDateTime()
+   and converted to a plain text using QwtDate::toString().
+
+   \param value Value
+   \return Label string.
+
+   \sa dateFormatOfDate()
+ */
 QwtText QwtDateScaleDraw::label( double value ) const
 {
@@ -208,18 +209,18 @@
         dt, intervalType( scaleDiv() ) );
 
-    return QwtDate::toString( dt, fmt, d_data->week0Type );
-}
-
-/*!
-  Find the less detailed datetime unit, where no rounding
-  errors happen.
-
-  \param scaleDiv Scale division
-  \return Interval type
-
-  \sa dateFormatOfDate()
+    return QwtDate::toString( dt, fmt, m_data->week0Type );
+}
+
+/*!
+   Find the less detailed datetime unit, where no rounding
+   errors happen.
+
+   \param scaleDiv Scale division
+   \return Interval type
+
+   \sa dateFormatOfDate()
  */
 QwtDate::IntervalType QwtDateScaleDraw::intervalType(
-    const QwtScaleDiv &scaleDiv ) const
+    const QwtScaleDiv& scaleDiv ) const
 {
     int intvType = QwtDate::Year;
@@ -227,5 +228,5 @@
     bool alignedToWeeks = true;
 
-    const QList<double> ticks = scaleDiv.ticks( QwtScaleDiv::MajorTick );
+    const QList< double > ticks = scaleDiv.ticks( QwtScaleDiv::MajorTick );
     for ( int i = 0; i < ticks.size(); i++ )
     {
@@ -234,5 +235,5 @@
         {
             const QDateTime dt0 = QwtDate::floor( dt,
-                static_cast<QwtDate::IntervalType>( j ) );
+                static_cast< QwtDate::IntervalType >( j ) );
 
             if ( dt0 != dt )
@@ -257,20 +258,24 @@
         intvType = QwtDate::Day;
 
-    return static_cast<QwtDate::IntervalType>( intvType );
-}
-
-/*!
-  Translate a double value into a QDateTime object.
-
-  \return QDateTime object initialized with timeSpec() and utcOffset().
-  \sa timeSpec(), utcOffset(), QwtDate::toDateTime()
+    return static_cast< QwtDate::IntervalType >( intvType );
+}
+
+/*!
+   Translate a double value into a QDateTime object.
+
+   \return QDateTime object initialized with timeSpec() and utcOffset().
+   \sa timeSpec(), utcOffset(), QwtDate::toDateTime()
  */
 QDateTime QwtDateScaleDraw::toDateTime( double value ) const
 {
-    QDateTime dt = QwtDate::toDateTime( value, d_data->timeSpec );
-    if ( d_data->timeSpec == Qt::OffsetFromUTC )
-    {
-        dt = dt.addSecs( d_data->utcOffset );
-        dt.setUtcOffset( d_data->utcOffset );
+    QDateTime dt = QwtDate::toDateTime( value, m_data->timeSpec );
+    if ( m_data->timeSpec == Qt::OffsetFromUTC )
+    {
+        dt = dt.addSecs( m_data->utcOffset );
+#if QT_VERSION >= 0x050200
+        dt.setOffsetFromUtc( m_data->utcOffset );
+#else
+        dt.setUtcOffset( m_data->utcOffset );
+#endif
     }
 
Index: /trunk/BNC/qwt/qwt_date_scale_draw.h
===================================================================
--- /trunk/BNC/qwt/qwt_date_scale_draw.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_date_scale_draw.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -8,6 +8,6 @@
  *****************************************************************************/
 
-#ifndef _QWT_DATE_SCALE_DRAW_H_
-#define _QWT_DATE_SCALE_DRAW_H_ 1
+#ifndef QWT_DATE_SCALE_DRAW_H
+#define QWT_DATE_SCALE_DRAW_H
 
 #include "qwt_global.h"
@@ -16,45 +16,45 @@
 
 /*!
-  \brief A class for drawing datetime scales
+   \brief A class for drawing datetime scales
 
-  QwtDateScaleDraw displays values as datetime labels.
-  The format of the labels depends on the alignment of
-  the major tick labels.
+   QwtDateScaleDraw displays values as datetime labels.
+   The format of the labels depends on the alignment of
+   the major tick labels.
 
-  The default format strings are:
+   The default format strings are:
 
-  - Millisecond\n
+   - Millisecond\n
     "hh:mm:ss:zzz\nddd dd MMM yyyy"
-  - Second\n
+   - Second\n
     "hh:mm:ss\nddd dd MMM yyyy"
-  - Minute\n
+   - Minute\n
     "hh:mm\nddd dd MMM yyyy"
-  - Hour\n
+   - Hour\n
     "hh:mm\nddd dd MMM yyyy"
-  - Day\n
+   - Day\n
     "ddd dd MMM yyyy"
-  - Week\n
+   - Week\n
     "Www yyyy"
-  - Month\n
+   - Month\n
     "MMM yyyy"
-  - Year\n
+   - Year\n
     "yyyy"
 
-  The format strings can be modified using setDateFormat()
-  or individually for each tick label by overloading dateFormatOfDate(),
+   The format strings can be modified using setDateFormat()
+   or individually for each tick label by overloading dateFormatOfDate(),
 
-  Usually QwtDateScaleDraw is used in combination with
-  QwtDateScaleEngine, that calculates scales for datetime
-  intervals.
+   Usually QwtDateScaleDraw is used in combination with
+   QwtDateScaleEngine, that calculates scales for datetime
+   intervals.
 
-  \sa QwtDateScaleEngine, QwtPlot::setAxisScaleDraw()
-*/
-class QWT_EXPORT QwtDateScaleDraw: public QwtScaleDraw
+   \sa QwtDateScaleEngine, QwtPlot::setAxisScaleDraw()
+ */
+class QWT_EXPORT QwtDateScaleDraw : public QwtScaleDraw
 {
-public:
-    QwtDateScaleDraw( Qt::TimeSpec = Qt::LocalTime );
+  public:
+    explicit QwtDateScaleDraw( Qt::TimeSpec = Qt::LocalTime );
     virtual ~QwtDateScaleDraw();
 
-    void setDateFormat( QwtDate::IntervalType, const QString & );
+    void setDateFormat( QwtDate::IntervalType, const QString& );
     QString dateFormat( QwtDate::IntervalType ) const;
 
@@ -68,18 +68,18 @@
     QwtDate::Week0Type week0Type() const;
 
-    virtual QwtText label( double ) const;
+    virtual QwtText label( double ) const QWT_OVERRIDE;
 
     QDateTime toDateTime( double ) const;
 
-protected:
+  protected:
     virtual QwtDate::IntervalType
-        intervalType( const QwtScaleDiv & ) const;
+    intervalType( const QwtScaleDiv& ) const;
 
-    virtual QString dateFormatOfDate( const QDateTime &,
+    virtual QString dateFormatOfDate( const QDateTime&,
         QwtDate::IntervalType ) const;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_date_scale_engine.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_date_scale_engine.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_date_scale_engine.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,7 +10,9 @@
 #include "qwt_date_scale_engine.h"
 #include "qwt_math.h"
-#include "qwt_transform.h"
+#include "qwt_interval.h"
+
 #include <qdatetime.h>
-#include <limits.h>
+
+#include <limits>
 
 static inline double qwtMsecsForType( int type )
@@ -28,5 +30,5 @@
     };
 
-    if ( type < 0 || type >= static_cast<int>( sizeof( msecs ) / sizeof( msecs[0] ) ) )
+    if ( type < 0 || type >= static_cast< int >( sizeof( msecs ) / sizeof( msecs[0] ) ) )
         return 1.0;
 
@@ -38,11 +40,11 @@
 {
     double d = value / stepSize;
-    d = up ? ::ceil( d ) : ::floor( d );
-
-    return static_cast<int>( d * stepSize );
-}
-
-static double qwtIntervalWidth( const QDateTime &minDate,
-    const QDateTime &maxDate, QwtDate::IntervalType intervalType )
+    d = up ? std::ceil( d ) : std::floor( d );
+
+    return static_cast< int >( d * stepSize );
+}
+
+static double qwtIntervalWidth( const QDateTime& minDate,
+    const QDateTime& maxDate, QwtDate::IntervalType intervalType )
 {
     switch( intervalType )
@@ -50,23 +52,19 @@
         case QwtDate::Millisecond:
         {
+            return minDate.msecsTo( maxDate );
+        }
+        case QwtDate::Second:
+        {
+            return minDate.secsTo( maxDate );
+        }
+        case QwtDate::Minute:
+        {
             const double secsTo = minDate.secsTo( maxDate );
-            const double msecs = maxDate.time().msec() -
-                minDate.time().msec();
-
-            return secsTo * 1000 + msecs;
-        }
-        case QwtDate::Second:
-        {
-            return minDate.secsTo( maxDate );
-        }
-        case QwtDate::Minute:
+            return std::floor( secsTo / 60 );
+        }
+        case QwtDate::Hour:
         {
             const double secsTo = minDate.secsTo( maxDate );
-            return ::floor( secsTo / 60 );
-        }
-        case QwtDate::Hour:
-        {
-            const double secsTo = minDate.secsTo( maxDate );
-            return ::floor( secsTo / 3600 );
+            return std::floor( secsTo / 3600 );
         }
         case QwtDate::Day:
@@ -76,5 +74,5 @@
         case QwtDate::Week:
         {
-            return ::floor( minDate.daysTo( maxDate ) / 7.0 );
+            return std::floor( minDate.daysTo( maxDate ) / 7.0 );
         }
         case QwtDate::Month:
@@ -105,5 +103,5 @@
 
 static double qwtRoundedIntervalWidth(
-    const QDateTime &minDate, const QDateTime &maxDate,
+    const QDateTime& minDate, const QDateTime& maxDate,
     QwtDate::IntervalType intervalType )
 {
@@ -142,6 +140,6 @@
             const double stepSize = double( intervalSize ) / numSteps;
 
-            const double p = ::floor( ::log( stepSize ) / ::log( double( base ) ) );
-            const double fraction = qPow( base, p );
+            const double p = std::floor( std::log( stepSize ) / std::log( double( base ) ) );
+            const double fraction = std::pow( base, p );
 
             for ( uint n = base; n >= 1; n /= 2 )
@@ -165,5 +163,5 @@
     const int limits[], size_t numLimits )
 {
-    const int v = qCeil( intervalSize / double( numSteps ) );
+    const int v = qwtCeil( intervalSize / double( numSteps ) );
 
     for ( uint i = 0; i < numLimits - 1; i++ )
@@ -215,7 +213,7 @@
             const double v = intervalSize / double( numSteps );
             if ( v <= 5.0 )
-                stepSize = qCeil( v );
+                stepSize = std::ceil( v );
             else
-                stepSize = qCeil( v / 7 ) * 7;
+                stepSize = std::ceil( v / 7 ) * 7;
 
             break;
@@ -285,5 +283,5 @@
 
             if ( numSteps > 0 )
-                minStepSize = double( stepSize ) / numSteps;
+                minStepSize = stepSize / numSteps;
 
             break;
@@ -309,5 +307,5 @@
 
             if ( numSteps > 0 )
-                minStepSize = double( stepSize ) / numSteps;
+                minStepSize = stepSize / numSteps;
 
             break;
@@ -333,5 +331,5 @@
 
             if ( numSteps > 0 )
-                minStepSize = double( stepSize ) / numSteps;
+                minStepSize = stepSize / numSteps;
 
             break;
@@ -370,5 +368,5 @@
 
             if ( stepSize < maxMinSteps )
-                maxMinSteps = static_cast<int>( stepSize );
+                maxMinSteps = static_cast< int >( stepSize );
 
             static int limits[] = { 1, 2, 3, 4, 6, 12 };
@@ -378,5 +376,5 @@
 
             if ( numSteps > 0 )
-                minStepSize = double( stepSize ) / numSteps;
+                minStepSize = stepSize / numSteps;
 
             break;
@@ -399,5 +397,5 @@
 
                 if ( numSteps > 0 )
-                    minStepSize = double( stepSize ) / numSteps;
+                    minStepSize = stepSize / numSteps;
             }
 
@@ -417,9 +415,9 @@
 }
 
-static QList<double> qwtDstTicks( const QDateTime &dateTime,
+static QList< double > qwtDstTicks( const QDateTime& dateTime,
     int secondsMajor, int secondsMinor )
 {
     if ( secondsMinor <= 0 )
-        QList<double>();
+        return QList< double >();
 
     QDateTime minDate = dateTime.addSecs( -secondsMajor );
@@ -438,5 +436,7 @@
     }
 
-    QList<double> ticks;
+    QList< double > ticks;
+    ticks.reserve( 3600 / secondsMinor);
+
     for ( int i = 0; i < 3600; i += secondsMinor )
         ticks += dstMin + i * 1000.0;
@@ -446,5 +446,5 @@
 
 static QwtScaleDiv qwtDivideToSeconds(
-    const QDateTime &minDate, const QDateTime &maxDate,
+    const QDateTime& minDate, const QDateTime& maxDate,
     double stepSize, int maxMinSteps,
     QwtDate::IntervalType intervalType )
@@ -470,5 +470,5 @@
 
     const double s = qwtMsecsForType( intervalType ) / 1000;
-    const int secondsMajor = static_cast<int>( stepSize * s );
+    const int secondsMajor = static_cast< int >( stepSize * s );
     const double secondsMinor = minStepSize * s;
 
@@ -480,7 +480,7 @@
     double dstOff = 0;
 
-    QList<double> majorTicks;
-    QList<double> mediumTicks;
-    QList<double> minorTicks;
+    QList< double > majorTicks;
+    QList< double > mediumTicks;
+    QList< double > minorTicks;
 
     for ( QDateTime dt = minDate; dt <= maxDate;
@@ -513,5 +513,5 @@
         if ( secondsMinor > 0.0 )
         {
-            const int numMinorSteps = qFloor( secondsMajor / secondsMinor );
+            const int numMinorSteps = qwtFloor( secondsMajor / secondsMinor );
 
             for ( int i = 1; i < numMinorSteps; i++ )
@@ -554,5 +554,5 @@
 
 static QwtScaleDiv qwtDivideToMonths(
-    QDateTime &minDate, const QDateTime &maxDate,
+    QDateTime& minDate, const QDateTime& maxDate,
     double stepSize, int maxMinSteps )
 {
@@ -584,7 +584,7 @@
     }
 
-    QList<double> majorTicks;
-    QList<double> mediumTicks;
-    QList<double> minorTicks;
+    QList< double > majorTicks;
+    QList< double > mediumTicks;
+    QList< double > minorTicks;
 
     for ( QDateTime dt = minDate;
@@ -638,10 +638,10 @@
 
 static QwtScaleDiv qwtDivideToYears(
-    const QDateTime &minDate, const QDateTime &maxDate,
+    const QDateTime& minDate, const QDateTime& maxDate,
     double stepSize, int maxMinSteps )
 {
-    QList<double> majorTicks;
-    QList<double> mediumTicks;
-    QList<double> minorTicks;
+    QList< double > majorTicks;
+    QList< double > mediumTicks;
+    QList< double > minorTicks;
 
     double minStepSize = 0.0;
@@ -655,5 +655,5 @@
     int numMinorSteps = 0;
     if ( minStepSize > 0.0 )
-        numMinorSteps = qFloor( stepSize / minStepSize );
+        numMinorSteps = qwtFloor( stepSize / minStepSize );
 
     bool dateBC = minDate.date().year() < -1;
@@ -679,5 +679,5 @@
 
             const double years = qRound( i * minStepSize );
-            if ( years >= INT_MAX / 12 )
+            if ( years >= std::numeric_limits< int >::max() / 12 )
             {
                 tickDate = dt.addYears( years );
@@ -717,10 +717,10 @@
 class QwtDateScaleEngine::PrivateData
 {
-public:
-    PrivateData( Qt::TimeSpec spec ):
-        timeSpec( spec ),
-        utcOffset( 0 ),
-        week0Type( QwtDate::FirstThursday ),
-        maxWeeks( 4 )
+  public:
+    explicit PrivateData( Qt::TimeSpec spec )
+        : timeSpec( spec )
+        , utcOffset( 0 )
+        , week0Type( QwtDate::FirstThursday )
+        , maxWeeks( 4 )
     {
     }
@@ -734,19 +734,19 @@
 
 /*!
-  \brief Constructor
-
-  The engine is initialized to build scales for the
-  given time specification. It classifies intervals > 4 weeks
-  as >= Qt::Month. The first week of a year is defined like
-  for QwtDate::FirstThursday.
-
-  \param timeSpec Time specification
-
-  \sa setTimeSpec(), setMaxWeeks(), setWeek0Type()
+   \brief Constructor
+
+   The engine is initialized to build scales for the
+   given time specification. It classifies intervals > 4 weeks
+   as >= Qt::Month. The first week of a year is defined like
+   for QwtDate::FirstThursday.
+
+   \param timeSpec Time specification
+
+   \sa setTimeSpec(), setMaxWeeks(), setWeek0Type()
  */
-QwtDateScaleEngine::QwtDateScaleEngine( Qt::TimeSpec timeSpec ):
-    QwtLinearScaleEngine( 10 )
-{
-    d_data = new PrivateData( timeSpec );
+QwtDateScaleEngine::QwtDateScaleEngine( Qt::TimeSpec timeSpec )
+    : QwtLinearScaleEngine( 10 )
+{
+    m_data = new PrivateData( timeSpec );
 }
 
@@ -754,115 +754,115 @@
 QwtDateScaleEngine::~QwtDateScaleEngine()
 {
-    delete d_data;
+    delete m_data;
 }
 
 /*!
-  Set the time specification used by the engine
-
-  \param timeSpec Time specification
-  \sa timeSpec(), setUtcOffset(), toDateTime()
+   Set the time specification used by the engine
+
+   \param timeSpec Time specification
+   \sa timeSpec(), setUtcOffset(), toDateTime()
  */
 void QwtDateScaleEngine::setTimeSpec( Qt::TimeSpec timeSpec )
 {
-    d_data->timeSpec = timeSpec;
+    m_data->timeSpec = timeSpec;
 }
 
 /*!
-  \return Time specification used by the engine
-  \sa setTimeSpec(), utcOffset(), toDateTime()
+   \return Time specification used by the engine
+   \sa setTimeSpec(), utcOffset(), toDateTime()
  */
 Qt::TimeSpec QwtDateScaleEngine::timeSpec() const
 {
-    return d_data->timeSpec;
+    return m_data->timeSpec;
 }
 
 /*!
-  Set the offset in seconds from Coordinated Universal Time
-
-  \param seconds Offset in seconds
-
-  \note The offset has no effect beside for the time specification
+   Set the offset in seconds from Coordinated Universal Time
+
+   \param seconds Offset in seconds
+
+   \note The offset has no effect beside for the time specification
         Qt::OffsetFromUTC.
 
-  \sa QDate::utcOffset(), setTimeSpec(), toDateTime()
+   \sa QDate::utcOffset(), setTimeSpec(), toDateTime()
  */
 void QwtDateScaleEngine::setUtcOffset( int seconds )
 {
-    d_data->utcOffset = seconds;
+    m_data->utcOffset = seconds;
 }
 
 /*!
-  \return Offset in seconds from Coordinated Universal Time
-  \note The offset has no effect beside for the time specification
+   \return Offset in seconds from Coordinated Universal Time
+   \note The offset has no effect beside for the time specification
         Qt::OffsetFromUTC.
 
-  \sa QDate::setUtcOffset(), setTimeSpec(), toDateTime()
+   \sa QDate::setUtcOffset(), setTimeSpec(), toDateTime()
  */
 int QwtDateScaleEngine::utcOffset() const
 {
-    return d_data->utcOffset;
+    return m_data->utcOffset;
 }
 
 /*!
-  Sets how to identify the first week of a year.
-
-  \param week0Type Mode how to identify the first week of a year
-
-  \sa week0Type(), setMaxWeeks()
-  \note week0Type has no effect beside for intervals classified as
+   Sets how to identify the first week of a year.
+
+   \param week0Type Mode how to identify the first week of a year
+
+   \sa week0Type(), setMaxWeeks()
+   \note week0Type has no effect beside for intervals classified as
         QwtDate::Week.
  */
 void QwtDateScaleEngine::setWeek0Type( QwtDate::Week0Type week0Type )
 {
-    d_data->week0Type = week0Type;
+    m_data->week0Type = week0Type;
 }
 
 /*!
-  \return Setting how to identify the first week of a year.
-  \sa setWeek0Type(), maxWeeks()
+   \return Setting how to identify the first week of a year.
+   \sa setWeek0Type(), maxWeeks()
  */
 QwtDate::Week0Type QwtDateScaleEngine::week0Type() const
 {
-    return d_data->week0Type;
+    return m_data->week0Type;
 }
 
 /*!
-  Set a upper limit for the number of weeks, when an interval
-  can be classified as Qt::Week.
-
-  The default setting is 4 weeks.
-
-  \param weeks Upper limit for the number of weeks
-
-  \note In business charts a year is often divided
+   Set a upper limit for the number of weeks, when an interval
+   can be classified as Qt::Week.
+
+   The default setting is 4 weeks.
+
+   \param weeks Upper limit for the number of weeks
+
+   \note In business charts a year is often divided
         into weeks [1-52]
-  \sa maxWeeks(), setWeek0Type()
+   \sa maxWeeks(), setWeek0Type()
  */
 void QwtDateScaleEngine::setMaxWeeks( int weeks )
 {
-    d_data->maxWeeks = qMax( weeks, 0 );
+    m_data->maxWeeks = qMax( weeks, 0 );
 }
 
 /*!
-  \return Upper limit for the number of weeks, when an interval
+   \return Upper limit for the number of weeks, when an interval
           can be classified as Qt::Week.
-  \sa setMaxWeeks(), week0Type()
+   \sa setMaxWeeks(), week0Type()
  */
 int QwtDateScaleEngine::maxWeeks() const
 {
-    return d_data->maxWeeks;
+    return m_data->maxWeeks;
 }
 
 /*!
-  Classification of a date/time interval division
-
-  \param minDate Minimum ( = earlier ) of the interval
-  \param maxDate Maximum ( = later ) of the interval
-  \param maxSteps Maximum for the number of steps
-
-  \return Interval classification
+   Classification of a date/time interval division
+
+   \param minDate Minimum ( = earlier ) of the interval
+   \param maxDate Maximum ( = later ) of the interval
+   \param maxSteps Maximum for the number of steps
+
+   \return Interval classification
  */
 QwtDate::IntervalType QwtDateScaleEngine::intervalType(
-    const QDateTime &minDate, const QDateTime &maxDate,
+    const QDateTime& minDate, const QDateTime& maxDate,
     int maxSteps ) const
 {
@@ -880,5 +880,5 @@
     const int weeks = qwtRoundedIntervalWidth( minDate, maxDate, QwtDate::Week );
 
-    if ( weeks > d_data->maxWeeks )
+    if ( weeks > m_data->maxWeeks )
     {
         if ( days > 4 * maxSteps * 7 )
@@ -908,21 +908,21 @@
 
 /*!
-  Align and divide an interval
-
-  The algorithm aligns and divides the interval into steps.
-
-  Datetime interval divisions are usually not equidistant and the
-  calculated stepSize can only be used as an approximation
-  for the steps calculated by divideScale().
-
-  \param maxNumSteps Max. number of steps
-  \param x1 First limit of the interval (In/Out)
-  \param x2 Second limit of the interval (In/Out)
-  \param stepSize Step size (Out)
-
-  \sa QwtScaleEngine::setAttribute()
-*/
+   Align and divide an interval
+
+   The algorithm aligns and divides the interval into steps.
+
+   Datetime interval divisions are usually not equidistant and the
+   calculated stepSize can only be used as an approximation
+   for the steps calculated by divideScale().
+
+   \param maxNumSteps Max. number of steps
+   \param x1 First limit of the interval (In/Out)
+   \param x2 Second limit of the interval (In/Out)
+   \param stepSize Step size (Out)
+
+   \sa QwtScaleEngine::setAttribute()
+ */
 void QwtDateScaleEngine::autoScale( int maxNumSteps,
-    double &x1, double &x2, double &stepSize ) const
+    double& x1, double& x2, double& stepSize ) const
 {
     stepSize = 0.0;
@@ -989,5 +989,5 @@
                    calculates one.
    \return Calculated scale division
-*/
+ */
 QwtScaleDiv QwtDateScaleEngine::divideScale( double x1, double x2,
     int maxMajorSteps, int maxMinorSteps, double stepSize ) const
@@ -996,6 +996,6 @@
         maxMajorSteps = 1;
 
-    const double min = qMin( x1, x2 );
-    const double max = qMax( x1, x2 );
+    const double min = qwtMinF( x1, x2 );
+    const double max = qwtMaxF( x1, x2 );
 
     const QDateTime from = toDateTime( min );
@@ -1012,5 +1012,5 @@
         // the stepSize is used as a hint only
 
-        maxMajorSteps = qCeil( ( max - min ) / stepSize );
+        maxMajorSteps = qwtCeil( ( max - min ) / stepSize );
     }
 
@@ -1047,5 +1047,5 @@
 
 QwtScaleDiv QwtDateScaleEngine::buildScaleDiv(
-    const QDateTime &minDate, const QDateTime &maxDate,
+    const QDateTime& minDate, const QDateTime& maxDate,
     int maxMajorSteps, int maxMinorSteps,
     QwtDate::IntervalType intervalType ) const
@@ -1091,21 +1091,21 @@
 
 /*!
-  Align a date/time value for a step size
-
-  For Qt::Day alignments there is no "natural day 0" -
-  instead the first day of the year is used to avoid jumping
-  major ticks positions when panning a scale. For other alignments
-  ( f.e according to the first day of the month ) alignDate()
-  has to be overloaded.
-
-  \param dateTime Date/time value
-  \param stepSize Step size
-  \param intervalType Interval type
-  \param up When true dateTime is ceiled - otherwise it is floored
-
-  \return Aligned date/time value
+   Align a date/time value for a step size
+
+   For Qt::Day alignments there is no "natural day 0" -
+   instead the first day of the year is used to avoid jumping
+   major ticks positions when panning a scale. For other alignments
+   ( f.e according to the first day of the month ) alignDate()
+   has to be overloaded.
+
+   \param dateTime Date/time value
+   \param stepSize Step size
+   \param intervalType Interval type
+   \param up When true dateTime is ceiled - otherwise it is floored
+
+   \return Aligned date/time value
  */
 QDateTime QwtDateScaleEngine::alignDate(
-    const QDateTime &dateTime, double stepSize,
+    const QDateTime& dateTime, double stepSize,
     QwtDate::IntervalType intervalType, bool up ) const
 {
@@ -1116,5 +1116,9 @@
     if ( dateTime.timeSpec() == Qt::OffsetFromUTC )
     {
+#if QT_VERSION >= 0x050200
+        dt.setOffsetFromUtc( 0 );
+#else
         dt.setUtcOffset( 0 );
+#endif
     }
 
@@ -1124,5 +1128,5 @@
         {
             const int ms = qwtAlignValue(
-                dt.time().msec(), stepSize, up ) ;
+                dt.time().msec(), stepSize, up );
 
             dt = QwtDate::floor( dateTime, QwtDate::Second );
@@ -1204,5 +1208,5 @@
         {
             const QDate date = QwtDate::dateOfWeek0(
-                dt.date().year(), d_data->week0Type );
+                dt.date().year(), m_data->week0Type );
 
             int numWeeks = date.daysTo( dt.date() ) / 7;
@@ -1274,5 +1278,9 @@
     if ( dateTime.timeSpec() == Qt::OffsetFromUTC )
     {
+#if QT_VERSION >= 0x050200
+        dt.setOffsetFromUtc( dateTime.offsetFromUtc() );
+#else
         dt.setUtcOffset( dateTime.utcOffset() );
+#endif
     }
 
@@ -1281,14 +1289,14 @@
 
 /*!
-  Translate a double value into a QDateTime object.
-
-  For QDateTime result is bounded by QwtDate::minDate() and QwtDate::maxDate()
-
-  \return QDateTime object initialized with timeSpec() and utcOffset().
-  \sa timeSpec(), utcOffset(), QwtDate::toDateTime()
+   Translate a double value into a QDateTime object.
+
+   For QDateTime result is bounded by QwtDate::minDate() and QwtDate::maxDate()
+
+   \return QDateTime object initialized with timeSpec() and utcOffset().
+   \sa timeSpec(), utcOffset(), QwtDate::toDateTime()
  */
 QDateTime QwtDateScaleEngine::toDateTime( double value ) const
 {
-    QDateTime dt = QwtDate::toDateTime( value, d_data->timeSpec );
+    QDateTime dt = QwtDate::toDateTime( value, m_data->timeSpec );
     if ( !dt.isValid() )
     {
@@ -1296,11 +1304,15 @@
             ? QwtDate::minDate() : QwtDate::maxDate();
 
-        dt = QDateTime( date, QTime( 0, 0 ), d_data->timeSpec );
-    }
-
-    if ( d_data->timeSpec == Qt::OffsetFromUTC )
-    {
-        dt = dt.addSecs( d_data->utcOffset );
-        dt.setUtcOffset( d_data->utcOffset );
+        dt = QDateTime( date, QTime( 0, 0 ), m_data->timeSpec );
+    }
+
+    if ( m_data->timeSpec == Qt::OffsetFromUTC )
+    {
+        dt = dt.addSecs( m_data->utcOffset );
+#if QT_VERSION >= 0x050200
+        dt.setOffsetFromUtc( m_data->utcOffset );
+#else
+        dt.setUtcOffset( m_data->utcOffset );
+#endif
     }
 
Index: /trunk/BNC/qwt/qwt_date_scale_engine.h
===================================================================
--- /trunk/BNC/qwt/qwt_date_scale_engine.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_date_scale_engine.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -8,39 +8,40 @@
  *****************************************************************************/
 
-#ifndef _QWT_DATE_SCALE_ENGINE_H_
-#define _QWT_DATE_SCALE_ENGINE_H_ 1
+#ifndef QWT_DATE_SCALE_ENGINE_H
+#define QWT_DATE_SCALE_ENGINE_H
 
+#include "qwt_global.h"
 #include "qwt_date.h"
 #include "qwt_scale_engine.h"
 
 /*!
-  \brief A scale engine for date/time values
+   \brief A scale engine for date/time values
 
-  QwtDateScaleEngine builds scales from a time intervals.
-  Together with QwtDateScaleDraw it can be used for
-  axes according to date/time values.
+   QwtDateScaleEngine builds scales from a time intervals.
+   Together with QwtDateScaleDraw it can be used for
+   axes according to date/time values.
 
-  Years, months, weeks, days, hours and minutes are organized
-  in steps with non constant intervals. QwtDateScaleEngine
-  classifies intervals and aligns the boundaries and tick positions
-  according to this classification.
+   Years, months, weeks, days, hours and minutes are organized
+   in steps with non constant intervals. QwtDateScaleEngine
+   classifies intervals and aligns the boundaries and tick positions
+   according to this classification.
 
-  QwtDateScaleEngine supports representations depending
-  on Qt::TimeSpec specifications. The valid range for scales
-  is limited by the range of QDateTime, that differs
-  between Qt4 and Qt5.
+   QwtDateScaleEngine supports representations depending
+   on Qt::TimeSpec specifications. The valid range for scales
+   is limited by the range of QDateTime, that differs
+   between Qt4 and Qt5.
 
-  Datetime values are expected as the number of milliseconds since
-  1970-01-01T00:00:00 Universal Coordinated Time - also known
-  as "The Epoch", that can be converted to QDateTime using
-  QwtDate::toDateTime().
+   Datetime values are expected as the number of milliseconds since
+   1970-01-01T00:00:00 Universal Coordinated Time - also known
+   as "The Epoch", that can be converted to QDateTime using
+   QwtDate::toDateTime().
 
-  \sa QwtDate, QwtPlot::setAxisScaleEngine(),
+   \sa QwtDate, QwtPlot::setAxisScaleEngine(),
       QwtAbstractScale::setScaleEngine()
-*/
-class QWT_EXPORT QwtDateScaleEngine: public QwtLinearScaleEngine
+ */
+class QWT_EXPORT QwtDateScaleEngine : public QwtLinearScaleEngine
 {
-public:
-    QwtDateScaleEngine( Qt::TimeSpec = Qt::LocalTime );
+  public:
+    explicit QwtDateScaleEngine( Qt::TimeSpec = Qt::LocalTime );
     virtual ~QwtDateScaleEngine();
 
@@ -57,29 +58,30 @@
     int maxWeeks() const;
 
-    virtual void autoScale( int maxNumSteps,
-        double &x1, double &x2, double &stepSize ) const;
+    virtual void autoScale(
+        int maxNumSteps, double& x1, double& x2,
+        double& stepSize ) const QWT_OVERRIDE;
 
     virtual QwtScaleDiv divideScale(
         double x1, double x2,
         int maxMajorSteps, int maxMinorSteps,
-        double stepSize = 0.0 ) const;
+        double stepSize = 0.0 ) const QWT_OVERRIDE;
 
     virtual QwtDate::IntervalType intervalType(
-        const QDateTime &, const QDateTime &, int maxSteps ) const;
+        const QDateTime&, const QDateTime&, int maxSteps ) const;
 
     QDateTime toDateTime( double ) const;
 
-protected:
-    virtual QDateTime alignDate( const QDateTime &, double stepSize,
+  protected:
+    virtual QDateTime alignDate( const QDateTime&, double stepSize,
         QwtDate::IntervalType, bool up ) const;
 
-private:
-    QwtScaleDiv buildScaleDiv( const QDateTime &, const QDateTime &,
+  private:
+    QwtScaleDiv buildScaleDiv( const QDateTime&, const QDateTime&,
         int maxMajorSteps, int maxMinorSteps,
         QwtDate::IntervalType ) const;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_dial.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_dial.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_dial.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,17 +11,15 @@
 #include "qwt_dial_needle.h"
 #include "qwt_math.h"
-#include "qwt_scale_engine.h"
 #include "qwt_scale_map.h"
 #include "qwt_round_scale_draw.h"
 #include "qwt_painter.h"
+#include "qwt.h"
+
 #include <qpainter.h>
 #include <qpalette.h>
 #include <qpixmap.h>
 #include <qevent.h>
-#include <qalgorithms.h>
-#include <qmath.h>
 #include <qstyle.h>
 #include <qstyleoption.h>
-#include <qapplication.h>
 
 static inline double qwtAngleDist( double a1, double a2 )
@@ -77,15 +75,15 @@
 class QwtDial::PrivateData
 {
-public:
-    PrivateData():
-        frameShadow( Sunken ),
-        lineWidth( 0 ),
-        mode( RotateNeedle ),
-        origin( 90.0 ),
-        minScaleArc( 0.0 ),
-        maxScaleArc( 0.0 ),
-        needle( NULL ),
-        arcOffset( 0.0 ),
-        mouseOffset( 0.0 )
+  public:
+    PrivateData()
+        : frameShadow( Sunken )
+        , lineWidth( 0 )
+        , mode( RotateNeedle )
+        , origin( 90.0 )
+        , minScaleArc( 0.0 )
+        , maxScaleArc( 0.0 )
+        , needle( NULL )
+        , arcOffset( 0.0 )
+        , mouseOffset( 0.0 )
     {
     }
@@ -104,5 +102,5 @@
     double maxScaleArc;
 
-    QwtDialNeedle *needle;
+    QwtDialNeedle* needle;
 
     double arcOffset;
@@ -113,19 +111,19 @@
 
 /*!
-  \brief Constructor
-  \param parent Parent widget
-
-  Create a dial widget with no needle. The scale is initialized
-  to [ 0.0, 360.0 ] and 360 steps ( QwtAbstractSlider::setTotalSteps() ).
-  The origin of the scale is at 90°,
-
-  The value is set to 0.0.
-
-  The default mode is QwtDial::RotateNeedle.
-*/
-QwtDial::QwtDial( QWidget* parent ):
-    QwtAbstractSlider( parent )
-{
-    d_data = new PrivateData;
+   \brief Constructor
+   \param parent Parent widget
+
+   Create a dial widget with no needle. The scale is initialized
+   to [ 0.0, 360.0 ] and 360 steps ( QwtAbstractSlider::setTotalSteps() ).
+   The origin of the scale is at 90°,
+
+   The value is set to 0.0.
+
+   The default mode is QwtDial::RotateNeedle.
+ */
+QwtDial::QwtDial( QWidget* parent )
+    : QwtAbstractSlider( parent )
+{
+    m_data = new PrivateData;
 
     setFocusPolicy( Qt::TabFocus );
@@ -135,5 +133,5 @@
     {
         const QPalette::ColorGroup colorGroup =
-            static_cast<QPalette::ColorGroup>( i );
+            static_cast< QPalette::ColorGroup >( i );
 
         // Base: background color of the circle inside the frame.
@@ -161,20 +159,20 @@
 QwtDial::~QwtDial()
 {
-    delete d_data;
-}
-
-/*!
-  Sets the frame shadow value from the frame style.
-
-  \param shadow Frame shadow
-  \sa setLineWidth(), QFrame::setFrameShadow()
-*/
+    delete m_data;
+}
+
+/*!
+   Sets the frame shadow value from the frame style.
+
+   \param shadow Frame shadow
+   \sa setLineWidth(), QFrame::setFrameShadow()
+ */
 void QwtDial::setFrameShadow( Shadow shadow )
 {
-    if ( shadow != d_data->frameShadow )
+    if ( shadow != m_data->frameShadow )
     {
         invalidateCache();
 
-        d_data->frameShadow = shadow;
+        m_data->frameShadow = shadow;
         if ( lineWidth() > 0 )
             update();
@@ -183,18 +181,18 @@
 
 /*!
-  \return Frame shadow
-  /sa setFrameShadow(), lineWidth(), QFrame::frameShadow()
-*/
+   \return Frame shadow
+   /sa setFrameShadow(), lineWidth(), QFrame::frameShadow()
+ */
 QwtDial::Shadow QwtDial::frameShadow() const
 {
-    return d_data->frameShadow;
-}
-
-/*!
-  Sets the line width of the frame
-
-  \param lineWidth Line width
-  \sa setFrameShadow()
-*/
+    return m_data->frameShadow;
+}
+
+/*!
+   Sets the line width of the frame
+
+   \param lineWidth Line width
+   \sa setFrameShadow()
+ */
 void QwtDial::setLineWidth( int lineWidth )
 {
@@ -202,9 +200,9 @@
         lineWidth = 0;
 
-    if ( d_data->lineWidth != lineWidth )
+    if ( m_data->lineWidth != lineWidth )
     {
         invalidateCache();
 
-        d_data->lineWidth = lineWidth;
+        m_data->lineWidth = lineWidth;
         update();
     }
@@ -212,16 +210,16 @@
 
 /*!
-  \return Line width of the frame
-  \sa setLineWidth(), frameShadow(), lineWidth()
-*/
+   \return Line width of the frame
+   \sa setLineWidth(), frameShadow(), lineWidth()
+ */
 int QwtDial::lineWidth() const
 {
-    return d_data->lineWidth;
-}
-
-/*!
-  \return bounding rectangle of the circle inside the frame
-  \sa setLineWidth(), scaleInnerRect(), boundingRect()
-*/
+    return m_data->lineWidth;
+}
+
+/*!
+   \return bounding rectangle of the circle inside the frame
+   \sa setLineWidth(), scaleInnerRect(), boundingRect()
+ */
 QRect QwtDial::innerRect() const
 {
@@ -231,7 +229,7 @@
 
 /*!
-  \return bounding rectangle of the dial including the frame
-  \sa setLineWidth(), scaleInnerRect(), innerRect()
-*/
+   \return bounding rectangle of the dial including the frame
+   \sa setLineWidth(), scaleInnerRect(), innerRect()
+ */
 QRect QwtDial::boundingRect() const
 {
@@ -247,15 +245,15 @@
 
 /*!
-  \return rectangle inside the scale
-  \sa setLineWidth(), boundingRect(), innerRect()
-*/
+   \return rectangle inside the scale
+   \sa setLineWidth(), boundingRect(), innerRect()
+ */
 QRect QwtDial::scaleInnerRect() const
 {
     QRect rect = innerRect();
 
-    const QwtAbstractScaleDraw *sd = scaleDraw();
+    const QwtAbstractScaleDraw* sd = scaleDraw();
     if ( sd )
     {
-        int scaleDist = qCeil( sd->extent( font() ) );
+        int scaleDist = qwtCeil( sd->extent( font() ) );
         scaleDist++; // margin
 
@@ -267,22 +265,22 @@
 
 /*!
-  \brief Change the mode of the dial.
-  \param mode New mode
-
-  In case of QwtDial::RotateNeedle the needle is rotating, in case of
-  QwtDial::RotateScale, the needle points to origin()
-  and the scale is rotating.
-
-  The default mode is QwtDial::RotateNeedle.
-
-  \sa mode(), setValue(), setOrigin()
-*/
+   \brief Change the mode of the dial.
+   \param mode New mode
+
+   In case of QwtDial::RotateNeedle the needle is rotating, in case of
+   QwtDial::RotateScale, the needle points to origin()
+   and the scale is rotating.
+
+   The default mode is QwtDial::RotateNeedle.
+
+   \sa mode(), setValue(), setOrigin()
+ */
 void QwtDial::setMode( Mode mode )
 {
-    if ( mode != d_data->mode )
+    if ( mode != m_data->mode )
     {
         invalidateCache();
 
-        d_data->mode = mode;
+        m_data->mode = mode;
         sliderChange();
     }
@@ -290,18 +288,18 @@
 
 /*!
-  \return Mode of the dial.
-  \sa setMode(), origin(), setScaleArc(), value()
-*/
+   \return Mode of the dial.
+   \sa setMode(), origin(), setScaleArc(), value()
+ */
 QwtDial::Mode QwtDial::mode() const
 {
-    return d_data->mode;
-}
-
-/*!
-  Invalidate the internal caches used to speed up repainting
+    return m_data->mode;
+}
+
+/*!
+   Invalidate the internal caches used to speed up repainting
  */
 void QwtDial::invalidateCache()
 {
-    d_data->pixmapCache = QPixmap();
+    m_data->pixmapCache = QPixmap();
 }
 
@@ -309,6 +307,6 @@
    Paint the dial
    \param event Paint event
-*/
-void QwtDial::paintEvent( QPaintEvent *event )
+ */
+void QwtDial::paintEvent( QPaintEvent* event )
 {
     QPainter painter( this );
@@ -316,8 +314,8 @@
 
     QStyleOption opt;
-    opt.init(this);
+    opt.initFrom(this);
     style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
 
-    if ( d_data->mode == QwtDial::RotateScale )
+    if ( m_data->mode == QwtDial::RotateScale )
     {
         painter.save();
@@ -330,14 +328,14 @@
 
     const QRect r = contentsRect();
-    if ( r.size() != d_data->pixmapCache.size() )
-    {
-        d_data->pixmapCache = QwtPainter::backingStore( this, r.size() );
-        d_data->pixmapCache.fill( Qt::transparent );
-
-        QPainter p( &d_data->pixmapCache );
+    if ( r.size() != m_data->pixmapCache.size() )
+    {
+        m_data->pixmapCache = QwtPainter::backingStore( this, r.size() );
+        m_data->pixmapCache.fill( Qt::transparent );
+
+        QPainter p( &m_data->pixmapCache );
         p.setRenderHint( QPainter::Antialiasing, true );
         p.translate( -r.topLeft() );
 
-        if ( d_data->mode != QwtDial::RotateScale )
+        if ( m_data->mode != QwtDial::RotateScale )
             drawContents( &p );
 
@@ -345,11 +343,11 @@
             drawFrame( &p );
 
-        if ( d_data->mode != QwtDial::RotateNeedle )
+        if ( m_data->mode != QwtDial::RotateNeedle )
             drawNeedle( &p );
     }
 
-    painter.drawPixmap( r.topLeft(), d_data->pixmapCache );
-
-    if ( d_data->mode == QwtDial::RotateNeedle )
+    painter.drawPixmap( r.topLeft(), m_data->pixmapCache );
+
+    if ( m_data->mode == QwtDial::RotateNeedle )
         drawNeedle( &painter );
 
@@ -359,8 +357,8 @@
 
 /*!
-  Draw the focus indicator
-  \param painter Painter
-*/
-void QwtDial::drawFocusIndicator( QPainter *painter ) const
+   Draw the focus indicator
+   \param painter Painter
+ */
+void QwtDial::drawFocusIndicator( QPainter* painter ) const
 {
     QwtPainter::drawFocusRect( painter, this, boundingRect() );
@@ -368,32 +366,32 @@
 
 /*!
-  Draw the frame around the dial
-
-  \param painter Painter
-  \sa lineWidth(), frameShadow()
-*/
-void QwtDial::drawFrame( QPainter *painter )
+   Draw the frame around the dial
+
+   \param painter Painter
+   \sa lineWidth(), frameShadow()
+ */
+void QwtDial::drawFrame( QPainter* painter )
 {
     QwtPainter::drawRoundFrame( painter, boundingRect(),
-        palette(), lineWidth(), d_data->frameShadow );
-}
-
-/*!
-  \brief Draw the contents inside the frame
-
-  QPalette::Window is the background color outside of the frame.
-  QPalette::Base is the background color inside the frame.
-  QPalette::WindowText is the background color inside the scale.
-
-  \param painter Painter
-
-  \sa boundingRect(), innerRect(),
+        palette(), lineWidth(), m_data->frameShadow );
+}
+
+/*!
+   \brief Draw the contents inside the frame
+
+   QPalette::Window is the background color outside of the frame.
+   QPalette::Base is the background color inside the frame.
+   QPalette::WindowText is the background color inside the scale.
+
+   \param painter Painter
+
+   \sa boundingRect(), innerRect(),
     scaleInnerRect(), QWidget::setPalette()
-*/
-void QwtDial::drawContents( QPainter *painter ) const
+ */
+void QwtDial::drawContents( QPainter* painter ) const
 {
     if ( testAttribute( Qt::WA_NoSystemBackground ) ||
         palette().brush( QPalette::Base ) !=
-            palette().brush( QPalette::Window ) )
+        palette().brush( QPalette::Window ) )
     {
         const QRectF br = boundingRect();
@@ -408,5 +406,5 @@
     const QRectF insideScaleRect = scaleInnerRect();
     if ( palette().brush( QPalette::WindowText ) !=
-            palette().brush( QPalette::Base ) )
+        palette().brush( QPalette::Base ) )
     {
         painter->save();
@@ -430,23 +428,23 @@
 
 /*!
-  Draw the needle
-
-  \param painter Painter
-  \param center Center of the dial
-  \param radius Length for the needle
-  \param direction Direction of the needle in degrees, counter clockwise
-  \param colorGroup ColorGroup
-*/
-void QwtDial::drawNeedle( QPainter *painter, const QPointF &center,
+   Draw the needle
+
+   \param painter Painter
+   \param center Center of the dial
+   \param radius Length for the needle
+   \param direction Direction of the needle in degrees, counter clockwise
+   \param colorGroup ColorGroup
+ */
+void QwtDial::drawNeedle( QPainter* painter, const QPointF& center,
     double radius, double direction, QPalette::ColorGroup colorGroup ) const
 {
-    if ( d_data->needle )
+    if ( m_data->needle )
     {
         direction = 360.0 - direction; // counter clockwise
-        d_data->needle->draw( painter, center, radius, direction, colorGroup );
-    }
-}
-
-void QwtDial::drawNeedle( QPainter *painter ) const
+        m_data->needle->draw( painter, center, radius, direction, colorGroup );
+    }
+}
+
+void QwtDial::drawNeedle( QPainter* painter ) const
 {
     if ( !isValid() )
@@ -469,14 +467,14 @@
 
 /*!
-  Draw the scale
-
-  \param painter Painter
-  \param center Center of the dial
-  \param radius Radius of the scale
-*/
-void QwtDial::drawScale( QPainter *painter,
-    const QPointF &center, double radius ) const
-{
-    QwtRoundScaleDraw *sd = const_cast<QwtRoundScaleDraw *>( scaleDraw() );
+   Draw the scale
+
+   \param painter Painter
+   \param center Center of the dial
+   \param radius Radius of the scale
+ */
+void QwtDial::drawScale( QPainter* painter,
+    const QPointF& center, double radius ) const
+{
+    QwtRoundScaleDraw* sd = const_cast< QwtRoundScaleDraw* >( scaleDraw() );
     if ( sd == NULL )
         return;
@@ -491,5 +489,5 @@
 
     painter->setFont( font() );
-    painter->setPen( QPen( textColor, sd->penWidth() ) );
+    painter->setPen( QPen( textColor, sd->penWidthF() ) );
 
     painter->setBrush( Qt::red );
@@ -498,14 +496,14 @@
 
 /*!
-  Draw the contents inside the scale
-
-  Paints nothing.
-
-  \param painter Painter
-  \param center Center of the contents circle
-  \param radius Radius of the contents circle
-*/
-void QwtDial::drawScaleContents( QPainter *painter,
-    const QPointF &center, double radius ) const
+   Draw the contents inside the scale
+
+   Paints nothing.
+
+   \param painter Painter
+   \param center Center of the contents circle
+   \param radius Radius of the contents circle
+ */
+void QwtDial::drawScaleContents( QPainter* painter,
+    const QPointF& center, double radius ) const
 {
     Q_UNUSED(painter);
@@ -515,19 +513,19 @@
 
 /*!
-  Set a needle for the dial
-
-  \param needle Needle
-
-  \warning The needle will be deleted, when a different needle is
+   Set a needle for the dial
+
+   \param needle Needle
+
+   \warning The needle will be deleted, when a different needle is
            set or in ~QwtDial()
-*/
-void QwtDial::setNeedle( QwtDialNeedle *needle )
-{
-    if ( needle != d_data->needle )
-    {
-        if ( d_data->needle )
-            delete d_data->needle;
-
-        d_data->needle = needle;
+ */
+void QwtDial::setNeedle( QwtDialNeedle* needle )
+{
+    if ( needle != m_data->needle )
+    {
+        if ( m_data->needle )
+            delete m_data->needle;
+
+        m_data->needle = needle;
         update();
     }
@@ -535,44 +533,44 @@
 
 /*!
-  \return needle
-  \sa setNeedle()
-*/
-const QwtDialNeedle *QwtDial::needle() const
-{
-    return d_data->needle;
-}
-
-/*!
-  \return needle
-  \sa setNeedle()
-*/
-QwtDialNeedle *QwtDial::needle()
-{
-    return d_data->needle;
+   \return needle
+   \sa setNeedle()
+ */
+const QwtDialNeedle* QwtDial::needle() const
+{
+    return m_data->needle;
+}
+
+/*!
+   \return needle
+   \sa setNeedle()
+ */
+QwtDialNeedle* QwtDial::needle()
+{
+    return m_data->needle;
 }
 
 //! \return the scale draw
-QwtRoundScaleDraw *QwtDial::scaleDraw()
-{
-    return static_cast<QwtRoundScaleDraw *>( abstractScaleDraw() );
+QwtRoundScaleDraw* QwtDial::scaleDraw()
+{
+    return static_cast< QwtRoundScaleDraw* >( abstractScaleDraw() );
 }
 
 //! \return the scale draw
-const QwtRoundScaleDraw *QwtDial::scaleDraw() const
-{
-    return static_cast<const QwtRoundScaleDraw *>( abstractScaleDraw() );
-}
-
-/*!
-  Set an individual scale draw
-
-  The motivation for setting a scale draw is often
-  to overload QwtRoundScaleDraw::label() to return
-  individual tick labels.
-
-  \param scaleDraw Scale draw
-  \warning The previous scale draw is deleted
-*/
-void QwtDial::setScaleDraw( QwtRoundScaleDraw *scaleDraw )
+const QwtRoundScaleDraw* QwtDial::scaleDraw() const
+{
+    return static_cast< const QwtRoundScaleDraw* >( abstractScaleDraw() );
+}
+
+/*!
+   Set an individual scale draw
+
+   The motivation for setting a scale draw is often
+   to overload QwtRoundScaleDraw::label() to return
+   individual tick labels.
+
+   \param scaleDraw Scale draw
+   \warning The previous scale draw is deleted
+ */
+void QwtDial::setScaleDraw( QwtRoundScaleDraw* scaleDraw )
 {
     setAbstractScaleDraw( scaleDraw );
@@ -581,29 +579,29 @@
 
 /*!
-  Change the arc of the scale
-
-  \param minArc Lower limit
-  \param maxArc Upper limit
-
-  \sa minScaleArc(), maxScaleArc()
-*/
+   Change the arc of the scale
+
+   \param minArc Lower limit
+   \param maxArc Upper limit
+
+   \sa minScaleArc(), maxScaleArc()
+ */
 void QwtDial::setScaleArc( double minArc, double maxArc )
 {
     if ( minArc != 360.0 && minArc != -360.0 )
-        minArc = ::fmod( minArc, 360.0 );
+        minArc = std::fmod( minArc, 360.0 );
     if ( maxArc != 360.0 && maxArc != -360.0 )
-        maxArc = ::fmod( maxArc, 360.0 );
-
-    double minScaleArc = qMin( minArc, maxArc );
-    double maxScaleArc = qMax( minArc, maxArc );
+        maxArc = std::fmod( maxArc, 360.0 );
+
+    double minScaleArc = qwtMinF( minArc, maxArc );
+    double maxScaleArc = qwtMaxF( minArc, maxArc );
 
     if ( maxScaleArc - minScaleArc > 360.0 )
         maxScaleArc = minScaleArc + 360.0;
 
-    if ( ( minScaleArc != d_data->minScaleArc ) ||
-        ( maxScaleArc != d_data->maxScaleArc ) )
-    {
-        d_data->minScaleArc = minScaleArc;
-        d_data->maxScaleArc = maxScaleArc;
+    if ( ( minScaleArc != m_data->minScaleArc ) ||
+        ( maxScaleArc != m_data->maxScaleArc ) )
+    {
+        m_data->minScaleArc = minScaleArc;
+        m_data->maxScaleArc = maxScaleArc;
 
         invalidateCache();
@@ -613,79 +611,79 @@
 
 /*!
-  Set the lower limit for the scale arc
-
-  \param min Lower limit of the scale arc
-  \sa setScaleArc(), setMaxScaleArc()
+   Set the lower limit for the scale arc
+
+   \param min Lower limit of the scale arc
+   \sa setScaleArc(), setMaxScaleArc()
  */
 void QwtDial::setMinScaleArc( double min )
 {
-    setScaleArc( min, d_data->maxScaleArc );
-}
-
-/*!
-  \return Lower limit of the scale arc
-  \sa setScaleArc()
-*/
+    setScaleArc( min, m_data->maxScaleArc );
+}
+
+/*!
+   \return Lower limit of the scale arc
+   \sa setScaleArc()
+ */
 double QwtDial::minScaleArc() const
 {
-    return d_data->minScaleArc;
-}
-
-/*!
-  Set the upper limit for the scale arc
-
-  \param max Upper limit of the scale arc
-  \sa setScaleArc(), setMinScaleArc()
+    return m_data->minScaleArc;
+}
+
+/*!
+   Set the upper limit for the scale arc
+
+   \param max Upper limit of the scale arc
+   \sa setScaleArc(), setMinScaleArc()
  */
 void QwtDial::setMaxScaleArc( double max )
 {
-    setScaleArc( d_data->minScaleArc, max );
-}
-
-/*!
-  \return Upper limit of the scale arc
-  \sa setScaleArc()
-*/
+    setScaleArc( m_data->minScaleArc, max );
+}
+
+/*!
+   \return Upper limit of the scale arc
+   \sa setScaleArc()
+ */
 double QwtDial::maxScaleArc() const
 {
-    return d_data->maxScaleArc;
-}
-
-/*!
-  \brief Change the origin
-
-  The origin is the angle where scale and needle is relative to.
-
-  \param origin New origin
-  \sa origin()
-*/
+    return m_data->maxScaleArc;
+}
+
+/*!
+   \brief Change the origin
+
+   The origin is the angle where scale and needle is relative to.
+
+   \param origin New origin
+   \sa origin()
+ */
 void QwtDial::setOrigin( double origin )
 {
     invalidateCache();
 
-    d_data->origin = origin;
+    m_data->origin = origin;
     sliderChange();
 }
 
 /*!
-  The origin is the angle where scale and needle is relative to.
-
-  \return Origin of the dial
-  \sa setOrigin()
-*/
+   The origin is the angle where scale and needle is relative to.
+
+   \return Origin of the dial
+   \sa setOrigin()
+ */
 double QwtDial::origin() const
 {
-    return d_data->origin;
-}
-
-/*!
-  \return Size hint
-  \sa minimumSizeHint()
-*/
+    return m_data->origin;
+}
+
+/*!
+   \return Size hint
+   \sa minimumSizeHint()
+ */
 QSize QwtDial::sizeHint() const
 {
     int sh = 0;
     if ( scaleDraw() )
-        sh = qCeil( scaleDraw()->extent( font() ) );
+        sh = qwtCeil( scaleDraw()->extent( font() ) );
 
     const int d = 6 * sh + 2 * lineWidth();
@@ -693,5 +691,5 @@
     QSize hint( d, d );
     if ( !isReadOnly() )
-        hint = hint.expandedTo( QApplication::globalStrut() );
+        hint = qwtExpandedToGlobalStrut( hint );
 
     return hint;
@@ -699,12 +697,12 @@
 
 /*!
-  \return Minimum size hint
-  \sa sizeHint()
-*/
+   \return Minimum size hint
+   \sa sizeHint()
+ */
 QSize QwtDial::minimumSizeHint() const
 {
     int sh = 0;
     if ( scaleDraw() )
-        sh = qCeil( scaleDraw()->extent( font() ) );
+        sh = qwtCeil( scaleDraw()->extent( font() ) );
 
     const int d = 3 * sh + 2 * lineWidth();
@@ -714,12 +712,12 @@
 
 /*!
-  \brief Determine what to do when the user presses a mouse button.
-
-  \param pos Mouse position
-
-  \retval True, when the inner circle contains pos
-  \sa scrolledTo()
-*/
-bool QwtDial::isScrollPosition( const QPoint &pos ) const
+   \brief Determine what to do when the user presses a mouse button.
+
+   \param pos Mouse position
+
+   \retval True, when the inner circle contains pos
+   \sa scrolledTo()
+ */
+bool QwtDial::isScrollPosition( const QPoint& pos ) const
 {
     const QRegion region( innerRect(), QRegion::Ellipse );
@@ -727,5 +725,5 @@
     {
         double angle = QLineF( rect().center(), pos ).angle();
-        if ( d_data->mode == QwtDial::RotateScale )
+        if ( m_data->mode == QwtDial::RotateScale )
             angle = 360.0 - angle;
 
@@ -733,6 +731,6 @@
             qwtNormalizeDegrees( 90.0 - scaleMap().transform( value() ) );
 
-        d_data->mouseOffset = qwtNormalizeDegrees( angle - valueAngle );
-        d_data->arcOffset = scaleMap().p1();
+        m_data->mouseOffset = qwtNormalizeDegrees( angle - valueAngle );
+        m_data->arcOffset = scaleMap().p1();
 
         return true;
@@ -743,22 +741,22 @@
 
 /*!
-  \brief Determine the value for a new position of the
+   \brief Determine the value for a new position of the
          slider handle.
 
-  \param pos Mouse position
-
-  \return Value for the mouse position
-  \sa isScrollPosition()
-*/
-double QwtDial::scrolledTo( const QPoint &pos ) const
+   \param pos Mouse position
+
+   \return Value for the mouse position
+   \sa isScrollPosition()
+ */
+double QwtDial::scrolledTo( const QPoint& pos ) const
 {
     double angle = QLineF( rect().center(), pos ).angle();
-    if ( d_data->mode == QwtDial::RotateScale )
-    {
-        angle += scaleMap().p1() - d_data->arcOffset;
+    if ( m_data->mode == QwtDial::RotateScale )
+    {
+        angle += scaleMap().p1() - m_data->arcOffset;
         angle = 360.0 - angle;
     }
 
-    angle = qwtNormalizeDegrees( angle - d_data->mouseOffset );
+    angle = qwtNormalizeDegrees( angle - m_data->mouseOffset );
     angle = qwtNormalizeDegrees( 90.0 - angle );
 
@@ -779,5 +777,5 @@
             }
 
-            d_data->mouseOffset += ( boundedAngle - angle );
+            m_data->mouseOffset += ( boundedAngle - angle );
 
             angle = boundedAngle;
@@ -790,5 +788,5 @@
 
         if ( !wrapping() )
-            d_data->mouseOffset += ( boundedAngle - angle );
+            m_data->mouseOffset += ( boundedAngle - angle );
 
         angle = boundedAngle;
@@ -799,10 +797,10 @@
 
 /*!
-  Change Event handler
-  \param event Change event
-
-  Invalidates internal paint caches if necessary
-*/
-void QwtDial::changeEvent( QEvent *event )
+   Change Event handler
+   \param event Change event
+
+   Invalidates internal paint caches if necessary
+ */
+void QwtDial::changeEvent( QEvent* event )
 {
     switch( event->type() )
@@ -826,11 +824,17 @@
 
 /*!
-  Wheel Event handler
-  \param event Wheel event
-*/
-void QwtDial::wheelEvent( QWheelEvent *event )
-{
+   Wheel Event handler
+   \param event Wheel event
+ */
+void QwtDial::wheelEvent( QWheelEvent* event )
+{
+#if QT_VERSION < 0x050e00
+    const QPoint wheelPos = event->pos();
+#else
+    const QPoint wheelPos = event->position().toPoint();
+#endif
+
     const QRegion region( innerRect(), QRegion::Ellipse );
-    if ( region.contains( event->pos() ) )
+    if ( region.contains( wheelPos ) )
         QwtAbstractSlider::wheelEvent( event );
 }
@@ -838,6 +842,5 @@
 void QwtDial::setAngleRange( double angle, double span )
 {
-    QwtRoundScaleDraw *sd = const_cast<QwtRoundScaleDraw *>( scaleDraw() );
-    if ( sd  )
+    if ( QwtRoundScaleDraw* sd = scaleDraw() )
     {
         angle = qwtNormalizeDegrees( angle - 270.0 );
@@ -847,6 +850,6 @@
 
 /*!
-  Invalidate the internal caches and call
-  QwtAbstractSlider::scaleChange()
+   Invalidate the internal caches and call
+   QwtAbstractSlider::scaleChange()
  */
 void QwtDial::scaleChange()
@@ -858,14 +861,16 @@
 void QwtDial::sliderChange()
 {
-    setAngleRange( d_data->origin + d_data->minScaleArc,
-        d_data->maxScaleArc - d_data->minScaleArc );
+    setAngleRange( m_data->origin + m_data->minScaleArc,
+        m_data->maxScaleArc - m_data->minScaleArc );
 
     if ( mode() == RotateScale )
     {
         const double arc = scaleMap().transform( value() ) - scaleMap().p1();
-        setAngleRange( d_data->origin - arc,
-            d_data->maxScaleArc - d_data->minScaleArc );
+        setAngleRange( m_data->origin - arc,
+            m_data->maxScaleArc - m_data->minScaleArc );
     }
 
     QwtAbstractSlider::sliderChange();
 }
+
+#include "moc_qwt_dial.cpp"
Index: /trunk/BNC/qwt/qwt_dial.h
===================================================================
--- /trunk/BNC/qwt/qwt_dial.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_dial.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,9 +9,9 @@
 
 #ifndef QWT_DIAL_H
-#define QWT_DIAL_H 1
+#define QWT_DIAL_H
 
 #include "qwt_global.h"
 #include "qwt_abstract_slider.h"
-#include "qwt_abstract_scale_draw.h"
+
 #include <qframe.h>
 #include <qpalette.h>
@@ -19,33 +19,34 @@
 class QwtDialNeedle;
 class QwtRoundScaleDraw;
+class QwtAbstractScaleDraw;
 
 /*!
-  \brief QwtDial class provides a rounded range control.
+   \brief QwtDial class provides a rounded range control.
 
-  QwtDial is intended as base class for dial widgets like
-  speedometers, compass widgets, clocks ...
+   QwtDial is intended as base class for dial widgets like
+   speedometers, compass widgets, clocks ...
 
-  \image html dials2.png
+   \image html dials2.png
 
-  A dial contains a scale and a needle indicating the current value
-  of the dial. Depending on Mode one of them is fixed and the
-  other is rotating. If not isReadOnly() the
-  dial can be rotated by dragging the mouse or using keyboard inputs
-  (see QwtAbstractSlider::keyPressEvent()). A dial might be wrapping, what means
-  a rotation below/above one limit continues on the other limit (f.e compass).
-  The scale might cover any arc of the dial, its values are related to
-  the origin() of the dial.
+   A dial contains a scale and a needle indicating the current value
+   of the dial. Depending on Mode one of them is fixed and the
+   other is rotating. If not isReadOnly() the
+   dial can be rotated by dragging the mouse or using keyboard inputs
+   (see QwtAbstractSlider::keyPressEvent()). A dial might be wrapping, what means
+   a rotation below/above one limit continues on the other limit (f.e compass).
+   The scale might cover any arc of the dial, its values are related to
+   the origin() of the dial.
 
-  Often dials have to be updated very often according to values from external
-  devices. For these high refresh rates QwtDial caches as much as possible.
-  For derived classes it might be necessary to clear these caches manually
-  according to attribute changes using invalidateCache().
+   Often dials have to be updated very often according to values from external
+   devices. For these high refresh rates QwtDial caches as much as possible.
+   For derived classes it might be necessary to clear these caches manually
+   according to attribute changes using invalidateCache().
 
-  \sa QwtCompass, QwtAnalogClock, QwtDialNeedle
-  \note The controls and dials examples shows different types of dials.
-  \note QDial is more similar to QwtKnob than to QwtDial
-*/
+   \sa QwtCompass, QwtAnalogClock, QwtDialNeedle
+   \note The controls and dials examples shows different types of dials.
+   \note QDial is more similar to QwtKnob than to QwtDial
+ */
 
-class QWT_EXPORT QwtDial: public QwtAbstractSlider
+class QWT_EXPORT QwtDial : public QwtAbstractSlider
 {
     Q_OBJECT
@@ -60,5 +61,5 @@
     Q_PROPERTY( double maxScaleArc READ maxScaleArc WRITE setMaxScaleArc )
 
-public:
+  public:
 
     /*!
@@ -92,5 +93,5 @@
     };
 
-    explicit QwtDial( QWidget *parent = NULL );
+    explicit QwtDial( QWidget* parent = NULL );
     virtual ~QwtDial();
 
@@ -115,7 +116,7 @@
     double origin() const;
 
-    void setNeedle( QwtDialNeedle * );
-    const QwtDialNeedle *needle() const;
-    QwtDialNeedle *needle();
+    void setNeedle( QwtDialNeedle* );
+    const QwtDialNeedle* needle() const;
+    QwtDialNeedle* needle();
 
     QRect boundingRect() const;
@@ -124,44 +125,44 @@
     virtual QRect scaleInnerRect() const;
 
-    virtual QSize sizeHint() const;
-    virtual QSize minimumSizeHint() const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
+    virtual QSize minimumSizeHint() const QWT_OVERRIDE;
 
-    void setScaleDraw( QwtRoundScaleDraw * );
+    void setScaleDraw( QwtRoundScaleDraw* );
 
-    QwtRoundScaleDraw *scaleDraw();
-    const QwtRoundScaleDraw *scaleDraw() const;
+    QwtRoundScaleDraw* scaleDraw();
+    const QwtRoundScaleDraw* scaleDraw() const;
 
-protected:
-    virtual void wheelEvent( QWheelEvent * );
-    virtual void paintEvent( QPaintEvent * );
-    virtual void changeEvent( QEvent * );
+  protected:
+    virtual void wheelEvent( QWheelEvent* ) QWT_OVERRIDE;
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
+    virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
 
-    virtual void drawFrame( QPainter * );
-    virtual void drawContents( QPainter * ) const;
-    virtual void drawFocusIndicator( QPainter * ) const;
+    virtual void drawFrame( QPainter* );
+    virtual void drawContents( QPainter* ) const;
+    virtual void drawFocusIndicator( QPainter* ) const;
 
     void invalidateCache();
 
-    virtual void drawScale( QPainter *,
-        const QPointF &center, double radius ) const;
+    virtual void drawScale( QPainter*,
+        const QPointF& center, double radius ) const;
 
-    virtual void drawScaleContents( QPainter *painter,
-        const QPointF &center, double radius ) const;
+    virtual void drawScaleContents( QPainter* painter,
+        const QPointF& center, double radius ) const;
 
-    virtual void drawNeedle( QPainter *, const QPointF &,
+    virtual void drawNeedle( QPainter*, const QPointF&,
         double radius, double direction, QPalette::ColorGroup ) const;
 
-    virtual double scrolledTo( const QPoint & ) const;
-    virtual bool isScrollPosition( const QPoint & ) const;
+    virtual double scrolledTo( const QPoint& ) const QWT_OVERRIDE;
+    virtual bool isScrollPosition( const QPoint& ) const QWT_OVERRIDE;
 
-    virtual void sliderChange();
-    virtual void scaleChange();
+    virtual void sliderChange() QWT_OVERRIDE;
+    virtual void scaleChange() QWT_OVERRIDE;
 
-private:
+  private:
     void setAngleRange( double angle, double span );
-    void drawNeedle( QPainter * ) const;
+    void drawNeedle( QPainter* ) const;
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_dial_needle.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_dial_needle.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_dial_needle.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,31 +9,25 @@
 
 #include "qwt_dial_needle.h"
-#include "qwt_global.h"
 #include "qwt_math.h"
-#include "qwt_painter.h"
+
 #include <qapplication.h>
 #include <qpainter.h>
 #include <qpainterpath.h>
-
-#if QT_VERSION < 0x040601
-#define qFastSin(x) qSin(x)
-#define qFastCos(x) qCos(x)
-#endif
-
-static void qwtDrawStyle1Needle( QPainter *painter,
-    const QPalette &palette, QPalette::ColorGroup colorGroup,
-    double length )
-{
-    const double r[] = { 0.4, 0.3, 1, 0.8, 1, 0.3, 0.4 };
-    const double a[] = { -45, -20, -15, 0, 15, 20, 45 };
+#include <qmath.h>
+
+static void qwtDrawStyle1Needle( QPainter* painter,
+    const QPalette& palette, QPalette::ColorGroup colorGroup, qreal length )
+{
+    const qreal r[] = { 0.4, 0.3, 1, 0.8, 1, 0.3, 0.4 };
+    const qreal a[] = { -45, -20, -15, 0, 15, 20, 45 };
 
     QPainterPath path;
     for ( int i = 0; i < 7; i++ )
     {
-        const double angle = a[i] / 180.0 * M_PI;
-        const double radius = r[i] * length;
-
-        const double x = radius * qFastCos( angle );
-        const double y = radius * qFastSin( angle );
+        const qreal angle = a[i] / 180.0 * M_PI;
+        const qreal radius = r[i] * length;
+
+        const qreal x = radius * qFastCos( angle );
+        const qreal y = radius * qFastSin( angle );
 
         path.lineTo( x, -y );
@@ -45,9 +39,9 @@
 }
 
-static void qwtDrawStyle2Needle( QPainter *painter,
-    const QPalette &palette, QPalette::ColorGroup colorGroup, double length )
-{
-    const double ratioX = 0.7;
-    const double ratioY = 0.3;
+static void qwtDrawStyle2Needle( QPainter* painter,
+    const QPalette& palette, QPalette::ColorGroup colorGroup, qreal length )
+{
+    const qreal ratioX = 0.7;
+    const qreal ratioY = 0.3;
 
     QPainterPath path1;
@@ -68,11 +62,11 @@
 }
 
-static void qwtDrawShadedPointer( QPainter *painter,
-    const QColor &lightColor, const QColor &darkColor,
-    double length, double width )
-{
-    const double peak = qMax( length / 10.0, 5.0 );
-
-    const double knobWidth = width + 8;
+static void qwtDrawShadedPointer( QPainter* painter,
+    const QColor& lightColor, const QColor& darkColor,
+    qreal length, qreal width )
+{
+    const qreal peak = qwtMaxF( length / 10.0, 5.0 );
+
+    const qreal knobWidth = width + 8;
     QRectF knobRect( 0, 0, knobWidth, knobWidth );
     knobRect.moveCenter( QPointF(0, 0) );
@@ -109,12 +103,12 @@
 }
 
-static void qwtDrawArrowNeedle( QPainter *painter,
-    const QPalette &palette, QPalette::ColorGroup colorGroup,
-    double length, double width )
+static void qwtDrawArrowNeedle( QPainter* painter,
+    const QPalette& palette, QPalette::ColorGroup colorGroup,
+    qreal length, qreal width )
 {
     if ( width <= 0 )
-        width = qMax( length * 0.06, 9.0 );
-
-    const double peak = qMax( 2.0, 0.4 * width );
+        width = qwtMaxF( length * 0.06, 9.0 );
+
+    const qreal peak = qwtMaxF( 2.0, 0.4 * width );
 
     QPainterPath path;
@@ -146,9 +140,8 @@
 }
 
-static void qwtDrawTriangleNeedle( QPainter *painter,
-    const QPalette &palette, QPalette::ColorGroup colorGroup,
-    double length )
-{
-    const double width = qRound( length / 3.0 );
+static void qwtDrawTriangleNeedle( QPainter* painter,
+    const QPalette& palette, QPalette::ColorGroup colorGroup, qreal length )
+{
+    const qreal width = qRound( length / 3.0 );
 
     QPainterPath path[4];
@@ -167,5 +160,5 @@
 
 
-    const int colorOffset =  10;
+    const int colorOffset = 10;
     const QColor darkColor = palette.color( colorGroup, QPalette::Dark );
     const QColor lightColor = palette.color( colorGroup, QPalette::Light );
@@ -187,6 +180,6 @@
 
 //! Constructor
-QwtDialNeedle::QwtDialNeedle():
-    d_palette( QApplication::palette() )
+QwtDialNeedle::QwtDialNeedle()
+    : m_palette( QApplication::palette() )
 {
 }
@@ -201,29 +194,29 @@
 
     \param palette New Palette
-*/
-void QwtDialNeedle::setPalette( const QPalette &palette )
-{
-    d_palette = palette;
-}
-
-/*!
-  \return the palette of the needle.
-*/
-const QPalette &QwtDialNeedle::palette() const
-{
-    return d_palette;
-}
-
-/*!
-  Draw the needle
-
-  \param painter Painter
-  \param center Center of the dial, start position for the needle
-  \param length Length of the needle
-  \param direction Direction of the needle, in degrees counter clockwise
-  \param colorGroup Color group, used for painting
-*/
-void QwtDialNeedle::draw( QPainter *painter,
-    const QPointF &center, double length, double direction,
+ */
+void QwtDialNeedle::setPalette( const QPalette& palette )
+{
+    m_palette = palette;
+}
+
+/*!
+   \return the palette of the needle.
+ */
+const QPalette& QwtDialNeedle::palette() const
+{
+    return m_palette;
+}
+
+/*!
+   Draw the needle
+
+   \param painter Painter
+   \param center Center of the dial, start position for the needle
+   \param length Length of the needle
+   \param direction Direction of the needle, in degrees counter clockwise
+   \param colorGroup Color group, used for painting
+ */
+void QwtDialNeedle::draw( QPainter* painter,
+    const QPointF& center, double length, double direction,
     QPalette::ColorGroup colorGroup ) const
 {
@@ -239,6 +232,6 @@
 
 //!  Draw the knob
-void QwtDialNeedle::drawKnob( QPainter *painter,
-    double width, const QBrush &brush, bool sunken ) const
+void QwtDialNeedle::drawKnob( QPainter* painter,
+    double width, const QBrush& brush, bool sunken ) const
 {
     QPalette palette( brush.color() );
@@ -251,5 +244,5 @@
 
     QRectF rect( 0.0, 0.0, width, width );
-    rect.moveCenter( painter->combinedTransform().map( QPointF() ) );
+    rect.moveCenter( painter->transform().map( QPointF() ) );
 
     QLinearGradient gradient( rect.topLeft(), rect.bottomRight() );
@@ -271,16 +264,16 @@
 
 /*!
-  Constructor
-
-  \param style Style
-  \param hasKnob With/Without knob
-  \param mid Middle color
-  \param base Base color
-*/
+   Constructor
+
+   \param style Style
+   \param hasKnob With/Without knob
+   \param mid Middle color
+   \param base Base color
+ */
 QwtDialSimpleNeedle::QwtDialSimpleNeedle( Style style, bool hasKnob,
-        const QColor &mid, const QColor &base ):
-    d_style( style ),
-    d_hasKnob( hasKnob ),
-    d_width( -1 )
+    const QColor& mid, const QColor& base ):
+    m_style( style ),
+    m_hasKnob( hasKnob ),
+    m_width( -1 )
 {
     QPalette palette;
@@ -292,44 +285,44 @@
 
 /*!
-  Set the width of the needle
-  \param width Width
-  \sa width()
-*/
+   Set the width of the needle
+   \param width Width
+   \sa width()
+ */
 void QwtDialSimpleNeedle::setWidth( double width )
 {
-    d_width = width;
-}
-
-/*!
-  \return the width of the needle
-  \sa setWidth()
-*/
+    m_width = width;
+}
+
+/*!
+   \return the width of the needle
+   \sa setWidth()
+ */
 double QwtDialSimpleNeedle::width() const
 {
-    return d_width;
-}
-
-/*!
- Draw the needle
-
- \param painter Painter
- \param length Length of the needle
- \param colorGroup Color group, used for painting
-*/
-void QwtDialSimpleNeedle::drawNeedle( QPainter *painter,
+    return m_width;
+}
+
+/*!
+   Draw the needle
+
+   \param painter Painter
+   \param length Length of the needle
+   \param colorGroup Color group, used for painting
+ */
+void QwtDialSimpleNeedle::drawNeedle( QPainter* painter,
     double length, QPalette::ColorGroup colorGroup ) const
 {
-    double knobWidth = 0.0;
-    double width = d_width;
-
-    if ( d_style == Arrow )
+    qreal knobWidth = 0.0;
+    qreal width = m_width;
+
+    if ( m_style == Arrow )
     {
         if ( width <= 0.0 )
-            width = qMax(length * 0.06, 6.0);
+            width = qwtMaxF( length * 0.06, 6.0 );
 
         qwtDrawArrowNeedle( painter,
             palette(), colorGroup, length, width );
 
-        knobWidth = qMin( width * 2.0, 0.2 * length );
+        knobWidth = qwtMinF( width * 2.0, 0.2 * length );
     }
     else
@@ -344,8 +337,8 @@
         painter->drawLine( QPointF( 0.0, 0.0 ), QPointF( length, 0.0 ) );
 
-        knobWidth = qMax( width * 3.0, 5.0 );
-    }
-
-    if ( d_hasKnob && knobWidth > 0.0 )
+        knobWidth = qwtMaxF( width * 3.0, 5.0 );
+    }
+
+    if ( m_hasKnob && knobWidth > 0.0 )
     {
         drawKnob( painter, knobWidth,
@@ -356,6 +349,6 @@
 //! Constructor
 QwtCompassMagnetNeedle::QwtCompassMagnetNeedle( Style style,
-        const QColor &light, const QColor &dark ):
-    d_style( style )
+    const QColor& light, const QColor& dark ):
+    m_style( style )
 {
     QPalette palette;
@@ -373,11 +366,11 @@
     \param length Length of the needle
     \param colorGroup Color group, used for painting
-*/
-void QwtCompassMagnetNeedle::drawNeedle( QPainter *painter,
+ */
+void QwtCompassMagnetNeedle::drawNeedle( QPainter* painter,
     double length, QPalette::ColorGroup colorGroup ) const
 {
-    if ( d_style == ThinStyle )
-    {
-        const double width = qMax( length / 6.0, 3.0 );
+    if ( m_style == ThinStyle )
+    {
+        const qreal width = qwtMaxF( length / 6.0, 3.0 );
 
         const int colorOffset = 10;
@@ -413,8 +406,8 @@
    \param light Light color
    \param dark Dark color
-*/
+ */
 QwtCompassWindArrow::QwtCompassWindArrow( Style style,
-        const QColor &light, const QColor &dark ):
-    d_style( style )
+    const QColor& light, const QColor& dark ):
+    m_style( style )
 {
     QPalette palette;
@@ -426,14 +419,14 @@
 
 /*!
- Draw the needle
-
- \param painter Painter
- \param length Length of the needle
- \param colorGroup Color group, used for painting
-*/
-void QwtCompassWindArrow::drawNeedle( QPainter *painter,
+   Draw the needle
+
+   \param painter Painter
+   \param length Length of the needle
+   \param colorGroup Color group, used for painting
+ */
+void QwtCompassWindArrow::drawNeedle( QPainter* painter,
     double length, QPalette::ColorGroup colorGroup ) const
 {
-    if ( d_style == Style1 )
+    if ( m_style == Style1 )
         qwtDrawStyle1Needle( painter, palette(), colorGroup, length );
     else
Index: /trunk/BNC/qwt/qwt_dial_needle.h
===================================================================
--- /trunk/BNC/qwt/qwt_dial_needle.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_dial_needle.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,5 +9,5 @@
 
 #ifndef QWT_DIAL_NEEDLE_H
-#define QWT_DIAL_NEEDLE_H 1
+#define QWT_DIAL_NEEDLE_H
 
 #include "qwt_global.h"
@@ -15,70 +15,71 @@
 
 class QPainter;
-class QPoint;
 
 /*!
-  \brief Base class for needles that can be used in a QwtDial.
+   \brief Base class for needles that can be used in a QwtDial.
 
-  QwtDialNeedle is a pointer that indicates a value by pointing
-  to a specific direction.
+   QwtDialNeedle is a pointer that indicates a value by pointing
+   to a specific direction.
 
-  \sa QwtDial, QwtCompass
-*/
+   \sa QwtDial, QwtCompass
+ */
 
 class QWT_EXPORT QwtDialNeedle
 {
-public:
+  public:
     QwtDialNeedle();
     virtual ~QwtDialNeedle();
 
-    virtual void setPalette( const QPalette & );
-    const QPalette &palette() const;
+    virtual void setPalette( const QPalette& );
+    const QPalette& palette() const;
 
-    virtual void draw( QPainter *painter, const QPointF &center,
+    virtual void draw( QPainter*, const QPointF& center,
         double length, double direction,
         QPalette::ColorGroup = QPalette::Active ) const;
 
-protected:
+  protected:
     /*!
-      \brief Draw the needle
+       \brief Draw the needle
 
-      The origin of the needle is at position (0.0, 0.0 )
-      pointing in direction 0.0 ( = east ).
+       The origin of the needle is at position (0.0, 0.0 )
+       pointing in direction 0.0 ( = east ).
 
-      The painter is already initialized with translation and
-      rotation.
+       The painter is already initialized with translation and
+       rotation.
 
-      \param painter Painter
-      \param length Length of the needle
-      \param colorGroup Color group, used for painting
+       \param painter Painter
+       \param length Length of the needle
+       \param colorGroup Color group, used for painting
 
-      \sa setPalette(), palette()
-    */
-    virtual void drawNeedle( QPainter *painter,
+       \sa setPalette(), palette()
+     */
+    virtual void drawNeedle( QPainter* painter,
         double length, QPalette::ColorGroup colorGroup ) const = 0;
 
-    virtual void drawKnob( QPainter *, double width,
-        const QBrush &, bool sunken ) const;
+    virtual void drawKnob( QPainter*, double width,
+        const QBrush&, bool sunken ) const;
 
-private:
-    QPalette d_palette;
+  private:
+    Q_DISABLE_COPY(QwtDialNeedle)
+
+    QPalette m_palette;
 };
 
 /*!
-  \brief A needle for dial widgets
+   \brief A needle for dial widgets
 
-  The following colors are used:
+   The following colors are used:
 
-  - QPalette::Mid\n
+   - QPalette::Mid\n
     Pointer
-  - QPalette::Base\n
+   - QPalette::Base\n
     Knob
 
-  \sa QwtDial, QwtCompass
-*/
+   \sa QwtDial, QwtCompass
+ */
 
-class QWT_EXPORT QwtDialSimpleNeedle: public QwtDialNeedle
+class QWT_EXPORT QwtDialSimpleNeedle : public QwtDialNeedle
 {
-public:
+  public:
     //! Style of the needle
     enum Style
@@ -92,39 +93,39 @@
 
     QwtDialSimpleNeedle( Style, bool hasKnob = true,
-        const QColor &mid = Qt::gray, const QColor &base = Qt::darkGray );
+        const QColor& mid = Qt::gray, const QColor& base = Qt::darkGray );
 
     void setWidth( double width );
     double width() const;
 
-protected:
-    virtual void drawNeedle( QPainter *, double length,
-        QPalette::ColorGroup ) const;
+  protected:
+    virtual void drawNeedle( QPainter*, double length,
+        QPalette::ColorGroup ) const QWT_OVERRIDE;
 
-private:
-    Style d_style;
-    bool d_hasKnob;
-    double d_width;
+  private:
+    Style m_style;
+    bool m_hasKnob;
+    double m_width;
 };
 
 /*!
-  \brief A magnet needle for compass widgets
+   \brief A magnet needle for compass widgets
 
-  A magnet needle points to two opposite directions indicating
-  north and south.
+   A magnet needle points to two opposite directions indicating
+   north and south.
 
-  The following colors are used:
-  - QPalette::Light\n
+   The following colors are used:
+   - QPalette::Light\n
     Used for pointing south
-  - QPalette::Dark\n
+   - QPalette::Dark\n
     Used for pointing north
-  - QPalette::Base\n
+   - QPalette::Base\n
     Knob (ThinStyle only)
 
-  \sa QwtDial, QwtCompass
-*/
+   \sa QwtDial, QwtCompass
+ */
 
-class QWT_EXPORT QwtCompassMagnetNeedle: public QwtDialNeedle
+class QWT_EXPORT QwtCompassMagnetNeedle : public QwtDialNeedle
 {
-public:
+  public:
     //! Style of the needle
     enum Style
@@ -138,30 +139,30 @@
 
     QwtCompassMagnetNeedle( Style = TriangleStyle,
-        const QColor &light = Qt::white, const QColor &dark = Qt::red );
+        const QColor& light = Qt::white, const QColor& dark = Qt::red );
 
-protected:
-    virtual void drawNeedle( QPainter *,
-        double length, QPalette::ColorGroup ) const;
+  protected:
+    virtual void drawNeedle( QPainter*,
+        double length, QPalette::ColorGroup ) const QWT_OVERRIDE;
 
-private:
-    Style d_style;
+  private:
+    Style m_style;
 };
 
 /*!
-  \brief An indicator for the wind direction
+   \brief An indicator for the wind direction
 
-  QwtCompassWindArrow shows the direction where the wind comes from.
+   QwtCompassWindArrow shows the direction where the wind comes from.
 
-  - QPalette::Light\n
+   - QPalette::Light\n
     Used for Style1, or the light half of Style2
-  - QPalette::Dark\n
+   - QPalette::Dark\n
     Used for the dark half of Style2
 
-  \sa QwtDial, QwtCompass
-*/
+   \sa QwtDial, QwtCompass
+ */
 
-class QWT_EXPORT QwtCompassWindArrow: public QwtDialNeedle
+class QWT_EXPORT QwtCompassWindArrow : public QwtDialNeedle
 {
-public:
+  public:
     //! Style of the arrow
     enum Style
@@ -174,13 +175,13 @@
     };
 
-    QwtCompassWindArrow( Style, const QColor &light = Qt::white,
-        const QColor &dark = Qt::gray );
+    QwtCompassWindArrow( Style, const QColor& light = Qt::white,
+        const QColor& dark = Qt::gray );
 
-protected:
-    virtual void drawNeedle( QPainter *,
-        double length, QPalette::ColorGroup ) const;
+  protected:
+    virtual void drawNeedle( QPainter*,
+        double length, QPalette::ColorGroup ) const QWT_OVERRIDE;
 
-private:
-    Style d_style;
+  private:
+    Style m_style;
 };
 
Index: /trunk/BNC/qwt/qwt_dyngrid_layout.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_dyngrid_layout.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_dyngrid_layout.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,5 +9,5 @@
 
 #include "qwt_dyngrid_layout.h"
-#include "qwt_math.h"
+
 #include <qvector.h>
 #include <qlist.h>
@@ -15,7 +15,7 @@
 class QwtDynGridLayout::PrivateData
 {
-public:
-    PrivateData():
-        isDirty( true )
+  public:
+    PrivateData()
+        : isDirty( true )
     {
     }
@@ -23,5 +23,5 @@
     void updateLayoutCache();
 
-    mutable QList<QLayoutItem*> itemList;
+    mutable QList< QLayoutItem* > itemList;
 
     uint maxColumns;
@@ -32,5 +32,5 @@
 
     bool isDirty;
-    QVector<QSize> itemSizeHints;
+    QVector< QSize > itemSizeHints;
 };
 
@@ -41,6 +41,6 @@
     int index = 0;
 
-    for ( QList<QLayoutItem*>::iterator it = itemList.begin();
-        it != itemList.end(); ++it, index++ )
+    for ( QList< QLayoutItem* >::const_iterator it = itemList.constBegin();
+        it != itemList.constEnd(); ++it, index++ )
     {
         itemSizeHints[ index ] = ( *it )->sizeHint();
@@ -51,22 +51,21 @@
 
 /*!
-  \param parent Parent widget
-  \param margin Margin
-  \param spacing Spacing
-*/
-
-QwtDynGridLayout::QwtDynGridLayout( QWidget *parent,
-        int margin, int spacing ):
-    QLayout( parent )
+   \param parent Parent widget
+   \param margin Margin
+   \param spacing Spacing
+ */
+
+QwtDynGridLayout::QwtDynGridLayout( QWidget* parent, int margin, int spacing )
+    : QLayout( parent )
 {
     init();
 
     setSpacing( spacing );
-    setMargin( margin );
-}
-
-/*!
-  \param spacing Spacing
-*/
+    setContentsMargins( margin, margin, margin, margin );
+}
+
+/*!
+   \param spacing Spacing
+ */
 
 QwtDynGridLayout::QwtDynGridLayout( int spacing )
@@ -77,11 +76,10 @@
 
 /*!
-  Initialize the layout with default values.
-*/
+   Initialize the layout with default values.
+ */
 void QwtDynGridLayout::init()
 {
-    d_data = new QwtDynGridLayout::PrivateData;
-    d_data->maxColumns = d_data->numRows = d_data->numColumns = 0;
-    d_data->expanding = 0;
+    m_data = new QwtDynGridLayout::PrivateData;
+    m_data->maxColumns = m_data->numRows = m_data->numColumns = 0;
 }
 
@@ -90,8 +88,6 @@
 QwtDynGridLayout::~QwtDynGridLayout()
 {
-    for ( int i = 0; i < d_data->itemList.size(); i++ )
-        delete d_data->itemList[i];
-
-    delete d_data;
+    qDeleteAll( m_data->itemList );
+    delete m_data;
 }
 
@@ -99,86 +95,86 @@
 void QwtDynGridLayout::invalidate()
 {
-    d_data->isDirty = true;
+    m_data->isDirty = true;
     QLayout::invalidate();
 }
 
 /*!
-  Limit the number of columns.
-  \param maxColumns upper limit, 0 means unlimited
-  \sa maxColumns()
-*/
+   Limit the number of columns.
+   \param maxColumns upper limit, 0 means unlimited
+   \sa maxColumns()
+ */
 void QwtDynGridLayout::setMaxColumns( uint maxColumns )
 {
-    d_data->maxColumns = maxColumns;
-}
-
-/*!
-  \brief Return the upper limit for the number of columns.
-
-  0 means unlimited, what is the default.
-
-  \return Upper limit for the number of columns
-  \sa setMaxColumns()
-*/
+    m_data->maxColumns = maxColumns;
+}
+
+/*!
+   \brief Return the upper limit for the number of columns.
+
+   0 means unlimited, what is the default.
+
+   \return Upper limit for the number of columns
+   \sa setMaxColumns()
+ */
 uint QwtDynGridLayout::maxColumns() const
 {
-    return d_data->maxColumns;
-}
-
-/*!
-  \brief Add an item to the next free position.
-  \param item Layout item
- */
-void QwtDynGridLayout::addItem( QLayoutItem *item )
-{
-    d_data->itemList.append( item );
+    return m_data->maxColumns;
+}
+
+/*!
+   \brief Add an item to the next free position.
+   \param item Layout item
+ */
+void QwtDynGridLayout::addItem( QLayoutItem* item )
+{
+    m_data->itemList.append( item );
     invalidate();
 }
 
 /*!
-  \return true if this layout is empty.
-*/
+   \return true if this layout is empty.
+ */
 bool QwtDynGridLayout::isEmpty() const
 {
-    return d_data->itemList.isEmpty();
-}
-
-/*!
-  \return number of layout items
-*/
+    return m_data->itemList.isEmpty();
+}
+
+/*!
+   \return number of layout items
+ */
 uint QwtDynGridLayout::itemCount() const
 {
-    return d_data->itemList.count();
-}
-
-/*!
-  Find the item at a specific index
-
-  \param index Index
-  \return Item at a specific index
-  \sa takeAt()
-*/
-QLayoutItem *QwtDynGridLayout::itemAt( int index ) const
-{
-    if ( index < 0 || index >= d_data->itemList.count() )
+    return m_data->itemList.count();
+}
+
+/*!
+   Find the item at a specific index
+
+   \param index Index
+   \return Item at a specific index
+   \sa takeAt()
+ */
+QLayoutItem* QwtDynGridLayout::itemAt( int index ) const
+{
+    if ( index < 0 || index >= m_data->itemList.count() )
         return NULL;
 
-    return d_data->itemList.at( index );
-}
-
-/*!
-  Find the item at a specific index and remove it from the layout
-
-  \param index Index
-  \return Layout item, removed from the layout
-  \sa itemAt()
-*/
-QLayoutItem *QwtDynGridLayout::takeAt( int index )
-{
-    if ( index < 0 || index >= d_data->itemList.count() )
+    return m_data->itemList.at( index );
+}
+
+/*!
+   Find the item at a specific index and remove it from the layout
+
+   \param index Index
+   \return Layout item, removed from the layout
+   \sa itemAt()
+ */
+QLayoutItem* QwtDynGridLayout::takeAt( int index )
+{
+    if ( index < 0 || index >= m_data->itemList.count() )
         return NULL;
 
-    d_data->isDirty = true;
-    return d_data->itemList.takeAt( index );
+    m_data->isDirty = true;
+    return m_data->itemList.takeAt( index );
 }
 
@@ -186,43 +182,43 @@
 int QwtDynGridLayout::count() const
 {
-    return d_data->itemList.count();
-}
-
-/*!
-  Set whether this layout can make use of more space than sizeHint().
-  A value of Qt::Vertical or Qt::Horizontal means that it wants to grow in only
-  one dimension, while Qt::Vertical | Qt::Horizontal means that it wants
-  to grow in both dimensions. The default value is 0.
-
-  \param expanding Or'd orientations
-  \sa expandingDirections()
-*/
+    return m_data->itemList.count();
+}
+
+/*!
+   Set whether this layout can make use of more space than sizeHint().
+   A value of Qt::Vertical or Qt::Horizontal means that it wants to grow in only
+   one dimension, while Qt::Vertical | Qt::Horizontal means that it wants
+   to grow in both dimensions. The default value is 0.
+
+   \param expanding Or'd orientations
+   \sa expandingDirections()
+ */
 void QwtDynGridLayout::setExpandingDirections( Qt::Orientations expanding )
 {
-    d_data->expanding = expanding;
-}
-
-/*!
-  \brief Returns whether this layout can make use of more space than sizeHint().
-
-  A value of Qt::Vertical or Qt::Horizontal means that it wants to grow in only
-  one dimension, while Qt::Vertical | Qt::Horizontal means that it wants
-  to grow in both dimensions.
-
-  \return Orientations, where the layout expands
-  \sa setExpandingDirections()
-*/
+    m_data->expanding = expanding;
+}
+
+/*!
+   \brief Returns whether this layout can make use of more space than sizeHint().
+
+   A value of Qt::Vertical or Qt::Horizontal means that it wants to grow in only
+   one dimension, while Qt::Vertical | Qt::Horizontal means that it wants
+   to grow in both dimensions.
+
+   \return Orientations, where the layout expands
+   \sa setExpandingDirections()
+ */
 Qt::Orientations QwtDynGridLayout::expandingDirections() const
 {
-    return d_data->expanding;
-}
-
-/*!
-  Reorganizes columns and rows and resizes managed items within
-  a rectangle.
-
-  \param rect Layout geometry
-*/
-void QwtDynGridLayout::setGeometry( const QRect &rect )
+    return m_data->expanding;
+}
+
+/*!
+   Reorganizes columns and rows and resizes managed items within
+   a rectangle.
+
+   \param rect Layout geometry
+ */
+void QwtDynGridLayout::setGeometry( const QRect& rect )
 {
     QLayout::setGeometry( rect );
@@ -231,14 +227,14 @@
         return;
 
-    d_data->numColumns = columnsForWidth( rect.width() );
-    d_data->numRows = itemCount() / d_data->numColumns;
-    if ( itemCount() % d_data->numColumns )
-        d_data->numRows++;
-
-    QList<QRect> itemGeometries = layoutItems( rect, d_data->numColumns );
+    m_data->numColumns = columnsForWidth( rect.width() );
+    m_data->numRows = itemCount() / m_data->numColumns;
+    if ( itemCount() % m_data->numColumns )
+        m_data->numRows++;
+
+    const QList< QRect > itemGeometries = layoutItems( rect, m_data->numColumns );
 
     int index = 0;
-    for ( QList<QLayoutItem*>::iterator it = d_data->itemList.begin();
-        it != d_data->itemList.end(); ++it )
+    for ( QList< QLayoutItem* >::const_iterator it = m_data->itemList.constBegin();
+        it != m_data->itemList.constEnd(); ++it )
     {
         ( *it )->setGeometry( itemGeometries[index] );
@@ -248,14 +244,14 @@
 
 /*!
-  \brief Calculate the number of columns for a given width.
-
-  The calculation tries to use as many columns as possible
-  ( limited by maxColumns() )
-
-  \param width Available width for all columns
-  \return Number of columns for a given width
-
-  \sa maxColumns(), setMaxColumns()
-*/
+   \brief Calculate the number of columns for a given width.
+
+   The calculation tries to use as many columns as possible
+   ( limited by maxColumns() )
+
+   \param width Available width for all columns
+   \return Number of columns for a given width
+
+   \sa maxColumns(), setMaxColumns()
+ */
 uint QwtDynGridLayout::columnsForWidth( int width ) const
 {
@@ -264,6 +260,6 @@
 
     uint maxColumns = itemCount();
-    if ( d_data->maxColumns > 0 )
-        maxColumns = qMin( d_data->maxColumns, maxColumns );
+    if ( m_data->maxColumns > 0 )
+        maxColumns = qMin( m_data->maxColumns, maxColumns );
 
     if ( maxRowWidth( maxColumns ) <= width )
@@ -281,30 +277,32 @@
 
 /*!
-  Calculate the width of a layout for a given number of
-  columns.
-
-  \param numColumns Given number of columns
-  \param itemWidth Array of the width hints for all items
-*/
+   Calculate the width of a layout for a given number of
+   columns.
+
+   \param numColumns Given number of columns
+   \param itemWidth Array of the width hints for all items
+ */
 int QwtDynGridLayout::maxRowWidth( int numColumns ) const
 {
     int col;
 
-    QVector<int> colWidth( numColumns );
+    QVector< int > colWidth( numColumns );
     for ( col = 0; col < numColumns; col++ )
         colWidth[col] = 0;
 
-    if ( d_data->isDirty )
-        d_data->updateLayoutCache();
+    if ( m_data->isDirty )
+        m_data->updateLayoutCache();
 
     for ( int index = 0;
-        index < d_data->itemSizeHints.count(); index++ )
+        index < m_data->itemSizeHints.count(); index++ )
     {
         col = index % numColumns;
         colWidth[col] = qMax( colWidth[col],
-            d_data->itemSizeHints[int( index )].width() );
-    }
-
-    int rowWidth = 2 * margin() + ( numColumns - 1 ) * spacing();
+            m_data->itemSizeHints[index].width() );
+    }
+
+    const QMargins m = contentsMargins();
+
+    int rowWidth = m.left() + m.right() + ( numColumns - 1 ) * spacing();
     for ( col = 0; col < numColumns; col++ )
         rowWidth += colWidth[col];
@@ -314,6 +312,6 @@
 
 /*!
-  \return the maximum width of all layout items
-*/
+   \return the maximum width of all layout items
+ */
 int QwtDynGridLayout::maxItemWidth() const
 {
@@ -321,11 +319,11 @@
         return 0;
 
-    if ( d_data->isDirty )
-        d_data->updateLayoutCache();
+    if ( m_data->isDirty )
+        m_data->updateLayoutCache();
 
     int w = 0;
-    for ( int i = 0; i < d_data->itemSizeHints.count(); i++ )
-    {
-        const int itemW = d_data->itemSizeHints[i].width();
+    for ( int i = 0; i < m_data->itemSizeHints.count(); i++ )
+    {
+        const int itemW = m_data->itemSizeHints[i].width();
         if ( itemW > w )
             w = itemW;
@@ -336,16 +334,16 @@
 
 /*!
-  Calculate the geometries of the layout items for a layout
-  with numColumns columns and a given rectangle.
-
-  \param rect Rect where to place the items
-  \param numColumns Number of columns
-  \return item geometries
-*/
-
-QList<QRect> QwtDynGridLayout::layoutItems( const QRect &rect,
+   Calculate the geometries of the layout items for a layout
+   with numColumns columns and a given rectangle.
+
+   \param rect Rect where to place the items
+   \param numColumns Number of columns
+   \return item geometries
+ */
+
+QList< QRect > QwtDynGridLayout::layoutItems( const QRect& rect,
     uint numColumns ) const
 {
-    QList<QRect> itemGeometries;
+    QList< QRect > itemGeometries;
     if ( numColumns == 0 || isEmpty() )
         return itemGeometries;
@@ -358,6 +356,6 @@
         return itemGeometries;
 
-    QVector<int> rowHeight( numRows );
-    QVector<int> colWidth( numColumns );
+    QVector< int > rowHeight( numRows );
+    QVector< int > colWidth( numColumns );
 
     layoutGrid( numColumns, rowHeight, colWidth );
@@ -370,26 +368,30 @@
         stretchGrid( rect, numColumns, rowHeight, colWidth );
 
-    const int maxColumns = d_data->maxColumns;
-    d_data->maxColumns = numColumns;
+    const int maxColumns = m_data->maxColumns;
+    m_data->maxColumns = numColumns;
     const QRect alignedRect = alignmentRect( rect );
-    d_data->maxColumns = maxColumns;
+    m_data->maxColumns = maxColumns;
 
     const int xOffset = expandH ? 0 : alignedRect.x();
     const int yOffset = expandV ? 0 : alignedRect.y();
 
-    QVector<int> colX( numColumns );
-    QVector<int> rowY( numRows );
+    QVector< int > colX( numColumns );
+    QVector< int > rowY( numRows );
 
     const int xySpace = spacing();
 
-    rowY[0] = yOffset + margin();
+    const QMargins m = contentsMargins();
+
+    rowY[0] = yOffset + m.top();
     for ( uint r = 1; r < numRows; r++ )
-        rowY[r] = rowY[r-1] + rowHeight[r-1] + xySpace;
-
-    colX[0] = xOffset + margin();
+        rowY[r] = rowY[r - 1] + rowHeight[r - 1] + xySpace;
+
+    colX[0] = xOffset + m.left();
     for ( uint c = 1; c < numColumns; c++ )
-        colX[c] = colX[c-1] + colWidth[c-1] + xySpace;
-
-    const int itemCount = d_data->itemList.size();
+        colX[c] = colX[c - 1] + colWidth[c - 1] + xySpace;
+
+    const int itemCount = m_data->itemList.size();
+    itemGeometries.reserve( itemCount );
+
     for ( int i = 0; i < itemCount; i++ )
     {
@@ -397,5 +399,5 @@
         const int col = i % numColumns;
 
-        QRect itemGeometry( colX[col], rowY[row],
+        const QRect itemGeometry( colX[col], rowY[row],
             colWidth[col], rowHeight[row] );
         itemGeometries.append( itemGeometry );
@@ -407,27 +409,27 @@
 
 /*!
-  Calculate the dimensions for the columns and rows for a grid
-  of numColumns columns.
-
-  \param numColumns Number of columns.
-  \param rowHeight Array where to fill in the calculated row heights.
-  \param colWidth Array where to fill in the calculated column widths.
-*/
+   Calculate the dimensions for the columns and rows for a grid
+   of numColumns columns.
+
+   \param numColumns Number of columns.
+   \param rowHeight Array where to fill in the calculated row heights.
+   \param colWidth Array where to fill in the calculated column widths.
+ */
 
 void QwtDynGridLayout::layoutGrid( uint numColumns,
-    QVector<int>& rowHeight, QVector<int>& colWidth ) const
+    QVector< int >& rowHeight, QVector< int >& colWidth ) const
 {
     if ( numColumns <= 0 )
         return;
 
-    if ( d_data->isDirty )
-        d_data->updateLayoutCache();
-
-    for ( int index = 0; index < d_data->itemSizeHints.count(); index++ )
+    if ( m_data->isDirty )
+        m_data->updateLayoutCache();
+
+    for ( int index = 0; index < m_data->itemSizeHints.count(); index++ )
     {
         const int row = index / numColumns;
         const int col = index % numColumns;
 
-        const QSize &size = d_data->itemSizeHints[int( index )];
+        const QSize& size = m_data->itemSizeHints[index];
 
         rowHeight[row] = ( col == 0 )
@@ -439,7 +441,7 @@
 
 /*!
-  \return true: QwtDynGridLayout implements heightForWidth().
-  \sa heightForWidth()
-*/
+   \return true: QwtDynGridLayout implements heightForWidth().
+   \sa heightForWidth()
+ */
 bool QwtDynGridLayout::hasHeightForWidth() const
 {
@@ -448,7 +450,7 @@
 
 /*!
-  \return The preferred height for this layout, given a width.
-  \sa hasHeightForWidth()
-*/
+   \return The preferred height for this layout, given a width.
+   \sa hasHeightForWidth()
+ */
 int QwtDynGridLayout::heightForWidth( int width ) const
 {
@@ -461,10 +463,12 @@
         numRows++;
 
-    QVector<int> rowHeight( numRows );
-    QVector<int> colWidth( numColumns );
+    QVector< int > rowHeight( numRows );
+    QVector< int > colWidth( numColumns );
 
     layoutGrid( numColumns, rowHeight, colWidth );
 
-    int h = 2 * margin() + ( numRows - 1 ) * spacing();
+    const QMargins m = contentsMargins();
+
+    int h = m.top() + m.bottom() + ( numRows - 1 ) * spacing();
     for ( uint row = 0; row < numRows; row++ )
         h += rowHeight[row];
@@ -474,17 +478,17 @@
 
 /*!
-  Stretch columns in case of expanding() & QSizePolicy::Horizontal and
-  rows in case of expanding() & QSizePolicy::Vertical to fill the entire
-  rect. Rows and columns are stretched with the same factor.
-
-  \param rect Bounding rectangle
-  \param numColumns Number of columns
-  \param rowHeight Array to be filled with the calculated row heights
-  \param colWidth Array to be filled with the calculated column widths
-
-  \sa setExpanding(), expanding()
-*/
-void QwtDynGridLayout::stretchGrid( const QRect &rect,
-    uint numColumns, QVector<int>& rowHeight, QVector<int>& colWidth ) const
+   Stretch columns in case of expanding() & QSizePolicy::Horizontal and
+   rows in case of expanding() & QSizePolicy::Vertical to fill the entire
+   rect. Rows and columns are stretched with the same factor.
+
+   \param rect Bounding rectangle
+   \param numColumns Number of columns
+   \param rowHeight Array to be filled with the calculated row heights
+   \param colWidth Array to be filled with the calculated column widths
+
+   \sa setExpanding(), expanding()
+ */
+void QwtDynGridLayout::stretchGrid( const QRect& rect,
+    uint numColumns, QVector< int >& rowHeight, QVector< int >& colWidth ) const
 {
     if ( numColumns == 0 || isEmpty() )
@@ -495,7 +499,9 @@
     expandV = expandingDirections() & Qt::Vertical;
 
+    const QMargins m = contentsMargins();
+
     if ( expandH )
     {
-        int xDelta = rect.width() - 2 * margin() - ( numColumns - 1 ) * spacing();
+        int xDelta = rect.width() - m.left() - m.right() - ( numColumns - 1 ) * spacing();
         for ( uint col = 0; col < numColumns; col++ )
             xDelta -= colWidth[col];
@@ -518,5 +524,5 @@
             numRows++;
 
-        int yDelta = rect.height() - 2 * margin() - ( numRows - 1 ) * spacing();
+        int yDelta = rect.height() - m.top() - m.bottom() - ( numRows - 1 ) * spacing();
         for ( uint row = 0; row < numRows; row++ )
             yDelta -= rowHeight[row];
@@ -541,5 +547,5 @@
    \return Size hint
    \sa maxColumns(), setMaxColumns()
-*/
+ */
 QSize QwtDynGridLayout::sizeHint() const
 {
@@ -548,6 +554,6 @@
 
     uint numColumns = itemCount();
-    if ( d_data->maxColumns > 0 )
-        numColumns = qMin( d_data->maxColumns, numColumns );
+    if ( m_data->maxColumns > 0 )
+        numColumns = qMin( m_data->maxColumns, numColumns );
 
     uint numRows = itemCount() / numColumns;
@@ -555,14 +561,16 @@
         numRows++;
 
-    QVector<int> rowHeight( numRows );
-    QVector<int> colWidth( numColumns );
+    QVector< int > rowHeight( numRows );
+    QVector< int > colWidth( numColumns );
 
     layoutGrid( numColumns, rowHeight, colWidth );
 
-    int h = 2 * margin() + ( numRows - 1 ) * spacing();
+    const QMargins m = contentsMargins();
+
+    int h = m.top() + m.bottom() + ( numRows - 1 ) * spacing();
     for ( uint row = 0; row < numRows; row++ )
         h += rowHeight[row];
 
-    int w = 2 * margin() + ( numColumns - 1 ) * spacing();
+    int w = m.left() + m.right() + ( numColumns - 1 ) * spacing();
     for ( uint col = 0; col < numColumns; col++ )
         w += colWidth[col];
@@ -572,20 +580,22 @@
 
 /*!
-  \return Number of rows of the current layout.
-  \sa numColumns()
-  \warning The number of rows might change whenever the geometry changes
-*/
+   \return Number of rows of the current layout.
+   \sa numColumns()
+   \warning The number of rows might change whenever the geometry changes
+ */
 uint QwtDynGridLayout::numRows() const
 {
-    return d_data->numRows;
-}
-
-/*!
-  \return Number of columns of the current layout.
-  \sa numRows()
-  \warning The number of columns might change whenever the geometry changes
-*/
+    return m_data->numRows;
+}
+
+/*!
+   \return Number of columns of the current layout.
+   \sa numRows()
+   \warning The number of columns might change whenever the geometry changes
+ */
 uint QwtDynGridLayout::numColumns() const
 {
-    return d_data->numColumns;
-}
+    return m_data->numColumns;
+}
+
+#include "moc_qwt_dyngrid_layout.cpp"
Index: /trunk/BNC/qwt/qwt_dyngrid_layout.h
===================================================================
--- /trunk/BNC/qwt/qwt_dyngrid_layout.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_dyngrid_layout.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,26 +13,26 @@
 #include "qwt_global.h"
 #include <qlayout.h>
-#include <qsize.h>
-#include <qlist.h>
+
+template< typename T > class QList;
 
 /*!
-  \brief The QwtDynGridLayout class lays out widgets in a grid,
+   \brief The QwtDynGridLayout class lays out widgets in a grid,
          adjusting the number of columns and rows to the current size.
 
-  QwtDynGridLayout takes the space it gets, divides it up into rows and
-  columns, and puts each of the widgets it manages into the correct cell(s).
-  It lays out as many number of columns as possible (limited by maxColumns()).
-*/
+   QwtDynGridLayout takes the space it gets, divides it up into rows and
+   columns, and puts each of the widgets it manages into the correct cell(s).
+   It lays out as many number of columns as possible (limited by maxColumns()).
+ */
 
 class QWT_EXPORT QwtDynGridLayout : public QLayout
 {
     Q_OBJECT
-public:
-    explicit QwtDynGridLayout( QWidget *, int margin = 0, int spacing = -1 );
+  public:
+    explicit QwtDynGridLayout( QWidget*, int margin = 0, int spacing = -1 );
     explicit QwtDynGridLayout( int spacing = -1 );
 
     virtual ~QwtDynGridLayout();
 
-    virtual void invalidate();
+    virtual void invalidate() QWT_OVERRIDE;
 
     void setMaxColumns( uint maxColumns );
@@ -42,41 +42,42 @@
     uint numColumns () const;
 
-    virtual void addItem( QLayoutItem * );
+    virtual void addItem( QLayoutItem* ) QWT_OVERRIDE;
 
-    virtual QLayoutItem *itemAt( int index ) const;
-    virtual QLayoutItem *takeAt( int index );
-    virtual int count() const;
+    virtual QLayoutItem* itemAt( int index ) const QWT_OVERRIDE;
+    virtual QLayoutItem* takeAt( int index ) QWT_OVERRIDE;
+    virtual int count() const QWT_OVERRIDE;
 
     void setExpandingDirections( Qt::Orientations );
-    virtual Qt::Orientations expandingDirections() const;
-    QList<QRect> layoutItems( const QRect &, uint numColumns ) const;
+    virtual Qt::Orientations expandingDirections() const QWT_OVERRIDE;
+    QList< QRect > layoutItems( const QRect&, uint numColumns ) const;
 
     virtual int maxItemWidth() const;
 
-    virtual void setGeometry( const QRect &rect );
+    virtual void setGeometry( const QRect& ) QWT_OVERRIDE;
 
-    virtual bool hasHeightForWidth() const;
-    virtual int heightForWidth( int ) const;
+    virtual bool hasHeightForWidth() const QWT_OVERRIDE;
+    virtual int heightForWidth( int ) const QWT_OVERRIDE;
 
-    virtual QSize sizeHint() const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
 
-    virtual bool isEmpty() const;
+    virtual bool isEmpty() const QWT_OVERRIDE;
     uint itemCount() const;
 
     virtual uint columnsForWidth( int width ) const;
 
-protected:
+  protected:
 
     void layoutGrid( uint numColumns,
-        QVector<int>& rowHeight, QVector<int>& colWidth ) const;
-    void stretchGrid( const QRect &rect, uint numColumns,
-        QVector<int>& rowHeight, QVector<int>& colWidth ) const;
+        QVector< int >& rowHeight, QVector< int >& colWidth ) const;
 
-private:
+    void stretchGrid( const QRect& rect, uint numColumns,
+        QVector< int >& rowHeight, QVector< int >& colWidth ) const;
+
+  private:
     void init();
     int maxRowWidth( int numColumns ) const;
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_event_pattern.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_event_pattern.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_event_pattern.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,12 +12,12 @@
 
 /*!
-  Constructor
-
-  \sa MousePatternCode, KeyPatternCode
-*/
-
-QwtEventPattern::QwtEventPattern():
-    d_mousePattern( MousePatternCount ),
-    d_keyPattern( KeyPatternCount )
+   Constructor
+
+   \sa MousePatternCode, KeyPatternCode
+ */
+
+QwtEventPattern::QwtEventPattern()
+    : m_mousePattern( MousePatternCount )
+    , m_keyPattern( KeyPatternCount )
 {
     initKeyPattern();
@@ -31,12 +31,12 @@
 
 /*!
-  Set default mouse patterns, depending on the number of mouse buttons
-
-  \param numButtons Number of mouse buttons ( <= 3 )
-  \sa MousePatternCode
-*/
+   Set default mouse patterns, depending on the number of mouse buttons
+
+   \param numButtons Number of mouse buttons ( <= 3 )
+   \sa MousePatternCode
+ */
 void QwtEventPattern::initMousePattern( int numButtons )
 {
-    d_mousePattern.resize( MousePatternCount );
+    m_mousePattern.resize( MousePatternCount );
 
     switch ( numButtons )
@@ -60,26 +60,26 @@
             setMousePattern( MouseSelect1, Qt::LeftButton );
             setMousePattern( MouseSelect2, Qt::RightButton );
-            setMousePattern( MouseSelect3, Qt::MidButton );
+            setMousePattern( MouseSelect3, Qt::MiddleButton );
         }
     }
 
-    setMousePattern( MouseSelect4, d_mousePattern[MouseSelect1].button,
-        d_mousePattern[MouseSelect1].modifiers | Qt::ShiftModifier );
-
-    setMousePattern( MouseSelect5, d_mousePattern[MouseSelect2].button,
-        d_mousePattern[MouseSelect2].modifiers | Qt::ShiftModifier );
-
-    setMousePattern( MouseSelect6, d_mousePattern[MouseSelect3].button,
-        d_mousePattern[MouseSelect3].modifiers | Qt::ShiftModifier );
-}
-
-/*!
-  Set default mouse patterns.
-
-  \sa KeyPatternCode
-*/
+    setMousePattern( MouseSelect4, m_mousePattern[MouseSelect1].button,
+        m_mousePattern[MouseSelect1].modifiers | Qt::ShiftModifier );
+
+    setMousePattern( MouseSelect5, m_mousePattern[MouseSelect2].button,
+        m_mousePattern[MouseSelect2].modifiers | Qt::ShiftModifier );
+
+    setMousePattern( MouseSelect6, m_mousePattern[MouseSelect3].button,
+        m_mousePattern[MouseSelect3].modifiers | Qt::ShiftModifier );
+}
+
+/*!
+   Set default mouse patterns.
+
+   \sa KeyPatternCode
+ */
 void QwtEventPattern::initKeyPattern()
 {
-    d_keyPattern.resize( KeyPatternCount );
+    m_keyPattern.resize( KeyPatternCount );
 
     setKeyPattern( KeySelect1, Qt::Key_Return );
@@ -98,12 +98,12 @@
 
 /*!
-  Change one mouse pattern
-
-  \param pattern Index of the pattern
-  \param button Button
-  \param modifiers Keyboard modifiers
-
-  \sa QMouseEvent
-*/
+   Change one mouse pattern
+
+   \param pattern Index of the pattern
+   \param button Button
+   \param modifiers Keyboard modifiers
+
+   \sa QMouseEvent
+ */
 void QwtEventPattern::setMousePattern( MousePatternCode pattern,
     Qt::MouseButton button, Qt::KeyboardModifiers modifiers )
@@ -111,18 +111,18 @@
     if ( pattern >= 0 && pattern < MousePatternCount )
     {
-        d_mousePattern[ pattern ].button = button;
-        d_mousePattern[ pattern ].modifiers = modifiers;
+        m_mousePattern[ pattern ].button = button;
+        m_mousePattern[ pattern ].modifiers = modifiers;
     }
 }
 
 /*!
-  Change one key pattern
-
-  \param pattern Index of the pattern
-  \param key Key
-  \param modifiers Keyboard modifiers
-
-  \sa QKeyEvent
-*/
+   Change one key pattern
+
+   \param pattern Index of the pattern
+   \param key Key
+   \param modifiers Keyboard modifiers
+
+   \sa QKeyEvent
+ */
 void QwtEventPattern::setKeyPattern( KeyPatternCode pattern,
     int key, Qt::KeyboardModifiers modifiers )
@@ -130,65 +130,65 @@
     if ( pattern >= 0 && pattern < KeyPatternCount )
     {
-        d_keyPattern[ pattern ].key = key;
-        d_keyPattern[ pattern ].modifiers = modifiers;
+        m_keyPattern[ pattern ].key = key;
+        m_keyPattern[ pattern ].modifiers = modifiers;
     }
 }
 
 //! Change the mouse event patterns
-void QwtEventPattern::setMousePattern( const QVector<MousePattern> &pattern )
-{
-    d_mousePattern = pattern;
+void QwtEventPattern::setMousePattern( const QVector< MousePattern >& pattern )
+{
+    m_mousePattern = pattern;
 }
 
 //! Change the key event patterns
-void QwtEventPattern::setKeyPattern( const QVector<KeyPattern> &pattern )
-{
-    d_keyPattern = pattern;
+void QwtEventPattern::setKeyPattern( const QVector< KeyPattern >& pattern )
+{
+    m_keyPattern = pattern;
 }
 
 //! \return Mouse pattern
-const QVector<QwtEventPattern::MousePattern> &
+const QVector< QwtEventPattern::MousePattern >&
 QwtEventPattern::mousePattern() const
 {
-    return d_mousePattern;
+    return m_mousePattern;
 }
 
 //! \return Key pattern
-const QVector<QwtEventPattern::KeyPattern> &
+const QVector< QwtEventPattern::KeyPattern >&
 QwtEventPattern::keyPattern() const
 {
-    return d_keyPattern;
+    return m_keyPattern;
 }
 
 //! \return Mouse pattern
-QVector<QwtEventPattern::MousePattern> &QwtEventPattern::mousePattern()
-{
-    return d_mousePattern;
+QVector< QwtEventPattern::MousePattern >& QwtEventPattern::mousePattern()
+{
+    return m_mousePattern;
 }
 
 //! \return Key pattern
-QVector<QwtEventPattern::KeyPattern> &QwtEventPattern::keyPattern()
-{
-    return d_keyPattern;
-}
-
-/*!
-  \brief Compare a mouse event with an event pattern.
-
-  A mouse event matches the pattern when both have the same button
-  value and in the state value the same key flags(Qt::KeyButtonMask)
-  are set.
-
-  \param code Index of the event pattern
-  \param event Mouse event
-  \return true if matches
-
-  \sa keyMatch()
-*/
+QVector< QwtEventPattern::KeyPattern >& QwtEventPattern::keyPattern()
+{
+    return m_keyPattern;
+}
+
+/*!
+   \brief Compare a mouse event with an event pattern.
+
+   A mouse event matches the pattern when both have the same button
+   value and in the state value the same key flags(Qt::KeyButtonMask)
+   are set.
+
+   \param code Index of the event pattern
+   \param event Mouse event
+   \return true if matches
+
+   \sa keyMatch()
+ */
 bool QwtEventPattern::mouseMatch( MousePatternCode code,
-    const QMouseEvent *event ) const
+    const QMouseEvent* event ) const
 {
     if ( code >= 0 && code < MousePatternCount )
-        return mouseMatch( d_mousePattern[ code ], event );
+        return mouseMatch( m_mousePattern[ code ], event );
 
     return false;
@@ -196,19 +196,19 @@
 
 /*!
-  \brief Compare a mouse event with an event pattern.
-
-  A mouse event matches the pattern when both have the same button
-  value and in the state value the same key flags(Qt::KeyButtonMask)
-  are set.
-
-  \param pattern Mouse event pattern
-  \param event Mouse event
-  \return true if matches
-
-  \sa keyMatch()
-*/
-
-bool QwtEventPattern::mouseMatch( const MousePattern &pattern,
-    const QMouseEvent *event ) const
+   \brief Compare a mouse event with an event pattern.
+
+   A mouse event matches the pattern when both have the same button
+   value and in the state value the same key flags(Qt::KeyButtonMask)
+   are set.
+
+   \param pattern Mouse event pattern
+   \param event Mouse event
+   \return true if matches
+
+   \sa keyMatch()
+ */
+
+bool QwtEventPattern::mouseMatch( const MousePattern& pattern,
+    const QMouseEvent* event ) const
 {
     if ( event == NULL )
@@ -220,21 +220,21 @@
 
 /*!
-  \brief Compare a key event with an event pattern.
-
-  A key event matches the pattern when both have the same key
-  value and in the state value the same key flags (Qt::KeyButtonMask)
-  are set.
-
-  \param code Index of the event pattern
-  \param event Key event
-  \return true if matches
-
-  \sa mouseMatch()
-*/
+   \brief Compare a key event with an event pattern.
+
+   A key event matches the pattern when both have the same key
+   value and in the state value the same key flags (Qt::KeyButtonMask)
+   are set.
+
+   \param code Index of the event pattern
+   \param event Key event
+   \return true if matches
+
+   \sa mouseMatch()
+ */
 bool QwtEventPattern::keyMatch( KeyPatternCode code,
-    const QKeyEvent *event ) const
+    const QKeyEvent* event ) const
 {
     if ( code >= 0 && code < KeyPatternCount )
-        return keyMatch( d_keyPattern[ code ], event );
+        return keyMatch( m_keyPattern[ code ], event );
 
     return false;
@@ -242,19 +242,19 @@
 
 /*!
-  \brief Compare a key event with an event pattern.
-
-  A key event matches the pattern when both have the same key
-  value and in the state value the same key flags (Qt::KeyButtonMask)
-  are set.
-
-  \param pattern Key event pattern
-  \param event Key event
-  \return true if matches
-
-  \sa mouseMatch()
-*/
+   \brief Compare a key event with an event pattern.
+
+   A key event matches the pattern when both have the same key
+   value and in the state value the same key flags (Qt::KeyButtonMask)
+   are set.
+
+   \param pattern Key event pattern
+   \param event Key event
+   \return true if matches
+
+   \sa mouseMatch()
+ */
 
 bool QwtEventPattern::keyMatch(
-    const KeyPattern &pattern, const QKeyEvent *event ) const
+    const KeyPattern& pattern, const QKeyEvent* event ) const
 {
     if ( event == NULL )
Index: /trunk/BNC/qwt/qwt_event_pattern.h
===================================================================
--- /trunk/BNC/qwt/qwt_event_pattern.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_event_pattern.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,7 +9,8 @@
 
 #ifndef QWT_EVENT_PATTERN
-#define QWT_EVENT_PATTERN 1
+#define QWT_EVENT_PATTERN
 
 #include "qwt_global.h"
+
 #include <qnamespace.h>
 #include <qvector.h>
@@ -19,80 +20,80 @@
 
 /*!
-  \brief A collection of event patterns
-
-  QwtEventPattern introduces an level of indirection for mouse and
-  keyboard inputs. Those are represented by symbolic names, so
-  the application code can be configured by individual mappings.
-
-  \sa QwtPicker, QwtPickerMachine, QwtPlotZoomer
-*/
+   \brief A collection of event patterns
+
+   QwtEventPattern introduces an level of indirection for mouse and
+   keyboard inputs. Those are represented by symbolic names, so
+   the application code can be configured by individual mappings.
+
+   \sa QwtPicker, QwtPickerMachine, QwtPlotZoomer
+ */
 class QWT_EXPORT QwtEventPattern
 {
-public:
+  public:
     /*!
-      \brief Symbolic mouse input codes
-
-      QwtEventPattern implements 3 different settings for
-      mice with 1, 2, or 3 buttons that can be activated
-      using initMousePattern(). The default setting is for
-      3 button mice.
-
-      Individual settings can be configured using setMousePattern().
-
-      \sa initMousePattern(), setMousePattern(), setKeyPattern()
-    */
+       \brief Symbolic mouse input codes
+
+       QwtEventPattern implements 3 different settings for
+       mice with 1, 2, or 3 buttons that can be activated
+       using initMousePattern(). The default setting is for
+       3 button mice.
+
+       Individual settings can be configured using setMousePattern().
+
+       \sa initMousePattern(), setMousePattern(), setKeyPattern()
+     */
     enum MousePatternCode
     {
         /*!
-          The default setting for 1, 2 and 3 button mice is:
-
-          - Qt::LeftButton
-          - Qt::LeftButton
-          - Qt::LeftButton
+           The default setting for 1, 2 and 3 button mice is:
+
+           - Qt::LeftButton
+           - Qt::LeftButton
+           - Qt::LeftButton
          */
         MouseSelect1,
 
         /*!
-          The default setting for 1, 2 and 3 button mice is:
-
-          - Qt::LeftButton + Qt::ControlModifier
-          - Qt::RightButton
-          - Qt::RightButton
+           The default setting for 1, 2 and 3 button mice is:
+
+           - Qt::LeftButton + Qt::ControlModifier
+           - Qt::RightButton
+           - Qt::RightButton
          */
         MouseSelect2,
 
         /*!
-          The default setting for 1, 2 and 3 button mice is:
-
-          - Qt::LeftButton + Qt::AltModifier
-          - Qt::LeftButton + Qt::AltModifier
-          - Qt::MidButton
+           The default setting for 1, 2 and 3 button mice is:
+
+           - Qt::LeftButton + Qt::AltModifier
+           - Qt::LeftButton + Qt::AltModifier
+           - Qt::MidButton
          */
         MouseSelect3,
 
         /*!
-          The default setting for 1, 2 and 3 button mice is:
-
-          - Qt::LeftButton + Qt::ShiftModifier
-          - Qt::LeftButton + Qt::ShiftModifier
-          - Qt::LeftButton + Qt::ShiftModifier
+           The default setting for 1, 2 and 3 button mice is:
+
+           - Qt::LeftButton + Qt::ShiftModifier
+           - Qt::LeftButton + Qt::ShiftModifier
+           - Qt::LeftButton + Qt::ShiftModifier
          */
         MouseSelect4,
 
         /*!
-          The default setting for 1, 2 and 3 button mice is:
-
-          - Qt::LeftButton + Qt::ControlButton | Qt::ShiftModifier
-          - Qt::RightButton + Qt::ShiftModifier
-          - Qt::RightButton + Qt::ShiftModifier
+           The default setting for 1, 2 and 3 button mice is:
+
+           - Qt::LeftButton + Qt::ControlButton | Qt::ShiftModifier
+           - Qt::RightButton + Qt::ShiftModifier
+           - Qt::RightButton + Qt::ShiftModifier
          */
         MouseSelect5,
 
         /*!
-          The default setting for 1, 2 and 3 button mice is:
-
-          - Qt::LeftButton + Qt::AltModifier + Qt::ShiftModifier
-          - Qt::LeftButton + Qt::AltModifier | Qt::ShiftModifier
-          - Qt::MidButton + Qt::ShiftModifier
+           The default setting for 1, 2 and 3 button mice is:
+
+           - Qt::LeftButton + Qt::AltModifier + Qt::ShiftModifier
+           - Qt::LeftButton + Qt::AltModifier | Qt::ShiftModifier
+           - Qt::MidButton + Qt::ShiftModifier
          */
         MouseSelect6,
@@ -103,10 +104,10 @@
 
     /*!
-      \brief Symbolic keyboard input codes
-
-      Individual settings can be configured using setKeyPattern()
-
-      \sa setKeyPattern(), setMousePattern()
-    */
+       \brief Symbolic keyboard input codes
+
+       Individual settings can be configured using setKeyPattern()
+
+       \sa setKeyPattern(), setMousePattern()
+     */
     enum KeyPatternCode
     {
@@ -148,8 +149,8 @@
     class MousePattern
     {
-    public:
+      public:
         //! Constructor
         MousePattern( Qt::MouseButton btn = Qt::NoButton,
-                Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ):
+            Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ):
             button( btn ),
             modifiers( modifierCodes )
@@ -167,8 +168,8 @@
     class KeyPattern
     {
-    public:
+      public:
         //! Constructor
         KeyPattern( int keyCode = Qt::Key_unknown,
-                Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ):
+            Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ):
             key( keyCode ),
             modifiers( modifierCodes )
@@ -195,29 +196,29 @@
         Qt::KeyboardModifiers modifiers = Qt::NoModifier );
 
-    void setMousePattern( const QVector<MousePattern> & );
-    void setKeyPattern( const QVector<KeyPattern> & );
-
-    const QVector<MousePattern> &mousePattern() const;
-    const QVector<KeyPattern> &keyPattern() const;
-
-    QVector<MousePattern> &mousePattern();
-    QVector<KeyPattern> &keyPattern();
-
-    bool mouseMatch( MousePatternCode, const QMouseEvent * ) const;
-    bool keyMatch( KeyPatternCode, const QKeyEvent * ) const;
-
-protected:
-    virtual bool mouseMatch( const MousePattern &, const QMouseEvent * ) const;
-    virtual bool keyMatch( const KeyPattern &, const QKeyEvent * ) const;
-
-private:
-
-#if defined(_MSC_VER)
+    void setMousePattern( const QVector< MousePattern >& );
+    void setKeyPattern( const QVector< KeyPattern >& );
+
+    const QVector< MousePattern >& mousePattern() const;
+    const QVector< KeyPattern >& keyPattern() const;
+
+    QVector< MousePattern >& mousePattern();
+    QVector< KeyPattern >& keyPattern();
+
+    bool mouseMatch( MousePatternCode, const QMouseEvent* ) const;
+    bool keyMatch( KeyPatternCode, const QKeyEvent* ) const;
+
+  protected:
+    virtual bool mouseMatch( const MousePattern&, const QMouseEvent* ) const;
+    virtual bool keyMatch( const KeyPattern&, const QKeyEvent* ) const;
+
+  private:
+
+#if defined( _MSC_VER )
 #pragma warning(push)
 #pragma warning(disable: 4251)
 #endif
-    QVector<MousePattern> d_mousePattern;
-    QVector<KeyPattern> d_keyPattern;
-#if defined(_MSC_VER)
+    QVector< MousePattern > m_mousePattern;
+    QVector< KeyPattern > m_keyPattern;
+#if defined( _MSC_VER )
 #pragma warning(pop)
 #endif
@@ -226,5 +227,5 @@
 //! Compare operator
 inline bool operator==( QwtEventPattern::MousePattern b1,
-    QwtEventPattern::MousePattern  b2 )
+    QwtEventPattern::MousePattern b2 )
 {
     return b1.button == b2.button && b1.modifiers == b2.modifiers;
@@ -233,5 +234,5 @@
 //! Compare operator
 inline bool operator==( QwtEventPattern::KeyPattern b1,
-   QwtEventPattern::KeyPattern  b2 )
+    QwtEventPattern::KeyPattern b2 )
 {
     return b1.key == b2.key && b1.modifiers == b2.modifiers;
Index: /trunk/BNC/qwt/qwt_global.h
===================================================================
--- /trunk/BNC/qwt/qwt_global.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_global.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -15,8 +15,8 @@
 // QWT_VERSION is (major << 16) + (minor << 8) + patch.
 
-#define QWT_VERSION       0x060106
-#define QWT_VERSION_STR   "6.1.6"
+#define QWT_VERSION       0x060300
+#define QWT_VERSION_STR   "6.3.0"
 
-#if defined(_MSC_VER) /* MSVC Compiler */
+#if defined( _MSC_VER ) /* MSVC Compiler */
 /* template-class specialization 'identifier' is already instantiated */
 #pragma warning(disable: 4660)
@@ -27,5 +27,5 @@
 #ifdef QWT_DLL
 
-#if defined(QWT_MAKEDLL)     // create a Qwt DLL library
+#if defined( QWT_MAKEDLL )     // create a Qwt DLL library
 #define QWT_EXPORT Q_DECL_EXPORT
 #else                        // use a Qwt DLL library
@@ -39,3 +39,22 @@
 #endif
 
+#define QWT_CONSTEXPR Q_DECL_CONSTEXPR
+
+#if QT_VERSION >= 0x050000
+#define QWT_OVERRIDE Q_DECL_OVERRIDE
+#define QWT_FINAL Q_DECL_FINAL
 #endif
+
+#ifndef QWT_CONSTEXPR
+#define QWT_CONSTEXPR
+#endif
+
+#ifndef QWT_OVERRIDE
+#define QWT_OVERRIDE
+#endif
+
+#ifndef QWT_FINAL
+#define QWT_FINAL
+#endif
+
+#endif
Index: /trunk/BNC/qwt/qwt_graphic.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_graphic.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_graphic.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,4 +10,6 @@
 #include "qwt_graphic.h"
 #include "qwt_painter_command.h"
+#include "qwt_math.h"
+
 #include <qvector.h>
 #include <qpainter.h>
@@ -16,7 +18,17 @@
 #include <qpixmap.h>
 #include <qpainterpath.h>
-#include <qmath.h>
-
-static bool qwtHasScalablePen( const QPainter *painter )
+
+#if QT_VERSION >= 0x050000
+
+#include <qguiapplication.h>
+
+static inline qreal qwtDevicePixelRatio()
+{
+    return qGuiApp ? qGuiApp->devicePixelRatio() : 1.0;
+}
+
+#endif
+
+static bool qwtHasScalablePen( const QPainter* painter )
 {
     const QPen pen = painter->pen();
@@ -27,4 +39,5 @@
     {
         scalablePen = !pen.isCosmetic();
+#if QT_VERSION < 0x050000
         if ( !scalablePen && pen.widthF() == 0.0 )
         {
@@ -33,4 +46,5 @@
                 scalablePen = true;
         }
+#endif
     }
 
@@ -39,5 +53,5 @@
 
 static QRectF qwtStrokedPathRect(
-    const QPainter *painter, const QPainterPath &path )
+    const QPainter* painter, const QPainterPath& path )
 {
     QPainterPathStroker stroker;
@@ -50,10 +64,10 @@
     if ( qwtHasScalablePen( painter ) )
     {
-        QPainterPath stroke = stroker.createStroke(path);
-        rect = painter->transform().map(stroke).boundingRect();
+        QPainterPath stroke = stroker.createStroke( path );
+        rect = painter->transform().map( stroke ).boundingRect();
     }
     else
     {
-        QPainterPath mappedPath = painter->transform().map(path);
+        QPainterPath mappedPath = painter->transform().map( path );
         mappedPath = stroker.createStroke( mappedPath );
 
@@ -65,8 +79,8 @@
 
 static inline void qwtExecCommand(
-    QPainter *painter, const QwtPainterCommand &cmd,
+    QPainter* painter, const QwtPainterCommand& cmd,
     QwtGraphic::RenderHints renderHints,
-    const QTransform &transform,
-    const QTransform *initialTransform )
+    const QTransform& transform,
+    const QTransform* initialTransform )
 {
     switch( cmd.type() )
@@ -76,8 +90,8 @@
             bool doMap = false;
 
-            if ( renderHints.testFlag( QwtGraphic::RenderPensUnscaled )
-                && painter->transform().isScaling() )
+            if ( painter->transform().isScaling() )
             {
                 bool isCosmetic = painter->pen().isCosmetic();
+#if QT_VERSION < 0x050000
                 if ( isCosmetic && painter->pen().widthF() == 0.0 )
                 {
@@ -86,6 +100,17 @@
                         isCosmetic = false;
                 }
-
-                doMap = !isCosmetic;
+#endif
+
+                if ( isCosmetic )
+                {
+                    // OpenGL2 seems to be buggy for cosmetic pens.
+                    // It interpolates curves in too rough steps then
+
+                    doMap = painter->paintEngine()->type() == QPaintEngine::OpenGL2;
+                }
+                else
+                {
+                    doMap = renderHints.testFlag( QwtGraphic::RenderPensUnscaled );
+                }
             }
 
@@ -115,5 +140,5 @@
         case QwtPainterCommand::Pixmap:
         {
-            const QwtPainterCommand::PixmapData *data = cmd.pixmapData();
+            const QwtPainterCommand::PixmapData* data = cmd.pixmapData();
             painter->drawPixmap( data->rect, data->pixmap, data->subRect );
             break;
@@ -121,5 +146,5 @@
         case QwtPainterCommand::Image:
         {
-            const QwtPainterCommand::ImageData *data = cmd.imageData();
+            const QwtPainterCommand::ImageData* data = cmd.imageData();
             painter->drawImage( data->rect, data->image,
                 data->subRect, data->flags );
@@ -128,5 +153,5 @@
         case QwtPainterCommand::State:
         {
-            const QwtPainterCommand::StateData *data = cmd.stateData();
+            const QwtPainterCommand::StateData* data = cmd.stateData();
 
             if ( data->flags & QPaintEngine::DirtyPen )
@@ -156,5 +181,5 @@
                 painter->setClipping( data->isClipEnabled );
 
-            if ( data->flags & QPaintEngine::DirtyClipRegion)
+            if ( data->flags & QPaintEngine::DirtyClipRegion )
             {
                 painter->setClipRegion( data->clipRegion,
@@ -167,28 +192,17 @@
             }
 
-            if ( data->flags & QPaintEngine::DirtyHints)
+            if ( data->flags & QPaintEngine::DirtyHints )
             {
-                const QPainter::RenderHints hints = data->renderHints;
-
-                painter->setRenderHint( QPainter::Antialiasing,
-                    hints.testFlag( QPainter::Antialiasing ) );
-
-                painter->setRenderHint( QPainter::TextAntialiasing,
-                    hints.testFlag( QPainter::TextAntialiasing ) );
-
-                painter->setRenderHint( QPainter::SmoothPixmapTransform,
-                    hints.testFlag( QPainter::SmoothPixmapTransform ) );
-
-                painter->setRenderHint( QPainter::HighQualityAntialiasing,
-                    hints.testFlag( QPainter::HighQualityAntialiasing ) );
-
-                painter->setRenderHint( QPainter::NonCosmeticDefaultPen,
-                    hints.testFlag( QPainter::NonCosmeticDefaultPen ) );
+                for ( int i = 0; i < 8; i++ )
+                {
+                    const QPainter::RenderHint hint = static_cast< QPainter::RenderHint >( 1 << i );
+                    painter->setRenderHint( hint, data->renderHints.testFlag( hint ) );
+                }
             }
 
-            if ( data->flags & QPaintEngine::DirtyCompositionMode)
+            if ( data->flags & QPaintEngine::DirtyCompositionMode )
                 painter->setCompositionMode( data->compositionMode );
 
-            if ( data->flags & QPaintEngine::DirtyOpacity)
+            if ( data->flags & QPaintEngine::DirtyOpacity )
                 painter->setOpacity( data->opacity );
 
@@ -198,29 +212,27 @@
             break;
     }
-
 }
 
 class QwtGraphic::PathInfo
 {
-public:
-    PathInfo():
-        d_scalablePen( false )
+  public:
+    PathInfo()
+        : m_scalablePen( false )
     {
         // QVector needs a default constructor
     }
 
-    PathInfo( const QRectF &pointRect,
-            const QRectF &boundingRect, bool scalablePen ):
-        d_pointRect( pointRect ),
-        d_boundingRect( boundingRect ),
-        d_scalablePen( scalablePen )
-    {
-    }
-
-    inline QRectF scaledBoundingRect( double sx, double sy,
-        bool scalePens ) const
+    PathInfo( const QRectF& pointRect,
+            const QRectF& boundingRect, bool scalablePen )
+        : m_pointRect( pointRect )
+        , m_boundingRect( boundingRect )
+        , m_scalablePen( scalablePen )
+    {
+    }
+
+    inline QRectF scaledBoundingRect( qreal sx, qreal sy, bool scalePens ) const
     {
         if ( sx == 1.0 && sy == 1.0 )
-            return d_boundingRect;
+            return m_boundingRect;
 
         QTransform transform;
@@ -228,16 +240,16 @@
 
         QRectF rect;
-        if ( scalePens && d_scalablePen )
-        {
-            rect = transform.mapRect( d_boundingRect );
+        if ( scalePens && m_scalablePen )
+        {
+            rect = transform.mapRect( m_boundingRect );
         }
         else
         {
-            rect = transform.mapRect( d_pointRect );
-
-            const double l = qAbs( d_pointRect.left() - d_boundingRect.left() );
-            const double r = qAbs( d_pointRect.right() - d_boundingRect.right() );
-            const double t = qAbs( d_pointRect.top() - d_boundingRect.top() );
-            const double b = qAbs( d_pointRect.bottom() - d_boundingRect.bottom() );
+            rect = transform.mapRect( m_pointRect );
+
+            const qreal l = qAbs( m_pointRect.left() - m_boundingRect.left() );
+            const qreal r = qAbs( m_pointRect.right() - m_boundingRect.right() );
+            const qreal t = qAbs( m_pointRect.top() - m_boundingRect.top() );
+            const qreal b = qAbs( m_pointRect.bottom() - m_boundingRect.bottom() );
 
             rect.adjust( -l, -t, r, b );
@@ -248,29 +260,29 @@
 
     inline double scaleFactorX( const QRectF& pathRect,
-        const QRectF &targetRect, bool scalePens ) const
+        const QRectF& targetRect, bool scalePens ) const
     {
         if ( pathRect.width() <= 0.0 )
             return 0.0;
 
-        const QPointF p0 = d_pointRect.center();
-
-        const double l = qAbs( pathRect.left() - p0.x() );
-        const double r = qAbs( pathRect.right() - p0.x() );
-
-        const double w = 2.0 * qMin( l, r )
+        const QPointF p0 = m_pointRect.center();
+
+        const qreal l = qAbs( pathRect.left() - p0.x() );
+        const qreal r = qAbs( pathRect.right() - p0.x() );
+
+        const double w = 2.0 * qwtMinF( l, r )
             * targetRect.width() / pathRect.width();
 
         double sx;
-        if ( scalePens && d_scalablePen )
-        {
-            sx = w / d_boundingRect.width();
+        if ( scalePens && m_scalablePen )
+        {
+            sx = w / m_boundingRect.width();
         }
         else
         {
-            const double pw = qMax(
-                qAbs( d_boundingRect.left() - d_pointRect.left() ),
-                qAbs( d_boundingRect.right() - d_pointRect.right() ) );
-
-            sx = ( w - 2 * pw ) / d_pointRect.width();
+            const qreal pw = qwtMaxF(
+                qAbs( m_boundingRect.left() - m_pointRect.left() ),
+                qAbs( m_boundingRect.right() - m_pointRect.right() ) );
+
+            sx = ( w - 2 * pw ) / m_pointRect.width();
         }
 
@@ -279,29 +291,29 @@
 
     inline double scaleFactorY( const QRectF& pathRect,
-        const QRectF &targetRect, bool scalePens ) const
+        const QRectF& targetRect, bool scalePens ) const
     {
         if ( pathRect.height() <= 0.0 )
             return 0.0;
 
-        const QPointF p0 = d_pointRect.center();
-
-        const double t = qAbs( pathRect.top() - p0.y() );
-        const double b = qAbs( pathRect.bottom() - p0.y() );
-
-        const double h = 2.0 * qMin( t, b )
+        const QPointF p0 = m_pointRect.center();
+
+        const qreal t = qAbs( pathRect.top() - p0.y() );
+        const qreal b = qAbs( pathRect.bottom() - p0.y() );
+
+        const qreal h = 2.0 * qwtMinF( t, b )
             * targetRect.height() / pathRect.height();
 
         double sy;
-        if ( scalePens && d_scalablePen )
-        {
-            sy = h / d_boundingRect.height();
+        if ( scalePens && m_scalablePen )
+        {
+            sy = h / m_boundingRect.height();
         }
         else
         {
-            const double pw =
-                qMax( qAbs( d_boundingRect.top() - d_pointRect.top() ),
-                qAbs( d_boundingRect.bottom() - d_pointRect.bottom() ) );
-
-            sy = ( h - 2 * pw ) / d_pointRect.height();
+            const qreal pw = qwtMaxF(
+                qAbs( m_boundingRect.top() - m_pointRect.top() ),
+                qAbs( m_boundingRect.bottom() - m_pointRect.bottom() ) );
+
+            sy = ( h - 2 * pw ) / m_pointRect.height();
         }
 
@@ -309,55 +321,52 @@
     }
 
-private:
-    QRectF d_pointRect;
-    QRectF d_boundingRect;
-    bool d_scalablePen;
+  private:
+    QRectF m_pointRect;
+    QRectF m_boundingRect;
+    bool m_scalablePen;
 };
 
 class QwtGraphic::PrivateData
 {
-public:
-    PrivateData():
-        boundingRect( 0.0, 0.0, -1.0, -1.0 ),
-        pointRect( 0.0, 0.0, -1.0, -1.0 ),
-        initialTransform( NULL )
+  public:
+    PrivateData()
+        : boundingRect( 0.0, 0.0, -1.0, -1.0 )
+        , pointRect( 0.0, 0.0, -1.0, -1.0 )
     {
     }
 
     QSizeF defaultSize;
-    QVector<QwtPainterCommand> commands;
-    QVector<QwtGraphic::PathInfo> pathInfos;
+    QVector< QwtPainterCommand > commands;
+    QVector< QwtGraphic::PathInfo > pathInfos;
 
     QRectF boundingRect;
     QRectF pointRect;
 
+    QwtGraphic::CommandTypes commandTypes;
     QwtGraphic::RenderHints renderHints;
-    QTransform *initialTransform;
 };
 
 /*!
-  \brief Constructor
-
-  Initializes a null graphic
-  \sa isNull()
- */
-QwtGraphic::QwtGraphic():
-    QwtNullPaintDevice()
+   \brief Constructor
+
+   Initializes a null graphic
+   \sa isNull()
+ */
+QwtGraphic::QwtGraphic()
 {
     setMode( QwtNullPaintDevice::PathMode );
-    d_data = new PrivateData;
-}
-
-/*!
-  \brief Copy constructor
-
-  \param other Source
-  \sa operator=()
- */
-QwtGraphic::QwtGraphic( const QwtGraphic &other ):
-    QwtNullPaintDevice()
+    m_data = new PrivateData;
+}
+
+/*!
+   \brief Copy constructor
+
+   \param other Source
+   \sa operator=()
+ */
+QwtGraphic::QwtGraphic( const QwtGraphic& other )
 {
     setMode( other.mode() );
-    d_data = new PrivateData( *other.d_data );
+    m_data = new PrivateData( *other.m_data );
 }
 
@@ -365,17 +374,17 @@
 QwtGraphic::~QwtGraphic()
 {
-    delete d_data;
-}
-
-/*!
-  \brief Assignment operator
-
-  \param other Source
-  \return A reference of this object
- */
-QwtGraphic& QwtGraphic::operator=(const QwtGraphic &other)
+    delete m_data;
+}
+
+/*!
+   \brief Assignment operator
+
+   \param other Source
+   \return A reference of this object
+ */
+QwtGraphic& QwtGraphic::operator=( const QwtGraphic& other )
 {
     setMode( other.mode() );
-    *d_data = *other.d_data;
+    *m_data = *other.m_data;
 
     return *this;
@@ -383,124 +392,138 @@
 
 /*!
-  \brief Clear all stored commands
-  \sa isNull()
+   \brief Clear all stored commands
+   \sa isNull()
  */
 void QwtGraphic::reset()
 {
-    d_data->commands.clear();
-    d_data->pathInfos.clear();
-
-    d_data->boundingRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
-    d_data->pointRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
-    d_data->defaultSize = QSizeF();
-
-}
-
-/*!
-  \return True, when no painter commands have been stored
-  \sa isEmpty(), commands()
-*/
+    m_data->commands.clear();
+    m_data->pathInfos.clear();
+
+    m_data->commandTypes = CommandTypes();
+
+    m_data->boundingRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
+    m_data->pointRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
+    m_data->defaultSize = QSizeF();
+}
+
+/*!
+   \return True, when no painter commands have been stored
+   \sa isEmpty(), commands()
+ */
 bool QwtGraphic::isNull() const
 {
-    return d_data->commands.isEmpty();
-}
-
-/*!
-  \return True, when the bounding rectangle is empty
-  \sa boundingRect(), isNull()
-*/
+    return m_data->commands.isEmpty();
+}
+
+/*!
+   \return True, when the bounding rectangle is empty
+   \sa boundingRect(), isNull()
+ */
 bool QwtGraphic::isEmpty() const
 {
-    return d_data->boundingRect.isEmpty();
-}
-
-/*!
-  Toggle an render hint
-
-  \param hint Render hint
-  \param on true/false
-
-  \sa testRenderHint(), RenderHint
-*/
+    return m_data->boundingRect.isEmpty();
+}
+
+/*!
+   \return Types of painter commands being used
+ */
+QwtGraphic::CommandTypes QwtGraphic::commandTypes() const
+{
+    return m_data->commandTypes;
+}
+
+/*!
+   Toggle an render hint
+
+   \param hint Render hint
+   \param on true/false
+
+   \sa testRenderHint(), RenderHint
+ */
 void QwtGraphic::setRenderHint( RenderHint hint, bool on )
 {
     if ( on )
-        d_data->renderHints |= hint;
+        m_data->renderHints |= hint;
     else
-        d_data->renderHints &= ~hint;
-}
-
-/*!
-  Test a render hint
-
-  \param hint Render hint
-  \return true/false
-  \sa setRenderHint(), RenderHint
-*/
+        m_data->renderHints &= ~hint;
+}
+
+/*!
+   Test a render hint
+
+   \param hint Render hint
+   \return true/false
+   \sa setRenderHint(), RenderHint
+ */
 bool QwtGraphic::testRenderHint( RenderHint hint ) const
 {
-    return d_data->renderHints.testFlag( hint );
-}
-
-/*!
-  The bounding rectangle is the controlPointRect()
-  extended by the areas needed for rendering the outlines
-  with unscaled pens.
-
-  \return Bounding rectangle of the graphic
-  \sa controlPointRect(), scaledBoundingRect()
+    return m_data->renderHints.testFlag( hint );
+}
+
+//! \return Render hints
+QwtGraphic::RenderHints QwtGraphic::renderHints() const
+{
+    return m_data->renderHints;
+}
+
+/*!
+   The bounding rectangle is the controlPointRect()
+   extended by the areas needed for rendering the outlines
+   with unscaled pens.
+
+   \return Bounding rectangle of the graphic
+   \sa controlPointRect(), scaledBoundingRect()
  */
 QRectF QwtGraphic::boundingRect() const
 {
-    if ( d_data->boundingRect.width() < 0 )
+    if ( m_data->boundingRect.width() < 0 )
         return QRectF();
 
-    return d_data->boundingRect;
-}
-
-/*!
-  The control point rectangle is the bounding rectangle
-  of all control points of the paths and the target
-  rectangles of the images/pixmaps.
-
-  \return Control point rectangle
-  \sa boundingRect(), scaledBoundingRect()
+    return m_data->boundingRect;
+}
+
+/*!
+   The control point rectangle is the bounding rectangle
+   of all control points of the paths and the target
+   rectangles of the images/pixmaps.
+
+   \return Control point rectangle
+   \sa boundingRect(), scaledBoundingRect()
  */
 QRectF QwtGraphic::controlPointRect() const
 {
-    if ( d_data->pointRect.width() < 0 )
+    if ( m_data->pointRect.width() < 0 )
         return QRectF();
 
-    return d_data->pointRect;
-}
-
-/*!
-  \brief Calculate the target rectangle for scaling the graphic
-
-  \param sx Horizontal scaling factor
-  \param sy Vertical scaling factor
-
-  \note In case of paths that are painted with a cosmetic pen
+    return m_data->pointRect;
+}
+
+/*!
+   \brief Calculate the target rectangle for scaling the graphic
+
+   \param sx Horizontal scaling factor
+   \param sy Vertical scaling factor
+
+   \note In case of paths that are painted with a cosmetic pen
         ( see QPen::isCosmetic() ) the target rectangle is different to
         multiplying the bounding rectangle.
 
-  \return Scaled bounding rectangle
-  \sa boundingRect(), controlPointRect()
- */
-QRectF QwtGraphic::scaledBoundingRect( double sx, double sy ) const
+   \return Scaled bounding rectangle
+   \sa boundingRect(), controlPointRect()
+ */
+QRectF QwtGraphic::scaledBoundingRect( qreal sx, qreal sy ) const
 {
     if ( sx == 1.0 && sy == 1.0 )
-        return d_data->boundingRect;
+        return m_data->boundingRect;
+
+    const bool scalePens = !( m_data->renderHints & RenderPensUnscaled );
 
     QTransform transform;
     transform.scale( sx, sy );
 
-    QRectF rect = transform.mapRect( d_data->pointRect );
-
-    for ( int i = 0; i < d_data->pathInfos.size(); i++ )
-    {
-        rect |= d_data->pathInfos[i].scaledBoundingRect( sx, sy,
-            !d_data->renderHints.testFlag( RenderPensUnscaled ) );
-    }
+    QRectF rect = transform.mapRect( m_data->pointRect );
+
+    for ( int i = 0; i < m_data->pathInfos.size(); i++ )
+        rect |= m_data->pathInfos[i].scaledBoundingRect( sx, sy, scalePens );
 
     return rect;
@@ -511,46 +534,46 @@
 {
     const QSizeF sz = defaultSize();
-    return QSize( qCeil( sz.width() ), qCeil( sz.height() ) );
-}
-
-/*!
-  \brief Set a default size
-
-  The default size is used in all methods rendering the graphic,
-  where no size is explicitly specified. Assigning an empty size
-  means, that the default size will be calculated from the bounding
-  rectangle.
-
-  The default setting is an empty size.
-
-  \param size Default size
-
-  \sa defaultSize(), boundingRect()
- */
-void QwtGraphic::setDefaultSize( const QSizeF &size )
-{
-    const double w = qMax( qreal( 0.0 ), size.width() );
-    const double h = qMax( qreal( 0.0 ), size.height() );
-
-    d_data->defaultSize = QSizeF( w, h );
-}
-
-/*!
-  \brief Default size
-
-  When a non empty size has been assigned by setDefaultSize() this
-  size will be returned. Otherwise the default size is the size
-  of the bounding rectangle.
-
-  The default size is used in all methods rendering the graphic,
-  where no size is explicitly specified.
-
-  \return Default size
-  \sa setDefaultSize(), boundingRect()
+    return QSize( qwtCeil( sz.width() ), qwtCeil( sz.height() ) );
+}
+
+/*!
+   \brief Set a default size
+
+   The default size is used in all methods rendering the graphic,
+   where no size is explicitly specified. Assigning an empty size
+   means, that the default size will be calculated from the bounding
+   rectangle.
+
+   The default setting is an empty size.
+
+   \param size Default size
+
+   \sa defaultSize(), boundingRect()
+ */
+void QwtGraphic::setDefaultSize( const QSizeF& size )
+{
+    const double w = qwtMaxF( 0.0, size.width() );
+    const double h = qwtMaxF( 0.0, size.height() );
+
+    m_data->defaultSize = QSizeF( w, h );
+}
+
+/*!
+   \brief Default size
+
+   When a non empty size has been assigned by setDefaultSize() this
+   size will be returned. Otherwise the default size is the size
+   of the bounding rectangle.
+
+   The default size is used in all methods rendering the graphic,
+   where no size is explicitly specified.
+
+   \return Default size
+   \sa setDefaultSize(), boundingRect()
  */
 QSizeF QwtGraphic::defaultSize() const
 {
-    if ( !d_data->defaultSize.isEmpty() )
-        return d_data->defaultSize;
+    if ( !m_data->defaultSize.isEmpty() )
+        return m_data->defaultSize;
 
     return boundingRect().size();
@@ -558,14 +581,57 @@
 
 /*!
-  \brief Replay all recorded painter commands
-  \param painter Qt painter
- */
-void QwtGraphic::render( QPainter *painter ) const
+   Find the height for a given width
+
+   The height is calculated using the aspect ratio of defaultSize().
+
+   \param width Width
+
+   \return Calculated height
+   \sa defaultSize()
+ */
+qreal QwtGraphic::heightForWidth( qreal width ) const
+{
+    const QSizeF sz = defaultSize();
+    if ( sz.isEmpty() )
+        return 0.0;
+
+    return sz.height() * width / sz.width();
+}
+
+/*!
+   Find the width for a given height
+
+   The width is calculated using the aspect ratio of defaultSize().
+
+   \param height Height
+
+   \return Calculated width
+   \sa defaultSize()
+ */
+qreal QwtGraphic::widthForHeight( qreal height ) const
+{
+    const QSizeF sz = defaultSize();
+    if ( sz.isEmpty() )
+        return 0.0;
+
+    return sz.width() * height / sz.height();
+}
+
+/*!
+   \brief Replay all recorded painter commands
+   \param painter Qt painter
+ */
+void QwtGraphic::render( QPainter* painter ) const
+{
+    renderGraphic( painter, NULL );
+}
+
+void QwtGraphic::renderGraphic( QPainter* painter, QTransform* initialTransform ) const
 {
     if ( isNull() )
         return;
 
-    const int numCommands = d_data->commands.size();
-    const QwtPainterCommand *commands = d_data->commands.constData();
+    const int numCommands = m_data->commands.size();
+    const QwtPainterCommand* commands = m_data->commands.constData();
 
     const QTransform transform = painter->transform();
@@ -576,5 +642,5 @@
     {
         qwtExecCommand( painter, commands[i],
-            d_data->renderHints, transform, d_data->initialTransform );
+            m_data->renderHints, transform, initialTransform );
     }
 
@@ -583,14 +649,14 @@
 
 /*!
-  \brief Replay all recorded painter commands
-
-  The graphic is scaled to fit into the rectangle
-  of the given size starting at ( 0, 0 ).
-
-  \param painter Qt painter
-  \param size Size for the scaled graphic
-  \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode
- */
-void QwtGraphic::render( QPainter *painter, const QSizeF &size,
+   \brief Replay all recorded painter commands
+
+   The graphic is scaled to fit into the rectangle
+   of the given size starting at ( 0, 0 ).
+
+   \param painter Qt painter
+   \param size Size for the scaled graphic
+   \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode
+ */
+void QwtGraphic::render( QPainter* painter, const QSizeF& size,
     Qt::AspectRatioMode aspectRatioMode ) const
 {
@@ -600,13 +666,13 @@
 
 /*!
-  \brief Replay all recorded painter commands
-
-  The graphic is scaled to fit into the given rectangle
-
-  \param painter Qt painter
-  \param rect Rectangle for the scaled graphic
-  \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode
- */
-void QwtGraphic::render( QPainter *painter, const QRectF &rect,
+   \brief Replay all recorded painter commands
+
+   The graphic is scaled to fit into the given rectangle
+
+   \param painter Qt painter
+   \param rect Rectangle for the scaled graphic
+   \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode
+ */
+void QwtGraphic::render( QPainter* painter, const QRectF& rect,
     Qt::AspectRatioMode aspectRatioMode ) const
 {
@@ -617,33 +683,32 @@
     double sy = 1.0;
 
-    if ( d_data->pointRect.width() > 0.0 )
-        sx = rect.width() / d_data->pointRect.width();
-
-    if ( d_data->pointRect.height() > 0.0 )
-        sy = rect.height() / d_data->pointRect.height();
-
-    const bool scalePens =
-        !d_data->renderHints.testFlag( RenderPensUnscaled );
-
-    for ( int i = 0; i < d_data->pathInfos.size(); i++ )
-    {
-        const PathInfo info = d_data->pathInfos[i];
+    if ( m_data->pointRect.width() > 0.0 )
+        sx = rect.width() / m_data->pointRect.width();
+
+    if ( m_data->pointRect.height() > 0.0 )
+        sy = rect.height() / m_data->pointRect.height();
+
+    const bool scalePens = !m_data->renderHints.testFlag( RenderPensUnscaled );
+
+    for ( int i = 0; i < m_data->pathInfos.size(); i++ )
+    {
+        const PathInfo& info = m_data->pathInfos[i];
 
         const double ssx = info.scaleFactorX(
-            d_data->pointRect, rect, scalePens );
+            m_data->pointRect, rect, scalePens );
 
         if ( ssx > 0.0 )
-            sx = qMin( sx, ssx );
+            sx = qwtMinF( sx, ssx );
 
         const double ssy = info.scaleFactorY(
-            d_data->pointRect, rect, scalePens );
+            m_data->pointRect, rect, scalePens );
 
         if ( ssy > 0.0 )
-            sy = qMin( sy, ssy );
+            sy = qwtMinF( sy, ssy );
     }
 
     if ( aspectRatioMode == Qt::KeepAspectRatio )
     {
-        const double s = qMin( sx, sy );
+        const qreal s = qwtMinF( sx, sy );
         sx = s;
         sy = s;
@@ -651,5 +716,5 @@
     else if ( aspectRatioMode == Qt::KeepAspectRatioByExpanding )
     {
-        const double s = qMax( sx, sy );
+        const qreal s = qwtMaxF( sx, sy );
         sx = s;
         sy = s;
@@ -657,10 +722,13 @@
 
     QTransform tr;
-    tr.translate( rect.center().x() - 0.5 * sx * d_data->pointRect.width(),
-        rect.center().y() - 0.5 * sy * d_data->pointRect.height() );
+    tr.translate( rect.center().x() - 0.5 * sx * m_data->pointRect.width(),
+        rect.center().y() - 0.5 * sy * m_data->pointRect.height() );
     tr.scale( sx, sy );
-    tr.translate( -d_data->pointRect.x(), -d_data->pointRect.y() );
+    tr.translate( -m_data->pointRect.x(), -m_data->pointRect.y() );
 
     const QTransform transform = painter->transform();
+
+    painter->setTransform( tr, true );
+
     if ( !scalePens && transform.isScaling() )
     {
@@ -669,30 +737,29 @@
         // painter transformation later
 
-        d_data->initialTransform = new QTransform();
-        d_data->initialTransform->scale( transform.m11(), transform.m22() );
-    }
-
-    painter->setTransform( tr, true );
-    render( painter );
+        QTransform initialTransform;
+        initialTransform.scale( transform.m11(), transform.m22() );
+
+        renderGraphic( painter, &initialTransform );
+    }
+    else
+    {
+        renderGraphic( painter, NULL );
+    }
 
     painter->setTransform( transform );
-
-    delete d_data->initialTransform;
-    d_data->initialTransform = NULL;
-}
-
-/*!
-  \brief Replay all recorded painter commands
-
-  The graphic is scaled to the defaultSize() and aligned
-  to a position.
-
-  \param painter Qt painter
-  \param pos Reference point, where to render
-  \param alignment Flags how to align the target rectangle
-                   to pos.
- */
-void QwtGraphic::render( QPainter *painter,
-    const QPointF &pos, Qt::Alignment alignment ) const
+}
+
+/*!
+   \brief Replay all recorded painter commands
+
+   The graphic is scaled to the defaultSize() and aligned
+   to a position.
+
+   \param painter Qt painter
+   \param pos Reference point, where to render
+   \param alignment Flags how to align the target rectangle to pos.
+ */
+void QwtGraphic::render( QPainter* painter,
+    const QPointF& pos, Qt::Alignment alignment ) const
 {
     QRectF r( pos, defaultSize() );
@@ -728,16 +795,20 @@
 
 /*!
-  \brief Convert the graphic to a QPixmap
-
-  All pixels of the pixmap get initialized by Qt::transparent
-  before the graphic is scaled and rendered on it.
-
-  The size of the pixmap is the default size ( ceiled to integers )
-  of the graphic.
-
-  \return The graphic as pixmap in default size
-  \sa defaultSize(), toImage(), render()
- */
-QPixmap QwtGraphic::toPixmap() const
+   \brief Convert the graphic to a QPixmap
+
+   All pixels of the pixmap get initialized by Qt::transparent
+   before the graphic is scaled and rendered on it.
+
+   The size of the pixmap is the default size ( ceiled to integers )
+   of the graphic.
+
+   \param devicePixelRatio Device pixel ratio for the pixmap.
+                          If devicePixelRatio <= 0.0 the pixmap
+                          is initialized with the system default.
+
+   \return The graphic as pixmap in default size
+   \sa defaultSize(), toImage(), render()
+ */
+QPixmap QwtGraphic::toPixmap( qreal devicePixelRatio ) const
 {
     if ( isNull() )
@@ -746,8 +817,22 @@
     const QSizeF sz = defaultSize();
 
-    const int w = qCeil( sz.width() );
-    const int h = qCeil( sz.height() );
+#if QT_VERSION >= 0x050000
+    if ( devicePixelRatio <= 0.0 )
+        devicePixelRatio = qwtDevicePixelRatio();
+
+    const int w = qwtCeil( sz.width() * devicePixelRatio );
+    const int h = qwtCeil( sz.height() * devicePixelRatio );
 
     QPixmap pixmap( w, h );
+    pixmap.setDevicePixelRatio( devicePixelRatio );
+#else
+    Q_UNUSED( devicePixelRatio )
+
+    const int w = qwtCeil( sz.width() );
+    const int h = qwtCeil( sz.height() );
+
+    QPixmap pixmap( w, h );
+#endif
+
     pixmap.fill( Qt::transparent );
 
@@ -762,19 +847,34 @@
 
 /*!
-  \brief Convert the graphic to a QPixmap
-
-  All pixels of the pixmap get initialized by Qt::transparent
-  before the graphic is scaled and rendered on it.
-
-  \param size Size of the image
-  \param aspectRatioMode Aspect ratio how to scale the graphic
-
-  \return The graphic as pixmap
-  \sa toImage(), render()
- */
-QPixmap QwtGraphic::toPixmap( const QSize &size,
-    Qt::AspectRatioMode aspectRatioMode ) const
-{
+   \brief Convert the graphic to a QPixmap
+
+   All pixels of the pixmap get initialized by Qt::transparent
+   before the graphic is scaled and rendered on it.
+
+   \param size Size of the image
+   \param aspectRatioMode Aspect ratio how to scale the graphic
+   \param devicePixelRatio Device pixel ratio for the pixmap.
+                          If devicePixelRatio <= 0.0 the pixmap
+                          is initialized with the system default.
+
+   \return The graphic as pixmap
+   \sa toImage(), render()
+ */
+QPixmap QwtGraphic::toPixmap( const QSize& size,
+    Qt::AspectRatioMode aspectRatioMode, qreal devicePixelRatio ) const
+{
+#if QT_VERSION >= 0x050000
+    if ( devicePixelRatio <= 0.0 )
+        devicePixelRatio = qwtDevicePixelRatio();
+
+    const int w = qwtCeil( size.width() * devicePixelRatio );
+    const int h = qwtCeil( size.height() * devicePixelRatio );
+
+    QPixmap pixmap( w, h );
+    pixmap.setDevicePixelRatio( devicePixelRatio );
+#else
+    Q_UNUSED( devicePixelRatio )
     QPixmap pixmap( size );
+#endif
     pixmap.fill( Qt::transparent );
 
@@ -789,21 +889,37 @@
 
 /*!
-  \brief Convert the graphic to a QImage
-
-  All pixels of the image get initialized by 0 ( transparent )
-  before the graphic is scaled and rendered on it.
-
-  The format of the image is QImage::Format_ARGB32_Premultiplied.
-
-  \param size Size of the image
-  \param aspectRatioMode Aspect ratio how to scale the graphic
-
-  \return The graphic as image
-  \sa toPixmap(), render()
- */
-QImage QwtGraphic::toImage( const QSize &size,
-    Qt::AspectRatioMode aspectRatioMode  ) const
-{
+   \brief Convert the graphic to a QImage
+
+   All pixels of the image get initialized by 0 ( transparent )
+   before the graphic is scaled and rendered on it.
+
+   The format of the image is QImage::Format_ARGB32_Premultiplied.
+
+   \param size Size of the image ( will be multiplied by the devicePixelRatio )
+   \param aspectRatioMode Aspect ratio how to scale the graphic
+   \param devicePixelRatio Device pixel ratio for the image.
+                          If devicePixelRatio <= 0.0 the pixmap
+                          is initialized with the system default.
+
+   \return The graphic as image
+   \sa toPixmap(), render()
+ */
+QImage QwtGraphic::toImage( const QSize& size,
+    Qt::AspectRatioMode aspectRatioMode, qreal devicePixelRatio  ) const
+{
+#if QT_VERSION >= 0x050000
+    if ( devicePixelRatio <= 0.0 )
+        devicePixelRatio = qwtDevicePixelRatio();
+
+    const int w = qwtCeil( size.width() * devicePixelRatio );
+    const int h = qwtCeil( size.height() * devicePixelRatio );
+
+    QImage image( w, h, QImage::Format_ARGB32_Premultiplied );
+    image.setDevicePixelRatio( devicePixelRatio );
+#else
+    Q_UNUSED( devicePixelRatio )
     QImage image( size, QImage::Format_ARGB32_Premultiplied );
+#endif
+
     image.fill( 0 );
 
@@ -818,18 +934,22 @@
 
 /*!
-  \brief Convert the graphic to a QImage
-
-  All pixels of the image get initialized by 0 ( transparent )
-  before the graphic is scaled and rendered on it.
-
-  The format of the image is QImage::Format_ARGB32_Premultiplied.
-
-  The size of the image is the default size ( ceiled to integers )
-  of the graphic.
-
-  \return The graphic as image in default size
-  \sa defaultSize(), toPixmap(), render()
- */
-QImage QwtGraphic::toImage() const
+   \brief Convert the graphic to a QImage
+
+   All pixels of the image get initialized by 0 ( transparent )
+   before the graphic is scaled and rendered on it.
+
+   The format of the image is QImage::Format_ARGB32_Premultiplied.
+
+   The size of the image is the default size ( ceiled to integers )
+   of the graphic multiplied by the devicePixelRatio.
+
+   \param devicePixelRatio Device pixel ratio for the image.
+                          If devicePixelRatio <= 0.0 the pixmap
+                          is initialized with the system default.
+
+   \return The graphic as image in default size
+   \sa defaultSize(), toPixmap(), render()
+ */
+QImage QwtGraphic::toImage( qreal devicePixelRatio ) const
 {
     if ( isNull() )
@@ -838,8 +958,22 @@
     const QSizeF sz = defaultSize();
 
-    const int w = qCeil( sz.width() );
-    const int h = qCeil( sz.height() );
+#if QT_VERSION >= 0x050000
+    if ( devicePixelRatio <= 0.0 )
+        devicePixelRatio = qwtDevicePixelRatio();
+
+    const int w = qwtCeil( sz.width() * devicePixelRatio );
+    const int h = qwtCeil( sz.height() * devicePixelRatio );
 
     QImage image( w, h, QImage::Format_ARGB32 );
+    image.setDevicePixelRatio( devicePixelRatio );
+#else
+    Q_UNUSED( devicePixelRatio )
+
+    const int w = qwtCeil( sz.width() );
+    const int h = qwtCeil( sz.height() );
+
+    QImage image( w, h, QImage::Format_ARGB32 );
+#endif
+
     image.fill( 0 );
 
@@ -854,16 +988,17 @@
 
 /*!
-  Store a path command in the command list
-
-  \param path Painter path
-  \sa QPaintEngine::drawPath()
-*/
-void QwtGraphic::drawPath( const QPainterPath &path )
-{
-    const QPainter *painter = paintEngine()->painter();
+   Store a path command in the command list
+
+   \param path Painter path
+   \sa QPaintEngine::drawPath()
+ */
+void QwtGraphic::drawPath( const QPainterPath& path )
+{
+    const QPainter* painter = paintEngine()->painter();
     if ( painter == NULL )
         return;
 
-    d_data->commands += QwtPainterCommand( path );
+    m_data->commands += QwtPainterCommand( path );
+    m_data->commandTypes |= QwtGraphic::VectorData;
 
     if ( !path.isEmpty() )
@@ -883,5 +1018,5 @@
         updateBoundingRect( boundingRect );
 
-        d_data->pathInfos += PathInfo( pointRect,
+        m_data->pathInfos += PathInfo( pointRect,
             boundingRect, qwtHasScalablePen( painter ) );
     }
@@ -889,20 +1024,21 @@
 
 /*!
-  \brief Store a pixmap command in the command list
-
-  \param rect target rectangle
-  \param pixmap Pixmap to be painted
-  \param subRect Reactangle of the pixmap to be painted
-
-  \sa QPaintEngine::drawPixmap()
-*/
-void QwtGraphic::drawPixmap( const QRectF &rect,
-    const QPixmap &pixmap, const QRectF &subRect )
-{
-    const QPainter *painter = paintEngine()->painter();
+   \brief Store a pixmap command in the command list
+
+   \param rect target rectangle
+   \param pixmap Pixmap to be painted
+   \param subRect Reactangle of the pixmap to be painted
+
+   \sa QPaintEngine::drawPixmap()
+ */
+void QwtGraphic::drawPixmap( const QRectF& rect,
+    const QPixmap& pixmap, const QRectF& subRect )
+{
+    const QPainter* painter = paintEngine()->painter();
     if ( painter == NULL )
         return;
 
-    d_data->commands += QwtPainterCommand( rect, pixmap, subRect );
+    m_data->commands += QwtPainterCommand( rect, pixmap, subRect );
+    m_data->commandTypes |= QwtGraphic::RasterData;
 
     const QRectF r = painter->transform().mapRect( rect );
@@ -912,21 +1048,22 @@
 
 /*!
-  \brief Store a image command in the command list
-
-  \param rect traget rectangle
-  \param image Image to be painted
-  \param subRect Reactangle of the pixmap to be painted
-  \param flags Image conversion flags
-
-  \sa QPaintEngine::drawImage()
- */
-void QwtGraphic::drawImage( const QRectF &rect, const QImage &image,
-    const QRectF &subRect, Qt::ImageConversionFlags flags)
-{
-    const QPainter *painter = paintEngine()->painter();
+   \brief Store a image command in the command list
+
+   \param rect target rectangle
+   \param image Image to be painted
+   \param subRect Reactangle of the pixmap to be painted
+   \param flags Image conversion flags
+
+   \sa QPaintEngine::drawImage()
+ */
+void QwtGraphic::drawImage( const QRectF& rect, const QImage& image,
+    const QRectF& subRect, Qt::ImageConversionFlags flags )
+{
+    const QPainter* painter = paintEngine()->painter();
     if ( painter == NULL )
         return;
 
-    d_data->commands += QwtPainterCommand( rect, image, subRect, flags );
+    m_data->commands += QwtPainterCommand( rect, image, subRect, flags );
+    m_data->commandTypes |= QwtGraphic::RasterData;
 
     const QRectF r = painter->transform().mapRect( rect );
@@ -937,19 +1074,33 @@
 
 /*!
-  \brief Store a state command in the command list
-
-  \param state State to be stored
-  \sa QPaintEngine::updateState()
- */
-void QwtGraphic::updateState( const QPaintEngineState &state)
-{
-    d_data->commands += QwtPainterCommand( state );
-}
-
-void QwtGraphic::updateBoundingRect( const QRectF &rect )
+   \brief Store a state command in the command list
+
+   \param state State to be stored
+   \sa QPaintEngine::updateState()
+ */
+void QwtGraphic::updateState( const QPaintEngineState& state )
+{
+    m_data->commands += QwtPainterCommand( state );
+
+    if ( state.state() & QPaintEngine::DirtyTransform )
+    {
+        if ( !( m_data->commandTypes & QwtGraphic::Transformation ) )
+        {
+            /*
+                QTransform::isScaling() returns true for all type
+                of transformations beside simple translations
+                even if it is f.e a rotation
+             */
+            if ( state.transform().isScaling() )
+                m_data->commandTypes |= QwtGraphic::Transformation;
+        }
+    }
+}
+
+void QwtGraphic::updateBoundingRect( const QRectF& rect )
 {
     QRectF br = rect;
 
-    const QPainter *painter = paintEngine()->painter();
+    const QPainter* painter = paintEngine()->painter();
     if ( painter && painter->hasClipping() )
     {
@@ -960,34 +1111,34 @@
     }
 
-    if ( d_data->boundingRect.width() < 0 )
-        d_data->boundingRect = br;
+    if ( m_data->boundingRect.width() < 0 )
+        m_data->boundingRect = br;
     else
-        d_data->boundingRect |= br;
-}
-
-void QwtGraphic::updateControlPointRect( const QRectF &rect )
-{
-    if ( d_data->pointRect.width() < 0.0 )
-        d_data->pointRect = rect;
+        m_data->boundingRect |= br;
+}
+
+void QwtGraphic::updateControlPointRect( const QRectF& rect )
+{
+    if ( m_data->pointRect.width() < 0.0 )
+        m_data->pointRect = rect;
     else
-        d_data->pointRect |= rect;
-}
-
-/*!
-  \return List of recorded paint commands
-  \sa setCommands()
- */
-const QVector< QwtPainterCommand > &QwtGraphic::commands() const
-{
-    return d_data->commands;
-}
-
-/*!
-  \brief Append paint commands
-
-  \param commands Paint commands
-  \sa commands()
- */
-void QwtGraphic::setCommands( QVector< QwtPainterCommand > &commands )
+        m_data->pointRect |= rect;
+}
+
+/*!
+   \return List of recorded paint commands
+   \sa setCommands()
+ */
+const QVector< QwtPainterCommand >& QwtGraphic::commands() const
+{
+    return m_data->commands;
+}
+
+/*!
+   \brief Append paint commands
+
+   \param commands Paint commands
+   \sa commands()
+ */
+void QwtGraphic::setCommands( const QVector< QwtPainterCommand >& commands )
 {
     reset();
@@ -1000,9 +1151,12 @@
     // the commands.
 
-    const QwtPainterCommand *cmds = commands.constData();
+    const QwtPainterCommand* cmds = commands.constData();
+
+    const QTransform noTransform;
+    const RenderHints noRenderHints;
 
     QPainter painter( this );
     for ( int i = 0; i < numCommands; i++ )
-        qwtExecCommand( &painter, cmds[i], RenderHints(), QTransform(), NULL );
+        qwtExecCommand( &painter, cmds[i], noRenderHints, noTransform, NULL );
 
     painter.end();
Index: /trunk/BNC/qwt/qwt_graphic.h
===================================================================
--- /trunk/BNC/qwt/qwt_graphic.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_graphic.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,9 +13,10 @@
 #include "qwt_global.h"
 #include "qwt_null_paintdevice.h"
+
 #include <qmetatype.h>
-#include <qimage.h>
-#include <qpixmap.h>
 
 class QwtPainterCommand;
+class QPixmap;
+class QImage;
 
 /*!
@@ -72,7 +73,7 @@
     \sa QwtPainterCommand
  */
-class QWT_EXPORT QwtGraphic: public QwtNullPaintDevice
+class QWT_EXPORT QwtGraphic : public QwtNullPaintDevice
 {
-public:
+  public:
     /*!
         Hint how to render a graphic
@@ -96,17 +97,30 @@
     };
 
+    Q_DECLARE_FLAGS( RenderHints, RenderHint )
+
     /*!
-        \brief Render hints
-
-        The default setting is to disable all hints
+       Indicator if the graphic contains a specific type of painter command
+       \sa CommandTypes, commandTypes();
      */
-    typedef QFlags<RenderHint> RenderHints;
+    enum CommandType
+    {
+        //! The graphic contains scalable vector data
+        VectorData     = 1 << 0,
+
+        //! The graphic contains raster data ( QPixmap or QImage )
+        RasterData     = 1 << 1,
+
+        //! The graphic contains transformations beyond simple translations
+        Transformation = 1 << 2
+    };
+
+    Q_DECLARE_FLAGS( CommandTypes, CommandType )
 
     QwtGraphic();
-    QwtGraphic( const QwtGraphic & );
+    QwtGraphic( const QwtGraphic& );
 
     virtual ~QwtGraphic();
 
-    QwtGraphic& operator=( const QwtGraphic & );
+    QwtGraphic& operator=( const QwtGraphic& );
 
     void reset();
@@ -115,61 +129,75 @@
     bool isEmpty() const;
 
-    void render( QPainter * ) const;
-
-    void render( QPainter *, const QSizeF &,
-            Qt::AspectRatioMode = Qt::IgnoreAspectRatio  ) const;
-
-    void render( QPainter *, const QRectF &,
-            Qt::AspectRatioMode = Qt::IgnoreAspectRatio  ) const;
-
-    void render( QPainter *, const QPointF &,
+    CommandTypes commandTypes() const;
+
+    void render( QPainter* ) const;
+
+    void render( QPainter*, const QSizeF&,
+        Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
+
+    void render( QPainter*, const QPointF&,
         Qt::Alignment = Qt::AlignTop | Qt::AlignLeft ) const;
 
-    QPixmap toPixmap() const;
-    QPixmap toPixmap( const QSize &,
-        Qt::AspectRatioMode = Qt::IgnoreAspectRatio  ) const;
-
-    QImage toImage() const;
-    QImage toImage( const QSize &,
-        Qt::AspectRatioMode = Qt::IgnoreAspectRatio  ) const;
-
-    QRectF scaledBoundingRect( double sx, double sy ) const;
+    void render( QPainter*, const QRectF&,
+        Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
+
+    QPixmap toPixmap( qreal devicePixelRatio = 0.0 ) const;
+
+    QPixmap toPixmap( const QSize&,
+        Qt::AspectRatioMode = Qt::IgnoreAspectRatio,
+        qreal devicePixelRatio = 0.0 ) const;
+
+    QImage toImage( qreal devicePixelRatio = 0.0 ) const;
+
+    QImage toImage( const QSize&,
+        Qt::AspectRatioMode = Qt::IgnoreAspectRatio,
+        qreal devicePixelRatio = 0.0 ) const;
+
+    QRectF scaledBoundingRect( qreal sx, qreal sy ) const;
 
     QRectF boundingRect() const;
     QRectF controlPointRect() const;
 
-    const QVector< QwtPainterCommand > &commands() const;
-    void setCommands( QVector< QwtPainterCommand > & );
-
-    void setDefaultSize( const QSizeF & );
+    const QVector< QwtPainterCommand >& commands() const;
+    void setCommands( const QVector< QwtPainterCommand >& );
+
+    void setDefaultSize( const QSizeF& );
     QSizeF defaultSize() const;
+
+    qreal heightForWidth( qreal width ) const;
+    qreal widthForHeight( qreal height ) const;
 
     void setRenderHint( RenderHint, bool on = true );
     bool testRenderHint( RenderHint ) const;
 
-protected:
-    virtual QSize sizeMetrics() const;
-
-    virtual void drawPath( const QPainterPath & );
-
-    virtual void drawPixmap( const QRectF &,
-        const QPixmap &, const QRectF & );
-
-    virtual void drawImage( const QRectF &,
-        const QImage &, const QRectF &, Qt::ImageConversionFlags );
-
-    virtual void updateState( const QPaintEngineState &state );
-
-private:
-    void updateBoundingRect( const QRectF & );
-    void updateControlPointRect( const QRectF & );
+    RenderHints renderHints() const;
+
+  protected:
+    virtual QSize sizeMetrics() const QWT_OVERRIDE;
+
+    virtual void drawPath( const QPainterPath& ) QWT_OVERRIDE;
+
+    virtual void drawPixmap( const QRectF&,
+        const QPixmap&, const QRectF& ) QWT_OVERRIDE;
+
+    virtual void drawImage( const QRectF&, const QImage&,
+        const QRectF&, Qt::ImageConversionFlags ) QWT_OVERRIDE;
+
+    virtual void updateState( const QPaintEngineState& ) QWT_OVERRIDE;
+
+  private:
+    void renderGraphic( QPainter*, QTransform* ) const;
+
+    void updateBoundingRect( const QRectF& );
+    void updateControlPointRect( const QRectF& );
 
     class PathInfo;
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtGraphic::RenderHints )
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtGraphic::CommandTypes )
 Q_DECLARE_METATYPE( QwtGraphic )
 
Index: /trunk/BNC/qwt/qwt_interval.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_interval.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_interval.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,22 +9,29 @@
 
 #include "qwt_interval.h"
-#include "qwt_math.h"
-#include <qalgorithms.h>
-
-/*!
-  \brief Normalize the limits of the interval
-
-  If maxValue() < minValue() the limits will be inverted.
-  \return Normalized interval
-
-  \sa isValid(), inverted()
-*/
+
+namespace
+{
+    static const struct RegisterQwtInterval
+    {
+        inline RegisterQwtInterval() { qRegisterMetaType< QwtInterval >(); }
+
+    } qwtRegisterQwtInterval;
+}
+
+/*!
+   \brief Normalize the limits of the interval
+
+   If maxValue() < minValue() the limits will be inverted.
+   \return Normalized interval
+
+   \sa isValid(), inverted()
+ */
 QwtInterval QwtInterval::normalized() const
 {
-    if ( d_minValue > d_maxValue )
+    if ( m_minValue > m_maxValue )
     {
         return inverted();
     }
-    if ( d_minValue == d_maxValue && d_borderFlags == ExcludeMinimum )
+    if ( m_minValue == m_maxValue && m_borderFlags == ExcludeMinimum )
     {
         return inverted();
@@ -35,25 +42,27 @@
 
 /*!
-  Invert the limits of the interval
-  \return Inverted interval
-  \sa normalized()
-*/
+   Invert the limits of the interval
+   \return Inverted interval
+   \sa normalized()
+ */
 QwtInterval QwtInterval::inverted() const
 {
     BorderFlags borderFlags = IncludeBorders;
-    if ( d_borderFlags & ExcludeMinimum )
+
+    if ( m_borderFlags & ExcludeMinimum )
         borderFlags |= ExcludeMaximum;
-    if ( d_borderFlags & ExcludeMaximum )
+
+    if ( m_borderFlags & ExcludeMaximum )
         borderFlags |= ExcludeMinimum;
 
-    return QwtInterval( d_maxValue, d_minValue, borderFlags );
-}
-
-/*!
-  Test if a value is inside an interval
-
-  \param value Value
-  \return true, if value >= minValue() && value <= maxValue()
-*/
+    return QwtInterval( m_maxValue, m_minValue, borderFlags );
+}
+
+/*!
+   Test if a value is inside an interval
+
+   \param value Value
+   \return true, if value lies inside the boundaries
+ */
 bool QwtInterval::contains( double value ) const
 {
@@ -61,11 +70,11 @@
         return false;
 
-    if ( value < d_minValue || value > d_maxValue )
-        return false;
-
-    if ( value == d_minValue && d_borderFlags & ExcludeMinimum )
-        return false;
-
-    if ( value == d_maxValue && d_borderFlags & ExcludeMaximum )
+    if ( ( value < m_minValue ) || ( value > m_maxValue ) )
+        return false;
+
+    if ( ( value == m_minValue ) && ( m_borderFlags & ExcludeMinimum ) )
+        return false;
+
+    if ( ( value == m_maxValue ) && ( m_borderFlags & ExcludeMaximum ) )
         return false;
 
@@ -73,10 +82,48 @@
 }
 
+/*!
+   Test if an interval is inside an interval
+
+   \param interval Interval
+   \return true, if interval lies inside the boundaries
+ */
+bool QwtInterval::contains( const QwtInterval& interval ) const
+{
+    if ( !isValid() || !interval.isValid() )
+        return false;
+
+    if ( ( interval.m_minValue < m_minValue ) || ( interval.m_maxValue > m_maxValue ) )
+        return false;
+
+    if ( m_borderFlags )
+    {
+        if ( interval.m_minValue == m_minValue )
+        {
+            if ( ( m_borderFlags & ExcludeMinimum )
+                && !( interval.m_borderFlags & ExcludeMinimum ) )
+            {
+                return false;
+            }
+        }
+
+        if ( interval.m_maxValue == m_maxValue )
+        {
+            if ( ( m_borderFlags & ExcludeMaximum )
+                && !( interval.m_borderFlags & ExcludeMaximum ) )
+            {
+                return false;
+            }
+        }
+    }
+
+    return true;
+}
+
 //! Unite 2 intervals
-QwtInterval QwtInterval::unite( const QwtInterval &other ) const
+QwtInterval QwtInterval::unite( const QwtInterval& other ) const
 {
     /*
-     If one of the intervals is invalid return the other one.
-     If both are invalid return an invalid default interval
+       If one of the intervals is invalid return the other one.
+       If both are invalid return an invalid default interval
      */
     if ( !isValid() )
@@ -94,35 +141,35 @@
 
     // minimum
-    if ( d_minValue < other.minValue() )
-    {
-        united.setMinValue( d_minValue );
-        flags &= d_borderFlags & ExcludeMinimum;
-    }
-    else if ( other.minValue() < d_minValue )
+    if ( m_minValue < other.minValue() )
+    {
+        united.setMinValue( m_minValue );
+        flags &= m_borderFlags & ExcludeMinimum;
+    }
+    else if ( other.minValue() < m_minValue )
     {
         united.setMinValue( other.minValue() );
         flags &= other.borderFlags() & ExcludeMinimum;
     }
-    else // d_minValue == other.minValue()
-    {
-        united.setMinValue( d_minValue );
-        flags &= ( d_borderFlags & other.borderFlags() ) & ExcludeMinimum;
+    else // m_minValue == other.minValue()
+    {
+        united.setMinValue( m_minValue );
+        flags &= ( m_borderFlags & other.borderFlags() ) & ExcludeMinimum;
     }
 
     // maximum
-    if ( d_maxValue > other.maxValue() )
-    {
-        united.setMaxValue( d_maxValue );
-        flags &= d_borderFlags & ExcludeMaximum;
-    }
-    else if ( other.maxValue() > d_maxValue )
+    if ( m_maxValue > other.maxValue() )
+    {
+        united.setMaxValue( m_maxValue );
+        flags &= m_borderFlags & ExcludeMaximum;
+    }
+    else if ( other.maxValue() > m_maxValue )
     {
         united.setMaxValue( other.maxValue() );
         flags &= other.borderFlags() & ExcludeMaximum;
     }
-    else // d_maxValue == other.maxValue() )
-    {
-        united.setMaxValue( d_maxValue );
-        flags &= d_borderFlags & other.borderFlags() & ExcludeMaximum;
+    else // m_maxValue == other.maxValue() )
+    {
+        united.setMaxValue( m_maxValue );
+        flags &= m_borderFlags & other.borderFlags() & ExcludeMaximum;
     }
 
@@ -132,10 +179,10 @@
 
 /*!
-  \brief Intersect 2 intervals
-
-  \param other Interval to be intersect with
-  \return Intersection
- */
-QwtInterval QwtInterval::intersect( const QwtInterval &other ) const
+   \brief Intersect 2 intervals
+
+   \param other Interval to be intersect with
+   \return Intersection
+ */
+QwtInterval QwtInterval::intersect( const QwtInterval& other ) const
 {
     if ( !other.isValid() || !isValid() )
@@ -199,10 +246,10 @@
 
 /*!
-  \brief Unite this interval with the given interval.
-
-  \param other Interval to be united with
-  \return This interval
- */
-QwtInterval& QwtInterval::operator|=( const QwtInterval &other )
+   \brief Unite this interval with the given interval.
+
+   \param other Interval to be united with
+   \return This interval
+ */
+QwtInterval& QwtInterval::operator|=( const QwtInterval& other )
 {
     *this = *this | other;
@@ -211,10 +258,10 @@
 
 /*!
-  \brief Intersect this interval with the given interval.
-
-  \param other Interval to be intersected with
-  \return This interval
- */
-QwtInterval& QwtInterval::operator&=( const QwtInterval &other )
+   \brief Intersect this interval with the given interval.
+
+   \param other Interval to be intersected with
+   \return This interval
+ */
+QwtInterval& QwtInterval::operator&=( const QwtInterval& other )
 {
     *this = *this & other;
@@ -223,10 +270,10 @@
 
 /*!
-  \brief Test if two intervals overlap
-
-  \param other Interval
-  \return True, when the intervals are intersecting
-*/
-bool QwtInterval::intersects( const QwtInterval &other ) const
+   \brief Test if two intervals overlap
+
+   \param other Interval
+   \return True, when the intervals are intersecting
+ */
+bool QwtInterval::intersects( const QwtInterval& other ) const
 {
     if ( !isValid() || !other.isValid() )
@@ -244,5 +291,5 @@
     }
     else if ( i1.minValue() == i2.minValue() &&
-              i1.borderFlags() & ExcludeMinimum )
+        i1.borderFlags() & ExcludeMinimum )
     {
         qSwap( i1, i2 );
@@ -256,5 +303,5 @@
     {
         return !( ( i1.borderFlags() & ExcludeMaximum ) ||
-            ( i2.borderFlags() & ExcludeMinimum ) );
+               ( i2.borderFlags() & ExcludeMinimum ) );
     }
     return false;
@@ -262,10 +309,10 @@
 
 /*!
-  Adjust the limit that is closer to value, so that value becomes
-  the center of the interval.
-
-  \param value Center
-  \return Interval with value as center
-*/
+   Adjust the limit that is closer to value, so that value becomes
+   the center of the interval.
+
+   \param value Center
+   \return Interval with value as center
+ */
 QwtInterval QwtInterval::symmetrize( double value ) const
 {
@@ -274,5 +321,5 @@
 
     const double delta =
-        qMax( qAbs( value - d_maxValue ), qAbs( value - d_minValue ) );
+        qMax( qAbs( value - m_maxValue ), qAbs( value - m_minValue ) );
 
     return QwtInterval( value - delta, value + delta );
@@ -280,11 +327,11 @@
 
 /*!
-  Limit the interval, keeping the border modes
-
-  \param lowerBound Lower limit
-  \param upperBound Upper limit
-
-  \return Limited interval
-*/
+   Limit the interval, keeping the border modes
+
+   \param lowerBound Lower limit
+   \param upperBound Upper limit
+
+   \return Limited interval
+ */
 QwtInterval QwtInterval::limited( double lowerBound, double upperBound ) const
 {
@@ -292,26 +339,26 @@
         return QwtInterval();
 
-    double minValue = qMax( d_minValue, lowerBound );
+    double minValue = qMax( m_minValue, lowerBound );
     minValue = qMin( minValue, upperBound );
 
-    double maxValue = qMax( d_maxValue, lowerBound );
+    double maxValue = qMax( m_maxValue, lowerBound );
     maxValue = qMin( maxValue, upperBound );
 
-    return QwtInterval( minValue, maxValue, d_borderFlags );
-}
-
-/*!
-  \brief Extend the interval
-
-  If value is below minValue(), value becomes the lower limit.
-  If value is above maxValue(), value becomes the upper limit.
-
-  extend() has no effect for invalid intervals
-
-  \param value Value
-  \return extended interval
-
-  \sa isValid()
-*/
+    return QwtInterval( minValue, maxValue, m_borderFlags );
+}
+
+/*!
+   \brief Extend the interval
+
+   If value is below minValue(), value becomes the lower limit.
+   If value is above maxValue(), value becomes the upper limit.
+
+   extend() has no effect for invalid intervals
+
+   \param value Value
+   \return extended interval
+
+   \sa isValid()
+ */
 QwtInterval QwtInterval::extend( double value ) const
 {
@@ -319,16 +366,16 @@
         return *this;
 
-    return QwtInterval( qMin( value, d_minValue ),
-        qMax( value, d_maxValue ), d_borderFlags );
-}
-
-/*!
-  Extend an interval
-
-  \param value Value
-  \return Reference of the extended interval
-
-  \sa extend()
-*/
+    return QwtInterval( qMin( value, m_minValue ),
+        qMax( value, m_maxValue ), m_borderFlags );
+}
+
+/*!
+   Extend an interval
+
+   \param value Value
+   \return Reference of the extended interval
+
+   \sa extend()
+ */
 QwtInterval& QwtInterval::operator|=( double value )
 {
@@ -339,13 +386,15 @@
 #ifndef QT_NO_DEBUG_STREAM
 
-QDebug operator<<( QDebug debug, const QwtInterval &interval )
+#include <qdebug.h>
+
+QDebug operator<<( QDebug debug, const QwtInterval& interval )
 {
     const int flags = interval.borderFlags();
 
     debug.nospace() << "QwtInterval("
-        << ( ( flags & QwtInterval::ExcludeMinimum ) ? "]" : "[" )
-        << interval.minValue() << "," << interval.maxValue()
-        << ( ( flags & QwtInterval::ExcludeMaximum ) ? "[" : "]" )
-        << ")";
+                    << ( ( flags& QwtInterval::ExcludeMinimum ) ? "]" : "[" )
+                    << interval.minValue() << "," << interval.maxValue()
+                    << ( ( flags& QwtInterval::ExcludeMaximum ) ? "[" : "]" )
+                    << ")";
 
     return debug.space();
Index: /trunk/BNC/qwt/qwt_interval.h
===================================================================
--- /trunk/BNC/qwt/qwt_interval.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_interval.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -14,21 +14,17 @@
 #include <qmetatype.h>
 
-#ifndef QT_NO_DEBUG_STREAM
-#include <qdebug.h>
-#endif
-
-/*!
-  \brief A class representing an interval
-
-  The interval is represented by 2 doubles, the lower and the upper limit.
-*/
+/*!
+   \brief A class representing an interval
+
+   The interval is represented by 2 doubles, the lower and the upper limit.
+ */
 
 class QWT_EXPORT QwtInterval
 {
-public:
+  public:
     /*!
-      Flag indicating if a border is included or excluded
-      \sa setBorderFlags(), borderFlags()
-    */
+       Flag indicating if a border is included or excluded
+       \sa setBorderFlags(), borderFlags()
+     */
     enum BorderFlag
     {
@@ -47,5 +43,5 @@
 
     //! Border flags
-    typedef QFlags<BorderFlag> BorderFlags;
+    Q_DECLARE_FLAGS( BorderFlags, BorderFlag )
 
     QwtInterval();
@@ -60,6 +56,6 @@
     QwtInterval limited( double lowerBound, double upperBound ) const;
 
-    bool operator==( const QwtInterval & ) const;
-    bool operator!=( const QwtInterval & ) const;
+    bool operator==( const QwtInterval& ) const;
+    bool operator!=( const QwtInterval& ) const;
 
     void setBorderFlags( BorderFlags );
@@ -70,4 +66,5 @@
 
     double width() const;
+    long double widthL() const;
 
     void setMinValue( double );
@@ -75,18 +72,19 @@
 
     bool contains( double value ) const;
-
-    bool intersects( const QwtInterval & ) const;
-    QwtInterval intersect( const QwtInterval & ) const;
-    QwtInterval unite( const QwtInterval & ) const;
-
-    QwtInterval operator|( const QwtInterval & ) const;
-    QwtInterval operator&( const QwtInterval & ) const;
-
-    QwtInterval &operator|=( const QwtInterval & );
-    QwtInterval &operator&=( const QwtInterval & );
+    bool contains( const QwtInterval& ) const;
+
+    bool intersects( const QwtInterval& ) const;
+    QwtInterval intersect( const QwtInterval& ) const;
+    QwtInterval unite( const QwtInterval& ) const;
+
+    QwtInterval operator|( const QwtInterval& ) const;
+    QwtInterval operator&( const QwtInterval& ) const;
+
+    QwtInterval& operator|=( const QwtInterval& );
+    QwtInterval& operator&=( const QwtInterval& );
 
     QwtInterval extend( double value ) const;
     QwtInterval operator|( double ) const;
-    QwtInterval &operator|=( double );
+    QwtInterval& operator|=( double );
 
     bool isValid() const;
@@ -96,22 +94,24 @@
     QwtInterval symmetrize( double value ) const;
 
-private:
-    double d_minValue;
-    double d_maxValue;
-    BorderFlags d_borderFlags;
+  private:
+    double m_minValue;
+    double m_maxValue;
+    BorderFlags m_borderFlags;
 };
 
-Q_DECLARE_TYPEINFO(QwtInterval, Q_MOVABLE_TYPE);
-
-/*!
-  \brief Default Constructor
-
-  Creates an invalid interval [0.0, -1.0]
-  \sa setInterval(), isValid()
-*/
-inline QwtInterval::QwtInterval():
-    d_minValue( 0.0 ),
-    d_maxValue( -1.0 ),
-    d_borderFlags( IncludeBorders )
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtInterval::BorderFlags )
+Q_DECLARE_METATYPE( QwtInterval )
+Q_DECLARE_TYPEINFO( QwtInterval, Q_MOVABLE_TYPE );
+
+/*!
+   \brief Default Constructor
+
+   Creates an invalid interval [0.0, -1.0]
+   \sa setInterval(), isValid()
+ */
+inline QwtInterval::QwtInterval()
+    : m_minValue( 0.0 )
+    , m_maxValue( -1.0 )
+    , m_borderFlags( IncludeBorders )
 {
 }
@@ -125,10 +125,10 @@
    \param maxValue Maximum value
    \param borderFlags Include/Exclude borders
-*/
+ */
 inline QwtInterval::QwtInterval(
-        double minValue, double maxValue, BorderFlags borderFlags ):
-    d_minValue( minValue ),
-    d_maxValue( maxValue ),
-    d_borderFlags( borderFlags )
+        double minValue, double maxValue, BorderFlags borderFlags )
+    : m_minValue( minValue )
+    , m_maxValue( maxValue )
+    , m_borderFlags( borderFlags )
 {
 }
@@ -140,11 +140,11 @@
    \param maxValue Maximum value
    \param borderFlags Include/Exclude borders
-*/
+ */
 inline void QwtInterval::setInterval(
     double minValue, double maxValue, BorderFlags borderFlags )
 {
-    d_minValue = minValue;
-    d_maxValue = maxValue;
-    d_borderFlags = borderFlags;
+    m_minValue = minValue;
+    m_maxValue = maxValue;
+    m_borderFlags = borderFlags;
 }
 
@@ -154,8 +154,8 @@
    \param borderFlags Or'd BorderMode flags
    \sa borderFlags()
-*/
+ */
 inline void QwtInterval::setBorderFlags( BorderFlags borderFlags )
 {
-    d_borderFlags = borderFlags;
+    m_borderFlags = borderFlags;
 }
 
@@ -163,8 +163,8 @@
    \return Border flags
    \sa setBorderFlags()
-*/
+ */
 inline QwtInterval::BorderFlags QwtInterval::borderFlags() const
 {
-    return d_borderFlags;
+    return m_borderFlags;
 }
 
@@ -173,8 +173,8 @@
 
    \param minValue Minimum value
-*/
+ */
 inline void QwtInterval::setMinValue( double minValue )
 {
-    d_minValue = minValue;
+    m_minValue = minValue;
 }
 
@@ -183,8 +183,8 @@
 
    \param maxValue Maximum value
-*/
+ */
 inline void QwtInterval::setMaxValue( double maxValue )
 {
-    d_maxValue = maxValue;
+    m_maxValue = maxValue;
 }
 
@@ -192,5 +192,5 @@
 inline double QwtInterval::minValue() const
 {
-    return d_minValue;
+    return m_minValue;
 }
 
@@ -198,5 +198,5 @@
 inline double QwtInterval::maxValue() const
 {
-    return d_maxValue;
+    return m_maxValue;
 }
 
@@ -207,11 +207,11 @@
 
    \return True, when the interval is valid
-*/
+ */
 inline bool QwtInterval::isValid() const
 {
-    if ( ( d_borderFlags & ExcludeBorders ) == 0 )
-        return d_minValue <= d_maxValue;
+    if ( ( m_borderFlags & ExcludeBorders ) == 0 )
+        return m_minValue <= m_maxValue;
     else
-        return d_minValue < d_maxValue;
+        return m_minValue < m_maxValue;
 }
 
@@ -224,8 +224,26 @@
    \return Interval width
    \sa isValid()
-*/
+ */
 inline double QwtInterval::width() const
 {
-    return isValid() ? ( d_maxValue - d_minValue ) : 0.0;
+    return isValid() ? ( m_maxValue - m_minValue ) : 0.0;
+}
+
+/*!
+   \brief Return the width of an interval as long double
+
+   The width of invalid intervals is 0.0, otherwise the result is
+   maxValue() - minValue().
+
+   \return Interval width
+   \sa isValid()
+ */
+inline long double QwtInterval::widthL() const
+{
+    if ( !isValid() )
+        return 0.0;
+
+    return static_cast< long double >( m_maxValue )
+           - static_cast< long double >( m_minValue );
 }
 
@@ -237,7 +255,7 @@
 
    \sa intersect()
-*/
+ */
 inline QwtInterval QwtInterval::operator&(
-    const QwtInterval &other ) const
+    const QwtInterval& other ) const
 {
     return intersect( other );
@@ -251,7 +269,7 @@
 
    \sa unite()
-*/
+ */
 inline QwtInterval QwtInterval::operator|(
-    const QwtInterval &other ) const
+    const QwtInterval& other ) const
 {
     return unite( other );
@@ -263,10 +281,10 @@
    \param other Interval to compare with
    \return True, when this and other are equal
-*/
-inline bool QwtInterval::operator==( const QwtInterval &other ) const
-{
-    return ( d_minValue == other.d_minValue ) &&
-           ( d_maxValue == other.d_maxValue ) &&
-           ( d_borderFlags == other.d_borderFlags );
+ */
+inline bool QwtInterval::operator==( const QwtInterval& other ) const
+{
+    return ( m_minValue == other.m_minValue ) &&
+           ( m_maxValue == other.m_maxValue ) &&
+           ( m_borderFlags == other.m_borderFlags );
 }
 /*!
@@ -275,6 +293,6 @@
    \param other Interval to compare with
    \return True, when this and other are not equal
-*/
-inline bool QwtInterval::operator!=( const QwtInterval &other ) const
+ */
+inline bool QwtInterval::operator!=( const QwtInterval& other ) const
 {
     return ( !( *this == other ) );
@@ -287,5 +305,5 @@
    \return Extended interval
    \sa extend()
-*/
+ */
 inline QwtInterval QwtInterval::operator|( double value ) const
 {
@@ -296,24 +314,21 @@
 inline bool QwtInterval::isNull() const
 {
-    return isValid() && d_minValue >= d_maxValue;
-}
-
-/*!
-  Invalidate the interval
-
-  The limits are set to interval [0.0, -1.0]
-  \sa isValid()
-*/
+    return isValid() && m_minValue >= m_maxValue;
+}
+
+/*!
+   Invalidate the interval
+
+   The limits are set to interval [0.0, -1.0]
+   \sa isValid()
+ */
 inline void QwtInterval::invalidate()
 {
-    d_minValue = 0.0;
-    d_maxValue = -1.0;
-}
-
-Q_DECLARE_OPERATORS_FOR_FLAGS( QwtInterval::BorderFlags )
-Q_DECLARE_METATYPE( QwtInterval )
+    m_minValue = 0.0;
+    m_maxValue = -1.0;
+}
 
 #ifndef QT_NO_DEBUG_STREAM
-QWT_EXPORT QDebug operator<<( QDebug, const QwtInterval & );
+QWT_EXPORT QDebug operator<<( QDebug, const QwtInterval& );
 #endif
 
Index: /trunk/BNC/qwt/qwt_interval_symbol.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_interval_symbol.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_interval_symbol.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,27 +11,23 @@
 #include "qwt_painter.h"
 #include "qwt_math.h"
+
 #include <qpainter.h>
-
-#if QT_VERSION < 0x040601
-#define qAtan2(y, x) ::atan2(y, x)
-#define qFastSin(x) qSin(x)
-#define qFastCos(x) qCos(x)
-#endif
+#include <qmath.h>
 
 class QwtIntervalSymbol::PrivateData
 {
-public:
-    PrivateData():
-        style( QwtIntervalSymbol::NoSymbol ),
-        width( 6 )
+  public:
+    PrivateData()
+        : style( QwtIntervalSymbol::NoSymbol )
+        , width( 6 )
     {
     }
 
-    bool operator==( const PrivateData &other ) const
+    bool operator==( const PrivateData& other ) const
     {
         return ( style == other.style )
-            && ( width == other.width )
-            && ( brush == other.brush )
-            && ( pen == other.pen );
+               && ( width == other.width )
+               && ( brush == other.brush )
+               && ( pen == other.pen );
     }
 
@@ -44,20 +40,20 @@
 
 /*!
-  Constructor
-
-  \param style Style of the symbol
-  \sa setStyle(), style(), Style
-*/
+   Constructor
+
+   \param style Style of the symbol
+   \sa setStyle(), style(), Style
+ */
 QwtIntervalSymbol::QwtIntervalSymbol( Style style )
 {
-    d_data = new PrivateData();
-    d_data->style = style;
+    m_data = new PrivateData();
+    m_data->style = style;
 }
 
 //! Copy constructor
-QwtIntervalSymbol::QwtIntervalSymbol( const QwtIntervalSymbol &other )
-{
-    d_data = new PrivateData();
-    *d_data = *other.d_data;
+QwtIntervalSymbol::QwtIntervalSymbol( const QwtIntervalSymbol& other )
+{
+    m_data = new PrivateData();
+    *m_data = *other.m_data;
 }
 
@@ -65,12 +61,12 @@
 QwtIntervalSymbol::~QwtIntervalSymbol()
 {
-    delete d_data;
+    delete m_data;
 }
 
 //! \brief Assignment operator
-QwtIntervalSymbol &QwtIntervalSymbol::operator=(
-    const QwtIntervalSymbol &other )
-{
-    *d_data = *other.d_data;
+QwtIntervalSymbol& QwtIntervalSymbol::operator=(
+    const QwtIntervalSymbol& other )
+{
+    *m_data = *other.m_data;
     return *this;
 }
@@ -78,93 +74,93 @@
 //! \brief Compare two symbols
 bool QwtIntervalSymbol::operator==(
-    const QwtIntervalSymbol &other ) const
-{
-    return *d_data == *other.d_data;
+    const QwtIntervalSymbol& other ) const
+{
+    return *m_data == *other.m_data;
 }
 
 //! \brief Compare two symbols
 bool QwtIntervalSymbol::operator!=(
-    const QwtIntervalSymbol &other ) const
-{
-    return !( *d_data == *other.d_data );
-}
-
-/*!
-  Specify the symbol style
-
-  \param style Style
-  \sa style(), Style
-*/
+    const QwtIntervalSymbol& other ) const
+{
+    return !( *m_data == *other.m_data );
+}
+
+/*!
+   Specify the symbol style
+
+   \param style Style
+   \sa style(), Style
+ */
 void QwtIntervalSymbol::setStyle( Style style )
 {
-    d_data->style = style;
-}
-
-/*!
-  \return Current symbol style
-  \sa setStyle()
-*/
+    m_data->style = style;
+}
+
+/*!
+   \return Current symbol style
+   \sa setStyle()
+ */
 QwtIntervalSymbol::Style QwtIntervalSymbol::style() const
 {
-    return d_data->style;
-}
-
-/*!
-  Specify the width of the symbol
-  It is used depending on the style.
-
-  \param width Width
-  \sa width(), setStyle()
-*/
+    return m_data->style;
+}
+
+/*!
+   Specify the width of the symbol
+   It is used depending on the style.
+
+   \param width Width
+   \sa width(), setStyle()
+ */
 void QwtIntervalSymbol::setWidth( int width )
 {
-    d_data->width = width;
-}
-
-/*!
-  \return Width of the symbol.
-  \sa setWidth(), setStyle()
-*/
+    m_data->width = width;
+}
+
+/*!
+   \return Width of the symbol.
+   \sa setWidth(), setStyle()
+ */
 int QwtIntervalSymbol::width() const
 {
-    return d_data->width;
-}
-
-/*!
-  \brief Assign a brush
-
-  The brush is used for the Box style.
-
-  \param brush Brush
-  \sa brush()
-*/
-void QwtIntervalSymbol::setBrush( const QBrush &brush )
-{
-    d_data->brush = brush;
-}
-
-/*!
-  \return Brush
-  \sa setBrush()
-*/
+    return m_data->width;
+}
+
+/*!
+   \brief Assign a brush
+
+   The brush is used for the Box style.
+
+   \param brush Brush
+   \sa brush()
+ */
+void QwtIntervalSymbol::setBrush( const QBrush& brush )
+{
+    m_data->brush = brush;
+}
+
+/*!
+   \return Brush
+   \sa setBrush()
+ */
 const QBrush& QwtIntervalSymbol::brush() const
 {
-    return d_data->brush;
-}
-
-/*!
-  Build and assign a pen
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtIntervalSymbol::setPen( const QColor &color,
+    return m_data->brush;
+}
+
+/*!
+   Build and assign a pen
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtIntervalSymbol::setPen( const QColor& color,
     qreal width, Qt::PenStyle style )
 {
@@ -173,37 +169,37 @@
 
 /*!
-  Assign a pen
-
-  \param pen Pen
-  \sa pen(), setBrush()
-*/
-void QwtIntervalSymbol::setPen( const QPen &pen )
-{
-    d_data->pen = pen;
-}
-
-/*!
-  \return Pen
-  \sa setPen(), brush()
-*/
+   Assign a pen
+
+   \param pen Pen
+   \sa pen(), setBrush()
+ */
+void QwtIntervalSymbol::setPen( const QPen& pen )
+{
+    m_data->pen = pen;
+}
+
+/*!
+   \return Pen
+   \sa setPen(), brush()
+ */
 const QPen& QwtIntervalSymbol::pen() const
 {
-    return d_data->pen;
-}
-
-/*!
-  Draw a symbol depending on its style
-
-  \param painter Painter
-  \param orientation Orientation
-  \param from Start point of the interval in target device coordinates
-  \param to End point of the interval in target device coordinates
-
-  \sa setStyle()
-*/
-void QwtIntervalSymbol::draw( QPainter *painter, Qt::Orientation orientation,
-    const QPointF &from, const QPointF &to ) const
-{
-    const qreal pw = qMax( painter->pen().widthF(), qreal( 1.0 ) );
+    return m_data->pen;
+}
+
+/*!
+   Draw a symbol depending on its style
+
+   \param painter Painter
+   \param orientation Orientation
+   \param from Start point of the interval in target device coordinates
+   \param to End point of the interval in target device coordinates
+
+   \sa setStyle()
+ */
+void QwtIntervalSymbol::draw( QPainter* painter, Qt::Orientation orientation,
+    const QPointF& from, const QPointF& to ) const
+{
+    const qreal pw = QwtPainter::effectivePenWidth( painter->pen() );
 
     QPointF p1 = from;
@@ -215,15 +211,15 @@
     }
 
-    switch ( d_data->style )
+    switch ( m_data->style )
     {
         case QwtIntervalSymbol::Bar:
         {
             QwtPainter::drawLine( painter, p1, p2 );
-            if ( d_data->width > pw )
+            if ( m_data->width > pw )
             {
                 if ( ( orientation == Qt::Horizontal )
                     && ( p1.y() == p2.y() ) )
                 {
-                    const double sw = d_data->width;
+                    const double sw = m_data->width;
 
                     const double y = p1.y() - sw / 2;
@@ -236,5 +232,5 @@
                     && ( p1.x() == p2.x() ) )
                 {
-                    const double sw = d_data->width;
+                    const double sw = m_data->width;
 
                     const double x = p1.x() - sw / 2;
@@ -246,9 +242,9 @@
                 else
                 {
-                    const double sw = d_data->width;
+                    const double sw = m_data->width;
 
                     const double dx = p2.x() - p1.x();
                     const double dy = p2.y() - p1.y();
-                    const double angle = qAtan2( dy, dx ) + M_PI_2;
+                    const double angle = std::atan2( dy, dx ) + M_PI_2;
                     double dw2 = sw / 2.0;
 
@@ -268,5 +264,5 @@
         case QwtIntervalSymbol::Box:
         {
-            if ( d_data->width <= pw )
+            if ( m_data->width <= pw )
             {
                 QwtPainter::drawLine( painter, p1, p2 );
@@ -277,7 +273,7 @@
                     && ( p1.y() == p2.y() ) )
                 {
-                    const double sw = d_data->width;
-
-                    const double y = p1.y() - d_data->width / 2;
+                    const double sw = m_data->width;
+
+                    const double y = p1.y() - m_data->width / 2;
                     QwtPainter::drawRect( painter,
                         p1.x(), y, p2.x() - p1.x(),  sw );
@@ -286,7 +282,7 @@
                     && ( p1.x() == p2.x() ) )
                 {
-                    const double sw = d_data->width;
-
-                    const double x = p1.x() - d_data->width / 2;
+                    const double sw = m_data->width;
+
+                    const double x = p1.x() - m_data->width / 2;
                     QwtPainter::drawRect( painter,
                         x, p1.y(), sw, p2.y() - p1.y() );
@@ -294,9 +290,9 @@
                 else
                 {
-                    const double sw = d_data->width;
+                    const double sw = m_data->width;
 
                     const double dx = p2.x() - p1.x();
                     const double dy = p2.y() - p1.y();
-                    const double angle = qAtan2( dy, dx ) + M_PI_2;
+                    const double angle = std::atan2( dy, dx ) + M_PI_2;
                     double dw2 = sw / 2.0;
 
Index: /trunk/BNC/qwt/qwt_interval_symbol.h
===================================================================
--- /trunk/BNC/qwt/qwt_interval_symbol.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_interval_symbol.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,19 +12,20 @@
 
 #include "qwt_global.h"
-#include <qpen.h>
-#include <qsize.h>
+#include <qnamespace.h>
 
 class QPainter;
-class QRect;
+class QPen;
+class QBrush;
 class QPointF;
+class QColor;
 
 /*!
-  \brief A drawing primitive for displaying an interval like an error bar
+   \brief A drawing primitive for displaying an interval like an error bar
 
-  \sa QwtPlotIntervalCurve
-*/
+   \sa QwtPlotIntervalCurve
+ */
 class QWT_EXPORT QwtIntervalSymbol
 {
-public:
+  public:
     //! Symbol style
     enum Style
@@ -34,41 +35,42 @@
 
         /*!
-          The symbol displays a line with caps at the beginning/end.
-          The size of the caps depends on the symbol width().
+           The symbol displays a line with caps at the beginning/end.
+           The size of the caps depends on the symbol width().
          */
         Bar,
 
         /*!
-          The symbol displays a plain rectangle using pen() and brush().
-          The size of the rectangle depends on the translated interval and
-          the width(),
+           The symbol displays a plain rectangle using pen() and brush().
+           The size of the rectangle depends on the translated interval and
+           the width(),
          */
         Box,
 
         /*!
-          Styles >= UserSymbol are reserved for derived
-          classes of QwtIntervalSymbol that overload draw() with
-          additional application specific symbol types.
+           Styles >= UserSymbol are reserved for derived
+           classes of QwtIntervalSymbol that overload draw() with
+           additional application specific symbol types.
          */
         UserSymbol = 1000
     };
 
-public:
-    QwtIntervalSymbol( Style = NoSymbol );
-    QwtIntervalSymbol( const QwtIntervalSymbol & );
+  public:
+    explicit QwtIntervalSymbol( Style = NoSymbol );
+    QwtIntervalSymbol( const QwtIntervalSymbol& );
+
     virtual ~QwtIntervalSymbol();
 
-    QwtIntervalSymbol &operator=( const QwtIntervalSymbol & );
-    bool operator==( const QwtIntervalSymbol & ) const;
-    bool operator!=( const QwtIntervalSymbol & ) const;
+    QwtIntervalSymbol& operator=( const QwtIntervalSymbol& );
+    bool operator==( const QwtIntervalSymbol& ) const;
+    bool operator!=( const QwtIntervalSymbol& ) const;
 
     void setWidth( int );
     int width() const;
 
-    void setBrush( const QBrush & );
+    void setBrush( const QBrush& );
     const QBrush& brush() const;
 
-    void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setPen( const QPen & );
+    void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
+    void setPen( const QPen& );
     const QPen& pen() const;
 
@@ -76,10 +78,10 @@
     Style style() const;
 
-    virtual void draw( QPainter *, Qt::Orientation,
+    virtual void draw( QPainter*, Qt::Orientation,
         const QPointF& from, const QPointF& to ) const;
 
-private:
+  private:
     class PrivateData;
-    PrivateData* d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_knob.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_knob.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_knob.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,7 +10,9 @@
 #include "qwt_knob.h"
 #include "qwt_round_scale_draw.h"
-#include "qwt_math.h"
 #include "qwt_painter.h"
 #include "qwt_scale_map.h"
+#include "qwt_math.h"
+#include "qwt.h"
+
 #include <qpainter.h>
 #include <qpalette.h>
@@ -18,15 +20,8 @@
 #include <qstyleoption.h>
 #include <qevent.h>
+#include <qmargins.h>
 #include <qmath.h>
-#include <qapplication.h>
-
-#if QT_VERSION < 0x040601
-#define qAtan2(y, x) ::atan2(y, x)
-#define qFabs(x) ::fabs(x)
-#define qFastCos(x) qCos(x)
-#define qFastSin(x) qSin(x)
-#endif
-
-static QSize qwtKnobSizeHint( const QwtKnob *knob, int min )
+
+static QSize qwtKnobSizeHint( const QwtKnob* knob, int min )
 {
     int knobWidth = knob->knobWidth();
@@ -35,11 +30,9 @@
 
     // Add the scale radial thickness to the knobWidth
-    const int extent = qCeil( knob->scaleDraw()->extent( knob->font() ) );
+    const int extent = qwtCeil( knob->scaleDraw()->extent( knob->font() ) );
     const int d = 2 * ( extent + 4 ) + knobWidth;
 
-    int left, right, top, bottom;
-    knob->getContentsMargins( &left, &top, &right, &bottom );
-
-    return QSize( d + left + right, d + top + bottom );
+    const QMargins m = knob->contentsMargins();
+    return QSize( d + m.left() + m.right(), d + m.top() + m.bottom() );
 }
 
@@ -65,17 +58,17 @@
 class QwtKnob::PrivateData
 {
-public:
-    PrivateData():
-        knobStyle( QwtKnob::Raised ),
-        markerStyle( QwtKnob::Notch ),
-        borderWidth( 2 ),
-        borderDist( 4 ),
-        scaleDist( 4 ),
-        maxScaleTicks( 11 ),
-        knobWidth( 0 ),
-        alignment( Qt::AlignCenter ),
-        markerSize( 8 ),
-        totalAngle( 270.0 ),
-        mouseOffset( 0.0 )
+  public:
+    PrivateData()
+        : knobStyle( QwtKnob::Raised )
+        , markerStyle( QwtKnob::Notch )
+        , borderWidth( 2 )
+        , borderDist( 4 )
+        , scaleDist( 4 )
+        , maxScaleTicks( 11 )
+        , knobWidth( 0 )
+        , alignment( Qt::AlignCenter )
+        , markerSize( 8 )
+        , totalAngle( 270.0 )
+        , mouseOffset( 0.0 )
     {
     }
@@ -98,18 +91,18 @@
 
 /*!
-  \brief Constructor
-
-  Construct a knob with an angle of 270°. The style is
-  QwtKnob::Raised and the marker style is QwtKnob::Notch.
-  The width of the knob is set to 50 pixels.
-
-  \param parent Parent widget
-
-  \sa setTotalAngle()
-*/
-QwtKnob::QwtKnob( QWidget* parent ):
-    QwtAbstractSlider( parent )
-{
-    d_data = new PrivateData;
+   \brief Constructor
+
+   Construct a knob with an angle of 270°. The style is
+   QwtKnob::Raised and the marker style is QwtKnob::Notch.
+   The width of the knob is set to 50 pixels.
+
+   \param parent Parent widget
+
+   \sa setTotalAngle()
+ */
+QwtKnob::QwtKnob( QWidget* parent )
+    : QwtAbstractSlider( parent )
+{
+    m_data = new PrivateData;
 
     setScaleDraw( new QwtRoundScaleDraw() );
@@ -127,18 +120,18 @@
 QwtKnob::~QwtKnob()
 {
-    delete d_data;
-}
-
-/*!
-  \brief Set the knob type
-
-  \param knobStyle Knob type
-  \sa knobStyle(), setBorderWidth()
-*/
+    delete m_data;
+}
+
+/*!
+   \brief Set the knob type
+
+   \param knobStyle Knob type
+   \sa knobStyle(), setBorderWidth()
+ */
 void QwtKnob::setKnobStyle( KnobStyle knobStyle )
 {
-    if ( d_data->knobStyle != knobStyle )
-    {
-        d_data->knobStyle = knobStyle;
+    if ( m_data->knobStyle != knobStyle )
+    {
+        m_data->knobStyle = knobStyle;
         update();
     }
@@ -148,21 +141,21 @@
     \return Marker type of the knob
     \sa setKnobStyle(), setBorderWidth()
-*/
+ */
 QwtKnob::KnobStyle QwtKnob::knobStyle() const
 {
-    return d_data->knobStyle;
-}
-
-/*!
-  \brief Set the marker type of the knob
-
-  \param markerStyle Marker type
-  \sa markerStyle(), setMarkerSize()
-*/
+    return m_data->knobStyle;
+}
+
+/*!
+   \brief Set the marker type of the knob
+
+   \param markerStyle Marker type
+   \sa markerStyle(), setMarkerSize()
+ */
 void QwtKnob::setMarkerStyle( MarkerStyle markerStyle )
 {
-    if ( d_data->markerStyle != markerStyle )
-    {
-        d_data->markerStyle = markerStyle;
+    if ( m_data->markerStyle != markerStyle )
+    {
+        m_data->markerStyle = markerStyle;
         update();
     }
@@ -170,34 +163,34 @@
 
 /*!
-  \return Marker type of the knob
-  \sa setMarkerStyle(), setMarkerSize()
-*/
+   \return Marker type of the knob
+   \sa setMarkerStyle(), setMarkerSize()
+ */
 QwtKnob::MarkerStyle QwtKnob::markerStyle() const
 {
-    return d_data->markerStyle;
-}
-
-/*!
-  \brief Set the total angle by which the knob can be turned
-  \param angle Angle in degrees.
-
-  The angle has to be between [10, 360] degrees. Angles above
-  360 ( so that the knob can be turned several times around its axis )
-  have to be set using setNumTurns().
-
-  The default angle is 270 degrees.
-
-  \sa totalAngle(), setNumTurns()
-*/
+    return m_data->markerStyle;
+}
+
+/*!
+   \brief Set the total angle by which the knob can be turned
+   \param angle Angle in degrees.
+
+   The angle has to be between [10, 360] degrees. Angles above
+   360 ( so that the knob can be turned several times around its axis )
+   have to be set using setNumTurns().
+
+   The default angle is 270 degrees.
+
+   \sa totalAngle(), setNumTurns()
+ */
 void QwtKnob::setTotalAngle ( double angle )
 {
     angle = qBound( 10.0, angle, 360.0 );
 
-    if ( angle != d_data->totalAngle )
-    {
-        d_data->totalAngle = angle;
-
-        scaleDraw()->setAngleRange( -0.5 * d_data->totalAngle,
-            0.5 * d_data->totalAngle );
+    if ( angle != m_data->totalAngle )
+    {
+        m_data->totalAngle = angle;
+
+        scaleDraw()->setAngleRange( -0.5 * m_data->totalAngle,
+            0.5 * m_data->totalAngle );
 
         updateGeometry();
@@ -207,20 +200,20 @@
 
 /*!
-  \return the total angle
-  \sa setTotalAngle(), setNumTurns(), numTurns()
+   \return the total angle
+   \sa setTotalAngle(), setNumTurns(), numTurns()
  */
 double QwtKnob::totalAngle() const
 {
-    return d_data->totalAngle;
-}
-
-/*!
-  \brief Set the number of turns
-
-  When numTurns > 1 the knob can be turned several times around its axis
-  - otherwise the total angle is floored to 360°.
-
-  \sa numTurns(), totalAngle(), setTotalAngle()
-*/
+    return m_data->totalAngle;
+}
+
+/*!
+   \brief Set the number of turns
+
+   When numTurns > 1 the knob can be turned several times around its axis
+   - otherwise the total angle is floored to 360°.
+
+   \sa numTurns(), totalAngle(), setTotalAngle()
+ */
 
 void QwtKnob::setNumTurns( int numTurns )
@@ -228,14 +221,14 @@
     numTurns = qMax( numTurns, 1 );
 
-    if ( numTurns == 1 && d_data->totalAngle <= 360.0 )
+    if ( numTurns == 1 && m_data->totalAngle <= 360.0 )
         return;
 
     const double angle = numTurns * 360.0;
-    if ( angle != d_data->totalAngle )
-    {
-        d_data->totalAngle = angle;
-
-        scaleDraw()->setAngleRange( -0.5 * d_data->totalAngle,
-            0.5 * d_data->totalAngle );
+    if ( angle != m_data->totalAngle )
+    {
+        m_data->totalAngle = angle;
+
+        scaleDraw()->setAngleRange( -0.5 * m_data->totalAngle,
+            0.5 * m_data->totalAngle );
 
         updateGeometry();
@@ -245,12 +238,12 @@
 
 /*!
-  \return Number of turns.
-
-  When the total angle is below 360° numTurns() is ceiled to 1.
-  \sa setNumTurns(), setTotalAngle(), totalAngle()
+   \return Number of turns.
+
+   When the total angle is below 360° numTurns() is ceiled to 1.
+   \sa setNumTurns(), setTotalAngle(), totalAngle()
  */
 int QwtKnob::numTurns() const
 {
-    return qCeil( d_data->totalAngle / 360.0 );
+    return qwtCeil( m_data->totalAngle / 360.0 );
 }
 
@@ -263,9 +256,9 @@
 
    \sa scaleDraw()
-*/
-void QwtKnob::setScaleDraw( QwtRoundScaleDraw *scaleDraw )
+ */
+void QwtKnob::setScaleDraw( QwtRoundScaleDraw* scaleDraw )
 {
     setAbstractScaleDraw( scaleDraw );
-    setTotalAngle( d_data->totalAngle );
+    setTotalAngle( m_data->totalAngle );
 
     updateGeometry();
@@ -276,8 +269,8 @@
    \return the scale draw of the knob
    \sa setScaleDraw()
-*/
-const QwtRoundScaleDraw *QwtKnob::scaleDraw() const
-{
-    return static_cast<const QwtRoundScaleDraw *>( abstractScaleDraw() );
+ */
+const QwtRoundScaleDraw* QwtKnob::scaleDraw() const
+{
+    return static_cast< const QwtRoundScaleDraw* >( abstractScaleDraw() );
 }
 
@@ -285,15 +278,15 @@
    \return the scale draw of the knob
    \sa setScaleDraw()
-*/
-QwtRoundScaleDraw *QwtKnob::scaleDraw()
-{
-    return static_cast<QwtRoundScaleDraw *>( abstractScaleDraw() );
-}
-
-/*!
-  Calculate the bounding rectangle of the knob without the scale
-
-  \return Bounding rectangle of the knob
-  \sa knobWidth(), alignment(), QWidget::contentsRect()
+ */
+QwtRoundScaleDraw* QwtKnob::scaleDraw()
+{
+    return static_cast< QwtRoundScaleDraw* >( abstractScaleDraw() );
+}
+
+/*!
+   Calculate the bounding rectangle of the knob without the scale
+
+   \return Bounding rectangle of the knob
+   \sa knobWidth(), alignment(), QWidget::contentsRect()
  */
 QRect QwtKnob::knobRect() const
@@ -301,8 +294,8 @@
     const QRect cr = contentsRect();
 
-    const int extent = qCeil( scaleDraw()->extent( font() ) );
-    const int d = extent + d_data->scaleDist;
-
-    int w = d_data->knobWidth;
+    const int extent = qwtCeil( scaleDraw()->extent( font() ) );
+    const int d = extent + m_data->scaleDist;
+
+    int w = m_data->knobWidth;
     if ( w <= 0 )
     {
@@ -315,9 +308,9 @@
     QRect r( 0, 0, w, w );
 
-    if ( d_data->alignment & Qt::AlignLeft )
+    if ( m_data->alignment & Qt::AlignLeft )
     {
         r.moveLeft( cr.left() + d );
     }
-    else if ( d_data->alignment & Qt::AlignRight )
+    else if ( m_data->alignment & Qt::AlignRight )
     {
         r.moveRight( cr.right() - d );
@@ -328,9 +321,9 @@
     }
 
-    if ( d_data->alignment & Qt::AlignTop )
+    if ( m_data->alignment & Qt::AlignTop )
     {
         r.moveTop( cr.top() + d );
     }
-    else if ( d_data->alignment & Qt::AlignBottom )
+    else if ( m_data->alignment & Qt::AlignBottom )
     {
         r.moveBottom( cr.bottom() - d );
@@ -345,12 +338,12 @@
 
 /*!
-  \brief Determine what to do when the user presses a mouse button.
-
-  \param pos Mouse position
-
-  \retval True, when pos is inside the circle of the knob.
-  \sa scrolledTo()
-*/
-bool QwtKnob::isScrollPosition( const QPoint &pos ) const
+   \brief Determine what to do when the user presses a mouse button.
+
+   \param pos Mouse position
+
+   \retval True, when pos is inside the circle of the knob.
+   \sa scrolledTo()
+ */
+bool QwtKnob::isScrollPosition( const QPoint& pos ) const
 {
     const QRect kr = knobRect();
@@ -362,5 +355,5 @@
         const double valueAngle = qwtToDegrees( scaleMap().transform( value() ) );
 
-        d_data->mouseOffset = qwtNormalizeDegrees( angle - valueAngle );
+        m_data->mouseOffset = qwtNormalizeDegrees( angle - valueAngle );
 
         return true;
@@ -371,15 +364,15 @@
 
 /*!
-  \brief Determine the value for a new position of the mouse
-
-  \param pos Mouse position
-
-  \return Value for the mouse position
-  \sa isScrollPosition()
-*/
-double QwtKnob::scrolledTo( const QPoint &pos ) const
+   \brief Determine the value for a new position of the mouse
+
+   \param pos Mouse position
+
+   \return Value for the mouse position
+   \sa isScrollPosition()
+ */
+double QwtKnob::scrolledTo( const QPoint& pos ) const
 {
     double angle = QLineF( rect().center(), pos ).angle();
-    angle = qwtNormalizeDegrees( angle - d_data->mouseOffset );
+    angle = qwtNormalizeDegrees( angle - m_data->mouseOffset );
 
     if ( scaleMap().pDist() > 360.0 )
@@ -389,5 +382,5 @@
         const double v = scaleMap().transform( value() );
 
-        int numTurns = qFloor( ( v - scaleMap().p1() ) / 360.0 );
+        int numTurns = qwtFloor( ( v - scaleMap().p1() ) / 360.0 );
 
         double valueAngle = qwtNormalizeDegrees( v );
@@ -404,5 +397,5 @@
                 qBound( scaleMap().p1(), angle, scaleMap().p2() );
 
-            d_data->mouseOffset += ( boundedAngle - angle );
+            m_data->mouseOffset += ( boundedAngle - angle );
             angle = boundedAngle;
         }
@@ -423,5 +416,5 @@
                 boundedAngle = scaleMap().p1();
 
-            d_data->mouseOffset += ( boundedAngle - angle );
+            m_data->mouseOffset += ( boundedAngle - angle );
         }
 
@@ -433,8 +426,8 @@
 
 /*!
-  Handle QEvent::StyleChange and QEvent::FontChange;
-  \param event Change event
-*/
-void QwtKnob::changeEvent( QEvent *event )
+   Handle QEvent::StyleChange and QEvent::FontChange;
+   \param event Change event
+ */
+void QwtKnob::changeEvent( QEvent* event )
 {
     switch( event->type() )
@@ -453,8 +446,8 @@
 
 /*!
-  Repaint the knob
-  \param event Paint event
-*/
-void QwtKnob::paintEvent( QPaintEvent *event )
+   Repaint the knob
+   \param event Paint event
+ */
+void QwtKnob::paintEvent( QPaintEvent* event )
 {
     const QRectF knobRect = this->knobRect();
@@ -464,5 +457,5 @@
 
     QStyleOption opt;
-    opt.init(this);
+    opt.initFrom(this);
     style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
 
@@ -471,5 +464,5 @@
     if ( !knobRect.contains( event->region().boundingRect() ) )
     {
-        scaleDraw()->setRadius( 0.5 * knobRect.width() + d_data->scaleDist );
+        scaleDraw()->setRadius( 0.5 * knobRect.width() + m_data->scaleDist );
         scaleDraw()->moveCenter( knobRect.center() );
 
@@ -489,13 +482,13 @@
 
 /*!
-  \brief Draw the knob
-
-  \param painter painter
-  \param knobRect Bounding rectangle of the knob (without scale)
-*/
-void QwtKnob::drawKnob( QPainter *painter, const QRectF &knobRect ) const
+   \brief Draw the knob
+
+   \param painter painter
+   \param knobRect Bounding rectangle of the knob (without scale)
+ */
+void QwtKnob::drawKnob( QPainter* painter, const QRectF& knobRect ) const
 {
     double dim = qMin( knobRect.width(), knobRect.height() );
-    dim -= d_data->borderWidth * 0.5;
+    dim -= m_data->borderWidth * 0.5;
 
     QRectF aRect( 0, 0, dim, dim );
@@ -503,5 +496,5 @@
 
     QPen pen( Qt::NoPen );
-    if ( d_data->borderWidth > 0 )
+    if ( m_data->borderWidth > 0 )
     {
         QColor c1 = palette().color( QPalette::Light );
@@ -514,9 +507,9 @@
         gradient.setColorAt( 1.0, c2 );
 
-        pen = QPen( gradient, d_data->borderWidth );
+        pen = QPen( gradient, m_data->borderWidth );
     }
 
     QBrush brush;
-    switch( d_data->knobStyle )
+    switch( m_data->knobStyle )
     {
         case QwtKnob::Raised:
@@ -542,8 +535,8 @@
 
             const QColor c = palette().color( QPalette::Button );
-            gradient.setColorAt(0, c.lighter(110));
-            gradient.setColorAt(qreal(0.5), c);
-            gradient.setColorAt(qreal(0.501), c.darker(102));
-            gradient.setColorAt(1, c.darker(115));
+            gradient.setColorAt(0, c.lighter(110) );
+            gradient.setColorAt( 0.5, c);
+            gradient.setColorAt( 0.501, c.darker(102) );
+            gradient.setColorAt(1, c.darker(115) );
 
             brush = QBrush( gradient );
@@ -574,15 +567,15 @@
 
 /*!
-  \brief Draw the marker at the knob's front
-
-  \param painter Painter
-  \param rect Bounding rectangle of the knob without scale
-  \param angle Angle of the marker in degrees
+   \brief Draw the marker at the knob's front
+
+   \param painter Painter
+   \param rect Bounding rectangle of the knob without scale
+   \param angle Angle of the marker in degrees
                ( clockwise, 0 at the 12 o'clock position )
-*/
-void QwtKnob::drawMarker( QPainter *painter,
-    const QRectF &rect, double angle ) const
-{
-    if ( d_data->markerStyle == NoMarker || !isValid() )
+ */
+void QwtKnob::drawMarker( QPainter* painter,
+    const QRectF& rect, double angle ) const
+{
+    if ( m_data->markerStyle == NoMarker || !isValid() )
         return;
 
@@ -595,19 +588,18 @@
     const double margin = 4.0;
 
-    double radius = 0.5 * ( rect.width() - d_data->borderWidth ) - margin;
+    double radius = 0.5 * ( rect.width() - m_data->borderWidth ) - margin;
     if ( radius < 1.0 )
         radius = 1.0;
 
-    int markerSize = d_data->markerSize;
+    double markerSize = m_data->markerSize;
     if ( markerSize <= 0 )
         markerSize = qRound( 0.4 * radius );
 
-    switch ( d_data->markerStyle )
+    switch ( m_data->markerStyle )
     {
         case Notch:
         case Nub:
         {
-            const double dotWidth =
-                qMin( double( markerSize ), radius);
+            const double dotWidth = qwtMinF( markerSize, radius );
 
             const double dotCenterDist = radius - 0.5 * dotWidth;
@@ -623,5 +615,5 @@
                 QColor c2 = palette().color( QPalette::Mid );
 
-                if ( d_data->markerStyle == Notch )
+                if ( m_data->markerStyle == Notch )
                     qSwap( c1, c2 );
 
@@ -640,6 +632,5 @@
         case Dot:
         {
-            const double dotWidth =
-                qMin( double( markerSize ), radius);
+            const double dotWidth = qwtMinF( markerSize, radius);
 
             const double dotCenterDist = radius - 0.5 * dotWidth;
@@ -661,5 +652,5 @@
         case Tick:
         {
-            const double rb = qMax( radius - markerSize, 1.0 );
+            const double rb = qwtMaxF( radius - markerSize, 1.0 );
             const double re = radius;
 
@@ -676,5 +667,5 @@
         case Triangle:
         {
-            const double rb = qMax( radius - markerSize, 1.0 );
+            const double rb = qwtMaxF( radius - markerSize, 1.0 );
             const double re = radius;
 
@@ -701,12 +692,12 @@
 
 /*!
-  Draw the focus indicator
-  \param painter Painter
-*/
-void QwtKnob::drawFocusIndicator( QPainter *painter ) const
+   Draw the focus indicator
+   \param painter Painter
+ */
+void QwtKnob::drawFocusIndicator( QPainter* painter ) const
 {
     const QRect cr = contentsRect();
 
-    int w = d_data->knobWidth;
+    int w = m_data->knobWidth;
     if ( w <= 0 )
     {
@@ -716,5 +707,5 @@
     {
         const int extent = qCeil( scaleDraw()->extent( font() ) );
-        w += 2 * ( extent + d_data->scaleDist );
+        w += 2 * ( extent + m_data->scaleDist );
     }
 
@@ -726,20 +717,20 @@
 
 /*!
-  \brief Set the alignment of the knob
-
-  Similar to a QLabel::alignment() the flags decide how
-  to align the knob inside of contentsRect().
-
-  The default setting is Qt::AlignCenter
-
-  \param alignment Or'd alignment flags
-
-  \sa alignment(), setKnobWidth(), knobRect()
+   \brief Set the alignment of the knob
+
+   Similar to a QLabel::alignment() the flags decide how
+   to align the knob inside of contentsRect().
+
+   The default setting is Qt::AlignCenter
+
+   \param alignment Or'd alignment flags
+
+   \sa alignment(), setKnobWidth(), knobRect()
  */
 void QwtKnob::setAlignment( Qt::Alignment alignment )
 {
-    if ( d_data->alignment != alignment )
-    {
-        d_data->alignment = alignment;
+    if ( m_data->alignment != alignment )
+    {
+        m_data->alignment = alignment;
         update();
     }
@@ -747,28 +738,28 @@
 
 /*!
-  \return Alignment of the knob inside of contentsRect()
-  \sa setAlignment(), knobWidth(), knobRect()
+   \return Alignment of the knob inside of contentsRect()
+   \sa setAlignment(), knobWidth(), knobRect()
  */
 Qt::Alignment QwtKnob::alignment() const
 {
-    return d_data->alignment;
-}
-
-/*!
-  \brief Change the knob's width.
-
-  Setting a fixed value for the diameter of the knob
-  is helpful for aligning several knobs in a row.
-
-  \param width New width
-
-  \sa knobWidth(), setAlignment()
-  \note Modifies the sizePolicy()
-*/
+    return m_data->alignment;
+}
+
+/*!
+   \brief Change the knob's width.
+
+   Setting a fixed value for the diameter of the knob
+   is helpful for aligning several knobs in a row.
+
+   \param width New width
+
+   \sa knobWidth(), setAlignment()
+   \note Modifies the sizePolicy()
+ */
 void QwtKnob::setKnobWidth( int width )
 {
     width = qMax( width, 0 );
 
-    if ( width != d_data->knobWidth )
+    if ( width != m_data->knobWidth )
     {
         QSizePolicy::Policy policy;
@@ -780,5 +771,5 @@
         setSizePolicy( policy, policy );
 
-        d_data->knobWidth = width;
+        m_data->knobWidth = width;
 
         updateGeometry();
@@ -790,14 +781,14 @@
 int QwtKnob::knobWidth() const
 {
-    return d_data->knobWidth;
-}
-
-/*!
-  \brief Set the knob's border width
-  \param borderWidth new border width
-*/
+    return m_data->knobWidth;
+}
+
+/*!
+   \brief Set the knob's border width
+   \param borderWidth new border width
+ */
 void QwtKnob::setBorderWidth( int borderWidth )
 {
-    d_data->borderWidth = qMax( borderWidth, 0 );
+    m_data->borderWidth = qMax( borderWidth, 0 );
 
     updateGeometry();
@@ -808,20 +799,20 @@
 int QwtKnob::borderWidth() const
 {
-    return d_data->borderWidth;
-}
-
-/*!
-  \brief Set the size of the marker
-
-  When setting a size <= 0 the marker will
-  automatically scaled to 40% of the radius of the knob.
-
-  \sa markerSize(), markerStyle()
-*/
+    return m_data->borderWidth;
+}
+
+/*!
+   \brief Set the size of the marker
+
+   When setting a size <= 0 the marker will
+   automatically scaled to 40% of the radius of the knob.
+
+   \sa markerSize(), markerStyle()
+ */
 void QwtKnob::setMarkerSize( int size )
 {
-    if ( d_data->markerSize != size )
-    {
-        d_data->markerSize = size;
+    if ( m_data->markerSize != size )
+    {
+        m_data->markerSize = size;
         update();
     }
@@ -829,27 +820,29 @@
 
 /*!
-  \return Marker size
-  \sa setMarkerSize()
+   \return Marker size
+   \sa setMarkerSize()
  */
 int QwtKnob::markerSize() const
 {
-    return d_data->markerSize;
-}
-
-/*!
-  \return sizeHint()
-*/
+    return m_data->markerSize;
+}
+
+/*!
+   \return sizeHint()
+ */
 QSize QwtKnob::sizeHint() const
 {
     const QSize hint = qwtKnobSizeHint( this, 50 );
-    return hint.expandedTo( QApplication::globalStrut() );
-}
-
-/*!
-  \return Minimum size hint
-  \sa sizeHint()
-*/
+    return qwtExpandedToGlobalStrut( hint );
+}
+
+/*!
+   \return Minimum size hint
+   \sa sizeHint()
+ */
 QSize QwtKnob::minimumSizeHint() const
 {
     return qwtKnobSizeHint( this, 20 );
 }
+
+#include "moc_qwt_knob.cpp"
Index: /trunk/BNC/qwt/qwt_knob.h
===================================================================
--- /trunk/BNC/qwt/qwt_knob.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_knob.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -17,28 +17,28 @@
 
 /*!
-  \brief The Knob Widget
+   \brief The Knob Widget
 
-  The QwtKnob widget imitates look and behavior of a volume knob on a radio.
-  It looks similar to QDial - not to QwtDial.
+   The QwtKnob widget imitates look and behavior of a volume knob on a radio.
+   It looks similar to QDial - not to QwtDial.
 
-  The value range of a knob might be divided into several turns.
+   The value range of a knob might be divided into several turns.
 
-  The layout of the knob depends on the knobWidth().
+   The layout of the knob depends on the knobWidth().
 
-  - width > 0
+   - width > 0
     The diameter of the knob is fixed and the knob is aligned
     according to the alignment() flags inside of the contentsRect().
 
-  - width <= 0
+   - width <= 0
     The knob is extended to the minimum of width/height of the contentsRect()
     and aligned in the other direction according to alignment().
 
-  Setting a fixed knobWidth() is helpful to align several knobs with different
-  scale labels.
+   Setting a fixed knobWidth() is helpful to align several knobs with different
+   scale labels.
 
-  \image html knob.png
-*/
+   \image html knob.png
+ */
 
-class QWT_EXPORT QwtKnob: public QwtAbstractSlider
+class QWT_EXPORT QwtKnob : public QwtAbstractSlider
 {
     Q_OBJECT
@@ -55,5 +55,5 @@
     Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
 
-public:
+  public:
     /*!
        \brief Style of the knob surface
@@ -73,12 +73,12 @@
 
         /*!
-          Build a gradient from QPalette::Midlight, QPalette::Button
-          and QPalette::Midlight
+           Build a gradient from QPalette::Midlight, QPalette::Button
+           and QPalette::Midlight
          */
         Sunken,
 
         /*!
-          Build a radial gradient from QPalette::Button
-          like it is used for QDial in various Qt styles.
+           Build a radial gradient from QPalette::Button
+           like it is used for QDial in various Qt styles.
          */
         Styled
@@ -92,5 +92,5 @@
 
         \sa setMarkerStyle(), setMarkerSize()
-    */
+     */
     enum MarkerStyle
     {
@@ -108,12 +108,12 @@
 
         /*!
-          Draw a raised ellipse with a gradient build from
-          QPalette::Light and QPalette::Mid
+           Draw a raised ellipse with a gradient build from
+           QPalette::Light and QPalette::Mid
          */
         Nub,
 
         /*!
-          Draw a sunken ellipse with a gradient build from
-          QPalette::Light and QPalette::Mid
+           Draw a sunken ellipse with a gradient build from
+           QPalette::Light and QPalette::Mid
          */
         Notch
@@ -147,31 +147,31 @@
     int markerSize() const;
 
-    virtual QSize sizeHint() const;
-    virtual QSize minimumSizeHint() const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
+    virtual QSize minimumSizeHint() const QWT_OVERRIDE;
 
-    void setScaleDraw( QwtRoundScaleDraw * );
+    void setScaleDraw( QwtRoundScaleDraw* );
 
-    const QwtRoundScaleDraw *scaleDraw() const;
-    QwtRoundScaleDraw *scaleDraw();
+    const QwtRoundScaleDraw* scaleDraw() const;
+    QwtRoundScaleDraw* scaleDraw();
 
     QRect knobRect() const;
 
-protected:
-    virtual void paintEvent( QPaintEvent * );
-    virtual void changeEvent( QEvent * );
+  protected:
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
+    virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
 
-    virtual void drawKnob( QPainter *, const QRectF & ) const;
+    virtual void drawKnob( QPainter*, const QRectF& ) const;
 
-    virtual void drawFocusIndicator( QPainter * ) const;
+    virtual void drawFocusIndicator( QPainter* ) const;
 
-    virtual void drawMarker( QPainter *,
-        const QRectF &, double angle ) const;
+    virtual void drawMarker( QPainter*,
+        const QRectF&, double angle ) const;
 
-    virtual double scrolledTo( const QPoint & ) const;
-    virtual bool isScrollPosition( const QPoint & ) const;
+    virtual double scrolledTo( const QPoint& ) const QWT_OVERRIDE;
+    virtual bool isScrollPosition( const QPoint& ) const QWT_OVERRIDE;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_legend.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_legend.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_legend.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,135 +12,138 @@
 #include "qwt_dyngrid_layout.h"
 #include "qwt_math.h"
-#include "qwt_plot_item.h"
 #include "qwt_painter.h"
+#include "qwt_graphic.h"
+
 #include <qapplication.h>
 #include <qscrollbar.h>
 #include <qscrollarea.h>
 #include <qpainter.h>
-#include <qstyle.h>
-#include <qstyleoption.h>
-
-class QwtLegendMap
-{
-public:
-    inline bool isEmpty() const { return d_entries.isEmpty(); }
-
-    void insert( const QVariant &, const QList<QWidget *> & );
-    void remove( const QVariant & );
-
-    void removeWidget( const QWidget * );
-
-    QList<QWidget *> legendWidgets( const QVariant & ) const;
-    QVariant itemInfo( const QWidget * ) const;
-
-private:
-    // we don't know anything about itemInfo and therefore don't have
-    // any key that can be used for a map or hashtab.
-    // But a simple linear list is o.k. here, as we will never have
-    // more than a few entries.
-
-    class Entry
-    {
-    public:
-        QVariant itemInfo;
-        QList<QWidget *> widgets;
+#include <qmargins.h>
+
+namespace
+{
+    class LegendMap
+    {
+      public:
+        inline bool isEmpty() const { return m_entries.isEmpty(); }
+
+        void insert( const QVariant&, const QList< QWidget* >& );
+        void remove( const QVariant& );
+
+        void removeWidget( const QWidget* );
+
+        QList< QWidget* > legendWidgets( const QVariant& ) const;
+        QVariant itemInfo( const QWidget* ) const;
+
+      private:
+        // we don't know anything about itemInfo and therefore don't have
+        // any key that can be used for a map or hashtab.
+        // But a simple linear list is o.k. here, as we will never have
+        // more than a few entries.
+
+        class Entry
+        {
+          public:
+            QVariant itemInfo;
+            QList< QWidget* > widgets;
+        };
+
+        QList< Entry > m_entries;
     };
 
-    QList< Entry > d_entries;
+    void LegendMap::insert( const QVariant& itemInfo,
+        const QList< QWidget* >& widgets )
+    {
+        for ( int i = 0; i < m_entries.size(); i++ )
+        {
+            Entry& entry = m_entries[i];
+            if ( entry.itemInfo == itemInfo )
+            {
+                entry.widgets = widgets;
+                return;
+            }
+        }
+
+        Entry newEntry;
+        newEntry.itemInfo = itemInfo;
+        newEntry.widgets = widgets;
+
+        m_entries += newEntry;
+    }
+
+    void LegendMap::remove( const QVariant& itemInfo )
+    {
+        for ( int i = 0; i < m_entries.size(); i++ )
+        {
+            Entry& entry = m_entries[i];
+            if ( entry.itemInfo == itemInfo )
+            {
+                m_entries.removeAt( i );
+                return;
+            }
+        }
+    }
+
+    void LegendMap::removeWidget( const QWidget* widget )
+    {
+        QWidget* w = const_cast< QWidget* >( widget );
+
+        for ( int i = 0; i < m_entries.size(); i++ )
+            m_entries[ i ].widgets.removeAll( w );
+    }
+
+    QVariant LegendMap::itemInfo( const QWidget* widget ) const
+    {
+        if ( widget != NULL )
+        {
+            QWidget* w = const_cast< QWidget* >( widget );
+
+            for ( int i = 0; i < m_entries.size(); i++ )
+            {
+                const Entry& entry = m_entries[i];
+                if ( entry.widgets.indexOf( w ) >= 0 )
+                    return entry.itemInfo;
+            }
+        }
+
+        return QVariant();
+    }
+
+    QList< QWidget* > LegendMap::legendWidgets( const QVariant& itemInfo ) const
+    {
+        if ( itemInfo.isValid() )
+        {
+            for ( int i = 0; i < m_entries.size(); i++ )
+            {
+                const Entry& entry = m_entries[i];
+                if ( entry.itemInfo == itemInfo )
+                    return entry.widgets;
+            }
+        }
+
+        return QList< QWidget* >();
+    }
+}
+
+class QwtLegend::PrivateData
+{
+  public:
+    PrivateData()
+        : itemMode( QwtLegendData::ReadOnly )
+        , view( NULL )
+    {
+    }
+
+    QwtLegendData::Mode itemMode;
+    LegendMap itemMap;
+
+    class LegendView;
+    LegendView* view;
 };
 
-void QwtLegendMap::insert( const QVariant &itemInfo,
-    const QList<QWidget *> &widgets )
-{
-    for ( int i = 0; i < d_entries.size(); i++ )
-    {
-        Entry &entry = d_entries[i];
-        if ( entry.itemInfo == itemInfo )
-        {
-            entry.widgets = widgets;
-            return;
-        }
-    }
-
-    Entry newEntry;
-    newEntry.itemInfo = itemInfo;
-    newEntry.widgets = widgets;
-
-    d_entries += newEntry;
-}
-
-void QwtLegendMap::remove( const QVariant &itemInfo )
-{
-    for ( int i = 0; i < d_entries.size(); i++ )
-    {
-        Entry &entry = d_entries[i];
-        if ( entry.itemInfo == itemInfo )
-        {
-            d_entries.removeAt( i );
-            return;
-        }
-    }
-}
-
-void QwtLegendMap::removeWidget( const QWidget *widget )
-{
-    QWidget *w = const_cast<QWidget *>( widget );
-
-    for ( int i = 0; i < d_entries.size(); i++ )
-        d_entries[ i ].widgets.removeAll( w );
-}
-
-QVariant QwtLegendMap::itemInfo( const QWidget *widget ) const
-{
-    if ( widget != NULL )
-    {
-        QWidget *w = const_cast<QWidget *>( widget );
-
-        for ( int i = 0; i < d_entries.size(); i++ )
-        {
-            const Entry &entry = d_entries[i];
-            if ( entry.widgets.indexOf( w ) >= 0 )
-                return entry.itemInfo;
-        }
-    }
-
-    return QVariant();
-}
-
-QList<QWidget *> QwtLegendMap::legendWidgets( const QVariant &itemInfo ) const
-{
-    if ( itemInfo.isValid() )
-    {
-        for ( int i = 0; i < d_entries.size(); i++ )
-        {
-            const Entry &entry = d_entries[i];
-            if ( entry.itemInfo == itemInfo )
-                return entry.widgets;
-        }
-    }
-
-    return QList<QWidget *>();
-}
-
-class QwtLegend::PrivateData
-{
-public:
-    PrivateData():
-        itemMode( QwtLegendData::ReadOnly ),
-        view( NULL )
-    {
-    }
-
-    QwtLegendData::Mode itemMode;
-    QwtLegendMap itemMap;
-
-    class LegendView;
-    LegendView *view;
-};
-
-class QwtLegend::PrivateData::LegendView: public QScrollArea
-{
-public:
-    explicit LegendView( QWidget *parent ):
+class QwtLegend::PrivateData::LegendView QWT_FINAL : public QScrollArea
+{
+  public:
+    explicit LegendView( QWidget * parent ) :
         QScrollArea( parent )
     {
@@ -159,5 +162,5 @@
     }
 
-    virtual bool event( QEvent *event )
+    virtual bool event( QEvent* event ) QWT_OVERRIDE
     {
         if ( event->type() == QEvent::PolishRequest )
@@ -187,5 +190,5 @@
     }
 
-    virtual bool viewportEvent( QEvent *event )
+    virtual bool viewportEvent( QEvent* event ) QWT_OVERRIDE
     {
         bool ok = QScrollArea::viewportEvent( event );
@@ -223,5 +226,5 @@
     void layoutContents()
     {
-        const QwtDynGridLayout *tl = qobject_cast<QwtDynGridLayout *>(
+        const QwtDynGridLayout* tl = qobject_cast< QwtDynGridLayout* >(
             contentsWidget->layout() );
         if ( tl == NULL )
@@ -230,5 +233,6 @@
         const QSize visibleSize = viewport()->contentsRect().size();
 
-        const int minW = int( tl->maxItemWidth() ) + 2 * tl->margin();
+        const QMargins m = tl->contentsMargins();
+        const int minW = tl->maxItemWidth() + m.left() + m.right();
 
         int w = qMax( visibleSize.width(), minW );
@@ -245,31 +249,31 @@
     }
 
-    QWidget *contentsWidget;
+    QWidget* contentsWidget;
 };
 
 /*!
-  Constructor
-  \param parent Parent widget
-*/
-QwtLegend::QwtLegend( QWidget *parent ):
-    QwtAbstractLegend( parent )
+   Constructor
+   \param parent Parent widget
+ */
+QwtLegend::QwtLegend( QWidget* parent )
+    : QwtAbstractLegend( parent )
 {
     setFrameStyle( NoFrame );
 
-    d_data = new QwtLegend::PrivateData;
-
-    d_data->view = new QwtLegend::PrivateData::LegendView( this );
-    d_data->view->setObjectName( "QwtLegendView" );
-    d_data->view->setFrameStyle( NoFrame );
-
-    QwtDynGridLayout *gridLayout = new QwtDynGridLayout(
-        d_data->view->contentsWidget );
+    m_data = new QwtLegend::PrivateData;
+
+    m_data->view = new QwtLegend::PrivateData::LegendView( this );
+    m_data->view->setObjectName( "QwtLegendView" );
+    m_data->view->setFrameStyle( NoFrame );
+
+    QwtDynGridLayout* gridLayout = new QwtDynGridLayout(
+        m_data->view->contentsWidget );
     gridLayout->setAlignment( Qt::AlignHCenter | Qt::AlignTop );
 
-    d_data->view->contentsWidget->installEventFilter( this );
-
-    QVBoxLayout *layout = new QVBoxLayout( this );
+    m_data->view->contentsWidget->installEventFilter( this );
+
+    QVBoxLayout* layout = new QVBoxLayout( this );
     layout->setContentsMargins( 0, 0, 0, 0 );
-    layout->addWidget( d_data->view );
+    layout->addWidget( m_data->view );
 }
 
@@ -277,21 +281,21 @@
 QwtLegend::~QwtLegend()
 {
-    delete d_data;
-}
-
-/*!
-  \brief Set the maximum number of entries in a row
-
-  F.e when the maximum is set to 1 all items are aligned
-  vertically. 0 means unlimited
-
-  \param numColums Maximum number of entries in a row
-
-  \sa maxColumns(), QwtDynGridLayout::setMaxColumns()
+    delete m_data;
+}
+
+/*!
+   \brief Set the maximum number of entries in a row
+
+   F.e when the maximum is set to 1 all items are aligned
+   vertically. 0 means unlimited
+
+   \param numColums Maximum number of entries in a row
+
+   \sa maxColumns(), QwtDynGridLayout::setMaxColumns()
  */
 void QwtLegend::setMaxColumns( uint numColums )
 {
-    QwtDynGridLayout *tl = qobject_cast<QwtDynGridLayout *>(
-        d_data->view->contentsWidget->layout() );
+    QwtDynGridLayout* tl = qobject_cast< QwtDynGridLayout* >(
+        m_data->view->contentsWidget->layout() );
     if ( tl )
         tl->setMaxColumns( numColums );
@@ -301,6 +305,6 @@
 
 /*!
-  \return Maximum number of entries in a row
-  \sa setMaxColumns(), QwtDynGridLayout::maxColumns()
+   \return Maximum number of entries in a row
+   \sa setMaxColumns(), QwtDynGridLayout::maxColumns()
  */
 uint QwtLegend::maxColumns() const
@@ -308,6 +312,6 @@
     uint maxCols = 0;
 
-    const QwtDynGridLayout *tl = qobject_cast<const QwtDynGridLayout *>(
-        d_data->view->contentsWidget->layout() );
+    const QwtDynGridLayout* tl = qobject_cast< const QwtDynGridLayout* >(
+        m_data->view->contentsWidget->layout() );
     if ( tl )
         maxCols = tl->maxColumns();
@@ -317,89 +321,89 @@
 
 /*!
-  \brief Set the default mode for legend labels
-
-  Legend labels will be constructed according to the
-  attributes in a QwtLegendData object. When it doesn't
-  contain a value for the QwtLegendData::ModeRole the
-  label will be initialized with the default mode of the legend.
-
-  \param mode Default item mode
-
-  \sa itemMode(), QwtLegendData::value(), QwtPlotItem::legendData()
-  \note Changing the mode doesn't have any effect on existing labels.
+   \brief Set the default mode for legend labels
+
+   Legend labels will be constructed according to the
+   attributes in a QwtLegendData object. When it doesn't
+   contain a value for the QwtLegendData::ModeRole the
+   label will be initialized with the default mode of the legend.
+
+   \param mode Default item mode
+
+   \sa itemMode(), QwtLegendData::value(), QwtPlotItem::legendData()
+   \note Changing the mode doesn't have any effect on existing labels.
  */
 void QwtLegend::setDefaultItemMode( QwtLegendData::Mode mode )
 {
-    d_data->itemMode = mode;
-}
-
-/*!
-  \return Default item mode
-  \sa setDefaultItemMode()
-*/
+    m_data->itemMode = mode;
+}
+
+/*!
+   \return Default item mode
+   \sa setDefaultItemMode()
+ */
 QwtLegendData::Mode QwtLegend::defaultItemMode() const
 {
-    return d_data->itemMode;
-}
-
-/*!
-  The contents widget is the only child of the viewport of
-  the internal QScrollArea and the parent widget of all legend items.
-
-  \return Container widget of the legend items
-*/
-QWidget *QwtLegend::contentsWidget()
-{
-    return d_data->view->contentsWidget;
-}
-
-/*!
-  \return Horizontal scrollbar
-  \sa verticalScrollBar()
-*/
-QScrollBar *QwtLegend::horizontalScrollBar() const
-{
-    return d_data->view->horizontalScrollBar();
-}
-
-/*!
-  \return Vertical scrollbar
-  \sa horizontalScrollBar()
-*/
-QScrollBar *QwtLegend::verticalScrollBar() const
-{
-    return d_data->view->verticalScrollBar();
-}
-
-/*!
-  The contents widget is the only child of the viewport of
-  the internal QScrollArea and the parent widget of all legend items.
-
-  \return Container widget of the legend items
-
-*/
-const QWidget *QwtLegend::contentsWidget() const
-{
-    return d_data->view->contentsWidget;
-}
-
-/*!
-  \brief Update the entries for an item
-
-  \param itemInfo Info for an item
-  \param legendData List of legend entry attributes for the item
- */
-void QwtLegend::updateLegend( const QVariant &itemInfo,
-    const QList<QwtLegendData> &legendData )
-{
-    QList<QWidget *> widgetList = legendWidgets( itemInfo );
+    return m_data->itemMode;
+}
+
+/*!
+   The contents widget is the only child of the viewport of
+   the internal QScrollArea and the parent widget of all legend items.
+
+   \return Container widget of the legend items
+ */
+QWidget* QwtLegend::contentsWidget()
+{
+    return m_data->view->contentsWidget;
+}
+
+/*!
+   \return Horizontal scrollbar
+   \sa verticalScrollBar()
+ */
+QScrollBar* QwtLegend::horizontalScrollBar() const
+{
+    return m_data->view->horizontalScrollBar();
+}
+
+/*!
+   \return Vertical scrollbar
+   \sa horizontalScrollBar()
+ */
+QScrollBar* QwtLegend::verticalScrollBar() const
+{
+    return m_data->view->verticalScrollBar();
+}
+
+/*!
+   The contents widget is the only child of the viewport of
+   the internal QScrollArea and the parent widget of all legend items.
+
+   \return Container widget of the legend items
+
+ */
+const QWidget* QwtLegend::contentsWidget() const
+{
+    return m_data->view->contentsWidget;
+}
+
+/*!
+   \brief Update the entries for an item
+
+   \param itemInfo Info for an item
+   \param legendData List of legend entry attributes for the item
+ */
+void QwtLegend::updateLegend( const QVariant& itemInfo,
+    const QList< QwtLegendData >& legendData )
+{
+    QList< QWidget* > widgetList = legendWidgets( itemInfo );
 
     if ( widgetList.size() != legendData.size() )
     {
-        QLayout *contentsLayout = d_data->view->contentsWidget->layout();
+        QLayout* contentsLayout = m_data->view->contentsWidget->layout();
 
         while ( widgetList.size() > legendData.size() )
         {
-            QWidget *w = widgetList.takeLast();
+            QWidget* w = widgetList.takeLast();
 
             contentsLayout->removeWidget( w );
@@ -412,11 +416,9 @@
         }
 
-#if QT_VERSION >= 0x040700
         widgetList.reserve( legendData.size() );
-#endif
 
         for ( int i = widgetList.size(); i < legendData.size(); i++ )
         {
-            QWidget *widget = createWidget( legendData[i] );
+            QWidget* widget = createWidget( legendData[i] );
 
             if ( contentsLayout )
@@ -438,9 +440,9 @@
         if ( widgetList.isEmpty() )
         {
-            d_data->itemMap.remove( itemInfo );
+            m_data->itemMap.remove( itemInfo );
         }
         else
         {
-            d_data->itemMap.insert( itemInfo, widgetList );
+            m_data->itemMap.insert( itemInfo, widgetList );
         }
 
@@ -453,19 +455,19 @@
 
 /*!
-  \brief Create a widget to be inserted into the legend
-
-  The default implementation returns a QwtLegendLabel.
-
-  \param legendData Attributes of the legend entry
-  \return Widget representing data on the legend
-
-  \note updateWidget() will called soon after createWidget()
+   \brief Create a widget to be inserted into the legend
+
+   The default implementation returns a QwtLegendLabel.
+
+   \param legendData Attributes of the legend entry
+   \return Widget representing data on the legend
+
+   \note updateWidget() will called soon after createWidget()
         with the same attributes.
  */
-QWidget *QwtLegend::createWidget( const QwtLegendData &legendData ) const
+QWidget* QwtLegend::createWidget( const QwtLegendData& legendData ) const
 {
     Q_UNUSED( legendData );
 
-    QwtLegendLabel *label = new QwtLegendLabel();
+    QwtLegendLabel* label = new QwtLegendLabel();
     label->setItemMode( defaultItemMode() );
 
@@ -477,15 +479,15 @@
 
 /*!
-  \brief Update the widget
-
-  \param widget Usually a QwtLegendLabel
-  \param legendData Attributes to be displayed
-
-  \sa createWidget()
-  \note When widget is no QwtLegendLabel updateWidget() does nothing.
- */
-void QwtLegend::updateWidget( QWidget *widget, const QwtLegendData &legendData )
-{
-    QwtLegendLabel *label = qobject_cast<QwtLegendLabel *>( widget );
+   \brief Update the widget
+
+   \param widget Usually a QwtLegendLabel
+   \param legendData Attributes to be displayed
+
+   \sa createWidget()
+   \note When widget is no QwtLegendLabel updateWidget() does nothing.
+ */
+void QwtLegend::updateWidget( QWidget* widget, const QwtLegendData& legendData )
+{
+    QwtLegendLabel* label = qobject_cast< QwtLegendLabel* >( widget );
     if ( label )
     {
@@ -503,14 +505,14 @@
 void QwtLegend::updateTabOrder()
 {
-    QLayout *contentsLayout = d_data->view->contentsWidget->layout();
+    QLayout* contentsLayout = m_data->view->contentsWidget->layout();
     if ( contentsLayout )
     {
         // set tab focus chain
 
-        QWidget *w = NULL;
+        QWidget* w = NULL;
 
         for ( int i = 0; i < contentsLayout->count(); i++ )
         {
-            QLayoutItem *item = contentsLayout->itemAt( i );
+            QLayoutItem* item = contentsLayout->itemAt( i );
             if ( w && item->widget() )
                 QWidget::setTabOrder( w, item->widget() );
@@ -524,5 +526,5 @@
 QSize QwtLegend::sizeHint() const
 {
-    QSize hint = d_data->view->contentsWidget->sizeHint();
+    QSize hint = m_data->view->contentsWidget->sizeHint();
     hint += QSize( 2 * frameWidth(), 2 * frameWidth() );
 
@@ -531,12 +533,12 @@
 
 /*!
-  \return The preferred height, for a width.
-  \param width Width
-*/
+   \return The preferred height, for a width.
+   \param width Width
+ */
 int QwtLegend::heightForWidth( int width ) const
 {
     width -= 2 * frameWidth();
 
-    int h = d_data->view->contentsWidget->heightForWidth( width );
+    int h = m_data->view->contentsWidget->heightForWidth( width );
     if ( h >= 0 )
         h += 2 * frameWidth();
@@ -547,15 +549,15 @@
 
 /*!
-  Handle QEvent::ChildRemoved andQEvent::LayoutRequest events
-  for the contentsWidget().
-
-  \param object Object to be filtered
-  \param event Event
-
-  \return Forwarded to QwtAbstractLegend::eventFilter()
-*/
-bool QwtLegend::eventFilter( QObject *object, QEvent *event )
-{
-    if ( object == d_data->view->contentsWidget )
+   Handle QEvent::ChildRemoved and QEvent::LayoutRequest events
+   for the contentsWidget().
+
+   \param object Object to be filtered
+   \param event Event
+
+   \return Forwarded to QwtAbstractLegend::eventFilter()
+ */
+bool QwtLegend::eventFilter( QObject* object, QEvent* event )
+{
+    if ( object == m_data->view->contentsWidget )
     {
         switch ( event->type() )
@@ -563,6 +565,6 @@
             case QEvent::ChildRemoved:
             {
-                const QChildEvent *ce =
-                    static_cast<const QChildEvent *>(event);
+                const QChildEvent* ce =
+                    static_cast< const QChildEvent* >( event );
 
                 if ( ce->child()->isWidgetType() )
@@ -573,6 +575,6 @@
                         to remove it from the map.
                      */
-                    QWidget *w = reinterpret_cast< QWidget * >( ce->child() );
-                    d_data->itemMap.removeWidget( w );
+                    QWidget* w = reinterpret_cast< QWidget* >( ce->child() );
+                    m_data->itemMap.removeWidget( w );
                 }
                 break;
@@ -580,5 +582,5 @@
             case QEvent::LayoutRequest:
             {
-                d_data->view->layoutContents();
+                m_data->view->layoutContents();
 
                 if ( parentWidget() && parentWidget()->layout() == NULL )
@@ -609,17 +611,17 @@
 
 /*!
-  Called internally when the legend has been clicked on.
-  Emits a clicked() signal.
-*/
+   Called internally when the legend has been clicked on.
+   Emits a clicked() signal.
+ */
 void QwtLegend::itemClicked()
 {
-    QWidget *w = qobject_cast<QWidget *>( sender() );
+    QWidget* w = qobject_cast< QWidget* >( sender() );
     if ( w )
     {
-        const QVariant itemInfo = d_data->itemMap.itemInfo( w );
+        const QVariant itemInfo = m_data->itemMap.itemInfo( w );
         if ( itemInfo.isValid() )
         {
-            const QList<QWidget *> widgetList =
-                d_data->itemMap.legendWidgets( itemInfo );
+            const QList< QWidget* > widgetList =
+                m_data->itemMap.legendWidgets( itemInfo );
 
             const int index = widgetList.indexOf( w );
@@ -631,17 +633,17 @@
 
 /*!
-  Called internally when the legend has been checked
-  Emits a checked() signal.
-*/
+   Called internally when the legend has been checked
+   Emits a checked() signal.
+ */
 void QwtLegend::itemChecked( bool on )
 {
-    QWidget *w = qobject_cast<QWidget *>( sender() );
+    QWidget* w = qobject_cast< QWidget* >( sender() );
     if ( w )
     {
-        const QVariant itemInfo = d_data->itemMap.itemInfo( w );
+        const QVariant itemInfo = m_data->itemMap.itemInfo( w );
         if ( itemInfo.isValid() )
         {
-            const QList<QWidget *> widgetList =
-                d_data->itemMap.legendWidgets( itemInfo );
+            const QList< QWidget* > widgetList =
+                m_data->itemMap.legendWidgets( itemInfo );
 
             const int index = widgetList.indexOf( w );
@@ -653,16 +655,16 @@
 
 /*!
-  Render the legend into a given rectangle.
-
-  \param painter Painter
-  \param rect Bounding rectangle
-  \param fillBackground When true, fill rect with the widget background
-
-  \sa renderLegend() is used by QwtPlotRenderer - not by QwtLegend itself
-*/
-void QwtLegend::renderLegend( QPainter *painter,
-    const QRectF &rect, bool fillBackground ) const
-{
-    if ( d_data->itemMap.isEmpty() )
+   Render the legend into a given rectangle.
+
+   \param painter Painter
+   \param rect Bounding rectangle
+   \param fillBackground When true, fill rect with the widget background
+
+   \sa renderLegend() is used by QwtPlotRenderer - not by QwtLegend itself
+ */
+void QwtLegend::renderLegend( QPainter* painter,
+    const QRectF& rect, bool fillBackground ) const
+{
+    if ( m_data->itemMap.isEmpty() )
         return;
 
@@ -676,20 +678,19 @@
     }
 
-    const QwtDynGridLayout *legendLayout =
-        qobject_cast<QwtDynGridLayout *>( contentsWidget()->layout() );
+    const QwtDynGridLayout* legendLayout =
+        qobject_cast< QwtDynGridLayout* >( contentsWidget()->layout() );
     if ( legendLayout == NULL )
         return;
 
-    int left, right, top, bottom;
-    getContentsMargins( &left, &top, &right, &bottom );
+    const QMargins m = contentsMargins();
 
     QRect layoutRect;
-    layoutRect.setLeft( qCeil( rect.left() ) + left );
-    layoutRect.setTop( qCeil( rect.top() ) + top );
-    layoutRect.setRight( qFloor( rect.right() ) - right );
-    layoutRect.setBottom( qFloor( rect.bottom() ) - bottom );
+    layoutRect.setLeft( qwtCeil( rect.left() ) + m.left() );
+    layoutRect.setTop( qwtCeil( rect.top() ) + m.top() );
+    layoutRect.setRight( qwtFloor( rect.right() ) - m.right() );
+    layoutRect.setBottom( qwtFloor( rect.bottom() ) - m.bottom() );
 
     uint numCols = legendLayout->columnsForWidth( layoutRect.width() );
-    const QList<QRect> itemRects =
+    const QList< QRect > itemRects =
         legendLayout->layoutItems( layoutRect, numCols );
 
@@ -698,6 +699,6 @@
     for ( int i = 0; i < legendLayout->count(); i++ )
     {
-        QLayoutItem *item = legendLayout->itemAt( i );
-        QWidget *w = item->widget();
+        QLayoutItem* item = legendLayout->itemAt( i );
+        QWidget* w = item->widget();
         if ( w )
         {
@@ -714,16 +715,16 @@
 
 /*!
-  Render a legend entry into a given rectangle.
-
-  \param painter Painter
-  \param widget Widget representing a legend entry
-  \param rect Bounding rectangle
-  \param fillBackground When true, fill rect with the widget background
-
-  \note When widget is not derived from QwtLegendLabel renderItem
+   Render a legend entry into a given rectangle.
+
+   \param painter Painter
+   \param widget Widget representing a legend entry
+   \param rect Bounding rectangle
+   \param fillBackground When true, fill rect with the widget background
+
+   \note When widget is not derived from QwtLegendLabel renderItem
         does nothing beside the background
-*/
-void QwtLegend::renderItem( QPainter *painter,
-    const QWidget *widget, const QRectF &rect, bool fillBackground ) const
+ */
+void QwtLegend::renderItem( QPainter* painter,
+    const QWidget* widget, const QRectF& rect, bool fillBackground ) const
 {
     if ( fillBackground )
@@ -736,10 +737,10 @@
     }
 
-    const QwtLegendLabel *label = qobject_cast<const QwtLegendLabel *>( widget );
+    const QwtLegendLabel* label = qobject_cast< const QwtLegendLabel* >( widget );
     if ( label )
     {
         // icon
 
-        const QwtGraphic &icon = label->data().icon();
+        const QwtGraphic& icon = label->data().icon();
         const QSizeF sz = icon.defaultSize();
 
@@ -756,32 +757,36 @@
 
         QFont labelFont = label->font();
+#if QT_VERSION >= 0x060000
+        labelFont.setResolveMask( QFont::AllPropertiesResolved );
+#else
         labelFont.resolve( QFont::AllPropertiesResolved );
+#endif
 
         painter->setFont( labelFont );
         painter->setPen( label->palette().color( QPalette::Text ) );
 
-        const_cast< QwtLegendLabel *>( label )->drawText( painter, titleRect );
-    }
-}
-
-/*!
-  \return List of widgets associated to a item
-  \param itemInfo Info about an item
-  \sa legendWidget(), itemInfo(), QwtPlot::itemToInfo()
- */
-QList<QWidget *> QwtLegend::legendWidgets( const QVariant &itemInfo ) const
-{
-    return d_data->itemMap.legendWidgets( itemInfo );
-}
-
-/*!
-  \return First widget in the list of widgets associated to an item
-  \param itemInfo Info about an item
-  \sa itemInfo(), QwtPlot::itemToInfo()
-  \note Almost all types of items have only one widget
-*/
-QWidget *QwtLegend::legendWidget( const QVariant &itemInfo ) const
-{
-    const QList<QWidget *> list = d_data->itemMap.legendWidgets( itemInfo );
+        const_cast< QwtLegendLabel* >( label )->drawText( painter, titleRect );
+    }
+}
+
+/*!
+   \return List of widgets associated to a item
+   \param itemInfo Info about an item
+   \sa legendWidget(), itemInfo(), QwtPlot::itemToInfo()
+ */
+QList< QWidget* > QwtLegend::legendWidgets( const QVariant& itemInfo ) const
+{
+    return m_data->itemMap.legendWidgets( itemInfo );
+}
+
+/*!
+   \return First widget in the list of widgets associated to an item
+   \param itemInfo Info about an item
+   \sa itemInfo(), QwtPlot::itemToInfo()
+   \note Almost all types of items have only one widget
+ */
+QWidget* QwtLegend::legendWidget( const QVariant& itemInfo ) const
+{
+    const QList< QWidget* > list = m_data->itemMap.legendWidgets( itemInfo );
     if ( list.isEmpty() )
         return NULL;
@@ -791,13 +796,13 @@
 
 /*!
-  Find the item that is associated to a widget
-
-  \param widget Widget on the legend
-  \return Associated item info
-  \sa legendWidget()
- */
-QVariant QwtLegend::itemInfo( const QWidget *widget ) const
-{
-    return d_data->itemMap.itemInfo( widget );
+   Find the item that is associated to a widget
+
+   \param widget Widget on the legend
+   \return Associated item info
+   \sa legendWidget()
+ */
+QVariant QwtLegend::itemInfo( const QWidget* widget ) const
+{
+    return m_data->itemMap.itemInfo( widget );
 }
 
@@ -805,5 +810,5 @@
 bool QwtLegend::isEmpty() const
 {
-    return d_data->itemMap.isEmpty();
+    return m_data->itemMap.isEmpty();
 }
 
@@ -826,2 +831,3 @@
 }
 
+#include "moc_qwt_legend.cpp"
Index: /trunk/BNC/qwt/qwt_legend.h
===================================================================
--- /trunk/BNC/qwt/qwt_legend.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_legend.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,4 +13,6 @@
 #include "qwt_global.h"
 #include "qwt_abstract_legend.h"
+#include "qwt_legend_data.h"
+
 #include <qvariant.h>
 
@@ -18,12 +20,12 @@
 
 /*!
-  \brief The legend widget
+   \brief The legend widget
 
-  The QwtLegend widget is a tabular arrangement of legend items. Legend
-  items might be any type of widget, but in general they will be
-  a QwtLegendLabel.
+   The QwtLegend widget is a tabular arrangement of legend items. Legend
+   items might be any type of widget, but in general they will be
+   a QwtLegendLabel.
 
-  \sa QwtLegendLabel, QwtPlotItem, QwtPlot
-*/
+   \sa QwtLegendLabel, QwtPlotItem, QwtPlot
+ */
 
 class QWT_EXPORT QwtLegend : public QwtAbstractLegend
@@ -31,6 +33,6 @@
     Q_OBJECT
 
-public:
-    explicit QwtLegend( QWidget *parent = NULL );
+  public:
+    explicit QwtLegend( QWidget* parent = NULL );
     virtual ~QwtLegend();
 
@@ -41,76 +43,76 @@
     QwtLegendData::Mode defaultItemMode() const;
 
-    QWidget *contentsWidget();
-    const QWidget *contentsWidget() const;
+    QWidget* contentsWidget();
+    const QWidget* contentsWidget() const;
 
-    QWidget *legendWidget( const QVariant &  ) const;
-    QList<QWidget *> legendWidgets( const QVariant & ) const;
+    QWidget* legendWidget( const QVariant&  ) const;
+    QList< QWidget* > legendWidgets( const QVariant& ) const;
 
-    QVariant itemInfo( const QWidget * ) const;
+    QVariant itemInfo( const QWidget* ) const;
 
-    virtual bool eventFilter( QObject *, QEvent * );
+    virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
 
-    virtual QSize sizeHint() const;
-    virtual int heightForWidth( int width ) const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
+    virtual int heightForWidth( int w ) const QWT_OVERRIDE;
 
-    QScrollBar *horizontalScrollBar() const;
-    QScrollBar *verticalScrollBar() const;
+    QScrollBar* horizontalScrollBar() const;
+    QScrollBar* verticalScrollBar() const;
 
-    virtual void renderLegend( QPainter *,
-        const QRectF &, bool fillBackground ) const;
+    virtual void renderLegend( QPainter*,
+        const QRectF&, bool fillBackground ) const QWT_OVERRIDE;
 
-    virtual void renderItem( QPainter *,
-        const QWidget *, const QRectF &, bool fillBackground ) const;
+    virtual void renderItem( QPainter*,
+        const QWidget*, const QRectF&, bool fillBackground ) const;
 
-    virtual bool isEmpty() const;
-    virtual int scrollExtent( Qt::Orientation ) const;
+    virtual bool isEmpty() const QWT_OVERRIDE;
+    virtual int scrollExtent( Qt::Orientation ) const QWT_OVERRIDE;
 
-Q_SIGNALS:
+  Q_SIGNALS:
     /*!
-      A signal which is emitted when the user has clicked on
-      a legend label, which is in QwtLegendData::Clickable mode.
+       A signal which is emitted when the user has clicked on
+       a legend label, which is in QwtLegendData::Clickable mode.
 
-      \param itemInfo Info for the item item of the
+       \param itemInfo Info for the item item of the
                       selected legend item
-      \param index Index of the legend label in the list of widgets
+       \param index Index of the legend label in the list of widgets
                    that are associated with the plot item
 
-      \note clicks are disabled as default
-      \sa setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo()
+       \note clicks are disabled as default
+       \sa setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo()
      */
-    void clicked( const QVariant &itemInfo, int index );
+    void clicked( const QVariant& itemInfo, int index );
 
     /*!
-      A signal which is emitted when the user has clicked on
-      a legend label, which is in QwtLegendData::Checkable mode
+       A signal which is emitted when the user has clicked on
+       a legend label, which is in QwtLegendData::Checkable mode
 
-      \param itemInfo Info for the item of the
+       \param itemInfo Info for the item of the
                       selected legend label
-      \param index Index of the legend label in the list of widgets
+       \param index Index of the legend label in the list of widgets
                    that are associated with the plot item
-      \param on True when the legend label is checked
+       \param on True when the legend label is checked
 
-      \note clicks are disabled as default
-      \sa setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo()
+       \note clicks are disabled as default
+       \sa setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo()
      */
-    void checked( const QVariant &itemInfo, bool on, int index );
+    void checked( const QVariant& itemInfo, bool on, int index );
 
-public Q_SLOTS:
-    virtual void updateLegend( const QVariant &,
-        const QList<QwtLegendData> & );
+  public Q_SLOTS:
+    virtual void updateLegend( const QVariant&,
+        const QList< QwtLegendData >& ) QWT_OVERRIDE;
 
-protected Q_SLOTS:
+  protected Q_SLOTS:
     void itemClicked();
     void itemChecked( bool );
 
-protected:
-    virtual QWidget *createWidget( const QwtLegendData & ) const;
-    virtual void updateWidget( QWidget *widget, const QwtLegendData & );
+  protected:
+    virtual QWidget* createWidget( const QwtLegendData& ) const;
+    virtual void updateWidget( QWidget*, const QwtLegendData& );
 
-private:
+  private:
     void updateTabOrder();
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_legend_data.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_legend_data.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_legend_data.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,4 +9,6 @@
 
 #include "qwt_legend_data.h"
+#include "qwt_text.h"
+#include "qwt_graphic.h"
 
 //! Constructor
@@ -21,58 +23,58 @@
 
 /*!
-  Set the legend attributes
+   Set the legend attributes
 
-  QwtLegendData actually is a QMap<int, QVariant> with some
-  convenience interfaces
+   QwtLegendData actually is a QMap<int, QVariant> with some
+   convenience interfaces
 
-  \param map Values
-  \sa values()
+   \param map Values
+   \sa values()
  */
-void QwtLegendData::setValues( const QMap<int, QVariant> &map )
+void QwtLegendData::setValues( const QMap< int, QVariant >& map )
 {
-    d_map = map;
+    m_map = map;
 }
 
 /*!
-  \return Legend attributes
-  \sa setValues()
+   \return Legend attributes
+   \sa setValues()
  */
-const QMap<int, QVariant> &QwtLegendData::values() const
+const QMap< int, QVariant >& QwtLegendData::values() const
 {
-    return d_map;
+    return m_map;
 }
 
 /*!
-  \param role Attribute role
-  \return True, when the internal map has an entry for role
+   \param role Attribute role
+   \return True, when the internal map has an entry for role
  */
 bool QwtLegendData::hasRole( int role ) const
 {
-    return d_map.contains( role );
+    return m_map.contains( role );
 }
 
 /*!
-  Set an attribute value
+   Set an attribute value
 
-  \param role Attribute role
-  \param data Attribute value
+   \param role Attribute role
+   \param data Attribute value
 
-  \sa value()
+   \sa value()
  */
-void QwtLegendData::setValue( int role, const QVariant &data )
+void QwtLegendData::setValue( int role, const QVariant& data )
 {
-    d_map[role] = data;
+    m_map[role] = data;
 }
 
 /*!
-  \param role Attribute role
-  \return Attribute value for a specific role
+   \param role Attribute role
+   \return Attribute value for a specific role
  */
 QVariant QwtLegendData::value( int role ) const
 {
-    if ( !d_map.contains( role ) )
+    if ( !m_map.contains( role ) )
         return QVariant();
 
-    return d_map[role];
+    return m_map[role];
 }
 
@@ -80,5 +82,5 @@
 bool QwtLegendData::isValid() const
 {
-    return !d_map.isEmpty();
+    return !m_map.isEmpty();
 }
 
@@ -89,11 +91,11 @@
 
     const QVariant titleValue = value( QwtLegendData::TitleRole );
-    if ( titleValue.canConvert<QwtText>() )
+    if ( titleValue.canConvert< QwtText >() )
     {
-        text = qvariant_cast<QwtText>( titleValue );
+        text = qvariant_cast< QwtText >( titleValue );
     }
-    else if ( titleValue.canConvert<QString>() )
+    else if ( titleValue.canConvert< QString >() )
     {
-        text.setText( qvariant_cast<QString>( titleValue ) );
+        text.setText( qvariant_cast< QString >( titleValue ) );
     }
 
@@ -107,7 +109,7 @@
 
     QwtGraphic graphic;
-    if ( iconValue.canConvert<QwtGraphic>() )
+    if ( iconValue.canConvert< QwtGraphic >() )
     {
-        graphic = qvariant_cast<QwtGraphic>( iconValue );
+        graphic = qvariant_cast< QwtGraphic >( iconValue );
     }
 
@@ -119,8 +121,8 @@
 {
     const QVariant modeValue = value( QwtLegendData::ModeRole );
-    if ( modeValue.canConvert<int>() )
+    if ( modeValue.canConvert< int >() )
     {
-        const int mode = qvariant_cast<int>( modeValue );
-        return static_cast<QwtLegendData::Mode>( mode );
+        const int mode = qvariant_cast< int >( modeValue );
+        return static_cast< QwtLegendData::Mode >( mode );
     }
 
Index: /trunk/BNC/qwt/qwt_legend_data.h
===================================================================
--- /trunk/BNC/qwt/qwt_legend_data.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_legend_data.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,28 +12,29 @@
 
 #include "qwt_global.h"
-#include "qwt_text.h"
-#include "qwt_graphic.h"
+
 #include <qvariant.h>
-#include <qpixmap.h>
 #include <qmap.h>
 
+class QwtText;
+class QwtGraphic;
+
 /*!
-  \brief Attributes of an entry on a legend
+   \brief Attributes of an entry on a legend
 
-  QwtLegendData is an abstract container ( like QAbstractModel )
-  to exchange attributes, that are only known between to
-  the plot item and the legend.
+   QwtLegendData is an abstract container ( like QAbstractModel )
+   to exchange attributes, that are only known between to
+   the plot item and the legend.
 
-  By overloading QwtPlotItem::legendData() any other set of attributes
-  could be used, that can be handled by a modified ( or completely
-  different ) implementation of a legend.
+   By overloading QwtPlotItem::legendData() any other set of attributes
+   could be used, that can be handled by a modified ( or completely
+   different ) implementation of a legend.
 
-  \sa QwtLegend, QwtPlotLegendItem
-  \note The stockchart example implements a legend as a tree
+   \sa QwtLegend, QwtPlotLegendItem
+   \note The stockchart example implements a legend as a tree
         with checkable items
  */
 class QWT_EXPORT QwtLegendData
 {
-public:
+  public:
     //! Mode defining how a legend entry interacts
     enum Mode
@@ -49,5 +50,5 @@
     };
 
-    //! Identifier how to interprete a QVariant
+    //! Identifier how to interpret a QVariant
     enum Role
     {
@@ -68,8 +69,8 @@
     ~QwtLegendData();
 
-    void setValues( const QMap<int, QVariant> & );
-    const QMap<int, QVariant> &values() const;
+    void setValues( const QMap< int, QVariant >& );
+    const QMap< int, QVariant >& values() const;
 
-    void setValue( int role, const QVariant & );
+    void setValue( int role, const QVariant& );
     QVariant value( int role ) const;
 
@@ -81,6 +82,6 @@
     Mode mode() const;
 
-private:
-    QMap<int, QVariant> d_map;
+  private:
+    QMap< int, QVariant > m_map;
 };
 
Index: /trunk/BNC/qwt/qwt_legend_label.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_legend_label.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_legend_label.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,23 +10,21 @@
 #include "qwt_legend_label.h"
 #include "qwt_legend_data.h"
-#include "qwt_math.h"
+#include "qwt_graphic.h"
 #include "qwt_painter.h"
-#include "qwt_symbol.h"
-#include "qwt_graphic.h"
+#include "qwt.h"
+
 #include <qpainter.h>
 #include <qdrawutil.h>
 #include <qstyle.h>
-#include <qpen.h>
 #include <qevent.h>
 #include <qstyleoption.h>
-#include <qapplication.h>
 
 static const int ButtonFrame = 2;
 static const int Margin = 2;
 
-static QSize buttonShift( const QwtLegendLabel *w )
+static QSize buttonShift( const QwtLegendLabel* w )
 {
     QStyleOption option;
-    option.init( w );
+    option.initFrom( w );
 
     const int ph = w->style()->pixelMetric(
@@ -39,9 +37,9 @@
 class QwtLegendLabel::PrivateData
 {
-public:
-    PrivateData():
-        itemMode( QwtLegendData::ReadOnly ),
-        isDown( false ),
-        spacing( Margin )
+  public:
+    PrivateData()
+        : itemMode( QwtLegendData::ReadOnly )
+        , isDown( false )
+        , spacing( Margin )
     {
     }
@@ -57,15 +55,16 @@
 
 /*!
-  Set the attributes of the legend label
-
-  \param legendData Attributes of the label
-  \sa data()
- */
-void QwtLegendLabel::setData( const QwtLegendData &legendData )
-{
-    d_data->legendData = legendData;
+   Set the attributes of the legend label
+
+   \param legendData Attributes of the label
+   \sa data()
+ */
+void QwtLegendLabel::setData( const QwtLegendData& legendData )
+{
+    m_data->legendData = legendData;
 
     const bool doUpdate = updatesEnabled();
-    setUpdatesEnabled( false );
+    if ( doUpdate )
+        setUpdatesEnabled( false );
 
     setText( legendData.title() );
@@ -76,26 +75,23 @@
 
     if ( doUpdate )
-    {
         setUpdatesEnabled( true );
-        update();
-    }
-}
-
-/*!
-  \return Attributes of the label
-  \sa setData(), QwtPlotItem::legendData()
- */
-const QwtLegendData &QwtLegendLabel::data() const
-{
-    return d_data->legendData;
-}
-
-/*!
-  \param parent Parent widget
-*/
-QwtLegendLabel::QwtLegendLabel( QWidget *parent ):
-    QwtTextLabel( parent )
-{
-    d_data = new PrivateData;
+}
+
+/*!
+   \return Attributes of the label
+   \sa setData(), QwtPlotItem::legendData()
+ */
+const QwtLegendData& QwtLegendLabel::data() const
+{
+    return m_data->legendData;
+}
+
+/*!
+   \param parent Parent widget
+ */
+QwtLegendLabel::QwtLegendLabel( QWidget* parent )
+    : QwtTextLabel( parent )
+{
+    m_data = new PrivateData;
     setMargin( Margin );
     setIndent( Margin );
@@ -105,6 +101,6 @@
 QwtLegendLabel::~QwtLegendLabel()
 {
-    delete d_data;
-    d_data = NULL;
+    delete m_data;
+    m_data = NULL;
 }
 
@@ -114,6 +110,6 @@
    \param text Text label
     \sa QwtTextLabel::text()
-*/
-void QwtLegendLabel::setText( const QwtText &text )
+ */
+void QwtLegendLabel::setText( const QwtText& text )
 {
     const int flags = Qt::AlignLeft | Qt::AlignVCenter
@@ -132,11 +128,11 @@
    \param mode Item mode
    \sa itemMode()
-*/
+ */
 void QwtLegendLabel::setItemMode( QwtLegendData::Mode mode )
 {
-    if ( mode != d_data->itemMode )
-    {
-        d_data->itemMode = mode;
-        d_data->isDown = false;
+    if ( mode != m_data->itemMode )
+    {
+        m_data->itemMode = mode;
+        m_data->isDown = false;
 
         setFocusPolicy( ( mode != QwtLegendData::ReadOnly )
@@ -151,24 +147,27 @@
    \return Item mode
    \sa setItemMode()
-*/
+ */
 QwtLegendData::Mode QwtLegendLabel::itemMode() const
 {
-    return d_data->itemMode;
-}
-
-/*!
-  Assign the icon
-
-  \param icon Pixmap representing a plot item
-
-  \sa icon(), QwtPlotItem::legendIcon()
-*/
-void QwtLegendLabel::setIcon( const QPixmap &icon )
-{
-    d_data->icon = icon;
-
-    int indent = margin() + d_data->spacing;
+    return m_data->itemMode;
+}
+
+/*!
+   Assign the icon
+
+   \param icon Pixmap representing a plot item
+
+   \sa icon(), QwtPlotItem::legendIcon()
+ */
+void QwtLegendLabel::setIcon( const QPixmap& icon )
+{
+    m_data->icon = icon;
+
+    int indent = margin() + m_data->spacing;
     if ( icon.width() > 0 )
-        indent += icon.width() + d_data->spacing;
+    {
+        const qreal devicePixelRatio = QwtPainter::devicePixelRatio( &icon );
+        indent += icon.width() / devicePixelRatio + m_data->spacing;
+    }
 
     setIndent( indent );
@@ -176,10 +175,10 @@
 
 /*!
-  \return Pixmap representing a plot item
-  \sa setIcon()
-*/
+   \return Pixmap representing a plot item
+   \sa setIcon()
+ */
 QPixmap QwtLegendLabel::icon() const
 {
-    return d_data->icon;
+    return m_data->icon;
 }
 
@@ -189,15 +188,15 @@
    \param spacing Spacing
    \sa spacing(), QwtTextLabel::margin()
-*/
+ */
 void QwtLegendLabel::setSpacing( int spacing )
 {
     spacing = qMax( spacing, 0 );
-    if ( spacing != d_data->spacing )
-    {
-        d_data->spacing = spacing;
-
-        int indent = margin() + d_data->spacing;
-        if ( d_data->icon.width() > 0 )
-            indent += d_data->icon.width() + d_data->spacing;
+    if ( spacing != m_data->spacing )
+    {
+        m_data->spacing = spacing;
+
+        int indent = margin() + m_data->spacing;
+        if ( m_data->icon.width() > 0 )
+            indent += m_data->icon.width() + m_data->spacing;
 
         setIndent( indent );
@@ -208,8 +207,8 @@
    \return Spacing between icon and text
    \sa setSpacing(), QwtTextLabel::margin()
-*/
+ */
 int QwtLegendLabel::spacing() const
 {
-    return d_data->spacing;
+    return m_data->spacing;
 }
 
@@ -219,8 +218,8 @@
     \param on check/uncheck
     \sa setItemMode()
-*/
+ */
 void QwtLegendLabel::setChecked( bool on )
 {
-    if ( d_data->itemMode == QwtLegendData::Checkable )
+    if ( m_data->itemMode == QwtLegendData::Checkable )
     {
         const bool isBlocked = signalsBlocked();
@@ -236,5 +235,5 @@
 bool QwtLegendLabel::isChecked() const
 {
-    return d_data->itemMode == QwtLegendData::Checkable && isDown();
+    return m_data->itemMode == QwtLegendData::Checkable && isDown();
 }
 
@@ -242,13 +241,13 @@
 void QwtLegendLabel::setDown( bool down )
 {
-    if ( down == d_data->isDown )
+    if ( down == m_data->isDown )
         return;
 
-    d_data->isDown = down;
+    m_data->isDown = down;
     update();
 
-    if ( d_data->itemMode == QwtLegendData::Clickable )
-    {
-        if ( d_data->isDown )
+    if ( m_data->itemMode == QwtLegendData::Clickable )
+    {
+        if ( m_data->isDown )
             Q_EMIT pressed();
         else
@@ -259,6 +258,6 @@
     }
 
-    if ( d_data->itemMode == QwtLegendData::Checkable )
-        Q_EMIT checked( d_data->isDown );
+    if ( m_data->itemMode == QwtLegendData::Checkable )
+        Q_EMIT checked( m_data->isDown );
 }
 
@@ -266,5 +265,5 @@
 bool QwtLegendLabel::isDown() const
 {
-    return d_data->isDown;
+    return m_data->isDown;
 }
 
@@ -273,10 +272,10 @@
 {
     QSize sz = QwtTextLabel::sizeHint();
-    sz.setHeight( qMax( sz.height(), d_data->icon.height() + 4 ) );
-
-    if ( d_data->itemMode != QwtLegendData::ReadOnly )
+    sz.setHeight( qMax( sz.height(), m_data->icon.height() + 4 ) );
+
+    if ( m_data->itemMode != QwtLegendData::ReadOnly )
     {
         sz += buttonShift( this );
-        sz = sz.expandedTo( QApplication::globalStrut() );
+        sz = qwtExpandedToGlobalStrut( sz );
     }
 
@@ -285,5 +284,5 @@
 
 //! Paint event
-void QwtLegendLabel::paintEvent( QPaintEvent *e )
+void QwtLegendLabel::paintEvent( QPaintEvent* e )
 {
     const QRect cr = contentsRect();
@@ -292,5 +291,5 @@
     painter.setClipRegion( e->region() );
 
-    if ( d_data->isDown )
+    if ( m_data->isDown )
     {
         qDrawWinButton( &painter, 0, 0, width(), height(),
@@ -300,5 +299,5 @@
     painter.save();
 
-    if ( d_data->isDown )
+    if ( m_data->isDown )
     {
         const QSize shiftSize = buttonShift( this );
@@ -310,15 +309,16 @@
     drawContents( &painter );
 
-    if ( !d_data->icon.isNull() )
+    if ( !m_data->icon.isNull() )
     {
         QRect iconRect = cr;
         iconRect.setX( iconRect.x() + margin() );
-        if ( d_data->itemMode != QwtLegendData::ReadOnly )
+        if ( m_data->itemMode != QwtLegendData::ReadOnly )
             iconRect.setX( iconRect.x() + ButtonFrame );
 
-        iconRect.setSize( d_data->icon.size() );
+        const qreal devicePixelRatio = QwtPainter::devicePixelRatio( &m_data->icon );
+        iconRect.setSize( m_data->icon.size() / devicePixelRatio );
         iconRect.moveCenter( QPoint( iconRect.center().x(), cr.center().y() ) );
 
-        painter.drawPixmap( iconRect, d_data->icon );
+        painter.drawPixmap( iconRect, m_data->icon );
     }
 
@@ -327,9 +327,9 @@
 
 //! Handle mouse press events
-void QwtLegendLabel::mousePressEvent( QMouseEvent *e )
+void QwtLegendLabel::mousePressEvent( QMouseEvent* e )
 {
     if ( e->button() == Qt::LeftButton )
     {
-        switch ( d_data->itemMode )
+        switch ( m_data->itemMode )
         {
             case QwtLegendData::Clickable:
@@ -350,9 +350,9 @@
 
 //! Handle mouse release events
-void QwtLegendLabel::mouseReleaseEvent( QMouseEvent *e )
+void QwtLegendLabel::mouseReleaseEvent( QMouseEvent* e )
 {
     if ( e->button() == Qt::LeftButton )
     {
-        switch ( d_data->itemMode )
+        switch ( m_data->itemMode )
         {
             case QwtLegendData::Clickable:
@@ -372,9 +372,9 @@
 
 //! Handle key press events
-void QwtLegendLabel::keyPressEvent( QKeyEvent *e )
+void QwtLegendLabel::keyPressEvent( QKeyEvent* e )
 {
     if ( e->key() == Qt::Key_Space )
     {
-        switch ( d_data->itemMode )
+        switch ( m_data->itemMode )
         {
             case QwtLegendData::Clickable:
@@ -398,9 +398,9 @@
 
 //! Handle key release events
-void QwtLegendLabel::keyReleaseEvent( QKeyEvent *e )
+void QwtLegendLabel::keyReleaseEvent( QKeyEvent* e )
 {
     if ( e->key() == Qt::Key_Space )
     {
-        switch ( d_data->itemMode )
+        switch ( m_data->itemMode )
         {
             case QwtLegendData::Clickable:
@@ -420,2 +420,4 @@
     QwtTextLabel::keyReleaseEvent( e );
 }
+
+#include "moc_qwt_legend_label.cpp"
Index: /trunk/BNC/qwt/qwt_legend_label.h
===================================================================
--- /trunk/BNC/qwt/qwt_legend_label.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_legend_label.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,23 +12,21 @@
 
 #include "qwt_global.h"
+#include "qwt_text_label.h"
 #include "qwt_legend_data.h"
-#include "qwt_text.h"
-#include "qwt_text_label.h"
-#include <qpixmap.h>
 
-class QwtLegendData;
+class QwtText;
 
 /*!
-  \brief A widget representing something on a QwtLegend.
-*/
-class QWT_EXPORT QwtLegendLabel: public QwtTextLabel
+   \brief A widget representing something on a QwtLegend.
+ */
+class QWT_EXPORT QwtLegendLabel : public QwtTextLabel
 {
     Q_OBJECT
-public:
-    explicit QwtLegendLabel( QWidget *parent = 0 );
+  public:
+    explicit QwtLegendLabel( QWidget* parent = 0 );
     virtual ~QwtLegendLabel();
 
-    void setData( const QwtLegendData & );
-    const QwtLegendData &data() const;
+    void setData( const QwtLegendData& );
+    const QwtLegendData& data() const;
 
     void setItemMode( QwtLegendData::Mode );
@@ -38,17 +36,17 @@
     int spacing() const;
 
-    virtual void setText( const QwtText & );
+    virtual void setText( const QwtText& ) QWT_OVERRIDE;
 
-    void setIcon( const QPixmap & );
+    void setIcon( const QPixmap& );
     QPixmap icon() const;
 
-    virtual QSize sizeHint() const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
 
     bool isChecked() const;
 
-public Q_SLOTS:
+  public Q_SLOTS:
     void setChecked( bool on );
 
-Q_SIGNALS:
+  Q_SIGNALS:
     //! Signal, when the legend item has been clicked
     void clicked();
@@ -63,17 +61,17 @@
     void checked( bool );
 
-protected:
+  protected:
     void setDown( bool );
     bool isDown() const;
 
-    virtual void paintEvent( QPaintEvent * );
-    virtual void mousePressEvent( QMouseEvent * );
-    virtual void mouseReleaseEvent( QMouseEvent * );
-    virtual void keyPressEvent( QKeyEvent * );
-    virtual void keyReleaseEvent( QKeyEvent * );
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
+    virtual void mousePressEvent( QMouseEvent* ) QWT_OVERRIDE;
+    virtual void mouseReleaseEvent( QMouseEvent* ) QWT_OVERRIDE;
+    virtual void keyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
+    virtual void keyReleaseEvent( QKeyEvent* ) QWT_OVERRIDE;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_magnifier.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_magnifier.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_magnifier.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,4 +10,5 @@
 #include "qwt_magnifier.h"
 #include "qwt_math.h"
+
 #include <qevent.h>
 #include <qwidget.h>
@@ -15,18 +16,19 @@
 class QwtMagnifier::PrivateData
 {
-public:
-    PrivateData():
-        isEnabled( false ),
-        wheelFactor( 0.9 ),
-        wheelModifiers( Qt::NoModifier ),
-        mouseFactor( 0.95 ),
-        mouseButton( Qt::RightButton ),
-        mouseButtonModifiers( Qt::NoModifier ),
-        keyFactor( 0.9 ),
-        zoomInKey( Qt::Key_Plus ),
-        zoomInKeyModifiers( Qt::NoModifier ),
-        zoomOutKey( Qt::Key_Minus ),
-        zoomOutKeyModifiers( Qt::NoModifier ),
-        mousePressed( false )
+  public:
+    PrivateData()
+        : isEnabled( false )
+        , wheelFactor( 0.9 )
+        , wheelModifiers( Qt::NoModifier )
+        , mouseFactor( 0.95 )
+        , mouseButton( Qt::RightButton )
+        , mouseButtonModifiers( Qt::NoModifier )
+        , keyFactor( 0.9 )
+        , zoomInKey( Qt::Key_Plus )
+        , zoomInKeyModifiers( Qt::NoModifier )
+        , zoomOutKey( Qt::Key_Minus )
+        , zoomOutKeyModifiers( Qt::NoModifier )
+        , mousePressed( false )
+        , hasMouseTracking( false )
     {
     }
@@ -48,5 +50,5 @@
 
     int zoomOutKey;
-    Qt::KeyboardModifiers  zoomOutKeyModifiers;
+    Qt::KeyboardModifiers zoomOutKeyModifiers;
 
     bool mousePressed;
@@ -58,9 +60,16 @@
    Constructor
    \param parent Widget to be magnified
-*/
-QwtMagnifier::QwtMagnifier( QWidget *parent ):
-    QObject( parent )
-{
-    d_data = new PrivateData();
+ */
+QwtMagnifier::QwtMagnifier( QWidget* parent )
+    : QObject( parent )
+{
+    m_data = new PrivateData();
+
+    if ( parent )
+    {
+        if ( parent->focusPolicy() == Qt::NoFocus )
+            parent->setFocusPolicy( Qt::WheelFocus );
+    }
+
     setEnabled( true );
 }
@@ -69,26 +78,26 @@
 QwtMagnifier::~QwtMagnifier()
 {
-    delete d_data;
-}
-
-/*!
-  \brief En/disable the magnifier
-
-  When enabled is true an event filter is installed for
-  the observed widget, otherwise the event filter is removed.
-
-  \param on true or false
-  \sa isEnabled(), eventFilter()
-*/
+    delete m_data;
+}
+
+/*!
+   \brief En/disable the magnifier
+
+   When enabled is true an event filter is installed for
+   the observed widget, otherwise the event filter is removed.
+
+   \param on true or false
+   \sa isEnabled(), eventFilter()
+ */
 void QwtMagnifier::setEnabled( bool on )
 {
-    if ( d_data->isEnabled != on )
-    {
-        d_data->isEnabled = on;
-
-        QObject *o = parent();
+    if ( m_data->isEnabled != on )
+    {
+        m_data->isEnabled = on;
+
+        QObject* o = parent();
         if ( o )
         {
-            if ( d_data->isEnabled )
+            if ( m_data->isEnabled )
                 o->installEventFilter( this );
             else
@@ -99,10 +108,10 @@
 
 /*!
-  \return true when enabled, false otherwise
-  \sa setEnabled(), eventFilter()
-*/
+   \return true when enabled, false otherwise
+   \sa setEnabled(), eventFilter()
+ */
 bool QwtMagnifier::isEnabled() const
 {
-    return d_data->isEnabled;
+    return m_data->isEnabled;
 }
 
@@ -122,8 +131,8 @@
    \sa wheelFactor(), setWheelButtonState(),
        setMouseFactor(), setKeyFactor()
-*/
+ */
 void QwtMagnifier::setWheelFactor( double factor )
 {
-    d_data->wheelFactor = factor;
+    m_data->wheelFactor = factor;
 }
 
@@ -131,8 +140,8 @@
    \return Wheel factor
    \sa setWheelFactor()
-*/
+ */
 double QwtMagnifier::wheelFactor() const
 {
-    return d_data->wheelFactor;
+    return m_data->wheelFactor;
 }
 
@@ -143,8 +152,8 @@
    \param modifiers Keyboard modifiers
    \sa wheelModifiers()
-*/
+ */
 void QwtMagnifier::setWheelModifiers( Qt::KeyboardModifiers modifiers )
 {
-    d_data->wheelModifiers = modifiers;
+    m_data->wheelModifiers = modifiers;
 }
 
@@ -152,8 +161,8 @@
    \return Wheel modifiers
    \sa setWheelModifiers()
-*/
+ */
 Qt::KeyboardModifiers QwtMagnifier::wheelModifiers() const
 {
-    return d_data->wheelModifiers;
+    return m_data->wheelModifiers;
 }
 
@@ -167,8 +176,8 @@
    \param factor Wheel factor
    \sa mouseFactor(), setMouseButton(), setWheelFactor(), setKeyFactor()
-*/
+ */
 void QwtMagnifier::setMouseFactor( double factor )
 {
-    d_data->mouseFactor = factor;
+    m_data->mouseFactor = factor;
 }
 
@@ -176,8 +185,8 @@
    \return Mouse factor
    \sa setMouseFactor()
-*/
+ */
 double QwtMagnifier::mouseFactor() const
 {
-    return d_data->mouseFactor;
+    return m_data->mouseFactor;
 }
 
@@ -190,18 +199,18 @@
 
    \sa getMouseButton()
-*/
+ */
 void QwtMagnifier::setMouseButton(
     Qt::MouseButton button, Qt::KeyboardModifiers modifiers )
 {
-    d_data->mouseButton = button;
-    d_data->mouseButtonModifiers = modifiers;
+    m_data->mouseButton = button;
+    m_data->mouseButtonModifiers = modifiers;
 }
 
 //! \sa setMouseButton()
 void QwtMagnifier::getMouseButton(
-    Qt::MouseButton &button, Qt::KeyboardModifiers &modifiers ) const
-{
-    button = d_data->mouseButton;
-    modifiers = d_data->mouseButtonModifiers;
+    Qt::MouseButton& button, Qt::KeyboardModifiers& modifiers ) const
+{
+    button = m_data->mouseButton;
+    modifiers = m_data->mouseButtonModifiers;
 }
 
@@ -216,8 +225,8 @@
    \sa keyFactor(), setZoomInKey(), setZoomOutKey(),
        setWheelFactor, setMouseFactor()
-*/
+ */
 void QwtMagnifier::setKeyFactor( double factor )
 {
-    d_data->keyFactor = factor;
+    m_data->keyFactor = factor;
 }
 
@@ -225,8 +234,8 @@
    \return Key factor
    \sa setKeyFactor()
-*/
+ */
 double QwtMagnifier::keyFactor() const
 {
-    return d_data->keyFactor;
+    return m_data->keyFactor;
 }
 
@@ -238,10 +247,10 @@
    \param modifiers
    \sa getZoomInKey(), setZoomOutKey()
-*/
+ */
 void QwtMagnifier::setZoomInKey( int key,
     Qt::KeyboardModifiers modifiers )
 {
-    d_data->zoomInKey = key;
-    d_data->zoomInKeyModifiers = modifiers;
+    m_data->zoomInKey = key;
+    m_data->zoomInKeyModifiers = modifiers;
 }
 
@@ -253,10 +262,10 @@
 
    \sa setZoomInKey()
-*/
-void QwtMagnifier::getZoomInKey( int &key,
-    Qt::KeyboardModifiers &modifiers ) const
-{
-    key = d_data->zoomInKey;
-    modifiers = d_data->zoomInKeyModifiers;
+ */
+void QwtMagnifier::getZoomInKey( int& key,
+    Qt::KeyboardModifiers& modifiers ) const
+{
+    key = m_data->zoomInKey;
+    modifiers = m_data->zoomInKeyModifiers;
 }
 
@@ -268,10 +277,10 @@
    \param modifiers
    \sa getZoomOutKey(), setZoomOutKey()
-*/
+ */
 void QwtMagnifier::setZoomOutKey( int key,
     Qt::KeyboardModifiers modifiers )
 {
-    d_data->zoomOutKey = key;
-    d_data->zoomOutKeyModifiers = modifiers;
+    m_data->zoomOutKey = key;
+    m_data->zoomOutKeyModifiers = modifiers;
 }
 
@@ -283,28 +292,28 @@
 
    \sa setZoomOutKey()
-*/
-void QwtMagnifier::getZoomOutKey( int &key,
-    Qt::KeyboardModifiers &modifiers ) const
-{
-    key = d_data->zoomOutKey;
-    modifiers = d_data->zoomOutKeyModifiers;
-}
-
-/*!
-  \brief Event filter
-
-  When isEnabled() is true, the mouse events of the
-  observed widget are filtered.
-
-  \param object Object to be filtered
-  \param event Event
-
-  \return Forwarded to QObject::eventFilter()
-
-  \sa widgetMousePressEvent(), widgetMouseReleaseEvent(),
+ */
+void QwtMagnifier::getZoomOutKey( int& key,
+    Qt::KeyboardModifiers& modifiers ) const
+{
+    key = m_data->zoomOutKey;
+    modifiers = m_data->zoomOutKeyModifiers;
+}
+
+/*!
+   \brief Event filter
+
+   When isEnabled() is true, the mouse events of the
+   observed widget are filtered.
+
+   \param object Object to be filtered
+   \param event Event
+
+   \return Forwarded to QObject::eventFilter()
+
+   \sa widgetMousePressEvent(), widgetMouseReleaseEvent(),
       widgetMouseMoveEvent(), widgetWheelEvent(), widgetKeyPressEvent()
       widgetKeyReleaseEvent()
-*/
-bool QwtMagnifier::eventFilter( QObject *object, QEvent *event )
+ */
+bool QwtMagnifier::eventFilter( QObject* object, QEvent* event )
 {
     if ( object && object == parent() )
@@ -314,30 +323,30 @@
             case QEvent::MouseButtonPress:
             {
-                widgetMousePressEvent( static_cast<QMouseEvent *>( event ) );
+                widgetMousePressEvent( static_cast< QMouseEvent* >( event ) );
                 break;
             }
             case QEvent::MouseMove:
             {
-                widgetMouseMoveEvent( static_cast<QMouseEvent *>( event ) );
+                widgetMouseMoveEvent( static_cast< QMouseEvent* >( event ) );
                 break;
             }
             case QEvent::MouseButtonRelease:
             {
-                widgetMouseReleaseEvent( static_cast<QMouseEvent *>( event ) );
+                widgetMouseReleaseEvent( static_cast< QMouseEvent* >( event ) );
                 break;
             }
             case QEvent::Wheel:
             {
-                widgetWheelEvent( static_cast<QWheelEvent *>( event ) );
+                widgetWheelEvent( static_cast< QWheelEvent* >( event ) );
                 break;
             }
             case QEvent::KeyPress:
             {
-                widgetKeyPressEvent( static_cast<QKeyEvent *>( event ) );
+                widgetKeyPressEvent( static_cast< QKeyEvent* >( event ) );
                 break;
             }
             case QEvent::KeyRelease:
             {
-                widgetKeyReleaseEvent( static_cast<QKeyEvent *>( event ) );
+                widgetKeyReleaseEvent( static_cast< QKeyEvent* >( event ) );
                 break;
             }
@@ -349,60 +358,60 @@
 
 /*!
-  Handle a mouse press event for the observed widget.
-
-  \param mouseEvent Mouse event
-  \sa eventFilter(), widgetMouseReleaseEvent(), widgetMouseMoveEvent()
-*/
-void QwtMagnifier::widgetMousePressEvent( QMouseEvent *mouseEvent )
+   Handle a mouse press event for the observed widget.
+
+   \param mouseEvent Mouse event
+   \sa eventFilter(), widgetMouseReleaseEvent(), widgetMouseMoveEvent()
+ */
+void QwtMagnifier::widgetMousePressEvent( QMouseEvent* mouseEvent )
 {
     if ( parentWidget() == NULL )
         return;
 
-    if ( ( mouseEvent->button() != d_data->mouseButton ) ||
-        ( mouseEvent->modifiers() != d_data->mouseButtonModifiers ) )
+    if ( ( mouseEvent->button() != m_data->mouseButton ) ||
+        ( mouseEvent->modifiers() != m_data->mouseButtonModifiers ) )
     {
         return;
     }
 
-    d_data->hasMouseTracking = parentWidget()->hasMouseTracking();
+    m_data->hasMouseTracking = parentWidget()->hasMouseTracking();
 
     parentWidget()->setMouseTracking( true );
-    d_data->mousePos = mouseEvent->pos();
-    d_data->mousePressed = true;
-}
-
-/*!
-  Handle a mouse release event for the observed widget.
-
-  \param mouseEvent Mouse event
-
-  \sa eventFilter(), widgetMousePressEvent(), widgetMouseMoveEvent(),
-*/
-void QwtMagnifier::widgetMouseReleaseEvent( QMouseEvent *mouseEvent )
+    m_data->mousePos = mouseEvent->pos();
+    m_data->mousePressed = true;
+}
+
+/*!
+   Handle a mouse release event for the observed widget.
+
+   \param mouseEvent Mouse event
+
+   \sa eventFilter(), widgetMousePressEvent(), widgetMouseMoveEvent(),
+ */
+void QwtMagnifier::widgetMouseReleaseEvent( QMouseEvent* mouseEvent )
 {
     Q_UNUSED( mouseEvent );
 
-    if ( d_data->mousePressed && parentWidget() )
-    {
-        d_data->mousePressed = false;
-        parentWidget()->setMouseTracking( d_data->hasMouseTracking );
-    }
-}
-
-/*!
-  Handle a mouse move event for the observed widget.
-
-  \param mouseEvent Mouse event
-  \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
-*/
-void QwtMagnifier::widgetMouseMoveEvent( QMouseEvent *mouseEvent )
-{
-    if ( !d_data->mousePressed )
+    if ( m_data->mousePressed && parentWidget() )
+    {
+        m_data->mousePressed = false;
+        parentWidget()->setMouseTracking( m_data->hasMouseTracking );
+    }
+}
+
+/*!
+   Handle a mouse move event for the observed widget.
+
+   \param mouseEvent Mouse event
+   \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
+ */
+void QwtMagnifier::widgetMouseMoveEvent( QMouseEvent* mouseEvent )
+{
+    if ( !m_data->mousePressed )
         return;
 
-    const int dy = mouseEvent->pos().y() - d_data->mousePos.y();
+    const int dy = mouseEvent->pos().y() - m_data->mousePos.y();
     if ( dy != 0 )
     {
-        double f = d_data->mouseFactor;
+        double f = m_data->mouseFactor;
         if ( dy < 0 )
             f = 1 / f;
@@ -411,22 +420,30 @@
     }
 
-    d_data->mousePos = mouseEvent->pos();
-}
-
-/*!
-  Handle a wheel event for the observed widget.
-
-  \param wheelEvent Wheel event
-  \sa eventFilter()
-*/
-void QwtMagnifier::widgetWheelEvent( QWheelEvent *wheelEvent )
-{
-    if ( wheelEvent->modifiers() != d_data->wheelModifiers )
+    m_data->mousePos = mouseEvent->pos();
+}
+
+/*!
+   Handle a wheel event for the observed widget.
+
+   \param wheelEvent Wheel event
+   \sa eventFilter()
+ */
+void QwtMagnifier::widgetWheelEvent( QWheelEvent* wheelEvent )
+{
+    if ( wheelEvent->modifiers() != m_data->wheelModifiers )
     {
         return;
     }
 
-    if ( d_data->wheelFactor != 0.0 )
-    {
+    if ( m_data->wheelFactor != 0.0 )
+    {
+#if QT_VERSION < 0x050000
+        const int wheelDelta = wheelEvent->delta();
+#else
+        const QPoint delta = wheelEvent->angleDelta();
+        const int wheelDelta = ( qAbs( delta.x() ) > qAbs( delta.y() ) )
+            ? delta.x() : delta.y();
+#endif
+
         /*
             A positive delta indicates that the wheel was
@@ -438,8 +455,8 @@
             of 120 (== 15 * 8).
          */
-        double f = qPow( d_data->wheelFactor,
-            qAbs( wheelEvent->delta() / 120.0 ) );
-
-        if ( wheelEvent->delta() > 0 )
+        double f = std::pow( m_data->wheelFactor,
+            qAbs( wheelDelta / 120.0 ) );
+
+        if ( wheelDelta > 0 )
             f = 1 / f;
 
@@ -449,30 +466,30 @@
 
 /*!
-  Handle a key press event for the observed widget.
-
-  \param keyEvent Key event
-  \sa eventFilter(), widgetKeyReleaseEvent()
-*/
-void QwtMagnifier::widgetKeyPressEvent( QKeyEvent *keyEvent )
-{
-    if ( keyEvent->key() == d_data->zoomInKey &&
-        keyEvent->modifiers() == d_data->zoomInKeyModifiers )
-    {
-        rescale( d_data->keyFactor );
-    }
-    else if ( keyEvent->key() == d_data->zoomOutKey &&
-        keyEvent->modifiers() == d_data->zoomOutKeyModifiers )
-    {
-        rescale( 1.0 / d_data->keyFactor );
-    }
-}
-
-/*!
-  Handle a key release event for the observed widget.
-
-  \param keyEvent Key event
-  \sa eventFilter(), widgetKeyReleaseEvent()
-*/
-void QwtMagnifier::widgetKeyReleaseEvent( QKeyEvent *keyEvent )
+   Handle a key press event for the observed widget.
+
+   \param keyEvent Key event
+   \sa eventFilter(), widgetKeyReleaseEvent()
+ */
+void QwtMagnifier::widgetKeyPressEvent( QKeyEvent* keyEvent )
+{
+    if ( keyEvent->key() == m_data->zoomInKey &&
+        keyEvent->modifiers() == m_data->zoomInKeyModifiers )
+    {
+        rescale( m_data->keyFactor );
+    }
+    else if ( keyEvent->key() == m_data->zoomOutKey &&
+        keyEvent->modifiers() == m_data->zoomOutKeyModifiers )
+    {
+        rescale( 1.0 / m_data->keyFactor );
+    }
+}
+
+/*!
+   Handle a key release event for the observed widget.
+
+   \param keyEvent Key event
+   \sa eventFilter(), widgetKeyReleaseEvent()
+ */
+void QwtMagnifier::widgetKeyReleaseEvent( QKeyEvent* keyEvent )
 {
     Q_UNUSED( keyEvent );
@@ -480,13 +497,14 @@
 
 //! \return Parent widget, where the rescaling happens
-QWidget *QwtMagnifier::parentWidget()
-{
-    return qobject_cast<QWidget *>( parent() );
+QWidget* QwtMagnifier::parentWidget()
+{
+    return qobject_cast< QWidget* >( parent() );
 }
 
 //! \return Parent widget, where the rescaling happens
-const QWidget *QwtMagnifier::parentWidget() const
-{
-    return qobject_cast<const QWidget *>( parent() );
-}
-
+const QWidget* QwtMagnifier::parentWidget() const
+{
+    return qobject_cast< const QWidget* >( parent() );
+}
+
+#include "moc_qwt_magnifier.cpp"
Index: /trunk/BNC/qwt/qwt_magnifier.h
===================================================================
--- /trunk/BNC/qwt/qwt_magnifier.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_magnifier.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,5 +9,5 @@
 
 #ifndef QWT_MAGNIFIER_H
-#define QWT_MAGNIFIER_H 1
+#define QWT_MAGNIFIER_H
 
 #include "qwt_global.h"
@@ -20,19 +20,19 @@
 
 /*!
-  \brief QwtMagnifier provides zooming, by magnifying in steps.
+   \brief QwtMagnifier provides zooming, by magnifying in steps.
 
-  Using QwtMagnifier a plot can be zoomed in/out in steps using
-  keys, the mouse wheel or moving a mouse button in vertical direction.
-*/
-class QWT_EXPORT QwtMagnifier: public QObject
+   Using QwtMagnifier a plot can be zoomed in/out in steps using
+   keys, the mouse wheel or moving a mouse button in vertical direction.
+ */
+class QWT_EXPORT QwtMagnifier : public QObject
 {
     Q_OBJECT
 
-public:
-    explicit QwtMagnifier( QWidget * );
+  public:
+    explicit QwtMagnifier( QWidget* );
     virtual ~QwtMagnifier();
 
-    QWidget *parentWidget();
-    const QWidget *parentWidget() const;
+    QWidget* parentWidget();
+    const QWidget* parentWidget() const;
 
     void setEnabled( bool );
@@ -44,5 +44,5 @@
 
     void setMouseButton( Qt::MouseButton, Qt::KeyboardModifiers = Qt::NoModifier );
-    void getMouseButton( Qt::MouseButton &, Qt::KeyboardModifiers & ) const;
+    void getMouseButton( Qt::MouseButton&, Qt::KeyboardModifiers& ) const;
 
     // mouse wheel
@@ -58,12 +58,12 @@
 
     void setZoomInKey( int key, Qt::KeyboardModifiers = Qt::NoModifier );
-    void getZoomInKey( int &key, Qt::KeyboardModifiers & ) const;
+    void getZoomInKey( int& key, Qt::KeyboardModifiers& ) const;
 
     void setZoomOutKey( int key, Qt::KeyboardModifiers = Qt::NoModifier );
-    void getZoomOutKey( int &key, Qt::KeyboardModifiers & ) const;
+    void getZoomOutKey( int& key, Qt::KeyboardModifiers& ) const;
 
-    virtual bool eventFilter( QObject *, QEvent * );
+    virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
 
-protected:
+  protected:
     /*!
        Rescale the parent widget
@@ -72,14 +72,14 @@
     virtual void rescale( double factor ) = 0;
 
-    virtual void widgetMousePressEvent( QMouseEvent * );
-    virtual void widgetMouseReleaseEvent( QMouseEvent * );
-    virtual void widgetMouseMoveEvent( QMouseEvent * );
-    virtual void widgetWheelEvent( QWheelEvent * );
-    virtual void widgetKeyPressEvent( QKeyEvent * );
-    virtual void widgetKeyReleaseEvent( QKeyEvent * );
+    virtual void widgetMousePressEvent( QMouseEvent* );
+    virtual void widgetMouseReleaseEvent( QMouseEvent* );
+    virtual void widgetMouseMoveEvent( QMouseEvent* );
+    virtual void widgetWheelEvent( QWheelEvent* );
+    virtual void widgetKeyPressEvent( QKeyEvent* );
+    virtual void widgetKeyReleaseEvent( QKeyEvent* );
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_math.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_math.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_math.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,48 +9,16 @@
 
 #include "qwt_math.h"
+#if QT_VERSION >= 0x050a00
+#include <qrandom.h>
+#endif
 
 /*!
-  \brief Find the smallest value in an array
-  \param array Pointer to an array
-  \param size Array size
-*/
-double qwtGetMin( const double *array, int size )
-{
-    if ( size <= 0 )
-        return 0.0;
-
-    double rv = array[0];
-    for ( int i = 1; i < size; i++ )
-        rv = qMin( rv, array[i] );
-
-    return rv;
-}
-
-
-/*!
-  \brief Find the largest value in an array
-  \param array Pointer to an array
-  \param size Array size
-*/
-double qwtGetMax( const double *array, int size )
-{
-    if ( size <= 0 )
-        return 0.0;
-
-    double rv = array[0];
-    for ( int i = 1; i < size; i++ )
-        rv = qMax( rv, array[i] );
-
-    return rv;
-}
-
-/*!
-  \brief Normalize an angle to be int the range [0.0, 2 * PI[
-  \param radians Angle in radians
-  \return Normalized angle in radians
-*/
+   \brief Normalize an angle to be int the range [0.0, 2 * PI[
+   \param radians Angle in radians
+   \return Normalized angle in radians
+ */
 double qwtNormalizeRadians( double radians )
 {
-    double a = ::fmod( radians, 2.0 * M_PI );
+    double a = std::fmod( radians, 2.0 * M_PI );
     if ( a < 0.0 )
         a += 2.0 * M_PI;
@@ -61,11 +29,11 @@
 
 /*!
-  \brief Normalize an angle to be int the range [0.0, 360.0[
-  \param radians Angle in degrees
-  \return Normalized angle in degrees
-*/
+   \brief Normalize an angle to be int the range [0.0, 360.0[
+   \param radians Angle in degrees
+   \return Normalized angle in degrees
+ */
 double qwtNormalizeDegrees( double degrees )
 {
-    double a = ::fmod( degrees, 360.0 );
+    double a = std::fmod( degrees, 360.0 );
     if ( a < 0.0 )
         a += 360.0;
@@ -73,2 +41,15 @@
     return a;
 }
+
+/*!
+   \brief Uses QRandomGenerator for Qt >= 5.10 and qRand() otherwise
+   \return A 32-bit random quantity
+ */
+quint32 qwtRand()
+{
+#if QT_VERSION >= 0x050a00
+    return QRandomGenerator::global()->generate();
+#else
+    return static_cast< quint32 >( qrand() ); // [0, RAND_MAX ]
+#endif
+}
Index: /trunk/BNC/qwt/qwt_math.h
===================================================================
--- /trunk/BNC/qwt/qwt_math.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_math.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,52 +13,159 @@
 #include "qwt_global.h"
 
-#if defined(_MSC_VER)
 /*
-  Microsoft says:
-
-  Define _USE_MATH_DEFINES before including math.h to expose these macro
-  definitions for common math constants.  These are placed under an #ifdef
-  since these commonly-defined names are not part of the C/C++ standards.
-*/
-#define _USE_MATH_DEFINES 1
-#endif
-
-#include <qmath.h>
-#include "qwt_global.h"
+   Microsoft says:
+
+   Define _USE_MATH_DEFINES before including math.h to expose these macro
+   definitions for common math constants.  These are placed under an #ifdef
+   since these commonly-defined names are not part of the C/C++ standards.
+ */
+
+#ifndef _USE_MATH_DEFINES
+#define _USE_MATH_DEFINES
+#define undef_USE_MATH_DEFINES
+#endif
+
+#include <cmath>
+
+#ifdef undef_USE_MATH_DEFINES
+#undef _USE_MATH_DEFINES
+#undef undef_USE_MATH_DEFINES
+#endif
+
+#ifndef M_E
+#define M_E ( 2.7182818284590452354 )
+#endif
+
+#ifndef M_LOG2E
+#define M_LOG2E ( 1.4426950408889634074 )
+#endif
+
+#ifndef M_LOG10E
+#define M_LOG10E ( 0.43429448190325182765 )
+#endif
+
+#ifndef M_LN2
+#define M_LN2 ( 0.69314718055994530942 )
+#endif
+
+#ifndef M_LN10
+#define M_LN10 ( 2.30258509299404568402 )
+#endif
+
+#ifndef M_PI
+#define M_PI ( 3.14159265358979323846 )
+#endif
 
 #ifndef M_PI_2
-// For Qt <= 4.8.4 M_PI_2 is not known by MinGW-w64
-// when compiling with -std=c++11
-#define M_PI_2 (1.57079632679489661923)
-#endif
-
-#ifndef LOG_MIN
-//! Minimum value for logarithmic scales
-#define LOG_MIN 1.0e-100
-#endif
-
-#ifndef LOG_MAX
-//! Maximum value for logarithmic scales
-#define LOG_MAX 1.0e100
-#endif
-
-QWT_EXPORT double qwtGetMin( const double *array, int size );
-QWT_EXPORT double qwtGetMax( const double *array, int size );
+#define M_PI_2 ( 1.57079632679489661923 )
+#endif
+
+#ifndef M_PI_4
+#define M_PI_4 ( 0.78539816339744830962 )
+#endif
+
+#ifndef M_1_PI
+#define M_1_PI ( 0.31830988618379067154 )
+#endif
+
+#ifndef M_2_PI
+#define M_2_PI ( 0.63661977236758134308 )
+#endif
+
+#ifndef M_2_SQRTPI
+#define M_2_SQRTPI ( 1.12837916709551257390 )
+#endif
+
+#ifndef M_SQRT2
+#define M_SQRT2 ( 1.41421356237309504880 )
+#endif
+
+#ifndef M_SQRT1_2
+#define M_SQRT1_2 ( 0.70710678118654752440 )
+#endif
+
+#if defined( QT_WARNING_PUSH )
+    /*
+        early Qt versions not having QT_WARNING_PUSH is full of warnings
+        so that we do not care of suppressing those from below
+     */
+    QT_WARNING_PUSH
+    QT_WARNING_DISABLE_CLANG("-Wdouble-promotion")
+    QT_WARNING_DISABLE_GCC("-Wdouble-promotion")
+#endif
+
+/*
+    On systems, where qreal is a float you often run into
+    compiler issues with qMin/qMax.
+ */
+
+//! \return Minimum of a and b.
+QWT_CONSTEXPR inline float qwtMinF( float a, float b )
+{
+    return ( a < b ) ? a : b;
+}
+
+//! \return Minimum of a and b.
+QWT_CONSTEXPR inline double qwtMinF( double a, double b )
+{
+    return ( a < b ) ? a : b;
+}
+
+//! \return Minimum of a and b.
+QWT_CONSTEXPR inline qreal qwtMinF( float a, double b )
+{
+    return ( a < b ) ? a : b;
+}
+
+//! \return Minimum of a and b.
+QWT_CONSTEXPR inline qreal qwtMinF( double a, float b )
+{
+    return ( a < b ) ? a : b;
+}
+
+//! \return Maximum of a and b.
+QWT_CONSTEXPR inline float qwtMaxF( float a, float b )
+{
+    return ( a < b ) ? b : a;
+}
+
+//! \return Maximum of a and b.
+QWT_CONSTEXPR inline double qwtMaxF( double a, double b )
+{
+    return ( a < b ) ? b : a;
+}
+
+//! \return Maximum of a and b.
+QWT_CONSTEXPR inline qreal qwtMaxF( float a, double b )
+{
+    return ( a < b ) ? b : a;
+}
+
+//! \return Maximum of a and b.
+QWT_CONSTEXPR inline qreal qwtMaxF( double a, float b )
+{
+    return ( a < b ) ? b : a;
+}
+
+#if defined( QT_WARNING_POP )
+    QT_WARNING_POP
+#endif
 
 QWT_EXPORT double qwtNormalizeRadians( double radians );
 QWT_EXPORT double qwtNormalizeDegrees( double degrees );
+QWT_EXPORT quint32 qwtRand();
 
 /*!
-  \brief Compare 2 values, relative to an interval
-
-  Values are "equal", when :
-  \f$\cdot value2 - value1 <= abs(intervalSize * 10e^{-6})\f$
-
-  \param value1 First value to compare
-  \param value2 Second value to compare
-  \param intervalSize interval size
-
-  \return 0: if equal, -1: if value2 > value1, 1: if value1 > value2
-*/
+   \brief Compare 2 values, relative to an interval
+
+   Values are "equal", when :
+   \f$\cdot value2 - value1 <= abs(intervalSize * 10e^{-6})\f$
+
+   \param value1 First value to compare
+   \param value2 Second value to compare
+   \param intervalSize interval size
+
+   \return 0: if equal, -1: if value2 > value1, 1: if value1 > value2
+ */
 inline int qwtFuzzyCompare( double value1, double value2, double intervalSize )
 {
@@ -72,15 +179,4 @@
 
     return 0;
-}
-
-
-inline bool qwtFuzzyGreaterOrEqual( double d1, double d2 )
-{
-    return ( d1 >= d2 ) || qFuzzyCompare( d1, d2 );
-}
-
-inline bool qwtFuzzyLessOrEqual( double d1, double d2 )
-{
-    return ( d1 <= d2 ) || qFuzzyCompare( d1, d2 );
 }
 
@@ -135,4 +231,21 @@
 }
 
+/* !
+   \brief Calculate a value of a cubic polynomial
+
+   \param x Value
+   \param a Cubic coefficient
+   \param b Quadratic coefficient
+   \param c Linear coefficient
+   \param d Constant offset
+
+   \return Value of the polyonom for x
+ */
+inline double qwtCubicPolynomial( double x,
+    double a, double b, double c, double d )
+{
+    return ( ( ( a * x ) + b ) * x + c ) * x + d;
+}
+
 //! Translate degrees into radians
 inline double qwtRadians( double degrees )
@@ -147,3 +260,22 @@
 }
 
-#endif
+/*!
+    The same as qCeil, but avoids including qmath.h
+    \return Ceiling of value.
+ */
+inline int qwtCeil( qreal value )
+{
+    using std::ceil;
+    return int( ceil( value ) );
+}
+/*!
+    The same as qFloor, but avoids including qmath.h
+    \return Floor of value.
+ */
+inline int qwtFloor( qreal value )
+{
+    using std::floor;
+    return int( floor( value ) );
+}
+
+#endif
Index: /trunk/BNC/qwt/qwt_matrix_raster_data.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_matrix_raster_data.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_matrix_raster_data.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,13 +9,45 @@
 
 #include "qwt_matrix_raster_data.h"
+#include "qwt_interval.h"
+
+#include <qvector.h>
 #include <qnumeric.h>
-#include <qmath.h>
+#include <qrect.h>
+
+static inline double qwtHermiteInterpolate(
+    double A, double B, double C, double D, double t )
+{
+    const double t2 = t * t;
+    const double t3 = t2 * t;
+
+    const double a = -A / 2.0 + ( 3.0 * B ) / 2.0 - ( 3.0 * C ) / 2.0 + D / 2.0;
+    const double b = A - ( 5.0 * B ) / 2.0 + 2.0 * C - D / 2.0;
+    const double c = -A / 2.0 + C / 2.0;
+    const double d = B;
+
+    return a * t3 + b * t2 + c * t + d;
+}
+
+static inline double qwtBicubicInterpolate(
+    double v00, double v10, double v20, double v30,
+    double v01, double v11, double v21, double v31,
+    double v02, double v12, double v22, double v32,
+    double v03, double v13, double v23, double v33,
+    double dx, double dy )
+{
+    const double v0 = qwtHermiteInterpolate( v00, v10, v20, v30, dx );
+    const double v1 = qwtHermiteInterpolate( v01, v11, v21, v31, dx );
+    const double v2 = qwtHermiteInterpolate( v02, v12, v22, v32, dx );
+    const double v3 = qwtHermiteInterpolate( v03, v13, v23, v33, dx );
+
+    return qwtHermiteInterpolate( v0, v1, v2, v3, dy );
+}
 
 class QwtMatrixRasterData::PrivateData
 {
-public:
-    PrivateData():
-        resampleMode(QwtMatrixRasterData::NearestNeighbour),
-        numColumns(0)
+  public:
+    PrivateData()
+        : resampleMode( QwtMatrixRasterData::NearestNeighbour )
+        , numColumns(0)
     {
     }
@@ -26,7 +58,8 @@
     }
 
+    QwtInterval intervals[3];
     QwtMatrixRasterData::ResampleMode resampleMode;
 
-    QVector<double> values;
+    QVector< double > values;
     int numColumns;
     int numRows;
@@ -39,5 +72,5 @@
 QwtMatrixRasterData::QwtMatrixRasterData()
 {
-    d_data = new PrivateData();
+    m_data = new PrivateData();
     update();
 }
@@ -46,5 +79,5 @@
 QwtMatrixRasterData::~QwtMatrixRasterData()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -54,8 +87,8 @@
    \param mode Resampling mode
    \sa resampleMode(), value()
-*/
+ */
 void QwtMatrixRasterData::setResampleMode( ResampleMode mode )
 {
-    d_data->resampleMode = mode;
+    m_data->resampleMode = mode;
 }
 
@@ -63,8 +96,8 @@
    \return resampling algorithm
    \sa setResampleMode(), value()
-*/
+ */
 QwtMatrixRasterData::ResampleMode QwtMatrixRasterData::resampleMode() const
 {
-    return d_data->resampleMode;
+    return m_data->resampleMode;
 }
 
@@ -84,10 +117,25 @@
 
    \sa QwtRasterData::interval(), setValueMatrix()
-*/
+ */
 void QwtMatrixRasterData::setInterval(
-    Qt::Axis axis, const QwtInterval &interval )
-{
-    QwtRasterData::setInterval( axis, interval );
-    update();
+    Qt::Axis axis, const QwtInterval& interval )
+{
+    if ( axis >= 0 && axis <= 2 )
+    {
+        m_data->intervals[axis] = interval;
+        update();
+    }
+}
+
+/*!
+   \return Bounding interval for an axis
+   \sa setInterval
+ */
+QwtInterval QwtMatrixRasterData::interval( Qt::Axis axis ) const
+{
+    if ( axis >= 0 && axis <= 2 )
+        return m_data->intervals[ axis ];
+
+    return QwtInterval();
 }
 
@@ -104,10 +152,10 @@
 
    \sa valueMatrix(), numColumns(), numRows(), setInterval()()
-*/
+ */
 void QwtMatrixRasterData::setValueMatrix(
-    const QVector<double> &values, int numColumns )
-{
-    d_data->values = values;
-    d_data->numColumns = qMax( numColumns, 0 );
+    const QVector< double >& values, int numColumns )
+{
+    m_data->values = values;
+    m_data->numColumns = qMax( numColumns, 0 );
     update();
 }
@@ -116,26 +164,26 @@
    \return Value matrix
    \sa setValueMatrix(), numColumns(), numRows(), setInterval()
-*/
-const QVector<double> QwtMatrixRasterData::valueMatrix() const
-{
-    return d_data->values;
-}
-
-/*!
-  \brief Change a single value in the matrix
-
-  \param row Row index
-  \param col Column index
-  \param value New value
-
-  \sa value(), setValueMatrix()
-*/
+ */
+const QVector< double > QwtMatrixRasterData::valueMatrix() const
+{
+    return m_data->values;
+}
+
+/*!
+   \brief Change a single value in the matrix
+
+   \param row Row index
+   \param col Column index
+   \param value New value
+
+   \sa value(), setValueMatrix()
+ */
 void QwtMatrixRasterData::setValue( int row, int col, double value )
 {
-    if ( row >= 0 && row < d_data->numRows &&
-        col >= 0 && col < d_data->numColumns )
-    {
-        const int index = row * d_data->numColumns + col;
-        d_data->values.data()[ index ] = value;
+    if ( row >= 0 && row < m_data->numRows &&
+        col >= 0 && col < m_data->numColumns )
+    {
+        const int index = row * m_data->numColumns + col;
+        m_data->values.data()[ index ] = value;
     }
 }
@@ -144,8 +192,8 @@
    \return Number of columns of the value matrix
    \sa valueMatrix(), numRows(), setValueMatrix()
-*/
+ */
 int QwtMatrixRasterData::numColumns() const
 {
-    return d_data->numColumns;
+    return m_data->numColumns;
 }
 
@@ -153,8 +201,8 @@
    \return Number of rows of the value matrix
    \sa valueMatrix(), numColumns(), setValueMatrix()
-*/
+ */
 int QwtMatrixRasterData::numRows() const
 {
-    return d_data->numRows;
+    return m_data->numRows;
 }
 
@@ -178,11 +226,11 @@
 
    \sa ResampleMode, setMatrix(), setInterval()
-*/
-QRectF QwtMatrixRasterData::pixelHint( const QRectF &area ) const
+ */
+QRectF QwtMatrixRasterData::pixelHint( const QRectF& area ) const
 {
     Q_UNUSED( area )
 
     QRectF rect;
-    if ( d_data->resampleMode == NearestNeighbour )
+    if ( m_data->resampleMode == NearestNeighbour )
     {
         const QwtInterval intervalX = interval( Qt::XAxis );
@@ -191,5 +239,5 @@
         {
             rect = QRectF( intervalX.minValue(), intervalY.minValue(),
-                d_data->dx, d_data->dy );
+                m_data->dx, m_data->dy );
         }
     }
@@ -205,5 +253,5 @@
 
    \sa ResampleMode
-*/
+ */
 double QwtMatrixRasterData::value( double x, double y ) const
 {
@@ -216,10 +264,83 @@
     double value;
 
-    switch( d_data->resampleMode )
-    {
+    switch( m_data->resampleMode )
+    {
+        case BicubicInterpolation:
+        {
+            const double colF = ( x - xInterval.minValue() ) / m_data->dx;
+            const double rowF = ( y - yInterval.minValue() ) / m_data->dy;
+
+            const int col = qRound( colF );
+            const int row = qRound( rowF );
+
+            int col0 = col - 2;
+            int col1 = col - 1;
+            int col2 = col;
+            int col3 = col + 1;
+
+            if ( col1 < 0 )
+                col1 = col2;
+
+            if ( col0 < 0 )
+                col0 = col1;
+
+            if ( col2 >= m_data->numColumns )
+                col2 = col1;
+
+            if ( col3 >= m_data->numColumns )
+                col3 = col2;
+
+            int row0 = row - 2;
+            int row1 = row - 1;
+            int row2 = row;
+            int row3 = row + 1;
+
+            if ( row1 < 0 )
+                row1 = row2;
+
+            if ( row0 < 0 )
+                row0 = row1;
+
+            if ( row2 >= m_data->numRows )
+                row2 = row1;
+
+            if ( row3 >= m_data->numRows )
+                row3 = row2;
+
+            // First row
+            const double v00 = m_data->value( row0, col0 );
+            const double v10 = m_data->value( row0, col1 );
+            const double v20 = m_data->value( row0, col2 );
+            const double v30 = m_data->value( row0, col3 );
+
+            // Second row
+            const double v01 = m_data->value( row1, col0 );
+            const double v11 = m_data->value( row1, col1 );
+            const double v21 = m_data->value( row1, col2 );
+            const double v31 = m_data->value( row1, col3 );
+
+            // Third row
+            const double v02 = m_data->value( row2, col0 );
+            const double v12 = m_data->value( row2, col1 );
+            const double v22 = m_data->value( row2, col2 );
+            const double v32 = m_data->value( row2, col3 );
+
+            // Fourth row
+            const double v03 = m_data->value( row3, col0 );
+            const double v13 = m_data->value( row3, col1 );
+            const double v23 = m_data->value( row3, col2 );
+            const double v33 = m_data->value( row3, col3 );
+
+            value = qwtBicubicInterpolate(
+                v00, v10, v20, v30, v01, v11, v21, v31,
+                v02, v12, v22, v32, v03, v13, v23, v33,
+                colF - col + 0.5, rowF - row + 0.5 );
+
+            break;
+        }
         case BilinearInterpolation:
         {
-            int col1 = qRound( (x - xInterval.minValue() ) / d_data->dx ) - 1;
-            int row1 = qRound( (y - yInterval.minValue() ) / d_data->dy ) - 1;
+            int col1 = qRound( ( x - xInterval.minValue() ) / m_data->dx ) - 1;
+            int row1 = qRound( ( y - yInterval.minValue() ) / m_data->dy ) - 1;
             int col2 = col1 + 1;
             int row2 = row1 + 1;
@@ -227,24 +348,22 @@
             if ( col1 < 0 )
                 col1 = col2;
-            else if ( col2 >= static_cast<int>( d_data->numColumns ) )
+            else if ( col2 >= m_data->numColumns )
                 col2 = col1;
 
             if ( row1 < 0 )
                 row1 = row2;
-            else if ( row2 >= static_cast<int>( d_data->numRows ) )
+            else if ( row2 >= m_data->numRows )
                 row2 = row1;
 
-            const double v11 = d_data->value( row1, col1 );
-            const double v21 = d_data->value( row1, col2 );
-            const double v12 = d_data->value( row2, col1 );
-            const double v22 = d_data->value( row2, col2 );
-
-            const double x2 = xInterval.minValue() +
-                ( col2 + 0.5 ) * d_data->dx;
-            const double y2 = yInterval.minValue() +
-                ( row2 + 0.5 ) * d_data->dy;
-
-            const double rx = ( x2 - x ) / d_data->dx;
-            const double ry = ( y2 - y ) / d_data->dy;
+            const double v11 = m_data->value( row1, col1 );
+            const double v21 = m_data->value( row1, col2 );
+            const double v12 = m_data->value( row2, col1 );
+            const double v22 = m_data->value( row2, col2 );
+
+            const double x2 = xInterval.minValue() + ( col2 + 0.5 ) * m_data->dx;
+            const double y2 = yInterval.minValue() + ( row2 + 0.5 ) * m_data->dy;
+
+            const double rx = ( x2 - x ) / m_data->dx;
+            const double ry = ( y2 - y ) / m_data->dy;
 
             const double vr1 = rx * v11 + ( 1.0 - rx ) * v21;
@@ -258,6 +377,6 @@
         default:
         {
-            int row = int( (y - yInterval.minValue() ) / d_data->dy );
-            int col = int( (x - xInterval.minValue() ) / d_data->dx );
+            int row = int( ( y - yInterval.minValue() ) / m_data->dy );
+            int col = int( ( x - xInterval.minValue() ) / m_data->dx );
 
             // In case of intervals, where the maximum is included
@@ -266,11 +385,11 @@
             // from the last row/col
 
-            if ( row >= d_data->numRows )
-                row = d_data->numRows - 1;
-
-            if ( col >= d_data->numColumns )
-                col = d_data->numColumns - 1;
-
-            value = d_data->value( row, col );
+            if ( row >= m_data->numRows )
+                row = m_data->numRows - 1;
+
+            if ( col >= m_data->numColumns )
+                col = m_data->numColumns - 1;
+
+            value = m_data->value( row, col );
         }
     }
@@ -281,18 +400,18 @@
 void QwtMatrixRasterData::update()
 {
-    d_data->numRows = 0;
-    d_data->dx = 0.0;
-    d_data->dy = 0.0;
-
-    if ( d_data->numColumns > 0 )
-    {
-        d_data->numRows = d_data->values.size() / d_data->numColumns;
+    m_data->numRows = 0;
+    m_data->dx = 0.0;
+    m_data->dy = 0.0;
+
+    if ( m_data->numColumns > 0 )
+    {
+        m_data->numRows = m_data->values.size() / m_data->numColumns;
 
         const QwtInterval xInterval = interval( Qt::XAxis );
         const QwtInterval yInterval = interval( Qt::YAxis );
         if ( xInterval.isValid() )
-            d_data->dx = xInterval.width() / d_data->numColumns;
+            m_data->dx = xInterval.width() / m_data->numColumns;
         if ( yInterval.isValid() )
-            d_data->dy = yInterval.width() / d_data->numRows;
-    }
-}
+            m_data->dy = yInterval.width() / m_data->numRows;
+    }
+}
Index: /trunk/BNC/qwt/qwt_matrix_raster_data.h
===================================================================
--- /trunk/BNC/qwt/qwt_matrix_raster_data.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_matrix_raster_data.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,38 +9,47 @@
 
 #ifndef QWT_MATRIX_RASTER_DATA_H
-#define QWT_MATRIX_RASTER_DATA_H 1
+#define QWT_MATRIX_RASTER_DATA_H
 
 #include "qwt_global.h"
 #include "qwt_raster_data.h"
-#include <qvector.h>
+
+#if QT_VERSION < 0x060000
+template< typename T > class QVector;
+#endif
 
 /*!
-  \brief A class representing a matrix of values as raster data
+   \brief A class representing a matrix of values as raster data
 
-  QwtMatrixRasterData implements an interface for a matrix of
-  equidistant values, that can be used by a QwtPlotRasterItem.
-  It implements a couple of resampling algorithms, to provide
-  values for positions, that or not on the value matrix.
-*/
-class QWT_EXPORT QwtMatrixRasterData: public QwtRasterData
+   QwtMatrixRasterData implements an interface for a matrix of
+   equidistant values, that can be used by a QwtPlotRasterItem.
+   It implements a couple of resampling algorithms, to provide
+   values for positions, that or not on the value matrix.
+ */
+class QWT_EXPORT QwtMatrixRasterData : public QwtRasterData
 {
-public:
+  public:
     /*!
-      \brief Resampling algorithm
-      The default setting is NearestNeighbour;
-    */
+       \brief Resampling algorithm
+       The default setting is NearestNeighbour;
+     */
     enum ResampleMode
     {
         /*!
-          Return the value from the matrix, that is nearest to the
-          the requested position.
+           Return the value from the matrix, that is nearest to the
+           the requested position.
          */
         NearestNeighbour,
 
         /*!
-          Interpolate the value from the distances and values of the
-          4 surrounding values in the matrix,
+           Interpolate the value from the distances and values of the
+           4 surrounding values in the matrix,
          */
-        BilinearInterpolation
+        BilinearInterpolation,
+
+        /*!
+           Interpolate the value from the 16 surrounding values in the
+           matrix using hermite bicubic interpolation
+         */
+        BicubicInterpolation
     };
 
@@ -51,8 +60,9 @@
     ResampleMode resampleMode() const;
 
-    virtual void setInterval( Qt::Axis, const QwtInterval & );
+    void setInterval( Qt::Axis, const QwtInterval& );
+    virtual QwtInterval interval( Qt::Axis axis) const QWT_OVERRIDE QWT_FINAL;
 
-    void setValueMatrix( const QVector<double> &values, int numColumns );
-    const QVector<double> valueMatrix() const;
+    void setValueMatrix( const QVector< double >& values, int numColumns );
+    const QVector< double > valueMatrix() const;
 
     void setValue( int row, int col, double value );
@@ -61,13 +71,13 @@
     int numRows() const;
 
-    virtual QRectF pixelHint( const QRectF & ) const;
+    virtual QRectF pixelHint( const QRectF& ) const QWT_OVERRIDE;
 
-    virtual double value( double x, double y ) const;
+    virtual double value( double x, double y ) const QWT_OVERRIDE;
 
-private:
+  private:
     void update();
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_null_paintdevice.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_null_paintdevice.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_null_paintdevice.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,9 +11,8 @@
 #include <qpaintengine.h>
 #include <qpainterpath.h>
-#include <qpixmap.h>
 
 class QwtNullPaintDevice::PrivateData
 {
-public:
+  public:
     PrivateData():
         mode( QwtNullPaintDevice::NormalMode )
@@ -24,53 +23,57 @@
 };
 
-class QwtNullPaintDevice::PaintEngine: public QPaintEngine
-{
-public:
+class QwtNullPaintDevice::PaintEngine QWT_FINAL : public QPaintEngine
+{
+  public:
     PaintEngine();
 
-    virtual bool begin( QPaintDevice * );
-    virtual bool end();
-
-    virtual Type type () const;
-    virtual void updateState(const QPaintEngineState &);
-
-    virtual void drawRects(const QRect *, int );
-    virtual void drawRects(const QRectF *, int );
-
-    virtual void drawLines(const QLine *, int );
-    virtual void drawLines(const QLineF *, int );
-
-    virtual void drawEllipse(const QRectF &);
-    virtual void drawEllipse(const QRect &);
-
-    virtual void drawPath(const QPainterPath &);
-
-    virtual void drawPoints(const QPointF *, int );
-    virtual void drawPoints(const QPoint *, int );
-
-    virtual void drawPolygon(const QPointF *, int , PolygonDrawMode );
-    virtual void drawPolygon(const QPoint *, int , PolygonDrawMode );
-
-    virtual void drawPixmap(const QRectF &,
-        const QPixmap &, const QRectF &);
-
-    virtual void drawTextItem(const QPointF &, const QTextItem &);
-
-    virtual void drawTiledPixmap(const QRectF &,
-        const QPixmap &, const QPointF &s);
-
-    virtual void drawImage(const QRectF &,
-        const QImage &, const QRectF &, Qt::ImageConversionFlags );
-
-private:
-    QwtNullPaintDevice *nullDevice();
+    virtual bool begin( QPaintDevice* ) QWT_OVERRIDE;
+    virtual bool end() QWT_OVERRIDE;
+
+    virtual Type type () const QWT_OVERRIDE;
+    virtual void updateState(const QPaintEngineState&) QWT_OVERRIDE;
+
+    virtual void drawRects(const QRect*, int ) QWT_OVERRIDE;
+    virtual void drawRects(const QRectF*, int ) QWT_OVERRIDE;
+
+    virtual void drawLines(const QLine*, int ) QWT_OVERRIDE;
+    virtual void drawLines(const QLineF*, int ) QWT_OVERRIDE;
+
+    virtual void drawEllipse(const QRectF&) QWT_OVERRIDE;
+    virtual void drawEllipse(const QRect&) QWT_OVERRIDE;
+
+    virtual void drawPath(const QPainterPath&) QWT_OVERRIDE;
+
+    virtual void drawPoints(const QPointF*, int ) QWT_OVERRIDE;
+    virtual void drawPoints(const QPoint*, int ) QWT_OVERRIDE;
+
+    virtual void drawPolygon(
+        const QPointF*, int, PolygonDrawMode ) QWT_OVERRIDE;
+
+    virtual void drawPolygon(
+        const QPoint*, int, PolygonDrawMode ) QWT_OVERRIDE;
+
+    virtual void drawPixmap(const QRectF&,
+        const QPixmap&, const QRectF&) QWT_OVERRIDE;
+
+    virtual void drawTextItem(
+        const QPointF&, const QTextItem&) QWT_OVERRIDE;
+
+    virtual void drawTiledPixmap(const QRectF&,
+        const QPixmap&, const QPointF& s) QWT_OVERRIDE;
+
+    virtual void drawImage(const QRectF&, const QImage&,
+        const QRectF&, Qt::ImageConversionFlags ) QWT_OVERRIDE;
+
+  private:
+    QwtNullPaintDevice* nullDevice();
 };
 
-QwtNullPaintDevice::PaintEngine::PaintEngine():
-    QPaintEngine( QPaintEngine::AllFeatures )
-{
-}
-
-bool QwtNullPaintDevice::PaintEngine::begin( QPaintDevice * )
+QwtNullPaintDevice::PaintEngine::PaintEngine()
+    : QPaintEngine( QPaintEngine::AllFeatures )
+{
+}
+
+bool QwtNullPaintDevice::PaintEngine::begin( QPaintDevice* )
 {
     setActive( true );
@@ -86,11 +89,16 @@
 QPaintEngine::Type QwtNullPaintDevice::PaintEngine::type() const
 {
-    return QPaintEngine::User;
+    /*
+        How to avoid conflicts with other 3rd party pain engines ?
+        At least we don't use QPaintEngine::User what is known to
+        be the value of some print engines
+     */
+    return static_cast< QPaintEngine::Type >( QPaintEngine::MaxUser - 2 );
 }
 
 void QwtNullPaintDevice::PaintEngine::drawRects(
-    const QRect *rects, int rectCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRect* rects, int rectCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -106,7 +114,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawRects(
-    const QRectF *rects, int rectCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRectF* rects, int rectCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -122,7 +130,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawLines(
-    const QLine *lines, int lineCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QLine* lines, int lineCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -138,7 +146,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawLines(
-    const QLineF *lines, int lineCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QLineF* lines, int lineCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -154,7 +162,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawEllipse(
-    const QRectF &rect)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRectF& rect)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -170,7 +178,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawEllipse(
-    const QRect &rect)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRect& rect)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -187,7 +195,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPath(
-    const QPainterPath &path)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPainterPath& path)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -197,7 +205,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPoints(
-    const QPointF *points, int pointCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPointF* points, int pointCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -213,7 +221,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPoints(
-    const QPoint *points, int pointCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPoint* points, int pointCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -229,7 +237,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPolygon(
-    const QPointF *points, int pointCount, PolygonDrawMode mode)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPointF* points, int pointCount, PolygonDrawMode mode)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -257,7 +265,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPolygon(
-    const QPoint *points, int pointCount, PolygonDrawMode mode)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPoint* points, int pointCount, PolygonDrawMode mode)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -285,7 +293,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPixmap(
-    const QRectF &rect, const QPixmap &pm, const QRectF &subRect )
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRectF& rect, const QPixmap& pm, const QRectF& subRect )
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -295,7 +303,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawTextItem(
-    const QPointF &pos, const QTextItem &textItem)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPointF& pos, const QTextItem& textItem)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -311,8 +319,8 @@
 
 void QwtNullPaintDevice::PaintEngine::drawTiledPixmap(
-    const QRectF &rect, const QPixmap &pixmap,
-    const QPointF &subRect)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRectF& rect, const QPixmap& pixmap,
+    const QPointF& subRect)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -328,8 +336,8 @@
 
 void QwtNullPaintDevice::PaintEngine::drawImage(
-    const QRectF &rect, const QImage &image,
-    const QRectF &subRect, Qt::ImageConversionFlags flags)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRectF& rect, const QImage& image,
+    const QRectF& subRect, Qt::ImageConversionFlags flags)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -339,7 +347,7 @@
 
 void QwtNullPaintDevice::PaintEngine::updateState(
-    const QPaintEngineState &engineState)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPaintEngineState& engineState)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -348,17 +356,17 @@
 }
 
-inline QwtNullPaintDevice *QwtNullPaintDevice::PaintEngine::nullDevice()
+inline QwtNullPaintDevice* QwtNullPaintDevice::PaintEngine::nullDevice()
 {
     if ( !isActive() )
         return NULL;
 
-    return static_cast<QwtNullPaintDevice *>( paintDevice() );
+    return static_cast< QwtNullPaintDevice* >( paintDevice() );
 }
 
 //! Constructor
 QwtNullPaintDevice::QwtNullPaintDevice():
-    d_engine( NULL )
-{
-    d_data = new PrivateData;
+    m_engine( NULL )
+{
+    m_data = new PrivateData;
 }
 
@@ -366,6 +374,6 @@
 QwtNullPaintDevice::~QwtNullPaintDevice()
 {
-    delete d_engine;
-    delete d_data;
+    delete m_engine;
+    delete m_data;
 }
 
@@ -378,5 +386,5 @@
 void QwtNullPaintDevice::setMode( Mode mode )
 {
-    d_data->mode = mode;
+    m_data->mode = mode;
 }
 
@@ -384,22 +392,22 @@
     \return Render mode
     \sa setMode()
-*/
+ */
 QwtNullPaintDevice::Mode QwtNullPaintDevice::mode() const
 {
-    return d_data->mode;
+    return m_data->mode;
 }
 
 //! See QPaintDevice::paintEngine()
-QPaintEngine *QwtNullPaintDevice::paintEngine() const
-{
-    if ( d_engine == NULL )
-    {
-        QwtNullPaintDevice *that =
-            const_cast< QwtNullPaintDevice * >( this );
-
-        that->d_engine = new PaintEngine();
-    }
-
-    return d_engine;
+QPaintEngine* QwtNullPaintDevice::paintEngine() const
+{
+    if ( m_engine == NULL )
+    {
+        QwtNullPaintDevice* that =
+            const_cast< QwtNullPaintDevice* >( this );
+
+        that->m_engine = new PaintEngine();
+    }
+
+    return m_engine;
 }
 
@@ -411,5 +419,5 @@
 
     \sa sizeMetrics()
-*/
+ */
 int QwtNullPaintDevice::metric( PaintDeviceMetric deviceMetric ) const
 {
@@ -456,14 +464,23 @@
             break;
         }
+#if QT_VERSION >= 0x050100
+        case PdmDevicePixelRatio:
+        {
+            value = 1.0;
+            break;
+        }
+#endif
         default:
-            value = 0;
-    }
+        {
+            value = QPaintDevice::metric( deviceMetric );
+        }
+    }
+
     return value;
-
 }
 
 //! See QPaintEngine::drawRects()
 void QwtNullPaintDevice::drawRects(
-    const QRect *rects, int rectCount)
+    const QRect* rects, int rectCount)
 {
     Q_UNUSED(rects);
@@ -473,5 +490,5 @@
 //! See QPaintEngine::drawRects()
 void QwtNullPaintDevice::drawRects(
-    const QRectF *rects, int rectCount)
+    const QRectF* rects, int rectCount)
 {
     Q_UNUSED(rects);
@@ -481,5 +498,5 @@
 //! See QPaintEngine::drawLines()
 void QwtNullPaintDevice::drawLines(
-    const QLine *lines, int lineCount)
+    const QLine* lines, int lineCount)
 {
     Q_UNUSED(lines);
@@ -489,5 +506,5 @@
 //! See QPaintEngine::drawLines()
 void QwtNullPaintDevice::drawLines(
-    const QLineF *lines, int lineCount)
+    const QLineF* lines, int lineCount)
 {
     Q_UNUSED(lines);
@@ -496,5 +513,5 @@
 
 //! See QPaintEngine::drawEllipse()
-void QwtNullPaintDevice::drawEllipse( const QRectF &rect )
+void QwtNullPaintDevice::drawEllipse( const QRectF& rect )
 {
     Q_UNUSED(rect);
@@ -502,5 +519,5 @@
 
 //! See QPaintEngine::drawEllipse()
-void QwtNullPaintDevice::drawEllipse( const QRect &rect )
+void QwtNullPaintDevice::drawEllipse( const QRect& rect )
 {
     Q_UNUSED(rect);
@@ -508,5 +525,5 @@
 
 //! See QPaintEngine::drawPath()
-void QwtNullPaintDevice::drawPath( const QPainterPath &path )
+void QwtNullPaintDevice::drawPath( const QPainterPath& path )
 {
     Q_UNUSED(path);
@@ -515,5 +532,5 @@
 //! See QPaintEngine::drawPoints()
 void QwtNullPaintDevice::drawPoints(
-    const QPointF *points, int pointCount)
+    const QPointF* points, int pointCount)
 {
     Q_UNUSED(points);
@@ -523,5 +540,5 @@
 //! See QPaintEngine::drawPoints()
 void QwtNullPaintDevice::drawPoints(
-    const QPoint *points, int pointCount)
+    const QPoint* points, int pointCount)
 {
     Q_UNUSED(points);
@@ -531,5 +548,5 @@
 //! See QPaintEngine::drawPolygon()
 void QwtNullPaintDevice::drawPolygon(
-    const QPointF *points, int pointCount,
+    const QPointF* points, int pointCount,
     QPaintEngine::PolygonDrawMode mode)
 {
@@ -541,5 +558,5 @@
 //! See QPaintEngine::drawPolygon()
 void QwtNullPaintDevice::drawPolygon(
-    const QPoint *points, int pointCount,
+    const QPoint* points, int pointCount,
     QPaintEngine::PolygonDrawMode mode)
 {
@@ -550,6 +567,6 @@
 
 //! See QPaintEngine::drawPixmap()
-void QwtNullPaintDevice::drawPixmap( const QRectF &rect,
-    const QPixmap &pm, const QRectF &subRect )
+void QwtNullPaintDevice::drawPixmap( const QRectF& rect,
+    const QPixmap& pm, const QRectF& subRect )
 {
     Q_UNUSED(rect);
@@ -560,5 +577,5 @@
 //! See QPaintEngine::drawTextItem()
 void QwtNullPaintDevice::drawTextItem(
-    const QPointF &pos, const QTextItem &textItem)
+    const QPointF& pos, const QTextItem& textItem)
 {
     Q_UNUSED(pos);
@@ -568,6 +585,6 @@
 //! See QPaintEngine::drawTiledPixmap()
 void QwtNullPaintDevice::drawTiledPixmap(
-    const QRectF &rect, const QPixmap &pixmap,
-    const QPointF &subRect)
+    const QRectF& rect, const QPixmap& pixmap,
+    const QPointF& subRect)
 {
     Q_UNUSED(rect);
@@ -578,6 +595,6 @@
 //! See QPaintEngine::drawImage()
 void QwtNullPaintDevice::drawImage(
-    const QRectF &rect, const QImage &image,
-    const QRectF &subRect, Qt::ImageConversionFlags flags)
+    const QRectF& rect, const QImage& image,
+    const QRectF& subRect, Qt::ImageConversionFlags flags)
 {
     Q_UNUSED(rect);
@@ -589,5 +606,5 @@
 //! See QPaintEngine::updateState()
 void QwtNullPaintDevice::updateState(
-    const QPaintEngineState &state )
+    const QPaintEngineState& state )
 {
     Q_UNUSED(state);
Index: /trunk/BNC/qwt/qwt_null_paintdevice.h
===================================================================
--- /trunk/BNC/qwt/qwt_null_paintdevice.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_null_paintdevice.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,31 +9,32 @@
 
 #ifndef QWT_NULL_PAINT_DEVICE_H
-#define QWT_NULL_PAINT_DEVICE_H 1
+#define QWT_NULL_PAINT_DEVICE_H
 
 #include "qwt_global.h"
+
 #include <qpaintdevice.h>
 #include <qpaintengine.h>
 
 /*!
-  \brief A null paint device doing nothing
+   \brief A null paint device doing nothing
 
-  Sometimes important layout/rendering geometries are not
-  available or changeable from the public Qt class interface.
-  ( f.e hidden in the style implementation ).
+   Sometimes important layout/rendering geometries are not
+   available or changeable from the public Qt class interface.
+   ( f.e hidden in the style implementation ).
 
-  QwtNullPaintDevice can be used to manipulate or filter out
-  this information by analyzing the stream of paint primitives.
+   QwtNullPaintDevice can be used to manipulate or filter out
+   this information by analyzing the stream of paint primitives.
 
-  F.e. QwtNullPaintDevice is used by QwtPlotCanvas to identify
-  styled backgrounds with rounded corners.
-*/
+   F.e. QwtNullPaintDevice is used by QwtPlotCanvas to identify
+   styled backgrounds with rounded corners.
+ */
 
-class QWT_EXPORT QwtNullPaintDevice: public QPaintDevice
+class QWT_EXPORT QwtNullPaintDevice : public QPaintDevice
 {
-public:
+  public:
     /*!
-      \brief Render mode
+       \brief Render mode
 
-      \sa setMode(), mode()
+       \sa setMode(), mode()
      */
     enum Mode
@@ -75,51 +76,51 @@
     Mode mode() const;
 
-    virtual QPaintEngine *paintEngine() const;
+    virtual QPaintEngine* paintEngine() const QWT_OVERRIDE;
 
-    virtual int metric( PaintDeviceMetric ) const;
+    virtual int metric( PaintDeviceMetric ) const QWT_OVERRIDE;
 
-    virtual void drawRects(const QRect *, int );
-    virtual void drawRects(const QRectF *, int );
+    virtual void drawRects(const QRect*, int );
+    virtual void drawRects(const QRectF*, int );
 
-    virtual void drawLines(const QLine *, int );
-    virtual void drawLines(const QLineF *, int );
+    virtual void drawLines(const QLine*, int );
+    virtual void drawLines(const QLineF*, int );
 
-    virtual void drawEllipse(const QRectF &);
-    virtual void drawEllipse(const QRect &);
+    virtual void drawEllipse(const QRectF&);
+    virtual void drawEllipse(const QRect&);
 
-    virtual void drawPath(const QPainterPath &);
+    virtual void drawPath(const QPainterPath&);
 
-    virtual void drawPoints(const QPointF *, int );
-    virtual void drawPoints(const QPoint *, int );
+    virtual void drawPoints(const QPointF*, int );
+    virtual void drawPoints(const QPoint*, int );
 
-    virtual void drawPolygon(
-        const QPointF *, int , QPaintEngine::PolygonDrawMode );
+    virtual void drawPolygon( const QPointF*, int,
+        QPaintEngine::PolygonDrawMode );
 
-    virtual void drawPolygon(
-        const QPoint *, int , QPaintEngine::PolygonDrawMode );
+    virtual void drawPolygon( const QPoint*, int,
+        QPaintEngine::PolygonDrawMode );
 
-    virtual void drawPixmap(const QRectF &,
-        const QPixmap &, const QRectF &);
+    virtual void drawPixmap(const QRectF&,
+        const QPixmap&, const QRectF&);
 
-    virtual void drawTextItem(const QPointF &, const QTextItem &);
+    virtual void drawTextItem(const QPointF&, const QTextItem&);
 
-    virtual void drawTiledPixmap(const QRectF &,
-        const QPixmap &, const QPointF & );
+    virtual void drawTiledPixmap(const QRectF&,
+        const QPixmap&, const QPointF& );
 
-    virtual void drawImage(const QRectF &,
-        const QImage &, const QRectF &, Qt::ImageConversionFlags );
+    virtual void drawImage(const QRectF&, const QImage&,
+        const QRectF&, Qt::ImageConversionFlags );
 
-    virtual void updateState( const QPaintEngineState & );
+    virtual void updateState( const QPaintEngineState& );
 
-protected:
+  protected:
     //! \return Size needed to implement metric()
     virtual QSize sizeMetrics() const = 0;
 
-private:
+  private:
     class PaintEngine;
-    PaintEngine *d_engine;
+    PaintEngine* m_engine;
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_painter.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_painter.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_painter.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,5 +13,5 @@
 #include "qwt_color_map.h"
 #include "qwt_scale_map.h"
-#include <qwindowdefs.h>
+
 #include <qwidget.h>
 #include <qframe.h>
@@ -28,8 +28,9 @@
 #include <qpaintengine.h>
 #include <qapplication.h>
+
+#if QT_VERSION >= 0x060000
+#include <qscreen.h>
+#else
 #include <qdesktopwidget.h>
-
-#if QT_VERSION >= 0x050000
-#include <qwindow.h>
 #endif
 
@@ -42,12 +43,53 @@
 #endif
 
-bool QwtPainter::d_polylineSplitting = true;
-bool QwtPainter::d_roundingAlignment = true;
+#include <cstring>
+
+bool QwtPainter::m_polylineSplitting = true;
+bool QwtPainter::m_roundingAlignment = true;
+
+static inline bool qwtIsRasterPaintEngineBuggy()
+{
+#if 0
+    static int isBuggy = -1;
+    if ( isBuggy < 0 )
+    {
+        // auto detect bug of the raster paint engine,
+        // fixed with: https://codereview.qt-project.org/#/c/99456/
+
+        QImage image( 2, 3, QImage::Format_ARGB32 );
+        image.fill( 0u );
+
+        QPolygonF p;
+        p += QPointF(0, 1);
+        p += QPointF(0, 0);
+        p += QPointF(1, 0 );
+        p += QPointF(1, 2 );
+
+        QPainter painter( &image );
+        painter.drawPolyline( p );
+        painter.end();
+
+        isBuggy = ( image.pixel( 1, 1 ) == 0 ) ? 1 : 0;
+    }
+
+    return isBuggy == 1;
+#endif
+
+#if QT_VERSION < 0x050000
+    return true;
+#elif QT_VERSION < 0x050100
+    return false;
+#elif QT_VERSION < 0x050400
+    return true;
+#else
+    return false;
+#endif
+}
 
 static inline bool qwtIsClippingNeeded(
-    const QPainter *painter, QRectF &clipRect )
+    const QPainter* painter, QRectF& clipRect )
 {
     bool doClipping = false;
-    const QPaintEngine *pe = painter->paintEngine();
+    const QPaintEngine* pe = painter->paintEngine();
     if ( pe && pe->type() == QPaintEngine::SVG )
     {
@@ -64,19 +106,18 @@
 }
 
-template <class T>
-static inline void qwtDrawPolyline( QPainter *painter,
-    const T *points, int pointCount, bool polylineSplitting )
+template< class T >
+static inline void qwtDrawPolyline( QPainter* painter,
+    const T* points, int pointCount, bool polylineSplitting )
 {
     bool doSplit = false;
     if ( polylineSplitting )
     {
-        const QPaintEngine *pe = painter->paintEngine();
+        const QPaintEngine* pe = painter->paintEngine();
         if ( pe && pe->type() == QPaintEngine::Raster )
         {
             /*
-                The raster paint engine seems to use some algo with O(n*n).
-                ( Qt 4.3 is better than Qt 4.2, but remains unacceptable)
-                To work around this problem, we have to split the polygon into
-                smaller pieces.
+               Raster paint engine is much faster when splitting
+               the polygon, but of course we might see some issues where
+               the pieces are joining
              */
             doSplit = true;
@@ -86,10 +127,37 @@
     if ( doSplit )
     {
+        QPen pen = painter->pen();
+
         const int splitSize = 6;
 
-        for ( int i = 0; i < pointCount; i += splitSize )
-        {
-            const int n = qMin( splitSize + 1, pointCount - i );
-            painter->drawPolyline( points + i, n );
+        if ( pen.width() <= 1 && pen.isSolid() && qwtIsRasterPaintEngineBuggy()
+            && !( painter->renderHints() & QPainter::Antialiasing ) )
+        {
+            int k = 0;
+
+            for ( int i = k + 1; i < pointCount; i++ )
+            {
+                const QPointF& p1 = points[i - 1];
+                const QPointF& p2 = points[i];
+
+                const bool isBad = ( qAbs( p2.y() - p1.y() ) <= 1 )
+                    && qAbs( p2.x() - p1.x() ) <= 1;
+
+                if ( isBad || ( i - k >= splitSize ) )
+                {
+                    painter->drawPolyline( points + k, i - k + 1 );
+                    k = i;
+                }
+            }
+
+            painter->drawPolyline( points + k, pointCount - k );
+        }
+        else
+        {
+            for ( int i = 0; i < pointCount; i += splitSize )
+            {
+                const int n = qMin( splitSize + 1, pointCount - i );
+                painter->drawPolyline( points + i, n );
+            }
         }
     }
@@ -105,5 +173,16 @@
     if ( !screenResolution.isValid() )
     {
-        QDesktopWidget *desktop = QApplication::desktop();
+        /*
+            We might have screens with different resolutions. TODO ...
+         */
+#if QT_VERSION >= 0x060000
+        QScreen* screen = QGuiApplication::primaryScreen();
+        if ( screen )
+        {
+            screenResolution.setWidth( screen->logicalDotsPerInchX() );
+            screenResolution.setHeight( screen->logicalDotsPerInchY() );
+        }
+#else
+        QDesktopWidget* desktop = QApplication::desktop();
         if ( desktop )
         {
@@ -111,4 +190,5 @@
             screenResolution.setHeight( desktop->logicalDpiY() );
         }
+#endif
     }
 
@@ -116,5 +196,5 @@
 }
 
-static inline void qwtUnscaleFont( QPainter *painter )
+static inline void qwtUnscaleFont( QPainter* painter )
 {
     if ( painter->font().pixelSize() >= 0 )
@@ -123,9 +203,9 @@
     const QSize screenResolution = qwtScreenResolution();
 
-    const QPaintDevice *pd = painter->device();
+    const QPaintDevice* pd = painter->device();
     if ( pd->logicalDpiX() != screenResolution.width() ||
         pd->logicalDpiY() != screenResolution.height() )
     {
-        QFont pixelFont( painter->font(), QApplication::desktop() );
+        QFont pixelFont = QwtPainter::scaledFont( painter->font() );
         pixelFont.setPixelSize( QFontInfo( pixelFont ).pixelSize() );
 
@@ -135,10 +215,10 @@
 
 /*!
-  Check is the application is running with the X11 graphics system
-  that has some special capabilities that can be used for incremental
-  painting to a widget.
-
-  \return True, when the graphics system is X11
-*/
+   Check is the application is running with the X11 graphics system
+   that has some special capabilities that can be used for incremental
+   painting to a widget.
+
+   \return True, when the graphics system is X11
+ */
 bool QwtPainter::isX11GraphicsSystem()
 {
@@ -162,31 +242,44 @@
 
 /*!
-  Check if the painter is using a paint engine, that aligns
-  coordinates to integers. Today these are all paint engines
-  beside QPaintEngine::Pdf and QPaintEngine::SVG.
-
-  If we have an integer based paint engine it is also
-  checked if the painter has a transformation matrix,
-  that rotates or scales.
-
-  \param  painter Painter
-  \return true, when the painter is aligning
-
-  \sa setRoundingAlignment()
-*/
-bool QwtPainter::isAligning( QPainter *painter )
+   Check if the painter is using a paint engine, that aligns
+   coordinates to integers. Today these are all paint engines
+   beside QPaintEngine::Pdf and QPaintEngine::SVG.
+
+   If we have an integer based paint engine it is also
+   checked if the painter has a transformation matrix,
+   that rotates or scales.
+
+   \param  painter Painter
+   \return true, when the painter is aligning
+
+   \sa setRoundingAlignment()
+ */
+bool QwtPainter::isAligning( const QPainter* painter )
 {
     if ( painter && painter->isActive() )
     {
-        switch ( painter->paintEngine()->type() )
+        const QPaintEngine::Type type =
+            painter->paintEngine()->type();
+
+        if ( type >= QPaintEngine::User )
+        {
+            // we have no idea - better don't align
+            return false;
+        }
+
+        switch ( type )
         {
             case QPaintEngine::Pdf:
             case QPaintEngine::SVG:
+#if 0
+            case QPaintEngine::MacPrinter:
+#endif
                 return false;
 
-            default:;
-        }
-
-        const QTransform &tr = painter->transform();
+            default:
+                break;
+        }
+
+        const QTransform& tr = painter->transform();
         if ( tr.isRotating() || tr.isScaling() )
         {
@@ -200,41 +293,41 @@
 
 /*!
-  Enable whether coordinates should be rounded, before they are painted
-  to a paint engine that floors to integer values. For other paint engines
-  ( PDF, SVG ) this flag has no effect.
-  QwtPainter stores this flag only, the rounding itself is done in
-  the painting code ( f.e the plot items ).
-
-  The default setting is true.
-
-  \sa roundingAlignment(), isAligning()
-*/
+   Enable whether coordinates should be rounded, before they are painted
+   to a paint engine that floors to integer values. For other paint engines
+   ( PDF, SVG ) this flag has no effect.
+   QwtPainter stores this flag only, the rounding itself is done in
+   the painting code ( f.e the plot items ).
+
+   The default setting is true.
+
+   \sa roundingAlignment(), isAligning()
+ */
 void QwtPainter::setRoundingAlignment( bool enable )
 {
-    d_roundingAlignment = enable;
-}
-
-/*!
-  \brief En/Disable line splitting for the raster paint engine
-
-  In some Qt versions the raster paint engine paints polylines of many points
-  much faster when they are split in smaller chunks: f.e all supported Qt versions
-  >= Qt 5.0 when drawing an antialiased polyline with a pen width >=2.
-
-  Also the raster paint engine has a nasty bug in many versions ( Qt 4.8 - ... )
-  for short lines ( https://codereview.qt-project.org/#/c/99456 ), that is worked
-  around in this mode.
-
-  The default setting is true.
-
-  \sa polylineSplitting()
-*/
+    m_roundingAlignment = enable;
+}
+
+/*!
+   \brief En/Disable line splitting for the raster paint engine
+
+   In some Qt versions the raster paint engine paints polylines of many points
+   much faster when they are split in smaller chunks: f.e all supported Qt versions
+   >= Qt 5.0 when drawing an antialiased polyline with a pen width >=2.
+
+   Also the raster paint engine has a nasty bug in many versions ( Qt 4.8 - ... )
+   for short lines ( https://codereview.qt-project.org/#/c/99456 ), that is worked
+   around in this mode.
+
+   The default setting is true.
+
+   \sa polylineSplitting()
+ */
 void QwtPainter::setPolylineSplitting( bool enable )
 {
-    d_polylineSplitting = enable;
+    m_polylineSplitting = enable;
 }
 
 //! Wrapper for QPainter::drawPath()
-void QwtPainter::drawPath( QPainter *painter, const QPainterPath &path )
+void QwtPainter::drawPath( QPainter* painter, const QPainterPath& path )
 {
     painter->drawPath( path );
@@ -242,5 +335,5 @@
 
 //! Wrapper for QPainter::drawRect()
-void QwtPainter::drawRect( QPainter *painter, double x, double y, double w, double h )
+void QwtPainter::drawRect( QPainter* painter, qreal x, qreal y, qreal w, qreal h )
 {
     drawRect( painter, QRectF( x, y, w, h ) );
@@ -248,5 +341,5 @@
 
 //! Wrapper for QPainter::drawRect()
-void QwtPainter::drawRect( QPainter *painter, const QRectF &rect )
+void QwtPainter::drawRect( QPainter* painter, const QRectF& rect )
 {
     const QRectF r = rect;
@@ -277,6 +370,6 @@
 
 //! Wrapper for QPainter::fillRect()
-void QwtPainter::fillRect( QPainter *painter,
-    const QRectF &rect, const QBrush &brush )
+void QwtPainter::fillRect( QPainter* painter,
+    const QRectF& rect, const QBrush& brush )
 {
     if ( !rect.isValid() )
@@ -287,8 +380,8 @@
 
     /*
-      Performance of Qt4 is horrible for a non trivial brush. Without
-      clipping expect minutes or hours for repainting large rectangles
-      (might result from zooming)
-    */
+       Performance of Qt4 is horrible for a non trivial brush. Without
+       clipping expect minutes or hours for repainting large rectangles
+       (might result from zooming)
+     */
 
     if ( deviceClipping )
@@ -309,5 +402,5 @@
 
 //! Wrapper for QPainter::drawPie()
-void QwtPainter::drawPie( QPainter *painter, const QRectF &rect,
+void QwtPainter::drawPie( QPainter* painter, const QRectF& rect,
     int a, int alen )
 {
@@ -321,5 +414,5 @@
 
 //! Wrapper for QPainter::drawEllipse()
-void QwtPainter::drawEllipse( QPainter *painter, const QRectF &rect )
+void QwtPainter::drawEllipse( QPainter* painter, const QRectF& rect )
 {
     QRectF clipRect;
@@ -333,6 +426,6 @@
 
 //! Wrapper for QPainter::drawText()
-void QwtPainter::drawText( QPainter *painter, double x, double y,
-        const QString &text )
+void QwtPainter::drawText( QPainter* painter,
+    qreal x, qreal y, const QString& text )
 {
     drawText( painter, QPointF( x, y ), text );
@@ -340,6 +433,6 @@
 
 //! Wrapper for QPainter::drawText()
-void QwtPainter::drawText( QPainter *painter, const QPointF &pos,
-        const QString &text )
+void QwtPainter::drawText( QPainter* painter, const QPointF& pos,
+    const QString& text )
 {
     QRectF clipRect;
@@ -357,7 +450,7 @@
 
 //! Wrapper for QPainter::drawText()
-void QwtPainter::drawText( QPainter *painter,
-    double x, double y, double w, double h,
-    int flags, const QString &text )
+void QwtPainter::drawText( QPainter* painter,
+    qreal x, qreal y, qreal w, qreal h,
+    int flags, const QString& text )
 {
     drawText( painter, QRectF( x, y, w, h ), flags, text );
@@ -365,6 +458,6 @@
 
 //! Wrapper for QPainter::drawText()
-void QwtPainter::drawText( QPainter *painter, const QRectF &rect,
-        int flags, const QString &text )
+void QwtPainter::drawText( QPainter* painter, const QRectF& rect,
+    int flags, const QString& text )
 {
     painter->save();
@@ -377,15 +470,15 @@
 
 /*!
-  Draw a text document into a rectangle
-
-  \param painter Painter
-  \param rect Traget rectangle
-  \param flags Alignments/Text flags, see QPainter::drawText()
-  \param text Text document
-*/
-void QwtPainter::drawSimpleRichText( QPainter *painter, const QRectF &rect,
-    int flags, const QTextDocument &text )
-{
-    QTextDocument *txt = text.clone();
+   Draw a text document into a rectangle
+
+   \param painter Painter
+   \param rect Target rectangle
+   \param flags Alignments/Text flags, see QPainter::drawText()
+   \param text Text document
+ */
+void QwtPainter::drawSimpleRichText( QPainter* painter, const QRectF& rect,
+    int flags, const QTextDocument& text )
+{
+    QTextDocument* txt = text.clone();
 
     painter->save();
@@ -397,11 +490,11 @@
         const QSize res = qwtScreenResolution();
 
-        const QPaintDevice *pd = painter->device();
+        const QPaintDevice* pd = painter->device();
         if ( pd->logicalDpiX() != res.width() ||
             pd->logicalDpiY() != res.height() )
         {
             QTransform transform;
-            transform.scale( res.width() / double( pd->logicalDpiX() ),
-                res.height() / double( pd->logicalDpiY() ));
+            transform.scale( res.width() / qreal( pd->logicalDpiX() ),
+                res.height() / qreal( pd->logicalDpiY() ) );
 
             painter->setWorldTransform( transform, true );
@@ -415,6 +508,6 @@
     QAbstractTextDocumentLayout* layout = txt->documentLayout();
 
-    const double height = layout->documentSize().height();
-    double y = unscaledRect.y();
+    const qreal height = layout->documentSize().height();
+    qreal y = unscaledRect.y();
     if ( flags & Qt::AlignBottom )
         y += ( unscaledRect.height() - height );
@@ -436,6 +529,6 @@
 
 //! Wrapper for QPainter::drawLine()
-void QwtPainter::drawLine( QPainter *painter,
-    const QPointF &p1, const QPointF &p2 )
+void QwtPainter::drawLine( QPainter* painter,
+    const QPointF& p1, const QPointF& p2 )
 {
     QRectF clipRect;
@@ -456,33 +549,43 @@
 
 //! Wrapper for QPainter::drawPolygon()
-void QwtPainter::drawPolygon( QPainter *painter, const QPolygonF &polygon )
+void QwtPainter::drawPolygon( QPainter* painter, const QPolygonF& polygon )
 {
     QRectF clipRect;
     const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
 
-    QPolygonF cpa = polygon;
     if ( deviceClipping )
-        cpa = QwtClipper::clipPolygonF( clipRect, polygon, true );
-
-    painter->drawPolygon( cpa );
+    {
+        painter->drawPolygon(
+            QwtClipper::clippedPolygonF( clipRect, polygon, true ) );
+    }
+    else
+    {
+        painter->drawPolygon( polygon );
+    }
 }
 
 //! Wrapper for QPainter::drawPolyline()
-void QwtPainter::drawPolyline( QPainter *painter, const QPolygonF &polygon )
+void QwtPainter::drawPolyline( QPainter* painter, const QPolygonF& polygon )
 {
     QRectF clipRect;
     const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
 
-    QPolygonF cpa = polygon;
     if ( deviceClipping )
-        cpa = QwtClipper::clipPolygonF( clipRect, cpa );
-
-    qwtDrawPolyline<QPointF>( painter,
-        cpa.constData(), cpa.size(), d_polylineSplitting );
+    {
+        const QPolygonF cpa = QwtClipper::clippedPolygonF( clipRect, polygon );
+
+        qwtDrawPolyline< QPointF >( painter,
+            cpa.constData(), cpa.size(), m_polylineSplitting );
+    }
+    else
+    {
+        qwtDrawPolyline< QPointF >( painter,
+            polygon.constData(), polygon.size(), m_polylineSplitting );
+    }
 }
 
 //! Wrapper for QPainter::drawPolyline()
-void QwtPainter::drawPolyline( QPainter *painter,
-    const QPointF *points, int pointCount )
+void QwtPainter::drawPolyline( QPainter* painter,
+    const QPointF* points, int pointCount )
 {
     QRectF clipRect;
@@ -492,46 +595,56 @@
     {
         QPolygonF polygon( pointCount );
-        ::memcpy( polygon.data(), points, pointCount * sizeof( QPointF ) );
-
-        polygon = QwtClipper::clipPolygonF( clipRect, polygon );
-        qwtDrawPolyline<QPointF>( painter,
-            polygon.constData(), polygon.size(), d_polylineSplitting );
+        std::memcpy( polygon.data(), points, pointCount * sizeof( QPointF ) );
+
+        QwtClipper::clipPolygonF( clipRect, polygon );
+        qwtDrawPolyline< QPointF >( painter,
+            polygon.constData(), polygon.size(), m_polylineSplitting );
     }
     else
     {
-        qwtDrawPolyline<QPointF>( painter, points, pointCount, d_polylineSplitting );
+        qwtDrawPolyline< QPointF >( painter, points, pointCount, m_polylineSplitting );
     }
 }
 
 //! Wrapper for QPainter::drawPolygon()
-void QwtPainter::drawPolygon( QPainter *painter, const QPolygon &polygon )
+void QwtPainter::drawPolygon( QPainter* painter, const QPolygon& polygon )
 {
     QRectF clipRect;
     const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
 
-    QPolygon cpa = polygon;
     if ( deviceClipping )
-        cpa = QwtClipper::clipPolygon( clipRect, polygon, true );
-
-    painter->drawPolygon( cpa );
+    {
+        painter->drawPolygon(
+            QwtClipper::clippedPolygon( clipRect, polygon, true ) );
+    }
+    else
+    {
+        painter->drawPolygon( polygon );
+    }
 }
 
 //! Wrapper for QPainter::drawPolyline()
-void QwtPainter::drawPolyline( QPainter *painter, const QPolygon &polygon )
+void QwtPainter::drawPolyline( QPainter* painter, const QPolygon& polygon )
 {
     QRectF clipRect;
     const bool deviceClipping = qwtIsClippingNeeded( painter, clipRect );
 
-    QPolygon cpa = polygon;
     if ( deviceClipping )
-        cpa = QwtClipper::clipPolygon( clipRect, cpa );
-
-    qwtDrawPolyline<QPoint>( painter,
-        cpa.constData(), cpa.size(), d_polylineSplitting );
+    {
+        const QPolygon cpa = QwtClipper::clippedPolygon( clipRect, polygon );
+
+        qwtDrawPolyline< QPoint >( painter,
+            cpa.constData(), cpa.size(), m_polylineSplitting );
+    }
+    else
+    {
+        qwtDrawPolyline< QPoint >( painter,
+            polygon.constData(), polygon.size(), m_polylineSplitting );
+    }
 }
 
 //! Wrapper for QPainter::drawPolyline()
-void QwtPainter::drawPolyline( QPainter *painter,
-    const QPoint *points, int pointCount )
+void QwtPainter::drawPolyline( QPainter* painter,
+    const QPoint* points, int pointCount )
 {
     QRectF clipRect;
@@ -541,18 +654,18 @@
     {
         QPolygon polygon( pointCount );
-        ::memcpy( polygon.data(), points, pointCount * sizeof( QPoint ) );
-
-        polygon = QwtClipper::clipPolygon( clipRect, polygon );
-        qwtDrawPolyline<QPoint>( painter,
-            polygon.constData(), polygon.size(), d_polylineSplitting );
+        std::memcpy( polygon.data(), points, pointCount * sizeof( QPoint ) );
+
+        QwtClipper::clipPolygon( clipRect, polygon );
+        qwtDrawPolyline< QPoint >( painter,
+            polygon.constData(), polygon.size(), m_polylineSplitting );
     }
     else
     {
-        qwtDrawPolyline<QPoint>( painter, points, pointCount, d_polylineSplitting );
+        qwtDrawPolyline< QPoint >( painter, points, pointCount, m_polylineSplitting );
     }
 }
 
 //! Wrapper for QPainter::drawPoint()
-void QwtPainter::drawPoint( QPainter *painter, const QPointF &pos )
+void QwtPainter::drawPoint( QPainter* painter, const QPointF& pos )
 {
     QRectF clipRect;
@@ -566,5 +679,5 @@
 
 //! Wrapper for QPainter::drawPoint()
-void QwtPainter::drawPoint( QPainter *painter, const QPoint &pos )
+void QwtPainter::drawPoint( QPainter* painter, const QPoint& pos )
 {
     QRectF clipRect;
@@ -573,8 +686,8 @@
     if ( deviceClipping )
     {
-        const int minX = qCeil( clipRect.left() );
-        const int maxX = qFloor( clipRect.right() );
-        const int minY = qCeil( clipRect.top() );
-        const int maxY = qFloor( clipRect.bottom() );
+        const int minX = qwtCeil( clipRect.left() );
+        const int maxX = qwtFloor( clipRect.right() );
+        const int minY = qwtCeil( clipRect.top() );
+        const int maxY = qwtFloor( clipRect.bottom() );
 
         if ( pos.x() < minX || pos.x() > maxX
@@ -589,6 +702,6 @@
 
 //! Wrapper for QPainter::drawPoints()
-void QwtPainter::drawPoints( QPainter *painter,
-    const QPoint *points, int pointCount )
+void QwtPainter::drawPoints( QPainter* painter,
+    const QPoint* points, int pointCount )
 {
     QRectF clipRect;
@@ -597,13 +710,13 @@
     if ( deviceClipping )
     {
-        const int minX = qCeil( clipRect.left() );
-        const int maxX = qFloor( clipRect.right() );
-        const int minY = qCeil( clipRect.top() );
-        const int maxY = qFloor( clipRect.bottom() );
+        const int minX = qwtCeil( clipRect.left() );
+        const int maxX = qwtFloor( clipRect.right() );
+        const int minY = qwtCeil( clipRect.top() );
+        const int maxY = qwtFloor( clipRect.bottom() );
 
         const QRect r( minX, minY, maxX - minX, maxY - minY );
 
         QPolygon clippedPolygon( pointCount );
-        QPoint *clippedData = clippedPolygon.data();
+        QPoint* clippedData = clippedPolygon.data();
 
         int numClippedPoints = 0;
@@ -622,6 +735,6 @@
 
 //! Wrapper for QPainter::drawPoints()
-void QwtPainter::drawPoints( QPainter *painter,
-    const QPointF *points, int pointCount )
+void QwtPainter::drawPoints( QPainter* painter,
+    const QPointF* points, int pointCount )
 {
     QRectF clipRect;
@@ -631,5 +744,5 @@
     {
         QPolygonF clippedPolygon( pointCount );
-        QPointF *clippedData = clippedPolygon.data();
+        QPointF* clippedData = clippedPolygon.data();
 
         int numClippedPoints = 0;
@@ -648,6 +761,6 @@
 
 //! Wrapper for QPainter::drawImage()
-void QwtPainter::drawImage( QPainter *painter,
-    const QRectF &rect, const QImage &image )
+void QwtPainter::drawImage( QPainter* painter,
+    const QRectF& rect, const QImage& image )
 {
     const QRect alignedRect = rect.toAlignedRect();
@@ -669,6 +782,6 @@
 
 //! Wrapper for QPainter::drawPixmap()
-void QwtPainter::drawPixmap( QPainter *painter,
-    const QRectF &rect, const QPixmap &pixmap )
+void QwtPainter::drawPixmap( QPainter* painter,
+    const QRectF& rect, const QPixmap& pixmap )
 {
     const QRect alignedRect = rect.toAlignedRect();
@@ -690,5 +803,5 @@
 
 //! Draw a focus rectangle on a widget using its style.
-void QwtPainter::drawFocusRect( QPainter *painter, const QWidget *widget )
+void QwtPainter::drawFocusRect( QPainter* painter, const QWidget* widget )
 {
     drawFocusRect( painter, widget, widget->rect() );
@@ -696,9 +809,9 @@
 
 //! Draw a focus rectangle on a widget using its style.
-void QwtPainter::drawFocusRect( QPainter *painter, const QWidget *widget,
-    const QRect &rect )
+void QwtPainter::drawFocusRect( QPainter* painter, const QWidget* widget,
+    const QRect& rect )
 {
     QStyleOptionFocusRect opt;
-    opt.init( widget );
+    opt.initFrom( widget );
     opt.rect = rect;
     opt.state |= QStyle::State_HasFocus;
@@ -710,16 +823,16 @@
 
 /*!
-  Draw a round frame
-
-  \param painter Painter
-  \param rect Frame rectangle
-  \param palette QPalette::WindowText is used for plain borders
+   Draw a round frame
+
+   \param painter Painter
+   \param rect Frame rectangle
+   \param palette QPalette::WindowText is used for plain borders
                  QPalette::Dark and QPalette::Light for raised
                  or sunken borders
-  \param lineWidth Line width
-  \param frameStyle bitwise OR´ed value of QFrame::Shape and QFrame::Shadow
-*/
-void QwtPainter::drawRoundFrame( QPainter *painter,
-    const QRectF &rect, const QPalette &palette,
+   \param lineWidth Line width
+   \param frameStyle bitwise OR´ed value of QFrame::Shape and QFrame::Shadow
+ */
+void QwtPainter::drawRoundFrame( QPainter* painter,
+    const QRectF& rect, const QPalette& palette,
     int lineWidth, int frameStyle )
 {
@@ -732,10 +845,10 @@
 
     Style style = Plain;
-    if ( (frameStyle & QFrame::Sunken) == QFrame::Sunken )
+    if ( (frameStyle& QFrame::Sunken) == QFrame::Sunken )
         style = Sunken;
-    else if ( (frameStyle & QFrame::Raised) == QFrame::Raised )
+    else if ( (frameStyle& QFrame::Raised) == QFrame::Raised )
         style = Raised;
 
-    const double lw2 = 0.5 * lineWidth;
+    const qreal lw2 = 0.5 * lineWidth;
     QRectF r = rect.adjusted( lw2, lw2, -lw2, -lw2 );
 
@@ -776,16 +889,16 @@
 
 /*!
-  Draw a rectangular frame
-
-  \param painter Painter
-  \param rect Frame rectangle
-  \param palette Palette
-  \param foregroundRole Foreground role used for QFrame::Plain
-  \param frameWidth Frame width
-  \param midLineWidth Used for QFrame::Box
-  \param frameStyle bitwise OR´ed value of QFrame::Shape and QFrame::Shadow
-*/
-void QwtPainter::drawFrame( QPainter *painter, const QRectF &rect,
-    const QPalette &palette, QPalette::ColorRole foregroundRole,
+   Draw a rectangular frame
+
+   \param painter Painter
+   \param rect Frame rectangle
+   \param palette Palette
+   \param foregroundRole Foreground role used for QFrame::Plain
+   \param frameWidth Frame width
+   \param midLineWidth Used for QFrame::Box
+   \param frameStyle bitwise OR´ed value of QFrame::Shape and QFrame::Shadow
+ */
+void QwtPainter::drawFrame( QPainter* painter, const QRectF& rect,
+    const QPalette& palette, QPalette::ColorRole foregroundRole,
     int frameWidth, int midLineWidth, int frameStyle )
 {
@@ -882,19 +995,4 @@
             painter->drawPath( path5 );
         }
-#if 0
-        // qDrawWinPanel doesn't result in something nice
-        // on a scalable document like PDF. Better draw a
-        // Panel.
-
-        else if ( shape == QFrame::WinPanel )
-        {
-            painter->setRenderHint( QPainter::NonCosmeticDefaultPen, true );
-            qDrawWinPanel ( painter, rect.toRect(), palette,
-                frameStyle & QFrame::Sunken );
-        }
-        else if ( shape == QFrame::StyledPanel )
-        {
-        }
-#endif
         else
         {
@@ -942,20 +1040,20 @@
 
 /*!
-  Draw a rectangular frame with rounded borders
-
-  \param painter Painter
-  \param rect Frame rectangle
-  \param xRadius x-radius of the ellipses defining the corners
-  \param yRadius y-radius of the ellipses defining the corners
-  \param palette QPalette::WindowText is used for plain borders
+   Draw a rectangular frame with rounded borders
+
+   \param painter Painter
+   \param rect Frame rectangle
+   \param xRadius x-radius of the ellipses defining the corners
+   \param yRadius y-radius of the ellipses defining the corners
+   \param palette QPalette::WindowText is used for plain borders
                  QPalette::Dark and QPalette::Light for raised
                  or sunken borders
-  \param lineWidth Line width
-  \param frameStyle bitwise OR´ed value of QFrame::Shape and QFrame::Shadow
-*/
-
-void QwtPainter::drawRoundedFrame( QPainter *painter,
-    const QRectF &rect, double xRadius, double yRadius,
-    const QPalette &palette, int lineWidth, int frameStyle )
+   \param lineWidth Line width
+   \param frameStyle bitwise OR´ed value of QFrame::Shape and QFrame::Shadow
+ */
+
+void QwtPainter::drawRoundedFrame( QPainter* painter,
+    const QRectF& rect, qreal xRadius, qreal yRadius,
+    const QPalette& palette, int lineWidth, int frameStyle )
 {
     painter->save();
@@ -963,5 +1061,5 @@
     painter->setBrush( Qt::NoBrush );
 
-    double lw2 = lineWidth * 0.5;
+    qreal lw2 = lineWidth * 0.5;
     QRectF innerRect = rect.adjusted( lw2, lw2, -lw2, -lw2 );
 
@@ -977,7 +1075,7 @@
 
     Style style = Plain;
-    if ( (frameStyle & QFrame::Sunken) == QFrame::Sunken )
+    if ( (frameStyle& QFrame::Sunken) == QFrame::Sunken )
         style = Sunken;
-    else if ( (frameStyle & QFrame::Raised) == QFrame::Raised )
+    else if ( (frameStyle& QFrame::Raised) == QFrame::Raised )
         style = Raised;
 
@@ -993,5 +1091,5 @@
             pathList[ 2 * i ].moveTo(
                 path.elementAt(j - 1).x, path.elementAt( j - 1 ).y
-            );
+                );
 
             pathList[ 2 * i ].cubicTo(
@@ -1002,8 +1100,8 @@
             pathList[ 2 * i + 1 ].moveTo(
                 path.elementAt(j + 2).x, path.elementAt(j + 2).y
-            );
+                );
             pathList[ 2 * i + 1 ].lineTo(
                 path.elementAt(j + 3).x, path.elementAt(j + 3).y
-            );
+                );
         }
 
@@ -1086,21 +1184,21 @@
 
 /*!
-  Draw a color bar into a rectangle
-
-  \param painter Painter
-  \param colorMap Color map
-  \param interval Value range
-  \param scaleMap Scale map
-  \param orientation Orientation
-  \param rect Traget rectangle
-*/
-void QwtPainter::drawColorBar( QPainter *painter,
-        const QwtColorMap &colorMap, const QwtInterval &interval,
-        const QwtScaleMap &scaleMap, Qt::Orientation orientation,
-        const QRectF &rect )
-{
-    QVector<QRgb> colorTable;
+   Draw a color bar into a rectangle
+
+   \param painter Painter
+   \param colorMap Color map
+   \param interval Value range
+   \param scaleMap Scale map
+   \param orientation Orientation
+   \param rect Target rectangle
+ */
+void QwtPainter::drawColorBar( QPainter* painter,
+    const QwtColorMap& colorMap, const QwtInterval& interval,
+    const QwtScaleMap& scaleMap, Qt::Orientation orientation,
+    const QRectF& rect )
+{
+    QVector< QRgb > colorTable;
     if ( colorMap.format() == QwtColorMap::Indexed )
-        colorTable = colorMap.colorTable( interval );
+        colorTable = colorMap.colorTable256();
 
     QColor c;
@@ -1109,6 +1207,6 @@
 
     /*
-      We paint to a pixmap first to have something scalable for printing
-      ( f.e. in a Pdf document )
+       We paint to a pixmap first to have something scalable for printing
+       ( f.e. in a Pdf document )
      */
 
@@ -1131,5 +1229,5 @@
                 c.setRgba( colorMap.rgb( interval, value ) );
             else
-                c = colorTable[colorMap.colorIndex( interval, value )];
+                c = colorTable[colorMap.colorIndex( 256, interval, value )];
 
             pmPainter.setPen( c );
@@ -1149,5 +1247,5 @@
                 c.setRgba( colorMap.rgb( interval, value ) );
             else
-                c = colorTable[colorMap.colorIndex( interval, value )];
+                c = colorTable[colorMap.colorIndex( 256, interval, value )];
 
             pmPainter.setPen( c );
@@ -1160,6 +1258,6 @@
 }
 
-static inline void qwtFillRect( const QWidget *widget, QPainter *painter,
-    const QRect &rect, const QBrush &brush)
+static inline void qwtFillRect( const QWidget* widget, QPainter* painter,
+    const QRect& rect, const QBrush& brush)
 {
     if ( brush.style() == Qt::TexturePattern )
@@ -1168,5 +1266,5 @@
 
         painter->setClipRect( rect );
-        painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
+        painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft() );
 
         painter->restore();
@@ -1189,18 +1287,18 @@
 
 /*!
-  Fill a pixmap with the content of a widget
-
-  In Qt >= 5.0 QPixmap::fill() is a nop, in Qt 4.x it is buggy
-  for backgrounds with gradients. Thus fillPixmap() offers
-  an alternative implementation.
-
-  \param widget Widget
-  \param pixmap Pixmap to be filled
-  \param offset Offset
-
-  \sa QPixmap::fill()
- */
-void QwtPainter::fillPixmap( const QWidget *widget,
-    QPixmap &pixmap, const QPoint &offset )
+   Fill a pixmap with the content of a widget
+
+   In Qt >= 5.0 QPixmap::fill() is a nop, in Qt 4.x it is buggy
+   for backgrounds with gradients. Thus fillPixmap() offers
+   an alternative implementation.
+
+   \param widget Widget
+   \param pixmap Pixmap to be filled
+   \param offset Offset
+
+   \sa QPixmap::fill()
+ */
+void QwtPainter::fillPixmap( const QWidget* widget,
+    QPixmap& pixmap, const QPoint& offset )
 {
     const QRect rect( offset, pixmap.size() );
@@ -1233,14 +1331,14 @@
 
 /*!
-  Fill rect with the background of a widget
-
-  \param painter Painter
-  \param rect Rectangle to be filled
-  \param widget Widget
-
-  \sa QStyle::PE_Widget, QWidget::backgroundRole()
- */
-void QwtPainter::drawBackgound( QPainter *painter,
-    const QRectF &rect, const QWidget *widget )
+   Fill rect with the background of a widget
+
+   \param painter Painter
+   \param rect Rectangle to be filled
+   \param widget Widget
+
+   \sa QStyle::PE_Widget, QWidget::backgroundRole()
+ */
+void QwtPainter::drawBackgound( QPainter* painter,
+    const QRectF& rect, const QWidget* widget )
 {
     if ( widget->testAttribute( Qt::WA_StyledBackground ) )
@@ -1263,40 +1361,169 @@
 
 /*!
-  \return A pixmap that can be used as backing store
-
-  \param widget Widget, for which the backingstore is intended
-  \param size Size of the pixmap
- */
-QPixmap QwtPainter::backingStore( QWidget *widget, const QSize &size )
+   Distance appropriate for drawing a subsequent character after text.
+
+   \param fontMetrics Font metrics
+   \param text Text
+   \return horizontal advance in pixels
+ */
+int QwtPainter::horizontalAdvance(
+    const QFontMetrics& fontMetrics, const QString& text )
+{
+#if QT_VERSION >= 0x050b00
+    return fontMetrics.horizontalAdvance( text );
+#else
+    return fontMetrics.width( text );
+#endif
+
+}
+
+/*!
+   Distance appropriate for drawing a subsequent character after text.
+
+   \param fontMetrics Font metrics
+   \param text Text
+   \return horizontal advance in pixels
+ */
+qreal QwtPainter::horizontalAdvance(
+    const QFontMetricsF& fontMetrics, const QString& text )
+{
+#if QT_VERSION >= 0x050b00
+    return fontMetrics.horizontalAdvance( text );
+#else
+    return fontMetrics.width( text );
+#endif
+}
+
+/*!
+   Distance appropriate for drawing a subsequent character after ch.
+
+   \param fontMetrics Font metrics
+   \param ch Character
+   \return horizontal advance in pixels
+ */
+int QwtPainter::horizontalAdvance(
+    const QFontMetrics& fontMetrics, QChar ch )
+{
+#if QT_VERSION >= 0x050b00
+    return fontMetrics.horizontalAdvance( ch );
+#else
+    return fontMetrics.width( ch );
+#endif
+}
+
+/*!
+   Distance appropriate for drawing a subsequent character after ch.
+
+   \param fontMetrics Font metrics
+   \param ch Character
+   \return horizontal advance in pixels
+ */
+qreal QwtPainter::horizontalAdvance(
+    const QFontMetricsF& fontMetrics, QChar ch )
+{
+#if QT_VERSION >= 0x050b00
+    return fontMetrics.horizontalAdvance( ch );
+#else
+    return fontMetrics.width( ch );
+#endif
+}
+
+/*!
+   Adjust the DPI value of font according to the DPI value of the paint device
+
+   \param font Unscaled font
+   \param paintDevice Paint device providing a DPI value. If paintDevice == null
+                     the DPI value of the primary screen will be used
+
+   \return Font being adjusted to the DPI value of the paint device
+ */
+QFont QwtPainter::scaledFont( const QFont& font, const QPaintDevice* paintDevice )
+{
+    if ( paintDevice == NULL )
+    {
+#if QT_VERSION < 0x060000
+        paintDevice = QApplication::desktop();
+#else
+        class PaintDevice : public QPaintDevice
+        {
+            virtual QPaintEngine* paintEngine() const QWT_OVERRIDE
+            {
+                return NULL;
+            }
+
+            virtual int metric( PaintDeviceMetric metric ) const QWT_OVERRIDE
+            {
+                if ( metric == PdmDpiY )
+                {
+                    QScreen* screen = QGuiApplication::primaryScreen();
+                    if ( screen )
+                    {
+                        return screen->logicalDotsPerInchY();
+                    }
+                }
+
+                return QPaintDevice::metric( metric );
+            }
+        };
+
+        static PaintDevice dummyPaintDevice;
+        paintDevice = &dummyPaintDevice;
+#endif
+    }
+
+    return QFont( font, const_cast< QPaintDevice* >( paintDevice ) );
+}
+
+/*!
+   \return Pixel ratio for a paint device
+   \param paintDevice Paint device
+ */
+qreal QwtPainter::devicePixelRatio( const QPaintDevice* paintDevice )
+{
+    qreal pixelRatio = 0.0;
+
+#if QT_VERSION >= 0x050100
+    if ( paintDevice )
+    {
+#if QT_VERSION >= 0x050600
+        pixelRatio = paintDevice->devicePixelRatioF();
+#else
+        pixelRatio = paintDevice->devicePixelRatio();
+#endif
+    }
+#else
+    Q_UNUSED( paintDevice )
+#endif
+
+#if QT_VERSION >= 0x050000
+    if ( pixelRatio == 0.0 && qApp )
+        pixelRatio = qApp->devicePixelRatio();
+#endif
+
+    if ( pixelRatio == 0.0 )
+        pixelRatio = 1.0;
+
+    return pixelRatio;
+}
+
+/*!
+   \return A pixmap that can be used as backing store
+
+   \param widget Widget, for which the backingstore is intended
+   \param size Size of the pixmap
+ */
+QPixmap QwtPainter::backingStore( QWidget* widget, const QSize& size )
 {
     QPixmap pm;
 
-#define QWT_HIGH_DPI 1
-
-#if QT_VERSION >= 0x050000 && QWT_HIGH_DPI
-    qreal pixelRatio = 1.0;
-
-    if ( widget && widget->windowHandle() )
-    {
-#if QT_VERSION < 0x050100
-        pixelRatio = widget->windowHandle()->devicePixelRatio();
-#else
-        pixelRatio = widget->devicePixelRatio();
-#endif
-    }
-    else
-    {
-        if ( qApp )
-            pixelRatio = qApp->devicePixelRatio();
-    }
+#if QT_VERSION >= 0x050000
+    const qreal pixelRatio = QwtPainter::devicePixelRatio( widget );
 
     pm = QPixmap( size * pixelRatio );
     pm.setDevicePixelRatio( pixelRatio );
 #else
-    Q_UNUSED( widget )
     pm = QPixmap( size );
 #endif
 
-#if QT_VERSION < 0x050000
 #ifdef Q_WS_X11
     if ( widget && isX11GraphicsSystem() )
@@ -1305,8 +1532,8 @@
             pm.x11SetScreen( widget->x11Info().screen() );
     }
-#endif
+#else
+    Q_UNUSED( widget )
 #endif
 
     return pm;
 }
-
Index: /trunk/BNC/qwt/qwt_painter.h
===================================================================
--- /trunk/BNC/qwt/qwt_painter.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_painter.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,31 +13,28 @@
 #include "qwt_global.h"
 
-#include <qpoint.h>
-#include <qrect.h>
+#include <qpalette.h>
+#include <qpolygon.h>
 #include <qpen.h>
-#include <qline.h>
-#include <qpalette.h>
-
-class QPainter;
-class QBrush;
-class QColor;
-class QWidget;
-class QPolygonF;
-class QRectF;
-class QImage;
-class QPixmap;
+
 class QwtScaleMap;
 class QwtColorMap;
 class QwtInterval;
 
+class QPainter;
+class QBrush;
+class QWidget;
+class QImage;
+class QPixmap;
+class QFontMetrics;
+class QFontMetricsF;
 class QTextDocument;
 class QPainterPath;
 
 /*!
-  \brief A collection of QPainter workarounds
-*/
+   \brief A collection of QPainter workarounds
+ */
 class QWT_EXPORT QwtPainter
 {
-public:
+  public:
     static void setPolylineSplitting( bool );
     static bool polylineSplitting();
@@ -45,86 +42,97 @@
     static void setRoundingAlignment( bool );
     static bool roundingAlignment();
-    static bool roundingAlignment(QPainter *);
-
-    static void drawText( QPainter *, double x, double y, const QString & );
-    static void drawText( QPainter *, const QPointF &, const QString & );
-    static void drawText( QPainter *, double x, double y, double w, double h,
-        int flags, const QString & );
-    static void drawText( QPainter *, const QRectF &,
-        int flags, const QString & );
+    static bool roundingAlignment( const QPainter* );
+
+    static void drawText( QPainter*, qreal x, qreal y, const QString& );
+    static void drawText( QPainter*, const QPointF&, const QString& );
+    static void drawText( QPainter*, qreal x, qreal y, qreal w, qreal h,
+        int flags, const QString& );
+    static void drawText( QPainter*, const QRectF&,
+        int flags, const QString& );
 
 #ifndef QT_NO_RICHTEXT
-    static void drawSimpleRichText( QPainter *, const QRectF &,
-        int flags, const QTextDocument & );
+    static void drawSimpleRichText( QPainter*, const QRectF&,
+        int flags, const QTextDocument& );
 #endif
 
-    static void drawRect( QPainter *, double x, double y, double w, double h );
-    static void drawRect( QPainter *, const QRectF &rect );
-    static void fillRect( QPainter *, const QRectF &, const QBrush & );
-
-    static void drawEllipse( QPainter *, const QRectF & );
-    static void drawPie( QPainter *, const QRectF &, int a, int alen );
-
-    static void drawLine( QPainter *, double x1, double y1, double x2, double y2 );
-    static void drawLine( QPainter *, const QPointF &p1, const QPointF &p2 );
-    static void drawLine( QPainter *, const QLineF & );
-
-    static void drawPolygon( QPainter *, const QPolygonF & );
-    static void drawPolyline( QPainter *, const QPolygonF & );
-    static void drawPolyline( QPainter *, const QPointF *, int pointCount );
-
-    static void drawPolygon( QPainter *, const QPolygon & );
-    static void drawPolyline( QPainter *, const QPolygon & );
-    static void drawPolyline( QPainter *, const QPoint *, int pointCount );
-
-    static void drawPoint( QPainter *, const QPoint & );
-    static void drawPoints( QPainter *, const QPolygon & );
-    static void drawPoints( QPainter *, const QPoint *, int pointCount );
-
-    static void drawPoint( QPainter *, double x, double y );
-    static void drawPoint( QPainter *, const QPointF & );
-    static void drawPoints( QPainter *, const QPolygonF & );
-    static void drawPoints( QPainter *, const QPointF *, int pointCount );
-
-    static void drawPath( QPainter *, const QPainterPath & );
-    static void drawImage( QPainter *, const QRectF &, const QImage & );
-    static void drawPixmap( QPainter *, const QRectF &, const QPixmap & );
-
-    static void drawRoundFrame( QPainter *,
-        const QRectF &, const QPalette &, int lineWidth, int frameStyle );
-
-    static void drawRoundedFrame( QPainter *,
-        const QRectF &, double xRadius, double yRadius,
-        const QPalette &, int lineWidth, int frameStyle );
-
-    static void drawFrame( QPainter *, const QRectF &rect,
-        const QPalette &palette, QPalette::ColorRole foregroundRole,
-        int frameWidth, int midLineWidth, int frameStyle );
-
-    static void drawFocusRect( QPainter *, const QWidget * );
-    static void drawFocusRect( QPainter *, const QWidget *, const QRect & );
-
-    static void drawColorBar( QPainter *painter,
-        const QwtColorMap &, const QwtInterval &,
-        const QwtScaleMap &, Qt::Orientation, const QRectF & );
-
-    static bool isAligning( QPainter *painter );
+    static void drawRect( QPainter*, qreal x, qreal y, qreal w, qreal h );
+    static void drawRect( QPainter*, const QRectF& rect );
+    static void fillRect( QPainter*, const QRectF&, const QBrush& );
+
+    static void drawEllipse( QPainter*, const QRectF& );
+    static void drawPie( QPainter*, const QRectF& r, int a, int alen );
+
+    static void drawLine( QPainter*, qreal x1, qreal y1, qreal x2, qreal y2 );
+    static void drawLine( QPainter*, const QPointF& p1, const QPointF& p2 );
+    static void drawLine( QPainter*, const QLineF& );
+
+    static void drawPolygon( QPainter*, const QPolygonF& );
+    static void drawPolyline( QPainter*, const QPolygonF& );
+    static void drawPolyline( QPainter*, const QPointF*, int pointCount );
+
+    static void drawPolygon( QPainter*, const QPolygon& );
+    static void drawPolyline( QPainter*, const QPolygon& );
+    static void drawPolyline( QPainter*, const QPoint*, int pointCount );
+
+    static void drawPoint( QPainter*, const QPoint& );
+    static void drawPoints( QPainter*, const QPolygon& );
+    static void drawPoints( QPainter*, const QPoint*, int pointCount );
+
+    static void drawPoint( QPainter*, qreal x, qreal y );
+    static void drawPoint( QPainter*, const QPointF& );
+    static void drawPoints( QPainter*, const QPolygonF& );
+    static void drawPoints( QPainter*, const QPointF*, int pointCount );
+
+    static void drawPath( QPainter*, const QPainterPath& );
+    static void drawImage( QPainter*, const QRectF&, const QImage& );
+    static void drawPixmap( QPainter*, const QRectF&, const QPixmap& );
+
+    static void drawRoundFrame( QPainter*,
+        const QRectF&, const QPalette&, int lineWidth, int frameStyle );
+
+    static void drawRoundedFrame( QPainter*,
+        const QRectF&, qreal xRadius, qreal yRadius,
+        const QPalette&, int lineWidth, int frameStyle );
+
+    static void drawFrame( QPainter*, const QRectF& rect,
+        const QPalette& palette, QPalette::ColorRole foregroundRole,
+        int lineWidth, int midLineWidth, int frameStyle );
+
+    static void drawFocusRect( QPainter*, const QWidget* );
+    static void drawFocusRect( QPainter*, const QWidget*, const QRect& );
+
+    static void drawColorBar( QPainter*,
+        const QwtColorMap&, const QwtInterval&,
+        const QwtScaleMap&, Qt::Orientation, const QRectF& );
+
+    static bool isAligning( const QPainter*);
     static bool isX11GraphicsSystem();
 
-    static void fillPixmap( const QWidget *,
-        QPixmap &, const QPoint &offset = QPoint() );
-
-    static void drawBackgound( QPainter *painter,
-        const QRectF &rect, const QWidget *widget );
-
-    static QPixmap backingStore( QWidget *, const QSize & );
-
-private:
-    static bool d_polylineSplitting;
-    static bool d_roundingAlignment;
+    static void fillPixmap( const QWidget*,
+        QPixmap&, const QPoint& offset = QPoint() );
+
+    static void drawBackgound( QPainter*,
+        const QRectF&, const QWidget* );
+
+    static QPixmap backingStore( QWidget*, const QSize& );
+    static qreal devicePixelRatio( const QPaintDevice* );
+
+    static qreal effectivePenWidth( const QPen& );
+
+    static int horizontalAdvance( const QFontMetrics&, const QString& );
+    static qreal horizontalAdvance( const QFontMetricsF&, const QString& );
+
+    static int horizontalAdvance( const QFontMetrics&, QChar );
+    static qreal horizontalAdvance( const QFontMetricsF&, QChar );
+
+    static QFont scaledFont( const QFont&, const QPaintDevice* = NULL );
+
+  private:
+    static bool m_polylineSplitting;
+    static bool m_roundingAlignment;
 };
 
 //!  Wrapper for QPainter::drawPoint()
-inline void QwtPainter::drawPoint( QPainter *painter, double x, double y )
+inline void QwtPainter::drawPoint( QPainter* painter, qreal x, qreal y )
 {
     QwtPainter::drawPoint( painter, QPointF( x, y ) );
@@ -132,5 +140,5 @@
 
 //! Wrapper for QPainter::drawPoints()
-inline void QwtPainter::drawPoints( QPainter *painter, const QPolygon &polygon )
+inline void QwtPainter::drawPoints( QPainter* painter, const QPolygon& polygon )
 {
     drawPoints( painter, polygon.data(), polygon.size() );
@@ -138,5 +146,5 @@
 
 //! Wrapper for QPainter::drawPoints()
-inline void QwtPainter::drawPoints( QPainter *painter, const QPolygonF &polygon )
+inline void QwtPainter::drawPoints( QPainter* painter, const QPolygonF& polygon )
 {
     drawPoints( painter, polygon.data(), polygon.size() );
@@ -144,6 +152,6 @@
 
 //!  Wrapper for QPainter::drawLine()
-inline void QwtPainter::drawLine( QPainter *painter,
-    double x1, double y1, double x2, double y2 )
+inline void QwtPainter::drawLine( QPainter* painter,
+    qreal x1, qreal y1, qreal x2, qreal y2 )
 {
     QwtPainter::drawLine( painter, QPointF( x1, y1 ), QPointF( x2, y2 ) );
@@ -151,5 +159,5 @@
 
 //!  Wrapper for QPainter::drawLine()
-inline void QwtPainter::drawLine( QPainter *painter, const QLineF &line )
+inline void QwtPainter::drawLine( QPainter* painter, const QLineF& line )
 {
     QwtPainter::drawLine( painter, line.p1(), line.p2() );
@@ -157,32 +165,43 @@
 
 /*!
-  \return True, when line splitting for the raster paint engine is enabled.
-  \sa setPolylineSplitting()
-*/
+   \return True, when line splitting for the raster paint engine is enabled.
+   \sa setPolylineSplitting()
+ */
 inline bool QwtPainter::polylineSplitting()
 {
-    return d_polylineSplitting;
-}
-
-/*!
-  Check whether coordinates should be rounded, before they are painted
-  to a paint engine that rounds to integer values. For other paint engines
-  ( PDF, SVG ), this flag has no effect.
-
-  \return True, when rounding is enabled
-  \sa setRoundingAlignment(), isAligning()
-*/
+    return m_polylineSplitting;
+}
+
+/*!
+   Check whether coordinates should be rounded, before they are painted
+   to a paint engine that rounds to integer values. For other paint engines
+   ( PDF, SVG ), this flag has no effect.
+
+   \return True, when rounding is enabled
+   \sa setRoundingAlignment(), isAligning()
+ */
 inline bool QwtPainter::roundingAlignment()
 {
-    return d_roundingAlignment;
-}
-
-/*!
-  \return roundingAlignment() && isAligning(painter);
-  \param painter Painter
-*/
-inline bool QwtPainter::roundingAlignment(QPainter *painter)
-{
-    return d_roundingAlignment && isAligning(painter);
-}
+    return m_roundingAlignment;
+}
+
+/*!
+   \return roundingAlignment() && isAligning(painter);
+   \param painter Painter
+ */
+inline bool QwtPainter::roundingAlignment( const QPainter* painter )
+{
+    return m_roundingAlignment && isAligning(painter);
+}
+
+/*!
+   \return pen.widthF() expanded to at least 1.0
+   \param pen Pen
+ */
+inline qreal QwtPainter::effectivePenWidth( const QPen& pen )
+{
+    const qreal width = pen.widthF();
+    return ( width < 1.0 ) ? 1.0 : width;
+}
+
 #endif
Index: /trunk/BNC/qwt/qwt_painter_command.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_painter_command.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_painter_command.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,120 +11,120 @@
 
 //! Construct an invalid command
-QwtPainterCommand::QwtPainterCommand():
-    d_type( Invalid )
+QwtPainterCommand::QwtPainterCommand()
+    : m_type( Invalid )
 {
 }
 
 //! Copy constructor
-QwtPainterCommand::QwtPainterCommand( const QPainterPath &path ):
-    d_type( Path )
-{
-    d_path = new QPainterPath( path );
-}
-
-/*!
-  Constructor for Pixmap paint operation
-
-  \param rect Target rectangle
-  \param pixmap Pixmap
-  \param subRect Rectangle inside the pixmap
-
-  \sa QPainter::drawPixmap()
- */
-QwtPainterCommand::QwtPainterCommand( const QRectF &rect,
-        const QPixmap &pixmap, const QRectF& subRect ):
-    d_type( Pixmap )
-{
-    d_pixmapData = new PixmapData();
-    d_pixmapData->rect = rect;
-    d_pixmapData->pixmap = pixmap;
-    d_pixmapData->subRect = subRect;
-}
-
-/*!
-  Constructor for Image paint operation
-
-  \param rect Target rectangle
-  \param image Image
-  \param subRect Rectangle inside the image
-  \param flags Conversion flags
-
-  \sa QPainter::drawImage()
- */
-QwtPainterCommand::QwtPainterCommand( const QRectF &rect,
-        const QImage &image, const QRectF& subRect,
-        Qt::ImageConversionFlags flags ):
-    d_type( Image )
-{
-    d_imageData = new ImageData();
-    d_imageData->rect = rect;
-    d_imageData->image = image;
-    d_imageData->subRect = subRect;
-    d_imageData->flags = flags;
-}
-
-/*!
-  Constructor for State paint operation
-  \param state Paint engine state
- */
-QwtPainterCommand::QwtPainterCommand( const QPaintEngineState &state ):
-    d_type( State )
-{
-    d_stateData = new StateData();
-
-    d_stateData->flags = state.state();
-
-    if ( d_stateData->flags & QPaintEngine::DirtyPen )
-        d_stateData->pen = state.pen();
-
-    if ( d_stateData->flags & QPaintEngine::DirtyBrush )
-        d_stateData->brush = state.brush();
-
-    if ( d_stateData->flags & QPaintEngine::DirtyBrushOrigin )
-        d_stateData->brushOrigin = state.brushOrigin();
-
-    if ( d_stateData->flags & QPaintEngine::DirtyFont )
-        d_stateData->font = state.font();
-
-    if ( d_stateData->flags & QPaintEngine::DirtyBackground )
-    {
-        d_stateData->backgroundMode = state.backgroundMode();
-        d_stateData->backgroundBrush = state.backgroundBrush();
-    }
-
-    if ( d_stateData->flags & QPaintEngine::DirtyTransform )
-        d_stateData->transform = state.transform();
-
-    if ( d_stateData->flags & QPaintEngine::DirtyClipEnabled )
-        d_stateData->isClipEnabled = state.isClipEnabled();
-
-    if ( d_stateData->flags & QPaintEngine::DirtyClipRegion )
-    {
-        d_stateData->clipRegion = state.clipRegion();
-        d_stateData->clipOperation = state.clipOperation();
-    }
-
-    if ( d_stateData->flags & QPaintEngine::DirtyClipPath )
-    {
-        d_stateData->clipPath = state.clipPath();
-        d_stateData->clipOperation = state.clipOperation();
-    }
-
-    if ( d_stateData->flags & QPaintEngine::DirtyHints )
-        d_stateData->renderHints = state.renderHints();
-
-    if ( d_stateData->flags & QPaintEngine::DirtyCompositionMode )
-        d_stateData->compositionMode = state.compositionMode();
-
-    if ( d_stateData->flags & QPaintEngine::DirtyOpacity )
-        d_stateData->opacity = state.opacity();
-}
-
-/*!
-  Copy constructor
-  \param other Command to be copied
-
- */
-QwtPainterCommand::QwtPainterCommand(const QwtPainterCommand &other)
+QwtPainterCommand::QwtPainterCommand( const QPainterPath& path )
+    : m_type( Path )
+{
+    m_path = new QPainterPath( path );
+}
+
+/*!
+   Constructor for Pixmap paint operation
+
+   \param rect Target rectangle
+   \param pixmap Pixmap
+   \param subRect Rectangle inside the pixmap
+
+   \sa QPainter::drawPixmap()
+ */
+QwtPainterCommand::QwtPainterCommand( const QRectF& rect,
+        const QPixmap& pixmap, const QRectF& subRect )
+    : m_type( Pixmap )
+{
+    m_pixmapData = new PixmapData();
+    m_pixmapData->rect = rect;
+    m_pixmapData->pixmap = pixmap;
+    m_pixmapData->subRect = subRect;
+}
+
+/*!
+   Constructor for Image paint operation
+
+   \param rect Target rectangle
+   \param image Image
+   \param subRect Rectangle inside the image
+   \param flags Conversion flags
+
+   \sa QPainter::drawImage()
+ */
+QwtPainterCommand::QwtPainterCommand( const QRectF& rect,
+        const QImage& image, const QRectF& subRect,
+        Qt::ImageConversionFlags flags )
+    : m_type( Image )
+{
+    m_imageData = new ImageData();
+    m_imageData->rect = rect;
+    m_imageData->image = image;
+    m_imageData->subRect = subRect;
+    m_imageData->flags = flags;
+}
+
+/*!
+   Constructor for State paint operation
+   \param state Paint engine state
+ */
+QwtPainterCommand::QwtPainterCommand( const QPaintEngineState& state )
+    : m_type( State )
+{
+    m_stateData = new StateData();
+
+    m_stateData->flags = state.state();
+
+    if ( m_stateData->flags & QPaintEngine::DirtyPen )
+        m_stateData->pen = state.pen();
+
+    if ( m_stateData->flags & QPaintEngine::DirtyBrush )
+        m_stateData->brush = state.brush();
+
+    if ( m_stateData->flags & QPaintEngine::DirtyBrushOrigin )
+        m_stateData->brushOrigin = state.brushOrigin();
+
+    if ( m_stateData->flags & QPaintEngine::DirtyFont )
+        m_stateData->font = state.font();
+
+    if ( m_stateData->flags & QPaintEngine::DirtyBackground )
+    {
+        m_stateData->backgroundMode = state.backgroundMode();
+        m_stateData->backgroundBrush = state.backgroundBrush();
+    }
+
+    if ( m_stateData->flags & QPaintEngine::DirtyTransform )
+        m_stateData->transform = state.transform();
+
+    if ( m_stateData->flags & QPaintEngine::DirtyClipEnabled )
+        m_stateData->isClipEnabled = state.isClipEnabled();
+
+    if ( m_stateData->flags & QPaintEngine::DirtyClipRegion )
+    {
+        m_stateData->clipRegion = state.clipRegion();
+        m_stateData->clipOperation = state.clipOperation();
+    }
+
+    if ( m_stateData->flags & QPaintEngine::DirtyClipPath )
+    {
+        m_stateData->clipPath = state.clipPath();
+        m_stateData->clipOperation = state.clipOperation();
+    }
+
+    if ( m_stateData->flags & QPaintEngine::DirtyHints )
+        m_stateData->renderHints = state.renderHints();
+
+    if ( m_stateData->flags & QPaintEngine::DirtyCompositionMode )
+        m_stateData->compositionMode = state.compositionMode();
+
+    if ( m_stateData->flags & QPaintEngine::DirtyOpacity )
+        m_stateData->opacity = state.opacity();
+}
+
+/*!
+   Copy constructor
+   \param other Command to be copied
+
+ */
+QwtPainterCommand::QwtPainterCommand( const QwtPainterCommand& other )
 {
     copy( other );
@@ -138,10 +138,10 @@
 
 /*!
-  Assignment operator
-
-  \param other Command to be copied
-  \return Modified command
- */
-QwtPainterCommand &QwtPainterCommand::operator=(const QwtPainterCommand &other)
+   Assignment operator
+
+   \param other Command to be copied
+   \return Modified command
+ */
+QwtPainterCommand& QwtPainterCommand::operator=( const QwtPainterCommand& other )
 {
     reset();
@@ -151,28 +151,28 @@
 }
 
-void QwtPainterCommand::copy( const QwtPainterCommand &other )
-{
-    d_type = other.d_type;
-
-    switch( other.d_type )
+void QwtPainterCommand::copy( const QwtPainterCommand& other )
+{
+    m_type = other.m_type;
+
+    switch( other.m_type )
     {
         case Path:
         {
-            d_path = new QPainterPath( *other.d_path );
+            m_path = new QPainterPath( *other.m_path );
             break;
         }
         case Pixmap:
         {
-            d_pixmapData = new PixmapData( *other.d_pixmapData );
+            m_pixmapData = new PixmapData( *other.m_pixmapData );
             break;
         }
         case Image:
         {
-            d_imageData = new ImageData( *other.d_imageData );
+            m_imageData = new ImageData( *other.m_imageData );
             break;
         }
         case State:
         {
-            d_stateData = new StateData( *other.d_stateData );
+            m_stateData = new StateData( *other.m_stateData );
             break;
         }
@@ -184,24 +184,24 @@
 void QwtPainterCommand::reset()
 {
-    switch( d_type )
+    switch( m_type )
     {
         case Path:
         {
-            delete d_path;
+            delete m_path;
             break;
         }
         case Pixmap:
         {
-            delete d_pixmapData;
+            delete m_pixmapData;
             break;
         }
         case Image:
         {
-            delete d_imageData;
+            delete m_imageData;
             break;
         }
         case State:
         {
-            delete d_stateData;
+            delete m_stateData;
             break;
         }
@@ -210,11 +210,11 @@
     }
 
-    d_type = Invalid;
+    m_type = Invalid;
 }
 
 //! \return Painter path to be painted
-QPainterPath *QwtPainterCommand::path()
-{
-    return d_path;
+QPainterPath* QwtPainterCommand::path()
+{
+    return m_path;
 }
 
@@ -222,5 +222,5 @@
 QwtPainterCommand::PixmapData* QwtPainterCommand::pixmapData()
 {
-    return d_pixmapData;
+    return m_pixmapData;
 }
 
@@ -228,5 +228,5 @@
 QwtPainterCommand::ImageData* QwtPainterCommand::imageData()
 {
-    return d_imageData;
+    return m_imageData;
 }
 
@@ -234,4 +234,4 @@
 QwtPainterCommand::StateData* QwtPainterCommand::stateData()
 {
-    return d_stateData;
-}
+    return m_stateData;
+}
Index: /trunk/BNC/qwt/qwt_painter_command.h
===================================================================
--- /trunk/BNC/qwt/qwt_painter_command.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_painter_command.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,4 +12,5 @@
 
 #include "qwt_global.h"
+
 #include <qpaintengine.h>
 #include <qpixmap.h>
@@ -21,15 +22,15 @@
 
 /*!
-  QwtPainterCommand represents the attributes of a paint operation
-  how it is used between QPainter and QPaintDevice
+   QwtPainterCommand represents the attributes of a paint operation
+   how it is used between QPainter and QPaintDevice
 
-  It is used by QwtGraphic to record and replay paint operations
+   It is used by QwtGraphic to record and replay paint operations
 
-  \sa QwtGraphic::commands()
+   \sa QwtGraphic::commands()
  */
 
 class QWT_EXPORT QwtPainterCommand
 {
-public:
+  public:
     //! Type of the paint command
     enum Type
@@ -79,5 +80,4 @@
         Qt::BGMode backgroundMode;
         QFont font;
-        QMatrix matrix;
         QTransform transform;
 
@@ -93,25 +93,25 @@
 
     QwtPainterCommand();
-    QwtPainterCommand(const QwtPainterCommand &);
+    QwtPainterCommand(const QwtPainterCommand&);
 
-    QwtPainterCommand( const QPainterPath & );
+    explicit QwtPainterCommand( const QPainterPath& );
 
-    QwtPainterCommand( const QRectF &rect,
-            const QPixmap &, const QRectF& subRect );
+    QwtPainterCommand( const QRectF& rect,
+        const QPixmap&, const QRectF& subRect );
 
-    QwtPainterCommand( const QRectF &rect,
-            const QImage &, const QRectF& subRect,
-            Qt::ImageConversionFlags );
+    QwtPainterCommand( const QRectF& rect,
+        const QImage&, const QRectF& subRect,
+        Qt::ImageConversionFlags );
 
-    QwtPainterCommand( const QPaintEngineState & );
+    explicit QwtPainterCommand( const QPaintEngineState& );
 
     ~QwtPainterCommand();
 
-    QwtPainterCommand &operator=(const QwtPainterCommand & );
+    QwtPainterCommand& operator=(const QwtPainterCommand& );
 
     Type type() const;
 
-    QPainterPath *path();
-    const QPainterPath *path() const;
+    QPainterPath* path();
+    const QPainterPath* path() const;
 
     PixmapData* pixmapData();
@@ -124,16 +124,16 @@
     const StateData* stateData() const;
 
-private:
-    void copy( const QwtPainterCommand & );
+  private:
+    void copy( const QwtPainterCommand& );
     void reset();
 
-    Type d_type;
+    Type m_type;
 
     union
     {
-        QPainterPath *d_path;
-        PixmapData *d_pixmapData;
-        ImageData *d_imageData;
-        StateData *d_stateData;
+        QPainterPath* m_path;
+        PixmapData* m_pixmapData;
+        ImageData* m_imageData;
+        StateData* m_stateData;
     };
 };
@@ -142,32 +142,32 @@
 inline QwtPainterCommand::Type QwtPainterCommand::type() const
 {
-    return d_type;
+    return m_type;
 }
 
 //! \return Painter path to be painted
-inline const QPainterPath *QwtPainterCommand::path() const
+inline const QPainterPath* QwtPainterCommand::path() const
 {
-    return d_path;
+    return m_path;
 }
 
 //! \return Attributes how to paint a QPixmap
-inline const QwtPainterCommand::PixmapData *
+inline const QwtPainterCommand::PixmapData*
 QwtPainterCommand::pixmapData() const
 {
-    return d_pixmapData;
+    return m_pixmapData;
 }
 
 //! \return Attributes how to paint a QImage
-inline const QwtPainterCommand::ImageData *
+inline const QwtPainterCommand::ImageData*
 QwtPainterCommand::imageData() const
 {
-    return d_imageData;
+    return m_imageData;
 }
 
 //! \return Attributes of a state change
-inline const QwtPainterCommand::StateData *
+inline const QwtPainterCommand::StateData*
 QwtPainterCommand::stateData() const
 {
-    return d_stateData;
+    return m_stateData;
 }
 
Index: /trunk/BNC/qwt/qwt_panner.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_panner.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_panner.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,4 +11,5 @@
 #include "qwt_picker.h"
 #include "qwt_painter.h"
+
 #include <qpainter.h>
 #include <qpixmap.h>
@@ -17,12 +18,12 @@
 #include <qbitmap.h>
 
-static QVector<QwtPicker *> qwtActivePickers( QWidget *w )
-{
-    QVector<QwtPicker *> pickers;
+static QVector< QwtPicker* > qwtActivePickers( QWidget* w )
+{
+    QVector< QwtPicker* > pickers;
 
     QObjectList children = w->children();
     for ( int i = 0; i < children.size(); i++ )
     {
-        QwtPicker *picker = qobject_cast<QwtPicker *>( children[i] );
+        QwtPicker* picker = qobject_cast< QwtPicker* >( children[i] );
         if ( picker && picker->isEnabled() )
             pickers += picker;
@@ -34,18 +35,18 @@
 class QwtPanner::PrivateData
 {
-public:
-    PrivateData():
-        button( Qt::LeftButton ),
-        buttonModifiers( Qt::NoModifier ),
-        abortKey( Qt::Key_Escape ),
-        abortKeyModifiers( Qt::NoModifier ),
-#ifndef QT_NO_CURSOR
-        cursor( NULL ),
-        restoreCursor( NULL ),
-        hasCursor( false ),
-#endif
-        isEnabled( false )
-    {
-        orientations = Qt::Vertical | Qt::Horizontal;
+  public:
+    PrivateData()
+        : button( Qt::LeftButton )
+        , buttonModifiers( Qt::NoModifier )
+        , abortKey( Qt::Key_Escape )
+        , abortKeyModifiers( Qt::NoModifier )
+#ifndef QT_NO_CURSOR
+        , cursor( NULL )
+        , restoreCursor( NULL )
+        , hasCursor( false )
+#endif
+        , isEnabled( false )
+        , orientations( Qt::Vertical | Qt::Horizontal )
+    {
     }
 
@@ -59,5 +60,5 @@
 
     Qt::MouseButton button;
-    Qt::KeyboardModifiers  buttonModifiers;
+    Qt::KeyboardModifiers buttonModifiers;
 
     int abortKey;
@@ -71,6 +72,6 @@
 
 #ifndef QT_NO_CURSOR
-    QCursor *cursor;
-    QCursor *restoreCursor;
+    QCursor* cursor;
+    QCursor* restoreCursor;
     bool hasCursor;
 #endif
@@ -80,12 +81,12 @@
 
 /*!
-  Creates an panner that is enabled for the left mouse button.
-
-  \param parent Parent widget to be panned
-*/
-QwtPanner::QwtPanner( QWidget *parent ):
-    QWidget( parent )
-{
-    d_data = new PrivateData();
+   Creates an panner that is enabled for the left mouse button.
+
+   \param parent Parent widget to be panned
+ */
+QwtPanner::QwtPanner( QWidget* parent )
+    : QWidget( parent )
+{
+    m_data = new PrivateData();
 
     setAttribute( Qt::WA_TransparentForMouseEvents );
@@ -100,5 +101,5 @@
 QwtPanner::~QwtPanner()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -106,18 +107,18 @@
    Change the mouse button and modifiers used for panning
    The defaults are Qt::LeftButton and Qt::NoModifier
-*/
+ */
 void QwtPanner::setMouseButton( Qt::MouseButton button,
     Qt::KeyboardModifiers modifiers )
 {
-    d_data->button = button;
-    d_data->buttonModifiers = modifiers;
+    m_data->button = button;
+    m_data->buttonModifiers = modifiers;
 }
 
 //! Get mouse button and modifiers used for panning
-void QwtPanner::getMouseButton( Qt::MouseButton &button,
-    Qt::KeyboardModifiers &modifiers ) const
-{
-    button = d_data->button;
-    modifiers = d_data->buttonModifiers;
+void QwtPanner::getMouseButton( Qt::MouseButton& button,
+    Qt::KeyboardModifiers& modifiers ) const
+{
+    button = m_data->button;
+    modifiers = m_data->buttonModifiers;
 }
 
@@ -128,18 +129,18 @@
    \param key Key ( See Qt::Keycode )
    \param modifiers Keyboard modifiers
-*/
+ */
 void QwtPanner::setAbortKey( int key,
     Qt::KeyboardModifiers modifiers )
 {
-    d_data->abortKey = key;
-    d_data->abortKeyModifiers = modifiers;
+    m_data->abortKey = key;
+    m_data->abortKeyModifiers = modifiers;
 }
 
 //! Get the abort key and modifiers
-void QwtPanner::getAbortKey( int &key,
-    Qt::KeyboardModifiers &modifiers ) const
-{
-    key = d_data->abortKey;
-    modifiers = d_data->abortKeyModifiers;
+void QwtPanner::getAbortKey( int& key,
+    Qt::KeyboardModifiers& modifiers ) const
+{
+    key = m_data->abortKey;
+    modifiers = m_data->abortKeyModifiers;
 }
 
@@ -151,9 +152,9 @@
 
    \sa setCursor()
-*/
-#ifndef QT_NO_CURSOR
-void QwtPanner::setCursor( const QCursor &cursor )
-{
-    d_data->cursor = new QCursor( cursor );
+ */
+#ifndef QT_NO_CURSOR
+void QwtPanner::setCursor( const QCursor& cursor )
+{
+    m_data->cursor = new QCursor( cursor );
 }
 #endif
@@ -162,10 +163,10 @@
    \return Cursor that is active while panning
    \sa setCursor()
-*/
+ */
 #ifndef QT_NO_CURSOR
 const QCursor QwtPanner::cursor() const
 {
-    if ( d_data->cursor )
-        return *d_data->cursor;
+    if ( m_data->cursor )
+        return *m_data->cursor;
 
     if ( parentWidget() )
@@ -177,22 +178,22 @@
 
 /*!
-  \brief En/disable the panner
-
-  When enabled is true an event filter is installed for
-  the observed widget, otherwise the event filter is removed.
-
-  \param on true or false
-  \sa isEnabled(), eventFilter()
-*/
+   \brief En/disable the panner
+
+   When enabled is true an event filter is installed for
+   the observed widget, otherwise the event filter is removed.
+
+   \param on true or false
+   \sa isEnabled(), eventFilter()
+ */
 void QwtPanner::setEnabled( bool on )
 {
-    if ( d_data->isEnabled != on )
-    {
-        d_data->isEnabled = on;
-
-        QWidget *w = parentWidget();
+    if ( m_data->isEnabled != on )
+    {
+        m_data->isEnabled = on;
+
+        QWidget* w = parentWidget();
         if ( w )
         {
-            if ( d_data->isEnabled )
+            if ( m_data->isEnabled )
             {
                 w->installEventFilter( this );
@@ -212,14 +213,14 @@
 
    /param o Orientation
-*/
+ */
 void QwtPanner::setOrientations( Qt::Orientations o )
 {
-    d_data->orientations = o;
-}
-
-//! Return the orientation, where paning is enabled
+    m_data->orientations = o;
+}
+
+//! Return the orientation, where panning is enabled
 Qt::Orientations QwtPanner::orientations() const
 {
-    return d_data->orientations;
+    return m_data->orientations;
 }
 
@@ -227,17 +228,17 @@
    \return True if an orientation is enabled
    \sa orientations(), setOrientations()
-*/
+ */
 bool QwtPanner::isOrientationEnabled( Qt::Orientation o ) const
 {
-    return d_data->orientations & o;
-}
-
-/*!
-  \return true when enabled, false otherwise
-  \sa setEnabled, eventFilter()
-*/
+    return m_data->orientations & o;
+}
+
+/*!
+   \return true when enabled, false otherwise
+   \sa setEnabled, eventFilter()
+ */
 bool QwtPanner::isEnabled() const
 {
-    return d_data->isEnabled;
+    return m_data->isEnabled;
 }
 
@@ -249,15 +250,12 @@
 
    \param event Paint event
-*/
-void QwtPanner::paintEvent( QPaintEvent *event )
-{
-    int dx = d_data->pos.x() - d_data->initialPos.x();
-    int dy = d_data->pos.y() - d_data->initialPos.y();
+ */
+void QwtPanner::paintEvent( QPaintEvent* event )
+{
+    int dx = m_data->pos.x() - m_data->initialPos.x();
+    int dy = m_data->pos.y() - m_data->initialPos.y();
 
     QRectF r;
-    r.setSize( d_data->pixmap.size() );
-#if QT_VERSION >= 0x050000
-    r.setSize( r.size() / d_data->pixmap.devicePixelRatio() );
-#endif
+    r.setSize( m_data->pixmap.size() / QwtPainter::devicePixelRatio( &m_data->pixmap ) );
     r.moveCenter( QPointF( r.center().x() + dx, r.center().y() + dy ) );
 
@@ -267,19 +265,19 @@
     QPainter painter( &pm );
 
-    if ( !d_data->contentsMask.isNull() )
-    {
-        QPixmap masked = d_data->pixmap;
-        masked.setMask( d_data->contentsMask );
+    if ( !m_data->contentsMask.isNull() )
+    {
+        QPixmap masked = m_data->pixmap;
+        masked.setMask( m_data->contentsMask );
         painter.drawPixmap( r.toRect(), masked );
     }
     else
     {
-        painter.drawPixmap( r.toRect(), d_data->pixmap );
+        painter.drawPixmap( r.toRect(), m_data->pixmap );
     }
 
     painter.end();
 
-    if ( !d_data->contentsMask.isNull() )
-        pm.setMask( d_data->contentsMask );
+    if ( !m_data->contentsMask.isNull() )
+        pm.setMask( m_data->contentsMask );
 
     painter.begin( this );
@@ -289,12 +287,12 @@
 
 /*!
-  \brief Calculate a mask for the contents of the panned widget
-
-  Sometimes only parts of the contents of a widget should be
-  panned. F.e. for a widget with a styled background with rounded borders
-  only the area inside of the border should be panned.
-
-  \return An empty bitmap, indicating no mask
-*/
+   \brief Calculate a mask for the contents of the panned widget
+
+   Sometimes only parts of the contents of a widget should be
+   panned. F.e. for a widget with a styled background with rounded borders
+   only the area inside of the border should be panned.
+
+   \return An empty bitmap, indicating no mask
+ */
 QBitmap QwtPanner::contentsMask() const
 {
@@ -303,7 +301,7 @@
 
 /*!
-  Grab the widget into a pixmap.
-  \return Grabbed pixmap
-*/
+   Grab the widget into a pixmap.
+   \return Grabbed pixmap
+ */
 QPixmap QwtPanner::grab() const
 {
@@ -316,19 +314,19 @@
 
 /*!
-  \brief Event filter
-
-  When isEnabled() is true mouse events of the
-  observed widget are filtered.
-
-  \param object Object to be filtered
-  \param event Event
-
-  \return Always false, beside for paint events for the
+   \brief Event filter
+
+   When isEnabled() is true mouse events of the
+   observed widget are filtered.
+
+   \param object Object to be filtered
+   \param event Event
+
+   \return Always false, beside for paint events for the
           parent widget.
 
-  \sa widgetMousePressEvent(), widgetMouseReleaseEvent(),
+   \sa widgetMousePressEvent(), widgetMouseReleaseEvent(),
       widgetMouseMoveEvent()
-*/
-bool QwtPanner::eventFilter( QObject *object, QEvent *event )
+ */
+bool QwtPanner::eventFilter( QObject* object, QEvent* event )
 {
     if ( object == NULL || object != parentWidget() )
@@ -339,25 +337,25 @@
         case QEvent::MouseButtonPress:
         {
-            widgetMousePressEvent( static_cast<QMouseEvent *>( event ) );
+            widgetMousePressEvent( static_cast< QMouseEvent* >( event ) );
             break;
         }
         case QEvent::MouseMove:
         {
-            widgetMouseMoveEvent( static_cast<QMouseEvent *>( event ) );
+            widgetMouseMoveEvent( static_cast< QMouseEvent* >( event ) );
             break;
         }
         case QEvent::MouseButtonRelease:
         {
-            widgetMouseReleaseEvent( static_cast<QMouseEvent *>( event ) );
+            widgetMouseReleaseEvent( static_cast< QMouseEvent* >( event ) );
             break;
         }
         case QEvent::KeyPress:
         {
-            widgetKeyPressEvent( static_cast<QKeyEvent *>( event ) );
+            widgetKeyPressEvent( static_cast< QKeyEvent* >( event ) );
             break;
         }
         case QEvent::KeyRelease:
         {
-            widgetKeyReleaseEvent( static_cast<QKeyEvent *>( event ) );
+            widgetKeyReleaseEvent( static_cast< QKeyEvent* >( event ) );
             break;
         }
@@ -375,19 +373,19 @@
 
 /*!
-  Handle a mouse press event for the observed widget.
-
-  \param mouseEvent Mouse event
-  \sa eventFilter(), widgetMouseReleaseEvent(),
+   Handle a mouse press event for the observed widget.
+
+   \param mouseEvent Mouse event
+   \sa eventFilter(), widgetMouseReleaseEvent(),
       widgetMouseMoveEvent(),
-*/
-void QwtPanner::widgetMousePressEvent( QMouseEvent *mouseEvent )
-{
-    if ( ( mouseEvent->button() != d_data->button )
-        || ( mouseEvent->modifiers() != d_data->buttonModifiers ) )
+ */
+void QwtPanner::widgetMousePressEvent( QMouseEvent* mouseEvent )
+{
+    if ( ( mouseEvent->button() != m_data->button )
+        || ( mouseEvent->modifiers() != m_data->buttonModifiers ) )
     {
         return;
     }
 
-    QWidget *w = parentWidget();
+    QWidget* w = parentWidget();
     if ( w == NULL )
         return;
@@ -397,15 +395,15 @@
 #endif
 
-    d_data->initialPos = d_data->pos = mouseEvent->pos();
+    m_data->initialPos = m_data->pos = mouseEvent->pos();
 
     setGeometry( parentWidget()->rect() );
 
     // We don't want to grab the picker !
-    QVector<QwtPicker *> pickers = qwtActivePickers( parentWidget() );
+    QVector< QwtPicker* > pickers = qwtActivePickers( parentWidget() );
     for ( int i = 0; i < pickers.size(); i++ )
         pickers[i]->setEnabled( false );
 
-    d_data->pixmap = grab();
-    d_data->contentsMask = contentsMask();
+    m_data->pixmap = grab();
+    m_data->contentsMask = contentsMask();
 
     for ( int i = 0; i < pickers.size(); i++ )
@@ -416,10 +414,10 @@
 
 /*!
-  Handle a mouse move event for the observed widget.
-
-  \param mouseEvent Mouse event
-  \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent()
-*/
-void QwtPanner::widgetMouseMoveEvent( QMouseEvent *mouseEvent )
+   Handle a mouse move event for the observed widget.
+
+   \param mouseEvent Mouse event
+   \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent()
+ */
+void QwtPanner::widgetMouseMoveEvent( QMouseEvent* mouseEvent )
 {
     if ( !isVisible() )
@@ -428,26 +426,26 @@
     QPoint pos = mouseEvent->pos();
     if ( !isOrientationEnabled( Qt::Horizontal ) )
-        pos.setX( d_data->initialPos.x() );
+        pos.setX( m_data->initialPos.x() );
     if ( !isOrientationEnabled( Qt::Vertical ) )
-        pos.setY( d_data->initialPos.y() );
-
-    if ( pos != d_data->pos && rect().contains( pos ) )
-    {
-        d_data->pos = pos;
+        pos.setY( m_data->initialPos.y() );
+
+    if ( pos != m_data->pos && rect().contains( pos ) )
+    {
+        m_data->pos = pos;
         update();
 
-        Q_EMIT moved( d_data->pos.x() - d_data->initialPos.x(),
-            d_data->pos.y() - d_data->initialPos.y() );
-    }
-}
-
-/*!
-  Handle a mouse release event for the observed widget.
-
-  \param mouseEvent Mouse event
-  \sa eventFilter(), widgetMousePressEvent(),
+        Q_EMIT moved( m_data->pos.x() - m_data->initialPos.x(),
+            m_data->pos.y() - m_data->initialPos.y() );
+    }
+}
+
+/*!
+   Handle a mouse release event for the observed widget.
+
+   \param mouseEvent Mouse event
+   \sa eventFilter(), widgetMousePressEvent(),
       widgetMouseMoveEvent(),
-*/
-void QwtPanner::widgetMouseReleaseEvent( QMouseEvent *mouseEvent )
+ */
+void QwtPanner::widgetMouseReleaseEvent( QMouseEvent* mouseEvent )
 {
     if ( isVisible() )
@@ -460,30 +458,30 @@
         QPoint pos = mouseEvent->pos();
         if ( !isOrientationEnabled( Qt::Horizontal ) )
-            pos.setX( d_data->initialPos.x() );
+            pos.setX( m_data->initialPos.x() );
         if ( !isOrientationEnabled( Qt::Vertical ) )
-            pos.setY( d_data->initialPos.y() );
-
-        d_data->pixmap = QPixmap();
-        d_data->contentsMask = QBitmap();
-        d_data->pos = pos;
-
-        if ( d_data->pos != d_data->initialPos )
-        {
-            Q_EMIT panned( d_data->pos.x() - d_data->initialPos.x(),
-                d_data->pos.y() - d_data->initialPos.y() );
-        }
-    }
-}
-
-/*!
-  Handle a key press event for the observed widget.
-
-  \param keyEvent Key event
-  \sa eventFilter(), widgetKeyReleaseEvent()
-*/
-void QwtPanner::widgetKeyPressEvent( QKeyEvent *keyEvent )
-{
-    if ( ( keyEvent->key() == d_data->abortKey )
-        && ( keyEvent->modifiers() == d_data->abortKeyModifiers ) )
+            pos.setY( m_data->initialPos.y() );
+
+        m_data->pixmap = QPixmap();
+        m_data->contentsMask = QBitmap();
+        m_data->pos = pos;
+
+        if ( m_data->pos != m_data->initialPos )
+        {
+            Q_EMIT panned( m_data->pos.x() - m_data->initialPos.x(),
+                m_data->pos.y() - m_data->initialPos.y() );
+        }
+    }
+}
+
+/*!
+   Handle a key press event for the observed widget.
+
+   \param keyEvent Key event
+   \sa eventFilter(), widgetKeyReleaseEvent()
+ */
+void QwtPanner::widgetKeyPressEvent( QKeyEvent* keyEvent )
+{
+    if ( ( keyEvent->key() == m_data->abortKey )
+        && ( keyEvent->modifiers() == m_data->abortKeyModifiers ) )
     {
         hide();
@@ -492,15 +490,15 @@
         showCursor( false );
 #endif
-        d_data->pixmap = QPixmap();
-    }
-}
-
-/*!
-  Handle a key release event for the observed widget.
-
-  \param keyEvent Key event
-  \sa eventFilter(), widgetKeyReleaseEvent()
-*/
-void QwtPanner::widgetKeyReleaseEvent( QKeyEvent *keyEvent )
+        m_data->pixmap = QPixmap();
+    }
+}
+
+/*!
+   Handle a key release event for the observed widget.
+
+   \param keyEvent Key event
+   \sa eventFilter(), widgetKeyReleaseEvent()
+ */
+void QwtPanner::widgetKeyReleaseEvent( QKeyEvent* keyEvent )
 {
     Q_UNUSED( keyEvent );
@@ -510,12 +508,12 @@
 void QwtPanner::showCursor( bool on )
 {
-    if ( on == d_data->hasCursor )
+    if ( on == m_data->hasCursor )
         return;
 
-    QWidget *w = parentWidget();
-    if ( w == NULL || d_data->cursor == NULL )
+    QWidget* w = parentWidget();
+    if ( w == NULL || m_data->cursor == NULL )
         return;
 
-    d_data->hasCursor = on;
+    m_data->hasCursor = on;
 
     if ( on )
@@ -523,16 +521,16 @@
         if ( w->testAttribute( Qt::WA_SetCursor ) )
         {
-            delete d_data->restoreCursor;
-            d_data->restoreCursor = new QCursor( w->cursor() );
-        }
-        w->setCursor( *d_data->cursor );
+            delete m_data->restoreCursor;
+            m_data->restoreCursor = new QCursor( w->cursor() );
+        }
+        w->setCursor( *m_data->cursor );
     }
     else
     {
-        if ( d_data->restoreCursor )
-        {
-            w->setCursor( *d_data->restoreCursor );
-            delete d_data->restoreCursor;
-            d_data->restoreCursor = NULL;
+        if ( m_data->restoreCursor )
+        {
+            w->setCursor( *m_data->restoreCursor );
+            delete m_data->restoreCursor;
+            m_data->restoreCursor = NULL;
         }
         else
@@ -541,2 +539,4 @@
 }
 #endif
+
+#include "moc_qwt_panner.cpp"
Index: /trunk/BNC/qwt/qwt_panner.h
===================================================================
--- /trunk/BNC/qwt/qwt_panner.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_panner.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,34 +9,34 @@
 
 #ifndef QWT_PANNER_H
-#define QWT_PANNER_H 1
+#define QWT_PANNER_H
 
 #include "qwt_global.h"
 #include <qwidget.h>
-#include <qpixmap.h>
 
 class QCursor;
+class QPixmap;
 
 /*!
-  \brief QwtPanner provides panning of a widget
+   \brief QwtPanner provides panning of a widget
 
-  QwtPanner grabs the contents of a widget, that can be dragged
-  in all directions. The offset between the start and the end position
-  is emitted by the panned signal.
+   QwtPanner grabs the contents of a widget, that can be dragged
+   in all directions. The offset between the start and the end position
+   is emitted by the panned signal.
 
-  QwtPanner grabs the content of the widget into a pixmap and moves
-  the pixmap around, without initiating any repaint events for the widget.
-  Areas, that are not part of content are not painted  while panning.
-  This makes panning fast enough for widgets, where
-  repaints are too slow for mouse movements.
+   QwtPanner grabs the content of the widget into a pixmap and moves
+   the pixmap around, without initiating any repaint events for the widget.
+   Areas, that are not part of content are not painted  while panning.
+   This makes panning fast enough for widgets, where
+   repaints are too slow for mouse movements.
 
-  For widgets, where repaints are very fast it might be better to
-  implement panning manually by mapping mouse events into paint events.
-*/
-class QWT_EXPORT QwtPanner: public QWidget
+   For widgets, where repaints are very fast it might be better to
+   implement panning manually by mapping mouse events into paint events.
+ */
+class QWT_EXPORT QwtPanner : public QWidget
 {
     Q_OBJECT
 
-public:
-    QwtPanner( QWidget* parent );
+  public:
+    explicit QwtPanner( QWidget* parent );
     virtual ~QwtPanner();
 
@@ -46,11 +46,11 @@
     void setMouseButton( Qt::MouseButton,
         Qt::KeyboardModifiers = Qt::NoModifier );
-    void getMouseButton( Qt::MouseButton &button,
-        Qt::KeyboardModifiers & ) const;
+    void getMouseButton( Qt::MouseButton& button,
+        Qt::KeyboardModifiers& ) const;
 
     void setAbortKey( int key, Qt::KeyboardModifiers = Qt::NoModifier );
-    void getAbortKey( int &key, Qt::KeyboardModifiers & ) const;
+    void getAbortKey( int& key, Qt::KeyboardModifiers& ) const;
 
-    void setCursor( const QCursor & );
+    void setCursor( const QCursor& );
     const QCursor cursor() const;
 
@@ -60,37 +60,37 @@
     bool isOrientationEnabled( Qt::Orientation ) const;
 
-    virtual bool eventFilter( QObject *, QEvent * );
+    virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
 
-Q_SIGNALS:
+  Q_SIGNALS:
     /*!
-      Signal emitted, when panning is done
+       Signal emitted, when panning is done
 
-      \param dx Offset in horizontal direction
-      \param dy Offset in vertical direction
-    */
+       \param dx Offset in horizontal direction
+       \param dy Offset in vertical direction
+     */
     void panned( int dx, int dy );
 
     /*!
-      Signal emitted, while the widget moved, but panning
-      is not finished.
+       Signal emitted, while the widget moved, but panning
+       is not finished.
 
-      \param dx Offset in horizontal direction
-      \param dy Offset in vertical direction
-    */
+       \param dx Offset in horizontal direction
+       \param dy Offset in vertical direction
+     */
     void moved( int dx, int dy );
 
-protected:
-    virtual void widgetMousePressEvent( QMouseEvent * );
-    virtual void widgetMouseReleaseEvent( QMouseEvent * );
-    virtual void widgetMouseMoveEvent( QMouseEvent * );
-    virtual void widgetKeyPressEvent( QKeyEvent * );
-    virtual void widgetKeyReleaseEvent( QKeyEvent * );
+  protected:
+    virtual void widgetMousePressEvent( QMouseEvent* );
+    virtual void widgetMouseReleaseEvent( QMouseEvent* );
+    virtual void widgetMouseMoveEvent( QMouseEvent* );
+    virtual void widgetKeyPressEvent( QKeyEvent* );
+    virtual void widgetKeyReleaseEvent( QKeyEvent* );
 
-    virtual void paintEvent( QPaintEvent * );
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
 
     virtual QBitmap contentsMask() const;
     virtual QPixmap grab() const;
 
-private:
+  private:
 #ifndef QT_NO_CURSOR
     void showCursor( bool );
@@ -98,5 +98,5 @@
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_picker.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_picker.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_picker.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,15 +13,14 @@
 #include "qwt_math.h"
 #include "qwt_widget_overlay.h"
-#include <qapplication.h>
+#include "qwt_text.h"
+
 #include <qevent.h>
 #include <qpainter.h>
-#include <qframe.h>
+#include <qpainterpath.h>
 #include <qcursor.h>
-#include <qbitmap.h>
 #include <qpointer.h>
-#include <qpaintengine.h>
 #include <qmath.h>
 
-static inline QRegion qwtMaskRegion( const QRect &r, int penWidth )
+static inline QRegion qwtMaskRegion( const QRect& r, int penWidth )
 {
     const int pw = qMax( penWidth, 1 );
@@ -44,5 +43,5 @@
 }
 
-static inline QRegion qwtMaskRegion( const QLine &l, int penWidth )
+static inline QRegion qwtMaskRegion( const QLine& l, int penWidth )
 {
     const int pw = qMax( penWidth, 1 );
@@ -65,32 +64,60 @@
 }
 
-class QwtPickerRubberband: public QwtWidgetOverlay
-{
-public:
-    QwtPickerRubberband( QwtPicker *, QWidget * );
-
-protected:
-    virtual void drawOverlay( QPainter * ) const;
-    virtual QRegion maskHint() const;
-
-    QwtPicker *d_picker;
-};
-
-class QwtPickerTracker: public QwtWidgetOverlay
-{
-public:
-    QwtPickerTracker( QwtPicker *, QWidget * );
-
-protected:
-    virtual void drawOverlay( QPainter * ) const;
-    virtual QRegion maskHint() const;
-
-    QwtPicker *d_picker;
-};
-
+namespace
+{
+    class Rubberband QWT_FINAL : public QwtWidgetOverlay
+    {
+      public:
+        Rubberband( QwtPicker* picker, QWidget* parent )
+            : QwtWidgetOverlay( parent )
+            , m_picker( picker )
+        {
+            setMaskMode( QwtWidgetOverlay::MaskHint );
+        }
+
+      protected:
+        virtual void drawOverlay( QPainter* painter ) const QWT_OVERRIDE
+        {
+            painter->setPen( m_picker->rubberBandPen() );
+            m_picker->drawRubberBand( painter );
+        }
+
+        virtual QRegion maskHint() const QWT_OVERRIDE
+        {
+            return m_picker->rubberBandMask();
+        }
+
+        QwtPicker* m_picker;
+    };
+
+    class Tracker QWT_FINAL : public QwtWidgetOverlay
+    {
+      public:
+        Tracker( QwtPicker* picker, QWidget* parent )
+            : QwtWidgetOverlay( parent )
+            , m_picker( picker )
+        {
+            setMaskMode( QwtWidgetOverlay::MaskHint );
+        }
+
+      protected:
+        virtual void drawOverlay( QPainter* painter ) const QWT_OVERRIDE
+        {
+            painter->setPen( m_picker->trackerPen() );
+            m_picker->drawTracker( painter );
+        }
+
+        virtual QRegion maskHint() const QWT_OVERRIDE
+        {
+            return m_picker->trackerMask();
+        }
+
+        QwtPicker* m_picker;
+    };
+}
 
 class QwtPicker::PrivateData
 {
-public:
+  public:
     PrivateData():
         enabled( false ),
@@ -108,5 +135,5 @@
     bool enabled;
 
-    QwtPickerMachine *stateMachine;
+    QwtPickerMachine* stateMachine;
 
     QwtPicker::ResizeMode resizeMode;
@@ -125,58 +152,20 @@
     bool mouseTracking; // used to save previous value
 
-    QPointer< QwtPickerRubberband > rubberBandOverlay;
-    QPointer< QwtPickerTracker> trackerOverlay;
+    QPointer< Rubberband > rubberBandOverlay;
+    QPointer< Tracker > trackerOverlay;
 
     bool openGL;
 };
 
-QwtPickerRubberband::QwtPickerRubberband(
-        QwtPicker *picker, QWidget *parent ):
-    QwtWidgetOverlay( parent ),
-    d_picker( picker )
-{
-    setMaskMode( QwtWidgetOverlay::MaskHint );
-}
-
-QRegion QwtPickerRubberband::maskHint() const
-{
-    return d_picker->rubberBandMask();
-}
-
-void QwtPickerRubberband::drawOverlay( QPainter *painter ) const
-{
-    painter->setPen( d_picker->rubberBandPen() );
-    d_picker->drawRubberBand( painter );
-}
-
-QwtPickerTracker::QwtPickerTracker(
-        QwtPicker *picker, QWidget *parent ):
-    QwtWidgetOverlay( parent ),
-    d_picker( picker )
-{
-    setMaskMode( QwtWidgetOverlay::MaskHint );
-}
-
-QRegion QwtPickerTracker::maskHint() const
-{
-    return d_picker->trackerRect( font() );
-}
-
-void QwtPickerTracker::drawOverlay( QPainter *painter ) const
-{
-    painter->setPen( d_picker->trackerPen() );
-    d_picker->drawTracker( painter );
-}
-
-/*!
-  Constructor
-
-  Creates an picker that is enabled, but without a state machine.
-  rubber band and tracker are disabled.
-
-  \param parent Parent widget, that will be observed
- */
-
-QwtPicker::QwtPicker( QWidget *parent ):
+/*!
+   Constructor
+
+   Creates an picker that is enabled, but without a state machine.
+   rubber band and tracker are disabled.
+
+   \param parent Parent widget, that will be observed
+ */
+
+QwtPicker::QwtPicker( QWidget* parent ):
     QObject( parent )
 {
@@ -185,12 +174,12 @@
 
 /*!
-  Constructor
-
-  \param rubberBand Rubber band style
-  \param trackerMode Tracker mode
-  \param parent Parent widget, that will be observed
+   Constructor
+
+   \param rubberBand Rubber band style
+   \param trackerMode Tracker mode
+   \param parent Parent widget, that will be observed
  */
 QwtPicker::QwtPicker( RubberBand rubberBand,
-        DisplayMode trackerMode, QWidget *parent ):
+    DisplayMode trackerMode, QWidget* parent ):
     QObject( parent )
 {
@@ -203,18 +192,18 @@
     setMouseTracking( false );
 
-    delete d_data->stateMachine;
-    delete d_data->rubberBandOverlay;
-    delete d_data->trackerOverlay;
-
-    delete d_data;
+    delete m_data->stateMachine;
+    delete m_data->rubberBandOverlay;
+    delete m_data->trackerOverlay;
+
+    delete m_data;
 }
 
 //! Initialize the picker - used by the constructors
-void QwtPicker::init( QWidget *parent,
+void QwtPicker::init( QWidget* parent,
     RubberBand rubberBand, DisplayMode trackerMode )
 {
-    d_data = new PrivateData;
-
-    d_data->rubberBand = rubberBand;
+    m_data = new PrivateData;
+
+    m_data->rubberBand = rubberBand;
 
     if ( parent )
@@ -223,7 +212,7 @@
             parent->setFocusPolicy( Qt::WheelFocus );
 
-        d_data->openGL = parent->inherits( "QGLWidget" );
-        d_data->trackerFont = parent->font();
-        d_data->mouseTracking = parent->hasMouseTracking();
+        m_data->openGL = parent->inherits( "QGLWidget" );
+        m_data->trackerFont = parent->font();
+        m_data->mouseTracking = parent->hasMouseTracking();
 
         setEnabled( true );
@@ -234,47 +223,47 @@
 
 /*!
-  Set a state machine and delete the previous one
-
-  \param stateMachine State machine
-  \sa stateMachine()
-*/
-void QwtPicker::setStateMachine( QwtPickerMachine *stateMachine )
-{
-    if ( d_data->stateMachine != stateMachine )
+   Set a state machine and delete the previous one
+
+   \param stateMachine State machine
+   \sa stateMachine()
+ */
+void QwtPicker::setStateMachine( QwtPickerMachine* stateMachine )
+{
+    if ( m_data->stateMachine != stateMachine )
     {
         reset();
 
-        delete d_data->stateMachine;
-        d_data->stateMachine = stateMachine;
-
-        if ( d_data->stateMachine )
-            d_data->stateMachine->reset();
-    }
-}
-
-/*!
-  \return Assigned state machine
-  \sa setStateMachine()
-*/
-QwtPickerMachine *QwtPicker::stateMachine()
-{
-    return d_data->stateMachine;
-}
-
-/*!
-  \return Assigned state machine
-  \sa setStateMachine()
-*/
-const QwtPickerMachine *QwtPicker::stateMachine() const
-{
-    return d_data->stateMachine;
+        delete m_data->stateMachine;
+        m_data->stateMachine = stateMachine;
+
+        if ( m_data->stateMachine )
+            m_data->stateMachine->reset();
+    }
+}
+
+/*!
+   \return Assigned state machine
+   \sa setStateMachine()
+ */
+QwtPickerMachine* QwtPicker::stateMachine()
+{
+    return m_data->stateMachine;
+}
+
+/*!
+   \return Assigned state machine
+   \sa setStateMachine()
+ */
+const QwtPickerMachine* QwtPicker::stateMachine() const
+{
+    return m_data->stateMachine;
 }
 
 //! Return the parent widget, where the selection happens
-QWidget *QwtPicker::parentWidget()
-{
-    QObject *obj = parent();
+QWidget* QwtPicker::parentWidget()
+{
+    QObject* obj = parent();
     if ( obj && obj->isWidgetType() )
-        return static_cast<QWidget *>( obj );
+        return static_cast< QWidget* >( obj );
 
     return NULL;
@@ -282,9 +271,9 @@
 
 //! Return the parent widget, where the selection happens
-const QWidget *QwtPicker::parentWidget() const
-{
-    QObject *obj = parent();
+const QWidget* QwtPicker::parentWidget() const
+{
+    QObject* obj = parent();
     if ( obj && obj->isWidgetType() )
-        return static_cast< const QWidget *>( obj );
+        return static_cast< const QWidget* >( obj );
 
     return NULL;
@@ -292,104 +281,104 @@
 
 /*!
-  Set the rubber band style
-
-  \param rubberBand Rubber band style
+   Set the rubber band style
+
+   \param rubberBand Rubber band style
          The default value is NoRubberBand.
 
-  \sa rubberBand(), RubberBand, setRubberBandPen()
-*/
+   \sa rubberBand(), RubberBand, setRubberBandPen()
+ */
 void QwtPicker::setRubberBand( RubberBand rubberBand )
 {
-    d_data->rubberBand = rubberBand;
-}
-
-/*!
-  \return Rubber band style
-  \sa setRubberBand(), RubberBand, rubberBandPen()
-*/
+    m_data->rubberBand = rubberBand;
+}
+
+/*!
+   \return Rubber band style
+   \sa setRubberBand(), RubberBand, rubberBandPen()
+ */
 QwtPicker::RubberBand QwtPicker::rubberBand() const
 {
-    return d_data->rubberBand;
-}
-
-/*!
-  \brief Set the display mode of the tracker.
-
-  A tracker displays information about current position of
-  the cursor as a string. The display mode controls
-  if the tracker has to be displayed whenever the observed
-  widget has focus and cursor (AlwaysOn), never (AlwaysOff), or
-  only when the selection is active (ActiveOnly).
-
-  \param mode Tracker display mode
-
-  \warning In case of AlwaysOn, mouseTracking will be enabled
+    return m_data->rubberBand;
+}
+
+/*!
+   \brief Set the display mode of the tracker.
+
+   A tracker displays information about current position of
+   the cursor as a string. The display mode controls
+   if the tracker has to be displayed whenever the observed
+   widget has focus and cursor (AlwaysOn), never (AlwaysOff), or
+   only when the selection is active (ActiveOnly).
+
+   \param mode Tracker display mode
+
+   \warning In case of AlwaysOn, mouseTracking will be enabled
            for the observed widget.
-  \sa trackerMode(), DisplayMode
-*/
+   \sa trackerMode(), DisplayMode
+ */
 
 void QwtPicker::setTrackerMode( DisplayMode mode )
 {
-    if ( d_data->trackerMode != mode )
-    {
-        d_data->trackerMode = mode;
-        setMouseTracking( d_data->trackerMode == AlwaysOn );
-    }
-}
-
-/*!
-  \return Tracker display mode
-  \sa setTrackerMode(), DisplayMode
-*/
+    if ( m_data->trackerMode != mode )
+    {
+        m_data->trackerMode = mode;
+        setMouseTracking( m_data->trackerMode == AlwaysOn );
+    }
+}
+
+/*!
+   \return Tracker display mode
+   \sa setTrackerMode(), DisplayMode
+ */
 QwtPicker::DisplayMode QwtPicker::trackerMode() const
 {
-    return d_data->trackerMode;
-}
-
-/*!
-  \brief Set the resize mode.
-
-  The resize mode controls what to do with the selected points of an active
-  selection when the observed widget is resized.
-
-  Stretch means the points are scaled according to the new
-  size, KeepSize means the points remain unchanged.
-
-  The default mode is Stretch.
-
-  \param mode Resize mode
-  \sa resizeMode(), ResizeMode
-*/
+    return m_data->trackerMode;
+}
+
+/*!
+   \brief Set the resize mode.
+
+   The resize mode controls what to do with the selected points of an active
+   selection when the observed widget is resized.
+
+   Stretch means the points are scaled according to the new
+   size, KeepSize means the points remain unchanged.
+
+   The default mode is Stretch.
+
+   \param mode Resize mode
+   \sa resizeMode(), ResizeMode
+ */
 void QwtPicker::setResizeMode( ResizeMode mode )
 {
-    d_data->resizeMode = mode;
-}
-
-/*!
-  \return Resize mode
-  \sa setResizeMode(), ResizeMode
-*/
+    m_data->resizeMode = mode;
+}
+
+/*!
+   \return Resize mode
+   \sa setResizeMode(), ResizeMode
+ */
 
 QwtPicker::ResizeMode QwtPicker::resizeMode() const
 {
-    return d_data->resizeMode;
-}
-
-/*!
-  \brief En/disable the picker
-
-  When enabled is true an event filter is installed for
-  the observed widget, otherwise the event filter is removed.
-
-  \param enabled true or false
-  \sa isEnabled(), eventFilter()
-*/
+    return m_data->resizeMode;
+}
+
+/*!
+   \brief En/disable the picker
+
+   When enabled is true an event filter is installed for
+   the observed widget, otherwise the event filter is removed.
+
+   \param enabled true or false
+   \sa isEnabled(), eventFilter()
+ */
 void QwtPicker::setEnabled( bool enabled )
 {
-    if ( d_data->enabled != enabled )
-    {
-        d_data->enabled = enabled;
-
-        QWidget *w = parentWidget();
+    if ( m_data->enabled != enabled )
+    {
+        m_data->enabled = enabled;
+
+        QWidget* w = parentWidget();
         if ( w )
         {
@@ -405,24 +394,24 @@
 
 /*!
-  \return true when enabled, false otherwise
-  \sa setEnabled(), eventFilter()
-*/
+   \return true when enabled, false otherwise
+   \sa setEnabled(), eventFilter()
+ */
 
 bool QwtPicker::isEnabled() const
 {
-    return d_data->enabled;
-}
-
-/*!
-  Set the font for the tracker
-
-  \param font Tracker font
-  \sa trackerFont(), setTrackerMode(), setTrackerPen()
-*/
-void QwtPicker::setTrackerFont( const QFont &font )
-{
-    if ( font != d_data->trackerFont )
-    {
-        d_data->trackerFont = font;
+    return m_data->enabled;
+}
+
+/*!
+   Set the font for the tracker
+
+   \param font Tracker font
+   \sa trackerFont(), setTrackerMode(), setTrackerPen()
+ */
+void QwtPicker::setTrackerFont( const QFont& font )
+{
+    if ( font != m_data->trackerFont )
+    {
+        m_data->trackerFont = font;
         updateDisplay();
     }
@@ -430,24 +419,24 @@
 
 /*!
-  \return Tracker font
-  \sa setTrackerFont(), trackerMode(), trackerPen()
-*/
+   \return Tracker font
+   \sa setTrackerFont(), trackerMode(), trackerPen()
+ */
 
 QFont QwtPicker::trackerFont() const
 {
-    return d_data->trackerFont;
-}
-
-/*!
-  Set the pen for the tracker
-
-  \param pen Tracker pen
-  \sa trackerPen(), setTrackerMode(), setTrackerFont()
-*/
-void QwtPicker::setTrackerPen( const QPen &pen )
-{
-    if ( pen != d_data->trackerPen )
-    {
-        d_data->trackerPen = pen;
+    return m_data->trackerFont;
+}
+
+/*!
+   Set the pen for the tracker
+
+   \param pen Tracker pen
+   \sa trackerPen(), setTrackerMode(), setTrackerFont()
+ */
+void QwtPicker::setTrackerPen( const QPen& pen )
+{
+    if ( pen != m_data->trackerPen )
+    {
+        m_data->trackerPen = pen;
         updateDisplay();
     }
@@ -455,23 +444,23 @@
 
 /*!
-  \return Tracker pen
-  \sa setTrackerPen(), trackerMode(), trackerFont()
-*/
+   \return Tracker pen
+   \sa setTrackerPen(), trackerMode(), trackerFont()
+ */
 QPen QwtPicker::trackerPen() const
 {
-    return d_data->trackerPen;
-}
-
-/*!
-  Set the pen for the rubberband
-
-  \param pen Rubber band pen
-  \sa rubberBandPen(), setRubberBand()
-*/
-void QwtPicker::setRubberBandPen( const QPen &pen )
-{
-    if ( pen != d_data->rubberBandPen )
-    {
-        d_data->rubberBandPen = pen;
+    return m_data->trackerPen;
+}
+
+/*!
+   Set the pen for the rubberband
+
+   \param pen Rubber band pen
+   \sa rubberBandPen(), setRubberBand()
+ */
+void QwtPicker::setRubberBandPen( const QPen& pen )
+{
+    if ( pen != m_data->rubberBandPen )
+    {
+        m_data->rubberBandPen = pen;
         updateDisplay();
     }
@@ -479,10 +468,10 @@
 
 /*!
-  \return Rubber band pen
-  \sa setRubberBandPen(), rubberBand()
-*/
+   \return Rubber band pen
+   \sa setRubberBandPen(), rubberBand()
+ */
 QPen QwtPicker::rubberBandPen() const
 {
-    return d_data->rubberBandPen;
+    return m_data->rubberBandPen;
 }
 
@@ -498,7 +487,7 @@
    \param pos Position
    \return Converted position as string
-*/
-
-QwtText QwtPicker::trackerText( const QPoint &pos ) const
+ */
+
+QwtText QwtPicker::trackerText( const QPoint& pos ) const
 {
     QString label;
@@ -507,11 +496,11 @@
     {
         case HLineRubberBand:
-            label.sprintf( "%d", pos.y() );
+            label = QString::number( pos.y() );
             break;
         case VLineRubberBand:
-            label.sprintf( "%d", pos.x() );
+            label = QString::number( pos.x() );
             break;
         default:
-            label.sprintf( "%d, %d", pos.x(), pos.y() );
+            label = QString::number( pos.x() ) + ", " + QString::number( pos.y() );
     }
     return label;
@@ -519,8 +508,19 @@
 
 /*!
-  Calculate the mask for the rubber band overlay
-
-  \return Region for the mask
-  \sa QWidget::setMask()
+   Calculate the mask for the tracker overlay
+
+   \return Region with one rectangle: trackerRect( trackerFont() );
+   \sa QWidget::setMask(), trackerRect()
+ */
+QRegion QwtPicker::trackerMask() const
+{
+    return trackerRect( m_data->trackerFont );
+}
+
+/*!
+   Calculate the mask for the rubber band overlay
+
+   \return Region for the mask
+   \sa QWidget::setMask()
  */
 QRegion QwtPicker::rubberBandMask() const
@@ -534,11 +534,14 @@
     }
 
-    const QPolygon pa = adjustedPoints( d_data->pickedPoints );
+    const QPolygon pa = adjustedPoints( m_data->pickedPoints );
 
     QwtPickerMachine::SelectionType selectionType =
         QwtPickerMachine::NoSelection;
 
-    if ( d_data->stateMachine )
-        selectionType = d_data->stateMachine->selectionType();
+    if ( m_data->stateMachine )
+        selectionType = m_data->stateMachine->selectionType();
+
+    const int pw = qCeil( rubberBandPen().widthF()
+        * QwtPainter::devicePixelRatio( parentWidget() ) );
 
     switch ( selectionType )
@@ -551,5 +554,4 @@
 
             const QPoint pos = pa[0];
-            const int pw = rubberBandPen().width();
 
             const QRect pRect = pickArea().boundingRect().toRect();
@@ -586,6 +588,4 @@
                 return mask;
 
-            const int pw = rubberBandPen().width();
-
             switch ( rubberBand() )
             {
@@ -609,5 +609,4 @@
         case QwtPickerMachine::PolygonSelection:
         {
-            const int pw = rubberBandPen().width();
             if ( pw <= 1 )
             {
@@ -634,7 +633,7 @@
 
    \sa rubberBand(), RubberBand
-*/
-
-void QwtPicker::drawRubberBand( QPainter *painter ) const
+ */
+
+void QwtPicker::drawRubberBand( QPainter* painter ) const
 {
     if ( !isActive() || rubberBand() == NoRubberBand ||
@@ -644,11 +643,11 @@
     }
 
-    const QPolygon pa = adjustedPoints( d_data->pickedPoints );
+    const QPolygon pa = adjustedPoints( m_data->pickedPoints );
 
     QwtPickerMachine::SelectionType selectionType =
         QwtPickerMachine::NoSelection;
 
-    if ( d_data->stateMachine )
-        selectionType = d_data->stateMachine->selectionType();
+    if ( m_data->stateMachine )
+        selectionType = m_data->stateMachine->selectionType();
 
     switch ( selectionType )
@@ -729,12 +728,12 @@
    \param painter Painter
    \sa trackerRect(), trackerText()
-*/
-
-void QwtPicker::drawTracker( QPainter *painter ) const
+ */
+
+void QwtPicker::drawTracker( QPainter* painter ) const
 {
     const QRect textRect = trackerRect( painter->font() );
     if ( !textRect.isEmpty() )
     {
-        const QwtText label = trackerText( d_data->trackerPosition );
+        const QwtText label = trackerText( m_data->trackerPosition );
         if ( !label.isEmpty() )
             label.draw( painter, textRect );
@@ -759,6 +758,6 @@
    point is the center of the selected rectangle.
 
-  \par Example
-  \code
+   \par Example
+   \code
     QPolygon MyPicker::adjustedPoints( const QPolygon &points ) const
     {
@@ -777,11 +776,10 @@
         return adjusted;
     }
-  \endcode
-  \endpar
-
-  \param points Selected points
-  \return Selected points unmodified
-*/
-QPolygon QwtPicker::adjustedPoints( const QPolygon &points ) const
+   \endcode
+
+   \param points Selected points
+   \return Selected points unmodified
+ */
+QPolygon QwtPicker::adjustedPoints( const QPolygon& points ) const
 {
     return points;
@@ -789,10 +787,10 @@
 
 /*!
-  \return Selected points
-  \sa pickedPoints(), adjustedPoints()
-*/
+   \return Selected points
+   \sa pickedPoints(), adjustedPoints()
+ */
 QPolygon QwtPicker::selection() const
 {
-    return adjustedPoints( d_data->pickedPoints );
+    return adjustedPoints( m_data->pickedPoints );
 }
 
@@ -800,5 +798,5 @@
 QPoint QwtPicker::trackerPosition() const
 {
-    return d_data->trackerPosition;
+    return m_data->trackerPosition;
 }
 
@@ -811,6 +809,6 @@
 
    \sa trackerPosition()
-*/
-QRect QwtPicker::trackerRect( const QFont &font ) const
+ */
+QRect QwtPicker::trackerRect( const QFont& font ) const
 {
     if ( trackerMode() == AlwaysOff ||
@@ -820,22 +818,39 @@
     }
 
-    if ( d_data->trackerPosition.x() < 0 || d_data->trackerPosition.y() < 0 )
+    if ( m_data->trackerPosition.x() < 0 || m_data->trackerPosition.y() < 0 )
         return QRect();
 
-    QwtText text = trackerText( d_data->trackerPosition );
+    QwtText text = trackerText( m_data->trackerPosition );
     if ( text.isEmpty() )
         return QRect();
 
     const QSizeF textSize = text.textSize( font );
-    QRect textRect( 0, 0, qCeil( textSize.width() ), qCeil( textSize.height() ) );
-
-    const QPoint &pos = d_data->trackerPosition;
+
+    const int w = qwtCeil( textSize.width() );
+    const int h = qwtCeil( textSize.height() );
+
+    return trackerRect( QSize( w, h ) );
+}
+
+/*! 
+   Calculate the geometry of the tracker that is needed to display
+   information of a specific size at the tracker position
+    
+   \param size Size 
+   \return Bounding rectangle of the tracker
+    
+   \sa trackerPosition()
+ */
+QRect QwtPicker::trackerRect( const QSize& size ) const
+{
+    const QPoint& pos = m_data->trackerPosition;
+    QRect infoRect( 0, 0, size.width(), size.height() );
 
     int alignment = 0;
-    if ( isActive() && d_data->pickedPoints.count() > 1
+    if ( isActive() && m_data->pickedPoints.count() > 1
         && rubberBand() != NoRubberBand )
     {
         const QPoint last =
-            d_data->pickedPoints[ d_data->pickedPoints.count() - 2 ];
+            m_data->pickedPoints[ m_data->pickedPoints.count() - 2 ];
 
         alignment |= ( pos.x() >= last.x() ) ? Qt::AlignRight : Qt::AlignLeft;
@@ -843,5 +858,7 @@
     }
     else
+    {
         alignment = Qt::AlignTop | Qt::AlignRight;
+    }
 
     const int margin = 5;
@@ -849,5 +866,5 @@
     int x = pos.x();
     if ( alignment & Qt::AlignLeft )
-        x -= textRect.width() + margin;
+        x -= infoRect.width() + margin;
     else if ( alignment & Qt::AlignRight )
         x += margin;
@@ -857,41 +874,41 @@
         y += margin;
     else if ( alignment & Qt::AlignTop )
-        y -= textRect.height() + margin;
-
-    textRect.moveTopLeft( QPoint( x, y ) );
+        y -= infoRect.height() + margin;
+
+    infoRect.moveTopLeft( QPoint( x, y ) );
 
     const QRect pickRect = pickArea().boundingRect().toRect();
 
-    int right = qMin( textRect.right(), pickRect.right() - margin );
-    int bottom = qMin( textRect.bottom(), pickRect.bottom() - margin );
-    textRect.moveBottomRight( QPoint( right, bottom ) );
-
-    int left = qMax( textRect.left(), pickRect.left() + margin );
-    int top = qMax( textRect.top(), pickRect.top() + margin );
-    textRect.moveTopLeft( QPoint( left, top ) );
-
-    return textRect;
-}
-
-/*!
-  \brief Event filter
-
-  When isEnabled() is true all events of the observed widget are filtered.
-  Mouse and keyboard events are translated into widgetMouse- and widgetKey-
-  and widgetWheel-events. Paint and Resize events are handled to keep
-  rubber band and tracker up to date.
-
-  \param object Object to be filtered
-  \param event Event
-
-  \return Always false.
-
-  \sa widgetEnterEvent(), widgetLeaveEvent(),
+    int right = qMin( infoRect.right(), pickRect.right() - margin );
+    int bottom = qMin( infoRect.bottom(), pickRect.bottom() - margin );
+    infoRect.moveBottomRight( QPoint( right, bottom ) );
+
+    int left = qMax( infoRect.left(), pickRect.left() + margin );
+    int top = qMax( infoRect.top(), pickRect.top() + margin );
+    infoRect.moveTopLeft( QPoint( left, top ) );
+
+    return infoRect;
+}
+
+/*!
+   \brief Event filter
+
+   When isEnabled() is true all events of the observed widget are filtered.
+   Mouse and keyboard events are translated into widgetMouse- and widgetKey-
+   and widgetWheel-events. Paint and Resize events are handled to keep
+   rubber band and tracker up to date.
+
+   \param object Object to be filtered
+   \param event Event
+
+   \return Always false.
+
+   \sa widgetEnterEvent(), widgetLeaveEvent(),
       widgetMousePressEvent(), widgetMouseReleaseEvent(),
       widgetMouseDoubleClickEvent(), widgetMouseMoveEvent(),
       widgetWheelEvent(), widgetKeyPressEvent(), widgetKeyReleaseEvent(),
       QObject::installEventFilter(), QObject::event()
-*/
-bool QwtPicker::eventFilter( QObject *object, QEvent *event )
+ */
+bool QwtPicker::eventFilter( QObject* object, QEvent* event )
 {
     if ( object && object == parentWidget() )
@@ -901,19 +918,19 @@
             case QEvent::Resize:
             {
-                const QResizeEvent *re = static_cast<QResizeEvent *>( event );
+                const QResizeEvent* re = static_cast< QResizeEvent* >( event );
 
                 /*
                    Adding/deleting additional event filters inside of an event filter
-                   is not safe dues to the implementation in Qt ( changing alist while iterating ).
+                   is not safe dues to the implementation in Qt ( changing a list while iterating ).
                    So we create the overlays in a way, that they don't install en event filter
                    ( parent set to NULL ) and do the resizing here.
                  */
-                if ( d_data->trackerOverlay )
-                    d_data->trackerOverlay->resize( re->size() );
-
-                if ( d_data->rubberBandOverlay )
-                    d_data->rubberBandOverlay->resize( re->size() );
-
-                if ( d_data->resizeMode == Stretch )
+                if ( m_data->trackerOverlay )
+                    m_data->trackerOverlay->resize( re->size() );
+
+                if ( m_data->rubberBandOverlay )
+                    m_data->rubberBandOverlay->resize( re->size() );
+
+                if ( m_data->resizeMode == Stretch )
                     stretchSelection( re->oldSize(), re->size() );
 
@@ -933,35 +950,35 @@
             case QEvent::MouseButtonPress:
             {
-                widgetMousePressEvent( static_cast<QMouseEvent *>( event ) );
+                widgetMousePressEvent( static_cast< QMouseEvent* >( event ) );
                 break;
             }
             case QEvent::MouseButtonRelease:
             {
-                widgetMouseReleaseEvent( static_cast<QMouseEvent *>( event ) );
+                widgetMouseReleaseEvent( static_cast< QMouseEvent* >( event ) );
                 break;
             }
             case QEvent::MouseButtonDblClick:
             {
-                widgetMouseDoubleClickEvent( static_cast<QMouseEvent *>( event ) );
+                widgetMouseDoubleClickEvent( static_cast< QMouseEvent* >( event ) );
                 break;
             }
             case QEvent::MouseMove:
             {
-                widgetMouseMoveEvent( static_cast<QMouseEvent *>( event ) );
+                widgetMouseMoveEvent( static_cast< QMouseEvent* >( event ) );
                 break;
             }
             case QEvent::KeyPress:
             {
-                widgetKeyPressEvent( static_cast<QKeyEvent *>( event ) );
+                widgetKeyPressEvent( static_cast< QKeyEvent* >( event ) );
                 break;
             }
             case QEvent::KeyRelease:
             {
-                widgetKeyReleaseEvent( static_cast<QKeyEvent *>( event ) );
+                widgetKeyReleaseEvent( static_cast< QKeyEvent* >( event ) );
                 break;
             }
             case QEvent::Wheel:
             {
-                widgetWheelEvent( static_cast<QWheelEvent *>( event ) );
+                widgetWheelEvent( static_cast< QWheelEvent* >( event ) );
                 break;
             }
@@ -974,13 +991,13 @@
 
 /*!
-  Handle a mouse press event for the observed widget.
-
-  \param mouseEvent Mouse event
-
-  \sa eventFilter(), widgetMouseReleaseEvent(),
+   Handle a mouse press event for the observed widget.
+
+   \param mouseEvent Mouse event
+
+   \sa eventFilter(), widgetMouseReleaseEvent(),
       widgetMouseDoubleClickEvent(), widgetMouseMoveEvent(),
       widgetWheelEvent(), widgetKeyPressEvent(), widgetKeyReleaseEvent()
-*/
-void QwtPicker::widgetMousePressEvent( QMouseEvent *mouseEvent )
+ */
+void QwtPicker::widgetMousePressEvent( QMouseEvent* mouseEvent )
 {
     transition( mouseEvent );
@@ -988,18 +1005,18 @@
 
 /*!
-  Handle a mouse move event for the observed widget.
-
-  \param mouseEvent Mouse event
-
-  \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
+   Handle a mouse move event for the observed widget.
+
+   \param mouseEvent Mouse event
+
+   \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
       widgetMouseDoubleClickEvent(),
       widgetWheelEvent(), widgetKeyPressEvent(), widgetKeyReleaseEvent()
-*/
-void QwtPicker::widgetMouseMoveEvent( QMouseEvent *mouseEvent )
+ */
+void QwtPicker::widgetMouseMoveEvent( QMouseEvent* mouseEvent )
 {
     if ( pickArea().contains( mouseEvent->pos() ) )
-        d_data->trackerPosition = mouseEvent->pos();
+        m_data->trackerPosition = mouseEvent->pos();
     else
-        d_data->trackerPosition = QPoint( -1, -1 );
+        m_data->trackerPosition = QPoint( -1, -1 );
 
     if ( !isActive() )
@@ -1010,13 +1027,13 @@
 
 /*!
-  Handle a enter event for the observed widget.
-
-  \param event Qt event
-
-  \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
+   Handle a enter event for the observed widget.
+
+   \param event Qt event
+
+   \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
       widgetMouseDoubleClickEvent(),
       widgetWheelEvent(), widgetKeyPressEvent(), widgetKeyReleaseEvent()
-*/
-void QwtPicker::widgetEnterEvent( QEvent *event )
+ */
+void QwtPicker::widgetEnterEvent( QEvent* event )
 {
     transition( event );
@@ -1024,17 +1041,17 @@
 
 /*!
-  Handle a leave event for the observed widget.
-
-  \param event Qt event
-
-  \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
+   Handle a leave event for the observed widget.
+
+   \param event Qt event
+
+   \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
       widgetMouseDoubleClickEvent(),
       widgetWheelEvent(), widgetKeyPressEvent(), widgetKeyReleaseEvent()
-*/
-void QwtPicker::widgetLeaveEvent( QEvent *event )
+ */
+void QwtPicker::widgetLeaveEvent( QEvent* event )
 {
     transition( event );
 
-    d_data->trackerPosition = QPoint( -1, -1 );
+    m_data->trackerPosition = QPoint( -1, -1 );
     if ( !isActive() )
         updateDisplay();
@@ -1042,13 +1059,13 @@
 
 /*!
-  Handle a mouse release event for the observed widget.
-
-  \param mouseEvent Mouse event
-
-  \sa eventFilter(), widgetMousePressEvent(),
+   Handle a mouse release event for the observed widget.
+
+   \param mouseEvent Mouse event
+
+   \sa eventFilter(), widgetMousePressEvent(),
       widgetMouseDoubleClickEvent(), widgetMouseMoveEvent(),
       widgetWheelEvent(), widgetKeyPressEvent(), widgetKeyReleaseEvent()
-*/
-void QwtPicker::widgetMouseReleaseEvent( QMouseEvent *mouseEvent )
+ */
+void QwtPicker::widgetMouseReleaseEvent( QMouseEvent* mouseEvent )
 {
     transition( mouseEvent );
@@ -1056,13 +1073,13 @@
 
 /*!
-  Handle mouse double click event for the observed widget.
-
-  \param mouseEvent Mouse event
-
-  \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
+   Handle mouse double click event for the observed widget.
+
+   \param mouseEvent Mouse event
+
+   \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
       widgetMouseMoveEvent(),
       widgetWheelEvent(), widgetKeyPressEvent(), widgetKeyReleaseEvent()
-*/
-void QwtPicker::widgetMouseDoubleClickEvent( QMouseEvent *mouseEvent )
+ */
+void QwtPicker::widgetMouseDoubleClickEvent( QMouseEvent* mouseEvent )
 {
     transition( mouseEvent );
@@ -1071,20 +1088,25 @@
 
 /*!
-  Handle a wheel event for the observed widget.
-
-  Move the last point of the selection in case of isActive() == true
-
-  \param wheelEvent Wheel event
-
-  \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
+   Handle a wheel event for the observed widget.
+
+   Move the last point of the selection in case of isActive() == true
+
+   \param wheelEvent Wheel event
+
+   \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
       widgetMouseDoubleClickEvent(), widgetMouseMoveEvent(),
       widgetKeyPressEvent(), widgetKeyReleaseEvent()
-*/
-void QwtPicker::widgetWheelEvent( QWheelEvent *wheelEvent )
-{
-    if ( pickArea().contains( wheelEvent->pos() ) )
-        d_data->trackerPosition = wheelEvent->pos();
+ */
+void QwtPicker::widgetWheelEvent( QWheelEvent* wheelEvent )
+{
+#if QT_VERSION < 0x050e00
+    const QPoint wheelPos = wheelEvent->pos();
+#else
+    const QPoint wheelPos = wheelEvent->position().toPoint();
+#endif
+    if ( pickArea().contains( wheelPos ) )
+        m_data->trackerPosition = wheelPos;
     else
-        d_data->trackerPosition = QPoint( -1, -1 );
+        m_data->trackerPosition = QPoint( -1, -1 );
 
     updateDisplay();
@@ -1094,18 +1116,18 @@
 
 /*!
-  Handle a key press event for the observed widget.
-
-  Selections can be completely done by the keyboard. The arrow keys
-  move the cursor, the abort key aborts a selection. All other keys
-  are handled by the current state machine.
-
-  \param keyEvent Key event
-
-  \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
+   Handle a key press event for the observed widget.
+
+   Selections can be completely done by the keyboard. The arrow keys
+   move the cursor, the abort key aborts a selection. All other keys
+   are handled by the current state machine.
+
+   \param keyEvent Key event
+
+   \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
       widgetMouseDoubleClickEvent(), widgetMouseMoveEvent(),
       widgetWheelEvent(), widgetKeyReleaseEvent(), stateMachine(),
       QwtEventPattern::KeyPatternCode
-*/
-void QwtPicker::widgetKeyPressEvent( QKeyEvent *keyEvent )
+ */
+void QwtPicker::widgetKeyPressEvent( QKeyEvent* keyEvent )
 {
     int dx = 0;
@@ -1149,15 +1171,15 @@
 
 /*!
-  Handle a key release event for the observed widget.
-
-  Passes the event to the state machine.
-
-  \param keyEvent Key event
-
-  \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
+   Handle a key release event for the observed widget.
+
+   Passes the event to the state machine.
+
+   \param keyEvent Key event
+
+   \sa eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent(),
       widgetMouseDoubleClickEvent(), widgetMouseMoveEvent(),
       widgetWheelEvent(), widgetKeyPressEvent(), stateMachine()
-*/
-void QwtPicker::widgetKeyReleaseEvent( QKeyEvent *keyEvent )
+ */
+void QwtPicker::widgetKeyReleaseEvent( QKeyEvent* keyEvent )
 {
     transition( keyEvent );
@@ -1165,17 +1187,17 @@
 
 /*!
-  Passes an event to the state machine and executes the resulting
-  commands. Append and Move commands use the current position
-  of the cursor ( QCursor::pos() ).
-
-  \param event Event
-*/
-void QwtPicker::transition( const QEvent *event )
-{
-    if ( !d_data->stateMachine )
+   Passes an event to the state machine and executes the resulting
+   commands. Append and Move commands use the current position
+   of the cursor ( QCursor::pos() ).
+
+   \param event Event
+ */
+void QwtPicker::transition( const QEvent* event )
+{
+    if ( !m_data->stateMachine )
         return;
 
-    const QList<QwtPickerMachine::Command> commandList =
-        d_data->stateMachine->transition( *this, event );
+    const QList< QwtPickerMachine::Command > commandList =
+        m_data->stateMachine->transition( *this, event );
 
     QPoint pos;
@@ -1187,6 +1209,6 @@
         case QEvent::MouseMove:
         {
-            const QMouseEvent *me =
-                static_cast< const QMouseEvent * >( event );
+            const QMouseEvent* me =
+                static_cast< const QMouseEvent* >( event );
             pos = me->pos();
             break;
@@ -1230,24 +1252,24 @@
 
 /*!
-  Open a selection setting the state to active
-
-  \sa isActive(), end(), append(), move()
-*/
+   Open a selection setting the state to active
+
+   \sa isActive(), end(), append(), move()
+ */
 void QwtPicker::begin()
 {
-    if ( d_data->isActive )
+    if ( m_data->isActive )
         return;
 
-    d_data->pickedPoints.clear();
-    d_data->isActive = true;
+    m_data->pickedPoints.clear();
+    m_data->isActive = true;
     Q_EMIT activated( true );
 
     if ( trackerMode() != AlwaysOff )
     {
-        if ( d_data->trackerPosition.x() < 0 || d_data->trackerPosition.y() < 0 )
-        {
-            QWidget *w = parentWidget();
+        if ( m_data->trackerPosition.x() < 0 || m_data->trackerPosition.y() < 0 )
+        {
+            QWidget* w = parentWidget();
             if ( w )
-                d_data->trackerPosition = w->mapFromGlobal( QCursor::pos() );
+                m_data->trackerPosition = w->mapFromGlobal( QCursor::pos() );
         }
     }
@@ -1258,32 +1280,32 @@
 
 /*!
-  \brief Close a selection setting the state to inactive.
-
-  The selection is validated and maybe fixed by accept().
-
-  \param ok If true, complete the selection and emit a selected signal
+   \brief Close a selection setting the state to inactive.
+
+   The selection is validated and maybe fixed by accept().
+
+   \param ok If true, complete the selection and emit a selected signal
             otherwise discard the selection.
-  \return true if the selection is accepted, false otherwise
-  \sa isActive(), begin(), append(), move(), selected(), accept()
-*/
+   \return true if the selection is accepted, false otherwise
+   \sa isActive(), begin(), append(), move(), selected(), accept()
+ */
 bool QwtPicker::end( bool ok )
 {
-    if ( d_data->isActive )
+    if ( m_data->isActive )
     {
         setMouseTracking( false );
 
-        d_data->isActive = false;
+        m_data->isActive = false;
         Q_EMIT activated( false );
 
         if ( trackerMode() == ActiveOnly )
-            d_data->trackerPosition = QPoint( -1, -1 );
+            m_data->trackerPosition = QPoint( -1, -1 );
 
         if ( ok )
-            ok = accept( d_data->pickedPoints );
+            ok = accept( m_data->pickedPoints );
 
         if ( ok )
-            Q_EMIT selected( d_data->pickedPoints );
+            Q_EMIT selected( m_data->pickedPoints );
         else
-            d_data->pickedPoints.clear();
+            m_data->pickedPoints.clear();
 
         updateDisplay();
@@ -1297,9 +1319,9 @@
 /*!
    Reset the state machine and terminate ( end(false) ) the selection
-*/
+ */
 void QwtPicker::reset()
 {
-    if ( d_data->stateMachine )
-        d_data->stateMachine->reset();
+    if ( m_data->stateMachine )
+        m_data->stateMachine->reset();
 
     if ( isActive() )
@@ -1308,16 +1330,16 @@
 
 /*!
-  Append a point to the selection and update rubber band and tracker.
-  The appended() signal is emitted.
-
-  \param pos Additional point
-
-  \sa isActive(), begin(), end(), move(), appended()
-*/
-void QwtPicker::append( const QPoint &pos )
-{
-    if ( d_data->isActive )
-    {
-        d_data->pickedPoints += pos;
+   Append a point to the selection and update rubber band and tracker.
+   The appended() signal is emitted.
+
+   \param pos Additional point
+
+   \sa isActive(), begin(), end(), move(), appended()
+ */
+void QwtPicker::append( const QPoint& pos )
+{
+    if ( m_data->isActive )
+    {
+        m_data->pickedPoints += pos;
 
         updateDisplay();
@@ -1327,15 +1349,15 @@
 
 /*!
-  Move the last point of the selection
-  The moved() signal is emitted.
-
-  \param pos New position
-  \sa isActive(), begin(), end(), append()
-*/
-void QwtPicker::move( const QPoint &pos )
-{
-    if ( d_data->isActive && !d_data->pickedPoints.isEmpty() )
-    {
-        QPoint &point = d_data->pickedPoints.last();
+   Move the last point of the selection
+   The moved() signal is emitted.
+
+   \param pos New position
+   \sa isActive(), begin(), end(), append()
+ */
+void QwtPicker::move( const QPoint& pos )
+{
+    if ( m_data->isActive && !m_data->pickedPoints.isEmpty() )
+    {
+        QPoint& point = m_data->pickedPoints.last();
         if ( point != pos )
         {
@@ -1349,18 +1371,18 @@
 
 /*!
-  Remove the last point of the selection
-  The removed() signal is emitted.
-
-  \sa isActive(), begin(), end(), append(), move()
-*/
+   Remove the last point of the selection
+   The removed() signal is emitted.
+
+   \sa isActive(), begin(), end(), append(), move()
+ */
 void QwtPicker::remove()
 {
-    if ( d_data->isActive && !d_data->pickedPoints.isEmpty() )
+    if ( m_data->isActive && !m_data->pickedPoints.isEmpty() )
     {
 #if QT_VERSION >= 0x050100
-        const QPoint pos = d_data->pickedPoints.takeLast();
+        const QPoint pos = m_data->pickedPoints.takeLast();
 #else
-        const QPoint pos = d_data->pickedPoints.last();
-        d_data->pickedPoints.resize( d_data->pickedPoints.count() - 1 );
+        const QPoint pos = m_data->pickedPoints.last();
+        m_data->pickedPoints.resize( m_data->pickedPoints.count() - 1 );
 #endif
 
@@ -1371,12 +1393,12 @@
 
 /*!
-  \brief Validate and fix up the selection
-
-  Accepts all selections unmodified
-
-  \param selection Selection to validate and fix up
-  \return true, when accepted, false otherwise
-*/
-bool QwtPicker::accept( QPolygon &selection ) const
+   \brief Validate and fix up the selection
+
+   Accepts all selections unmodified
+
+   \param selection Selection to validate and fix up
+   \return true, when accepted, false otherwise
+ */
+bool QwtPicker::accept( QPolygon& selection ) const
 {
     Q_UNUSED( selection );
@@ -1385,32 +1407,32 @@
 
 /*!
-  A picker is active between begin() and end().
-  \return true if the selection is active.
-*/
+   A picker is active between begin() and end().
+   \return true if the selection is active.
+ */
 bool QwtPicker::isActive() const
 {
-    return d_data->isActive;
-}
-
-/*!
-  Return the points, that have been collected so far. The selection()
-  is calculated from the pickedPoints() in adjustedPoints().
-  \return Picked points
-*/
-const QPolygon &QwtPicker::pickedPoints() const
-{
-    return d_data->pickedPoints;
-}
-
-/*!
-  Scale the selection by the ratios of oldSize and newSize
-  The changed() signal is emitted.
-
-  \param oldSize Previous size
-  \param newSize Current size
-
-  \sa ResizeMode, setResizeMode(), resizeMode()
-*/
-void QwtPicker::stretchSelection( const QSize &oldSize, const QSize &newSize )
+    return m_data->isActive;
+}
+
+/*!
+   Return the points, that have been collected so far. The selection()
+   is calculated from the pickedPoints() in adjustedPoints().
+   \return Picked points
+ */
+const QPolygon& QwtPicker::pickedPoints() const
+{
+    return m_data->pickedPoints;
+}
+
+/*!
+   Scale the selection by the ratios of oldSize and newSize
+   The changed() signal is emitted.
+
+   \param oldSize Previous size
+   \param newSize Current size
+
+   \sa ResizeMode, setResizeMode(), resizeMode()
+ */
+void QwtPicker::stretchSelection( const QSize& oldSize, const QSize& newSize )
 {
     if ( oldSize.isEmpty() )
@@ -1424,30 +1446,30 @@
     const double yRatio = double( newSize.height() ) / double( oldSize.height() );
 
-    for ( int i = 0; i < d_data->pickedPoints.count(); i++ )
-    {
-        QPoint &p = d_data->pickedPoints[i];
+    for ( int i = 0; i < m_data->pickedPoints.count(); i++ )
+    {
+        QPoint& p = m_data->pickedPoints[i];
         p.setX( qRound( p.x() * xRatio ) );
         p.setY( qRound( p.y() * yRatio ) );
 
-        Q_EMIT changed( d_data->pickedPoints );
-    }
-}
-
-/*!
-  Set mouse tracking for the observed widget.
-
-  In case of enable is true, the previous value
-  is saved, that is restored when enable is false.
-
-  \warning Even when enable is false, mouse tracking might be restored
+        Q_EMIT changed( m_data->pickedPoints );
+    }
+}
+
+/*!
+   Set mouse tracking for the observed widget.
+
+   In case of enable is true, the previous value
+   is saved, that is restored when enable is false.
+
+   \warning Even when enable is false, mouse tracking might be restored
            to true. When mouseTracking for the observed widget
            has been changed directly by QWidget::setMouseTracking
            while mouse tracking has been set to true, this value can't
            be restored.
-*/
+ */
 
 void QwtPicker::setMouseTracking( bool enable )
 {
-    QWidget *widget = parentWidget();
+    QWidget* widget = parentWidget();
     if ( !widget )
         return;
@@ -1455,23 +1477,23 @@
     if ( enable )
     {
-        d_data->mouseTracking = widget->hasMouseTracking();
+        m_data->mouseTracking = widget->hasMouseTracking();
         widget->setMouseTracking( true );
     }
     else
     {
-        widget->setMouseTracking( d_data->mouseTracking );
-    }
-}
-
-/*!
-  Find the area of the observed widget, where selection might happen.
-
-  \return parentWidget()->contentsRect()
-*/
+        widget->setMouseTracking( m_data->mouseTracking );
+    }
+}
+
+/*!
+   Find the area of the observed widget, where selection might happen.
+
+   \return parentWidget()->contentsRect()
+ */
 QPainterPath QwtPicker::pickArea() const
 {
     QPainterPath path;
 
-    const QWidget *widget = parentWidget();
+    const QWidget* widget = parentWidget();
     if ( widget )
         path.addRect( widget->contentsRect() );
@@ -1483,10 +1505,10 @@
 void QwtPicker::updateDisplay()
 {
-    QWidget *w = parentWidget();
+    QWidget* w = parentWidget();
 
     bool showRubberband = false;
     bool showTracker = false;
 
-    if ( w && w->isVisible() && d_data->enabled )
+    if ( w && w->isVisible() && m_data->enabled )
     {
         if ( rubberBand() != NoRubberBand && isActive() &&
@@ -1507,10 +1529,10 @@
     }
 
-    QPointer< QwtPickerRubberband > &rw = d_data->rubberBandOverlay;
+    QPointer< Rubberband >& rw = m_data->rubberBandOverlay;
     if ( showRubberband )
     {
         if ( rw.isNull() )
         {
-            rw = new QwtPickerRubberband( this, NULL ); // NULL -> no extra event filter
+            rw = new Rubberband( this, NULL ); // NULL -> no extra event filter
             rw->setObjectName( "PickerRubberBand" );
             rw->setParent( w );
@@ -1518,5 +1540,5 @@
         }
 
-        if ( d_data->rubberBand <= RectRubberBand )
+        if ( m_data->rubberBand <= RectRubberBand )
             rw->setMaskMode( QwtWidgetOverlay::MaskHint );
         else
@@ -1527,5 +1549,5 @@
     else
     {
-        if ( d_data->openGL )
+        if ( m_data->openGL )
         {
             // Qt 4.8 crashes for a delete
@@ -1543,20 +1565,20 @@
     }
 
-    QPointer< QwtPickerTracker > &tw = d_data->trackerOverlay;
+    QPointer< Tracker >& tw = m_data->trackerOverlay;
     if ( showTracker )
     {
         if ( tw.isNull() )
         {
-            tw = new QwtPickerTracker( this, NULL ); // NULL -> no extra event filter
+            tw = new Tracker( this, NULL ); // NULL -> no extra event filter
             tw->setObjectName( "PickerTracker" );
             tw->setParent( w );
             tw->resize( w->size() );
         }
-        tw->setFont( d_data->trackerFont );
+        tw->setFont( m_data->trackerFont );
         tw->updateOverlay();
     }
     else
     {
-        if ( d_data->openGL )
+        if ( m_data->openGL )
         {
             // Qt 4.8 crashes for a delete
@@ -1576,13 +1598,14 @@
 
 //! \return Overlay displaying the rubber band
-const QwtWidgetOverlay *QwtPicker::rubberBandOverlay() const
-{
-    return d_data->rubberBandOverlay;
+const QwtWidgetOverlay* QwtPicker::rubberBandOverlay() const
+{
+    return m_data->rubberBandOverlay;
 }
 
 //! \return Overlay displaying the tracker text
-const QwtWidgetOverlay *QwtPicker::trackerOverlay() const
-{
-    return d_data->trackerOverlay;
-}
-
+const QwtWidgetOverlay* QwtPicker::trackerOverlay() const
+{
+    return m_data->trackerOverlay;
+}
+
+#include "moc_qwt_picker.cpp"
Index: /trunk/BNC/qwt/qwt_picker.h
===================================================================
--- /trunk/BNC/qwt/qwt_picker.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_picker.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,57 +9,63 @@
 
 #ifndef QWT_PICKER
-#define QWT_PICKER 1
+#define QWT_PICKER
 
 #include "qwt_global.h"
-#include "qwt_text.h"
 #include "qwt_event_pattern.h"
+
 #include <qobject.h>
-#include <qpen.h>
-#include <qfont.h>
-#include <qrect.h>
-#include <qpainterpath.h>
-
+
+class QwtPickerMachine;
+class QwtWidgetOverlay;
+class QwtText;
 class QWidget;
 class QMouseEvent;
 class QWheelEvent;
 class QKeyEvent;
-class QwtPickerMachine;
-class QwtWidgetOverlay;
+class QPainter;
+class QPen;
+class QFont;
+class QRegion;
+class QPainterPath;
+class QPoint;
+class QRect;
+class QSize;
+class QPolygon;
 
 /*!
-  \brief QwtPicker provides selections on a widget
-
-  QwtPicker filters all enter, leave, mouse and keyboard events of a widget
-  and translates them into an array of selected points.
-
-  The way how the points are collected depends on type of state machine
-  that is connected to the picker. Qwt offers a couple of predefined
-  state machines for selecting:
-
-  - Nothing\n
+   \brief QwtPicker provides selections on a widget
+
+   QwtPicker filters all enter, leave, mouse and keyboard events of a widget
+   and translates them into an array of selected points.
+
+   The way how the points are collected depends on type of state machine
+   that is connected to the picker. Qwt offers a couple of predefined
+   state machines for selecting:
+
+   - Nothing\n
     QwtPickerTrackerMachine
-  - Single points\n
+   - Single points\n
     QwtPickerClickPointMachine, QwtPickerDragPointMachine
-  - Rectangles\n
+   - Rectangles\n
     QwtPickerClickRectMachine, QwtPickerDragRectMachine
-  - Polygons\n
+   - Polygons\n
     QwtPickerPolygonMachine
 
-  While these state machines cover the most common ways to collect points
-  it is also possible to implement individual machines as well.
-
-  QwtPicker translates the picked points into a selection using the
-  adjustedPoints() method. adjustedPoints() is intended to be reimplemented
-  to fix up the selection according to application specific requirements.
-  (F.e. when an application accepts rectangles of a fixed aspect ratio only.)
-
-  Optionally QwtPicker support the process of collecting points by a
-  rubber band and tracker displaying a text for the current mouse
-  position.
-
-  \par Example
-  \code
-    #include <qwt_picker.h>
-    #include <qwt_picker_machine.h>
+   While these state machines cover the most common ways to collect points
+   it is also possible to implement individual machines as well.
+
+   QwtPicker translates the picked points into a selection using the
+   adjustedPoints() method. adjustedPoints() is intended to be reimplemented
+   to fix up the selection according to application specific requirements.
+   (F.e. when an application accepts rectangles of a fixed aspect ratio only.)
+
+   Optionally QwtPicker support the process of collecting points by a
+   rubber band and tracker displaying a text for the current mouse
+   position.
+
+   \par Example
+   \code
+ #include <qwt_picker.h>
+ #include <qwt_picker_machine.h>
 
     QwtPicker *picker = new QwtPicker(widget);
@@ -67,34 +73,33 @@
     picker->setTrackerMode(QwtPicker::ActiveOnly);
     picker->setRubberBand(QwtPicker::RectRubberBand);
-  \endcode
-  \endpar
-
-  The state machine triggers the following commands:
-
-  - begin()\n
+   \endcode
+
+   The state machine triggers the following commands:
+
+   - begin()\n
     Activate/Initialize the selection.
-  - append()\n
+   - append()\n
     Add a new point
-  - move() \n
+   - move() \n
     Change the position of the last point.
-  - remove()\n
+   - remove()\n
     Remove the last point.
-  - end()\n
+   - end()\n
     Terminate the selection and call accept to validate the picked points.
 
-  The picker is active (isActive()), between begin() and end().
-  In active state the rubber band is displayed, and the tracker is visible
-  in case of trackerMode is ActiveOnly or AlwaysOn.
-
-  The cursor can be moved using the arrow keys. All selections can be aborted
-  using the abort key. (QwtEventPattern::KeyPatternCode)
-
-  \warning In case of QWidget::NoFocus the focus policy of the observed
+   The picker is active (isActive()), between begin() and end().
+   In active state the rubber band is displayed, and the tracker is visible
+   in case of trackerMode is ActiveOnly or AlwaysOn.
+
+   The cursor can be moved using the arrow keys. All selections can be aborted
+   using the abort key. (QwtEventPattern::KeyPatternCode)
+
+   \warning In case of QWidget::NoFocus the focus policy of the observed
            widget is set to QWidget::WheelFocus and mouse tracking
            will be manipulated while the picker is active,
            or if trackerMode() is AlwayOn.
-*/
-
-class QWT_EXPORT QwtPicker: public QObject, public QwtEventPattern
+ */
+
+class QWT_EXPORT QwtPicker : public QObject, public QwtEventPattern
 {
     Q_OBJECT
@@ -112,11 +117,11 @@
     Q_PROPERTY( QPen rubberBandPen READ rubberBandPen WRITE setRubberBandPen )
 
-public:
-    /*!
-      Rubber band style
-
-      The default value is QwtPicker::NoRubberBand.
-      \sa setRubberBand(), rubberBand()
-    */
+  public:
+    /*!
+       Rubber band style
+
+       The default value is QwtPicker::NoRubberBand.
+       \sa setRubberBand(), rubberBand()
+     */
 
     enum RubberBand
@@ -144,6 +149,6 @@
 
         /*!
-          Values >= UserRubberBand can be used to define additional
-          rubber bands.
+           Values >= UserRubberBand can be used to define additional
+           rubber bands.
          */
         UserRubberBand = 100
@@ -151,7 +156,7 @@
 
     /*!
-      \brief Display mode
-      \sa setTrackerMode(), trackerMode(), isActive()
-    */
+       \brief Display mode
+       \sa setTrackerMode(), trackerMode(), isActive()
+     */
     enum DisplayMode
     {
@@ -167,10 +172,10 @@
 
     /*!
-      Controls what to do with the selected points of an active
+       Controls what to do with the selected points of an active
          selection when the observed widget is resized.
 
-      The default value is QwtPicker::Stretch.
-      \sa setResizeMode()
-    */
+       The default value is QwtPicker::Stretch.
+       \sa setResizeMode()
+     */
 
     enum ResizeMode
@@ -183,13 +188,13 @@
     };
 
-    explicit QwtPicker( QWidget *parent );
+    explicit QwtPicker( QWidget* parent );
     explicit QwtPicker( RubberBand rubberBand,
-                        DisplayMode trackerMode, QWidget * );
+        DisplayMode trackerMode, QWidget* );
 
     virtual ~QwtPicker();
 
-    void setStateMachine( QwtPickerMachine * );
-    const QwtPickerMachine *stateMachine() const;
-    QwtPickerMachine *stateMachine();
+    void setStateMachine( QwtPickerMachine* );
+    const QwtPickerMachine* stateMachine() const;
+    QwtPickerMachine* stateMachine();
 
     void setRubberBand( RubberBand );
@@ -202,11 +207,11 @@
     ResizeMode resizeMode() const;
 
-    void setRubberBandPen( const QPen & );
+    void setRubberBandPen( const QPen& );
     QPen rubberBandPen() const;
 
-    void setTrackerPen( const QPen & );
+    void setTrackerPen( const QPen& );
     QPen trackerPen() const;
 
-    void setTrackerFont( const QFont & );
+    void setTrackerFont( const QFont& );
     QFont trackerFont() const;
 
@@ -214,118 +219,120 @@
     bool isActive() const;
 
-    virtual bool eventFilter( QObject *, QEvent * );
-
-    QWidget *parentWidget();
-    const QWidget *parentWidget() const;
+    virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
+
+    QWidget* parentWidget();
+    const QWidget* parentWidget() const;
 
     virtual QPainterPath pickArea() const;
 
-    virtual void drawRubberBand( QPainter * ) const;
-    virtual void drawTracker( QPainter * ) const;
-
+    virtual void drawRubberBand( QPainter* ) const;
+    virtual void drawTracker( QPainter* ) const;
+
+    virtual QRegion trackerMask() const;
     virtual QRegion rubberBandMask() const;
 
-    virtual QwtText trackerText( const QPoint &pos ) const;
+    virtual QwtText trackerText( const QPoint& pos ) const;
     QPoint trackerPosition() const;
-    virtual QRect trackerRect( const QFont & ) const;
+    virtual QRect trackerRect( const QFont& ) const;
 
     QPolygon selection() const;
 
-public Q_SLOTS:
+  public Q_SLOTS:
     void setEnabled( bool );
 
-Q_SIGNALS:
-    /*!
-      A signal indicating, when the picker has been activated.
-      Together with setEnabled() it can be used to implement
-      selections with more than one picker.
-
-      \param on True, when the picker has been activated
-    */
+  Q_SIGNALS:
+    /*!
+       A signal indicating, when the picker has been activated.
+       Together with setEnabled() it can be used to implement
+       selections with more than one picker.
+
+       \param on True, when the picker has been activated
+     */
     void activated( bool on );
 
     /*!
-      A signal emitting the selected points,
-      at the end of a selection.
-
-      \param polygon Selected points
-    */
-    void selected( const QPolygon &polygon );
-
-    /*!
-      A signal emitted when a point has been appended to the selection
-
-      \param pos Position of the appended point.
-      \sa append(). moved()
-    */
-    void appended( const QPoint &pos );
-
-    /*!
-      A signal emitted whenever the last appended point of the
-      selection has been moved.
-
-      \param pos Position of the moved last point of the selection.
-      \sa move(), appended()
-    */
-    void moved( const QPoint &pos );
-
-    /*!
-      A signal emitted whenever the last appended point of the
-      selection has been removed.
-
-      \param pos Position of the point, that has been removed
-      \sa remove(), appended()
-    */
-    void removed( const QPoint &pos );
-    /*!
-      A signal emitted when the active selection has been changed.
-      This might happen when the observed widget is resized.
-
-      \param selection Changed selection
-      \sa stretchSelection()
-    */
-    void changed( const QPolygon &selection );
-
-protected:
-    virtual QPolygon adjustedPoints( const QPolygon & ) const;
-
-    virtual void transition( const QEvent * );
+       A signal emitting the selected points,
+       at the end of a selection.
+
+       \param polygon Selected points
+     */
+    void selected( const QPolygon& polygon );
+
+    /*!
+       A signal emitted when a point has been appended to the selection
+
+       \param pos Position of the appended point.
+       \sa append(). moved()
+     */
+    void appended( const QPoint& pos );
+
+    /*!
+       A signal emitted whenever the last appended point of the
+       selection has been moved.
+
+       \param pos Position of the moved last point of the selection.
+       \sa move(), appended()
+     */
+    void moved( const QPoint& pos );
+
+    /*!
+       A signal emitted whenever the last appended point of the
+       selection has been removed.
+
+       \param pos Position of the point, that has been removed
+       \sa remove(), appended()
+     */
+    void removed( const QPoint& pos );
+    /*!
+       A signal emitted when the active selection has been changed.
+       This might happen when the observed widget is resized.
+
+       \param selection Changed selection
+       \sa stretchSelection()
+     */
+    void changed( const QPolygon& selection );
+
+  protected:
+    virtual QPolygon adjustedPoints( const QPolygon& ) const;
+
+    virtual void transition( const QEvent* );
 
     virtual void begin();
-    virtual void append( const QPoint & );
-    virtual void move( const QPoint & );
+    virtual void append( const QPoint& );
+    virtual void move( const QPoint& );
     virtual void remove();
     virtual bool end( bool ok = true );
 
-    virtual bool accept( QPolygon & ) const;
+    virtual bool accept( QPolygon& ) const;
     virtual void reset();
 
-    virtual void widgetMousePressEvent( QMouseEvent * );
-    virtual void widgetMouseReleaseEvent( QMouseEvent * );
-    virtual void widgetMouseDoubleClickEvent( QMouseEvent * );
-    virtual void widgetMouseMoveEvent( QMouseEvent * );
-    virtual void widgetWheelEvent( QWheelEvent * );
-    virtual void widgetKeyPressEvent( QKeyEvent * );
-    virtual void widgetKeyReleaseEvent( QKeyEvent * );
-    virtual void widgetEnterEvent( QEvent * );
-    virtual void widgetLeaveEvent( QEvent * );
+    virtual void widgetMousePressEvent( QMouseEvent* );
+    virtual void widgetMouseReleaseEvent( QMouseEvent* );
+    virtual void widgetMouseDoubleClickEvent( QMouseEvent* );
+    virtual void widgetMouseMoveEvent( QMouseEvent* );
+    virtual void widgetWheelEvent( QWheelEvent* );
+    virtual void widgetKeyPressEvent( QKeyEvent* );
+    virtual void widgetKeyReleaseEvent( QKeyEvent* );
+    virtual void widgetEnterEvent( QEvent* );
+    virtual void widgetLeaveEvent( QEvent* );
 
     virtual void stretchSelection(
-        const QSize &oldSize, const QSize &newSize );
+        const QSize& oldSize, const QSize& newSize );
 
     virtual void updateDisplay();
 
-    const QwtWidgetOverlay *rubberBandOverlay() const;
-    const QwtWidgetOverlay *trackerOverlay() const;
-
-    const QPolygon &pickedPoints() const;
-
-private:
-    void init( QWidget *, RubberBand rubberBand, DisplayMode trackerMode );
+    const QwtWidgetOverlay* rubberBandOverlay() const;
+    const QwtWidgetOverlay* trackerOverlay() const;
+
+    const QPolygon& pickedPoints() const;
+    QRect trackerRect( const QSize& ) const;
+
+  private:
+    void init( QWidget*, RubberBand rubberBand, DisplayMode trackerMode );
 
     void setMouseTracking( bool );
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_picker_machine.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_picker_machine.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_picker_machine.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,10 +10,11 @@
 #include "qwt_picker_machine.h"
 #include "qwt_event_pattern.h"
+
 #include <qevent.h>
 
 //! Constructor
-QwtPickerMachine::QwtPickerMachine( SelectionType type ):
-    d_selectionType( type ),
-    d_state( 0 )
+QwtPickerMachine::QwtPickerMachine( SelectionType type )
+    : m_selectionType( type )
+    , m_state( 0 )
 {
 }
@@ -27,5 +28,5 @@
 QwtPickerMachine::SelectionType QwtPickerMachine::selectionType() const
 {
-    return d_selectionType;
+    return m_selectionType;
 }
 
@@ -33,5 +34,5 @@
 int QwtPickerMachine::state() const
 {
-    return d_state;
+    return m_state;
 }
 
@@ -39,5 +40,5 @@
 void QwtPickerMachine::setState( int state )
 {
-    d_state = state;
+    m_state = state;
 }
 
@@ -55,8 +56,8 @@
 
 //! Transition
-QList<QwtPickerMachine::Command> QwtPickerTrackerMachine::transition(
-    const QwtEventPattern &, const QEvent *e )
-{
-    QList<QwtPickerMachine::Command> cmdList;
+QList< QwtPickerMachine::Command > QwtPickerTrackerMachine::transition(
+    const QwtEventPattern&, const QEvent* e )
+{
+    QList< QwtPickerMachine::Command > cmdList;
 
     switch ( e->type() )
@@ -97,8 +98,8 @@
 
 //! Transition
-QList<QwtPickerMachine::Command> QwtPickerClickPointMachine::transition(
-    const QwtEventPattern &eventPattern, const QEvent *event )
-{
-    QList<QwtPickerMachine::Command> cmdList;
+QList< QwtPickerMachine::Command > QwtPickerClickPointMachine::transition(
+    const QwtEventPattern& eventPattern, const QEvent* event )
+{
+    QList< QwtPickerMachine::Command > cmdList;
 
     switch ( event->type() )
@@ -107,5 +108,5 @@
         {
             if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1,
-                static_cast<const QMouseEvent *>( event ) ) )
+                static_cast< const QMouseEvent* >( event ) ) )
             {
                 cmdList += Begin;
@@ -117,5 +118,5 @@
         case QEvent::KeyPress:
         {
-            const QKeyEvent *keyEvent = static_cast<const QKeyEvent *> ( event );
+            const QKeyEvent* keyEvent = static_cast< const QKeyEvent* > ( event );
             if ( eventPattern.keyMatch( QwtEventPattern::KeySelect1, keyEvent ) )
             {
@@ -143,8 +144,8 @@
 
 //! Transition
-QList<QwtPickerMachine::Command> QwtPickerDragPointMachine::transition(
-    const QwtEventPattern &eventPattern, const QEvent *event )
-{
-    QList<QwtPickerMachine::Command> cmdList;
+QList< QwtPickerMachine::Command > QwtPickerDragPointMachine::transition(
+    const QwtEventPattern& eventPattern, const QEvent* event )
+{
+    QList< QwtPickerMachine::Command > cmdList;
 
     switch ( event->type() )
@@ -153,5 +154,5 @@
         {
             if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1,
-                static_cast<const QMouseEvent *>( event ) ) )
+                static_cast< const QMouseEvent* >( event ) ) )
             {
                 if ( state() == 0 )
@@ -182,5 +183,5 @@
         case QEvent::KeyPress:
         {
-            const QKeyEvent *keyEvent = static_cast<const QKeyEvent *> ( event );
+            const QKeyEvent* keyEvent = static_cast< const QKeyEvent* > ( event );
             if ( eventPattern.keyMatch( QwtEventPattern::KeySelect1, keyEvent ) )
             {
@@ -216,8 +217,8 @@
 
 //! Transition
-QList<QwtPickerMachine::Command> QwtPickerClickRectMachine::transition(
-    const QwtEventPattern &eventPattern, const QEvent *event )
-{
-    QList<QwtPickerMachine::Command> cmdList;
+QList< QwtPickerMachine::Command > QwtPickerClickRectMachine::transition(
+    const QwtEventPattern& eventPattern, const QEvent* event )
+{
+    QList< QwtPickerMachine::Command > cmdList;
 
     switch ( event->type() )
@@ -226,5 +227,5 @@
         {
             if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1,
-                static_cast<const QMouseEvent *>( event ) ) )
+                static_cast< const QMouseEvent* >( event ) ) )
             {
                 switch ( state() )
@@ -261,5 +262,5 @@
         {
             if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1,
-                static_cast<const QMouseEvent *>( event ) ) )
+                static_cast< const QMouseEvent* >( event ) ) )
             {
                 if ( state() == 1 )
@@ -273,5 +274,5 @@
         case QEvent::KeyPress:
         {
-            const QKeyEvent *keyEvent = static_cast<const QKeyEvent *> ( event );
+            const QKeyEvent* keyEvent = static_cast< const QKeyEvent* > ( event );
             if ( eventPattern.keyMatch( QwtEventPattern::KeySelect1, keyEvent ) )
             {
@@ -315,8 +316,8 @@
 
 //! Transition
-QList<QwtPickerMachine::Command> QwtPickerDragRectMachine::transition(
-    const QwtEventPattern &eventPattern, const QEvent *event )
-{
-    QList<QwtPickerMachine::Command> cmdList;
+QList< QwtPickerMachine::Command > QwtPickerDragRectMachine::transition(
+    const QwtEventPattern& eventPattern, const QEvent* event )
+{
+    QList< QwtPickerMachine::Command > cmdList;
 
     switch ( event->type() )
@@ -325,5 +326,5 @@
         {
             if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1,
-                static_cast<const QMouseEvent *>( event ) ) )
+                static_cast< const QMouseEvent* >( event ) ) )
             {
                 if ( state() == 0 )
@@ -356,5 +357,5 @@
         {
             if ( eventPattern.keyMatch( QwtEventPattern::KeySelect1,
-                static_cast<const QKeyEvent *> ( event ) ) )
+                static_cast< const QKeyEvent* > ( event ) ) )
             {
                 if ( state() == 0 )
@@ -387,8 +388,8 @@
 
 //! Transition
-QList<QwtPickerMachine::Command> QwtPickerPolygonMachine::transition(
-    const QwtEventPattern &eventPattern, const QEvent *event )
-{
-    QList<QwtPickerMachine::Command> cmdList;
+QList< QwtPickerMachine::Command > QwtPickerPolygonMachine::transition(
+    const QwtEventPattern& eventPattern, const QEvent* event )
+{
+    QList< QwtPickerMachine::Command > cmdList;
 
     switch ( event->type() )
@@ -397,5 +398,5 @@
         {
             if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1,
-                static_cast<const QMouseEvent *>( event ) ) )
+                static_cast< const QMouseEvent* >( event ) ) )
             {
                 if ( state() == 0 )
@@ -412,5 +413,5 @@
             }
             if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect2,
-                static_cast<const QMouseEvent *>( event ) ) )
+                static_cast< const QMouseEvent* >( event ) ) )
             {
                 if ( state() == 1 )
@@ -431,5 +432,5 @@
         case QEvent::KeyPress:
         {
-            const QKeyEvent *keyEvent = static_cast<const QKeyEvent *> ( event );
+            const QKeyEvent* keyEvent = static_cast< const QKeyEvent* > ( event );
             if ( eventPattern.keyMatch( QwtEventPattern::KeySelect1, keyEvent ) )
             {
@@ -476,8 +477,8 @@
 
 //! Transition
-QList<QwtPickerMachine::Command> QwtPickerDragLineMachine::transition(
-    const QwtEventPattern &eventPattern, const QEvent *event )
-{
-    QList<QwtPickerMachine::Command> cmdList;
+QList< QwtPickerMachine::Command > QwtPickerDragLineMachine::transition(
+    const QwtEventPattern& eventPattern, const QEvent* event )
+{
+    QList< QwtPickerMachine::Command > cmdList;
 
     switch( event->type() )
@@ -486,5 +487,5 @@
         {
             if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1,
-                static_cast<const QMouseEvent *>( event ) ) )
+                static_cast< const QMouseEvent* >( event ) ) )
             {
                 if ( state() == 0 )
@@ -501,5 +502,5 @@
         {
             if ( eventPattern.keyMatch( QwtEventPattern::KeySelect1,
-                static_cast<const QKeyEvent *> ( event ) ) )
+                static_cast< const QKeyEvent* > ( event ) ) )
             {
                 if ( state() == 0 )
Index: /trunk/BNC/qwt/qwt_picker_machine.h
===================================================================
--- /trunk/BNC/qwt/qwt_picker_machine.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_picker_machine.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,28 +9,28 @@
 
 #ifndef QWT_PICKER_MACHINE
-#define QWT_PICKER_MACHINE 1
+#define QWT_PICKER_MACHINE
 
 #include "qwt_global.h"
-#include <qlist.h>
-
+
+class QwtEventPattern;
 class QEvent;
-class QwtEventPattern;
-
-/*!
-  \brief A state machine for QwtPicker selections
-
-  QwtPickerMachine accepts key and mouse events and translates them
-  into selection commands.
-
-  \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
-*/
+template< typename T > class QList;
+
+/*!
+   \brief A state machine for QwtPicker selections
+
+   QwtPickerMachine accepts key and mouse events and translates them
+   into selection commands.
+
+   \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
+ */
 
 class QWT_EXPORT QwtPickerMachine
 {
-public:
+  public:
     /*!
-      Type of a selection.
-      \sa selectionType()
-    */
+       Type of a selection.
+       \sa selectionType()
+     */
     enum SelectionType
     {
@@ -58,10 +58,10 @@
     };
 
-    QwtPickerMachine( SelectionType );
+    explicit QwtPickerMachine( SelectionType );
     virtual ~QwtPickerMachine();
 
     //! Transition
-    virtual QList<Command> transition(
-        const QwtEventPattern &, const QEvent * ) = 0;
+    virtual QList< Command > transition(
+        const QwtEventPattern&, const QEvent* ) = 0;
     void reset();
 
@@ -71,143 +71,143 @@
     SelectionType selectionType() const;
 
-private:
-    const SelectionType d_selectionType;
-    int d_state;
-};
-
-/*!
-  \brief A state machine for indicating mouse movements
-
-  QwtPickerTrackerMachine supports displaying information
-  corresponding to mouse movements, but is not intended for
-  selecting anything. Begin/End are related to Enter/Leave events.
-*/
-class QWT_EXPORT QwtPickerTrackerMachine: public QwtPickerMachine
-{
-public:
+  private:
+    const SelectionType m_selectionType;
+    int m_state;
+};
+
+/*!
+   \brief A state machine for indicating mouse movements
+
+   QwtPickerTrackerMachine supports displaying information
+   corresponding to mouse movements, but is not intended for
+   selecting anything. Begin/End are related to Enter/Leave events.
+ */
+class QWT_EXPORT QwtPickerTrackerMachine : public QwtPickerMachine
+{
+  public:
     QwtPickerTrackerMachine();
 
-    virtual QList<Command> transition(
-        const QwtEventPattern &, const QEvent * );
-};
-
-/*!
-  \brief A state machine for point selections
-
-  Pressing QwtEventPattern::MouseSelect1 or
-  QwtEventPattern::KeySelect1 selects a point.
-
-  \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
-*/
-class QWT_EXPORT QwtPickerClickPointMachine: public QwtPickerMachine
-{
-public:
+    virtual QList< Command > transition(
+        const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
+};
+
+/*!
+   \brief A state machine for point selections
+
+   Pressing QwtEventPattern::MouseSelect1 or
+   QwtEventPattern::KeySelect1 selects a point.
+
+   \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
+ */
+class QWT_EXPORT QwtPickerClickPointMachine : public QwtPickerMachine
+{
+  public:
     QwtPickerClickPointMachine();
 
-    virtual QList<Command> transition(
-        const QwtEventPattern &, const QEvent * );
-};
-
-/*!
-  \brief A state machine for point selections
-
-  Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1
-  starts the selection, releasing QwtEventPattern::MouseSelect1 or
-  a second press of QwtEventPattern::KeySelect1 terminates it.
-*/
-class QWT_EXPORT QwtPickerDragPointMachine: public QwtPickerMachine
-{
-public:
+    virtual QList< Command > transition(
+        const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
+};
+
+/*!
+   \brief A state machine for point selections
+
+   Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1
+   starts the selection, releasing QwtEventPattern::MouseSelect1 or
+   a second press of QwtEventPattern::KeySelect1 terminates it.
+ */
+class QWT_EXPORT QwtPickerDragPointMachine : public QwtPickerMachine
+{
+  public:
     QwtPickerDragPointMachine();
 
-    virtual QList<Command> transition(
-        const QwtEventPattern &, const QEvent * );
-};
-
-/*!
-  \brief A state machine for rectangle selections
-
-  Pressing QwtEventPattern::MouseSelect1 starts
-  the selection, releasing it selects the first point. Pressing it
-  again selects the second point and terminates the selection.
-  Pressing QwtEventPattern::KeySelect1 also starts the
-  selection, a second press selects the first point. A third one selects
-  the second point and terminates the selection.
-
-  \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
-*/
-
-class QWT_EXPORT QwtPickerClickRectMachine: public QwtPickerMachine
-{
-public:
+    virtual QList< Command > transition(
+        const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
+};
+
+/*!
+   \brief A state machine for rectangle selections
+
+   Pressing QwtEventPattern::MouseSelect1 starts
+   the selection, releasing it selects the first point. Pressing it
+   again selects the second point and terminates the selection.
+   Pressing QwtEventPattern::KeySelect1 also starts the
+   selection, a second press selects the first point. A third one selects
+   the second point and terminates the selection.
+
+   \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
+ */
+
+class QWT_EXPORT QwtPickerClickRectMachine : public QwtPickerMachine
+{
+  public:
     QwtPickerClickRectMachine();
 
-    virtual QList<Command> transition(
-        const QwtEventPattern &, const QEvent * );
-};
-
-/*!
-  \brief A state machine for rectangle selections
-
-  Pressing QwtEventPattern::MouseSelect1 selects
-  the first point, releasing it the second point.
-  Pressing QwtEventPattern::KeySelect1 also selects the
-  first point, a second press selects the second point and terminates
-  the selection.
-
-  \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
-*/
-
-class QWT_EXPORT QwtPickerDragRectMachine: public QwtPickerMachine
-{
-public:
+    virtual QList< Command > transition(
+        const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
+};
+
+/*!
+   \brief A state machine for rectangle selections
+
+   Pressing QwtEventPattern::MouseSelect1 selects
+   the first point, releasing it the second point.
+   Pressing QwtEventPattern::KeySelect1 also selects the
+   first point, a second press selects the second point and terminates
+   the selection.
+
+   \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
+ */
+
+class QWT_EXPORT QwtPickerDragRectMachine : public QwtPickerMachine
+{
+  public:
     QwtPickerDragRectMachine();
 
-    virtual QList<Command> transition(
-        const QwtEventPattern &, const QEvent * );
-};
-
-/*!
-  \brief A state machine for line selections
-
-  Pressing QwtEventPattern::MouseSelect1 selects
-  the first point, releasing it the second point.
-  Pressing QwtEventPattern::KeySelect1 also selects the
-  first point, a second press selects the second point and terminates
-  the selection.
-
-  A common use case of QwtPickerDragLineMachine are pickers for
-  distance measurements.
-
-  \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
-*/
-
-class QWT_EXPORT QwtPickerDragLineMachine: public QwtPickerMachine
-{
-public:
+    virtual QList< Command > transition(
+        const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
+};
+
+/*!
+   \brief A state machine for line selections
+
+   Pressing QwtEventPattern::MouseSelect1 selects
+   the first point, releasing it the second point.
+   Pressing QwtEventPattern::KeySelect1 also selects the
+   first point, a second press selects the second point and terminates
+   the selection.
+
+   A common use case of QwtPickerDragLineMachine are pickers for
+   distance measurements.
+
+   \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
+ */
+
+class QWT_EXPORT QwtPickerDragLineMachine : public QwtPickerMachine
+{
+  public:
     QwtPickerDragLineMachine();
 
-    virtual QList<Command> transition(
-        const QwtEventPattern &, const QEvent * );
-};
-
-/*!
-  \brief A state machine for polygon selections
-
-  Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1
-  starts the selection and selects the first point, or appends a point.
-  Pressing QwtEventPattern::MouseSelect2 or QwtEventPattern::KeySelect2
-  appends the last point and terminates the selection.
-
-  \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
-*/
-
-class QWT_EXPORT QwtPickerPolygonMachine: public QwtPickerMachine
-{
-public:
+    virtual QList< Command > transition(
+        const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
+};
+
+/*!
+   \brief A state machine for polygon selections
+
+   Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1
+   starts the selection and selects the first point, or appends a point.
+   Pressing QwtEventPattern::MouseSelect2 or QwtEventPattern::KeySelect2
+   appends the last point and terminates the selection.
+
+   \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
+ */
+
+class QWT_EXPORT QwtPickerPolygonMachine : public QwtPickerMachine
+{
+  public:
     QwtPickerPolygonMachine();
 
-    virtual QList<Command> transition(
-        const QwtEventPattern &, const QEvent * );
+    virtual QList< Command > transition(
+        const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
 };
 
Index: /trunk/BNC/qwt/qwt_pixel_matrix.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_pixel_matrix.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_pixel_matrix.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,11 +11,11 @@
 
 /*!
-  \brief Constructor
+   \brief Constructor
 
-  \param rect Bounding rectangle for the matrix
-*/
-QwtPixelMatrix::QwtPixelMatrix( const QRect& rect ):
-    QBitArray( qMax( rect.width() * rect.height(), 0 ) ),
-    d_rect( rect )
+   \param rect Bounding rectangle for the matrix
+ */
+QwtPixelMatrix::QwtPixelMatrix( const QRect& rect )
+    : QBitArray( qMax( rect.width() * rect.height(), 0 ) )
+    , m_rect( rect )
 {
 }
@@ -35,7 +35,7 @@
 void QwtPixelMatrix::setRect( const QRect& rect )
 {
-    if ( rect != d_rect )
+    if ( rect != m_rect )
     {
-        d_rect = rect;
+        m_rect = rect;
         const int sz = qMax( rect.width() * rect.height(), 0 );
         resize( sz );
@@ -48,4 +48,4 @@
 QRect QwtPixelMatrix::rect() const
 {
-    return d_rect;
+    return m_rect;
 }
Index: /trunk/BNC/qwt/qwt_pixel_matrix.h
===================================================================
--- /trunk/BNC/qwt/qwt_pixel_matrix.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_pixel_matrix.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,17 +12,18 @@
 
 #include "qwt_global.h"
+
 #include <qbitarray.h>
 #include <qrect.h>
 
 /*!
-  \brief A bit field corresponding to the pixels of a rectangle
+   \brief A bit field corresponding to the pixels of a rectangle
 
-  QwtPixelMatrix is intended to filter out duplicates in an
-  unsorted array of points.
-*/
-class QWT_EXPORT QwtPixelMatrix: public QBitArray
+   QwtPixelMatrix is intended to filter out duplicates in an
+   unsorted array of points.
+ */
+class QWT_EXPORT QwtPixelMatrix : public QBitArray
 {
-public:
-    QwtPixelMatrix( const QRect& rect );
+  public:
+    explicit QwtPixelMatrix( const QRect& rect );
     ~QwtPixelMatrix();
 
@@ -35,15 +36,15 @@
     int index( int x, int y ) const;
 
-private:
-    QRect d_rect;
+  private:
+    QRect m_rect;
 };
 
 /*!
-  \brief Test if a pixel has been set
+   \brief Test if a pixel has been set
 
-  \param x X-coordinate
-  \param y Y-coordinate
+   \param x X-coordinate
+   \param y Y-coordinate
 
-  \return true, when pos is outside of rect(), or when the pixel
+   \return true, when pos is outside of rect(), or when the pixel
           has already been set.
  */
@@ -55,11 +56,11 @@
 
 /*!
-  \brief Set a pixel and test if a pixel has been set before
+   \brief Set a pixel and test if a pixel has been set before
 
-  \param x X-coordinate
-  \param y Y-coordinate
-  \param on Set/Clear the pixel
+   \param x X-coordinate
+   \param y Y-coordinate
+   \param on Set/Clear the pixel
 
-  \return true, when pos is outside of rect(), or when the pixel
+   \return true, when pos is outside of rect(), or when the pixel
           was set before.
  */
@@ -77,21 +78,21 @@
 
 /*!
-  \brief Calculate the index in the bit field corresponding to a position
+   \brief Calculate the index in the bit field corresponding to a position
 
-  \param x X-coordinate
-  \param y Y-coordinate
-  \return Index, when rect() contains pos - otherwise -1.
+   \param x X-coordinate
+   \param y Y-coordinate
+   \return Index, when rect() contains pos - otherwise -1.
  */
 inline int QwtPixelMatrix::index( int x, int y ) const
 {
-    const int dx = x - d_rect.x();
-    if ( dx < 0 || dx >= d_rect.width() )
+    const int dx = x - m_rect.x();
+    if ( dx < 0 || dx >= m_rect.width() )
         return -1;
 
-    const int dy = y - d_rect.y();
-    if ( dy < 0 || dy >= d_rect.height() )
+    const int dy = y - m_rect.y();
+    if ( dy < 0 || dy >= m_rect.height() )
         return -1;
 
-    return dy * d_rect.width() + dx;
+    return dy * m_rect.width() + dx;
 }
 
Index: /trunk/BNC/qwt/qwt_plot.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,37 +13,32 @@
 #include "qwt_scale_widget.h"
 #include "qwt_scale_engine.h"
+#include "qwt_scale_map.h"
 #include "qwt_text_label.h"
 #include "qwt_legend.h"
 #include "qwt_legend_data.h"
 #include "qwt_plot_canvas.h"
-#include <qmath.h>
+#include "qwt_math.h"
+
 #include <qpainter.h>
 #include <qpointer.h>
-#include <qpaintengine.h>
 #include <qapplication.h>
-#include <qevent.h>
-
-static inline void qwtEnableLegendItems( QwtPlot *plot, bool on )
-{
+#include <qcoreevent.h>
+
+static inline void qwtEnableLegendItems( QwtPlot* plot, bool on )
+{
+    // gcc seems to have problems with const char sig[] in combination with certain options
+    const char* sig = SIGNAL(legendDataChanged(QVariant,QList<QwtLegendData>));
+    const char* slot = SLOT(updateLegendItems(QVariant,QList<QwtLegendData>));
+
     if ( on )
-    {
-        QObject::connect(
-            plot, SIGNAL(legendDataChanged(QVariant,QList<QwtLegendData>)),
-            plot, SLOT(updateLegendItems(QVariant,QList<QwtLegendData>))
-        );
-    }
+        QObject::connect( plot, sig, plot, slot );
     else
-    {
-        QObject::disconnect(
-            plot, SIGNAL(legendDataChanged(QVariant,QList<QwtLegendData>) ),
-            plot, SLOT( updateLegendItems(QVariant,QList<QwtLegendData>))
-        );
-    }
+        QObject::disconnect( plot, sig, plot, slot );
 }
 
 static void qwtSetTabOrder(
-    QWidget *first, QWidget *second, bool withChildren )
-{
-    QList<QWidget *> tabChain;
+    QWidget* first, QWidget* second, bool withChildren )
+{
+    QList< QWidget* > tabChain;
     tabChain += first;
     tabChain += second;
@@ -51,7 +46,7 @@
     if ( withChildren )
     {
-        QList<QWidget *> children = second->findChildren<QWidget *>();
-
-        QWidget *w = second->nextInFocusChain();
+        QList< QWidget* > children = second->findChildren< QWidget* >();
+
+        QWidget* w = second->nextInFocusChain();
         while ( children.contains( w ) )
         {
@@ -65,12 +60,12 @@
     for ( int i = 0; i < tabChain.size() - 1; i++ )
     {
-        QWidget *from = tabChain[i];
-        QWidget *to = tabChain[i+1];
+        QWidget* from = tabChain[i];
+        QWidget* to = tabChain[i + 1];
 
         const Qt::FocusPolicy policy1 = from->focusPolicy();
         const Qt::FocusPolicy policy2 = to->focusPolicy();
 
-        QWidget *proxy1 = from->focusProxy();
-        QWidget *proxy2 = to->focusProxy();
+        QWidget* proxy1 = from->focusProxy();
+        QWidget* proxy2 = to->focusProxy();
 
         from->setFocusPolicy( Qt::TabFocus );
@@ -92,10 +87,10 @@
 class QwtPlot::PrivateData
 {
-public:
-    QPointer<QwtTextLabel> titleLabel;
-    QPointer<QwtTextLabel> footerLabel;
-    QPointer<QWidget> canvas;
-    QPointer<QwtAbstractLegend> legend;
-    QwtPlotLayout *layout;
+  public:
+    QPointer< QwtTextLabel > titleLabel;
+    QPointer< QwtTextLabel > footerLabel;
+    QPointer< QWidget > canvas;
+    QPointer< QwtAbstractLegend > legend;
+    QwtPlotLayout* layout;
 
     bool autoReplot;
@@ -103,9 +98,9 @@
 
 /*!
-  \brief Constructor
-  \param parent Parent widget
- */
-QwtPlot::QwtPlot( QWidget *parent ):
-    QFrame( parent )
+   \brief Constructor
+   \param parent Parent widget
+ */
+QwtPlot::QwtPlot( QWidget* parent )
+    : QFrame( parent )
 {
     initPlot( QwtText() );
@@ -113,10 +108,10 @@
 
 /*!
-  \brief Constructor
-  \param title Title text
-  \param parent Parent widget
- */
-QwtPlot::QwtPlot( const QwtText &title, QWidget *parent ):
-    QFrame( parent )
+   \brief Constructor
+   \param title Title text
+   \param parent Parent widget
+ */
+QwtPlot::QwtPlot( const QwtText& title, QWidget* parent )
+    : QFrame( parent )
 {
     initPlot( title );
@@ -129,47 +124,47 @@
     detachItems( QwtPlotItem::Rtti_PlotItem, autoDelete() );
 
-    delete d_data->layout;
+    delete m_data->layout;
     deleteAxesData();
-    delete d_data;
-}
-
-/*!
-  \brief Initializes a QwtPlot instance
-  \param title Title text
- */
-void QwtPlot::initPlot( const QwtText &title )
-{
-    d_data = new PrivateData;
-
-    d_data->layout = new QwtPlotLayout;
-    d_data->autoReplot = false;
+    delete m_data;
+}
+
+/*!
+   \brief Initializes a QwtPlot instance
+   \param title Title text
+ */
+void QwtPlot::initPlot( const QwtText& title )
+{
+    m_data = new PrivateData;
+
+    m_data->layout = new QwtPlotLayout;
+    m_data->autoReplot = false;
 
     // title
-    d_data->titleLabel = new QwtTextLabel( this );
-    d_data->titleLabel->setObjectName( "QwtPlotTitle" );
-    d_data->titleLabel->setFont( QFont( fontInfo().family(), 14, QFont::Bold ) );
+    m_data->titleLabel = new QwtTextLabel( this );
+    m_data->titleLabel->setObjectName( "QwtPlotTitle" );
+    m_data->titleLabel->setFont( QFont( fontInfo().family(), 14, QFont::Bold ) );
 
     QwtText text( title );
     text.setRenderFlags( Qt::AlignCenter | Qt::TextWordWrap );
-    d_data->titleLabel->setText( text );
+    m_data->titleLabel->setText( text );
 
     // footer
-    d_data->footerLabel = new QwtTextLabel( this );
-    d_data->footerLabel->setObjectName( "QwtPlotFooter" );
+    m_data->footerLabel = new QwtTextLabel( this );
+    m_data->footerLabel->setObjectName( "QwtPlotFooter" );
 
     QwtText footer;
     footer.setRenderFlags( Qt::AlignCenter | Qt::TextWordWrap );
-    d_data->footerLabel->setText( footer );
+    m_data->footerLabel->setText( footer );
 
     // legend
-    d_data->legend = NULL;
-
-    // axis
+    m_data->legend = NULL;
+
+    // axes
     initAxesData();
 
     // canvas
-    d_data->canvas = new QwtPlotCanvas( this );
-    d_data->canvas->setObjectName( "QwtPlotCanvas" );
-    d_data->canvas->installEventFilter( this );
+    m_data->canvas = new QwtPlotCanvas( this );
+    m_data->canvas->setObjectName( "QwtPlotCanvas" );
+    m_data->canvas->installEventFilter( this );
 
     setSizePolicy( QSizePolicy::MinimumExpanding,
@@ -178,11 +173,14 @@
     resize( 200, 200 );
 
-    QList<QWidget *> focusChain;
-    focusChain << this << d_data->titleLabel << axisWidget( xTop )
-        << axisWidget( yLeft ) << d_data->canvas << axisWidget( yRight )
-        << axisWidget( xBottom ) << d_data->footerLabel;
+    using namespace QwtAxis;
+
+    QList< QWidget* > focusChain;
+    focusChain << this << m_data->titleLabel << axisWidget( XTop )
+               << axisWidget( YLeft ) << m_data->canvas
+               << axisWidget( YRight ) << axisWidget( XBottom )
+               << m_data->footerLabel;
 
     for ( int i = 0; i < focusChain.size() - 1; i++ )
-        qwtSetTabOrder( focusChain[i], focusChain[i+1], false );
+        qwtSetTabOrder( focusChain[i], focusChain[i + 1], false );
 
     qwtEnableLegendItems( this, true );
@@ -190,34 +188,34 @@
 
 /*!
-  \brief Set the drawing canvas of the plot widget
-
-  QwtPlot invokes methods of the canvas as meta methods ( see QMetaObject ).
-  In opposite to using conventional C++ techniques like virtual methods
-  they allow to use canvas implementations that are derived from
-  QWidget or QGLWidget.
-
-  The following meta methods could be implemented:
-
-  - replot()
+   \brief Set the drawing canvas of the plot widget
+
+   QwtPlot invokes methods of the canvas as meta methods ( see QMetaObject ).
+   In opposite to using conventional C++ techniques like virtual methods
+   they allow to use canvas implementations that are derived from
+   QWidget or QGLWidget.
+
+   The following meta methods could be implemented:
+
+   - replot()
     When the canvas doesn't offer a replot method, QwtPlot calls
     update() instead.
 
-  - borderPath()
+   - borderPath()
     The border path is necessary to clip the content of the canvas
     When the canvas doesn't have any special border ( f.e rounded corners )
     it is o.k. not to implement this method.
 
-  The default canvas is a QwtPlotCanvas
-
-  \param canvas Canvas Widget
-  \sa canvas()
- */
-void QwtPlot::setCanvas( QWidget *canvas )
-{
-    if ( canvas == d_data->canvas )
+   The default canvas is a QwtPlotCanvas
+
+   \param canvas Canvas Widget
+   \sa canvas()
+ */
+void QwtPlot::setCanvas( QWidget* canvas )
+{
+    if ( canvas == m_data->canvas )
         return;
 
-    delete d_data->canvas;
-    d_data->canvas = canvas;
+    delete m_data->canvas;
+    m_data->canvas = canvas;
 
     if ( canvas )
@@ -232,10 +230,10 @@
 
 /*!
-  \brief Adds handling of layout requests
-  \param event Event
-
-  \return See QFrame::event()
-*/
-bool QwtPlot::event( QEvent *event )
+   \brief Adds handling of layout requests
+   \param event Event
+
+   \return See QFrame::event()
+ */
+bool QwtPlot::event( QEvent* event )
 {
     bool ok = QFrame::event( event );
@@ -254,24 +252,24 @@
 
 /*!
-  \brief Event filter
-
-  The plot handles the following events for the canvas:
-
-  - QEvent::Resize
+   \brief Event filter
+
+   The plot handles the following events for the canvas:
+
+   - QEvent::Resize
     The canvas margins might depend on its size
 
-  - QEvent::ContentsRectChange
+   - QEvent::ContentsRectChange
     The layout needs to be recalculated
 
-  \param object Object to be filtered
-  \param event Event
-
-  \return See QFrame::eventFilter()
-
-  \sa updateCanvasMargins(), updateLayout()
-*/
-bool QwtPlot::eventFilter( QObject *object, QEvent *event )
-{
-    if ( object == d_data->canvas )
+   \param object Object to be filtered
+   \param event Event
+
+   \return See QFrame::eventFilter()
+
+   \sa updateCanvasMargins(), updateLayout()
+ */
+bool QwtPlot::eventFilter( QObject* object, QEvent* event )
+{
+    if ( object == m_data->canvas )
     {
         if ( event->type() == QEvent::Resize )
@@ -291,46 +289,46 @@
 void QwtPlot::autoRefresh()
 {
-    if ( d_data->autoReplot )
+    if ( m_data->autoReplot )
         replot();
 }
 
 /*!
-  \brief Set or reset the autoReplot option
-
-  If the autoReplot option is set, the plot will be
-  updated implicitly by manipulating member functions.
-  Since this may be time-consuming, it is recommended
-  to leave this option switched off and call replot()
-  explicitly if necessary.
-
-  The autoReplot option is set to false by default, which
-  means that the user has to call replot() in order to make
-  changes visible.
-  \param tf \c true or \c false. Defaults to \c true.
-  \sa replot()
-*/
+   \brief Set or reset the autoReplot option
+
+   If the autoReplot option is set, the plot will be
+   updated implicitly by manipulating member functions.
+   Since this may be time-consuming, it is recommended
+   to leave this option switched off and call replot()
+   explicitly if necessary.
+
+   The autoReplot option is set to false by default, which
+   means that the user has to call replot() in order to make
+   changes visible.
+   \param tf \c true or \c false. Defaults to \c true.
+   \sa replot()
+ */
 void QwtPlot::setAutoReplot( bool tf )
 {
-    d_data->autoReplot = tf;
-}
-
-/*!
-  \return true if the autoReplot option is set.
-  \sa setAutoReplot()
-*/
+    m_data->autoReplot = tf;
+}
+
+/*!
+   \return true if the autoReplot option is set.
+   \sa setAutoReplot()
+ */
 bool QwtPlot::autoReplot() const
 {
-    return d_data->autoReplot;
-}
-
-/*!
-  Change the plot's title
-  \param title New title
-*/
-void QwtPlot::setTitle( const QString &title )
-{
-    if ( title != d_data->titleLabel->text().text() )
-    {
-        d_data->titleLabel->setText( title );
+    return m_data->autoReplot;
+}
+
+/*!
+   Change the plot's title
+   \param title New title
+ */
+void QwtPlot::setTitle( const QString& title )
+{
+    if ( title != m_data->titleLabel->text().text() )
+    {
+        m_data->titleLabel->setText( title );
         updateLayout();
     }
@@ -338,12 +336,12 @@
 
 /*!
-  Change the plot's title
-  \param title New title
-*/
-void QwtPlot::setTitle( const QwtText &title )
-{
-    if ( title != d_data->titleLabel->text() )
-    {
-        d_data->titleLabel->setText( title );
+   Change the plot's title
+   \param title New title
+ */
+void QwtPlot::setTitle( const QwtText& title )
+{
+    if ( title != m_data->titleLabel->text() )
+    {
+        m_data->titleLabel->setText( title );
         updateLayout();
     }
@@ -353,28 +351,28 @@
 QwtText QwtPlot::title() const
 {
-    return d_data->titleLabel->text();
+    return m_data->titleLabel->text();
 }
 
 //! \return Title label widget.
-QwtTextLabel *QwtPlot::titleLabel()
-{
-    return d_data->titleLabel;
+QwtTextLabel* QwtPlot::titleLabel()
+{
+    return m_data->titleLabel;
 }
 
 //! \return Title label widget.
-const QwtTextLabel *QwtPlot::titleLabel() const
-{
-    return d_data->titleLabel;
-}
-
-/*!
-  Change the text the footer
-  \param text New text of the footer
-*/
-void QwtPlot::setFooter( const QString &text )
-{
-    if ( text != d_data->footerLabel->text().text() )
-    {
-        d_data->footerLabel->setText( text );
+const QwtTextLabel* QwtPlot::titleLabel() const
+{
+    return m_data->titleLabel;
+}
+
+/*!
+   Change the text the footer
+   \param text New text of the footer
+ */
+void QwtPlot::setFooter( const QString& text )
+{
+    if ( text != m_data->footerLabel->text().text() )
+    {
+        m_data->footerLabel->setText( text );
         updateLayout();
     }
@@ -382,12 +380,12 @@
 
 /*!
-  Change the text the footer
-  \param text New text of the footer
-*/
-void QwtPlot::setFooter( const QwtText &text )
-{
-    if ( text != d_data->footerLabel->text() )
-    {
-        d_data->footerLabel->setText( text );
+   Change the text the footer
+   \param text New text of the footer
+ */
+void QwtPlot::setFooter( const QwtText& text )
+{
+    if ( text != m_data->footerLabel->text() )
+    {
+        m_data->footerLabel->setText( text );
         updateLayout();
     }
@@ -397,17 +395,17 @@
 QwtText QwtPlot::footer() const
 {
-    return d_data->footerLabel->text();
+    return m_data->footerLabel->text();
 }
 
 //! \return Footer label widget.
-QwtTextLabel *QwtPlot::footerLabel()
-{
-    return d_data->footerLabel;
+QwtTextLabel* QwtPlot::footerLabel()
+{
+    return m_data->footerLabel;
 }
 
 //! \return Footer label widget.
-const QwtTextLabel *QwtPlot::footerLabel() const
-{
-    return d_data->footerLabel;
+const QwtTextLabel* QwtPlot::footerLabel() const
+{
+    return m_data->footerLabel;
 }
 
@@ -418,10 +416,10 @@
    \sa plotLayout()
  */
-void QwtPlot::setPlotLayout( QwtPlotLayout *layout )
-{
-    if ( layout != d_data->layout )
-    {
-        delete d_data->layout;
-        d_data->layout = layout;
+void QwtPlot::setPlotLayout( QwtPlotLayout* layout )
+{
+    if ( layout != m_data->layout )
+    {
+        delete m_data->layout;
+        m_data->layout = layout;
 
         updateLayout();
@@ -430,256 +428,247 @@
 
 //! \return the plot's layout
-QwtPlotLayout *QwtPlot::plotLayout()
-{
-    return d_data->layout;
+QwtPlotLayout* QwtPlot::plotLayout()
+{
+    return m_data->layout;
 }
 
 //! \return the plot's layout
-const QwtPlotLayout *QwtPlot::plotLayout() const
-{
-    return d_data->layout;
-}
-
-/*!
-  \return the plot's legend
-  \sa insertLegend()
-*/
-QwtAbstractLegend *QwtPlot::legend()
-{
-    return d_data->legend;
-}
-
-/*!
-  \return the plot's legend
-  \sa insertLegend()
-*/
-const QwtAbstractLegend *QwtPlot::legend() const
-{
-    return d_data->legend;
-}
-
-
-/*!
-  \return the plot's canvas
-*/
-QWidget *QwtPlot::canvas()
-{
-    return d_data->canvas;
-}
-
-/*!
-  \return the plot's canvas
-*/
-const QWidget *QwtPlot::canvas() const
-{
-    return d_data->canvas;
-}
-
-/*!
-  \return Size hint for the plot widget
-  \sa minimumSizeHint()
-*/
+const QwtPlotLayout* QwtPlot::plotLayout() const
+{
+    return m_data->layout;
+}
+
+/*!
+   \return the plot's legend
+   \sa insertLegend()
+ */
+QwtAbstractLegend* QwtPlot::legend()
+{
+    return m_data->legend;
+}
+
+/*!
+   \return the plot's legend
+   \sa insertLegend()
+ */
+const QwtAbstractLegend* QwtPlot::legend() const
+{
+    return m_data->legend;
+}
+
+
+/*!
+   \return the plot's canvas
+ */
+QWidget* QwtPlot::canvas()
+{
+    return m_data->canvas;
+}
+
+/*!
+   \return the plot's canvas
+ */
+const QWidget* QwtPlot::canvas() const
+{
+    return m_data->canvas;
+}
+
+/*!
+   \return Size hint for the plot widget
+   \sa minimumSizeHint()
+ */
 QSize QwtPlot::sizeHint() const
 {
     int dw = 0;
     int dh = 0;
-    for ( int axisId = 0; axisId < axisCnt; axisId++ )
-    {
-        if ( axisEnabled( axisId ) )
-        {
-            const int niceDist = 40;
-            const QwtScaleWidget *scaleWidget = axisWidget( axisId );
-            const QwtScaleDiv &scaleDiv = scaleWidget->scaleDraw()->scaleDiv();
-            const int majCnt = scaleDiv.ticks( QwtScaleDiv::MajorTick ).count();
-
-            if ( axisId == yLeft || axisId == yRight )
+
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
+        {
+            const QwtAxisId axisId( axisPos );
+
+            if ( isAxisVisible( axisId ) )
             {
-                int hDiff = ( majCnt - 1 ) * niceDist
-                    - scaleWidget->minimumSizeHint().height();
-                if ( hDiff > dh )
-                    dh = hDiff;
+                const int niceDist = 40;
+                const QwtScaleWidget* scaleWidget = axisWidget( axisId );
+                const QwtScaleDiv& scaleDiv = scaleWidget->scaleDraw()->scaleDiv();
+                const int majCnt = scaleDiv.ticks( QwtScaleDiv::MajorTick ).count();
+
+                const QSize hint = scaleWidget->minimumSizeHint();
+
+                if ( QwtAxis::isYAxis( axisPos ) )
+                {
+                    const int hDiff = ( majCnt - 1 ) * niceDist - hint.height();
+                    dh = qMax( dh, hDiff );
+                }
+                else
+                {
+                    const int wDiff = ( majCnt - 1 ) * niceDist - hint.width();
+                    dw = qMax( dw, wDiff );
+                }
+            }
+        }
+    }
+    return minimumSizeHint() + QSize( dw, dh );
+}
+
+/*!
+   \brief Return a minimum size hint
+ */
+QSize QwtPlot::minimumSizeHint() const
+{
+    QSize hint = m_data->layout->minimumSizeHint( this );
+    hint += QSize( 2 * frameWidth(), 2 * frameWidth() );
+
+    return hint;
+}
+
+/*!
+   Resize and update internal layout
+   \param e Resize event
+ */
+void QwtPlot::resizeEvent( QResizeEvent* e )
+{
+    QFrame::resizeEvent( e );
+    updateLayout();
+}
+
+/*!
+   \brief Redraw the plot
+
+   If the autoReplot option is not set (which is the default)
+   or if any curves are attached to raw data, the plot has to
+   be refreshed explicitly in order to make changes visible.
+
+   \sa updateAxes(), setAutoReplot()
+ */
+void QwtPlot::replot()
+{
+    bool doAutoReplot = autoReplot();
+    setAutoReplot( false );
+
+    updateAxes();
+
+    /*
+       Maybe the layout needs to be updated, because of changed
+       axes labels. We need to process them here before painting
+       to avoid that scales and canvas get out of sync.
+     */
+    QApplication::sendPostedEvents( this, QEvent::LayoutRequest );
+
+    if ( m_data->canvas )
+    {
+        const bool ok = QMetaObject::invokeMethod(
+            m_data->canvas, "replot", Qt::DirectConnection );
+        if ( !ok )
+        {
+            // fallback, when canvas has no a replot method
+            m_data->canvas->update( m_data->canvas->contentsRect() );
+        }
+    }
+
+    setAutoReplot( doAutoReplot );
+}
+
+/*!
+   \brief Adjust plot content to its current size.
+   \sa resizeEvent()
+ */
+void QwtPlot::updateLayout()
+{
+    QwtPlotLayout* layout = m_data->layout;
+    layout->activate( this, contentsRect() );
+
+    const QRect titleRect = layout->titleRect().toRect();
+    const QRect footerRect = layout->footerRect().toRect();
+    const QRect legendRect = layout->legendRect().toRect();
+    const QRect canvasRect = layout->canvasRect().toRect();
+
+    // resize and show the visible widgets
+
+    if ( !m_data->titleLabel->text().isEmpty() )
+    {
+        m_data->titleLabel->setGeometry( titleRect );
+        if ( !m_data->titleLabel->isVisibleTo( this ) )
+            m_data->titleLabel->show();
+    }
+    else
+        m_data->titleLabel->hide();
+
+    if ( !m_data->footerLabel->text().isEmpty() )
+    {
+        m_data->footerLabel->setGeometry( footerRect );
+        if ( !m_data->footerLabel->isVisibleTo( this ) )
+            m_data->footerLabel->show();
+    }
+    else
+    {
+        m_data->footerLabel->hide();
+    }
+
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
+        {
+            const QwtAxisId axisId( axisPos );
+
+            QwtScaleWidget* scaleWidget = axisWidget( axisId );
+
+            if ( isAxisVisible( axisId ) )
+            {
+                const QRect scaleRect = layout->scaleRect( axisId ).toRect();
+
+                if ( scaleRect != scaleWidget->geometry() )
+                {
+                    scaleWidget->setGeometry( scaleRect );
+
+                    int startDist, endDist;
+                    scaleWidget->getBorderDistHint( startDist, endDist );
+                    scaleWidget->setBorderDist( startDist, endDist );
+                }
+
+                if ( !scaleWidget->isVisibleTo( this ) )
+                    scaleWidget->show();
             }
             else
             {
-                int wDiff = ( majCnt - 1 ) * niceDist
-                    - scaleWidget->minimumSizeHint().width();
-                if ( wDiff > dw )
-                    dw = wDiff;
+                scaleWidget->hide();
             }
         }
     }
-    return minimumSizeHint() + QSize( dw, dh );
-}
-
-/*!
-  \brief Return a minimum size hint
-*/
-QSize QwtPlot::minimumSizeHint() const
-{
-    QSize hint = d_data->layout->minimumSizeHint( this );
-    hint += QSize( 2 * frameWidth(), 2 * frameWidth() );
-
-    return hint;
-}
-
-/*!
-  Resize and update internal layout
-  \param e Resize event
-*/
-void QwtPlot::resizeEvent( QResizeEvent *e )
-{
-    QFrame::resizeEvent( e );
-    updateLayout();
-}
-
-/*!
-  \brief Redraw the plot
-
-  If the autoReplot option is not set (which is the default)
-  or if any curves are attached to raw data, the plot has to
-  be refreshed explicitly in order to make changes visible.
-
-  \sa updateAxes(), setAutoReplot()
-*/
-void QwtPlot::replot()
-{
-    bool doAutoReplot = autoReplot();
-    setAutoReplot( false );
-
-    updateAxes();
-
-    /*
-      Maybe the layout needs to be updated, because of changed
-      axes labels. We need to process them here before painting
-      to avoid that scales and canvas get out of sync.
-     */
-    QApplication::sendPostedEvents( this, QEvent::LayoutRequest );
-
-    if ( d_data->canvas )
-    {
-        const bool ok = QMetaObject::invokeMethod(
-            d_data->canvas, "replot", Qt::DirectConnection );
-        if ( !ok )
-        {
-            // fallback, when canvas has no a replot method
-            d_data->canvas->update( d_data->canvas->contentsRect() );
-        }
-    }
-
-    setAutoReplot( doAutoReplot );
-}
-
-/*!
-  \brief Adjust plot content to its current size.
-  \sa resizeEvent()
-*/
-void QwtPlot::updateLayout()
-{
-    d_data->layout->activate( this, contentsRect() );
-
-    QRect titleRect = d_data->layout->titleRect().toRect();
-    QRect footerRect = d_data->layout->footerRect().toRect();
-    QRect scaleRect[QwtPlot::axisCnt];
-    for ( int axisId = 0; axisId < axisCnt; axisId++ )
-        scaleRect[axisId] = d_data->layout->scaleRect( axisId ).toRect();
-    QRect legendRect = d_data->layout->legendRect().toRect();
-    QRect canvasRect = d_data->layout->canvasRect().toRect();
-
-    // resize and show the visible widgets
-
-    if ( !d_data->titleLabel->text().isEmpty() )
-    {
-        d_data->titleLabel->setGeometry( titleRect );
-        if ( !d_data->titleLabel->isVisibleTo( this ) )
-            d_data->titleLabel->show();
-    }
-    else
-        d_data->titleLabel->hide();
-
-    if ( !d_data->footerLabel->text().isEmpty() )
-    {
-        d_data->footerLabel->setGeometry( footerRect );
-        if ( !d_data->footerLabel->isVisibleTo( this ) )
-            d_data->footerLabel->show();
-    }
-    else
-    {
-        d_data->footerLabel->hide();
-    }
-
-    for ( int axisId = 0; axisId < axisCnt; axisId++ )
-    {
-        QwtScaleWidget* scaleWidget = axisWidget( axisId );
-
-        if ( axisEnabled( axisId ) )
-        {
-            if ( scaleRect[axisId] != scaleWidget->geometry() )
-            {
-                scaleWidget->setGeometry( scaleRect[axisId] );
-
-                int startDist, endDist;
-                scaleWidget->getBorderDistHint( startDist, endDist );
-                scaleWidget->setBorderDist( startDist, endDist );
-            }
-
-#if 1
-            if ( axisId == xBottom || axisId == xTop )
-            {
-                // do we need this code any longer ???
-
-                QRegion r( scaleRect[axisId] );
-                if ( axisEnabled( yLeft ) )
-                    r = r.subtracted( QRegion( scaleRect[yLeft] ) );
-                if ( axisEnabled( yRight ) )
-                    r = r.subtracted( QRegion( scaleRect[yRight] ) );
-                r.translate( -scaleRect[ axisId ].x(),
-                    -scaleRect[axisId].y() );
-
-                scaleWidget->setMask( r );
-            }
-#endif
-            if ( !scaleWidget->isVisibleTo( this ) )
-                scaleWidget->show();
+
+    if ( m_data->legend )
+    {
+        if ( m_data->legend->isEmpty() )
+        {
+            m_data->legend->hide();
         }
         else
         {
-            scaleWidget->hide();
-        }
-    }
-
-    if ( d_data->legend )
-    {
-        if ( d_data->legend->isEmpty() )
-        {
-            d_data->legend->hide();
-        }
-        else
-        {
-            d_data->legend->setGeometry( legendRect );
-            d_data->legend->show();
-        }
-    }
-
-    d_data->canvas->setGeometry( canvasRect );
-}
-
-/*!
-  \brief Calculate the canvas margins
-
-  \param maps QwtPlot::axisCnt maps, mapping between plot and paint device coordinates
-  \param canvasRect Bounding rectangle where to paint
-  \param left Return parameter for the left margin
-  \param top Return parameter for the top margin
-  \param right Return parameter for the right margin
-  \param bottom Return parameter for the bottom margin
-
-  Plot items might indicate, that they need some extra space
-  at the borders of the canvas by the QwtPlotItem::Margins flag.
-
-  updateCanvasMargins(), QwtPlotItem::getCanvasMarginHint()
+            m_data->legend->setGeometry( legendRect );
+            m_data->legend->show();
+        }
+    }
+
+    m_data->canvas->setGeometry( canvasRect );
+}
+
+/*!
+   \brief Calculate the canvas margins
+
+   \param maps QwtAxis::AxisCount maps, mapping between plot and paint device coordinates
+   \param canvasRect Bounding rectangle where to paint
+   \param left Return parameter for the left margin
+   \param top Return parameter for the top margin
+   \param right Return parameter for the right margin
+   \param bottom Return parameter for the bottom margin
+
+   Plot items might indicate, that they need some extra space
+   at the borders of the canvas by the QwtPlotItem::Margins flag.
+
+   updateCanvasMargins(), QwtPlotItem::getCanvasMarginHint()
  */
 void QwtPlot::getCanvasMarginsHint(
-    const QwtScaleMap maps[], const QRectF &canvasRect,
-    double &left, double &top, double &right, double &bottom) const
+    const QwtScaleMap maps[], const QRectF& canvasRect,
+    double& left, double& top, double& right, double& bottom) const
 {
     left = top = right = bottom = -1.0;
@@ -689,45 +678,49 @@
         it != itmList.end(); ++it )
     {
-        const QwtPlotItem *item = *it;
+        const QwtPlotItem* item = *it;
         if ( item->testItemAttribute( QwtPlotItem::Margins ) )
         {
-            double m[ QwtPlot::axisCnt ];
+            using namespace QwtAxis;
+
+            double m[ AxisPositions ];
             item->getCanvasMarginHint(
                 maps[ item->xAxis() ], maps[ item->yAxis() ],
-                canvasRect, m[yLeft], m[xTop], m[yRight], m[xBottom] );
-
-            left = qMax( left, m[yLeft] );
-            top = qMax( top, m[xTop] );
-            right = qMax( right, m[yRight] );
-            bottom = qMax( bottom, m[xBottom] );
-        }
-    }
-}
-
-/*!
-  \brief Update the canvas margins
-
-  Plot items might indicate, that they need some extra space
-  at the borders of the canvas by the QwtPlotItem::Margins flag.
-
-  getCanvasMarginsHint(), QwtPlotItem::getCanvasMarginHint()
+                canvasRect, m[YLeft], m[XTop], m[YRight], m[XBottom] );
+
+            left = qwtMaxF( left, m[YLeft] );
+            top = qwtMaxF( top, m[XTop] );
+            right = qwtMaxF( right, m[YRight] );
+            bottom = qwtMaxF( bottom, m[XBottom] );
+        }
+    }
+}
+
+/*!
+   \brief Update the canvas margins
+
+   Plot items might indicate, that they need some extra space
+   at the borders of the canvas by the QwtPlotItem::Margins flag.
+
+   getCanvasMarginsHint(), QwtPlotItem::getCanvasMarginHint()
  */
 void QwtPlot::updateCanvasMargins()
 {
-    QwtScaleMap maps[axisCnt];
-    for ( int axisId = 0; axisId < axisCnt; axisId++ )
+    using namespace QwtAxis;
+
+    QwtScaleMap maps[ AxisPositions ];
+    for ( int axisId = 0; axisId < AxisPositions; axisId++ )
         maps[axisId] = canvasMap( axisId );
 
-    double margins[axisCnt];
+    double margins[AxisPositions];
     getCanvasMarginsHint( maps, canvas()->contentsRect(),
-        margins[yLeft], margins[xTop], margins[yRight], margins[xBottom] );
+        margins[YLeft], margins[XTop], margins[YRight], margins[XBottom] );
 
     bool doUpdate = false;
-    for ( int axisId = 0; axisId < axisCnt; axisId++ )
-    {
-        if ( margins[axisId] >= 0.0 )
-        {
-            const int m = qCeil( margins[axisId] );
-            plotLayout()->setCanvasMargin( m, axisId);
+    for ( int axisPos = 0; axisPos < AxisPositions; axisPos++ )
+    {
+        if ( margins[axisPos] >= 0.0 )
+        {
+            const int m = qwtCeil( margins[axisPos] );
+            plotLayout()->setCanvasMargin( m, axisPos);
             doUpdate = true;
         }
@@ -739,36 +732,36 @@
 
 /*!
-  Redraw the canvas.
-  \param painter Painter used for drawing
-
-  \warning drawCanvas calls drawItems what is also used
+   Redraw the canvas.
+   \param painter Painter used for drawing
+
+   \warning drawCanvas calls drawItems what is also used
            for printing. Applications that like to add individual
            plot items better overload drawItems()
-  \sa drawItems()
-*/
-void QwtPlot::drawCanvas( QPainter *painter )
-{
-    QwtScaleMap maps[axisCnt];
-    for ( int axisId = 0; axisId < axisCnt; axisId++ )
-        maps[axisId] = canvasMap( axisId );
-
-    drawItems( painter, d_data->canvas->contentsRect(), maps );
-}
-
-/*!
-  Redraw the canvas items.
-
-  \param painter Painter used for drawing
-  \param canvasRect Bounding rectangle where to paint
-  \param maps QwtPlot::axisCnt maps, mapping between plot and paint device coordinates
-
-  \note Usually canvasRect is contentsRect() of the plot canvas.
+   \sa drawItems()
+ */
+void QwtPlot::drawCanvas( QPainter* painter )
+{
+    QwtScaleMap maps[ QwtAxis::AxisPositions ];
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+        maps[axisPos] = canvasMap( axisPos );
+
+    drawItems( painter, m_data->canvas->contentsRect(), maps );
+}
+
+/*!
+   Redraw the canvas items.
+
+   \param painter Painter used for drawing
+   \param canvasRect Bounding rectangle where to paint
+   \param maps QwtAxis::AxisCount maps, mapping between plot and paint device coordinates
+
+   \note Usually canvasRect is contentsRect() of the plot canvas.
         Due to a bug in Qt this rectangle might be wrong for certain
         frame styles ( f.e QFrame::Box ) and it might be necessary to
         fix the margins manually using QWidget::setContentsMargins()
-*/
-
-void QwtPlot::drawItems( QPainter *painter, const QRectF &canvasRect,
-        const QwtScaleMap maps[axisCnt] ) const
+ */
+
+void QwtPlot::drawItems( QPainter* painter, const QRectF& canvasRect,
+    const QwtScaleMap maps[ QwtAxis::AxisPositions ] ) const
 {
     const QwtPlotItemList& itmList = itemList();
@@ -776,17 +769,21 @@
         it != itmList.end(); ++it )
     {
-        QwtPlotItem *item = *it;
+        QwtPlotItem* item = *it;
         if ( item && item->isVisible() )
         {
+            const QwtAxisId xAxis = item->xAxis();
+            const QwtAxisId yAxis = item->yAxis();
+
             painter->save();
 
             painter->setRenderHint( QPainter::Antialiasing,
                 item->testRenderHint( QwtPlotItem::RenderAntialiased ) );
+
+#if QT_VERSION < 0x050100
             painter->setRenderHint( QPainter::HighQualityAntialiasing,
                 item->testRenderHint( QwtPlotItem::RenderAntialiased ) );
-
-            item->draw( painter,
-                maps[item->xAxis()], maps[item->yAxis()],
-                canvasRect );
+#endif
+
+            item->draw( painter, maps[xAxis], maps[yAxis], canvasRect );
 
             painter->restore();
@@ -796,27 +793,26 @@
 
 /*!
-  \param axisId Axis
-  \return Map for the axis on the canvas. With this map pixel coordinates can
+   \param axisId Axis
+   \return Map for the axis on the canvas. With this map pixel coordinates can
           translated to plot coordinates and vice versa.
-  \sa QwtScaleMap, transform(), invTransform()
-
-*/
-QwtScaleMap QwtPlot::canvasMap( int axisId ) const
+   \sa QwtScaleMap, transform(), invTransform()
+ */
+QwtScaleMap QwtPlot::canvasMap( QwtAxisId axisId ) const
 {
     QwtScaleMap map;
-    if ( !d_data->canvas )
+    if ( !m_data->canvas )
         return map;
 
     map.setTransformation( axisScaleEngine( axisId )->transformation() );
 
-    const QwtScaleDiv &sd = axisScaleDiv( axisId );
+    const QwtScaleDiv& sd = axisScaleDiv( axisId );
     map.setScaleInterval( sd.lowerBound(), sd.upperBound() );
 
-    if ( axisEnabled( axisId ) )
-    {
-        const QwtScaleWidget *s = axisWidget( axisId );
-        if ( axisId == yLeft || axisId == yRight )
-        {
-            double y = s->y() + s->startBorderDist() - d_data->canvas->y();
+    if ( isAxisVisible( axisId ) )
+    {
+        const QwtScaleWidget* s = axisWidget( axisId );
+        if ( QwtAxis::isYAxis( axisId ) )
+        {
+            double y = s->y() + s->startBorderDist() - m_data->canvas->y();
             double h = s->height() - s->startBorderDist() - s->endBorderDist();
             map.setPaintInterval( y + h, y );
@@ -824,5 +820,5 @@
         else
         {
-            double x = s->x() + s->startBorderDist() - d_data->canvas->x();
+            double x = s->x() + s->startBorderDist() - m_data->canvas->x();
             double w = s->width() - s->startBorderDist() - s->endBorderDist();
             map.setPaintInterval( x, x + w );
@@ -831,14 +827,16 @@
     else
     {
-        const QRect &canvasRect = d_data->canvas->contentsRect();
-        if ( axisId == yLeft || axisId == yRight )
+        using namespace QwtAxis;
+
+        const QRect& canvasRect = m_data->canvas->contentsRect();
+        if ( isYAxis( axisId ) )
         {
             int top = 0;
-            if ( !plotLayout()->alignCanvasToScale( xTop ) )
-                top = plotLayout()->canvasMargin( xTop );
+            if ( !plotLayout()->alignCanvasToScale( XTop ) )
+                top = plotLayout()->canvasMargin( XTop );
 
             int bottom = 0;
-            if ( !plotLayout()->alignCanvasToScale( xBottom ) )
-                bottom = plotLayout()->canvasMargin( xBottom );
+            if ( !plotLayout()->alignCanvasToScale( XBottom ) )
+                bottom = plotLayout()->canvasMargin( XBottom );
 
             map.setPaintInterval( canvasRect.bottom() - bottom,
@@ -848,10 +846,10 @@
         {
             int left = 0;
-            if ( !plotLayout()->alignCanvasToScale( yLeft ) )
-                left = plotLayout()->canvasMargin( yLeft );
+            if ( !plotLayout()->alignCanvasToScale( YLeft ) )
+                left = plotLayout()->canvasMargin( YLeft );
 
             int right = 0;
-            if ( !plotLayout()->alignCanvasToScale( yRight ) )
-                right = plotLayout()->canvasMargin( yRight );
+            if ( !plotLayout()->alignCanvasToScale( YRight ) )
+                right = plotLayout()->canvasMargin( YRight );
 
             map.setPaintInterval( canvasRect.left() + left,
@@ -864,16 +862,16 @@
 
 /*!
-  \brief Change the background of the plotting area
-
-  Sets brush to QPalette::Window of all color groups of
-  the palette of the canvas. Using canvas()->setPalette()
-  is a more powerful way to set these colors.
-
-  \param brush New background brush
-  \sa canvasBackground()
-*/
-void QwtPlot::setCanvasBackground( const QBrush &brush )
-{
-    QPalette pal = d_data->canvas->palette();
+   \brief Change the background of the plotting area
+
+   Sets brush to QPalette::Window of all color groups of
+   the palette of the canvas. Using canvas()->setPalette()
+   is a more powerful way to set these colors.
+
+   \param brush New background brush
+   \sa canvasBackground()
+ */
+void QwtPlot::setCanvasBackground( const QBrush& brush )
+{
+    QPalette pal = m_data->canvas->palette();
     pal.setBrush( QPalette::Window, brush );
 
@@ -882,10 +880,10 @@
 
 /*!
-  Nothing else than: canvas()->palette().brush(
+   Nothing else than: canvas()->palette().brush(
         QPalette::Normal, QPalette::Window);
 
-  \return Background brush of the plotting area.
-  \sa setCanvasBackground()
-*/
+   \return Background brush of the plotting area.
+   \sa setCanvasBackground()
+ */
 QBrush QwtPlot::canvasBackground() const
 {
@@ -895,36 +893,27 @@
 
 /*!
-  \return \c true if the specified axis exists, otherwise \c false
-  \param axisId axis index
- */
-bool QwtPlot::axisValid( int axisId )
-{
-    return ( ( axisId >= QwtPlot::yLeft ) && ( axisId < QwtPlot::axisCnt ) );
-}
-
-/*!
-  \brief Insert a legend
-
-  If the position legend is \c QwtPlot::LeftLegend or \c QwtPlot::RightLegend
-  the legend will be organized in one column from top to down.
-  Otherwise the legend items will be placed in a table
-  with a best fit number of columns from left to right.
-
-  insertLegend() will set the plot widget as parent for the legend.
-  The legend will be deleted in the destructor of the plot or when
-  another legend is inserted.
-
-  Legends, that are not inserted into the layout of the plot widget
-  need to connect to the legendDataChanged() signal. Calling updateLegend()
-  initiates this signal for an initial update. When the application code
-  wants to implement its own layout this also needs to be done for
-  rendering plots to a document ( see QwtPlotRenderer ).
-
-  \param legend Legend
-  \param pos The legend's position. For top/left position the number
+   \brief Insert a legend
+
+   If the position legend is \c QwtPlot::LeftLegend or \c QwtPlot::RightLegend
+   the legend will be organized in one column from top to down.
+   Otherwise the legend items will be placed in a table
+   with a best fit number of columns from left to right.
+
+   insertLegend() will set the plot widget as parent for the legend.
+   The legend will be deleted in the destructor of the plot or when
+   another legend is inserted.
+
+   Legends, that are not inserted into the layout of the plot widget
+   need to connect to the legendDataChanged() signal. Calling updateLegend()
+   initiates this signal for an initial update. When the application code
+   wants to implement its own layout this also needs to be done for
+   rendering plots to a document ( see QwtPlotRenderer ).
+
+   \param legend Legend
+   \param pos The legend's position. For top/left position the number
              of columns will be limited to 1, otherwise it will be set to
              unlimited.
 
-  \param ratio Ratio between legend and the bounding rectangle
+   \param ratio Ratio between legend and the bounding rectangle
                of title, canvas and axes. The legend will be shrunk
                if it would need more space than the given ratio.
@@ -933,28 +922,28 @@
                The default vertical/horizontal ratio is 0.33/0.5.
 
-  \sa legend(), QwtPlotLayout::legendPosition(),
+   \sa legend(), QwtPlotLayout::legendPosition(),
       QwtPlotLayout::setLegendPosition()
-*/
-void QwtPlot::insertLegend( QwtAbstractLegend *legend,
+ */
+void QwtPlot::insertLegend( QwtAbstractLegend* legend,
     QwtPlot::LegendPosition pos, double ratio )
 {
-    d_data->layout->setLegendPosition( pos, ratio );
-
-    if ( legend != d_data->legend )
-    {
-        if ( d_data->legend && d_data->legend->parent() == this )
-            delete d_data->legend;
-
-        d_data->legend = legend;
-
-        if ( d_data->legend )
+    m_data->layout->setLegendPosition( pos, ratio );
+
+    if ( legend != m_data->legend )
+    {
+        if ( m_data->legend && m_data->legend->parent() == this )
+            delete m_data->legend;
+
+        m_data->legend = legend;
+
+        if ( m_data->legend )
         {
             connect(
                 this, SIGNAL(legendDataChanged(QVariant,QList<QwtLegendData>)),
-                d_data->legend, SLOT(updateLegend(QVariant,QList<QwtLegendData>) )
-            );
-
-            if ( d_data->legend->parent() != this )
-                d_data->legend->setParent( this );
+                m_data->legend, SLOT(updateLegend(QVariant,QList<QwtLegendData>))
+                );
+
+            if ( m_data->legend->parent() != this )
+                m_data->legend->setParent( this );
 
             qwtEnableLegendItems( this, false );
@@ -962,8 +951,8 @@
             qwtEnableLegendItems( this, true );
 
-            QwtLegend *lgd = qobject_cast<QwtLegend *>( legend );
+            QwtLegend* lgd = qobject_cast< QwtLegend* >( legend );
             if ( lgd )
             {
-                switch ( d_data->layout->legendPosition() )
+                switch ( m_data->layout->legendPosition() )
                 {
                     case LeftLegend:
@@ -985,10 +974,11 @@
             }
 
-            QWidget *previousInChain = NULL;
-            switch ( d_data->layout->legendPosition() )
+            QWidget* previousInChain = NULL;
+            switch ( m_data->layout->legendPosition() )
             {
                 case LeftLegend:
                 {
-                    previousInChain = axisWidget( QwtPlot::xTop );
+                    const QwtAxisId axisId( QwtAxis::XTop );
+                    previousInChain = axisWidget( axisId );
                     break;
                 }
@@ -1000,5 +990,6 @@
                 case RightLegend:
                 {
-                    previousInChain = axisWidget( QwtPlot::yRight );
+                    const QwtAxisId axisId( QwtAxis::YRight );
+                    previousInChain = axisWidget( axisId );
                     break;
                 }
@@ -1019,7 +1010,7 @@
 
 /*!
-  Emit legendDataChanged() for all plot item
-
-  \sa QwtPlotItem::legendData(), legendDataChanged()
+   Emit legendDataChanged() for all plot item
+
+   \sa QwtPlotItem::legendData(), legendDataChanged()
  */
 void QwtPlot::updateLegend()
@@ -1034,39 +1025,39 @@
 
 /*!
-  Emit legendDataChanged() for a plot item
-
-  \param plotItem Plot item
-  \sa QwtPlotItem::legendData(), legendDataChanged()
- */
-void QwtPlot::updateLegend( const QwtPlotItem *plotItem )
+   Emit legendDataChanged() for a plot item
+
+   \param plotItem Plot item
+   \sa QwtPlotItem::legendData(), legendDataChanged()
+ */
+void QwtPlot::updateLegend( const QwtPlotItem* plotItem )
 {
     if ( plotItem == NULL )
         return;
 
-    QList<QwtLegendData> legendData;
+    QList< QwtLegendData > legendData;
 
     if ( plotItem->testItemAttribute( QwtPlotItem::Legend ) )
         legendData = plotItem->legendData();
 
-    const QVariant itemInfo = itemToInfo( const_cast< QwtPlotItem *>( plotItem) );
+    const QVariant itemInfo = itemToInfo( const_cast< QwtPlotItem* >( plotItem ) );
     Q_EMIT legendDataChanged( itemInfo, legendData );
 }
 
 /*!
-  \brief Update all plot items interested in legend attributes
-
-  Call QwtPlotItem::updateLegend(), when the QwtPlotItem::LegendInterest
-  flag is set.
-
-  \param itemInfo Info about the plot item
-  \param legendData Entries to be displayed for the plot item ( usually 1 )
-
-  \sa QwtPlotItem::LegendInterest,
+   \brief Update all plot items interested in legend attributes
+
+   Call QwtPlotItem::updateLegend(), when the QwtPlotItem::LegendInterest
+   flag is set.
+
+   \param itemInfo Info about the plot item
+   \param legendData Entries to be displayed for the plot item ( usually 1 )
+
+   \sa QwtPlotItem::LegendInterest,
       QwtPlotLegendItem, QwtPlotItem::updateLegend()
  */
-void QwtPlot::updateLegendItems( const QVariant &itemInfo,
-    const QList<QwtLegendData> &legendData )
-{
-    QwtPlotItem *plotItem = infoToItem( itemInfo );
+void QwtPlot::updateLegendItems( const QVariant& itemInfo,
+    const QList< QwtLegendData >& legendData )
+{
+    QwtPlotItem* plotItem = infoToItem( itemInfo );
     if ( plotItem )
     {
@@ -1075,5 +1066,5 @@
             it != itmList.end(); ++it )
         {
-            QwtPlotItem *item = *it;
+            QwtPlotItem* item = *it;
             if ( item->testItemInterest( QwtPlotItem::LegendInterest ) )
                 item->updateLegend( plotItem, legendData );
@@ -1083,10 +1074,10 @@
 
 /*!
-  \brief Attach/Detach a plot item
-
-  \param plotItem Plot item
-  \param on When true attach the item, otherwise detach it
- */
-void QwtPlot::attachItem( QwtPlotItem *plotItem, bool on )
+   \brief Attach/Detach a plot item
+
+   \param plotItem Plot item
+   \param on When true attach the item, otherwise detach it
+ */
+void QwtPlot::attachItem( QwtPlotItem* plotItem, bool on )
 {
     if ( plotItem->testItemInterest( QwtPlotItem::LegendInterest ) )
@@ -1098,7 +1089,7 @@
             it != itmList.end(); ++it )
         {
-            QwtPlotItem *item = *it;
-
-            QList<QwtLegendData> legendData;
+            QwtPlotItem* item = *it;
+
+            QList< QwtLegendData > legendData;
             if ( on && item->testItemAttribute( QwtPlotItem::Legend ) )
             {
@@ -1127,5 +1118,5 @@
         {
             const QVariant itemInfo = itemToInfo( plotItem );
-            Q_EMIT legendDataChanged( itemInfo, QList<QwtLegendData>() );
+            Q_EMIT legendDataChanged( itemInfo, QList< QwtLegendData >() );
         }
     }
@@ -1135,50 +1126,42 @@
 
 /*!
-  \brief Build an information, that can be used to identify
+   \brief Build an information, that can be used to identify
          a plot item on the legend.
 
-  The default implementation simply wraps the plot item
-  into a QVariant object. When overloading itemToInfo()
-  usually infoToItem() needs to reimplemeted too.
-
-\code
-    QVariant itemInfo;
-    qVariantSetValue( itemInfo, plotItem );
-\endcode
-
-  \param plotItem Plot item
-  \return Plot item embedded in a QVariant
-  \sa infoToItem()
- */
-QVariant QwtPlot::itemToInfo( QwtPlotItem *plotItem ) const
-{
-    QVariant itemInfo;
-    qVariantSetValue( itemInfo, plotItem );
-
-    return itemInfo;
-}
-
-/*!
-  \brief Identify the plot item according to an item info object,
+   The default implementation simply wraps the plot item
+   into a QVariant object. When overloading itemToInfo()
+   usually infoToItem() needs to reimplemeted too.
+
+   \param plotItem Plot item
+   \return Plot item embedded in a QVariant
+   \sa infoToItem()
+ */
+QVariant QwtPlot::itemToInfo( QwtPlotItem* plotItem ) const
+{
+    return QVariant::fromValue( plotItem );
+}
+
+/*!
+   \brief Identify the plot item according to an item info object,
          that has bee generated from itemToInfo().
 
-  The default implementation simply tries to unwrap a QwtPlotItem
-  pointer:
-
-\code
+   The default implementation simply tries to unwrap a QwtPlotItem
+   pointer:
+
+   \code
     if ( itemInfo.canConvert<QwtPlotItem *>() )
         return qvariant_cast<QwtPlotItem *>( itemInfo );
-\endcode
-  \param itemInfo Plot item
-  \return A plot item, when successful, otherwise a NULL pointer.
-  \sa itemToInfo()
-*/
-QwtPlotItem *QwtPlot::infoToItem( const QVariant &itemInfo ) const
-{
-    if ( itemInfo.canConvert<QwtPlotItem *>() )
-        return qvariant_cast<QwtPlotItem *>( itemInfo );
+   \endcode
+   \param itemInfo Plot item
+   \return A plot item, when successful, otherwise a NULL pointer.
+   \sa itemToInfo()
+ */
+QwtPlotItem* QwtPlot::infoToItem( const QVariant& itemInfo ) const
+{
+    if ( itemInfo.canConvert< QwtPlotItem* >() )
+        return qvariant_cast< QwtPlotItem* >( itemInfo );
 
     return NULL;
 }
 
-
+#include "moc_qwt_plot.cpp"
Index: /trunk/BNC/qwt/qwt_plot.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,11 +12,8 @@
 
 #include "qwt_global.h"
-#include "qwt_text.h"
+#include "qwt_axis_id.h"
 #include "qwt_plot_dict.h"
-#include "qwt_scale_map.h"
-#include "qwt_interval.h"
+
 #include <qframe.h>
-#include <qlist.h>
-#include <qvariant.h>
 
 class QwtPlotLayout;
@@ -25,32 +22,39 @@
 class QwtScaleEngine;
 class QwtScaleDiv;
+class QwtScaleMap;
 class QwtScaleDraw;
 class QwtTextLabel;
+class QwtInterval;
+class QwtText;
+template< typename T > class QList;
+
+// 6.1 compatibility definitions
+#define QWT_AXIS_COMPAT 1
 
 /*!
-  \brief A 2-D plotting widget
-
-  QwtPlot is a widget for plotting two-dimensional graphs.
-  An unlimited number of plot items can be displayed on
-  its canvas. Plot items might be curves (QwtPlotCurve), markers
-  (QwtPlotMarker), the grid (QwtPlotGrid), or anything else derived
-  from QwtPlotItem.
-  A plot can have up to four axes, with each plot item attached to an x- and
-  a y axis. The scales at the axes can be explicitly set (QwtScaleDiv), or
-  are calculated from the plot items, using algorithms (QwtScaleEngine) which
-  can be configured separately for each axis.
-
-  The simpleplot example is a good starting point to see how to set up a
-  plot widget.
-
-  \image html plot.png
-
-  \par Example
+   \brief A 2-D plotting widget
+
+   QwtPlot is a widget for plotting two-dimensional graphs.
+   An unlimited number of plot items can be displayed on
+   its canvas. Plot items might be curves (QwtPlotCurve), markers
+   (QwtPlotMarker), the grid (QwtPlotGrid), or anything else derived
+   from QwtPlotItem.
+   A plot can have up to four axes, with each plot item attached to an x- and
+   a y axis. The scales at the axes can be explicitly set (QwtScaleDiv), or
+   are calculated from the plot items, using algorithms (QwtScaleEngine) which
+   can be configured separately for each axis.
+
+   The simpleplot example is a good starting point to see how to set up a
+   plot widget.
+
+   \image html plot.png
+
+   \par Example
     The following example shows (schematically) the most simple
     way to use QwtPlot. By default, only the left and bottom axes are
     visible and their scales are computed automatically.
     \code
-      #include <qwt_plot.h>
-      #include <qwt_plot_curve.h>
+ #include <qwt_plot.h>
+ #include <qwt_plot_curve.h>
 
       QwtPlot *myPlot = new QwtPlot( "Two Curves", parent );
@@ -70,8 +74,7 @@
       myPlot->replot();
     \endcode
-  \endpar
-*/
-
-class QWT_EXPORT QwtPlot: public QFrame, public QwtPlotDict
+ */
+
+class QWT_EXPORT QwtPlot : public QFrame, public QwtPlotDict
 {
     Q_OBJECT
@@ -79,35 +82,8 @@
     Q_PROPERTY( QBrush canvasBackground
         READ canvasBackground WRITE setCanvasBackground )
+
     Q_PROPERTY( bool autoReplot READ autoReplot WRITE setAutoReplot )
 
-#if 0
-    // This property is intended to configure the plot
-    // widget from a special dialog in the deigner plugin.
-    // Disabled until such a dialog has been implemented.
-
-    Q_PROPERTY( QString propertiesDocument
-        READ grabProperties WRITE applyProperties )
-#endif
-
-public:
-    //! \brief Axis index
-    enum Axis
-    {
-        //! Y axis left of the canvas
-        yLeft,
-
-        //! Y axis right of the canvas
-        yRight,
-
-        //! X axis below the canvas
-        xBottom,
-
-        //! X axis above the canvas
-        xTop,
-
-        //! Number of axes
-        axisCnt
-    };
-
+  public:
     /*!
         Position of the legend, relative to the canvas.
@@ -117,8 +93,8 @@
     enum LegendPosition
     {
-        //! The legend will be left from the QwtPlot::yLeft axis.
+        //! The legend will be left from the QwtAxis::YLeft axis.
         LeftLegend,
 
-        //! The legend will be right from the QwtPlot::yRight axis.
+        //! The legend will be right from the QwtAxis::YRight axis.
         RightLegend,
 
@@ -130,11 +106,8 @@
     };
 
-    explicit QwtPlot( QWidget * = NULL );
-    explicit QwtPlot( const QwtText &title, QWidget * = NULL );
+    explicit QwtPlot( QWidget* = NULL );
+    explicit QwtPlot( const QwtText& title, QWidget* = NULL );
 
     virtual ~QwtPlot();
-
-    void applyProperties( const QString & );
-    QString grabProperties() const;
 
     void setAutoReplot( bool = true );
@@ -143,103 +116,106 @@
     // Layout
 
-    void setPlotLayout( QwtPlotLayout * );
-
-    QwtPlotLayout *plotLayout();
-    const QwtPlotLayout *plotLayout() const;
+    void setPlotLayout( QwtPlotLayout* );
+
+    QwtPlotLayout* plotLayout();
+    const QwtPlotLayout* plotLayout() const;
 
     // Title
 
-    void setTitle( const QString & );
-    void setTitle( const QwtText & );
+    void setTitle( const QString& );
+    void setTitle( const QwtText& );
     QwtText title() const;
 
-    QwtTextLabel *titleLabel();
-    const QwtTextLabel *titleLabel() const;
+    QwtTextLabel* titleLabel();
+    const QwtTextLabel* titleLabel() const;
 
     // Footer
 
-    void setFooter( const QString & );
-    void setFooter( const QwtText & );
+    void setFooter( const QString& );
+    void setFooter( const QwtText& );
     QwtText footer() const;
 
-    QwtTextLabel *footerLabel();
-    const QwtTextLabel *footerLabel() const;
+    QwtTextLabel* footerLabel();
+    const QwtTextLabel* footerLabel() const;
 
     // Canvas
 
-    void setCanvas( QWidget * );
-
-    QWidget *canvas();
-    const QWidget *canvas() const;
-
-    void setCanvasBackground( const QBrush & );
+    void setCanvas( QWidget* );
+
+    QWidget* canvas();
+    const QWidget* canvas() const;
+
+    void setCanvasBackground( const QBrush& );
     QBrush canvasBackground() const;
 
-    virtual QwtScaleMap canvasMap( int axisId ) const;
-
-    double invTransform( int axisId, int pos ) const;
-    double transform( int axisId, double value ) const;
+    virtual QwtScaleMap canvasMap( QwtAxisId ) const;
+
+    double invTransform( QwtAxisId, double pos ) const;
+    double transform( QwtAxisId, double value ) const;
 
     // Axes
 
-    QwtScaleEngine *axisScaleEngine( int axisId );
-    const QwtScaleEngine *axisScaleEngine( int axisId ) const;
-    void setAxisScaleEngine( int axisId, QwtScaleEngine * );
-
-    void setAxisAutoScale( int axisId, bool on = true );
-    bool axisAutoScale( int axisId ) const;
-
-    void enableAxis( int axisId, bool tf = true );
-    bool axisEnabled( int axisId ) const;
-
-    void setAxisFont( int axisId, const QFont & );
-    QFont axisFont( int axisId ) const;
-
-    void setAxisScale( int axisId, double min, double max, double stepSize = 0 );
-    void setAxisScaleDiv( int axisId, const QwtScaleDiv & );
-    void setAxisScaleDraw( int axisId, QwtScaleDraw * );
-
-    double axisStepSize( int axisId ) const;
-    QwtInterval axisInterval( int axisId ) const;
-
-    const QwtScaleDiv &axisScaleDiv( int axisId ) const;
-
-    const QwtScaleDraw *axisScaleDraw( int axisId ) const;
-    QwtScaleDraw *axisScaleDraw( int axisId );
-
-    const QwtScaleWidget *axisWidget( int axisId ) const;
-    QwtScaleWidget *axisWidget( int axisId );
-
-    void setAxisLabelAlignment( int axisId, Qt::Alignment );
-    void setAxisLabelRotation( int axisId, double rotation );
-
-    void setAxisTitle( int axisId, const QString & );
-    void setAxisTitle( int axisId, const QwtText & );
-    QwtText axisTitle( int axisId ) const;
-
-    void setAxisMaxMinor( int axisId, int maxMinor );
-    int axisMaxMinor( int axisId ) const;
-
-    void setAxisMaxMajor( int axisId, int maxMajor );
-    int axisMaxMajor( int axisId ) const;
+    bool isAxisValid( QwtAxisId ) const;
+
+    void setAxisVisible( QwtAxisId, bool on = true );
+    bool isAxisVisible( QwtAxisId ) const;
+
+    // Axes data
+
+    QwtScaleEngine* axisScaleEngine( QwtAxisId );
+    const QwtScaleEngine* axisScaleEngine( QwtAxisId ) const;
+    void setAxisScaleEngine( QwtAxisId, QwtScaleEngine* );
+
+    void setAxisAutoScale( QwtAxisId, bool on = true );
+    bool axisAutoScale( QwtAxisId ) const;
+
+    void setAxisFont( QwtAxisId, const QFont& );
+    QFont axisFont( QwtAxisId ) const;
+
+    void setAxisScale( QwtAxisId, double min, double max, double stepSize = 0 );
+    void setAxisScaleDiv( QwtAxisId, const QwtScaleDiv& );
+    void setAxisScaleDraw( QwtAxisId, QwtScaleDraw* );
+
+    double axisStepSize( QwtAxisId ) const;
+    QwtInterval axisInterval( QwtAxisId ) const;
+    const QwtScaleDiv& axisScaleDiv( QwtAxisId ) const;
+
+    const QwtScaleDraw* axisScaleDraw( QwtAxisId ) const;
+    QwtScaleDraw* axisScaleDraw( QwtAxisId );
+
+    const QwtScaleWidget* axisWidget( QwtAxisId ) const;
+    QwtScaleWidget* axisWidget( QwtAxisId );
+
+    void setAxisLabelAlignment( QwtAxisId, Qt::Alignment );
+    void setAxisLabelRotation( QwtAxisId, double rotation );
+
+    void setAxisTitle( QwtAxisId, const QString& );
+    void setAxisTitle( QwtAxisId, const QwtText& );
+    QwtText axisTitle( QwtAxisId ) const;
+
+    void setAxisMaxMinor( QwtAxisId, int maxMinor );
+    int axisMaxMinor( QwtAxisId ) const;
+
+    void setAxisMaxMajor( QwtAxisId, int maxMajor );
+    int axisMaxMajor( QwtAxisId ) const;
 
     // Legend
 
-    void insertLegend( QwtAbstractLegend *,
+    void insertLegend( QwtAbstractLegend*,
         LegendPosition = QwtPlot::RightLegend, double ratio = -1.0 );
 
-    QwtAbstractLegend *legend();
-    const QwtAbstractLegend *legend() const;
+    QwtAbstractLegend* legend();
+    const QwtAbstractLegend* legend() const;
 
     void updateLegend();
-    void updateLegend( const QwtPlotItem * );
+    void updateLegend( const QwtPlotItem* );
 
     // Misc
 
-    virtual QSize sizeHint() const;
-    virtual QSize minimumSizeHint() const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
+    virtual QSize minimumSizeHint() const QWT_OVERRIDE;
 
     virtual void updateLayout();
-    virtual void drawCanvas( QPainter * );
+    virtual void drawCanvas( QPainter* );
 
     void updateAxes();
@@ -247,54 +223,75 @@
 
     virtual void getCanvasMarginsHint(
-        const QwtScaleMap maps[], const QRectF &canvasRect,
-        double &left, double &top, double &right, double &bottom) const;
-
-    virtual bool event( QEvent * );
-    virtual bool eventFilter( QObject *, QEvent * );
-
-    virtual void drawItems( QPainter *, const QRectF &,
-        const QwtScaleMap maps[axisCnt] ) const;
-
-    virtual QVariant itemToInfo( QwtPlotItem * ) const;
-    virtual QwtPlotItem *infoToItem( const QVariant & ) const;
-
-Q_SIGNALS:
+        const QwtScaleMap maps[], const QRectF& canvasRect,
+        double& left, double& top, double& right, double& bottom) const;
+
+    virtual bool event( QEvent* ) QWT_OVERRIDE;
+    virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
+
+    virtual void drawItems( QPainter*, const QRectF&,
+        const QwtScaleMap maps[ QwtAxis::AxisPositions ] ) const;
+
+    virtual QVariant itemToInfo( QwtPlotItem* ) const;
+    virtual QwtPlotItem* infoToItem( const QVariant& ) const;
+
+#if QWT_AXIS_COMPAT
+    enum Axis
+    {
+        yLeft   = QwtAxis::YLeft,
+        yRight  = QwtAxis::YRight,
+        xBottom = QwtAxis::XBottom,
+        xTop    = QwtAxis::XTop,
+
+        axisCnt = QwtAxis::AxisPositions
+    };
+
+    void enableAxis( int axisId, bool on = true )
+    {
+        setAxisVisible( axisId, on );
+    }
+
+    bool axisEnabled( int axisId ) const
+    {
+        return isAxisVisible( axisId );
+    }
+#endif
+
+  Q_SIGNALS:
     /*!
-      A signal indicating, that an item has been attached/detached
-
-      \param plotItem Plot item
-      \param on Attached/Detached
+       A signal indicating, that an item has been attached/detached
+
+       \param plotItem Plot item
+       \param on Attached/Detached
      */
-    void itemAttached( QwtPlotItem *plotItem, bool on );
+    void itemAttached( QwtPlotItem* plotItem, bool on );
 
     /*!
-      A signal with the attributes how to update
-      the legend entries for a plot item.
-
-      \param itemInfo Info about a plot item, build from itemToInfo()
-      \param data Attributes of the entries ( usually <= 1 ) for
+       A signal with the attributes how to update
+       the legend entries for a plot item.
+
+       \param itemInfo Info about a plot item, build from itemToInfo()
+       \param data Attributes of the entries ( usually <= 1 ) for
                   the plot item.
 
-      \sa itemToInfo(), infoToItem(), QwtAbstractLegend::updateLegend()
+       \sa itemToInfo(), infoToItem(), QwtAbstractLegend::updateLegend()
      */
-    void legendDataChanged( const QVariant &itemInfo,
-        const QList<QwtLegendData> &data );
-
-public Q_SLOTS:
+    void legendDataChanged( const QVariant& itemInfo,
+        const QList< QwtLegendData >& data );
+
+  public Q_SLOTS:
     virtual void replot();
     void autoRefresh();
 
-protected:
-    static bool axisValid( int axisId );
-
-    virtual void resizeEvent( QResizeEvent *e );
-
-private Q_SLOTS:
-    void updateLegendItems( const QVariant &itemInfo,
-        const QList<QwtLegendData> &legendData );
-
-private:
+  protected:
+
+    virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
+
+  private Q_SLOTS:
+    void updateLegendItems( const QVariant& itemInfo,
+        const QList< QwtLegendData >& legendData );
+
+  private:
     friend class QwtPlotItem;
-    void attachItem( QwtPlotItem *, bool );
+    void attachItem( QwtPlotItem*, bool );
 
     void initAxesData();
@@ -302,11 +299,11 @@
     void updateScaleDiv();
 
-    void initPlot( const QwtText &title );
-
-    class AxisData;
-    AxisData *d_axisData[axisCnt];
+    void initPlot( const QwtText& title );
+
+    class ScaleData;
+    ScaleData* m_scaleData;
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_abstract_barchart.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_abstract_barchart.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_abstract_barchart.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,7 +10,8 @@
 #include "qwt_plot_abstract_barchart.h"
 #include "qwt_scale_map.h"
+#include "qwt_math.h"
 
 static inline double qwtTransformWidth(
-    const QwtScaleMap &map, double value, double width )
+    const QwtScaleMap& map, double value, double width )
 {
     const double w2 = 0.5 * width;
@@ -24,11 +25,11 @@
 class QwtPlotAbstractBarChart::PrivateData
 {
-public:
-    PrivateData():
-        layoutPolicy( QwtPlotAbstractBarChart::AutoAdjustSamples ),
-        layoutHint( 0.5 ),
-        spacing( 10 ),
-        margin( 5 ),
-        baseline( 0.0 )
+  public:
+    PrivateData()
+        : layoutPolicy( QwtPlotAbstractBarChart::AutoAdjustSamples )
+        , layoutHint( 0.5 )
+        , spacing( 10 )
+        , margin( 5 )
+        , baseline( 0.0 )
     {
     }
@@ -42,11 +43,11 @@
 
 /*!
-  Constructor
-  \param title Title of the chart
-*/
-QwtPlotAbstractBarChart::QwtPlotAbstractBarChart( const QwtText &title ):
-    QwtPlotSeriesItem( title )
-{
-    d_data = new PrivateData;
+   Constructor
+   \param title Title of the chart
+ */
+QwtPlotAbstractBarChart::QwtPlotAbstractBarChart( const QwtText& title )
+    : QwtPlotSeriesItem( title )
+{
+    m_data = new PrivateData;
 
     setItemAttribute( QwtPlotItem::Legend, true );
@@ -59,121 +60,121 @@
 QwtPlotAbstractBarChart::~QwtPlotAbstractBarChart()
 {
-    delete d_data;
-}
-
-/*!
-  The combination of layoutPolicy() and layoutHint() define how the width
-  of the bars is calculated
-
-  \param policy Layout policy
-
-  \sa layoutPolicy(), layoutHint()
+    delete m_data;
+}
+
+/*!
+   The combination of layoutPolicy() and layoutHint() define how the width
+   of the bars is calculated
+
+   \param policy Layout policy
+
+   \sa layoutPolicy(), layoutHint()
  */
 void QwtPlotAbstractBarChart::setLayoutPolicy( LayoutPolicy policy )
 {
-    if ( policy != d_data->layoutPolicy )
-    {
-        d_data->layoutPolicy = policy;
-        itemChanged();
-    }
-}
-
-/*!
-  The combination of layoutPolicy() and layoutHint() define how the width
-  of the bars is calculated
-
-  \return Layout policy of the chart item
-  \sa setLayoutPolicy(), layoutHint()
+    if ( policy != m_data->layoutPolicy )
+    {
+        m_data->layoutPolicy = policy;
+        itemChanged();
+    }
+}
+
+/*!
+   The combination of layoutPolicy() and layoutHint() define how the width
+   of the bars is calculated
+
+   \return Layout policy of the chart item
+   \sa setLayoutPolicy(), layoutHint()
  */
 QwtPlotAbstractBarChart::LayoutPolicy QwtPlotAbstractBarChart::layoutPolicy() const
 {
-    return d_data->layoutPolicy;
-}
-
-/*!
-  The combination of layoutPolicy() and layoutHint() define how the width
-  of the bars is calculated
-
-  \param hint Layout hint
-
-  \sa LayoutPolicy, layoutPolicy(), layoutHint()
+    return m_data->layoutPolicy;
+}
+
+/*!
+   The combination of layoutPolicy() and layoutHint() define how the width
+   of the bars is calculated
+
+   \param hint Layout hint
+
+   \sa LayoutPolicy, layoutPolicy(), layoutHint()
  */
 void QwtPlotAbstractBarChart::setLayoutHint( double hint )
 {
-    hint = qMax( 0.0, hint );
-    if ( hint != d_data->layoutHint )
-    {
-        d_data->layoutHint = hint;
-        itemChanged();
-    }
-}
-
-/*!
-  The combination of layoutPolicy() and layoutHint() define how the width
-  of the bars is calculated
-
-  \return Layout policy of the chart item
-  \sa LayoutPolicy, setLayoutHint(), layoutPolicy()
-*/
+    hint = qwtMaxF( 0.0, hint );
+    if ( hint != m_data->layoutHint )
+    {
+        m_data->layoutHint = hint;
+        itemChanged();
+    }
+}
+
+/*!
+   The combination of layoutPolicy() and layoutHint() define how the width
+   of the bars is calculated
+
+   \return Layout policy of the chart item
+   \sa LayoutPolicy, setLayoutHint(), layoutPolicy()
+ */
 double QwtPlotAbstractBarChart::layoutHint() const
 {
-    return d_data->layoutHint;
-}
-
-/*!
-  \brief Set the spacing
-
-  The spacing is the distance between 2 samples ( bars for QwtPlotBarChart or
-  a group of bars for QwtPlotMultiBarChart ) in paint device coordinates.
-
-  \sa spacing()
+    return m_data->layoutHint;
+}
+
+/*!
+   \brief Set the spacing
+
+   The spacing is the distance between 2 samples ( bars for QwtPlotBarChart or
+   a group of bars for QwtPlotMultiBarChart ) in paint device coordinates.
+
+   \sa spacing()
  */
 void QwtPlotAbstractBarChart::setSpacing( int spacing )
 {
     spacing = qMax( spacing, 0 );
-    if ( spacing != d_data->spacing )
-    {
-        d_data->spacing = spacing;
-        itemChanged();
-    }
-}
-
-/*!
-  \return Spacing between 2 samples ( bars or groups of bars )
-  \sa setSpacing(), margin()
+    if ( spacing != m_data->spacing )
+    {
+        m_data->spacing = spacing;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Spacing between 2 samples ( bars or groups of bars )
+   \sa setSpacing(), margin()
  */
 int QwtPlotAbstractBarChart::spacing() const
 {
-    return d_data->spacing;
-}
-/*!
-  \brief Set the margin
-
-  The margin is the distance between the outmost bars and the contentsRect()
-  of the canvas. The default setting is 5 pixels.
-
-  \param margin Margin
-
-  \sa spacing(), margin()
+    return m_data->spacing;
+}
+/*!
+   \brief Set the margin
+
+   The margin is the distance between the outmost bars and the contentsRect()
+   of the canvas. The default setting is 5 pixels.
+
+   \param margin Margin
+
+   \sa spacing(), margin()
  */
 void QwtPlotAbstractBarChart::setMargin( int margin )
 {
     margin = qMax( margin, 0 );
-    if ( margin != d_data->margin )
-    {
-        d_data->margin = margin;
-        itemChanged();
-    }
-}
-
-/*!
-  \return Margin between the outmost bars and the contentsRect()
-  of the canvas.
-
-  \sa setMargin(), spacing()
+    if ( margin != m_data->margin )
+    {
+        m_data->margin = margin;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Margin between the outmost bars and the contentsRect()
+   of the canvas.
+
+   \sa setMargin(), spacing()
  */
 int QwtPlotAbstractBarChart::margin() const
 {
-    return d_data->margin;
+    return m_data->margin;
 }
 
@@ -191,10 +192,10 @@
 
    \sa baseline(), QwtPlotSeriesItem::orientation()
-*/
+ */
 void QwtPlotAbstractBarChart::setBaseline( double value )
 {
-    if ( value != d_data->baseline )
-    {
-        d_data->baseline = value;
+    if ( value != m_data->baseline )
+    {
+        m_data->baseline = value;
         itemChanged();
     }
@@ -207,5 +208,5 @@
 double QwtPlotAbstractBarChart::baseline() const
 {
-    return d_data->baseline;
+    return m_data->baseline;
 }
 
@@ -221,25 +222,25 @@
    \return Sample width
    \sa layoutPolicy(), layoutHint()
-*/
-double QwtPlotAbstractBarChart::sampleWidth( const QwtScaleMap &map,
+ */
+double QwtPlotAbstractBarChart::sampleWidth( const QwtScaleMap& map,
     double canvasSize, double boundingSize, double value ) const
 {
     double width;
 
-    switch( d_data->layoutPolicy )
+    switch( m_data->layoutPolicy )
     {
         case ScaleSamplesToAxes:
         {
-            width = qwtTransformWidth( map, value, d_data->layoutHint );
+            width = qwtTransformWidth( map, value, m_data->layoutHint );
             break;
         }
         case ScaleSampleToCanvas:
         {
-            width = canvasSize * d_data->layoutHint;
+            width = canvasSize * m_data->layoutHint;
             break;
         }
         case FixedSampleSize:
         {
-            width = d_data->layoutHint;
+            width = m_data->layoutHint;
             break;
         }
@@ -256,6 +257,6 @@
 
             width = qwtTransformWidth( map, value, w );
-            width -= d_data->spacing;
-            width = qMax( width, d_data->layoutHint );
+            width -= m_data->spacing;
+            width = qwtMaxF( width, m_data->layoutHint );
         }
     }
@@ -281,12 +282,10 @@
    \param bottom Returns the bottom margin
 
-   \return Margin
-
    \sa layoutPolicy(), layoutHint(), QwtPlotItem::Margins
        QwtPlot::getCanvasMarginsHint(), QwtPlot::updateCanvasMargins()
  */
-void QwtPlotAbstractBarChart::getCanvasMarginHint( const QwtScaleMap &xMap,
-    const QwtScaleMap &yMap, const QRectF &canvasRect,
-    double &left, double &top, double &right, double &bottom ) const
+void QwtPlotAbstractBarChart::getCanvasMarginHint( const QwtScaleMap& xMap,
+    const QwtScaleMap& yMap, const QRectF& canvasRect,
+    double& left, double& top, double& right, double& bottom ) const
 {
     double hint = -1.0;
@@ -297,7 +296,7 @@
         {
             if ( orientation() == Qt::Vertical )
-                hint = 0.5 * canvasRect.width() * d_data->layoutHint;
+                hint = 0.5 * canvasRect.width() * m_data->layoutHint;
             else
-                hint = 0.5 * canvasRect.height() * d_data->layoutHint;
+                hint = 0.5 * canvasRect.height() * m_data->layoutHint;
 
             break;
@@ -305,5 +304,5 @@
         case FixedSampleSize:
         {
-            hint = 0.5 * d_data->layoutHint;
+            hint = 0.5 * m_data->layoutHint;
             break;
         }
@@ -324,9 +323,9 @@
             if ( layoutPolicy() == ScaleSamplesToAxes )
             {
-                sampleWidthS = qMax( d_data->layoutHint, 0.0 );
+                sampleWidthS = qwtMaxF( m_data->layoutHint, 0.0 );
             }
             else
             {
-                spacing = d_data->spacing;
+                spacing = m_data->spacing;
 
                 if ( numSamples > 1 )
@@ -352,5 +351,5 @@
 
             hint = 0.5 * sampleWidthP;
-            hint += qMax( d_data->margin, 0 );
+            hint += qMax( m_data->margin, 0 );
         }
     }
Index: /trunk/BNC/qwt/qwt_plot_abstract_barchart.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_abstract_barchart.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_abstract_barchart.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,17 +13,16 @@
 #include "qwt_global.h"
 #include "qwt_plot_seriesitem.h"
-#include "qwt_series_data.h"
 
 /*!
-  \brief Abstract base class for bar chart items
+   \brief Abstract base class for bar chart items
 
-  In opposite to almost all other plot items bar charts can't be
-  displayed inside of their bounding rectangle and need a special
-  API  how to calculate the width of the bars and how they affect
-  the layout of the attached plot.
+   In opposite to almost all other plot items bar charts can't be
+   displayed inside of their bounding rectangle and need a special
+   API  how to calculate the width of the bars and how they affect
+   the layout of the attached plot.
  */
-class QWT_EXPORT QwtPlotAbstractBarChart: public QwtPlotSeriesItem
+class QWT_EXPORT QwtPlotAbstractBarChart : public QwtPlotSeriesItem
 {
-public:
+  public:
     /*!
         \brief Mode how to calculate the bar width
@@ -34,32 +33,32 @@
     {
         /*!
-          The sample width is calculated by dividing the bounding rectangle
-          by the number of samples. The layoutHint() is used as a minimum width
-          in paint device coordinates.
+           The sample width is calculated by dividing the bounding rectangle
+           by the number of samples. The layoutHint() is used as a minimum width
+           in paint device coordinates.
 
-          \sa boundingRectangle()
+           \sa boundingRectangle()
          */
         AutoAdjustSamples,
 
         /*!
-          layoutHint() defines an interval in axis coordinates
+           layoutHint() defines an interval in axis coordinates
          */
         ScaleSamplesToAxes,
 
         /*!
-          The bar width is calculated by multiplying layoutHint()
-          with the height or width of the canvas.
+           The bar width is calculated by multiplying layoutHint()
+           with the height or width of the canvas.
 
-          \sa boundingRectangle()
+           \sa boundingRectangle()
          */
         ScaleSampleToCanvas,
 
         /*!
-          layoutHint() defines a fixed width in paint device coordinates.
+           layoutHint() defines a fixed width in paint device coordinates.
          */
         FixedSampleSize
     };
 
-    explicit QwtPlotAbstractBarChart( const QwtText &title );
+    explicit QwtPlotAbstractBarChart( const QwtText& title );
     virtual ~QwtPlotAbstractBarChart();
 
@@ -80,17 +79,17 @@
 
     virtual void getCanvasMarginHint(
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect,
-        double &left, double &top, double &right, double &bottom) const;
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, double& left, double& top,
+        double& right, double& bottom) const QWT_OVERRIDE;
 
 
-protected:
-    double sampleWidth( const QwtScaleMap &map,
+  protected:
+    double sampleWidth( const QwtScaleMap& map,
         double canvasSize, double boundingSize,
         double value ) const;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_abstract_canvas.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_abstract_canvas.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_plot_abstract_canvas.cpp	(revision 11158)
@@ -0,0 +1,1129 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_plot_abstract_canvas.h"
+#include "qwt_plot.h"
+#include "qwt_painter.h"
+#include "qwt_null_paintdevice.h"
+#include "qwt_math.h"
+
+#include <qpainter.h>
+#include <qpainterpath.h>
+#include <qstyle.h>
+#include <qstyleoption.h>
+
+namespace
+{
+    class QwtStyleSheetRecorder QWT_FINAL : public QwtNullPaintDevice
+    {
+      public:
+        explicit QwtStyleSheetRecorder( const QSize& size )
+            : m_size( size )
+        {
+        }
+
+        virtual void updateState( const QPaintEngineState& state ) QWT_OVERRIDE
+        {
+            if ( state.state() & QPaintEngine::DirtyPen )
+            {
+                m_pen = state.pen();
+            }
+            if ( state.state() & QPaintEngine::DirtyBrush )
+            {
+                m_brush = state.brush();
+            }
+            if ( state.state() & QPaintEngine::DirtyBrushOrigin )
+            {
+                m_origin = state.brushOrigin();
+            }
+        }
+
+        virtual void drawRects(const QRectF* rects, int count ) QWT_OVERRIDE
+        {
+            for ( int i = 0; i < count; i++ )
+                border.rectList += rects[i];
+        }
+
+        virtual void drawRects(const QRect* rects, int count ) QWT_OVERRIDE
+        {
+            for ( int i = 0; i < count; i++ )
+                border.rectList += rects[i];
+        }
+
+        virtual void drawPath( const QPainterPath& path ) QWT_OVERRIDE
+        {
+            const QRectF rect( QPointF( 0.0, 0.0 ), m_size );
+            if ( path.controlPointRect().contains( rect.center() ) )
+            {
+                setCornerRects( path );
+                alignCornerRects( rect );
+
+                background.path = path;
+                background.brush = m_brush;
+                background.origin = m_origin;
+            }
+            else
+            {
+                border.pathList += path;
+            }
+        }
+
+        void setCornerRects( const QPainterPath& path )
+        {
+            QPointF pos( 0.0, 0.0 );
+
+            for ( int i = 0; i < path.elementCount(); i++ )
+            {
+                QPainterPath::Element el = path.elementAt(i);
+                switch( el.type )
+                {
+                    case QPainterPath::MoveToElement:
+                    case QPainterPath::LineToElement:
+                    {
+                        pos.setX( el.x );
+                        pos.setY( el.y );
+                        break;
+                    }
+                    case QPainterPath::CurveToElement:
+                    {
+                        QRectF r( pos, QPointF( el.x, el.y ) );
+                        clipRects += r.normalized();
+
+                        pos.setX( el.x );
+                        pos.setY( el.y );
+
+                        break;
+                    }
+                    case QPainterPath::CurveToDataElement:
+                    {
+                        if ( clipRects.size() > 0 )
+                        {
+                            QRectF r = clipRects.last();
+                            r.setCoords(
+                                qwtMinF( r.left(), el.x ),
+                                qwtMinF( r.top(), el.y ),
+                                qwtMaxF( r.right(), el.x ),
+                                qwtMaxF( r.bottom(), el.y )
+                                );
+                            clipRects.last() = r.normalized();
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+
+      protected:
+        virtual QSize sizeMetrics() const QWT_OVERRIDE
+        {
+            return m_size;
+        }
+
+      private:
+        void alignCornerRects( const QRectF& rect )
+        {
+            for ( int i = 0; i < clipRects.size(); i++ )
+            {
+                QRectF& r = clipRects[i];
+                if ( r.center().x() < rect.center().x() )
+                    r.setLeft( rect.left() );
+                else
+                    r.setRight( rect.right() );
+
+                if ( r.center().y() < rect.center().y() )
+                    r.setTop( rect.top() );
+                else
+                    r.setBottom( rect.bottom() );
+            }
+        }
+
+
+      public:
+        QVector< QRectF > clipRects;
+
+        struct Border
+        {
+            QList< QPainterPath > pathList;
+            QList< QRectF > rectList;
+            QRegion clipRegion;
+        } border;
+
+        struct Background
+        {
+            QPainterPath path;
+            QBrush brush;
+            QPointF origin;
+        } background;
+
+      private:
+        const QSize m_size;
+
+        QPen m_pen;
+        QBrush m_brush;
+        QPointF m_origin;
+    };
+}
+
+static void qwtUpdateContentsRect( int fw, QWidget* canvas )
+{
+    canvas->setContentsMargins( fw, fw, fw, fw );
+}
+
+static void qwtFillRegion( QPainter* painter, const QRegion& region )
+{
+#if QT_VERSION >= 0x050800
+    for ( QRegion::const_iterator it = region.cbegin();
+        it != region.cend(); ++it )
+    {
+        painter->drawRect( *it );
+    }
+#else
+    painter->drawRects( region.rects() );
+#endif
+}
+
+static void qwtDrawBackground( QPainter* painter, QWidget* canvas )
+{
+    painter->save();
+
+    QPainterPath borderClip;
+
+    ( void )QMetaObject::invokeMethod(
+        canvas, "borderPath", Qt::DirectConnection,
+        Q_RETURN_ARG( QPainterPath, borderClip ), Q_ARG( QRect, canvas->rect() ) );
+
+    if ( !borderClip.isEmpty() )
+        painter->setClipPath( borderClip, Qt::IntersectClip );
+
+    const QBrush& brush = canvas->palette().brush( canvas->backgroundRole() );
+
+    if ( brush.style() == Qt::TexturePattern )
+    {
+        QPixmap pm( canvas->size() );
+        QwtPainter::fillPixmap( canvas, pm );
+        painter->drawPixmap( 0, 0, pm );
+    }
+    else if ( brush.gradient() )
+    {
+        const bool fillClipRegion =
+            brush.gradient()->coordinateMode() != QGradient::ObjectBoundingMode;
+
+        painter->setPen( Qt::NoPen );
+        painter->setBrush( brush );
+
+        if ( fillClipRegion )
+            qwtFillRegion( painter, painter->clipRegion() );
+        else
+            painter->drawRect( canvas->rect() );
+    }
+    else
+    {
+        painter->setPen( Qt::NoPen );
+        painter->setBrush( brush );
+        qwtFillRegion( painter, painter->clipRegion() );
+    }
+
+    painter->restore();
+}
+
+static inline void qwtDrawStyledBackground(
+    QWidget* w, QPainter* painter )
+{
+    QStyleOption opt;
+    opt.initFrom(w);
+    w->style()->drawPrimitive( QStyle::PE_Widget, &opt, painter, w);
+}
+
+static QWidget* qwtBackgroundWidget( QWidget* w )
+{
+    if ( w->parentWidget() == NULL )
+        return w;
+
+    if ( w->autoFillBackground() )
+    {
+        const QBrush brush = w->palette().brush( w->backgroundRole() );
+        if ( brush.color().alpha() > 0 )
+            return w;
+    }
+
+    if ( w->testAttribute( Qt::WA_StyledBackground ) )
+    {
+        QImage image( 1, 1, QImage::Format_ARGB32 );
+        image.fill( Qt::transparent );
+
+        QPainter painter( &image );
+        painter.translate( -w->rect().center() );
+        qwtDrawStyledBackground( w, &painter );
+        painter.end();
+
+        if ( qAlpha( image.pixel( 0, 0 ) ) != 0 )
+            return w;
+    }
+
+    return qwtBackgroundWidget( w->parentWidget() );
+}
+
+static void qwtFillBackground( QPainter* painter,
+    QWidget* widget, const QVector< QRectF >& fillRects )
+{
+    if ( fillRects.isEmpty() )
+        return;
+
+    QRegion clipRegion;
+    if ( painter->hasClipping() )
+        clipRegion = painter->transform().map( painter->clipRegion() );
+    else
+        clipRegion = widget->contentsRect();
+
+    // Try to find out which widget fills
+    // the unfilled areas of the styled background
+
+    QWidget* bgWidget = qwtBackgroundWidget( widget->parentWidget() );
+
+    for ( int i = 0; i < fillRects.size(); i++ )
+    {
+        const QRect rect = fillRects[i].toAlignedRect();
+        if ( clipRegion.intersects( rect ) )
+        {
+            QPixmap pm( rect.size() );
+            QwtPainter::fillPixmap( bgWidget, pm, widget->mapTo( bgWidget, rect.topLeft() ) );
+            painter->drawPixmap( rect, pm );
+        }
+    }
+}
+
+static void qwtFillBackground( QPainter* painter, QWidget* canvas )
+{
+    QVector< QRectF > rects;
+
+    if ( canvas->testAttribute( Qt::WA_StyledBackground ) )
+    {
+        QwtStyleSheetRecorder recorder( canvas->size() );
+
+        QPainter p( &recorder );
+        qwtDrawStyledBackground( canvas, &p );
+        p.end();
+
+        if ( recorder.background.brush.isOpaque() )
+            rects = recorder.clipRects;
+        else
+            rects += canvas->rect();
+    }
+    else
+    {
+        const double borderRadius = canvas->property( "borderRadius" ).toDouble();
+        if ( borderRadius > 0.0 )
+        {
+            QSizeF sz( borderRadius, borderRadius );
+
+            const QRectF r = canvas->rect();
+            rects += QRectF( r.topLeft(), sz );
+            rects += QRectF( r.topRight() - QPointF( borderRadius, 0 ), sz );
+            rects += QRectF( r.bottomRight() - QPointF( borderRadius, borderRadius ), sz );
+            rects += QRectF( r.bottomLeft() - QPointF( 0, borderRadius ), sz );
+        }
+    }
+
+    qwtFillBackground( painter, canvas, rects);
+}
+
+static inline void qwtRevertPath( QPainterPath& path )
+{
+    if ( path.elementCount() == 4 )
+    {
+        QPainterPath::Element el0 = path.elementAt(0);
+        QPainterPath::Element el3 = path.elementAt(3);
+
+        path.setElementPositionAt( 0, el3.x, el3.y );
+        path.setElementPositionAt( 3, el0.x, el0.y );
+    }
+}
+
+static QPainterPath qwtCombinePathList( const QRectF& rect,
+    const QList< QPainterPath >& pathList )
+{
+    if ( pathList.isEmpty() )
+        return QPainterPath();
+
+    QPainterPath ordered[8]; // starting top left
+
+    for ( int i = 0; i < pathList.size(); i++ )
+    {
+        int index = -1;
+        QPainterPath subPath = pathList[i];
+
+        const QRectF br = pathList[i].controlPointRect();
+        if ( br.center().x() < rect.center().x() )
+        {
+            if ( br.center().y() < rect.center().y() )
+            {
+                if ( qAbs( br.top() - rect.top() ) <
+                    qAbs( br.left() - rect.left() ) )
+                {
+                    index = 1;
+                }
+                else
+                {
+                    index = 0;
+                }
+            }
+            else
+            {
+                if ( qAbs( br.bottom() - rect.bottom() ) <
+                    qAbs( br.left() - rect.left() ) )
+                {
+                    index = 6;
+                }
+                else
+                {
+                    index = 7;
+                }
+            }
+
+            if ( subPath.currentPosition().y() > br.center().y() )
+                qwtRevertPath( subPath );
+        }
+        else
+        {
+            if ( br.center().y() < rect.center().y() )
+            {
+                if ( qAbs( br.top() - rect.top() ) <
+                    qAbs( br.right() - rect.right() ) )
+                {
+                    index = 2;
+                }
+                else
+                {
+                    index = 3;
+                }
+            }
+            else
+            {
+                if ( qAbs( br.bottom() - rect.bottom() ) <
+                    qAbs( br.right() - rect.right() ) )
+                {
+                    index = 5;
+                }
+                else
+                {
+                    index = 4;
+                }
+            }
+            if ( subPath.currentPosition().y() < br.center().y() )
+                qwtRevertPath( subPath );
+        }
+        ordered[index] = subPath;
+    }
+
+    for ( int i = 0; i < 4; i++ )
+    {
+        if ( ordered[ 2 * i].isEmpty() != ordered[2 * i + 1].isEmpty() )
+        {
+            // we don't accept incomplete rounded borders
+            return QPainterPath();
+        }
+    }
+
+
+    const QPolygonF corners( rect );
+
+    QPainterPath path;
+    //path.moveTo( rect.topLeft() );
+
+    for ( int i = 0; i < 4; i++ )
+    {
+        if ( ordered[2 * i].isEmpty() )
+        {
+            path.lineTo( corners[i] );
+        }
+        else
+        {
+            path.connectPath( ordered[2 * i] );
+            path.connectPath( ordered[2 * i + 1] );
+        }
+    }
+
+    path.closeSubpath();
+
+#if 0
+    return path.simplified();
+#else
+    return path;
+#endif
+}
+
+static QPainterPath qwtBorderPath( const QWidget* canvas, const QRect& rect )
+{
+    if ( canvas->testAttribute(Qt::WA_StyledBackground ) )
+    {
+        QwtStyleSheetRecorder recorder( rect.size() );
+
+        QPainter painter( &recorder );
+
+        QStyleOption opt;
+        opt.initFrom( canvas );
+        opt.rect = rect;
+        canvas->style()->drawPrimitive( QStyle::PE_Widget, &opt, &painter, canvas );
+
+        painter.end();
+
+        if ( !recorder.background.path.isEmpty() )
+            return recorder.background.path;
+
+        if ( !recorder.border.rectList.isEmpty() )
+            return qwtCombinePathList( rect, recorder.border.pathList );
+    }
+    else
+    {
+        const double borderRadius = canvas->property( "borderRadius" ).toDouble();
+
+        if ( borderRadius > 0.0 )
+        {
+            double fw2 = canvas->property( "frameWidth" ).toInt() * 0.5;
+            QRectF r = QRectF(rect).adjusted( fw2, fw2, -fw2, -fw2 );
+
+            QPainterPath path;
+            path.addRoundedRect( r, borderRadius, borderRadius );
+            return path;
+        }
+    }
+
+    return QPainterPath();
+}
+
+class QwtPlotAbstractCanvas::PrivateData
+{
+  public:
+    PrivateData()
+        : focusIndicator( NoFocusIndicator )
+        , borderRadius( 0 )
+    {
+        styleSheet.hasBorder = false;
+    }
+
+    FocusIndicator focusIndicator;
+    double borderRadius;
+
+    struct StyleSheet
+    {
+        bool hasBorder;
+        QPainterPath borderPath;
+        QVector< QRectF > cornerRects;
+
+        struct StyleSheetBackground
+        {
+            QBrush brush;
+            QPointF origin;
+        } background;
+
+    } styleSheet;
+
+    QWidget* canvasWidget;
+};
+
+/*!
+   \brief Constructor
+   \param canvasWidget plot canvas widget
+ */
+QwtPlotAbstractCanvas::QwtPlotAbstractCanvas( QWidget* canvasWidget )
+{
+    m_data = new PrivateData;
+    m_data->canvasWidget = canvasWidget;
+
+#ifndef QT_NO_CURSOR
+    canvasWidget->setCursor( Qt::CrossCursor );
+#endif
+    canvasWidget->setAutoFillBackground( true );
+}
+
+//! Destructor
+QwtPlotAbstractCanvas::~QwtPlotAbstractCanvas()
+{
+    delete m_data;
+}
+
+//! Return parent plot widget
+QwtPlot* QwtPlotAbstractCanvas::plot()
+{
+    return qobject_cast< QwtPlot* >( m_data->canvasWidget->parent() );
+}
+
+//! Return parent plot widget
+const QwtPlot* QwtPlotAbstractCanvas::plot() const
+{
+    return qobject_cast< const QwtPlot* >( m_data->canvasWidget->parent() );
+}
+
+/*!
+   Set the focus indicator
+
+   \sa FocusIndicator, focusIndicator()
+ */
+void QwtPlotAbstractCanvas::setFocusIndicator( FocusIndicator focusIndicator )
+{
+    m_data->focusIndicator = focusIndicator;
+}
+
+/*!
+   \return Focus indicator
+
+   \sa FocusIndicator, setFocusIndicator()
+ */
+QwtPlotAbstractCanvas::FocusIndicator QwtPlotAbstractCanvas::focusIndicator() const
+{
+    return m_data->focusIndicator;
+}
+
+/*!
+   Draw the focus indication
+   \param painter Painter
+ */
+void QwtPlotAbstractCanvas::drawFocusIndicator( QPainter* painter )
+{
+    const int margin = 1;
+
+    QRect focusRect = m_data->canvasWidget->contentsRect();
+    focusRect.setRect( focusRect.x() + margin, focusRect.y() + margin,
+        focusRect.width() - 2 * margin, focusRect.height() - 2 * margin );
+
+    QwtPainter::drawFocusRect( painter, m_data->canvasWidget, focusRect );
+}
+
+/*!
+   Set the radius for the corners of the border frame
+
+   \param radius Radius of a rounded corner
+   \sa borderRadius()
+ */
+void QwtPlotAbstractCanvas::setBorderRadius( double radius )
+{
+    m_data->borderRadius = qwtMaxF( 0.0, radius );
+}
+
+/*!
+   \return Radius for the corners of the border frame
+   \sa setBorderRadius()
+ */
+double QwtPlotAbstractCanvas::borderRadius() const
+{
+    return m_data->borderRadius;
+}
+
+//! \return Path for the canvas border
+QPainterPath QwtPlotAbstractCanvas::canvasBorderPath( const QRect& rect ) const
+{
+    return qwtBorderPath( canvasWidget(), rect );
+}
+
+/*!
+   Draw the border of the canvas
+   \param painter Painter
+ */
+void QwtPlotAbstractCanvas::drawBorder( QPainter* painter )
+{
+    const QWidget* w = canvasWidget();
+
+    if ( m_data->borderRadius > 0 )
+    {
+        const int frameWidth = w->property( "frameWidth" ).toInt();
+        if ( frameWidth > 0 )
+        {
+            const int frameShape = w->property( "frameShape" ).toInt();
+            const int frameShadow = w->property( "frameShadow" ).toInt();
+
+            const QRectF frameRect = w->property( "frameRect" ).toRect();
+
+            QwtPainter::drawRoundedFrame( painter, frameRect,
+                m_data->borderRadius, m_data->borderRadius,
+                w->palette(), frameWidth, frameShape | frameShadow );
+        }
+    }
+    else
+    {
+        const int frameShape = w->property( "frameShape" ).toInt();
+        const int frameShadow = w->property( "frameShadow" ).toInt();
+
+#if QT_VERSION < 0x050000
+        QStyleOptionFrameV3 opt;
+#else
+        QStyleOptionFrame opt;
+#endif
+        opt.initFrom( w );
+
+        opt.frameShape = QFrame::Shape( int( opt.frameShape ) | frameShape );
+
+        switch (frameShape)
+        {
+            case QFrame::Box:
+            case QFrame::HLine:
+            case QFrame::VLine:
+            case QFrame::StyledPanel:
+            case QFrame::Panel:
+            {
+                opt.lineWidth = w->property( "lineWidth" ).toInt();
+                opt.midLineWidth = w->property( "midLineWidth" ).toInt();
+                break;
+            }
+            default:
+            {
+                opt.lineWidth = w->property( "frameWidth" ).toInt();
+                break;
+            }
+        }
+
+        if ( frameShadow == QFrame::Sunken )
+            opt.state |= QStyle::State_Sunken;
+        else if ( frameShadow == QFrame::Raised )
+            opt.state |= QStyle::State_Raised;
+
+        w->style()->drawControl(QStyle::CE_ShapedFrame, &opt, painter, w );
+    }
+}
+
+//! Helper function for the derived plot canvas
+void QwtPlotAbstractCanvas::drawBackground( QPainter* painter )
+{
+    qwtDrawBackground( painter, canvasWidget() );
+}
+
+//! Helper function for the derived plot canvas
+void QwtPlotAbstractCanvas::fillBackground( QPainter* painter )
+{
+    qwtFillBackground( painter, canvasWidget() );
+}
+
+//! Helper function for the derived plot canvas
+void QwtPlotAbstractCanvas::drawUnstyled( QPainter* painter )
+{
+    fillBackground( painter );
+
+    QWidget* w = canvasWidget();
+
+    if ( w->autoFillBackground() )
+    {
+        const QRect canvasRect = w->rect();
+
+        painter->save();
+
+        painter->setPen( Qt::NoPen );
+        painter->setBrush( w->palette().brush( w->backgroundRole() ) );
+
+        const QRect frameRect = w->property( "frameRect" ).toRect();
+        if ( borderRadius() > 0.0 && ( canvasRect == frameRect ) )
+        {
+            const int frameWidth = w->property( "frameWidth" ).toInt();
+            if ( frameWidth > 0 )
+            {
+                painter->setClipPath( canvasBorderPath( canvasRect ) );
+                painter->drawRect( canvasRect );
+            }
+            else
+            {
+                painter->setRenderHint( QPainter::Antialiasing, true );
+                painter->drawPath( canvasBorderPath( canvasRect ) );
+            }
+        }
+        else
+        {
+            painter->drawRect( canvasRect );
+        }
+
+        painter->restore();
+    }
+
+    drawCanvas( painter );
+}
+
+//! Helper function for the derived plot canvas
+void QwtPlotAbstractCanvas::drawStyled( QPainter* painter, bool hackStyledBackground )
+{
+    fillBackground( painter );
+
+    if ( hackStyledBackground )
+    {
+        // Antialiasing rounded borders is done by
+        // inserting pixels with colors between the
+        // border color and the color on the canvas,
+        // When the border is painted before the plot items
+        // these colors are interpolated for the canvas
+        // and the plot items need to be clipped excluding
+        // the antialiased pixels. In situations, where
+        // the plot items fill the area at the rounded
+        // borders this is noticeable.
+        // The only way to avoid these annoying "artefacts"
+        // is to paint the border on top of the plot items.
+
+        if ( !m_data->styleSheet.hasBorder ||
+            m_data->styleSheet.borderPath.isEmpty() )
+        {
+            // We have no border with at least one rounded corner
+            hackStyledBackground = false;
+        }
+    }
+
+    QWidget* w = canvasWidget();
+
+    if ( hackStyledBackground )
+    {
+        painter->save();
+
+        // paint background without border
+        painter->setPen( Qt::NoPen );
+        painter->setBrush( m_data->styleSheet.background.brush );
+        painter->setBrushOrigin( m_data->styleSheet.background.origin );
+        painter->setClipPath( m_data->styleSheet.borderPath );
+        painter->drawRect( w->contentsRect() );
+
+        painter->restore();
+
+        drawCanvas( painter );
+
+        // Now paint the border on top
+        QStyleOptionFrame opt;
+        opt.initFrom( w );
+        w->style()->drawPrimitive( QStyle::PE_Frame, &opt, painter, w);
+    }
+    else
+    {
+        QStyleOption opt;
+        opt.initFrom( w );
+        w->style()->drawPrimitive( QStyle::PE_Widget, &opt, painter, w );
+
+        drawCanvas( painter );
+    }
+}
+
+//!  \brief Draw the plot to the canvas
+void QwtPlotAbstractCanvas::drawCanvas( QPainter* painter )
+{
+    QWidget* w = canvasWidget();
+
+    painter->save();
+
+    if ( !m_data->styleSheet.borderPath.isEmpty() )
+    {
+        painter->setClipPath(
+            m_data->styleSheet.borderPath, Qt::IntersectClip );
+    }
+    else
+    {
+        if ( borderRadius() > 0.0 )
+        {
+            const QRect frameRect = w->property( "frameRect" ).toRect();
+            painter->setClipPath( canvasBorderPath( frameRect ), Qt::IntersectClip );
+        }
+        else
+        {
+            painter->setClipRect( w->contentsRect(), Qt::IntersectClip );
+        }
+    }
+
+    QwtPlot* plot = qobject_cast< QwtPlot* >( w->parent() );
+    if ( plot )
+        plot->drawCanvas( painter );
+
+    painter->restore();
+}
+
+//! Update the cached information about the current style sheet
+void QwtPlotAbstractCanvas::updateStyleSheetInfo()
+{
+    QWidget* w = canvasWidget();
+
+    if ( !w->testAttribute( Qt::WA_StyledBackground ) )
+        return;
+
+    QwtStyleSheetRecorder recorder( w->size() );
+
+    QPainter painter( &recorder );
+
+    QStyleOption opt;
+    opt.initFrom(w);
+    w->style()->drawPrimitive( QStyle::PE_Widget, &opt, &painter, w);
+
+    painter.end();
+
+    m_data->styleSheet.hasBorder = !recorder.border.rectList.isEmpty();
+    m_data->styleSheet.cornerRects = recorder.clipRects;
+
+    if ( recorder.background.path.isEmpty() )
+    {
+        if ( !recorder.border.rectList.isEmpty() )
+        {
+            m_data->styleSheet.borderPath =
+                qwtCombinePathList( w->rect(), recorder.border.pathList );
+        }
+    }
+    else
+    {
+        m_data->styleSheet.borderPath = recorder.background.path;
+        m_data->styleSheet.background.brush = recorder.background.brush;
+        m_data->styleSheet.background.origin = recorder.background.origin;
+    }
+}
+
+//! \return canvas widget
+QWidget* QwtPlotAbstractCanvas::canvasWidget()
+{
+    return m_data->canvasWidget;
+}
+
+//! \return canvas widget
+const QWidget* QwtPlotAbstractCanvas::canvasWidget() const
+{
+    return m_data->canvasWidget;
+}
+
+class QwtPlotAbstractGLCanvas::PrivateData
+{
+  public:
+    PrivateData():
+        frameStyle( QFrame::Panel | QFrame::Sunken),
+        lineWidth( 2 ),
+        midLineWidth( 0 )
+    {
+    }
+
+    QwtPlotAbstractGLCanvas::PaintAttributes paintAttributes;
+
+    int frameStyle;
+    int lineWidth;
+    int midLineWidth;
+};
+
+/*!
+   \brief Constructor
+   \param canvasWidget plot canvas widget
+ */
+QwtPlotAbstractGLCanvas::QwtPlotAbstractGLCanvas( QWidget* canvasWidget ):
+    QwtPlotAbstractCanvas( canvasWidget )
+{
+    m_data = new PrivateData;
+
+    qwtUpdateContentsRect( frameWidth(), canvasWidget );
+    m_data->paintAttributes = QwtPlotAbstractGLCanvas::BackingStore;
+}
+
+//! Destructor
+QwtPlotAbstractGLCanvas::~QwtPlotAbstractGLCanvas()
+{
+    delete m_data;
+}
+
+/*!
+   \brief Changing the paint attributes
+
+   \param attribute Paint attribute
+   \param on On/Off
+
+   \sa testPaintAttribute()
+ */
+void QwtPlotAbstractGLCanvas::setPaintAttribute( PaintAttribute attribute, bool on )
+{
+    if ( bool( m_data->paintAttributes & attribute ) == on )
+        return;
+
+    if ( on )
+    {
+        m_data->paintAttributes |= attribute;
+    }
+    else
+    {
+        m_data->paintAttributes &= ~attribute;
+
+        if ( attribute == BackingStore )
+            clearBackingStore();
+    }
+}
+
+/*!
+   Test whether a paint attribute is enabled
+
+   \param attribute Paint attribute
+   \return true, when attribute is enabled
+   \sa setPaintAttribute()
+ */
+bool QwtPlotAbstractGLCanvas::testPaintAttribute( PaintAttribute attribute ) const
+{
+    return m_data->paintAttributes & attribute;
+}
+
+/*!
+   Set the frame style
+
+   \param style The bitwise OR between a shape and a shadow.
+
+   \sa frameStyle(), QFrame::setFrameStyle(),
+      setFrameShadow(), setFrameShape()
+ */
+void QwtPlotAbstractGLCanvas::setFrameStyle( int style )
+{
+    if ( style != m_data->frameStyle )
+    {
+        m_data->frameStyle = style;
+        qwtUpdateContentsRect( frameWidth(), canvasWidget() );
+
+        canvasWidget()->update();
+    }
+}
+
+/*!
+   \return The bitwise OR between a frameShape() and a frameShadow()
+   \sa setFrameStyle(), QFrame::frameStyle()
+ */
+int QwtPlotAbstractGLCanvas::frameStyle() const
+{
+    return m_data->frameStyle;
+}
+
+/*!
+   Set the frame shadow
+
+   \param shadow Frame shadow
+   \sa frameShadow(), setFrameShape(), QFrame::setFrameShadow()
+ */
+void QwtPlotAbstractGLCanvas::setFrameShadow( QFrame::Shadow shadow )
+{
+    setFrameStyle( ( m_data->frameStyle & QFrame::Shape_Mask ) | shadow );
+}
+
+/*!
+   \return Frame shadow
+   \sa setFrameShadow(), QFrame::setFrameShadow()
+ */
+QFrame::Shadow QwtPlotAbstractGLCanvas::frameShadow() const
+{
+    return (QFrame::Shadow) ( m_data->frameStyle & QFrame::Shadow_Mask );
+}
+
+/*!
+   Set the frame shape
+
+   \param shape Frame shape
+   \sa frameShape(), setFrameShadow(), QFrame::frameShape()
+ */
+void QwtPlotAbstractGLCanvas::setFrameShape( QFrame::Shape shape )
+{
+    setFrameStyle( ( m_data->frameStyle & QFrame::Shadow_Mask ) | shape );
+}
+
+/*!
+   \return Frame shape
+   \sa setFrameShape(), QFrame::frameShape()
+ */
+QFrame::Shape QwtPlotAbstractGLCanvas::frameShape() const
+{
+    return (QFrame::Shape) ( m_data->frameStyle & QFrame::Shape_Mask );
+}
+
+/*!
+   Set the frame line width
+
+   The default line width is 2 pixels.
+
+   \param width Line width of the frame
+   \sa lineWidth(), setMidLineWidth()
+ */
+void QwtPlotAbstractGLCanvas::setLineWidth( int width )
+{
+    width = qMax( width, 0 );
+    if ( width != m_data->lineWidth )
+    {
+        m_data->lineWidth = qMax( width, 0 );
+        qwtUpdateContentsRect( frameWidth(), canvasWidget() );
+        canvasWidget()->update();
+    }
+}
+
+/*!
+   \return Line width of the frame
+   \sa setLineWidth(), midLineWidth()
+ */
+int QwtPlotAbstractGLCanvas::lineWidth() const
+{
+    return m_data->lineWidth;
+}
+
+/*!
+   Set the frame mid line width
+
+   The default midline width is 0 pixels.
+
+   \param width Midline width of the frame
+   \sa midLineWidth(), setLineWidth()
+ */
+void QwtPlotAbstractGLCanvas::setMidLineWidth( int width )
+{
+    width = qMax( width, 0 );
+    if ( width != m_data->midLineWidth )
+    {
+        m_data->midLineWidth = width;
+        qwtUpdateContentsRect( frameWidth(), canvasWidget() );
+        canvasWidget()->update();
+    }
+}
+
+/*!
+   \return Midline width of the frame
+   \sa setMidLineWidth(), lineWidth()
+ */
+int QwtPlotAbstractGLCanvas::midLineWidth() const
+{
+    return m_data->midLineWidth;
+}
+
+/*!
+   \return Frame width depending on the style, line width and midline width.
+ */
+int QwtPlotAbstractGLCanvas::frameWidth() const
+{
+    return ( frameStyle() != QFrame::NoFrame ) ? m_data->lineWidth : 0;
+}
+
+/*!
+   Invalidate the paint cache and repaint the canvas
+   \sa invalidatePaintCache()
+ */
+void QwtPlotAbstractGLCanvas::replot()
+{
+    invalidateBackingStore();
+
+    QWidget* w = canvasWidget();
+    if ( testPaintAttribute( QwtPlotAbstractGLCanvas::ImmediatePaint ) )
+        w->repaint( w->contentsRect() );
+    else
+        w->update( w->contentsRect() );
+}
+
+//! \return The rectangle where the frame is drawn in.
+QRect QwtPlotAbstractGLCanvas::frameRect() const
+{
+    const int fw = frameWidth();
+    return canvasWidget()->contentsRect().adjusted( -fw, -fw, fw, fw );
+}
+
+//! Helper function for the derived plot canvas
+void QwtPlotAbstractGLCanvas::draw( QPainter* painter )
+{
+#if FIX_GL_TRANSLATION
+    if ( painter->paintEngine()->type() == QPaintEngine::OpenGL2 )
+    {
+        // work around a translation bug of QPaintEngine::OpenGL2
+        painter->translate( 1, 1 );
+    }
+#endif
+
+    if ( canvasWidget()->testAttribute( Qt::WA_StyledBackground ) )
+        drawStyled( painter, true );
+    else
+        drawUnstyled( painter );
+
+    if ( frameWidth() > 0 )
+        drawBorder( painter );
+}
Index: /trunk/BNC/qwt/qwt_plot_abstract_canvas.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_abstract_canvas.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_plot_abstract_canvas.h	(revision 11158)
@@ -0,0 +1,164 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_PLOT_ABSTRACT_CANVAS_H
+#define QWT_PLOT_ABSTRACT_CANVAS_H
+
+#include "qwt_global.h"
+#include <qframe.h>
+
+class QwtPlot;
+
+/*!
+   \brief Base class for all type of plot canvases
+ */
+class QWT_EXPORT QwtPlotAbstractCanvas
+{
+  public:
+    /*!
+       \brief Focus indicator
+       The default setting is NoFocusIndicator
+       \sa setFocusIndicator(), focusIndicator(), drawFocusIndicator()
+     */
+
+    enum FocusIndicator
+    {
+        //! Don't paint a focus indicator
+        NoFocusIndicator,
+
+        /*!
+           The focus is related to the complete canvas.
+           Paint the focus indicator using drawFocusIndicator()
+         */
+        CanvasFocusIndicator,
+
+        /*!
+           The focus is related to an item (curve, point, ...) on
+           the canvas. It is up to the application to display a
+           focus indication using f.e. highlighting.
+         */
+        ItemFocusIndicator
+    };
+
+    explicit QwtPlotAbstractCanvas( QWidget* canvasWidget );
+    virtual ~QwtPlotAbstractCanvas();
+
+    QwtPlot* plot();
+    const QwtPlot* plot() const;
+
+    void setFocusIndicator( FocusIndicator );
+    FocusIndicator focusIndicator() const;
+
+    void setBorderRadius( double );
+    double borderRadius() const;
+
+  protected:
+    QWidget* canvasWidget();
+    const QWidget* canvasWidget() const;
+
+    virtual void drawFocusIndicator( QPainter* );
+    virtual void drawBorder( QPainter* );
+    virtual void drawBackground( QPainter* );
+
+    void fillBackground( QPainter* );
+    void drawCanvas( QPainter* );
+    void drawStyled( QPainter*, bool );
+    void drawUnstyled( QPainter* );
+
+    QPainterPath canvasBorderPath( const QRect& rect ) const;
+    void updateStyleSheetInfo();
+
+  private:
+    Q_DISABLE_COPY(QwtPlotAbstractCanvas)
+
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+/*!
+   \brief Base class of QwtPlotOpenGLCanvas and QwtPlotGLCanvas
+ */
+class QWT_EXPORT QwtPlotAbstractGLCanvas : public QwtPlotAbstractCanvas
+{
+  public:
+    /*!
+       \brief Paint attributes
+
+       The default setting enables BackingStore and Opaque.
+
+       \sa setPaintAttribute(), testPaintAttribute()
+     */
+    enum PaintAttribute
+    {
+        /*!
+           \brief Paint double buffered reusing the content
+                 of the pixmap buffer when possible.
+
+           Using a backing store might improve the performance
+           significantly, when working with widget overlays ( like rubber bands ).
+           Disabling the cache might improve the performance for
+           incremental paints (using QwtPlotDirectPainter ).
+
+           \sa backingStore(), invalidateBackingStore()
+         */
+        BackingStore = 1,
+
+        /*!
+           When ImmediatePaint is set replot() calls repaint()
+           instead of update().
+
+           \sa replot(), QWidget::repaint(), QWidget::update()
+         */
+        ImmediatePaint = 8,
+    };
+
+    //! Paint attributes
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
+
+    explicit QwtPlotAbstractGLCanvas( QWidget* canvasWidget );
+    virtual ~QwtPlotAbstractGLCanvas();
+
+    void setPaintAttribute( PaintAttribute, bool on = true );
+    bool testPaintAttribute( PaintAttribute ) const;
+
+    void setFrameStyle( int style );
+    int frameStyle() const;
+
+    void setFrameShadow( QFrame::Shadow );
+    QFrame::Shadow frameShadow() const;
+
+    void setFrameShape( QFrame::Shape );
+    QFrame::Shape frameShape() const;
+
+    void setLineWidth( int );
+    int lineWidth() const;
+
+    void setMidLineWidth( int );
+    int midLineWidth() const;
+
+    int frameWidth() const;
+    QRect frameRect() const;
+
+    //! Invalidate the internal backing store
+    virtual void invalidateBackingStore() = 0;
+
+  protected:
+    void replot();
+    void draw( QPainter* );
+
+  private:
+    virtual void clearBackingStore() = 0;
+
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotAbstractGLCanvas::PaintAttributes )
+
+#endif
Index: /trunk/BNC/qwt/qwt_plot_axis.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_axis.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_axis.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,110 +9,138 @@
 
 #include "qwt_plot.h"
-#include "qwt_math.h"
 #include "qwt_scale_widget.h"
+#include "qwt_scale_map.h"
 #include "qwt_scale_div.h"
 #include "qwt_scale_engine.h"
-
-class QwtPlot::AxisData
-{
-public:
-    bool isEnabled;
-    bool doAutoScale;
-
-    double minValue;
-    double maxValue;
-    double stepSize;
-
-    int maxMajor;
-    int maxMinor;
-
-    bool isValid;
-
-    QwtScaleDiv scaleDiv;
-    QwtScaleEngine *scaleEngine;
-    QwtScaleWidget *scaleWidget;
+#include "qwt_interval.h"
+
+namespace
+{
+    class AxisData
+    {
+      public:
+        AxisData()
+            : isVisible( true )
+            , doAutoScale( true )
+            , minValue( 0.0 )
+            , maxValue( 1000.0 )
+            , stepSize( 0.0 )
+            , maxMajor( 8 )
+            , maxMinor( 5 )
+            , isValid( false )
+            , scaleEngine( new QwtLinearScaleEngine() )
+            , scaleWidget( NULL )
+        {
+        }
+
+        ~AxisData()
+        {
+            delete scaleEngine;
+        }
+
+        void initWidget( QwtScaleDraw::Alignment align, const QString& name, QwtPlot* plot )
+        {
+            scaleWidget = new QwtScaleWidget( align, plot );
+            scaleWidget->setObjectName( name );
+
+    #if 1
+            // better find the font sizes from the application font
+            const QFont fscl( plot->fontInfo().family(), 10 );
+            const QFont fttl( plot->fontInfo().family(), 12, QFont::Bold );
+    #endif
+
+            scaleWidget->setTransformation( scaleEngine->transformation() );
+
+            scaleWidget->setFont( fscl );
+            scaleWidget->setMargin( 2 );
+
+            QwtText text = scaleWidget->title();
+            text.setFont( fttl );
+            scaleWidget->setTitle( text );
+        }
+
+        bool isVisible;
+        bool doAutoScale;
+
+        double minValue;
+        double maxValue;
+        double stepSize;
+
+        int maxMajor;
+        int maxMinor;
+
+        bool isValid;
+
+        QwtScaleDiv scaleDiv;
+        QwtScaleEngine* scaleEngine;
+        QwtScaleWidget* scaleWidget;
+    };
+}
+
+class QwtPlot::ScaleData
+{
+  public:
+    ScaleData( QwtPlot* plot )
+    {
+        using namespace QwtAxis;
+
+        m_axisData[YLeft].initWidget( QwtScaleDraw::LeftScale, "QwtPlotAxisYLeft", plot );
+        m_axisData[YRight].initWidget( QwtScaleDraw::RightScale, "QwtPlotAxisYRight", plot );
+        m_axisData[XTop].initWidget( QwtScaleDraw::TopScale, "QwtPlotAxisXTop", plot );
+        m_axisData[XBottom].initWidget( QwtScaleDraw::BottomScale, "QwtPlotAxisXBottom", plot );
+    }
+
+    inline AxisData& axisData( QwtAxisId axisId )
+    {
+        return m_axisData[ axisId ];
+    }
+
+    inline const AxisData& axisData( QwtAxisId axisId ) const
+    {
+        return m_axisData[ axisId ];
+    }
+
+  private:
+    AxisData m_axisData[ QwtAxis::AxisPositions ];
 };
 
-//! Initialize axes
 void QwtPlot::initAxesData()
 {
-    int axisId;
-
-    for ( axisId = 0; axisId < axisCnt; axisId++ )
-        d_axisData[axisId] = new AxisData;
-
-    d_axisData[yLeft]->scaleWidget =
-        new QwtScaleWidget( QwtScaleDraw::LeftScale, this );
-    d_axisData[yRight]->scaleWidget =
-        new QwtScaleWidget( QwtScaleDraw::RightScale, this );
-    d_axisData[xTop]->scaleWidget =
-        new QwtScaleWidget( QwtScaleDraw::TopScale, this );
-    d_axisData[xBottom]->scaleWidget =
-        new QwtScaleWidget( QwtScaleDraw::BottomScale, this );
-
-    d_axisData[yLeft]->scaleWidget->setObjectName( "QwtPlotAxisYLeft" );
-    d_axisData[yRight]->scaleWidget->setObjectName( "QwtPlotAxisYRight" );
-    d_axisData[xTop]->scaleWidget->setObjectName( "QwtPlotAxisXTop" );
-    d_axisData[xBottom]->scaleWidget->setObjectName( "QwtPlotAxisXBottom" );
-
-#if 1
-    // better find the font sizes from the application font
-    QFont fscl( fontInfo().family(), 10 );
-    QFont fttl( fontInfo().family(), 12, QFont::Bold );
-#endif
-
-    for ( axisId = 0; axisId < axisCnt; axisId++ )
-    {
-        AxisData &d = *d_axisData[axisId];
-
-        d.scaleEngine = new QwtLinearScaleEngine;
-
-        d.scaleWidget->setTransformation(
-            d.scaleEngine->transformation() );
-
-        d.scaleWidget->setFont( fscl );
-        d.scaleWidget->setMargin( 2 );
-
-        QwtText text = d.scaleWidget->title();
-        text.setFont( fttl );
-        d.scaleWidget->setTitle( text );
-
-        d.doAutoScale = true;
-
-        d.minValue = 0.0;
-        d.maxValue = 1000.0;
-        d.stepSize = 0.0;
-
-        d.maxMinor = 5;
-        d.maxMajor = 8;
-
-
-        d.isValid = false;
-    }
-
-    d_axisData[yLeft]->isEnabled = true;
-    d_axisData[yRight]->isEnabled = false;
-    d_axisData[xBottom]->isEnabled = true;
-    d_axisData[xTop]->isEnabled = false;
+    m_scaleData = new ScaleData( this );
+
+    m_scaleData->axisData( QwtAxis::YRight ).isVisible = false;
+    m_scaleData->axisData( QwtAxis::XTop ).isVisible = false;
 }
 
 void QwtPlot::deleteAxesData()
 {
-    for ( int axisId = 0; axisId < axisCnt; axisId++ )
-    {
-        delete d_axisData[axisId]->scaleEngine;
-        delete d_axisData[axisId];
-        d_axisData[axisId] = NULL;
-    }
-}
-
-/*!
-  \return Scale widget of the specified axis, or NULL if axisId is invalid.
-  \param axisId Axis index
-*/
-const QwtScaleWidget *QwtPlot::axisWidget( int axisId ) const
-{
-    if ( axisValid( axisId ) )
-        return d_axisData[axisId]->scaleWidget;
+    delete m_scaleData;
+    m_scaleData = NULL;
+}
+
+/*!
+   Checks if an axis is valid
+
+   \param axisId axis
+   \return \c true if the specified axis exists, otherwise \c false
+
+   \note This method is equivalent to QwtAxis::isValid( axisId ) and simply checks
+         if axisId is one of the values of QwtAxis::Position. It is a placeholder
+         for future releases, where it will be possible to have a customizable number
+         of axes ( multiaxes branch ) at each side.
+ */
+bool QwtPlot::isAxisValid( QwtAxisId axisId ) const
+{
+    return QwtAxis::isValid( axisId );
+}
+
+/*!
+   \return Scale widget of the specified axis, or NULL if axisId is invalid.
+   \param axisId Axis
+ */
+const QwtScaleWidget* QwtPlot::axisWidget( QwtAxisId axisId ) const
+{
+    if ( isAxisValid( axisId ) )
+        return m_scaleData->axisData( axisId ).scaleWidget;
 
     return NULL;
@@ -120,11 +148,11 @@
 
 /*!
-  \return Scale widget of the specified axis, or NULL if axisId is invalid.
-  \param axisId Axis index
-*/
-QwtScaleWidget *QwtPlot::axisWidget( int axisId )
-{
-    if ( axisValid( axisId ) )
-        return d_axisData[axisId]->scaleWidget;
+   \return Scale widget of the specified axis, or NULL if axisId is invalid.
+   \param axisId Axis
+ */
+QwtScaleWidget* QwtPlot::axisWidget( QwtAxisId axisId )
+{
+    if ( isAxisValid( axisId ) )
+        return m_scaleData->axisData( axisId ).scaleWidget;
 
     return NULL;
@@ -132,22 +160,21 @@
 
 /*!
-  Change the scale engine for an axis
-
-  \param axisId Axis index
-  \param scaleEngine Scale engine
-
-  \sa axisScaleEngine()
-*/
-void QwtPlot::setAxisScaleEngine( int axisId, QwtScaleEngine *scaleEngine )
-{
-    if ( axisValid( axisId ) && scaleEngine != NULL )
-    {
-        AxisData &d = *d_axisData[axisId];
+   Change the scale engine for an axis
+
+   \param axisId Axis
+   \param scaleEngine Scale engine
+
+   \sa axisScaleEngine()
+ */
+void QwtPlot::setAxisScaleEngine( QwtAxisId axisId, QwtScaleEngine* scaleEngine )
+{
+    if ( isAxisValid( axisId ) && scaleEngine != NULL )
+    {
+        AxisData& d = m_scaleData->axisData( axisId );
 
         delete d.scaleEngine;
         d.scaleEngine = scaleEngine;
 
-        d_axisData[axisId]->scaleWidget->setTransformation(
-            scaleEngine->transformation() );
+        d.scaleWidget->setTransformation( scaleEngine->transformation() );
 
         d.isValid = false;
@@ -158,11 +185,11 @@
 
 /*!
-  \param axisId Axis index
-  \return Scale engine for a specific axis
-*/
-QwtScaleEngine *QwtPlot::axisScaleEngine( int axisId )
-{
-    if ( axisValid( axisId ) )
-        return d_axisData[axisId]->scaleEngine;
+   \param axisId Axis
+   \return Scale engine for a specific axis
+ */
+QwtScaleEngine* QwtPlot::axisScaleEngine( QwtAxisId axisId )
+{
+    if ( isAxisValid( axisId ) )
+        return m_scaleData->axisData( axisId ).scaleEngine;
     else
         return NULL;
@@ -170,22 +197,22 @@
 
 /*!
-  \param axisId Axis index
-  \return Scale engine for a specific axis
-*/
-const QwtScaleEngine *QwtPlot::axisScaleEngine( int axisId ) const
-{
-    if ( axisValid( axisId ) )
-        return d_axisData[axisId]->scaleEngine;
+   \param axisId Axis
+   \return Scale engine for a specific axis
+ */
+const QwtScaleEngine* QwtPlot::axisScaleEngine( QwtAxisId axisId ) const
+{
+    if ( isAxisValid( axisId ) )
+        return m_scaleData->axisData( axisId ).scaleEngine;
     else
         return NULL;
 }
 /*!
-  \return \c True, if autoscaling is enabled
-  \param axisId Axis index
-*/
-bool QwtPlot::axisAutoScale( int axisId ) const
-{
-    if ( axisValid( axisId ) )
-        return d_axisData[axisId]->doAutoScale;
+   \return \c True, if autoscaling is enabled
+   \param axisId Axis
+ */
+bool QwtPlot::axisAutoScale( QwtAxisId axisId ) const
+{
+    if ( isAxisValid( axisId ) )
+        return m_scaleData->axisData( axisId ).doAutoScale;
     else
         return false;
@@ -193,11 +220,11 @@
 
 /*!
-  \return \c True, if a specified axis is enabled
-  \param axisId Axis index
-*/
-bool QwtPlot::axisEnabled( int axisId ) const
-{
-    if ( axisValid( axisId ) )
-        return d_axisData[axisId]->isEnabled;
+   \return \c True, if a specified axis is visible
+   \param axisId Axis
+ */
+bool QwtPlot::isAxisVisible( QwtAxisId axisId ) const
+{
+    if ( isAxisValid( axisId ) )
+        return m_scaleData->axisData( axisId ).isVisible;
     else
         return false;
@@ -205,10 +232,10 @@
 
 /*!
-  \return The font of the scale labels for a specified axis
-  \param axisId Axis index
-*/
-QFont QwtPlot::axisFont( int axisId ) const
-{
-    if ( axisValid( axisId ) )
+   \return The font of the scale labels for a specified axis
+   \param axisId Axis
+ */
+QFont QwtPlot::axisFont( QwtAxisId axisId ) const
+{
+    if ( isAxisValid( axisId ) )
         return axisWidget( axisId )->font();
     else
@@ -218,12 +245,12 @@
 
 /*!
-  \return The maximum number of major ticks for a specified axis
-  \param axisId Axis index
-  \sa setAxisMaxMajor(), QwtScaleEngine::divideScale()
-*/
-int QwtPlot::axisMaxMajor( int axisId ) const
-{
-    if ( axisValid( axisId ) )
-        return d_axisData[axisId]->maxMajor;
+   \return The maximum number of major ticks for a specified axis
+   \param axisId Axis
+   \sa setAxisMaxMajor(), QwtScaleEngine::divideScale()
+ */
+int QwtPlot::axisMaxMajor( QwtAxisId axisId ) const
+{
+    if ( isAxisValid( axisId ) )
+        return m_scaleData->axisData( axisId ).maxMajor;
     else
         return 0;
@@ -231,12 +258,12 @@
 
 /*!
-  \return the maximum number of minor ticks for a specified axis
-  \param axisId Axis index
-  \sa setAxisMaxMinor(), QwtScaleEngine::divideScale()
-*/
-int QwtPlot::axisMaxMinor( int axisId ) const
-{
-    if ( axisValid( axisId ) )
-        return d_axisData[axisId]->maxMinor;
+   \return the maximum number of minor ticks for a specified axis
+   \param axisId Axis
+   \sa setAxisMaxMinor(), QwtScaleEngine::divideScale()
+ */
+int QwtPlot::axisMaxMinor( QwtAxisId axisId ) const
+{
+    if ( isAxisValid( axisId ) )
+        return m_scaleData->axisData( axisId ).maxMinor;
     else
         return 0;
@@ -244,28 +271,32 @@
 
 /*!
-  \brief Return the scale division of a specified axis
-
-  axisScaleDiv(axisId).lowerBound(), axisScaleDiv(axisId).upperBound()
-  are the current limits of the axis scale.
-
-  \param axisId Axis index
-  \return Scale division
-
-  \sa QwtScaleDiv, setAxisScaleDiv(), QwtScaleEngine::divideScale()
-*/
-const QwtScaleDiv &QwtPlot::axisScaleDiv( int axisId ) const
-{
-    return d_axisData[axisId]->scaleDiv;
-}
-
-/*!
-  \brief Return the scale draw of a specified axis
-
-  \param axisId Axis index
-  \return Specified scaleDraw for axis, or NULL if axis is invalid.
-*/
-const QwtScaleDraw *QwtPlot::axisScaleDraw( int axisId ) const
-{
-    if ( !axisValid( axisId ) )
+   \brief Return the scale division of a specified axis
+
+   axisScaleDiv(axisId).lowerBound(), axisScaleDiv(axisId).upperBound()
+   are the current limits of the axis scale.
+
+   \param axisId Axis
+   \return Scale division
+
+   \sa QwtScaleDiv, setAxisScaleDiv(), QwtScaleEngine::divideScale()
+ */
+const QwtScaleDiv& QwtPlot::axisScaleDiv( QwtAxisId axisId ) const
+{
+    if ( isAxisValid( axisId ) )
+        return m_scaleData->axisData( axisId ).scaleDiv;
+
+    static QwtScaleDiv dummyScaleDiv;
+    return dummyScaleDiv;
+}
+
+/*!
+   \brief Return the scale draw of a specified axis
+
+   \param axisId Axis
+   \return Specified scaleDraw for axis, or NULL if axis is invalid.
+ */
+const QwtScaleDraw* QwtPlot::axisScaleDraw( QwtAxisId axisId ) const
+{
+    if ( !isAxisValid( axisId ) )
         return NULL;
 
@@ -274,12 +305,12 @@
 
 /*!
-  \brief Return the scale draw of a specified axis
-
-  \param axisId Axis index
-  \return Specified scaleDraw for axis, or NULL if axis is invalid.
-*/
-QwtScaleDraw *QwtPlot::axisScaleDraw( int axisId )
-{
-    if ( !axisValid( axisId ) )
+   \brief Return the scale draw of a specified axis
+
+   \param axisId Axis
+   \return Specified scaleDraw for axis, or NULL if axis is invalid.
+ */
+QwtScaleDraw* QwtPlot::axisScaleDraw( QwtAxisId axisId )
+{
+    if ( !isAxisValid( axisId ) )
         return NULL;
 
@@ -288,46 +319,46 @@
 
 /*!
-  \brief Return the step size parameter that has been set in setAxisScale.
-
-  This doesn't need to be the step size of the current scale.
-
-  \param axisId Axis index
-  \return step size parameter value
+   \brief Return the step size parameter that has been set in setAxisScale.
+
+   This doesn't need to be the step size of the current scale.
+
+   \param axisId Axis
+   \return step size parameter value
 
    \sa setAxisScale(), QwtScaleEngine::divideScale()
-*/
-double QwtPlot::axisStepSize( int axisId ) const
-{
-    if ( !axisValid( axisId ) )
+ */
+double QwtPlot::axisStepSize( QwtAxisId axisId ) const
+{
+    if ( !isAxisValid( axisId ) )
         return 0;
 
-    return d_axisData[axisId]->stepSize;
-}
-
-/*!
-  \brief Return the current interval of the specified axis
-
-  This is only a convenience function for axisScaleDiv( axisId )->interval();
-
-  \param axisId Axis index
-  \return Scale interval
-
-  \sa QwtScaleDiv, axisScaleDiv()
-*/
-QwtInterval QwtPlot::axisInterval( int axisId ) const
-{
-    if ( !axisValid( axisId ) )
+    return m_scaleData->axisData( axisId ).stepSize;
+}
+
+/*!
+   \brief Return the current interval of the specified axis
+
+   This is only a convenience function for axisScaleDiv( axisId )->interval();
+
+   \param axisId Axis
+   \return Scale interval
+
+   \sa QwtScaleDiv, axisScaleDiv()
+ */
+QwtInterval QwtPlot::axisInterval( QwtAxisId axisId ) const
+{
+    if ( !isAxisValid( axisId ) )
         return QwtInterval();
 
-    return d_axisData[axisId]->scaleDiv.interval();
-}
-
-/*!
-  \return Title of a specified axis
-  \param axisId Axis index
-*/
-QwtText QwtPlot::axisTitle( int axisId ) const
-{
-    if ( axisValid( axisId ) )
+    return m_scaleData->axisData( axisId ).scaleDiv.interval();
+}
+
+/*!
+   \return Title of a specified axis
+   \param axisId Axis
+ */
+QwtText QwtPlot::axisTitle( QwtAxisId axisId ) const
+{
+    if ( isAxisValid( axisId ) )
         return axisWidget( axisId )->title();
     else
@@ -336,21 +367,20 @@
 
 /*!
-  \brief Enable or disable a specified axis
-
-  When an axis is disabled, this only means that it is not
-  visible on the screen. Curves, markers and can be attached
-  to disabled axes, and transformation of screen coordinates
-  into values works as normal.
-
-  Only xBottom and yLeft are enabled by default.
-
-  \param axisId Axis index
-  \param tf \c true (enabled) or \c false (disabled)
-*/
-void QwtPlot::enableAxis( int axisId, bool tf )
-{
-    if ( axisValid( axisId ) && tf != d_axisData[axisId]->isEnabled )
-    {
-        d_axisData[axisId]->isEnabled = tf;
+   \brief Hide or show a specified axis
+
+   Curves, markers and other items can be attached
+   to hidden axes, and transformation of screen coordinates
+   into values works as normal.
+
+   Only QwtAxis::XBottom and QwtAxis::YLeft are enabled by default.
+
+   \param axisId Axis
+   \param on \c true (visible) or \c false (hidden)
+ */
+void QwtPlot::setAxisVisible( QwtAxisId axisId, bool on )
+{
+    if ( isAxisValid( axisId ) && on != m_scaleData->axisData( axisId ).isVisible )
+    {
+        m_scaleData->axisData( axisId ).isVisible = on;
         updateLayout();
     }
@@ -358,18 +388,18 @@
 
 /*!
-  Transform the x or y coordinate of a position in the
-  drawing region into a value.
-
-  \param axisId Axis index
-  \param pos position
-
-  \return Position as axis coordinate
-
-  \warning The position can be an x or a y coordinate,
+   Transform the x or y coordinate of a position in the
+   drawing region into a value.
+
+   \param axisId Axis
+   \param pos position
+
+   \return Position as axis coordinate
+
+   \warning The position can be an x or a y coordinate,
            depending on the specified axis.
-*/
-double QwtPlot::invTransform( int axisId, int pos ) const
-{
-    if ( axisValid( axisId ) )
+ */
+double QwtPlot::invTransform( QwtAxisId axisId, double pos ) const
+{
+    if ( isAxisValid( axisId ) )
         return( canvasMap( axisId ).invTransform( pos ) );
     else
@@ -379,14 +409,14 @@
 
 /*!
-  \brief Transform a value into a coordinate in the plotting region
-
-  \param axisId Axis index
-  \param value value
-  \return X or Y coordinate in the plotting region corresponding
+   \brief Transform a value into a coordinate in the plotting region
+
+   \param axisId Axis
+   \param value value
+   \return X or Y coordinate in the plotting region corresponding
           to the value.
-*/
-double QwtPlot::transform( int axisId, double value ) const
-{
-    if ( axisValid( axisId ) )
+ */
+double QwtPlot::transform( QwtAxisId axisId, double value ) const
+{
+    if ( isAxisValid( axisId ) )
         return( canvasMap( axisId ).transform( value ) );
     else
@@ -395,35 +425,35 @@
 
 /*!
-  \brief Change the font of an axis
-
-  \param axisId Axis index
-  \param font Font
-  \warning This function changes the font of the tick labels,
+   \brief Change the font of an axis
+
+   \param axisId Axis
+   \param font Font
+   \warning This function changes the font of the tick labels,
            not of the axis title.
-*/
-void QwtPlot::setAxisFont( int axisId, const QFont &font )
-{
-    if ( axisValid( axisId ) )
+ */
+void QwtPlot::setAxisFont( QwtAxisId axisId, const QFont& font )
+{
+    if ( isAxisValid( axisId ) )
         axisWidget( axisId )->setFont( font );
 }
 
 /*!
-  \brief Enable autoscaling for a specified axis
-
-  This member function is used to switch back to autoscaling mode
-  after a fixed scale has been set. Autoscaling is enabled by default.
-
-  \param axisId Axis index
-  \param on On/Off
-  \sa setAxisScale(), setAxisScaleDiv(), updateAxes()
-
-  \note The autoscaling flag has no effect until updateAxes() is executed
+   \brief Enable autoscaling for a specified axis
+
+   This member function is used to switch back to autoscaling mode
+   after a fixed scale has been set. Autoscaling is enabled by default.
+
+   \param axisId Axis
+   \param on On/Off
+   \sa setAxisScale(), setAxisScaleDiv(), updateAxes()
+
+   \note The autoscaling flag has no effect until updateAxes() is executed
         ( called by replot() ).
-*/
-void QwtPlot::setAxisAutoScale( int axisId, bool on )
-{
-    if ( axisValid( axisId ) && ( d_axisData[axisId]->doAutoScale != on ) )
-    {
-        d_axisData[axisId]->doAutoScale = on;
+ */
+void QwtPlot::setAxisAutoScale( QwtAxisId axisId, bool on )
+{
+    if ( isAxisValid( axisId ) && ( m_scaleData->axisData( axisId ).doAutoScale != on ) )
+    {
+        m_scaleData->axisData( axisId ).doAutoScale = on;
         autoRefresh();
     }
@@ -431,23 +461,23 @@
 
 /*!
-  \brief Disable autoscaling and specify a fixed scale for a selected axis.
-
-  In updateAxes() the scale engine calculates a scale division from the
-  specified parameters, that will be assigned to the scale widget. So
-  updates of the scale widget usually happen delayed with the next replot.
-
-  \param axisId Axis index
-  \param min Minimum of the scale
-  \param max Maximum of the scale
-  \param stepSize Major step size. If <code>step == 0</code>, the step size is
+   \brief Disable autoscaling and specify a fixed scale for a selected axis.
+
+   In updateAxes() the scale engine calculates a scale division from the
+   specified parameters, that will be assigned to the scale widget. So
+   updates of the scale widget usually happen delayed with the next replot.
+
+   \param axisId Axis
+   \param min Minimum of the scale
+   \param max Maximum of the scale
+   \param stepSize Major step size. If <code>step == 0</code>, the step size is
                   calculated automatically using the maxMajor setting.
 
-  \sa setAxisMaxMajor(), setAxisAutoScale(), axisStepSize(), QwtScaleEngine::divideScale()
-*/
-void QwtPlot::setAxisScale( int axisId, double min, double max, double stepSize )
-{
-    if ( axisValid( axisId ) )
-    {
-        AxisData &d = *d_axisData[axisId];
+   \sa setAxisMaxMajor(), setAxisAutoScale(), axisStepSize(), QwtScaleEngine::divideScale()
+ */
+void QwtPlot::setAxisScale( QwtAxisId axisId, double min, double max, double stepSize )
+{
+    if ( isAxisValid( axisId ) )
+    {
+        AxisData& d = m_scaleData->axisData( axisId );
 
         d.doAutoScale = false;
@@ -463,20 +493,20 @@
 
 /*!
-  \brief Disable autoscaling and specify a fixed scale for a selected axis.
-
-  The scale division will be stored locally only until the next call
-  of updateAxes(). So updates of the scale widget usually happen delayed with
-  the next replot.
-
-  \param axisId Axis index
-  \param scaleDiv Scale division
-
-  \sa setAxisScale(), setAxisAutoScale()
-*/
-void QwtPlot::setAxisScaleDiv( int axisId, const QwtScaleDiv &scaleDiv )
-{
-    if ( axisValid( axisId ) )
-    {
-        AxisData &d = *d_axisData[axisId];
+   \brief Disable autoscaling and specify a fixed scale for a selected axis.
+
+   The scale division will be stored locally only until the next call
+   of updateAxes(). So updates of the scale widget usually happen delayed with
+   the next replot.
+
+   \param axisId Axis
+   \param scaleDiv Scale division
+
+   \sa setAxisScale(), setAxisAutoScale()
+ */
+void QwtPlot::setAxisScaleDiv( QwtAxisId axisId, const QwtScaleDiv& scaleDiv )
+{
+    if ( isAxisValid( axisId ) )
+    {
+        AxisData& d = m_scaleData->axisData( axisId );
 
         d.doAutoScale = false;
@@ -489,22 +519,22 @@
 
 /*!
-  \brief Set a scale draw
-
-  \param axisId Axis index
-  \param scaleDraw Object responsible for drawing scales.
-
-  By passing scaleDraw it is possible to extend QwtScaleDraw
-  functionality and let it take place in QwtPlot. Please note
-  that scaleDraw has to be created with new and will be deleted
-  by the corresponding QwtScale member ( like a child object ).
-
-  \sa QwtScaleDraw, QwtScaleWidget
-  \warning The attributes of scaleDraw will be overwritten by those of the
+   \brief Set a scale draw
+
+   \param axisId Axis
+   \param scaleDraw Object responsible for drawing scales.
+
+   By passing scaleDraw it is possible to extend QwtScaleDraw
+   functionality and let it take place in QwtPlot. Please note
+   that scaleDraw has to be created with new and will be deleted
+   by the corresponding QwtScale member ( like a child object ).
+
+   \sa QwtScaleDraw, QwtScaleWidget
+   \warning The attributes of scaleDraw will be overwritten by those of the
            previous QwtScaleDraw.
-*/
-
-void QwtPlot::setAxisScaleDraw( int axisId, QwtScaleDraw *scaleDraw )
-{
-    if ( axisValid( axisId ) )
+ */
+
+void QwtPlot::setAxisScaleDraw( QwtAxisId axisId, QwtScaleDraw* scaleDraw )
+{
+    if ( isAxisValid( axisId ) )
     {
         axisWidget( axisId )->setScaleDraw( scaleDraw );
@@ -514,47 +544,47 @@
 
 /*!
-  Change the alignment of the tick labels
-
-  \param axisId Axis index
-  \param alignment Or'd Qt::AlignmentFlags see <qnamespace.h>
-
-  \sa QwtScaleDraw::setLabelAlignment()
-*/
-void QwtPlot::setAxisLabelAlignment( int axisId, Qt::Alignment alignment )
-{
-    if ( axisValid( axisId ) )
+   Change the alignment of the tick labels
+
+   \param axisId Axis
+   \param alignment Or'd Qt::AlignmentFlags see <qnamespace.h>
+
+   \sa QwtScaleDraw::setLabelAlignment()
+ */
+void QwtPlot::setAxisLabelAlignment( QwtAxisId axisId, Qt::Alignment alignment )
+{
+    if ( isAxisValid( axisId ) )
         axisWidget( axisId )->setLabelAlignment( alignment );
 }
 
 /*!
-  Rotate all tick labels
-
-  \param axisId Axis index
-  \param rotation Angle in degrees. When changing the label rotation,
+   Rotate all tick labels
+
+   \param axisId Axis
+   \param rotation Angle in degrees. When changing the label rotation,
                   the label alignment might be adjusted too.
 
-  \sa QwtScaleDraw::setLabelRotation(), setAxisLabelAlignment()
-*/
-void QwtPlot::setAxisLabelRotation( int axisId, double rotation )
-{
-    if ( axisValid( axisId ) )
+   \sa QwtScaleDraw::setLabelRotation(), setAxisLabelAlignment()
+ */
+void QwtPlot::setAxisLabelRotation( QwtAxisId axisId, double rotation )
+{
+    if ( isAxisValid( axisId ) )
         axisWidget( axisId )->setLabelRotation( rotation );
 }
 
 /*!
-  Set the maximum number of minor scale intervals for a specified axis
-
-  \param axisId Axis index
-  \param maxMinor Maximum number of minor steps
-
-  \sa axisMaxMinor()
-*/
-void QwtPlot::setAxisMaxMinor( int axisId, int maxMinor )
-{
-    if ( axisValid( axisId ) )
+   Set the maximum number of minor scale intervals for a specified axis
+
+   \param axisId Axis
+   \param maxMinor Maximum number of minor steps
+
+   \sa axisMaxMinor()
+ */
+void QwtPlot::setAxisMaxMinor( QwtAxisId axisId, int maxMinor )
+{
+    if ( isAxisValid( axisId ) )
     {
         maxMinor = qBound( 0, maxMinor, 100 );
 
-        AxisData &d = *d_axisData[axisId];
+        AxisData& d = m_scaleData->axisData( axisId );
         if ( maxMinor != d.maxMinor )
         {
@@ -567,18 +597,18 @@
 
 /*!
-  Set the maximum number of major scale intervals for a specified axis
-
-  \param axisId Axis index
-  \param maxMajor Maximum number of major steps
-
-  \sa axisMaxMajor()
-*/
-void QwtPlot::setAxisMaxMajor( int axisId, int maxMajor )
-{
-    if ( axisValid( axisId ) )
+   Set the maximum number of major scale intervals for a specified axis
+
+   \param axisId Axis
+   \param maxMajor Maximum number of major steps
+
+   \sa axisMaxMajor()
+ */
+void QwtPlot::setAxisMaxMajor( QwtAxisId axisId, int maxMajor )
+{
+    if ( isAxisValid( axisId ) )
     {
         maxMajor = qBound( 1, maxMajor, 10000 );
 
-        AxisData &d = *d_axisData[axisId];
+        AxisData& d = m_scaleData->axisData( axisId );
         if ( maxMajor != d.maxMajor )
         {
@@ -591,49 +621,49 @@
 
 /*!
-  \brief Change the title of a specified axis
-
-  \param axisId Axis index
-  \param title axis title
-*/
-void QwtPlot::setAxisTitle( int axisId, const QString &title )
-{
-    if ( axisValid( axisId ) )
+   \brief Change the title of a specified axis
+
+   \param axisId Axis
+   \param title axis title
+ */
+void QwtPlot::setAxisTitle( QwtAxisId axisId, const QString& title )
+{
+    if ( isAxisValid( axisId ) )
         axisWidget( axisId )->setTitle( title );
 }
 
 /*!
-  \brief Change the title of a specified axis
-
-  \param axisId Axis index
-  \param title Axis title
-*/
-void QwtPlot::setAxisTitle( int axisId, const QwtText &title )
-{
-    if ( axisValid( axisId ) )
+   \brief Change the title of a specified axis
+
+   \param axisId Axis
+   \param title Axis title
+ */
+void QwtPlot::setAxisTitle( QwtAxisId axisId, const QwtText& title )
+{
+    if ( isAxisValid( axisId ) )
         axisWidget( axisId )->setTitle( title );
 }
 
 /*!
-  \brief Rebuild the axes scales
-
-  In case of autoscaling the boundaries of a scale are calculated
-  from the bounding rectangles of all plot items, having the
-  QwtPlotItem::AutoScale flag enabled ( QwtScaleEngine::autoScale() ).
-  Then a scale division is calculated ( QwtScaleEngine::didvideScale() )
-  and assigned to scale widget.
-
-  When the scale boundaries have been assigned with setAxisScale() a
-  scale division is calculated ( QwtScaleEngine::didvideScale() )
-  for this interval and assigned to the scale widget.
-
-  When the scale has been set explicitly by setAxisScaleDiv() the
-  locally stored scale division gets assigned to the scale widget.
-
-  The scale widget indicates modifications by emitting a
-  QwtScaleWidget::scaleDivChanged() signal.
-
-  updateAxes() is usually called by replot().
-
-  \sa setAxisAutoScale(), setAxisScale(), setAxisScaleDiv(), replot()
+   \brief Rebuild the axes scales
+
+   In case of autoscaling the boundaries of a scale are calculated
+   from the bounding rectangles of all plot items, having the
+   QwtPlotItem::AutoScale flag enabled ( QwtScaleEngine::autoScale() ).
+   Then a scale division is calculated ( QwtScaleEngine::didvideScale() )
+   and assigned to scale widget.
+
+   When the scale boundaries have been assigned with setAxisScale() a
+   scale division is calculated ( QwtScaleEngine::didvideScale() )
+   for this interval and assigned to the scale widget.
+
+   When the scale has been set explicitly by setAxisScaleDiv() the
+   locally stored scale division gets assigned to the scale widget.
+
+   The scale widget indicates modifications by emitting a
+   QwtScaleWidget::scaleDivChanged() signal.
+
+   updateAxes() is usually called by replot().
+
+   \sa setAxisAutoScale(), setAxisScale(), setAxisScaleDiv(), replot()
       QwtPlotItem::boundingRect()
  */
@@ -643,5 +673,5 @@
     // for all axes, where autoscaling is enabled
 
-    QwtInterval intv[axisCnt];
+    QwtInterval boundingIntervals[QwtAxis::AxisPositions];
 
     const QwtPlotItemList& itmList = itemList();
@@ -650,5 +680,5 @@
     for ( it = itmList.begin(); it != itmList.end(); ++it )
     {
-        const QwtPlotItem *item = *it;
+        const QwtPlotItem* item = *it;
 
         if ( !item->testItemAttribute( QwtPlotItem::AutoScale ) )
@@ -658,13 +688,16 @@
             continue;
 
-        if ( axisAutoScale( item->xAxis() ) || axisAutoScale( item->yAxis() ) )
+        const QwtAxisId xAxis = item->xAxis();
+        const QwtAxisId yAxis = item->yAxis();
+
+        if ( axisAutoScale( xAxis ) || axisAutoScale( yAxis ) )
         {
             const QRectF rect = item->boundingRect();
 
-            if ( rect.width() >= 0.0 )
-                intv[item->xAxis()] |= QwtInterval( rect.left(), rect.right() );
-
-            if ( rect.height() >= 0.0 )
-                intv[item->yAxis()] |= QwtInterval( rect.top(), rect.bottom() );
+            if ( axisAutoScale( xAxis ) && rect.width() >= 0.0 )
+                boundingIntervals[xAxis] |= QwtInterval( rect.left(), rect.right() );
+
+            if ( axisAutoScale( yAxis ) && rect.height() >= 0.0 )
+                boundingIntervals[yAxis] |= QwtInterval( rect.top(), rect.bottom() );
         }
     }
@@ -672,41 +705,46 @@
     // Adjust scales
 
-    for ( int axisId = 0; axisId < axisCnt; axisId++ )
-    {
-        AxisData &d = *d_axisData[axisId];
-
-        double minValue = d.minValue;
-        double maxValue = d.maxValue;
-        double stepSize = d.stepSize;
-
-        if ( d.doAutoScale && intv[axisId].isValid() )
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
         {
-            d.isValid = false;
-
-            minValue = intv[axisId].minValue();
-            maxValue = intv[axisId].maxValue();
-
-            d.scaleEngine->autoScale( d.maxMajor,
-                minValue, maxValue, stepSize );
+            const QwtAxisId axisId( axisPos );
+
+            AxisData& d = m_scaleData->axisData( axisId );
+
+            double minValue = d.minValue;
+            double maxValue = d.maxValue;
+            double stepSize = d.stepSize;
+
+            const QwtInterval& interval = boundingIntervals[axisId];
+
+            if ( d.doAutoScale && interval.isValid() )
+            {
+                d.isValid = false;
+
+                minValue = interval.minValue();
+                maxValue = interval.maxValue();
+
+                d.scaleEngine->autoScale( d.maxMajor,
+                    minValue, maxValue, stepSize );
+            }
+            if ( !d.isValid )
+            {
+                d.scaleDiv = d.scaleEngine->divideScale(
+                    minValue, maxValue, d.maxMajor, d.maxMinor, stepSize );
+                d.isValid = true;
+            }
+
+            QwtScaleWidget* scaleWidget = axisWidget( axisId );
+            scaleWidget->setScaleDiv( d.scaleDiv );
+
+            int startDist, endDist;
+            scaleWidget->getBorderDistHint( startDist, endDist );
+            scaleWidget->setBorderDist( startDist, endDist );
         }
-        if ( !d.isValid )
-        {
-            d.scaleDiv = d.scaleEngine->divideScale(
-                minValue, maxValue,
-                d.maxMajor, d.maxMinor, stepSize );
-            d.isValid = true;
-        }
-
-        QwtScaleWidget *scaleWidget = axisWidget( axisId );
-        scaleWidget->setScaleDiv( d.scaleDiv );
-
-        int startDist, endDist;
-        scaleWidget->getBorderDistHint( startDist, endDist );
-        scaleWidget->setBorderDist( startDist, endDist );
     }
 
     for ( it = itmList.begin(); it != itmList.end(); ++it )
     {
-        QwtPlotItem *item = *it;
+        QwtPlotItem* item = *it;
         if ( item->testItemInterest( QwtPlotItem::ScaleInterest ) )
         {
@@ -716,3 +754,2 @@
     }
 }
-
Index: /trunk/BNC/qwt/qwt_plot_barchart.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_barchart.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_barchart.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,13 +11,16 @@
 #include "qwt_scale_map.h"
 #include "qwt_column_symbol.h"
-#include "qwt_painter.h"
+#include "qwt_text.h"
+#include "qwt_graphic.h"
+#include "qwt_legend_data.h"
+
 #include <qpainter.h>
 
 class QwtPlotBarChart::PrivateData
 {
-public:
-    PrivateData():
-        symbol( NULL ),
-        legendMode( QwtPlotBarChart::LegendChartTitle )
+  public:
+    PrivateData()
+        : symbol( NULL )
+        , legendMode( QwtPlotBarChart::LegendChartTitle )
     {
     }
@@ -28,14 +31,14 @@
     }
 
-    QwtColumnSymbol *symbol;
+    QwtColumnSymbol* symbol;
     QwtPlotBarChart::LegendMode legendMode;
 };
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotBarChart::QwtPlotBarChart( const QwtText &title ):
-    QwtPlotAbstractBarChart( title )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotBarChart::QwtPlotBarChart( const QwtText& title )
+    : QwtPlotAbstractBarChart( title )
 {
     init();
@@ -43,9 +46,9 @@
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotBarChart::QwtPlotBarChart( const QString &title ):
-    QwtPlotAbstractBarChart( QwtText( title ) )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotBarChart::QwtPlotBarChart( const QString& title )
+    : QwtPlotAbstractBarChart( QwtText( title ) )
 {
     init();
@@ -55,10 +58,10 @@
 QwtPlotBarChart::~QwtPlotBarChart()
 {
-    delete d_data;
+    delete m_data;
 }
 
 void QwtPlotBarChart::init()
 {
-    d_data = new PrivateData;
+    m_data = new PrivateData;
     setData( new QwtPointSeriesData() );
 }
@@ -71,12 +74,12 @@
 
 /*!
-  Initialize data with an array of points
-
-  \param samples Vector of points
-  \note QVector is implicitly shared
-  \note QPolygonF is derived from QVector<QPointF>
-*/
+   Initialize data with an array of points
+
+   \param samples Vector of points
+   \note QVector is implicitly shared
+   \note QPolygonF is derived from QVector<QPointF>
+ */
 void QwtPlotBarChart::setSamples(
-    const QVector<QPointF> &samples )
+    const QVector< QPointF >& samples )
 {
     setData( new QwtPointSeriesData( samples ) );
@@ -84,16 +87,18 @@
 
 /*!
-  Initialize data with an array of doubles
-
-  The indices in the array are taken as x coordinate,
-  while the doubles are interpreted as y values.
-
-  \param samples Vector of y coordinates
-  \note QVector is implicitly shared
-*/
+   Initialize data with an array of doubles
+
+   The indices in the array are taken as x coordinate,
+   while the doubles are interpreted as y values.
+
+   \param samples Vector of y coordinates
+   \note QVector is implicitly shared
+ */
 void QwtPlotBarChart::setSamples(
-    const QVector<double> &samples )
-{
-    QVector<QPointF> points;
+    const QVector< double >& samples )
+{
+    QVector< QPointF > points;
+    points.reserve( samples.size() );
+
     for ( int i = 0; i < samples.size(); i++ )
         points += QPointF( i, samples[ i ] );
@@ -103,14 +108,14 @@
 
 /*!
-  Assign a series of samples
-
-  setSamples() is just a wrapper for setData() without any additional
-  value - beside that it is easier to find for the developer.
-
-  \param data Data
-  \warning The item takes ownership of the data object, deleting
+   Assign a series of samples
+
+   setSamples() is just a wrapper for setData() without any additional
+   value - beside that it is easier to find for the developer.
+
+   \param data Data
+   \warning The item takes ownership of the data object, deleting
            it when its not used anymore.
-*/
-void QwtPlotBarChart::setSamples( QwtSeriesData<QPointF> *data )
+ */
+void QwtPlotBarChart::setSamples( QwtSeriesData< QPointF >* data )
 {
     setData( data );
@@ -118,19 +123,19 @@
 
 /*!
-  \brief Assign a symbol
-
-  The bar chart will take the ownership of the symbol, hence the previously
-  set symbol will be delete by setting a new one. If \p symbol is
-  \c NULL no symbol will be drawn.
-
-  \param symbol Symbol
-  \sa symbol()
-*/
-void QwtPlotBarChart::setSymbol( QwtColumnSymbol *symbol )
-{
-    if ( symbol != d_data->symbol )
-    {
-        delete d_data->symbol;
-        d_data->symbol = symbol;
+   \brief Assign a symbol
+
+   The bar chart will take the ownership of the symbol, hence the previously
+   set symbol will be delete by setting a new one. If \p symbol is
+   \c NULL no symbol will be drawn.
+
+   \param symbol Symbol
+   \sa symbol()
+ */
+void QwtPlotBarChart::setSymbol( QwtColumnSymbol* symbol )
+{
+    if ( symbol != m_data->symbol )
+    {
+        delete m_data->symbol;
+        m_data->symbol = symbol;
 
         legendChanged();
@@ -140,26 +145,26 @@
 
 /*!
-  \return Current symbol or NULL, when no symbol has been assigned
-  \sa setSymbol()
-*/
-const QwtColumnSymbol *QwtPlotBarChart::symbol() const
-{
-    return d_data->symbol;
-}
-
-/*!
-  Set the mode that decides what to display on the legend
-
-  In case of LegendBarTitles barTitle() needs to be overloaded
-  to return individual titles for each bar.
-
-  \param mode New mode
-  \sa legendMode(), legendData(), barTitle(), QwtPlotItem::ItemAttribute
+   \return Current symbol or NULL, when no symbol has been assigned
+   \sa setSymbol()
+ */
+const QwtColumnSymbol* QwtPlotBarChart::symbol() const
+{
+    return m_data->symbol;
+}
+
+/*!
+   Set the mode that decides what to display on the legend
+
+   In case of LegendBarTitles barTitle() needs to be overloaded
+   to return individual titles for each bar.
+
+   \param mode New mode
+   \sa legendMode(), legendData(), barTitle(), QwtPlotItem::ItemAttribute
  */
 void QwtPlotBarChart::setLegendMode( LegendMode mode )
 {
-    if ( mode != d_data->legendMode )
-    {
-        d_data->legendMode = mode;
+    if ( mode != m_data->legendMode )
+    {
+        m_data->legendMode = mode;
         legendChanged();
     }
@@ -167,16 +172,16 @@
 
 /*!
-  \return Legend mode
-  \sa setLegendMode()
+   \return Legend mode
+   \sa setLegendMode()
  */
 QwtPlotBarChart::LegendMode QwtPlotBarChart::legendMode() const
 {
-    return d_data->legendMode;
-}
-
-/*!
-  \return Bounding rectangle of all samples.
-  For an empty series the rectangle is invalid.
-*/
+    return m_data->legendMode;
+}
+
+/*!
+   \return Bounding rectangle of all samples.
+   For an empty series the rectangle is invalid.
+ */
 QRectF QwtPlotBarChart::boundingRect() const
 {
@@ -204,19 +209,19 @@
 
 /*!
-  Draw an interval of the bar chart
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rect of the canvas
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted. If to < 0 the
+   Draw an interval of the bar chart
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rect of the canvas
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted. If to < 0 the
          curve will be painted to its last point.
 
-  \sa drawSymbols()
-*/
-void QwtPlotBarChart::drawSeries( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   \sa drawSymbols()
+ */
+void QwtPlotBarChart::drawSeries( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     if ( to < 0 )
@@ -238,5 +243,5 @@
     {
         drawSample( painter, xMap, yMap,
-                    canvasRect, interval, i, sample( i ) );
+            canvasRect, interval, i, sample( i ) );
     }
 
@@ -245,20 +250,18 @@
 
 /*!
-  Draw a sample
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rect of the canvas
-  \param boundingInterval Bounding interval of sample values
-  \param index Index of the sample
-  \param sample Value of the sample
-
-  \sa drawSeries()
-*/
-void QwtPlotBarChart::drawSample( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, const QwtInterval &boundingInterval,
-    int index, const QPointF &sample ) const
+   Calculate the geometry of a bar in widget coordinates
+
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rect of the canvas
+   \param boundingInterval Bounding interval of sample values
+   \param sample Value of the sample
+
+   \return Geometry of the column
+ */
+QwtColumnRect QwtPlotBarChart::columnRect(
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, const QwtInterval& boundingInterval,
+    const QPointF& sample ) const
 {
     QwtColumnRect barRect;
@@ -301,25 +304,49 @@
     }
 
+    return barRect;
+}
+
+/*!
+   Draw a sample
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rect of the canvas
+   \param boundingInterval Bounding interval of sample values
+   \param index Index of the sample
+   \param sample Value of the sample
+
+   \sa drawSeries()
+ */
+void QwtPlotBarChart::drawSample( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, const QwtInterval& boundingInterval,
+    int index, const QPointF& sample ) const
+{
+    const QwtColumnRect barRect = columnRect( xMap, yMap,
+        canvasRect, boundingInterval, sample );
+
     drawBar( painter, index, sample, barRect );
 }
 
 /*!
-  Draw a bar
-
-  \param painter Painter
-  \param sampleIndex Index of the sample represented by the bar
-  \param sample Value of the sample
-  \param rect Bounding rectangle of the bar
- */
-void QwtPlotBarChart::drawBar( QPainter *painter,
-    int sampleIndex, const QPointF &sample,
-    const QwtColumnRect &rect ) const
-{
-    const QwtColumnSymbol *specialSym =
+   Draw a bar
+
+   \param painter Painter
+   \param sampleIndex Index of the sample represented by the bar
+   \param sample Value of the sample
+   \param rect Bounding rectangle of the bar
+ */
+void QwtPlotBarChart::drawBar( QPainter* painter,
+    int sampleIndex, const QPointF& sample,
+    const QwtColumnRect& rect ) const
+{
+    const QwtColumnSymbol* specialSym =
         specialSymbol( sampleIndex, sample );
 
-    const QwtColumnSymbol *sym = specialSym;
+    const QwtColumnSymbol* sym = specialSym;
     if ( sym == NULL )
-        sym = d_data->symbol;
+        sym = m_data->symbol;
 
     if ( sym )
@@ -340,14 +367,14 @@
 
 /*!
-  Needs to be overloaded to return a
-  non default symbol for a specific sample
-
-  \param sampleIndex Index of the sample represented by the bar
-  \param sample Value of the sample
-
-  \return NULL, indicating to use the default symbol
- */
-QwtColumnSymbol *QwtPlotBarChart::specialSymbol(
-    int sampleIndex, const QPointF &sample ) const
+   Needs to be overloaded to return a
+   non default symbol for a specific sample
+
+   \param sampleIndex Index of the sample represented by the bar
+   \param sample Value of the sample
+
+   \return NULL, indicating to use the default symbol
+ */
+QwtColumnSymbol* QwtPlotBarChart::specialSymbol(
+    int sampleIndex, const QPointF& sample ) const
 {
     Q_UNUSED( sampleIndex );
@@ -358,15 +385,15 @@
 
 /*!
-  \brief Return the title of a bar
-
-  In LegendBarTitles mode the title is displayed on
-  the legend entry corresponding to a bar.
-
-  The default implementation is a dummy, that is intended
-  to be overloaded.
-
-  \param sampleIndex Index of the bar
-  \return An empty text
-  \sa LegendBarTitles
+   \brief Return the title of a bar
+
+   In LegendBarTitles mode the title is displayed on
+   the legend entry corresponding to a bar.
+
+   The default implementation is a dummy, that is intended
+   to be overloaded.
+
+   \param sampleIndex Index of the bar
+   \return An empty text
+   \sa LegendBarTitles
  */
 QwtText QwtPlotBarChart::barTitle( int sampleIndex ) const
@@ -387,26 +414,24 @@
    \sa title(), setLegendMode(), barTitle(), QwtLegend, QwtPlotLegendItem
  */
-QList<QwtLegendData> QwtPlotBarChart::legendData() const
-{
-    QList<QwtLegendData> list;
-
-    if ( d_data->legendMode == LegendBarTitles )
+QList< QwtLegendData > QwtPlotBarChart::legendData() const
+{
+    QList< QwtLegendData > list;
+
+    if ( m_data->legendMode == LegendBarTitles )
     {
         const size_t numSamples = dataSize();
+        list.reserve( numSamples );
+
         for ( size_t i = 0; i < numSamples; i++ )
         {
             QwtLegendData data;
 
-            QVariant titleValue;
-            qVariantSetValue( titleValue, barTitle( i ) );
-            data.setValue( QwtLegendData::TitleRole, titleValue );
+            data.setValue( QwtLegendData::TitleRole,
+                QVariant::fromValue( barTitle( i ) ) );
 
             if ( !legendIconSize().isEmpty() )
             {
-                QVariant iconValue;
-                qVariantSetValue( iconValue,
-                    legendIcon( i, legendIconSize() ) );
-
-                data.setValue( QwtLegendData::IconRole, iconValue );
+                data.setValue( QwtLegendData::IconRole,
+                    QVariant::fromValue( legendIcon( i, legendIconSize() ) ) );
             }
 
@@ -436,5 +461,5 @@
  */
 QwtGraphic QwtPlotBarChart::legendIcon(
-    int index, const QSizeF &size ) const
+    int index, const QSizeF& size ) const
 {
     QwtColumnRect column;
@@ -451,5 +476,5 @@
 
     int barIndex = -1;
-    if ( d_data->legendMode == QwtPlotBarChart::LegendBarTitles )
+    if ( m_data->legendMode == QwtPlotBarChart::LegendBarTitles )
         barIndex = index;
 
Index: /trunk/BNC/qwt/qwt_plot_barchart.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_barchart.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_barchart.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,105 +13,111 @@
 #include "qwt_global.h"
 #include "qwt_plot_abstract_barchart.h"
-#include "qwt_series_data.h"
 
 class QwtColumnRect;
 class QwtColumnSymbol;
+template< typename T > class QwtSeriesData;
 
 /*!
-  \brief QwtPlotBarChart displays a series of a values as bars.
+   \brief QwtPlotBarChart displays a series of a values as bars.
 
-  Each bar might be customized individually by implementing
-  a specialSymbol(). Otherwise it is rendered using a default symbol.
+   Each bar might be customized individually by implementing
+   a specialSymbol(). Otherwise it is rendered using a default symbol.
 
-  Depending on its orientation() the bars are displayed horizontally
-  or vertically. The bars cover the interval between the baseline()
-  and the value.
+   Depending on its orientation() the bars are displayed horizontally
+   or vertically. The bars cover the interval between the baseline()
+   and the value.
 
-  By activating the LegendBarTitles mode each sample will have
-  its own entry on the legend.
+   By activating the LegendBarTitles mode each sample will have
+   its own entry on the legend.
 
-  The most common use case of a bar chart is to display a
-  list of y coordinates, where the x coordinate is simply the index
-  in the list. But for other situations ( f.e. when values are related
-  to dates ) it is also possible to set x coordinates explicitly.
+   The most common use case of a bar chart is to display a
+   list of y coordinates, where the x coordinate is simply the index
+   in the list. But for other situations ( f.e. when values are related
+   to dates ) it is also possible to set x coordinates explicitly.
 
-  \sa QwtPlotMultiBarChart, QwtPlotHistogram, QwtPlotCurve::Sticks,
+   \sa QwtPlotMultiBarChart, QwtPlotHistogram, QwtPlotCurve::Sticks,
       QwtPlotSeriesItem::orientation(), QwtPlotAbstractBarChart::baseline()
  */
-class QWT_EXPORT QwtPlotBarChart:
-    public QwtPlotAbstractBarChart, public QwtSeriesStore<QPointF>
+class QWT_EXPORT QwtPlotBarChart
+    : public QwtPlotAbstractBarChart
+    , public QwtSeriesStore< QPointF >
 {
-public:
+  public:
     /*!
-      \brief Legend modes.
+       \brief Legend modes.
 
-      The default setting is QwtPlotBarChart::LegendChartTitle.
-      \sa setLegendMode(), legendMode()
-    */
+       The default setting is QwtPlotBarChart::LegendChartTitle.
+       \sa setLegendMode(), legendMode()
+     */
     enum LegendMode
     {
         /*!
-          One entry on the legend showing the default symbol
-          and the title() of the chart
+           One entry on the legend showing the default symbol
+           and the title() of the chart
 
-          \sa QwtPlotItem::title()
+           \sa QwtPlotItem::title()
          */
         LegendChartTitle,
 
         /*!
-          One entry for each value showing the individual symbol
-          of the corresponding bar and the bar title.
+           One entry for each value showing the individual symbol
+           of the corresponding bar and the bar title.
 
-          \sa specialSymbol(), barTitle()
+           \sa specialSymbol(), barTitle()
          */
         LegendBarTitles
     };
 
-    explicit QwtPlotBarChart( const QString &title = QString() );
-    explicit QwtPlotBarChart( const QwtText &title );
+    explicit QwtPlotBarChart( const QString& title = QString() );
+    explicit QwtPlotBarChart( const QwtText& title );
 
     virtual ~QwtPlotBarChart();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
-    void setSamples( const QVector<QPointF> & );
-    void setSamples( const QVector<double> & );
-    void setSamples( QwtSeriesData<QPointF> * );
+    void setSamples( const QVector< QPointF >& );
+    void setSamples( const QVector< double >& );
+    void setSamples( QwtSeriesData< QPointF >* );
 
-    void setSymbol( QwtColumnSymbol * );
-    const QwtColumnSymbol *symbol() const;
+    void setSymbol( QwtColumnSymbol* );
+    const QwtColumnSymbol* symbol() const;
 
     void setLegendMode( LegendMode );
     LegendMode legendMode() const;
 
-    virtual void drawSeries( QPainter *painter,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
+    virtual void drawSeries( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
 
-    virtual QRectF boundingRect() const;
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
 
-    virtual QwtColumnSymbol *specialSymbol(
+    virtual QwtColumnSymbol* specialSymbol(
         int sampleIndex, const QPointF& ) const;
 
     virtual QwtText barTitle( int sampleIndex ) const;
 
-protected:
-    virtual void drawSample( QPainter *painter,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, const QwtInterval &boundingInterval,
+  protected:
+    virtual void drawSample( QPainter* painter,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, const QwtInterval& boundingInterval,
         int index, const QPointF& sample ) const;
 
-    virtual void drawBar( QPainter *,
+    virtual void drawBar( QPainter*,
         int sampleIndex, const QPointF& sample,
-        const QwtColumnRect & ) const;
+        const QwtColumnRect& ) const;
 
-    QList<QwtLegendData> legendData() const;
-    QwtGraphic legendIcon( int index, const QSizeF & ) const;
+    QwtColumnRect columnRect(
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, const QwtInterval& boundingInterval,
+        const QPointF& sample ) const;
 
-private:
+    QList< QwtLegendData > legendData() const QWT_OVERRIDE;
+    QwtGraphic legendIcon( int index, const QSizeF& ) const QWT_OVERRIDE;
+
+  private:
     void init();
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_canvas.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_canvas.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_canvas.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,543 +10,46 @@
 #include "qwt_plot_canvas.h"
 #include "qwt_painter.h"
-#include "qwt_null_paintdevice.h"
-#include "qwt_math.h"
 #include "qwt_plot.h"
+
 #include <qpainter.h>
-#include <qstyle.h>
-#include <qstyleoption.h>
-#include <qpaintengine.h>
+#include <qpainterpath.h>
 #include <qevent.h>
 
-class QwtStyleSheetRecorder: public QwtNullPaintDevice
-{
-public:
-    QwtStyleSheetRecorder( const QSize &size ):
-        d_size( size )
-    {
-    }
-
-    virtual void updateState( const QPaintEngineState &state )
-    {
-        if ( state.state() & QPaintEngine::DirtyPen )
-        {
-            d_pen = state.pen();
-        }
-        if ( state.state() & QPaintEngine::DirtyBrush )
-        {
-            d_brush = state.brush();
-        }
-        if ( state.state() & QPaintEngine::DirtyBrushOrigin )
-        {
-            d_origin = state.brushOrigin();
-        }
-    }
-
-    virtual void drawRects(const QRectF *rects, int count )
-    {
-        for ( int i = 0; i < count; i++ )
-            border.rectList += rects[i];
-    }
-
-    virtual void drawRects(const QRect *rects, int count )
-    {
-        // to silence -Woverloaded-virtual
-        QwtNullPaintDevice::drawRects( rects, count );
-    }
-
-    virtual void drawPath( const QPainterPath &path )
-    {
-        const QRectF rect( QPointF( 0.0, 0.0 ), d_size );
-        if ( path.controlPointRect().contains( rect.center() ) )
-        {
-            setCornerRects( path );
-            alignCornerRects( rect );
-
-            background.path = path;
-            background.brush = d_brush;
-            background.origin = d_origin;
-        }
-        else
-        {
-            border.pathList += path;
-        }
-    }
-
-    void setCornerRects( const QPainterPath &path )
-    {
-        QPointF pos( 0.0, 0.0 );
-
-        for ( int i = 0; i < path.elementCount(); i++ )
-        {
-            QPainterPath::Element el = path.elementAt(i);
-            switch( el.type )
-            {
-                case QPainterPath::MoveToElement:
-                case QPainterPath::LineToElement:
-                {
-                    pos.setX( el.x );
-                    pos.setY( el.y );
-                    break;
-                }
-                case QPainterPath::CurveToElement:
-                {
-                    QRectF r( pos, QPointF( el.x, el.y ) );
-                    clipRects += r.normalized();
-
-                    pos.setX( el.x );
-                    pos.setY( el.y );
-
-                    break;
-                }
-                case QPainterPath::CurveToDataElement:
-                {
-                    if ( clipRects.size() > 0 )
-                    {
-                        QRectF r = clipRects.last();
-                        r.setCoords(
-                            qMin( r.left(), el.x ),
-                            qMin( r.top(), el.y ),
-                            qMax( r.right(), el.x ),
-                            qMax( r.bottom(), el.y )
-                        );
-                        clipRects.last() = r.normalized();
-                    }
-                    break;
-                }
-            }
-        }
-    }
-
-protected:
-    virtual QSize sizeMetrics() const
-    {
-        return d_size;
-    }
-
-private:
-    void alignCornerRects( const QRectF &rect )
-    {
-        for ( int i = 0; i < clipRects.size(); i++ )
-        {
-            QRectF &r = clipRects[i];
-            if ( r.center().x() < rect.center().x() )
-                r.setLeft( rect.left() );
-            else
-                r.setRight( rect.right() );
-
-            if ( r.center().y() < rect.center().y() )
-                r.setTop( rect.top() );
-            else
-                r.setBottom( rect.bottom() );
-        }
-    }
-
-
-public:
-    QVector<QRectF> clipRects;
-
-    struct Border
-    {
-        QList<QPainterPath> pathList;
-        QList<QRectF> rectList;
-        QRegion clipRegion;
-    } border;
-
-    struct Background
-    {
-        QPainterPath path;
-        QBrush brush;
-        QPointF origin;
-    } background;
-
-private:
-    const QSize d_size;
-
-    QPen d_pen;
-    QBrush d_brush;
-    QPointF d_origin;
+class QwtPlotCanvas::PrivateData
+{
+  public:
+    PrivateData()
+        : backingStore( NULL )
+    {
+    }
+
+    ~PrivateData()
+    {
+        delete backingStore;
+    }
+
+    QwtPlotCanvas::PaintAttributes paintAttributes;
+    QPixmap* backingStore;
 };
 
-static void qwtDrawBackground( QPainter *painter, QwtPlotCanvas *canvas )
-{
-    painter->save();
-
-    const QPainterPath borderClip = canvas->borderPath( canvas->rect() );
-    if ( !borderClip.isEmpty() )
-        painter->setClipPath( borderClip, Qt::IntersectClip );
-
-    const QBrush &brush =
-        canvas->palette().brush( canvas->backgroundRole() );
-
-    if ( brush.style() == Qt::TexturePattern )
-    {
-        QPixmap pm( canvas->size() );
-        QwtPainter::fillPixmap( canvas, pm );
-        painter->drawPixmap( 0, 0, pm );
-    }
-    else if ( brush.gradient() )
-    {
-        QVector<QRect> rects;
-
-        if ( brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode )
-        {
-            rects += canvas->rect();
-        }
-        else
-        {
-            rects = painter->clipRegion().rects();
-        }
-
-#if 1
-        bool useRaster = false;
-
-        if ( painter->paintEngine()->type() == QPaintEngine::X11 )
-        {
-            // Qt 4.7.1: gradients on X11 are broken ( subrects +
-            // QGradient::StretchToDeviceMode ) and horrible slow.
-            // As workaround we have to use the raster paintengine.
-            // Even if the QImage -> QPixmap translation is slow
-            // it is three times faster, than using X11 directly
-
-            useRaster = true;
-        }
-#endif
-        if ( useRaster )
-        {
-            QImage::Format format = QImage::Format_RGB32;
-
-            const QGradientStops stops = brush.gradient()->stops();
-            for ( int i = 0; i < stops.size(); i++ )
-            {
-                if ( stops[i].second.alpha() != 255 )
-                {
-                    // don't use Format_ARGB32_Premultiplied. It's
-                    // recommended by the Qt docs, but QPainter::drawImage()
-                    // is horrible slow on X11.
-
-                    format = QImage::Format_ARGB32;
-                    break;
-                }
-            }
-
-            QImage image( canvas->size(), format );
-
-            QPainter p( &image );
-            p.setPen( Qt::NoPen );
-            p.setBrush( brush );
-
-            p.drawRects( rects );
-
-            p.end();
-
-            painter->drawImage( 0, 0, image );
-        }
-        else
-        {
-            painter->setPen( Qt::NoPen );
-            painter->setBrush( brush );
-
-            painter->drawRects( rects );
-        }
-    }
-    else
-    {
-        painter->setPen( Qt::NoPen );
-        painter->setBrush( brush );
-
-        painter->drawRects( painter->clipRegion().rects() );
-
-    }
-
-    painter->restore();
-}
-
-static inline void qwtRevertPath( QPainterPath &path )
-{
-    if ( path.elementCount() == 4 )
-    {
-        QPainterPath::Element el0 = path.elementAt(0);
-        QPainterPath::Element el3 = path.elementAt(3);
-
-        path.setElementPositionAt( 0, el3.x, el3.y );
-        path.setElementPositionAt( 3, el0.x, el0.y );
-    }
-}
-
-static QPainterPath qwtCombinePathList( const QRectF &rect,
-    const QList<QPainterPath> &pathList )
-{
-    if ( pathList.isEmpty() )
-        return QPainterPath();
-
-    QPainterPath ordered[8]; // starting top left
-
-    for ( int i = 0; i < pathList.size(); i++ )
-    {
-        int index = -1;
-        QPainterPath subPath = pathList[i];
-
-        const QRectF br = pathList[i].controlPointRect();
-        if ( br.center().x() < rect.center().x() )
-        {
-            if ( br.center().y() < rect.center().y() )
-            {
-                if ( qAbs( br.top() - rect.top() ) <
-                    qAbs( br.left() - rect.left() ) )
-                {
-                    index = 1;
-                }
-                else
-                {
-                    index = 0;
-                }
-            }
-            else
-            {
-                if ( qAbs( br.bottom() - rect.bottom() ) <
-                    qAbs( br.left() - rect.left() ) )
-                {
-                    index = 6;
-                }
-                else
-                {
-                    index = 7;
-                }
-            }
-
-            if ( subPath.currentPosition().y() > br.center().y() )
-                qwtRevertPath( subPath );
-        }
-        else
-        {
-            if ( br.center().y() < rect.center().y() )
-            {
-                if ( qAbs( br.top() - rect.top() ) <
-                    qAbs( br.right() - rect.right() ) )
-                {
-                    index = 2;
-                }
-                else
-                {
-                    index = 3;
-                }
-            }
-            else
-            {
-                if ( qAbs( br.bottom() - rect.bottom() ) <
-                    qAbs( br.right() - rect.right() ) )
-                {
-                    index = 5;
-                }
-                else
-                {
-                    index = 4;
-                }
-            }
-            if ( subPath.currentPosition().y() < br.center().y() )
-                qwtRevertPath( subPath );
-        }
-        ordered[index] = subPath;
-    }
-
-    for ( int i = 0; i < 4; i++ )
-    {
-        if ( ordered[ 2 * i].isEmpty() != ordered[2 * i + 1].isEmpty() )
-        {
-            // we don't accept incomplete rounded borders
-            return QPainterPath();
-        }
-    }
-
-
-    const QPolygonF corners( rect );
-
-    QPainterPath path;
-    //path.moveTo( rect.topLeft() );
-
-    for ( int i = 0; i < 4; i++ )
-    {
-        if ( ordered[2 * i].isEmpty() )
-        {
-            path.lineTo( corners[i] );
-        }
-        else
-        {
-            path.connectPath( ordered[2 * i] );
-            path.connectPath( ordered[2 * i + 1] );
-        }
-    }
-
-    path.closeSubpath();
-
-#if 0
-    return path.simplified();
-#else
-    return path;
-#endif
-}
-
-static inline void qwtDrawStyledBackground(
-    QWidget *w, QPainter *painter )
-{
-    QStyleOption opt;
-    opt.initFrom(w);
-    w->style()->drawPrimitive( QStyle::PE_Widget, &opt, painter, w);
-}
-
-static QWidget *qwtBackgroundWidget( QWidget *w )
-{
-    if ( w->parentWidget() == NULL )
-        return w;
-
-    if ( w->autoFillBackground() )
-    {
-        const QBrush brush = w->palette().brush( w->backgroundRole() );
-        if ( brush.color().alpha() > 0 )
-            return w;
-    }
-
-    if ( w->testAttribute( Qt::WA_StyledBackground ) )
-    {
-        QImage image( 1, 1, QImage::Format_ARGB32 );
-        image.fill( Qt::transparent );
-
-        QPainter painter( &image );
-        painter.translate( -w->rect().center() );
-        qwtDrawStyledBackground( w, &painter );
-        painter.end();
-
-        if ( qAlpha( image.pixel( 0, 0 ) ) != 0 )
-            return w;
-    }
-
-    return qwtBackgroundWidget( w->parentWidget() );
-}
-
-static void qwtFillBackground( QPainter *painter,
-    QWidget *widget, const QVector<QRectF> &fillRects )
-{
-    if ( fillRects.isEmpty() )
-        return;
-
-    QRegion clipRegion;
-    if ( painter->hasClipping() )
-        clipRegion = painter->transform().map( painter->clipRegion() );
-    else
-        clipRegion = widget->contentsRect();
-
-    // Try to find out which widget fills
-    // the unfilled areas of the styled background
-
-    QWidget *bgWidget = qwtBackgroundWidget( widget->parentWidget() );
-
-    for ( int i = 0; i < fillRects.size(); i++ )
-    {
-        const QRect rect = fillRects[i].toAlignedRect();
-        if ( clipRegion.intersects( rect ) )
-        {
-            QPixmap pm( rect.size() );
-            QwtPainter::fillPixmap( bgWidget, pm, widget->mapTo( bgWidget, rect.topLeft() ) );
-            painter->drawPixmap( rect, pm );
-        }
-    }
-}
-
-static void qwtFillBackground( QPainter *painter, QwtPlotCanvas *canvas )
-{
-    QVector<QRectF> rects;
-
-    if ( canvas->testAttribute( Qt::WA_StyledBackground ) )
-    {
-        QwtStyleSheetRecorder recorder( canvas->size() );
-
-        QPainter p( &recorder );
-        qwtDrawStyledBackground( canvas, &p );
-        p.end();
-
-        if ( recorder.background.brush.isOpaque() )
-            rects = recorder.clipRects;
-        else
-            rects += canvas->rect();
-    }
-    else
-    {
-        const QRectF r = canvas->rect();
-        const double radius = canvas->borderRadius();
-        if ( radius > 0.0 )
-        {
-            QSizeF sz( radius, radius );
-
-            rects += QRectF( r.topLeft(), sz );
-            rects += QRectF( r.topRight() - QPointF( radius, 0 ), sz );
-            rects += QRectF( r.bottomRight() - QPointF( radius, radius ), sz );
-            rects += QRectF( r.bottomLeft() - QPointF( 0, radius ), sz );
-        }
-    }
-
-    qwtFillBackground( painter, canvas, rects);
-}
-
-
-class QwtPlotCanvas::PrivateData
-{
-public:
-    PrivateData():
-        focusIndicator( NoFocusIndicator ),
-        borderRadius( 0 ),
-        paintAttributes( 0 ),
-        backingStore( NULL )
-    {
-        styleSheet.hasBorder = false;
-    }
-
-    ~PrivateData()
-    {
-        delete backingStore;
-    }
-
-    FocusIndicator focusIndicator;
-    double borderRadius;
-    QwtPlotCanvas::PaintAttributes paintAttributes;
-    QPixmap *backingStore;
-
-    struct StyleSheet
-    {
-        bool hasBorder;
-        QPainterPath borderPath;
-        QVector<QRectF> cornerRects;
-
-        struct StyleSheetBackground
-        {
-            QBrush brush;
-            QPointF origin;
-        } background;
-
-    } styleSheet;
-
-};
-
-/*!
-  \brief Constructor
-
-  \param plot Parent plot widget
-  \sa QwtPlot::setCanvas()
-*/
-QwtPlotCanvas::QwtPlotCanvas( QwtPlot *plot ):
-    QFrame( plot )
-{
-    setFrameStyle( QFrame::Panel | QFrame::Sunken );
-    setLineWidth( 2 );
-
-    d_data = new PrivateData;
-
-#ifndef QT_NO_CURSOR
-    setCursor( Qt::CrossCursor );
-#endif
-
-    setAutoFillBackground( true );
+/*!
+   \brief Constructor
+
+   \param plot Parent plot widget
+   \sa QwtPlot::setCanvas()
+ */
+QwtPlotCanvas::QwtPlotCanvas( QwtPlot* plot )
+    : QFrame( plot )
+    , QwtPlotAbstractCanvas( this )
+{
+    m_data = new PrivateData;
+
     setPaintAttribute( QwtPlotCanvas::BackingStore, true );
     setPaintAttribute( QwtPlotCanvas::Opaque, true );
     setPaintAttribute( QwtPlotCanvas::HackStyledBackground, true );
+
+    setLineWidth( 2 );
+    setFrameShadow( QFrame::Sunken );
+    setFrameShape( QFrame::Panel );
 }
 
@@ -554,36 +57,24 @@
 QwtPlotCanvas::~QwtPlotCanvas()
 {
-    delete d_data;
-}
-
-//! Return parent plot widget
-QwtPlot *QwtPlotCanvas::plot()
-{
-    return qobject_cast<QwtPlot *>( parent() );
-}
-
-//! Return parent plot widget
-const QwtPlot *QwtPlotCanvas::plot() const
-{
-    return qobject_cast<const QwtPlot *>( parent() );
-}
-
-/*!
-  \brief Changing the paint attributes
-
-  \param attribute Paint attribute
-  \param on On/Off
-
-  \sa testPaintAttribute(), backingStore()
-*/
+    delete m_data;
+}
+
+/*!
+   \brief Changing the paint attributes
+
+   \param attribute Paint attribute
+   \param on On/Off
+
+   \sa testPaintAttribute(), backingStore()
+ */
 void QwtPlotCanvas::setPaintAttribute( PaintAttribute attribute, bool on )
 {
-    if ( bool( d_data->paintAttributes & attribute ) == on )
+    if ( bool( m_data->paintAttributes & attribute ) == on )
         return;
 
     if ( on )
-        d_data->paintAttributes |= attribute;
+        m_data->paintAttributes |= attribute;
     else
-        d_data->paintAttributes &= ~attribute;
+        m_data->paintAttributes &= ~attribute;
 
     switch ( attribute )
@@ -593,13 +84,13 @@
             if ( on )
             {
-                if ( d_data->backingStore == NULL )
-                    d_data->backingStore = new QPixmap();
+                if ( m_data->backingStore == NULL )
+                    m_data->backingStore = new QPixmap();
 
                 if ( isVisible() )
                 {
 #if QT_VERSION >= 0x050000
-                    *d_data->backingStore = grab( rect() );
+                    *m_data->backingStore = grab( rect() );
 #else
-                    *d_data->backingStore =
+                    *m_data->backingStore =
                         QPixmap::grabWidget( this, rect() );
 #endif
@@ -608,6 +99,6 @@
             else
             {
-                delete d_data->backingStore;
-                d_data->backingStore = NULL;
+                delete m_data->backingStore;
+                m_data->backingStore = NULL;
             }
             break;
@@ -620,6 +111,5 @@
             break;
         }
-        case HackStyledBackground:
-        case ImmediatePaint:
+        default:
         {
             break;
@@ -629,19 +119,19 @@
 
 /*!
-  Test whether a paint attribute is enabled
-
-  \param attribute Paint attribute
-  \return true, when attribute is enabled
-  \sa setPaintAttribute()
-*/
+   Test whether a paint attribute is enabled
+
+   \param attribute Paint attribute
+   \return true, when attribute is enabled
+   \sa setPaintAttribute()
+ */
 bool QwtPlotCanvas::testPaintAttribute( PaintAttribute attribute ) const
 {
-    return d_data->paintAttributes & attribute;
+    return m_data->paintAttributes & attribute;
 }
 
 //! \return Backing store, might be null
-const QPixmap *QwtPlotCanvas::backingStore() const
-{
-    return d_data->backingStore;
+const QPixmap* QwtPlotCanvas::backingStore() const
+{
+    return m_data->backingStore;
 }
 
@@ -649,55 +139,15 @@
 void QwtPlotCanvas::invalidateBackingStore()
 {
-    if ( d_data->backingStore )
-        *d_data->backingStore = QPixmap();
-}
-
-/*!
-  Set the focus indicator
-
-  \sa FocusIndicator, focusIndicator()
-*/
-void QwtPlotCanvas::setFocusIndicator( FocusIndicator focusIndicator )
-{
-    d_data->focusIndicator = focusIndicator;
-}
-
-/*!
-  \return Focus indicator
-
-  \sa FocusIndicator, setFocusIndicator()
-*/
-QwtPlotCanvas::FocusIndicator QwtPlotCanvas::focusIndicator() const
-{
-    return d_data->focusIndicator;
-}
-
-/*!
-  Set the radius for the corners of the border frame
-
-  \param radius Radius of a rounded corner
-  \sa borderRadius()
-*/
-void QwtPlotCanvas::setBorderRadius( double radius )
-{
-    d_data->borderRadius = qMax( 0.0, radius );
-}
-
-/*!
-  \return Radius for the corners of the border frame
-  \sa setBorderRadius()
-*/
-double QwtPlotCanvas::borderRadius() const
-{
-    return d_data->borderRadius;
-}
-
-/*!
-  Qt event handler for QEvent::PolishRequest and QEvent::StyleChange
-
-  \param event Qt Event
-  \return See QFrame::event()
-*/
-bool QwtPlotCanvas::event( QEvent *event )
+    if ( m_data->backingStore )
+        *m_data->backingStore = QPixmap();
+}
+
+/*!
+   Qt event handler for QEvent::PolishRequest and QEvent::StyleChange
+
+   \param event Qt Event
+   \return See QFrame::event()
+ */
+bool QwtPlotCanvas::event( QEvent* event )
 {
     if ( event->type() == QEvent::PolishRequest )
@@ -723,8 +173,8 @@
 
 /*!
-  Paint event
-  \param event Paint event
-*/
-void QwtPlotCanvas::paintEvent( QPaintEvent *event )
+   Paint event
+   \param event Paint event
+ */
+void QwtPlotCanvas::paintEvent( QPaintEvent* event )
 {
     QPainter painter( this );
@@ -732,15 +182,8 @@
 
     if ( testPaintAttribute( QwtPlotCanvas::BackingStore ) &&
-        d_data->backingStore != NULL )
-    {
-        QPixmap &bs = *d_data->backingStore;
-
-        qreal pixelRatio = 1.0;
-
-#if QT_VERSION >= 0x050000
-        pixelRatio = bs.devicePixelRatio();
-#endif
-
-        if ( bs.size() != size() * pixelRatio )
+        m_data->backingStore != NULL )
+    {
+        QPixmap& bs = *m_data->backingStore;
+        if ( bs.size() != size() * QwtPainter::devicePixelRatio( &bs ) )
         {
             bs = QwtPainter::backingStore( this, size() );
@@ -749,21 +192,19 @@
             {
                 QPainter p( &bs );
-                qwtFillBackground( &p, this );
-                drawCanvas( &p, true );
+                drawStyled( &p, testPaintAttribute( HackStyledBackground ) );
             }
             else
             {
                 QPainter p;
-                if ( d_data->borderRadius <= 0.0 )
+                if ( borderRadius() <= 0.0 )
                 {
                     QwtPainter::fillPixmap( this, bs );
                     p.begin( &bs );
-                    drawCanvas( &p, false );
+                    drawCanvas( &p );
                 }
                 else
                 {
                     p.begin( &bs );
-                    qwtFillBackground( &p, this );
-                    drawCanvas( &p, true );
+                    drawUnstyled( &p );
                 }
 
@@ -773,5 +214,5 @@
         }
 
-        painter.drawPixmap( 0, 0, *d_data->backingStore );
+        painter.drawPixmap( 0, 0, *m_data->backingStore );
     }
     else
@@ -781,10 +222,9 @@
             if ( testAttribute( Qt::WA_OpaquePaintEvent ) )
             {
-                qwtFillBackground( &painter, this );
-                drawCanvas( &painter, true );
+                drawStyled( &painter, testPaintAttribute( HackStyledBackground ) );
             }
             else
             {
-                drawCanvas( &painter, false );
+                drawCanvas( &painter );
             }
         }
@@ -795,6 +235,6 @@
                 if ( autoFillBackground() )
                 {
-                    qwtFillBackground( &painter, this );
-                    qwtDrawBackground( &painter, this );
+                    fillBackground( &painter );
+                    drawBackground( &painter );
                 }
             }
@@ -810,6 +250,6 @@
 
                     painter.setClipPath( clipPath, Qt::IntersectClip );
-                    qwtFillBackground( &painter, this );
-                    qwtDrawBackground( &painter, this );
+                    fillBackground( &painter );
+                    drawBackground( &painter );
 
                     painter.restore();
@@ -817,5 +257,5 @@
             }
 
-            drawCanvas( &painter, false );
+            drawCanvas( &painter );
 
             if ( frameWidth() > 0 )
@@ -828,178 +268,26 @@
 }
 
-void QwtPlotCanvas::drawCanvas( QPainter *painter, bool withBackground )
-{
-    bool hackStyledBackground = false;
-
-    if ( withBackground && testAttribute( Qt::WA_StyledBackground )
-        && testPaintAttribute( HackStyledBackground ) )
-    {
-        // Antialiasing rounded borders is done by
-        // inserting pixels with colors between the
-        // border color and the color on the canvas,
-        // When the border is painted before the plot items
-        // these colors are interpolated for the canvas
-        // and the plot items need to be clipped excluding
-        // the anialiased pixels. In situations, where
-        // the plot items fill the area at the rounded
-        // borders this is noticeable.
-        // The only way to avoid these annoying "artefacts"
-        // is to paint the border on top of the plot items.
-
-        if ( d_data->styleSheet.hasBorder &&
-            !d_data->styleSheet.borderPath.isEmpty() )
-        {
-            // We have a border with at least one rounded corner
-            hackStyledBackground = true;
-        }
-    }
-
-    if ( withBackground )
-    {
-        painter->save();
-
-        if ( testAttribute( Qt::WA_StyledBackground ) )
-        {
-            if ( hackStyledBackground )
-            {
-                // paint background without border
-
-                painter->setPen( Qt::NoPen );
-                painter->setBrush( d_data->styleSheet.background.brush );
-                painter->setBrushOrigin( d_data->styleSheet.background.origin );
-                painter->setClipPath( d_data->styleSheet.borderPath );
-                painter->drawRect( contentsRect() );
-            }
-            else
-            {
-                qwtDrawStyledBackground( this, painter );
-            }
-        }
-        else if ( autoFillBackground() )
-        {
-            painter->setPen( Qt::NoPen );
-            painter->setBrush( palette().brush( backgroundRole() ) );
-
-            if ( d_data->borderRadius > 0.0 && ( rect() == frameRect() ) )
-            {
-                if ( frameWidth() > 0 )
-                {
-                    painter->setClipPath( borderPath( rect() ) );
-                    painter->drawRect( rect() );
-                }
-                else
-                {
-                    painter->setRenderHint( QPainter::Antialiasing, true );
-                    painter->drawPath( borderPath( rect() ) );
-                }
-            }
-            else
-            {
-                painter->drawRect( rect() );
-            }
-        }
-
-        painter->restore();
-    }
-
-    painter->save();
-
-    if ( !d_data->styleSheet.borderPath.isEmpty() )
-    {
-        painter->setClipPath(
-            d_data->styleSheet.borderPath, Qt::IntersectClip );
-    }
-    else
-    {
-        if ( d_data->borderRadius > 0.0 )
-            painter->setClipPath( borderPath( frameRect() ), Qt::IntersectClip );
-        else
-            painter->setClipRect( contentsRect(), Qt::IntersectClip );
-    }
-
-    plot()->drawCanvas( painter );
-
-    painter->restore();
-
-    if ( withBackground && hackStyledBackground )
-    {
-        // Now paint the border on top
-        QStyleOptionFrame opt;
-        opt.initFrom(this);
-        style()->drawPrimitive( QStyle::PE_Frame, &opt, painter, this);
-    }
-}
-
-/*!
-  Draw the border of the plot canvas
-
-  \param painter Painter
-  \sa setBorderRadius()
-*/
-void QwtPlotCanvas::drawBorder( QPainter *painter )
-{
-    if ( d_data->borderRadius > 0 )
-    {
-        if ( frameWidth() > 0 )
-        {
-            QwtPainter::drawRoundedFrame( painter, QRectF( frameRect() ),
-                d_data->borderRadius, d_data->borderRadius,
-                palette(), frameWidth(), frameStyle() );
-        }
-    }
-    else
-    {
-#if QT_VERSION >= 0x040500
-#if QT_VERSION < 0x050000
-        QStyleOptionFrameV3 opt;
-#else
-        QStyleOptionFrame opt;
-#endif
-        opt.init(this);
-
-        int frameShape  = frameStyle() & QFrame::Shape_Mask;
-        int frameShadow = frameStyle() & QFrame::Shadow_Mask;
-
-        opt.frameShape = QFrame::Shape( int( opt.frameShape ) | frameShape );
-#if 0
-        opt.rect = frameRect();
-#endif
-
-        switch (frameShape)
-        {
-            case QFrame::Box:
-            case QFrame::HLine:
-            case QFrame::VLine:
-            case QFrame::StyledPanel:
-            case QFrame::Panel:
-            {
-                opt.lineWidth = lineWidth();
-                opt.midLineWidth = midLineWidth();
-                break;
-            }
-            default:
-            {
-                opt.lineWidth = frameWidth();
-                break;
-            }
-        }
-
-        if ( frameShadow == Sunken )
-            opt.state |= QStyle::State_Sunken;
-        else if ( frameShadow == Raised )
-            opt.state |= QStyle::State_Raised;
-
-        style()->drawControl(QStyle::CE_ShapedFrame, &opt, painter, this);
-#else
+/*!
+   Draw the border of the plot canvas
+
+   \param painter Painter
+   \sa setBorderRadius()
+ */
+void QwtPlotCanvas::drawBorder( QPainter* painter )
+{
+    if ( borderRadius() <= 0 )
+    {
         drawFrame( painter );
-#endif
-    }
-}
-
-/*!
-  Resize event
-  \param event Resize event
-*/
-void QwtPlotCanvas::resizeEvent( QResizeEvent *event )
+        return;
+    }
+
+    QwtPlotAbstractCanvas::drawBorder( painter );
+}
+
+/*!
+   Resize event
+   \param event Resize event
+ */
+void QwtPlotCanvas::resizeEvent( QResizeEvent* event )
 {
     QFrame::resizeEvent( event );
@@ -1008,22 +296,7 @@
 
 /*!
-  Draw the focus indication
-  \param painter Painter
-*/
-void QwtPlotCanvas::drawFocusIndicator( QPainter *painter )
-{
-    const int margin = 1;
-
-    QRect focusRect = contentsRect();
-    focusRect.setRect( focusRect.x() + margin, focusRect.y() + margin,
-        focusRect.width() - 2 * margin, focusRect.height() - 2 * margin );
-
-    QwtPainter::drawFocusRect( painter, this, focusRect );
-}
-
-/*!
    Invalidate the paint cache and repaint the canvas
    \sa invalidatePaintCache()
-*/
+ */
 void QwtPlotCanvas::replot()
 {
@@ -1036,39 +309,4 @@
 }
 
-//! Update the cached information about the current style sheet
-void QwtPlotCanvas::updateStyleSheetInfo()
-{
-    if ( !testAttribute(Qt::WA_StyledBackground ) )
-        return;
-
-    QwtStyleSheetRecorder recorder( size() );
-
-    QPainter painter( &recorder );
-
-    QStyleOption opt;
-    opt.initFrom(this);
-    style()->drawPrimitive( QStyle::PE_Widget, &opt, &painter, this);
-
-    painter.end();
-
-    d_data->styleSheet.hasBorder = !recorder.border.rectList.isEmpty();
-    d_data->styleSheet.cornerRects = recorder.clipRects;
-
-    if ( recorder.background.path.isEmpty() )
-    {
-        if ( !recorder.border.rectList.isEmpty() )
-        {
-            d_data->styleSheet.borderPath =
-                qwtCombinePathList( rect(), recorder.border.pathList );
-        }
-    }
-    else
-    {
-        d_data->styleSheet.borderPath = recorder.background.path;
-        d_data->styleSheet.background.brush = recorder.background.brush;
-        d_data->styleSheet.background.origin = recorder.background.origin;
-    }
-}
-
 /*!
    Calculate the painter path for a styled or rounded border
@@ -1079,36 +317,9 @@
    \param rect Bounding rectangle of the canvas
    \return Painter path, that can be used for clipping
-*/
-QPainterPath QwtPlotCanvas::borderPath( const QRect &rect ) const
-{
-    if ( testAttribute(Qt::WA_StyledBackground ) )
-    {
-        QwtStyleSheetRecorder recorder( rect.size() );
-
-        QPainter painter( &recorder );
-
-        QStyleOption opt;
-        opt.initFrom(this);
-        opt.rect = rect;
-        style()->drawPrimitive( QStyle::PE_Widget, &opt, &painter, this);
-
-        painter.end();
-
-        if ( !recorder.background.path.isEmpty() )
-            return recorder.background.path;
-
-        if ( !recorder.border.rectList.isEmpty() )
-            return qwtCombinePathList( rect, recorder.border.pathList );
-    }
-    else if ( d_data->borderRadius > 0.0 )
-    {
-        double fw2 = frameWidth() * 0.5;
-        QRectF r = QRectF(rect).adjusted( fw2, fw2, -fw2, -fw2 );
-
-        QPainterPath path;
-        path.addRoundedRect( r, d_data->borderRadius, d_data->borderRadius );
-        return path;
-    }
-
-    return QPainterPath();
-}
+ */
+QPainterPath QwtPlotCanvas::borderPath( const QRect& rect ) const
+{
+    return canvasBorderPath( rect );
+}
+
+#include "moc_qwt_plot_canvas.cpp"
Index: /trunk/BNC/qwt/qwt_plot_canvas.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_canvas.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_canvas.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,18 +12,20 @@
 
 #include "qwt_global.h"
+#include "qwt_plot_abstract_canvas.h"
+
 #include <qframe.h>
-#include <qpainterpath.h>
 
 class QwtPlot;
 class QPixmap;
+class QPainterPath;
 
 /*!
-  \brief Canvas of a QwtPlot.
+   \brief Canvas of a QwtPlot.
 
    Canvas is the widget where all plot items are displayed
 
-  \sa QwtPlot::setCanvas(), QwtPlotGLCanvas
-*/
-class QWT_EXPORT QwtPlotCanvas : public QFrame
+   \sa QwtPlot::setCanvas(), QwtPlotGLCanvas, QwtPlotOpenGLCanvas
+ */
+class QWT_EXPORT QwtPlotCanvas : public QFrame, public QwtPlotAbstractCanvas
 {
     Q_OBJECT
@@ -31,138 +33,98 @@
     Q_PROPERTY( double borderRadius READ borderRadius WRITE setBorderRadius )
 
-public:
+  public:
 
     /*!
-      \brief Paint attributes
+       \brief Paint attributes
 
-      The default setting enables BackingStore and Opaque.
+       The default setting enables BackingStore and Opaque.
 
-      \sa setPaintAttribute(), testPaintAttribute()
+       \sa setPaintAttribute(), testPaintAttribute()
      */
     enum PaintAttribute
     {
         /*!
-          \brief Paint double buffered reusing the content
+           \brief Paint double buffered reusing the content
                  of the pixmap buffer when possible.
 
-          Using a backing store might improve the performance
-          significantly, when working with widget overlays ( like rubber bands ).
-          Disabling the cache might improve the performance for
-          incremental paints (using QwtPlotDirectPainter ).
+           Using a backing store might improve the performance
+           significantly, when working with widget overlays ( like rubber bands ).
+           Disabling the cache might improve the performance for
+           incremental paints (using QwtPlotDirectPainter ).
 
-          \sa backingStore(), invalidateBackingStore()
+           \sa backingStore(), invalidateBackingStore()
          */
         BackingStore = 1,
 
         /*!
-          \brief Try to fill the complete contents rectangle
+           \brief Try to fill the complete contents rectangle
                  of the plot canvas
 
-          When using styled backgrounds Qt assumes, that the
-          canvas doesn't fill its area completely
-          ( f.e because of rounded borders ) and fills the area
-          below the canvas. When this is done with gradients it might
-          result in a serious performance bottleneck - depending on the size.
+           When using styled backgrounds Qt assumes, that the
+           canvas doesn't fill its area completely
+           ( f.e because of rounded borders ) and fills the area
+           below the canvas. When this is done with gradients it might
+           result in a serious performance bottleneck - depending on the size.
 
-          When the Opaque attribute is enabled the canvas tries to
-          identify the gaps with some heuristics and to fill those only.
+           When the Opaque attribute is enabled the canvas tries to
+           identify the gaps with some heuristics and to fill those only.
 
-          \warning Will not work for semitransparent backgrounds
+           \warning Will not work for semitransparent backgrounds
          */
         Opaque       = 2,
 
         /*!
-          \brief Try to improve painting of styled backgrounds
+           \brief Try to improve painting of styled backgrounds
 
-          QwtPlotCanvas supports the box model attributes for
-          customizing the layout with style sheets. Unfortunately
-          the design of Qt style sheets has no concept how to
-          handle backgrounds with rounded corners - beside of padding.
+           QwtPlotCanvas supports the box model attributes for
+           customizing the layout with style sheets. Unfortunately
+           the design of Qt style sheets has no concept how to
+           handle backgrounds with rounded corners - beside of padding.
 
-          When HackStyledBackground is enabled the plot canvas tries
-          to separate the background from the background border
-          by reverse engineering to paint the background before and
-          the border after the plot items. In this order the border
-          gets perfectly antialiased and you can avoid some pixel
-          artifacts in the corners.
+           When HackStyledBackground is enabled the plot canvas tries
+           to separate the background from the background border
+           by reverse engineering to paint the background before and
+           the border after the plot items. In this order the border
+           gets perfectly antialiased and you can avoid some pixel
+           artifacts in the corners.
          */
         HackStyledBackground = 4,
 
         /*!
-          When ImmediatePaint is set replot() calls repaint()
-          instead of update().
+           When ImmediatePaint is set replot() calls repaint()
+           instead of update().
 
-          \sa replot(), QWidget::repaint(), QWidget::update()
+           \sa replot(), QWidget::repaint(), QWidget::update()
          */
         ImmediatePaint = 8
     };
 
-    //! Paint attributes
-    typedef QFlags<PaintAttribute> PaintAttributes;
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
 
-    /*!
-      \brief Focus indicator
-      The default setting is NoFocusIndicator
-      \sa setFocusIndicator(), focusIndicator(), drawFocusIndicator()
-    */
-
-    enum FocusIndicator
-    {
-        //! Don't paint a focus indicator
-        NoFocusIndicator,
-
-        /*!
-          The focus is related to the complete canvas.
-          Paint the focus indicator using drawFocusIndicator()
-         */
-        CanvasFocusIndicator,
-
-        /*!
-          The focus is related to an item (curve, point, ...) on
-          the canvas. It is up to the application to display a
-          focus indication using f.e. highlighting.
-         */
-        ItemFocusIndicator
-    };
-
-    explicit QwtPlotCanvas( QwtPlot * = NULL );
+    explicit QwtPlotCanvas( QwtPlot* = NULL );
     virtual ~QwtPlotCanvas();
-
-    QwtPlot *plot();
-    const QwtPlot *plot() const;
-
-    void setFocusIndicator( FocusIndicator );
-    FocusIndicator focusIndicator() const;
-
-    void setBorderRadius( double );
-    double borderRadius() const;
 
     void setPaintAttribute( PaintAttribute, bool on = true );
     bool testPaintAttribute( PaintAttribute ) const;
 
-    const QPixmap *backingStore() const;
-    void invalidateBackingStore();
+    const QPixmap* backingStore() const;
+    Q_INVOKABLE void invalidateBackingStore();
 
-    virtual bool event( QEvent * );
+    virtual bool event( QEvent* ) QWT_OVERRIDE;
 
-    Q_INVOKABLE QPainterPath borderPath( const QRect & ) const;
+    Q_INVOKABLE QPainterPath borderPath( const QRect& ) const;
 
-public Q_SLOTS:
+  public Q_SLOTS:
     void replot();
 
-protected:
-    virtual void paintEvent( QPaintEvent * );
-    virtual void resizeEvent( QResizeEvent * );
+  protected:
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
+    virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
 
-    virtual void drawFocusIndicator( QPainter * );
-    virtual void drawBorder( QPainter * );
+    virtual void drawBorder( QPainter* ) QWT_OVERRIDE;
 
-    void updateStyleSheetInfo();
-
-private:
-    void drawCanvas( QPainter *, bool withBackground );
-
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_curve.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_curve.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_curve.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -15,13 +15,26 @@
 #include "qwt_scale_map.h"
 #include "qwt_plot.h"
-#include "qwt_curve_fitter.h"
+#include "qwt_spline_curve_fitter.h"
 #include "qwt_symbol.h"
 #include "qwt_point_mapper.h"
+#include "qwt_text.h"
+#include "qwt_graphic.h"
+
 #include <qpainter.h>
-#include <qpixmap.h>
-#include <qalgorithms.h>
-#include <qmath.h>
-
-static void qwtUpdateLegendIconSize( QwtPlotCurve *curve )
+#include <qpainterpath.h>
+#include <qnumeric.h>
+
+#include <climits>
+
+static inline QRectF qwtIntersectedClipRect( const QRectF& rect, QPainter* painter )
+{
+    QRectF clipRect = rect;
+    if ( painter->hasClipping() )
+        clipRect &= painter->clipBoundingRect();
+
+    return clipRect;
+}
+
+static void qwtUpdateLegendIconSize( QwtPlotCurve* curve )
 {
     if ( curve->symbol() &&
@@ -35,5 +48,5 @@
             // Avoid, that the line is completely covered by the symbol
 
-            int w = qCeil( 1.5 * sz.width() );
+            int w = qwtCeil( 1.5 * sz.width() );
             if ( w % 2 )
                 w++;
@@ -46,5 +59,5 @@
 }
 
-static int qwtVerifyRange( int size, int &i1, int &i2 )
+static int qwtVerifyRange( int size, int& i1, int& i2 )
 {
     if ( size < 1 )
@@ -62,15 +75,12 @@
 class QwtPlotCurve::PrivateData
 {
-public:
-    PrivateData():
-        style( QwtPlotCurve::Lines ),
-        baseline( 0.0 ),
-        symbol( NULL ),
-        attributes( 0 ),
-        paintAttributes(
-            QwtPlotCurve::ClipPolygons | QwtPlotCurve::FilterPoints ),
-        legendAttributes( 0 )
-    {
-        pen = QPen( Qt::black );
+  public:
+    PrivateData()
+        : style( QwtPlotCurve::Lines )
+        , baseline( 0.0 )
+        , symbol( NULL )
+        , pen( Qt::black )
+        , paintAttributes( QwtPlotCurve::ClipPolygons | QwtPlotCurve::FilterPoints )
+    {
         curveFitter = new QwtSplineCurveFitter;
     }
@@ -85,6 +95,6 @@
     double baseline;
 
-    const QwtSymbol *symbol;
-    QwtCurveFitter *curveFitter;
+    const QwtSymbol* symbol;
+    QwtCurveFitter* curveFitter;
 
     QPen pen;
@@ -98,9 +108,9 @@
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotCurve::QwtPlotCurve( const QwtText &title ):
-    QwtPlotSeriesItem( title )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotCurve::QwtPlotCurve( const QwtText& title )
+    : QwtPlotSeriesItem( title )
 {
     init();
@@ -108,9 +118,9 @@
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotCurve::QwtPlotCurve( const QString &title ):
-    QwtPlotSeriesItem( QwtText( title ) )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotCurve::QwtPlotCurve( const QString& title )
+    : QwtPlotSeriesItem( QwtText( title ) )
 {
     init();
@@ -120,5 +130,5 @@
 QwtPlotCurve::~QwtPlotCurve()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -129,5 +139,5 @@
     setItemAttribute( QwtPlotItem::AutoScale );
 
-    d_data = new PrivateData;
+    m_data = new PrivateData;
     setData( new QwtPointSeriesData() );
 
@@ -142,16 +152,16 @@
 
 /*!
-  Specify an attribute how to draw the curve
-
-  \param attribute Paint attribute
-  \param on On/Off
-  \sa testPaintAttribute()
-*/
+   Specify an attribute how to draw the curve
+
+   \param attribute Paint attribute
+   \param on On/Off
+   \sa testPaintAttribute()
+ */
 void QwtPlotCurve::setPaintAttribute( PaintAttribute attribute, bool on )
 {
     if ( on )
-        d_data->paintAttributes |= attribute;
+        m_data->paintAttributes |= attribute;
     else
-        d_data->paintAttributes &= ~attribute;
+        m_data->paintAttributes &= ~attribute;
 }
 
@@ -159,17 +169,17 @@
     \return True, when attribute is enabled
     \sa setPaintAttribute()
-*/
+ */
 bool QwtPlotCurve::testPaintAttribute( PaintAttribute attribute ) const
 {
-    return ( d_data->paintAttributes & attribute );
-}
-
-/*!
-  Specify an attribute how to draw the legend icon
-
-  \param attribute Attribute
-  \param on On/Off
-  /sa testLegendAttribute(). legendIcon()
-*/
+    return ( m_data->paintAttributes & attribute );
+}
+
+/*!
+   Specify an attribute how to draw the legend icon
+
+   \param attribute Attribute
+   \param on On/Off
+   /sa testLegendAttribute(). legendIcon()
+ */
 void QwtPlotCurve::setLegendAttribute( LegendAttribute attribute, bool on )
 {
@@ -177,7 +187,7 @@
     {
         if ( on )
-            d_data->legendAttributes |= attribute;
+            m_data->legendAttributes |= attribute;
         else
-            d_data->legendAttributes &= ~attribute;
+            m_data->legendAttributes &= ~attribute;
 
         qwtUpdateLegendIconSize( this );
@@ -187,23 +197,49 @@
 
 /*!
-  \return True, when attribute is enabled
-  \sa setLegendAttribute()
-*/
+   \return True, when attribute is enabled
+   \sa setLegendAttribute()
+ */
 bool QwtPlotCurve::testLegendAttribute( LegendAttribute attribute ) const
 {
-    return ( d_data->legendAttributes & attribute );
-}
-
-/*!
-  Set the curve's drawing style
-
-  \param style Curve style
-  \sa style()
-*/
+    return ( m_data->legendAttributes & attribute );
+}
+
+/*!
+   Specify the attributes how to draw the legend icon
+
+   \param attributes Attributes
+   /sa setLegendAttribute(). legendIcon()
+ */
+void QwtPlotCurve::setLegendAttributes( LegendAttributes attributes )
+{
+    if ( attributes != m_data->legendAttributes )
+    {
+        m_data->legendAttributes = attributes;
+
+        qwtUpdateLegendIconSize( this );
+        legendChanged();
+    }
+}
+
+/*!
+   \return Attributes how to draw the legend icon
+   \sa setLegendAttributes(), testLegendAttribute()
+ */
+QwtPlotCurve::LegendAttributes QwtPlotCurve::legendAttributes() const
+{
+    return m_data->legendAttributes;
+}
+
+/*!
+   Set the curve's drawing style
+
+   \param style Curve style
+   \sa style()
+ */
 void QwtPlotCurve::setStyle( CurveStyle style )
 {
-    if ( style != d_data->style )
-    {
-        d_data->style = style;
+    if ( style != m_data->style )
+    {
+        m_data->style = style;
 
         legendChanged();
@@ -213,28 +249,28 @@
 
 /*!
-  \return Style of the curve
-  \sa setStyle()
-*/
+   \return Style of the curve
+   \sa setStyle()
+ */
 QwtPlotCurve::CurveStyle QwtPlotCurve::style() const
 {
-    return d_data->style;
-}
-
-/*!
-  \brief Assign a symbol
-
-  The curve will take the ownership of the symbol, hence the previously
-  set symbol will be delete by setting a new one. If \p symbol is
-  \c NULL no symbol will be drawn.
-
-  \param symbol Symbol
-  \sa symbol()
-*/
-void QwtPlotCurve::setSymbol( QwtSymbol *symbol )
-{
-    if ( symbol != d_data->symbol )
-    {
-        delete d_data->symbol;
-        d_data->symbol = symbol;
+    return m_data->style;
+}
+
+/*!
+   \brief Assign a symbol
+
+   The curve will take the ownership of the symbol, hence the previously
+   set symbol will be delete by setting a new one. If \p symbol is
+   \c NULL no symbol will be drawn.
+
+   \param symbol Symbol
+   \sa symbol()
+ */
+void QwtPlotCurve::setSymbol( QwtSymbol* symbol )
+{
+    if ( symbol != m_data->symbol )
+    {
+        delete m_data->symbol;
+        m_data->symbol = symbol;
 
         qwtUpdateLegendIconSize( this );
@@ -246,26 +282,26 @@
 
 /*!
-  \return Current symbol or NULL, when no symbol has been assigned
-  \sa setSymbol()
-*/
-const QwtSymbol *QwtPlotCurve::symbol() const
-{
-    return d_data->symbol;
-}
-
-/*!
-  Build and assign a pen
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtPlotCurve::setPen( const QColor &color, qreal width, Qt::PenStyle style )
+   \return Current symbol or NULL, when no symbol has been assigned
+   \sa setSymbol()
+ */
+const QwtSymbol* QwtPlotCurve::symbol() const
+{
+    return m_data->symbol;
+}
+
+/*!
+   Build and assign a pen
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtPlotCurve::setPen( const QColor& color, qreal width, Qt::PenStyle style )
 {
     setPen( QPen( color, width, style ) );
@@ -273,14 +309,14 @@
 
 /*!
-  Assign a pen
-
-  \param pen New pen
-  \sa pen(), brush()
-*/
-void QwtPlotCurve::setPen( const QPen &pen )
-{
-    if ( pen != d_data->pen )
-    {
-        d_data->pen = pen;
+   Assign a pen
+
+   \param pen New pen
+   \sa pen(), brush()
+ */
+void QwtPlotCurve::setPen( const QPen& pen )
+{
+    if ( pen != m_data->pen )
+    {
+        m_data->pen = pen;
 
         legendChanged();
@@ -290,14 +326,14 @@
 
 /*!
-  \return Pen used to draw the lines
-  \sa setPen(), brush()
-*/
+   \return Pen used to draw the lines
+   \sa setPen(), brush()
+ */
 const QPen& QwtPlotCurve::pen() const
 {
-    return d_data->pen;
-}
-
-/*!
-  \brief Assign a brush.
+    return m_data->pen;
+}
+
+/*!
+   \brief Assign a brush.
 
    In case of brush.style() != QBrush::NoBrush
@@ -310,12 +346,12 @@
    (ascending or descending).
 
-  \param brush New brush
-  \sa brush(), setBaseline(), baseline()
-*/
-void QwtPlotCurve::setBrush( const QBrush &brush )
-{
-    if ( brush != d_data->brush )
-    {
-        d_data->brush = brush;
+   \param brush New brush
+   \sa brush(), setBaseline(), baseline()
+ */
+void QwtPlotCurve::setBrush( const QBrush& brush )
+{
+    if ( brush != m_data->brush )
+    {
+        m_data->brush = brush;
 
         legendChanged();
@@ -325,28 +361,28 @@
 
 /*!
-  \return Brush used to fill the area between lines and the baseline
-  \sa setBrush(), setBaseline(), baseline()
-*/
+   \return Brush used to fill the area between lines and the baseline
+   \sa setBrush(), setBaseline(), baseline()
+ */
 const QBrush& QwtPlotCurve::brush() const
 {
-    return d_data->brush;
-}
-
-/*!
-  Draw an interval of the curve
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted. If to < 0 the
+    return m_data->brush;
+}
+
+/*!
+   Draw an interval of the curve
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted. If to < 0 the
          curve will be painted to its last point.
 
-  \sa drawCurve(), drawSymbols(),
-*/
-void QwtPlotCurve::drawSeries( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   \sa drawCurve(), drawSymbols(),
+ */
+void QwtPlotCurve::drawSeries( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     const size_t numSamples = dataSize();
@@ -361,20 +397,20 @@
     {
         painter->save();
-        painter->setPen( d_data->pen );
+        painter->setPen( m_data->pen );
 
         /*
-          Qt 4.0.0 is slow when drawing lines, but it's even
-          slower when the painter has a brush. So we don't
-          set the brush before we really need it.
+           Qt 4.0.0 is slow when drawing lines, but it's even
+           slower when the painter has a brush. So we don't
+           set the brush before we really need it.
          */
 
-        drawCurve( painter, d_data->style, xMap, yMap, canvasRect, from, to );
+        drawCurve( painter, m_data->style, xMap, yMap, canvasRect, from, to );
         painter->restore();
 
-        if ( d_data->symbol &&
-            ( d_data->symbol->style() != QwtSymbol::NoSymbol ) )
+        if ( m_data->symbol &&
+            ( m_data->symbol->style() != QwtSymbol::NoSymbol ) )
         {
             painter->save();
-            drawSymbols( painter, *d_data->symbol,
+            drawSymbols( painter, *m_data->symbol,
                 xMap, yMap, canvasRect, from, to );
             painter->restore();
@@ -384,17 +420,17 @@
 
 /*!
-  \brief Draw the line part (without symbols) of a curve interval.
-  \param painter Painter
-  \param style curve style, see QwtPlotCurve::CurveStyle
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from index of the first point to be painted
-  \param to index of the last point to be painted
-  \sa draw(), drawDots(), drawLines(), drawSteps(), drawSticks()
-*/
-void QwtPlotCurve::drawCurve( QPainter *painter, int style,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   \brief Draw the line part (without symbols) of a curve interval.
+   \param painter Painter
+   \param style curve style, see QwtPlotCurve::CurveStyle
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted
+   \sa draw(), drawDots(), drawLines(), drawSteps(), drawSticks()
+ */
+void QwtPlotCurve::drawCurve( QPainter* painter, int style,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     switch ( style )
@@ -426,116 +462,111 @@
 
 /*!
-  \brief Draw lines
-
-  If the CurveAttribute Fitted is enabled a QwtCurveFitter tries
-  to interpolate/smooth the curve, before it is painted.
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from index of the first point to be painted
-  \param to index of the last point to be painted
-
-  \sa setCurveAttribute(), setCurveFitter(), draw(),
+   \brief Draw lines
+
+   If the CurveAttribute Fitted is enabled a QwtCurveFitter tries
+   to interpolate/smooth the curve, before it is painted.
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted
+
+   \sa setCurveAttribute(), setCurveFitter(), draw(),
       drawLines(), drawDots(), drawSteps(), drawSticks()
-*/
-void QwtPlotCurve::drawLines( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+ */
+void QwtPlotCurve::drawLines( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     if ( from > to )
         return;
 
-    const bool doAlign = QwtPainter::roundingAlignment( painter );
-    const bool doFit = ( d_data->attributes & Fitted ) && d_data->curveFitter;
-    const bool doFill = ( d_data->brush.style() != Qt::NoBrush )
-            && ( d_data->brush.color().alpha() > 0 );
+    const bool doFit = ( m_data->attributes & Fitted ) && m_data->curveFitter;
+    const bool doAlign = !doFit && QwtPainter::roundingAlignment( painter );
+    const bool doFill = ( m_data->brush.style() != Qt::NoBrush )
+        && ( m_data->brush.color().alpha() > 0 );
 
     QRectF clipRect;
-    if ( d_data->paintAttributes & ClipPolygons )
-    {
-        qreal pw = qMax( qreal( 1.0 ), painter->pen().widthF());
-        clipRect = canvasRect.adjusted(-pw, -pw, pw, pw);
-    }
-
-    bool doIntegers = false;
-
-#if QT_VERSION < 0x040800
-
-    // For Qt <= 4.7 the raster paint engine is significantly faster
-    // for rendering QPolygon than for QPolygonF. So let's
-    // see if we can use it.
-
-    if ( painter->paintEngine()->type() == QPaintEngine::Raster )
-    {
-        // In case of filling or fitting performance doesn't count
-        // because both operations are much more expensive
-        // then drawing the polyline itself
-
-        if ( !doFit && !doFill )
-            doIntegers = true;
-    }
-#endif
-
-    const bool noDuplicates = d_data->paintAttributes & FilterPoints;
+    if ( m_data->paintAttributes & ClipPolygons )
+    {
+        clipRect = qwtIntersectedClipRect( canvasRect, painter );
+
+        const qreal pw = QwtPainter::effectivePenWidth( painter->pen() );
+        clipRect = clipRect.adjusted(-pw, -pw, pw, pw);
+    }
 
     QwtPointMapper mapper;
-    mapper.setFlag( QwtPointMapper::RoundPoints, doAlign );
-    mapper.setFlag( QwtPointMapper::WeedOutPoints, noDuplicates );
+
+    if ( doAlign )
+    {
+        mapper.setFlag( QwtPointMapper::RoundPoints, true );
+        mapper.setFlag( QwtPointMapper::WeedOutIntermediatePoints,
+            testPaintAttribute( FilterPointsAggressive ) );
+    }
+
+    mapper.setFlag( QwtPointMapper::WeedOutPoints,
+        testPaintAttribute( FilterPoints ) ||
+        testPaintAttribute( FilterPointsAggressive ) );
+
     mapper.setBoundingRect( canvasRect );
 
-    if ( doIntegers )
-    {
-        QPolygon polyline = mapper.toPolygon(
-            xMap, yMap, data(), from, to );
-
-        if ( d_data->paintAttributes & ClipPolygons )
-        {
-            polyline = QwtClipper::clipPolygon(
-                clipRect.toAlignedRect(), polyline, false );
-        }
-
-        QwtPainter::drawPolyline( painter, polyline );
+    QPolygonF polyline = mapper.toPolygonF( xMap, yMap, data(), from, to );
+
+    if ( doFill )
+    {
+        if ( doFit )
+        {
+            // it might be better to extend and draw the curvePath, but for
+            // the moment we keep an implementation, where we translate the
+            // path back to a polyline.
+
+            polyline = m_data->curveFitter->fitCurve( polyline );
+        }
+
+        if ( painter->pen().style() != Qt::NoPen )
+        {
+            // here we are wasting memory for the filled copy,
+            // do polygon clipping twice etc .. TODO
+
+            QPolygonF filled = polyline;
+            fillCurve( painter, xMap, yMap, canvasRect, filled );
+            filled.clear();
+
+            if ( m_data->paintAttributes & ClipPolygons )
+                QwtClipper::clipPolygonF( clipRect, polyline, false );
+
+            QwtPainter::drawPolyline( painter, polyline );
+        }
+        else
+        {
+            fillCurve( painter, xMap, yMap, canvasRect, polyline );
+        }
     }
     else
     {
-        QPolygonF polyline = mapper.toPolygonF( xMap, yMap, data(), from, to );
+        if ( testPaintAttribute( ClipPolygons ) )
+        {
+            QwtClipper::clipPolygonF( clipRect, polyline, false );
+        }
 
         if ( doFit )
-            polyline = d_data->curveFitter->fitCurve( polyline );
-
-        if ( doFill )
-        {
-            if ( painter->pen().style() != Qt::NoPen )
+        {
+            if ( m_data->curveFitter->mode() == QwtCurveFitter::Path )
             {
-                // here we are wasting memory for the filled copy,
-                // do polygon clipping twice etc .. TODO
-
-                QPolygonF filled = polyline;
-                fillCurve( painter, xMap, yMap, canvasRect, filled );
-                filled.clear();
-
-                if ( d_data->paintAttributes & ClipPolygons )
-                {
-                    polyline = QwtClipper::clipPolygonF(
-                        clipRect, polyline, false );
-                }
-
-                QwtPainter::drawPolyline( painter, polyline );
+                const QPainterPath curvePath =
+                    m_data->curveFitter->fitCurvePath( polyline );
+
+                painter->drawPath( curvePath );
             }
             else
             {
-                fillCurve( painter, xMap, yMap, canvasRect, polyline );
+                polyline = m_data->curveFitter->fitCurve( polyline );
+                QwtPainter::drawPolyline( painter, polyline );
             }
         }
         else
         {
-            if ( d_data->paintAttributes & ClipPolygons )
-            {
-                polyline = QwtClipper::clipPolygonF(
-                    clipRect, polyline, false );
-            }
-
             QwtPainter::drawPolyline( painter, polyline );
         }
@@ -544,18 +575,18 @@
 
 /*!
-  Draw sticks
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from index of the first point to be painted
-  \param to index of the last point to be painted
-
-  \sa draw(), drawCurve(), drawDots(), drawLines(), drawSteps()
-*/
-void QwtPlotCurve::drawSticks( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   Draw sticks
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted
+
+   \sa draw(), drawCurve(), drawDots(), drawLines(), drawSteps()
+ */
+void QwtPlotCurve::drawSticks( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     Q_UNUSED( canvasRect )
@@ -566,6 +597,6 @@
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
-    double x0 = xMap.transform( d_data->baseline );
-    double y0 = yMap.transform( d_data->baseline );
+    double x0 = xMap.transform( m_data->baseline );
+    double y0 = yMap.transform( m_data->baseline );
     if ( doAlign )
     {
@@ -576,5 +607,5 @@
     const Qt::Orientation o = orientation();
 
-    const QwtSeriesData<QPointF> *series = data();
+    const QwtSeriesData< QPointF >* series = data();
 
     for ( int i = from; i <= to; i++ )
@@ -599,18 +630,18 @@
 
 /*!
-  Draw dots
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from index of the first point to be painted
-  \param to index of the last point to be painted
-
-  \sa draw(), drawCurve(), drawSticks(), drawLines(), drawSteps()
-*/
-void QwtPlotCurve::drawDots( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   Draw dots
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted
+
+   \sa draw(), drawCurve(), drawSticks(), drawLines(), drawSteps()
+ */
+void QwtPlotCurve::drawDots( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     const QColor color = painter->pen().color();
@@ -621,6 +652,6 @@
     }
 
-    const bool doFill = ( d_data->brush.style() != Qt::NoBrush )
-            && ( d_data->brush.color().alpha() > 0 );
+    const bool doFill = ( m_data->brush.style() != Qt::NoBrush )
+        && ( m_data->brush.color().alpha() > 0 );
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
@@ -629,5 +660,5 @@
     mapper.setFlag( QwtPointMapper::RoundPoints, doAlign );
 
-    if ( d_data->paintAttributes & FilterPoints )
+    if ( m_data->paintAttributes & FilterPoints )
     {
         if ( ( color.alpha() == 255 )
@@ -642,5 +673,5 @@
         mapper.setFlag( QwtPointMapper::WeedOutPoints, false );
 
-        QPolygonF points = mapper.toPointsF(
+        QPolygonF points = mapper.toPolygonF(
             xMap, yMap, data(), from, to );
 
@@ -648,8 +679,8 @@
         fillCurve( painter, xMap, yMap, canvasRect, points );
     }
-    else if ( d_data->paintAttributes & ImageBuffer )
+    else if ( m_data->paintAttributes & ImageBuffer )
     {
         const QImage image = mapper.toImage( xMap, yMap,
-            data(), from, to, d_data->pen,
+            data(), from, to, m_data->pen,
             painter->testRenderHint( QPainter::Antialiasing ),
             renderThreadCount() );
@@ -657,7 +688,7 @@
         painter->drawImage( canvasRect.toAlignedRect(), image );
     }
-    else if ( d_data->paintAttributes & MinimizeMemory )
-    {
-        const QwtSeriesData<QPointF> *series = data();
+    else if ( m_data->paintAttributes & MinimizeMemory )
+    {
+        const QwtSeriesData< QPointF >* series = data();
 
         for ( int i = from; i <= to; i++ )
@@ -697,32 +728,32 @@
 
 /*!
-  Draw step function
-
-  The direction of the steps depends on Inverted attribute.
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from index of the first point to be painted
-  \param to index of the last point to be painted
-
-  \sa CurveAttribute, setCurveAttribute(),
+   Draw step function
+
+   The direction of the steps depends on Inverted attribute.
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted
+
+   \sa CurveAttribute, setCurveAttribute(),
       draw(), drawCurve(), drawDots(), drawLines(), drawSticks()
-*/
-void QwtPlotCurve::drawSteps( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+ */
+void QwtPlotCurve::drawSteps( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
     QPolygonF polygon( 2 * ( to - from ) + 1 );
-    QPointF *points = polygon.data();
+    QPointF* points = polygon.data();
 
     bool inverted = orientation() == Qt::Vertical;
-    if ( d_data->attributes & Inverted )
+    if ( m_data->attributes & Inverted )
         inverted = !inverted;
 
-    const QwtSeriesData<QPointF> *series = data();
+    const QwtSeriesData< QPointF >* series = data();
 
     int i, ip;
@@ -740,6 +771,6 @@
         if ( ip > 0 )
         {
-            const QPointF &p0 = points[ip - 2];
-            QPointF &p = points[ip - 1];
+            const QPointF& p0 = points[ip - 2];
+            QPointF& p = points[ip - 1];
 
             if ( inverted )
@@ -759,10 +790,12 @@
     }
 
-    if ( d_data->paintAttributes & ClipPolygons )
-    {
-        qreal pw = qMax( qreal( 1.0 ), painter->pen().widthF());
-        const QRectF clipRect = canvasRect.adjusted(-pw, -pw, pw, pw);
-
-        const QPolygonF clipped = QwtClipper::clipPolygonF(
+    if ( m_data->paintAttributes & ClipPolygons )
+    {
+        QRectF clipRect = qwtIntersectedClipRect( canvasRect, painter );
+
+        const qreal pw = QwtPainter::effectivePenWidth( painter->pen() );
+        clipRect = clipRect.adjusted(-pw, -pw, pw, pw);
+
+        const QPolygonF clipped = QwtClipper::clippedPolygonF(
             clipRect, polygon, false );
 
@@ -774,5 +807,5 @@
     }
 
-    if ( d_data->brush.style() != Qt::NoBrush )
+    if ( m_data->brush.style() != Qt::NoBrush )
         fillCurve( painter, xMap, yMap, canvasRect, polygon );
 }
@@ -780,20 +813,20 @@
 
 /*!
-  Specify an attribute for drawing the curve
-
-  \param attribute Curve attribute
-  \param on On/Off
-
-  /sa testCurveAttribute(), setCurveFitter()
-*/
+   Specify an attribute for drawing the curve
+
+   \param attribute Curve attribute
+   \param on On/Off
+
+   /sa testCurveAttribute(), setCurveFitter()
+ */
 void QwtPlotCurve::setCurveAttribute( CurveAttribute attribute, bool on )
 {
-    if ( bool( d_data->attributes & attribute ) == on )
+    if ( bool( m_data->attributes & attribute ) == on )
         return;
 
     if ( on )
-        d_data->attributes |= attribute;
+        m_data->attributes |= attribute;
     else
-        d_data->attributes &= ~attribute;
+        m_data->attributes &= ~attribute;
 
     itemChanged();
@@ -803,31 +836,31 @@
     \return true, if attribute is enabled
     \sa setCurveAttribute()
-*/
+ */
 bool QwtPlotCurve::testCurveAttribute( CurveAttribute attribute ) const
 {
-    return d_data->attributes & attribute;
-}
-
-/*!
-  Assign a curve fitter
-
-  The curve fitter "smooths" the curve points, when the Fitted
-  CurveAttribute is set. setCurveFitter(NULL) also disables curve fitting.
-
-  The curve fitter operates on the translated points ( = widget coordinates)
-  to be functional for logarithmic scales. Obviously this is less performant
-  for fitting algorithms, that reduce the number of points.
-
-  For situations, where curve fitting is used to improve the performance
-  of painting huge series of points it might be better to execute the fitter
-  on the curve points once and to cache the result in the QwtSeriesData object.
-
-  \param curveFitter() Curve fitter
-  \sa Fitted
-*/
-void QwtPlotCurve::setCurveFitter( QwtCurveFitter *curveFitter )
-{
-    delete d_data->curveFitter;
-    d_data->curveFitter = curveFitter;
+    return m_data->attributes & attribute;
+}
+
+/*!
+   Assign a curve fitter
+
+   The curve fitter "smooths" the curve points, when the Fitted
+   CurveAttribute is set. setCurveFitter(NULL) also disables curve fitting.
+
+   The curve fitter operates on the translated points ( = widget coordinates)
+   to be functional for logarithmic scales. Obviously this is less performant
+   for fitting algorithms, that reduce the number of points.
+
+   For situations, where curve fitting is used to improve the performance
+   of painting huge series of points it might be better to execute the fitter
+   on the curve points once and to cache the result in the QwtSeriesData object.
+
+   \param curveFitter() Curve fitter
+   \sa Fitted
+ */
+void QwtPlotCurve::setCurveFitter( QwtCurveFitter* curveFitter )
+{
+    delete m_data->curveFitter;
+    m_data->curveFitter = curveFitter;
 
     itemChanged();
@@ -835,31 +868,31 @@
 
 /*!
-  Get the curve fitter. If curve fitting is disabled NULL is returned.
-
-  \return Curve fitter
-  \sa setCurveFitter(), Fitted
-*/
-QwtCurveFitter *QwtPlotCurve::curveFitter() const
-{
-    return d_data->curveFitter;
-}
-
-/*!
-  Fill the area between the curve and the baseline with
-  the curve brush
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param polygon Polygon - will be modified !
-
-  \sa setBrush(), setBaseline(), setStyle()
-*/
-void QwtPlotCurve::fillCurve( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, QPolygonF &polygon ) const
-{
-    if ( d_data->brush.style() == Qt::NoBrush )
+   Get the curve fitter. If curve fitting is disabled NULL is returned.
+
+   \return Curve fitter
+   \sa setCurveFitter(), Fitted
+ */
+QwtCurveFitter* QwtPlotCurve::curveFitter() const
+{
+    return m_data->curveFitter;
+}
+
+/*!
+   Fill the area between the curve and the baseline with
+   the curve brush
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param polygon Polygon - will be modified !
+
+   \sa setBrush(), setBaseline(), setStyle()
+ */
+void QwtPlotCurve::fillCurve( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, QPolygonF& polygon ) const
+{
+    if ( m_data->brush.style() == Qt::NoBrush )
         return;
 
@@ -868,10 +901,13 @@
         return;
 
-    QBrush brush = d_data->brush;
+    QBrush brush = m_data->brush;
     if ( !brush.color().isValid() )
-        brush.setColor( d_data->pen.color() );
-
-    if ( d_data->paintAttributes & ClipPolygons )
-        polygon = QwtClipper::clipPolygonF( canvasRect, polygon, true );
+        brush.setColor( m_data->pen.color() );
+
+    if ( m_data->paintAttributes & ClipPolygons )
+    {
+        const QRectF clipRect = qwtIntersectedClipRect( canvasRect, painter );
+        QwtClipper::clipPolygonF( clipRect, polygon, true );
+    }
 
     painter->save();
@@ -886,15 +922,15 @@
 
 /*!
-  \brief Complete a polygon to be a closed polygon including the
+   \brief Complete a polygon to be a closed polygon including the
          area between the original polygon and the baseline.
 
-  \param painter Painter
-  \param xMap X map
-  \param yMap Y map
-  \param polygon Polygon to be completed
-*/
-void QwtPlotCurve::closePolyline( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    QPolygonF &polygon ) const
+   \param painter Painter
+   \param xMap X map
+   \param yMap Y map
+   \param polygon Polygon to be completed
+ */
+void QwtPlotCurve::closePolyline( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    QPolygonF& polygon ) const
 {
     if ( polygon.size() < 2 )
@@ -903,5 +939,5 @@
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
-    double baseline = d_data->baseline;
+    double baseline = m_data->baseline;
 
     if ( orientation() == Qt::Vertical )
@@ -911,5 +947,5 @@
 
         double refY = yMap.transform( baseline );
-        if ( doAlign )
+        if ( doAlign && qAbs( refY ) < std::numeric_limits< int >::max() )
             refY = qRound( refY );
 
@@ -923,5 +959,5 @@
 
         double refX = xMap.transform( baseline );
-        if ( doAlign )
+        if ( doAlign && qAbs( refX ) < std::numeric_limits< int >::max() )
             refX = qRound( refX );
 
@@ -932,19 +968,19 @@
 
 /*!
-  Draw symbols
-
-  \param painter Painter
-  \param symbol Curve symbol
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-
-  \sa setSymbol(), drawSeries(), drawCurve()
-*/
-void QwtPlotCurve::drawSymbols( QPainter *painter, const QwtSymbol &symbol,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   Draw symbols
+
+   \param painter Painter
+   \param symbol Curve symbol
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+
+   \sa setSymbol(), drawSeries(), drawCurve()
+ */
+void QwtPlotCurve::drawSymbols( QPainter* painter, const QwtSymbol& symbol,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     QwtPointMapper mapper;
@@ -953,5 +989,7 @@
     mapper.setFlag( QwtPointMapper::WeedOutPoints,
         testPaintAttribute( QwtPlotCurve::FilterPoints ) );
-    mapper.setBoundingRect( canvasRect );
+
+    const QRectF clipRect = qwtIntersectedClipRect( canvasRect, painter );
+    mapper.setBoundingRect( clipRect );
 
     const int chunkSize = 500;
@@ -970,24 +1008,24 @@
 
 /*!
-  \brief Set the value of the baseline
-
-  The baseline is needed for filling the curve with a brush or
-  the Sticks drawing style.
-
-  The interpretation of the baseline depends on the orientation().
-  With Qt::Vertical, the baseline is interpreted as a horizontal line
-  at y = baseline(), with Qt::Horizontal, it is interpreted as a vertical
-  line at x = baseline().
-
-  The default value is 0.0.
-
-  \param value Value of the baseline
-  \sa baseline(), setBrush(), setStyle(), QwtPlotAbstractSeriesItem::orientation()
-*/
+   \brief Set the value of the baseline
+
+   The baseline is needed for filling the curve with a brush or
+   the Sticks drawing style.
+
+   The interpretation of the baseline depends on the orientation().
+   With Qt::Vertical, the baseline is interpreted as a horizontal line
+   at y = baseline(), with Qt::Horizontal, it is interpreted as a vertical
+   line at x = baseline().
+
+   The default value is 0.0.
+
+   \param value Value of the baseline
+   \sa baseline(), setBrush(), setStyle(), QwtPlotAbstractSeriesItem::orientation()
+ */
 void QwtPlotCurve::setBaseline( double value )
 {
-    if ( d_data->baseline != value )
-    {
-        d_data->baseline = value;
+    if ( m_data->baseline != value )
+    {
+        m_data->baseline = value;
         itemChanged();
     }
@@ -995,34 +1033,38 @@
 
 /*!
-  \return Value of the baseline
-  \sa setBaseline()
-*/
+   \return Value of the baseline
+   \sa setBaseline()
+ */
 double QwtPlotCurve::baseline() const
 {
-    return d_data->baseline;
-}
-
-/*!
-  Find the closest curve point for a specific position
-
-  \param pos Position, where to look for the closest curve point
-  \param dist If dist != NULL, closestPoint() returns the distance between
-              the position and the closest curve point
-  \return Index of the closest curve point, or -1 if none can be found
+    return m_data->baseline;
+}
+
+/*!
+   Find the closest curve point for a specific position
+
+   \param pos Position, where to look for the closest curve point
+   \param dist If dist != NULL, closestPoint() returns the distance between
+              the position and the closest curve point in paint device coordinates
+   \return Index of the closest curve point, or -1 if none can be found
           ( f.e when the curve has no points )
-  \note closestPoint() implements a dumb algorithm, that iterates
+   \note closestPoint() implements a dumb algorithm, that iterates
         over all points
-*/
-int QwtPlotCurve::closestPoint( const QPoint &pos, double *dist ) const
-{
+ */
+int QwtPlotCurve::closestPoint( const QPointF& pos, double* dist ) const
+{
+    const QwtPlot* plot = this->plot();
+
+    if ( ( plot == NULL ) || !plot->isAxisValid( xAxis() ) || !plot->isAxisValid( yAxis() ) )
+        return -1;
+
     const size_t numSamples = dataSize();
-
-    if ( plot() == NULL || numSamples <= 0 )
+    if ( numSamples <= 0 )
         return -1;
 
-    const QwtSeriesData<QPointF> *series = data();
-
-    const QwtScaleMap xMap = plot()->canvasMap( xAxis() );
-    const QwtScaleMap yMap = plot()->canvasMap( yAxis() );
+    const QwtSeriesData< QPointF >* series = data();
+
+    const QwtScaleMap xMap = plot->canvasMap( xAxis() );
+    const QwtScaleMap yMap = plot->canvasMap( yAxis() );
 
     int index = -1;
@@ -1044,7 +1086,128 @@
     }
     if ( dist )
-        *dist = qSqrt( dmin );
+        *dist = std::sqrt( dmin );
 
     return index;
+}
+
+/*!
+   Find the curve point with the smallest coordinate larger than a specific value
+   The coordinates have to be monotonic in direction of the orientation.
+    
+   \param orientation Qt::Horizontal corresponds to x, Qt::Vertical to y coordinates
+   \param value x or y coordinate, depending on the orientation
+
+   \return Index of the curve point with the smalles coordinate above value
+           or -1 if there is none.
+
+   \note The implementation uses a binary search algorithm and requires the
+         points being ordered in direction of the orientation.
+
+   \sa qwtUpperSampleIndex()
+ */
+int QwtPlotCurve::adjacentPoint( Qt::Orientation orientation, qreal value ) const
+{
+    const QwtSeriesData< QPointF >* data = this->data();
+    if ( data == NULL )
+        return -1;
+
+    if ( orientation == Qt::Horizontal )
+    {
+        struct compareX
+        {
+            inline bool operator()( const double x, const QPointF& pos ) const
+            {
+                return ( x < pos.x() );
+            }
+        };
+
+        return qwtUpperSampleIndex< QPointF >( *data, value, compareX() );
+    }
+    else
+    {
+        struct compareY
+        {
+            inline bool operator()( const double y, const QPointF& pos ) const
+            {
+                return ( y < pos.y() );
+            }
+        };
+
+        return qwtUpperSampleIndex< QPointF >( *data, value, compareY() );
+    }
+
+    return -1;
+}
+
+/*!
+   Calculate a fictive curve point by interpolating between the adjacent
+   points. The curve points have to be monotonic in direction of the orientation.
+    
+   \param orientation For Qt::Horizontal value is a x coordinate and a y coordinate
+                      is returned. For Qt::Vertical value is a x coordinate
+   \param value x or y coordinate, depending on the orientation
+
+   \return Interpolated coordinate or qQNaN() if value is outside the bounding
+           rectangle of the curve
+
+   \note The implementation uses a binary search algorithm and requires the
+         points being ordered in direction of the orientation.
+
+   \sa adjacentPoint()
+ */
+qreal QwtPlotCurve::interpolatedValueAt( Qt::Orientation orientation, double value ) const
+{
+    const QRectF br = boundingRect();
+    if ( br.width() <= 0.0 )
+        return qQNaN();
+
+    double v;
+
+    if ( orientation == Qt::Horizontal )
+    {
+        if ( value < br.left() || value > br.right() )
+            return qQNaN();
+
+        const int index = adjacentPoint( orientation, value );
+
+        if ( index == -1 )
+        {
+            const QPointF last = sample( dataSize() - 1 );
+
+            if ( value != last.x() )
+                return qQNaN();
+
+            v = last.y();
+        }
+        else
+        {
+            const QLineF line( sample( index - 1 ), sample( index ) );
+            v = line.pointAt( ( value - line.p1().x() ) / line.dx() ).y();
+        }
+    }
+    else
+    {
+        if ( value < br.top() || value > br.bottom() )
+            return qQNaN();
+
+        const int index = adjacentPoint( orientation, value );
+
+        if ( index == -1 )
+        {
+            const QPointF last = sample( dataSize() - 1 );
+
+            if ( value != last.y() )
+                return qQNaN();
+
+            v = last.x();
+        }
+        else
+        {
+            const QLineF line( sample( index - 1 ), sample( index ) );
+            v = line.pointAt( ( value - line.p1().y() ) / line.dy() ).x();
+        }
+    }
+
+    return v;
 }
 
@@ -1058,6 +1221,5 @@
    \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
  */
-QwtGraphic QwtPlotCurve::legendIcon( int index,
-    const QSizeF &size ) const
+QwtGraphic QwtPlotCurve::legendIcon( int index, const QSizeF& size ) const
 {
     Q_UNUSED( index );
@@ -1074,11 +1236,11 @@
         testRenderHint( QwtPlotItem::RenderAntialiased ) );
 
-    if ( d_data->legendAttributes == 0 ||
-        d_data->legendAttributes & QwtPlotCurve::LegendShowBrush )
-    {
-        QBrush brush = d_data->brush;
+    if ( m_data->legendAttributes == 0 ||
+        m_data->legendAttributes & QwtPlotCurve::LegendShowBrush )
+    {
+        QBrush brush = m_data->brush;
 
         if ( brush.style() == Qt::NoBrush &&
-            d_data->legendAttributes == 0 )
+            m_data->legendAttributes == 0 )
         {
             if ( style() != QwtPlotCurve::NoCurve )
@@ -1086,8 +1248,8 @@
                 brush = QBrush( pen().color() );
             }
-            else if ( d_data->symbol &&
-                ( d_data->symbol->style() != QwtSymbol::NoSymbol ) )
+            else if ( m_data->symbol &&
+                ( m_data->symbol->style() != QwtSymbol::NoSymbol ) )
             {
-                brush = QBrush( d_data->symbol->pen().color() );
+                brush = QBrush( m_data->symbol->pen().color() );
             }
         }
@@ -1100,5 +1262,5 @@
     }
 
-    if ( d_data->legendAttributes & QwtPlotCurve::LegendShowLine )
+    if ( m_data->legendAttributes & QwtPlotCurve::LegendShowLine )
     {
         if ( pen() != Qt::NoPen )
@@ -1114,10 +1276,10 @@
     }
 
-    if ( d_data->legendAttributes & QwtPlotCurve::LegendShowSymbol )
-    {
-        if ( d_data->symbol )
+    if ( m_data->legendAttributes & QwtPlotCurve::LegendShowSymbol )
+    {
+        if ( m_data->symbol )
         {
             QRectF r( 0, 0, size.width(), size.height() );
-            d_data->symbol->drawSymbol( &painter, r );
+            m_data->symbol->drawSymbol( &painter, r );
         }
     }
@@ -1127,11 +1289,26 @@
 
 /*!
-  Initialize data with an array of points.
-
-  \param samples Vector of points
-  \note QVector is implicitly shared
-  \note QPolygonF is derived from QVector<QPointF>
-*/
-void QwtPlotCurve::setSamples( const QVector<QPointF> &samples )
+   Assign a series of points
+
+   setSamples() is just a wrapper for setData() without any additional
+   value - beside that it is easier to find for the developer.
+
+   \param data Data
+   \warning The item takes ownership of the data object, deleting
+           it when its not used anymore.
+ */
+void QwtPlotCurve::setSamples( QwtSeriesData< QPointF >* data )
+{
+    setData( data );
+}
+
+/*!
+   Initialize data with an array of points.
+
+   \param samples Vector of points
+   \note QVector is implicitly shared
+   \note QPolygonF is derived from QVector<QPointF>
+ */
+void QwtPlotCurve::setSamples( const QVector< QPointF >& samples )
 {
     setData( new QwtPointSeriesData( samples ) );
@@ -1139,71 +1316,206 @@
 
 /*!
-  Assign a series of points
-
-  setSamples() is just a wrapper for setData() without any additional
-  value - beside that it is easier to find for the developer.
-
-  \param data Data
-  \warning The item takes ownership of the data object, deleting
-           it when its not used anymore.
-*/
-void QwtPlotCurve::setSamples( QwtSeriesData<QPointF> *data )
-{
-    setData( data );
-}
-
-#ifndef QWT_NO_COMPAT
-
-/*!
-  \brief Initialize the data by pointing to memory blocks which
+   \brief Initialize the data by pointing to memory blocks which
          are not managed by QwtPlotCurve.
 
-  setRawSamples is provided for efficiency.
-  It is important to keep the pointers
-  during the lifetime of the underlying QwtCPointerData class.
-
-  \param xData pointer to x data
-  \param yData pointer to y data
-  \param size size of x and y
-
-  \sa QwtCPointerData
-*/
+   setRawSamples is provided for efficiency.
+   It is important to keep the pointers
+   during the lifetime of the underlying QwtCPointerData class.
+
+   \param xData pointer to x data
+   \param yData pointer to y data
+   \param size size of x and y
+
+   \sa QwtCPointerData
+ */
 void QwtPlotCurve::setRawSamples(
-    const double *xData, const double *yData, int size )
-{
-    setData( new QwtCPointerData( xData, yData, size ) );
-}
-
-/*!
-  Set data by copying x- and y-values from specified memory blocks.
-  Contrary to setRawSamples(), this function makes a 'deep copy' of
-  the data.
-
-  \param xData pointer to x values
-  \param yData pointer to y values
-  \param size size of xData and yData
-
-  \sa QwtPointArrayData
-*/
+    const double* xData, const double* yData, int size )
+{
+    setData( new QwtCPointerData< double >( xData, yData, size ) );
+}
+
+/*!
+   \brief Initialize the data by pointing to memory blocks which
+         are not managed by QwtPlotCurve.
+
+   setRawSamples is provided for efficiency.
+   It is important to keep the pointers
+   during the lifetime of the underlying QwtCPointerData class.
+
+   \param xData pointer to x data
+   \param yData pointer to y data
+   \param size size of x and y
+
+   \sa QwtCPointerData
+ */
+void QwtPlotCurve::setRawSamples(
+    const float* xData, const float* yData, int size )
+{
+    setData( new QwtCPointerData< float >( xData, yData, size ) );
+}
+
+/*!
+   \brief Initialize the data by pointing to a memory block which
+         is not managed by QwtPlotCurve.
+
+   The memory contains the y coordinates, while the index is
+   interpreted as x coordinate.
+
+   setRawSamples() is provided for efficiency. It is important to
+   keep the pointers during the lifetime of the underlying
+   QwtCPointerValueData class.
+
+   \param yData pointer to y data
+   \param size size of x and y
+
+   \sa QwtCPointerData
+ */
+void QwtPlotCurve::setRawSamples( const double* yData, int size )
+{
+    setData( new QwtCPointerValueData< double >( yData, size ) );
+}
+
+/*!
+   \brief Initialize the data by pointing to memory blocks which
+         are not managed by QwtPlotCurve.
+
+   The memory contains the y coordinates, while the index is
+   interpreted as x coordinate.
+
+   setRawSamples() is provided for efficiency. It is important to
+   keep the pointers during the lifetime of the underlying
+   QwtCPointerValueData class.
+
+   \param yData pointer to y data
+   \param size size of x and y
+
+   \sa QwtCPointerData
+ */
+void QwtPlotCurve::setRawSamples( const float* yData, int size )
+{
+    setData( new QwtCPointerValueData< float >( yData, size ) );
+}
+
+/*!
+   Set data by copying x- and y-values from specified memory blocks.
+   Contrary to setRawSamples(), this function makes a 'deep copy' of
+   the data.
+
+   \param xData pointer to x values
+   \param yData pointer to y values
+   \param size size of xData and yData
+
+   \sa QwtPointArrayData
+ */
 void QwtPlotCurve::setSamples(
-    const double *xData, const double *yData, int size )
-{
-    setData( new QwtPointArrayData( xData, yData, size ) );
-}
-
-/*!
-  \brief Initialize data with x- and y-arrays (explicitly shared)
-
-  \param xData x data
-  \param yData y data
-
-  \sa QwtPointArrayData
-*/
-void QwtPlotCurve::setSamples( const QVector<double> &xData,
-    const QVector<double> &yData )
-{
-    setData( new QwtPointArrayData( xData, yData ) );
-}
-
-#endif // !QWT_NO_COMPAT
-
+    const double* xData, const double* yData, int size )
+{
+    setData( new QwtPointArrayData< double >( xData, yData, size ) );
+}
+
+/*!
+   Set data by copying x- and y-values from specified memory blocks.
+   Contrary to setRawSamples(), this function makes a 'deep copy' of
+   the data.
+
+   \param xData pointer to x values
+   \param yData pointer to y values
+   \param size size of xData and yData
+
+   \sa QwtPointArrayData
+ */
+void QwtPlotCurve::setSamples(
+    const float* xData, const float* yData, int size )
+{
+    setData( new QwtPointArrayData< float >( xData, yData, size ) );
+}
+
+/*!
+   \brief Initialize data with x- and y-arrays (explicitly shared)
+
+   \param xData x data
+   \param yData y data
+
+   \sa QwtPointArrayData
+ */
+void QwtPlotCurve::setSamples( const QVector< double >& xData,
+    const QVector< double >& yData )
+{
+    setData( new QwtPointArrayData< double >( xData, yData ) );
+}
+
+/*!
+   \brief Initialize data with x- and y-arrays (explicitly shared)
+
+   \param xData x data
+   \param yData y data
+
+   \sa QwtPointArrayData
+ */
+void QwtPlotCurve::setSamples( const QVector< float >& xData,
+    const QVector< float >& yData )
+{
+    setData( new QwtPointArrayData< float >( xData, yData ) );
+}
+
+/*!
+   Set data by copying y-values from a specified memory block.
+
+   The memory contains the y coordinates, while the index is
+   interpreted as x coordinate.
+
+   \param yData y data
+   \param size size of yData
+
+   \sa QwtValuePointData
+ */
+void QwtPlotCurve::setSamples( const double* yData, int size )
+{
+    setData( new QwtValuePointData< double >( yData, size ) );
+}
+
+/*!
+   Set data by copying y-values from a specified memory block.
+
+   The vector contains the y coordinates, while the index is
+   interpreted as x coordinate.
+
+   \param yData y data
+   \param size size of yData
+
+   \sa QwtValuePointData
+ */
+void QwtPlotCurve::setSamples( const float* yData, int size )
+{
+    setData( new QwtValuePointData< float >( yData, size ) );
+}
+
+/*!
+   Initialize data with an array of y values (explicitly shared)
+
+   The vector contains the y coordinates, while the index is
+   the x coordinate.
+
+   \param yData y data
+
+   \sa QwtValuePointData
+ */
+void QwtPlotCurve::setSamples( const QVector< double >& yData )
+{
+    setData( new QwtValuePointData< double >( yData ) );
+}
+
+/*!
+   Initialize data with an array of y values (explicitly shared)
+
+   The vector contains the y coordinates, while the index is
+   the x coordinate.
+
+   \param yData y data
+
+   \sa QwtValuePointData
+ */
+void QwtPlotCurve::setSamples( const QVector< float >& yData )
+{
+    setData( new QwtValuePointData< float >( yData ) );
+}
Index: /trunk/BNC/qwt/qwt_plot_curve.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_curve.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_curve.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,57 +13,59 @@
 #include "qwt_global.h"
 #include "qwt_plot_seriesitem.h"
-#include "qwt_series_data.h"
-#include "qwt_text.h"
-#include <qpen.h>
+
 #include <qstring.h>
 
-class QPainter;
-class QPolygonF;
 class QwtScaleMap;
 class QwtSymbol;
 class QwtCurveFitter;
+template< typename T > class QwtSeriesData;
+class QwtText;
+class QPainter;
+class QPolygonF;
+class QPen;
 
 /*!
-  \brief A plot item, that represents a series of points
-
-  A curve is the representation of a series of points in the x-y plane.
-  It supports different display styles, interpolation ( f.e. spline )
-  and symbols.
-
-  \par Usage
-  <dl><dt>a) Assign curve properties</dt>
-  <dd>When a curve is created, it is configured to draw black solid lines
-  with in QwtPlotCurve::Lines style and no symbols.
-  You can change this by calling
-  setPen(), setStyle() and setSymbol().</dd>
-  <dt>b) Connect/Assign data.</dt>
-  <dd>QwtPlotCurve gets its points using a QwtSeriesData object offering
-  a bridge to the real storage of the points ( like QAbstractItemModel ).
-  There are several convenience classes derived from QwtSeriesData, that also store
-  the points inside ( like QStandardItemModel ). QwtPlotCurve also offers
-  a couple of variations of setSamples(), that build QwtSeriesData objects from
-  arrays internally.</dd>
-  <dt>c) Attach the curve to a plot</dt>
-  <dd>See QwtPlotItem::attach()
-  </dd></dl>
-
-  \par Example:
-  see examples/bode
-
-  \sa QwtPointSeriesData, QwtSymbol, QwtScaleMap
-*/
-class QWT_EXPORT QwtPlotCurve:
-    public QwtPlotSeriesItem, public QwtSeriesStore<QPointF>
-{
-public:
+   \brief A plot item, that represents a series of points
+
+   A curve is the representation of a series of points in the x-y plane.
+   It supports different display styles, interpolation ( f.e. spline )
+   and symbols.
+
+   \par Usage
+   <dl><dt>a) Assign curve properties</dt>
+   <dd>When a curve is created, it is configured to draw black solid lines
+   with in QwtPlotCurve::Lines style and no symbols.
+   You can change this by calling
+   setPen(), setStyle() and setSymbol().</dd>
+   <dt>b) Connect/Assign data.</dt>
+   <dd>QwtPlotCurve gets its points using a QwtSeriesData object offering
+   a bridge to the real storage of the points ( like QAbstractItemModel ).
+   There are several convenience classes derived from QwtSeriesData, that also store
+   the points inside ( like QStandardItemModel ). QwtPlotCurve also offers
+   a couple of variations of setSamples(), that build QwtSeriesData objects from
+   arrays internally.</dd>
+   <dt>c) Attach the curve to a plot</dt>
+   <dd>See QwtPlotItem::attach()
+   </dd></dl>
+
+   \par Example:
+   see examples/bode
+
+   \sa QwtPointSeriesData, QwtSymbol, QwtScaleMap
+ */
+class QWT_EXPORT QwtPlotCurve
+    : public QwtPlotSeriesItem
+    , public QwtSeriesStore< QPointF >
+{
+  public:
     /*!
         Curve styles.
         \sa setStyle(), style()
-    */
+     */
     enum CurveStyle
     {
         /*!
            Don't draw a curve. Note: This doesn't affect the symbols.
-        */
+         */
         NoCurve = -1,
 
@@ -72,5 +74,5 @@
            be interpolated depending on the 'Fitted' attribute. Curve
            fitting can be configured using setCurveFitter().
-        */
+         */
         Lines,
 
@@ -78,5 +80,5 @@
            Draw vertical or horizontal sticks ( depending on the
            orientation() ) from a baseline which is defined by setBaseline().
-        */
+         */
         Sticks,
 
@@ -85,5 +87,5 @@
            is drawn from the left to the right or vice versa,
            depending on the QwtPlotCurve::Inverted attribute.
-        */
+         */
         Steps,
 
@@ -93,5 +95,5 @@
            as a curve in QwtPlotCurve::NoStyle style and a symbol
            painting a point.
-        */
+         */
         Dots,
 
@@ -100,12 +102,12 @@
            classes of QwtPlotCurve that overload drawCurve() with
            additional application specific curve types.
-        */
+         */
         UserCurve = 100
     };
 
     /*!
-      Attribute for drawing the curve
-      \sa setCurveAttribute(), testCurveAttribute(), curveFitter()
-    */
+       Attribute for drawing the curve
+       \sa setCurveAttribute(), testCurveAttribute(), curveFitter()
+     */
     enum CurveAttribute
     {
@@ -117,18 +119,17 @@
 
         /*!
-          Only in combination with QwtPlotCurve::Lines
-          A QwtCurveFitter tries to
-          interpolate/smooth the curve, before it is painted.
-
-          \note Curve fitting requires temporary memory
-          for calculating coefficients and additional points.
-          If painting in QwtPlotCurve::Fitted mode is slow it might be better
-          to fit the points, before they are passed to QwtPlotCurve.
+           Only in combination with QwtPlotCurve::Lines
+           A QwtCurveFitter tries to
+           interpolate/smooth the curve, before it is painted.
+
+           \note Curve fitting requires temporary memory
+           for calculating coefficients and additional points.
+           If painting in QwtPlotCurve::Fitted mode is slow it might be better
+           to fit the points, before they are passed to QwtPlotCurve.
          */
         Fitted = 0x02
     };
 
-    //! Curve attributes
-    typedef QFlags<CurveAttribute> CurveAttributes;
+    Q_DECLARE_FLAGS( CurveAttributes, CurveAttribute )
 
     /*!
@@ -142,29 +143,28 @@
     {
         /*!
-          QwtPlotCurve tries to find a color representing the curve
-          and paints a rectangle with it.
+           QwtPlotCurve tries to find a color representing the curve
+           and paints a rectangle with it.
          */
         LegendNoAttribute = 0x00,
 
         /*!
-          If the style() is not QwtPlotCurve::NoCurve a line
-          is painted with the curve pen().
+           If the style() is not QwtPlotCurve::NoCurve a line
+           is painted with the curve pen().
          */
         LegendShowLine = 0x01,
 
         /*!
-          If the curve has a valid symbol it is painted.
+           If the curve has a valid symbol it is painted.
          */
         LegendShowSymbol = 0x02,
 
         /*!
-          If the curve has a brush a rectangle filled with the
-          curve brush() is painted.
+           If the curve has a brush a rectangle filled with the
+           curve brush() is painted.
          */
         LegendShowBrush = 0x04
     };
 
-    //! Legend attributes
-    typedef QFlags<LegendAttribute> LegendAttributes;
+    Q_DECLARE_FLAGS( LegendAttributes, LegendAttribute )
 
     /*!
@@ -173,48 +173,71 @@
 
         \sa setPaintAttribute(), testPaintAttribute()
-    */
+     */
     enum PaintAttribute
     {
         /*!
-          Clip polygons before painting them. In situations, where points
-          are far outside the visible area (f.e when zooming deep) this
-          might be a substantial improvement for the painting performance
+           Clip polygons before painting them. In situations, where points
+           are far outside the visible area (f.e when zooming deep) this
+           might be a substantial improvement for the painting performance
          */
         ClipPolygons = 0x01,
 
         /*!
-          Tries to reduce the data that has to be painted, by sorting out
-          duplicates, or paintings outside the visible area. Might have a
-          notable impact on curves with many close points.
-          Only a couple of very basic filtering algorithms are implemented.
+           Tries to reduce the data that has to be painted, by sorting out
+           duplicates, or paintings outside the visible area. Might have a
+           notable impact on curves with many close points.
+           Only a couple of very basic filtering algorithms are implemented.
          */
         FilterPoints = 0x02,
 
         /*!
-          Minimize memory usage that is temporarily needed for the
-          translated points, before they get painted.
-          This might slow down the performance of painting
+           Minimize memory usage that is temporarily needed for the
+           translated points, before they get painted.
+           This might slow down the performance of painting
          */
         MinimizeMemory = 0x04,
 
         /*!
-          Render the points to a temporary image and paint the image.
-          This is a very special optimization for Dots style, when
-          having a huge amount of points.
-          With a reasonable number of points QPainter::drawPoints()
-          will be faster.
-         */
-        ImageBuffer = 0x08
+           Render the points to a temporary image and paint the image.
+           This is a very special optimization for Dots style, when
+           having a huge amount of points.
+           With a reasonable number of points QPainter::drawPoints()
+           will be faster.
+         */
+        ImageBuffer = 0x08,
+
+        /*!
+           More aggressive point filtering trying to filter out
+           intermediate points, accepting minor visual differences.
+
+           Has only an effect, when drawing the curve to a paint device
+           in integer coordinates ( f.e. all widgets on screen ) using the fact,
+           that consecutive points are often mapped to the same x or y coordinate.
+           Each chunk of samples mapped to the same coordinate can be reduced to
+           4 points ( first, min, max last ).
+
+           In the worst case the polygon to be rendered will be 4 times the width
+           of the plot canvas.
+
+           The algorithm is very fast and effective for huge datasets, and can be used
+           inside a replot cycle.
+
+           \note Implemented for QwtPlotCurve::Lines only
+           \note As this algo replaces many small lines by a long one
+                a nasty bug of the raster paint engine ( Qt 4.8, Qt 5.1 - 5.3 )
+                becomes more dominant. For these versions the bug can be
+                worked around by enabling the QwtPainter::polylineSplitting() mode.
+         */
+        FilterPointsAggressive = 0x10,
     };
 
-    //! Paint attributes
-    typedef QFlags<PaintAttribute> PaintAttributes;
-
-    explicit QwtPlotCurve( const QString &title = QString() );
-    explicit QwtPlotCurve( const QwtText &title );
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
+
+    explicit QwtPlotCurve( const QString& title = QString() );
+    explicit QwtPlotCurve( const QwtText& title );
 
     virtual ~QwtPlotCurve();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
     void setPaintAttribute( PaintAttribute, bool on = true );
@@ -224,13 +247,32 @@
     bool testLegendAttribute( LegendAttribute ) const;
 
-#ifndef QWT_NO_COMPAT
-    void setRawSamples( const double *xData, const double *yData, int size );
-    void setSamples( const double *xData, const double *yData, int size );
-    void setSamples( const QVector<double> &xData, const QVector<double> &yData );
-#endif
-    void setSamples( const QVector<QPointF> & );
-    void setSamples( QwtSeriesData<QPointF> * );
-
-    int closestPoint( const QPoint &pos, double *dist = NULL ) const;
+    void setLegendAttributes( LegendAttributes );
+    LegendAttributes legendAttributes() const;
+
+    void setRawSamples( const double* xData, const double* yData, int size );
+    void setRawSamples( const float* xData, const float* yData, int size );
+
+    void setRawSamples( const double* yData, int size );
+    void setRawSamples( const float* yData, int size );
+
+    void setSamples( const double* xData, const double* yData, int size );
+    void setSamples( const float* xData, const float* yData, int size );
+
+    void setSamples( const double* yData, int size );
+    void setSamples( const float* yData, int size );
+
+    void setSamples( const QVector< double >& yData );
+    void setSamples( const QVector< float >& yData );
+
+    void setSamples( const QVector< double >& xData, const QVector< double >& yData );
+    void setSamples( const QVector< float >& xData, const QVector< float >& yData );
+
+    void setSamples( const QVector< QPointF >& );
+    void setSamples( QwtSeriesData< QPointF >* );
+
+    virtual int closestPoint( const QPointF& pos, double* dist = NULL ) const;
+    virtual int adjacentPoint( Qt::Orientation orientation, qreal value ) const;
+
+    qreal interpolatedValueAt( Qt::Orientation, double ) const;
 
     double minXValue() const;
@@ -242,10 +284,10 @@
     bool testCurveAttribute( CurveAttribute ) const;
 
-    void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setPen( const QPen & );
-    const QPen &pen() const;
-
-    void setBrush( const QBrush & );
-    const QBrush &brush() const;
+    void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
+    void setPen( const QPen& );
+    const QPen& pen() const;
+
+    void setBrush( const QBrush& );
+    const QBrush& brush() const;
 
     void setBaseline( double );
@@ -255,54 +297,54 @@
     CurveStyle style() const;
 
-    void setSymbol( QwtSymbol * );
-    const QwtSymbol *symbol() const;
-
-    void setCurveFitter( QwtCurveFitter * );
-    QwtCurveFitter *curveFitter() const;
-
-    virtual void drawSeries( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
-
-    virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
-
-protected:
+    void setSymbol( QwtSymbol* );
+    const QwtSymbol* symbol() const;
+
+    void setCurveFitter( QwtCurveFitter* );
+    QwtCurveFitter* curveFitter() const;
+
+    virtual void drawSeries( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
+
+    virtual QwtGraphic legendIcon( int index, const QSizeF& ) const QWT_OVERRIDE;
+
+  protected:
 
     void init();
 
-    virtual void drawCurve( QPainter *, int style,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
-
-    virtual void drawSymbols( QPainter *, const QwtSymbol &,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
-
-    virtual void drawLines( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
-
-    virtual void drawSticks( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
-
-    virtual void drawDots( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
-
-    virtual void drawSteps( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
-
-    virtual void fillCurve( QPainter *,
-        const QwtScaleMap &, const QwtScaleMap &,
-        const QRectF &canvasRect, QPolygonF & ) const;
-
-    void closePolyline( QPainter *,
-        const QwtScaleMap &, const QwtScaleMap &, QPolygonF & ) const;
-
-private:
+    virtual void drawCurve( QPainter*, int style,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const;
+
+    virtual void drawSymbols( QPainter*, const QwtSymbol&,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const;
+
+    virtual void drawLines( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const;
+
+    virtual void drawSticks( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const;
+
+    virtual void drawDots( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const;
+
+    virtual void drawSteps( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const;
+
+    virtual void fillCurve( QPainter*,
+        const QwtScaleMap&, const QwtScaleMap&,
+        const QRectF& canvasRect, QPolygonF& ) const;
+
+    void closePolyline( QPainter*,
+        const QwtScaleMap&, const QwtScaleMap&, QPolygonF& ) const;
+
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_dict.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_dict.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_dict.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,29 +9,30 @@
 
 #include "qwt_plot_dict.h"
+#include <algorithm>
 
 class QwtPlotDict::PrivateData
 {
-public:
+  public:
 
-    class ItemList: public QList<QwtPlotItem *>
+    class ItemList : public QList< QwtPlotItem* >
     {
-    public:
-        void insertItem( QwtPlotItem *item )
+      public:
+        void insertItem( QwtPlotItem* item )
         {
             if ( item == NULL )
                 return;
 
-            QList<QwtPlotItem *>::iterator it =
-                qUpperBound( begin(), end(), item, LessZThan() );
+            QList< QwtPlotItem* >::iterator it =
+                std::upper_bound( begin(), end(), item, LessZThan() );
             insert( it, item );
         }
 
-        void removeItem( QwtPlotItem *item )
+        void removeItem( QwtPlotItem* item )
         {
             if ( item == NULL )
                 return;
 
-            QList<QwtPlotItem *>::iterator it =
-                qLowerBound( begin(), end(), item, LessZThan() );
+            QList< QwtPlotItem* >::iterator it =
+                std::lower_bound( begin(), end(), item, LessZThan() );
 
             for ( ; it != end(); ++it )
@@ -44,10 +45,10 @@
             }
         }
-    private:
+      private:
         class LessZThan
         {
-        public:
-            inline bool operator()( const QwtPlotItem *item1,
-                const QwtPlotItem *item2 ) const
+          public:
+            inline bool operator()( const QwtPlotItem* item1,
+                const QwtPlotItem* item2 ) const
             {
                 return item1->z() < item2->z();
@@ -65,9 +66,9 @@
    Auto deletion is enabled.
    \sa setAutoDelete(), QwtPlotItem::attach()
-*/
+ */
 QwtPlotDict::QwtPlotDict()
 {
-    d_data = new QwtPlotDict::PrivateData;
-    d_data->autoDelete = true;
+    m_data = new QwtPlotDict::PrivateData;
+    m_data->autoDelete = true;
 }
 
@@ -77,9 +78,9 @@
    If autoDelete() is on, all attached items will be deleted
    \sa setAutoDelete(), autoDelete(), QwtPlotItem::attach()
-*/
+ */
 QwtPlotDict::~QwtPlotDict()
 {
-    detachItems( QwtPlotItem::Rtti_PlotItem, d_data->autoDelete );
-    delete d_data;
+    detachItems( QwtPlotItem::Rtti_PlotItem, m_data->autoDelete );
+    delete m_data;
 }
 
@@ -91,8 +92,8 @@
 
    \sa autoDelete(), insertItem()
-*/
+ */
 void QwtPlotDict::setAutoDelete( bool autoDelete )
 {
-    d_data->autoDelete = autoDelete;
+    m_data->autoDelete = autoDelete;
 }
 
@@ -100,30 +101,30 @@
    \return true if auto deletion is enabled
    \sa setAutoDelete(), insertItem()
-*/
+ */
 bool QwtPlotDict::autoDelete() const
 {
-    return d_data->autoDelete;
+    return m_data->autoDelete;
 }
 
 /*!
-  Insert a plot item
+   Insert a plot item
 
-  \param item PlotItem
-  \sa removeItem()
+   \param item PlotItem
+   \sa removeItem()
  */
-void QwtPlotDict::insertItem( QwtPlotItem *item )
+void QwtPlotDict::insertItem( QwtPlotItem* item )
 {
-    d_data->itemList.insertItem( item );
+    m_data->itemList.insertItem( item );
 }
 
 /*!
-  Remove a plot item
+   Remove a plot item
 
-  \param item PlotItem
-  \sa insertItem()
+   \param item PlotItem
+   \sa insertItem()
  */
-void QwtPlotDict::removeItem( QwtPlotItem *item )
+void QwtPlotDict::removeItem( QwtPlotItem* item )
 {
-    d_data->itemList.removeItem( item );
+    m_data->itemList.removeItem( item );
 }
 
@@ -134,12 +135,12 @@
                otherwise only those items of the type rtti.
    \param autoDelete If true, delete all detached items
-*/
+ */
 void QwtPlotDict::detachItems( int rtti, bool autoDelete )
 {
-    PrivateData::ItemList list = d_data->itemList;
+    PrivateData::ItemList list = m_data->itemList;
     QwtPlotItemIterator it = list.constBegin();
     while ( it != list.constEnd() )
     {
-        QwtPlotItem *item = *it;
+        QwtPlotItem* item = *it;
 
         ++it; // increment before removing item from the list
@@ -155,33 +156,33 @@
 
 /*!
-  \brief A QwtPlotItemList of all attached plot items.
+   \brief A QwtPlotItemList of all attached plot items.
 
-  Use caution when iterating these lists, as removing/detaching an item will
-  invalidate the iterator. Instead you can place pointers to objects to be
-  removed in a removal list, and traverse that list later.
+   Use caution when iterating these lists, as removing/detaching an item will
+   invalidate the iterator. Instead you can place pointers to objects to be
+   removed in a removal list, and traverse that list later.
 
-  \return List of all attached plot items.
-*/
-const QwtPlotItemList &QwtPlotDict::itemList() const
+   \return List of all attached plot items.
+ */
+const QwtPlotItemList& QwtPlotDict::itemList() const
 {
-    return d_data->itemList;
+    return m_data->itemList;
 }
 
 /*!
-  \return List of all attached plot items of a specific type.
-  \param rtti See QwtPlotItem::RttiValues
-  \sa QwtPlotItem::rtti()
-*/
+   \return List of all attached plot items of a specific type.
+   \param rtti See QwtPlotItem::RttiValues
+   \sa QwtPlotItem::rtti()
+ */
 QwtPlotItemList QwtPlotDict::itemList( int rtti ) const
 {
     if ( rtti == QwtPlotItem::Rtti_PlotItem )
-        return d_data->itemList;
+        return m_data->itemList;
 
     QwtPlotItemList items;
 
-    PrivateData::ItemList list = d_data->itemList;
+    PrivateData::ItemList list = m_data->itemList;
     for ( QwtPlotItemIterator it = list.constBegin(); it != list.constEnd(); ++it )
     {
-        QwtPlotItem *item = *it;
+        QwtPlotItem* item = *it;
         if ( item->rtti() == rtti )
             items += item;
Index: /trunk/BNC/qwt/qwt_plot_dict.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_dict.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_dict.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -8,5 +8,4 @@
  *****************************************************************************/
 
-/*! \file !*/
 #ifndef QWT_PLOT_DICT
 #define QWT_PLOT_DICT
@@ -14,25 +13,24 @@
 #include "qwt_global.h"
 #include "qwt_plot_item.h"
+
 #include <qlist.h>
 
-/// \var typedef QList< QwtPlotItem *> QwtPlotItemList
-/// \brief See QT 4.x assistant documentation for QList
-typedef QList<QwtPlotItem *> QwtPlotItemList;
-typedef QList<QwtPlotItem *>::ConstIterator QwtPlotItemIterator;
+typedef QList< QwtPlotItem* > QwtPlotItemList;
+typedef QList< QwtPlotItem* >::ConstIterator QwtPlotItemIterator;
 
 /*!
-  \brief A dictionary for plot items
+   \brief A dictionary for plot items
 
-  QwtPlotDict organizes plot items in increasing z-order.
-  If autoDelete() is enabled, all attached items will be deleted
-  in the destructor of the dictionary.
-  QwtPlotDict can be used to get access to all QwtPlotItem items - or all
-  items of a specific type -  that are currently on the plot.
+   QwtPlotDict organizes plot items in increasing z-order.
+   If autoDelete() is enabled, all attached items will be deleted
+   in the destructor of the dictionary.
+   QwtPlotDict can be used to get access to all QwtPlotItem items - or all
+   items of a specific type -  that are currently on the plot.
 
-  \sa QwtPlotItem::attach(), QwtPlotItem::detach(), QwtPlotItem::z()
-*/
+   \sa QwtPlotItem::attach(), QwtPlotItem::detach(), QwtPlotItem::z()
+ */
 class QWT_EXPORT QwtPlotDict
 {
-public:
+  public:
     explicit QwtPlotDict();
     virtual ~QwtPlotDict();
@@ -47,11 +45,11 @@
         bool autoDelete = true );
 
-protected:
-    void insertItem( QwtPlotItem * );
-    void removeItem( QwtPlotItem * );
+  protected:
+    void insertItem( QwtPlotItem* );
+    void removeItem( QwtPlotItem* );
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_directpainter.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_directpainter.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_directpainter.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,17 +13,17 @@
 #include "qwt_plot_canvas.h"
 #include "qwt_plot_seriesitem.h"
+
 #include <qpainter.h>
 #include <qevent.h>
-#include <qapplication.h>
 #include <qpixmap.h>
 
 static inline void qwtRenderItem(
-    QPainter *painter, const QRect &canvasRect,
-    QwtPlotSeriesItem *seriesItem, int from, int to )
+    QPainter* painter, const QRect& canvasRect,
+    QwtPlotSeriesItem* seriesItem, int from, int to )
 {
     // A minor performance improvement is possible
     // with caching the maps. TODO ...
 
-    QwtPlot *plot = seriesItem->plot();
+    QwtPlot* plot = seriesItem->plot();
     const QwtScaleMap xMap = plot->canvasMap( seriesItem->xAxis() );
     const QwtScaleMap yMap = plot->canvasMap( seriesItem->yAxis() );
@@ -34,19 +34,18 @@
 }
 
-static inline bool qwtHasBackingStore( const QwtPlotCanvas *canvas )
+static inline bool qwtHasBackingStore( const QwtPlotCanvas* canvas )
 {
     return canvas->testPaintAttribute( QwtPlotCanvas::BackingStore )
-        && canvas->backingStore() && !canvas->backingStore()->isNull();
+           && canvas->backingStore() && !canvas->backingStore()->isNull();
 }
 
 class QwtPlotDirectPainter::PrivateData
 {
-public:
-    PrivateData():
-        attributes( 0 ),
-        hasClipping(false),
-        seriesItem( NULL ),
-        from( 0 ),
-        to( 0 )
+  public:
+    PrivateData()
+        : hasClipping( false )
+        , seriesItem( NULL )
+        , from( 0 )
+        , to( 0 )
     {
     }
@@ -59,5 +58,5 @@
     QPainter painter;
 
-    QwtPlotSeriesItem *seriesItem;
+    QwtPlotSeriesItem* seriesItem;
     int from;
     int to;
@@ -65,8 +64,8 @@
 
 //! Constructor
-QwtPlotDirectPainter::QwtPlotDirectPainter( QObject *parent ):
-    QObject( parent )
-{
-    d_data = new PrivateData;
+QwtPlotDirectPainter::QwtPlotDirectPainter( QObject* parent )
+    : QObject( parent )
+{
+    m_data = new PrivateData;
 }
 
@@ -74,23 +73,23 @@
 QwtPlotDirectPainter::~QwtPlotDirectPainter()
 {
-    delete d_data;
-}
-
-/*!
-  Change an attribute
-
-  \param attribute Attribute to change
-  \param on On/Off
-
-  \sa Attribute, testAttribute()
-*/
+    delete m_data;
+}
+
+/*!
+   Change an attribute
+
+   \param attribute Attribute to change
+   \param on On/Off
+
+   \sa Attribute, testAttribute()
+ */
 void QwtPlotDirectPainter::setAttribute( Attribute attribute, bool on )
 {
-    if ( bool( d_data->attributes & attribute ) != on )
+    if ( bool( m_data->attributes & attribute ) != on )
     {
         if ( on )
-            d_data->attributes |= attribute;
+            m_data->attributes |= attribute;
         else
-            d_data->attributes &= ~attribute;
+            m_data->attributes &= ~attribute;
 
         if ( ( attribute == AtomicPainter ) && on )
@@ -100,31 +99,31 @@
 
 /*!
-  \return True, when attribute is enabled
-  \param attribute Attribute to be tested
-  \sa Attribute, setAttribute()
-*/
+   \return True, when attribute is enabled
+   \param attribute Attribute to be tested
+   \sa Attribute, setAttribute()
+ */
 bool QwtPlotDirectPainter::testAttribute( Attribute attribute ) const
 {
-    return d_data->attributes & attribute;
-}
-
-/*!
-  En/Disables clipping
-
-  \param enable Enables clipping is true, disable it otherwise
-  \sa hasClipping(), clipRegion(), setClipRegion()
-*/
+    return m_data->attributes & attribute;
+}
+
+/*!
+   En/Disables clipping
+
+   \param enable Enables clipping is true, disable it otherwise
+   \sa hasClipping(), clipRegion(), setClipRegion()
+ */
 void QwtPlotDirectPainter::setClipping( bool enable )
 {
-    d_data->hasClipping = enable;
-}
-
-/*!
-  \return true, when clipping is enabled
-  \sa setClipping(), clipRegion(), setClipRegion()
-*/
+    m_data->hasClipping = enable;
+}
+
+/*!
+   \return true, when clipping is enabled
+   \sa setClipping(), clipRegion(), setClipRegion()
+ */
 bool QwtPlotDirectPainter::hasClipping() const
 {
-    return d_data->hasClipping;
+    return m_data->hasClipping;
 }
 
@@ -139,9 +138,9 @@
    \param region Clip region
    \sa clipRegion(), hasClipping(), setClipping()
-*/
-void QwtPlotDirectPainter::setClipRegion( const QRegion &region )
-{
-    d_data->clipRegion = region;
-    d_data->hasClipping = true;
+ */
+void QwtPlotDirectPainter::setClipRegion( const QRegion& region )
+{
+    m_data->clipRegion = region;
+    m_data->hasClipping = true;
 }
 
@@ -149,43 +148,43 @@
    \return Currently set clip region.
    \sa setClipRegion(), setClipping(), hasClipping()
-*/
+ */
 QRegion QwtPlotDirectPainter::clipRegion() const
 {
-    return d_data->clipRegion;
-}
-
-/*!
-  \brief Draw a set of points of a seriesItem.
-
-  When observing an measurement while it is running, new points have to be
-  added to an existing seriesItem. drawSeries() can be used to display them avoiding
-  a complete redraw of the canvas.
-
-  Setting plot()->canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true);
-  will result in faster painting, if the paint engine of the canvas widget
-  supports this feature.
-
-  \param seriesItem Item to be painted
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted. If to < 0 the
+    return m_data->clipRegion;
+}
+
+/*!
+   \brief Draw a set of points of a seriesItem.
+
+   When observing an measurement while it is running, new points have to be
+   added to an existing seriesItem. drawSeries() can be used to display them avoiding
+   a complete redraw of the canvas.
+
+   Setting plot()->canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true);
+   will result in faster painting, if the paint engine of the canvas widget
+   supports this feature.
+
+   \param seriesItem Item to be painted
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted. If to < 0 the
          series will be painted to its last point.
-*/
+ */
 void QwtPlotDirectPainter::drawSeries(
-    QwtPlotSeriesItem *seriesItem, int from, int to )
+    QwtPlotSeriesItem* seriesItem, int from, int to )
 {
     if ( seriesItem == NULL || seriesItem->plot() == NULL )
         return;
 
-    QWidget *canvas = seriesItem->plot()->canvas();
+    QWidget* canvas = seriesItem->plot()->canvas();
     const QRect canvasRect = canvas->contentsRect();
 
-    QwtPlotCanvas *plotCanvas = qobject_cast<QwtPlotCanvas *>( canvas );
+    QwtPlotCanvas* plotCanvas = qobject_cast< QwtPlotCanvas* >( canvas );
 
     if ( plotCanvas && qwtHasBackingStore( plotCanvas ) )
     {
-        QPainter painter( const_cast<QPixmap *>( plotCanvas->backingStore() ) );
-
-        if ( d_data->hasClipping )
-            painter.setClipRegion( d_data->clipRegion );
+        QPainter painter( const_cast< QPixmap* >( plotCanvas->backingStore() ) );
+
+        if ( m_data->hasClipping )
+            painter.setClipRegion( m_data->clipRegion );
 
         qwtRenderItem( &painter, canvasRect, seriesItem, from, to );
@@ -206,31 +205,31 @@
         if ( !canvas->testAttribute( Qt::WA_PaintOutsidePaintEvent ) )
 #endif
-            immediatePaint = false;
+        immediatePaint = false;
     }
 
     if ( immediatePaint )
     {
-        if ( !d_data->painter.isActive() )
+        if ( !m_data->painter.isActive() )
         {
             reset();
 
-            d_data->painter.begin( canvas );
+            m_data->painter.begin( canvas );
             canvas->installEventFilter( this );
         }
 
-        if ( d_data->hasClipping )
-        {
-            d_data->painter.setClipRegion(
-                QRegion( canvasRect ) & d_data->clipRegion );
+        if ( m_data->hasClipping )
+        {
+            m_data->painter.setClipRegion(
+                QRegion( canvasRect ) & m_data->clipRegion );
         }
         else
         {
-            if ( !d_data->painter.hasClipping() )
-                d_data->painter.setClipRect( canvasRect );
-        }
-
-        qwtRenderItem( &d_data->painter, canvasRect, seriesItem, from, to );
-
-        if ( d_data->attributes & QwtPlotDirectPainter::AtomicPainter )
+            if ( !m_data->painter.hasClipping() )
+                m_data->painter.setClipRect( canvasRect );
+        }
+
+        qwtRenderItem( &m_data->painter, canvasRect, seriesItem, from, to );
+
+        if ( m_data->attributes & QwtPlotDirectPainter::AtomicPainter )
         {
             reset();
@@ -238,6 +237,6 @@
         else
         {
-            if ( d_data->hasClipping )
-                d_data->painter.setClipping( false );
+            if ( m_data->hasClipping )
+                m_data->painter.setClipping( false );
         }
     }
@@ -246,11 +245,11 @@
         reset();
 
-        d_data->seriesItem = seriesItem;
-        d_data->from = from;
-        d_data->to = to;
+        m_data->seriesItem = seriesItem;
+        m_data->from = from;
+        m_data->to = to;
 
         QRegion clipRegion = canvasRect;
-        if ( d_data->hasClipping )
-            clipRegion &= d_data->clipRegion;
+        if ( m_data->hasClipping )
+            clipRegion &= m_data->clipRegion;
 
         canvas->installEventFilter( this );
@@ -258,5 +257,5 @@
         canvas->removeEventFilter( this );
 
-        d_data->seriesItem = NULL;
+        m_data->seriesItem = NULL;
     }
 }
@@ -265,16 +264,16 @@
 void QwtPlotDirectPainter::reset()
 {
-    if ( d_data->painter.isActive() )
-    {
-        QWidget *w = static_cast<QWidget *>( d_data->painter.device() );
+    if ( m_data->painter.isActive() )
+    {
+        QWidget* w = static_cast< QWidget* >( m_data->painter.device() );
         if ( w )
             w->removeEventFilter( this );
 
-        d_data->painter.end();
+        m_data->painter.end();
     }
 }
 
 //! Event filter
-bool QwtPlotDirectPainter::eventFilter( QObject *, QEvent *event )
+bool QwtPlotDirectPainter::eventFilter( QObject*, QEvent* event )
 {
     if ( event->type() == QEvent::Paint )
@@ -282,9 +281,9 @@
         reset();
 
-        if ( d_data->seriesItem )
-        {
-            const QPaintEvent *pe = static_cast< QPaintEvent *>( event );
-
-            QWidget *canvas = d_data->seriesItem->plot()->canvas();
+        if ( m_data->seriesItem )
+        {
+            const QPaintEvent* pe = static_cast< QPaintEvent* >( event );
+
+            QWidget* canvas = m_data->seriesItem->plot()->canvas();
 
             QPainter painter( canvas );
@@ -295,6 +294,6 @@
             if ( doCopyCache )
             {
-                QwtPlotCanvas *plotCanvas =
-                    qobject_cast<QwtPlotCanvas *>( canvas );
+                QwtPlotCanvas* plotCanvas =
+                    qobject_cast< QwtPlotCanvas* >( canvas );
                 if ( plotCanvas )
                 {
@@ -311,5 +310,5 @@
             {
                 qwtRenderItem( &painter, canvas->contentsRect(),
-                    d_data->seriesItem, d_data->from, d_data->to );
+                    m_data->seriesItem, m_data->from, m_data->to );
             }
 
Index: /trunk/BNC/qwt/qwt_plot_directpainter.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_directpainter.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_directpainter.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -36,43 +36,42 @@
              by another operation ( like changing scales ) and nothing needs
              to be erased.
-*/
-class QWT_EXPORT QwtPlotDirectPainter: public QObject
+ */
+class QWT_EXPORT QwtPlotDirectPainter : public QObject
 {
-public:
+  public:
     /*!
-      \brief Paint attributes
-      \sa setAttribute(), testAttribute(), drawSeries()
-    */
+       \brief Paint attributes
+       \sa setAttribute(), testAttribute(), drawSeries()
+     */
     enum Attribute
     {
         /*!
-          Initializing a QPainter is an expensive operation.
-          When AtomicPainter is set each call of drawSeries() opens/closes
-          a temporary QPainter. Otherwise QwtPlotDirectPainter tries to
-          use the same QPainter as long as possible.
+           Initializing a QPainter is an expensive operation.
+           When AtomicPainter is set each call of drawSeries() opens/closes
+           a temporary QPainter. Otherwise QwtPlotDirectPainter tries to
+           use the same QPainter as long as possible.
          */
         AtomicPainter = 0x01,
 
         /*!
-          When FullRepaint is set the plot canvas is explicitly repainted
-          after the samples have been rendered.
+           When FullRepaint is set the plot canvas is explicitly repainted
+           after the samples have been rendered.
          */
         FullRepaint = 0x02,
 
         /*!
-          When QwtPlotCanvas::BackingStore is enabled the painter
-          has to paint to the backing store and the widget. In certain
-          situations/environments it might be faster to paint to
-          the backing store only and then copy the backing store to the canvas.
-          This flag can also be useful for settings, where Qt fills the
-          the clip region with the widget background.
+           When QwtPlotCanvas::BackingStore is enabled the painter
+           has to paint to the backing store and the widget. In certain
+           situations/environments it might be faster to paint to
+           the backing store only and then copy the backing store to the canvas.
+           This flag can also be useful for settings, where Qt fills the
+           the clip region with the widget background.
          */
         CopyBackingStore = 0x04
     };
 
-    //! Paint attributes
-    typedef QFlags<Attribute> Attributes;
+    Q_DECLARE_FLAGS( Attributes, Attribute )
 
-    QwtPlotDirectPainter( QObject *parent = NULL );
+    explicit QwtPlotDirectPainter( QObject* parent = NULL );
     virtual ~QwtPlotDirectPainter();
 
@@ -83,15 +82,15 @@
     bool hasClipping() const;
 
-    void setClipRegion( const QRegion & );
+    void setClipRegion( const QRegion& );
     QRegion clipRegion() const;
 
-    void drawSeries( QwtPlotSeriesItem *, int from, int to );
+    void drawSeries( QwtPlotSeriesItem*, int from, int to );
     void reset();
 
-    virtual bool eventFilter( QObject *, QEvent * );
+    virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_glcanvas.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_glcanvas.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_glcanvas.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,76 +11,65 @@
 #include "qwt_plot.h"
 #include "qwt_painter.h"
-#include <qevent.h>
+
+#include <qcoreevent.h>
 #include <qpainter.h>
-#include <qdrawutil.h>
-#include <qstyle.h>
-#include <qstyleoption.h>
-
-#define FIX_GL_TRANSLATION 0
-
-static QWidget *qwtBGWidget( QWidget *widget )
-{
-    QWidget *w = widget;
-
-    for ( ; w->parentWidget() != NULL; w = w->parentWidget() )
-    {
-        if ( w->autoFillBackground() ||
-            w->testAttribute( Qt::WA_StyledBackground ) )
-        {
-            return w;
-        }
-    }
-
-    return w;
-}
-
-static void qwtUpdateContentsRect( QwtPlotGLCanvas *canvas )
-{
-    const int fw = canvas->frameWidth();
-    canvas->setContentsMargins( fw, fw, fw, fw );
+#include <qpainterpath.h>
+#include <qglframebufferobject.h>
+
+namespace
+{
+    class QwtPlotGLCanvasFormat : public QGLFormat
+    {
+      public:
+        QwtPlotGLCanvasFormat()
+            : QGLFormat( QGLFormat::defaultFormat() )
+        {
+            setSampleBuffers( true );
+        }
+    };
 }
 
 class QwtPlotGLCanvas::PrivateData
 {
-public:
-    PrivateData():
-        frameStyle( QFrame::Panel | QFrame::Sunken),
-        lineWidth( 2 ),
-        midLineWidth( 0 )
-    {
-    }
-
-    int frameStyle;
-    int lineWidth;
-    int midLineWidth;
+  public:
+    PrivateData()
+        : fboDirty( true )
+        , fbo( NULL )
+    {
+    }
+
+    ~PrivateData()
+    {
+        delete fbo;
+    }
+
+    bool fboDirty;
+    QGLFramebufferObject* fbo;
 };
 
-class QwtPlotGLCanvasFormat: public QGLFormat
-{
-public:
-    QwtPlotGLCanvasFormat():
-        QGLFormat( QGLFormat::defaultFormat() )
-    {
-        setSampleBuffers( true );
-    }
-};
-
-/*!
-  \brief Constructor
-
-  \param plot Parent plot widget
-  \sa QwtPlot::setCanvas()
-*/
-QwtPlotGLCanvas::QwtPlotGLCanvas( QwtPlot *plot ):
-    QGLWidget( QwtPlotGLCanvasFormat(), plot )
-{
-    d_data = new PrivateData;
-
-#ifndef QT_NO_CURSOR
-    setCursor( Qt::CrossCursor );
-#endif
-
-    setAutoFillBackground( true );
-    qwtUpdateContentsRect( this );
+/*!
+   \brief Constructor
+
+   \param plot Parent plot widget
+   \sa QwtPlot::setCanvas()
+ */
+QwtPlotGLCanvas::QwtPlotGLCanvas( QwtPlot* plot )
+    : QGLWidget( QwtPlotGLCanvasFormat(), plot )
+    , QwtPlotAbstractGLCanvas( this )
+{
+    init();
+}
+/*!
+   \brief Constructor
+
+   \param format OpenGL rendering options
+   \param plot Parent plot widget
+   \sa QwtPlot::setCanvas()
+ */
+QwtPlotGLCanvas::QwtPlotGLCanvas( const QGLFormat& format, QwtPlot* plot )
+    : QGLWidget( format, plot )
+    , QwtPlotAbstractGLCanvas( this )
+{
+    init();
 }
 
@@ -88,174 +77,36 @@
 QwtPlotGLCanvas::~QwtPlotGLCanvas()
 {
-    delete d_data;
-}
-
-/*!
-  Set the frame style
-
-  \param style The bitwise OR between a shape and a shadow.
-
-  \sa frameStyle(), QFrame::setFrameStyle(),
-      setFrameShadow(), setFrameShape()
- */
-void QwtPlotGLCanvas::setFrameStyle( int style )
-{
-    if ( style != d_data->frameStyle )
-    {
-        d_data->frameStyle = style;
-        qwtUpdateContentsRect( this );
-
-        update();
-    }
-}
-
-/*!
-  \return The bitwise OR between a frameShape() and a frameShadow()
-  \sa setFrameStyle(), QFrame::frameStyle()
- */
-int QwtPlotGLCanvas::frameStyle() const
-{
-    return d_data->frameStyle;
-}
-
-/*!
-  Set the frame shadow
-
-  \param shadow Frame shadow
-  \sa frameShadow(), setFrameShape(), QFrame::setFrameShadow()
- */
-void QwtPlotGLCanvas::setFrameShadow( Shadow shadow )
-{
-    setFrameStyle(( d_data->frameStyle & QFrame::Shape_Mask ) | shadow );
-}
-
-/*!
-  \return Frame shadow
-  \sa setFrameShadow(), QFrame::setFrameShadow()
- */
-QwtPlotGLCanvas::Shadow QwtPlotGLCanvas::frameShadow() const
-{
-    return (Shadow) ( d_data->frameStyle & QFrame::Shadow_Mask );
-}
-
-/*!
-  Set the frame shape
-
-  \param shape Frame shape
-  \sa frameShape(), setFrameShadow(), QFrame::frameShape()
- */
-void QwtPlotGLCanvas::setFrameShape( Shape shape )
-{
-    setFrameStyle( ( d_data->frameStyle & QFrame::Shadow_Mask ) | shape );
-}
-
-/*!
-  \return Frame shape
-  \sa setFrameShape(), QFrame::frameShape()
- */
-QwtPlotGLCanvas::Shape QwtPlotGLCanvas::frameShape() const
-{
-    return (Shape) ( d_data->frameStyle & QFrame::Shape_Mask );
-}
-
-/*!
-   Set the frame line width
-
-   The default line width is 2 pixels.
-
-   \param width Line width of the frame
-   \sa lineWidth(), setMidLineWidth()
-*/
-void QwtPlotGLCanvas::setLineWidth( int width )
-{
-    width = qMax( width, 0 );
-    if ( width != d_data->lineWidth )
-    {
-        d_data->lineWidth = qMax( width, 0 );
-        qwtUpdateContentsRect( this );
-        update();
-    }
-}
-
-/*!
-  \return Line width of the frame
-  \sa setLineWidth(), midLineWidth()
- */
-int QwtPlotGLCanvas::lineWidth() const
-{
-    return d_data->lineWidth;
-}
-
-/*!
-   Set the frame mid line width
-
-   The default midline width is 0 pixels.
-
-   \param width Midline width of the frame
-   \sa midLineWidth(), setLineWidth()
-*/
-void QwtPlotGLCanvas::setMidLineWidth( int width )
-{
-    width = qMax( width, 0 );
-    if ( width != d_data->midLineWidth )
-    {
-        d_data->midLineWidth = width;
-        qwtUpdateContentsRect( this );
-        update();
-    }
-}
-
-/*!
-  \return Midline width of the frame
-  \sa setMidLineWidth(), lineWidth()
- */
-int QwtPlotGLCanvas::midLineWidth() const
-{
-    return d_data->midLineWidth;
-}
-
-/*!
-  \return Frame width depending on the style, line width and midline width.
- */
-int QwtPlotGLCanvas::frameWidth() const
-{
-    return ( frameStyle() != NoFrame ) ? d_data->lineWidth : 0;
-}
-
-/*!
-  Paint event
-
-  \param event Paint event
-  \sa QwtPlot::drawCanvas()
-*/
-void QwtPlotGLCanvas::paintEvent( QPaintEvent *event )
-{
-    Q_UNUSED( event );
-
-    QPainter painter( this );
-
-#if FIX_GL_TRANSLATION
-    if ( painter.paintEngine()->type() == QPaintEngine::OpenGL2 )
-    {
-        // work around a translation bug of QPaintEngine::OpenGL2
-        painter.translate( 1, 1 );
-    }
+    delete m_data;
+}
+
+void QwtPlotGLCanvas::init()
+{
+    m_data = new PrivateData;
+
+#if 1
+    setAttribute( Qt::WA_OpaquePaintEvent, true );
 #endif
-
-    drawBackground( &painter );
-    drawItems( &painter );
-
-    if ( !testAttribute( Qt::WA_StyledBackground ) )
-    {
-        if ( frameWidth() > 0 )
-            drawBorder( &painter );
-    }
-}
-/*!
-  Qt event handler for QEvent::PolishRequest and QEvent::StyleChange
-  \param event Qt Event
-  \return See QGLWidget::event()
-*/
-bool QwtPlotGLCanvas::event( QEvent *event )
+    setLineWidth( 2 );
+    setFrameShadow( QFrame::Sunken );
+    setFrameShape( QFrame::Panel );
+}
+
+/*!
+   Paint event
+
+   \param event Paint event
+   \sa QwtPlot::drawCanvas()
+ */
+void QwtPlotGLCanvas::paintEvent( QPaintEvent* event )
+{
+    QGLWidget::paintEvent( event );
+}
+
+/*!
+   Qt event handler for QEvent::PolishRequest and QEvent::StyleChange
+   \param event Qt Event
+   \return See QGLWidget::event()
+ */
+bool QwtPlotGLCanvas::event( QEvent* event )
 {
     const bool ok = QGLWidget::event( event );
@@ -275,103 +126,113 @@
 
 /*!
-  Draw the plot items
-  \param painter Painter
-
-  \sa QwtPlot::drawCanvas()
-*/
-void QwtPlotGLCanvas::drawItems( QPainter *painter )
-{
-    painter->save();
-
-    painter->setClipRect( contentsRect(), Qt::IntersectClip );
-
-    QwtPlot *plot = qobject_cast< QwtPlot *>( parent() );
-    if ( plot )
-        plot->drawCanvas( painter );
-
-    painter->restore();
-}
-
-/*!
-  Draw the background of the canvas
-  \param painter Painter
-*/
-void QwtPlotGLCanvas::drawBackground( QPainter *painter )
-{
-    painter->save();
-
-    QWidget *w = qwtBGWidget( this );
-
-    const QPoint off = mapTo( w, QPoint() );
-    painter->translate( -off );
-
-    const QRect fillRect = rect().translated( off );
-
-    if ( w->testAttribute( Qt::WA_StyledBackground ) )
-    {
-        painter->setClipRect( fillRect );
-
-        QStyleOption opt;
-        opt.initFrom( w );
-        w->style()->drawPrimitive( QStyle::PE_Widget, &opt, painter, w);
+   Invalidate the paint cache and repaint the canvas
+   \sa invalidatePaintCache()
+ */
+void QwtPlotGLCanvas::replot()
+{
+    QwtPlotAbstractGLCanvas::replot();
+}
+
+//! Invalidate the internal backing store
+void QwtPlotGLCanvas::invalidateBackingStore()
+{
+    m_data->fboDirty = true;
+}
+
+void QwtPlotGLCanvas::clearBackingStore()
+{
+    delete m_data->fbo;
+    m_data->fbo = NULL;
+}
+
+/*!
+   Calculate the painter path for a styled or rounded border
+
+   When the canvas has no styled background or rounded borders
+   the painter path is empty.
+
+   \param rect Bounding rectangle of the canvas
+   \return Painter path, that can be used for clipping
+ */
+QPainterPath QwtPlotGLCanvas::borderPath( const QRect& rect ) const
+{
+    return canvasBorderPath( rect );
+}
+
+//! No operation - reserved for some potential use in the future
+void QwtPlotGLCanvas::initializeGL()
+{
+}
+
+//! Paint the plot
+void QwtPlotGLCanvas::paintGL()
+{
+    const bool hasFocusIndicator =
+        hasFocus() && focusIndicator() == CanvasFocusIndicator;
+
+    QPainter painter;
+
+    if ( testPaintAttribute( QwtPlotGLCanvas::BackingStore ) )
+    {
+        const qreal pixelRatio = QwtPainter::devicePixelRatio( this );
+        const QRect rect( 0, 0, width() * pixelRatio, height() * pixelRatio );
+
+        if ( hasFocusIndicator )
+            painter.begin( this );
+
+        if ( m_data->fbo )
+        {
+            if ( m_data->fbo->size() != rect.size() )
+            {
+                delete m_data->fbo;
+                m_data->fbo = NULL;
+            }
+        }
+
+        if ( m_data->fbo == NULL )
+        {
+            QGLFramebufferObjectFormat format;
+            format.setSamples( 4 );
+            format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
+
+            m_data->fbo = new QGLFramebufferObject( rect.size(), format );
+            m_data->fboDirty = true;
+        }
+
+        if ( m_data->fboDirty )
+        {
+            QPainter fboPainter( m_data->fbo );
+            fboPainter.scale( pixelRatio, pixelRatio );
+            draw( &fboPainter );
+            fboPainter.end();
+
+            m_data->fboDirty = false;
+        }
+
+        /*
+            Why do we have this strange translation - but, anyway
+            QwtPlotGLCanvas in combination with scaling factor
+            is not very likely to happen as using QwtPlotOpenGLCanvas
+            usually makes more sense then.
+         */
+
+        QGLFramebufferObject::blitFramebuffer( NULL,
+            rect.translated( 0, height() - rect.height() ), m_data->fbo, rect );
     }
     else
     {
-        painter->fillRect( fillRect,
-            w->palette().brush( w->backgroundRole() ) );
-    }
-
-    painter->restore();
-}
-
-/*!
-  Draw the border of the canvas
-  \param painter Painter
-*/
-void QwtPlotGLCanvas::drawBorder( QPainter *painter )
-{
-    const int fw = frameWidth();
-    if ( fw <= 0 )
-        return;
-
-    if ( frameShadow() == QwtPlotGLCanvas::Plain )
-    {
-        qDrawPlainRect( painter, frameRect(),
-            palette().shadow().color(), lineWidth() );
-    }
-    else
-    {
-        if ( frameShape() == QwtPlotGLCanvas::Box )
-        {
-            qDrawShadeRect( painter, frameRect(), palette(),
-                frameShadow() == Sunken, lineWidth(), midLineWidth() );
-        }
-        else
-        {
-            qDrawShadePanel( painter, frameRect(), palette(),
-                frameShadow() == Sunken, lineWidth() );
-        }
-    }
-}
-
-//! Calls repaint()
-void QwtPlotGLCanvas::replot()
-{
-    repaint();
-}
-
-/*!
-   \return Empty path
-*/
-QPainterPath QwtPlotGLCanvas::borderPath( const QRect &rect ) const
-{
-    Q_UNUSED( rect );
-    return QPainterPath();
-}
-
-//! \return The rectangle where the frame is drawn in.
-QRect QwtPlotGLCanvas::frameRect() const
-{
-    const int fw = frameWidth();
-    return contentsRect().adjusted( -fw, -fw, fw, fw );
-}
+        painter.begin( this );
+        draw( &painter );
+    }
+
+    if ( hasFocusIndicator )
+        drawFocusIndicator( &painter );
+}
+
+//! No operation - reserved for some potential use in the future
+void QwtPlotGLCanvas::resizeGL( int, int )
+{
+    // nothing to do
+}
+
+#include "moc_qwt_plot_glcanvas.cpp"
Index: /trunk/BNC/qwt/qwt_plot_glcanvas.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_glcanvas.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_glcanvas.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,36 +12,41 @@
 
 #include "qwt_global.h"
-#include <qframe.h>
+#include "qwt_plot_abstract_canvas.h"
+
 #include <qgl.h>
-#include <qpainterpath.h>
 
 class QwtPlot;
 
 /*!
-  \brief An alternative canvas for a QwtPlot derived from QGLWidget
+   \brief An alternative canvas for a QwtPlot derived from QGLWidget
 
-  QwtPlotGLCanvas implements the very basics to act as canvas
-  inside of a QwtPlot widget. It might be extended to a full
-  featured alternative to QwtPlotCanvas in a future version of Qwt.
+   QwtPlotGLCanvas implements the very basics to act as canvas
+   inside of a QwtPlot widget. It might be extended to a full
+   featured alternative to QwtPlotCanvas in a future version of Qwt.
 
-  Even if QwtPlotGLCanvas is not derived from QFrame it imitates
-  its API. When using style sheets it supports the box model - beside
-  backgrounds with rounded borders.
+   Even if QwtPlotGLCanvas is not derived from QFrame it imitates
+   its API. When using style sheets it supports the box model - beside
+   backgrounds with rounded borders.
 
-  \sa QwtPlot::setCanvas(), QwtPlotCanvas
+   Since Qt 5.4 QOpenGLWidget is available, that is used by QwtPlotOpenGLCanvas.
 
-  \note With Qt4 you might want to use the QPaintEngine::OpenGL paint engine
+   \sa QwtPlot::setCanvas(), QwtPlotCanvas, QwtPlotOpenGLCanvas
+
+   \note With Qt4 you might want to use the QPaintEngine::OpenGL paint engine
         ( see QGL::setPreferredPaintEngine() ). On a Linux test system
         QPaintEngine::OpenGL2 shows very basic problems like translated
         geometries.
-*/
-class QWT_EXPORT QwtPlotGLCanvas: public QGLWidget
+
+   \note Another way for getting hardware accelerated graphics is using
+        an OpenGL offscreen buffer ( QwtPlotCanvas::OpenGLBuffer ) with QwtPlotCanvas.
+        Performance is worse, than rendering straight to a QGLWidget, but is usually
+        better integrated into a desktop application.
+ */
+class QWT_EXPORT QwtPlotGLCanvas : public QGLWidget, public QwtPlotAbstractGLCanvas
 {
     Q_OBJECT
 
-    Q_ENUMS( Shape Shadow )
-
-    Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow )
-    Q_PROPERTY( Shape frameShape READ frameShape WRITE setFrameShape )
+    Q_PROPERTY( QFrame::Shadow frameShadow READ frameShadow WRITE setFrameShadow )
+    Q_PROPERTY( QFrame::Shape frameShape READ frameShape WRITE setFrameShape )
     Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
     Q_PROPERTY( int midLineWidth READ midLineWidth WRITE setMidLineWidth )
@@ -49,82 +54,32 @@
     Q_PROPERTY( QRect frameRect READ frameRect DESIGNABLE false )
 
-public:
-    /*!
-        \brief Frame shadow
+    Q_PROPERTY( double borderRadius READ borderRadius WRITE setBorderRadius )
 
-         Unfortunately it is not possible to use QFrame::Shadow
-         as a property of a widget that is not derived from QFrame.
-         The following enum is made for the designer only. It is safe
-         to use QFrame::Shadow instead.
-     */
-    enum Shadow
-    {
-        //! QFrame::Plain
-        Plain = QFrame::Plain,
-
-        //! QFrame::Raised
-        Raised = QFrame::Raised,
-
-        //! QFrame::Sunken
-        Sunken = QFrame::Sunken
-    };
-
-    /*!
-        \brief Frame shape
-
-        Unfortunately it is not possible to use QFrame::Shape
-        as a property of a widget that is not derived from QFrame.
-        The following enum is made for the designer only. It is safe
-        to use QFrame::Shadow instead.
-
-        \note QFrame::StyledPanel and QFrame::WinPanel are unsupported
-              and will be displayed as QFrame::Panel.
-     */
-    enum Shape
-    {
-        NoFrame = QFrame::NoFrame,
-
-        Box = QFrame::Box,
-        Panel = QFrame::Panel
-    };
-
-    explicit QwtPlotGLCanvas( QwtPlot * = NULL );
+  public:
+    explicit QwtPlotGLCanvas( QwtPlot* = NULL );
+    explicit QwtPlotGLCanvas( const QGLFormat&, QwtPlot* = NULL );
     virtual ~QwtPlotGLCanvas();
 
-    void setFrameStyle( int style );
-    int frameStyle() const;
+    Q_INVOKABLE virtual void invalidateBackingStore() QWT_OVERRIDE;
+    Q_INVOKABLE QPainterPath borderPath( const QRect& ) const;
 
-    void setFrameShadow( Shadow );
-    Shadow frameShadow() const;
+    virtual bool event( QEvent* ) QWT_OVERRIDE;
 
-    void setFrameShape( Shape );
-    Shape frameShape() const;
-
-    void setLineWidth( int );
-    int lineWidth() const;
-
-    void setMidLineWidth( int );
-    int midLineWidth() const;
-
-    int frameWidth() const;
-    QRect frameRect() const;
-
-    Q_INVOKABLE QPainterPath borderPath( const QRect & ) const;
-
-    virtual bool event( QEvent * );
-
-public Q_SLOTS:
+  public Q_SLOTS:
     void replot();
 
-protected:
-    virtual void paintEvent( QPaintEvent * );
+  protected:
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
 
-    virtual void drawBackground( QPainter * );
-    virtual void drawBorder( QPainter * );
-    virtual void drawItems( QPainter * );
+    virtual void initializeGL() QWT_OVERRIDE;
+    virtual void paintGL() QWT_OVERRIDE;
+    virtual void resizeGL( int width, int height ) QWT_OVERRIDE;
 
-private:
+  private:
+    void init();
+    virtual void clearBackingStore() QWT_OVERRIDE;
+
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_graphicitem.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_graphicitem.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_plot_graphicitem.cpp	(revision 11158)
@@ -0,0 +1,136 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_plot_graphicitem.h"
+#include "qwt_scale_map.h"
+#include "qwt_painter.h"
+#include "qwt_text.h"
+#include "qwt_graphic.h"
+
+class QwtPlotGraphicItem::PrivateData
+{
+  public:
+    QRectF boundingRect;
+    QwtGraphic graphic;
+};
+
+/*!
+   \brief Constructor
+
+   Sets the following item attributes:
+   - QwtPlotItem::AutoScale: true
+   - QwtPlotItem::Legend:    false
+
+   \param title Title
+ */
+QwtPlotGraphicItem::QwtPlotGraphicItem( const QString& title )
+    : QwtPlotItem( QwtText( title ) )
+{
+    init();
+}
+
+/*!
+   \brief Constructor
+
+   Sets the following item attributes:
+   - QwtPlotItem::AutoScale: true
+   - QwtPlotItem::Legend:    false
+
+   \param title Title
+ */
+QwtPlotGraphicItem::QwtPlotGraphicItem( const QwtText& title )
+    : QwtPlotItem( title )
+{
+    init();
+}
+
+//! Destructor
+QwtPlotGraphicItem::~QwtPlotGraphicItem()
+{
+    delete m_data;
+}
+
+void QwtPlotGraphicItem::init()
+{
+    m_data = new PrivateData();
+    m_data->boundingRect = QwtPlotItem::boundingRect();
+
+    setItemAttribute( QwtPlotItem::AutoScale, true );
+    setItemAttribute( QwtPlotItem::Legend, false );
+
+    setZ( 8.0 );
+}
+
+//! \return QwtPlotItem::Rtti_PlotGraphic
+int QwtPlotGraphicItem::rtti() const
+{
+    return QwtPlotItem::Rtti_PlotGraphic;
+}
+
+/*!
+   Set the graphic to be displayed
+
+   \param rect Rectangle in plot coordinates
+   \param graphic Recorded sequence of painter commands
+ */
+void QwtPlotGraphicItem::setGraphic(
+    const QRectF& rect, const QwtGraphic& graphic )
+{
+    m_data->boundingRect = rect;
+    m_data->graphic = graphic;
+
+    legendChanged();
+    itemChanged();
+}
+
+/*!
+   \return Recorded sequence of painter commands
+   \sa setGraphic()
+ */
+QwtGraphic QwtPlotGraphicItem::graphic() const
+{
+    return m_data->graphic;
+}
+
+//! Bounding rectangle of the item
+QRectF QwtPlotGraphicItem::boundingRect() const
+{
+    return m_data->boundingRect;
+}
+
+/*!
+   Draw the item
+
+   \param painter Painter
+   \param xMap X-Scale Map
+   \param yMap Y-Scale Map
+   \param canvasRect Contents rect of the plot canvas
+ */
+void QwtPlotGraphicItem::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
+{
+    if ( m_data->graphic.isEmpty() )
+        return;
+
+    QRectF r = QwtScaleMap::transform( xMap, yMap, boundingRect() );
+
+    if ( !r.intersects( canvasRect ) )
+        return;
+
+    if ( QwtPainter::roundingAlignment( painter ) )
+    {
+        r.setLeft ( qRound( r.left() ) );
+        r.setRight ( qRound( r.right() ) );
+        r.setTop ( qRound( r.top() ) );
+        r.setBottom ( qRound( r.bottom() ) );
+    }
+
+    m_data->graphic.render( painter, r );
+}
Index: /trunk/BNC/qwt/qwt_plot_graphicitem.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_graphicitem.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_plot_graphicitem.h	(revision 11158)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_PLOT_GRAPHIC_ITEM_H
+#define QWT_PLOT_GRAPHIC_ITEM_H
+
+#include "qwt_global.h"
+#include "qwt_plot_item.h"
+
+#include <qstring.h>
+
+/*!
+   \brief A plot item, which displays
+         a recorded sequence of QPainter commands
+
+   QwtPlotGraphicItem renders a sequence of recorded painter commands
+   into a specific plot area. Recording of painter commands can be
+   done manually by QPainter or e.g. QSvgRenderer.
+
+   \sa QwtPlotShapeItem, QwtPlotSvgItem
+ */
+
+class QWT_EXPORT QwtPlotGraphicItem : public QwtPlotItem
+{
+  public:
+    explicit QwtPlotGraphicItem( const QString& title = QString() );
+    explicit QwtPlotGraphicItem( const QwtText& title );
+
+    virtual ~QwtPlotGraphicItem();
+
+    void setGraphic( const QRectF& rect, const QwtGraphic& );
+    QwtGraphic graphic() const;
+
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
+
+    virtual void draw( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
+
+    virtual int rtti() const QWT_OVERRIDE;
+
+  private:
+    void init();
+
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_plot_grid.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_grid.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_grid.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,16 +13,21 @@
 #include "qwt_scale_map.h"
 #include "qwt_scale_div.h"
-#include "qwt_math.h"
+
 #include <qpainter.h>
 #include <qpen.h>
 
+static inline bool qwtFuzzyGreaterOrEqual( double d1, double d2 )
+{
+    return ( d1 >= d2 ) || qFuzzyCompare( d1, d2 );
+}
+
 class QwtPlotGrid::PrivateData
 {
-public:
-    PrivateData():
-        xEnabled( true ),
-        yEnabled( true ),
-        xMinEnabled( false ),
-        yMinEnabled( false )
+  public:
+    PrivateData()
+        : xEnabled( true )
+        , yEnabled( true )
+        , xMinEnabled( false )
+        , yMinEnabled( false )
     {
     }
@@ -41,8 +46,8 @@
 
 //! Enables major grid, disables minor grid
-QwtPlotGrid::QwtPlotGrid():
-    QwtPlotItem( QwtText( "Grid" ) )
-{
-    d_data = new PrivateData;
+QwtPlotGrid::QwtPlotGrid()
+    : QwtPlotItem( QwtText( "Grid" ) )
+{
+    m_data = new PrivateData;
 
     setItemInterest( QwtPlotItem::ScaleInterest, true );
@@ -53,5 +58,5 @@
 QwtPlotGrid::~QwtPlotGrid()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -63,111 +68,111 @@
 
 /*!
-  \brief Enable or disable vertical grid lines
-  \param on Enable (true) or disable
-
-  \sa Minor grid lines can be enabled or disabled with
+   \brief Enable or disable vertical grid lines
+   \param on Enable (true) or disable
+
+   \sa Minor grid lines can be enabled or disabled with
       enableXMin()
-*/
+ */
 void QwtPlotGrid::enableX( bool on )
 {
-    if ( d_data->xEnabled != on )
-    {
-        d_data->xEnabled = on;
-
-        legendChanged();
-        itemChanged();
-    }
-}
-
-/*!
-  \brief Enable or disable horizontal grid lines
-  \param on Enable (true) or disable
-  \sa Minor grid lines can be enabled or disabled with enableYMin()
-*/
+    if ( m_data->xEnabled != on )
+    {
+        m_data->xEnabled = on;
+
+        legendChanged();
+        itemChanged();
+    }
+}
+
+/*!
+   \brief Enable or disable horizontal grid lines
+   \param on Enable (true) or disable
+   \sa Minor grid lines can be enabled or disabled with enableYMin()
+ */
 void QwtPlotGrid::enableY( bool on )
 {
-    if ( d_data->yEnabled != on )
-    {
-        d_data->yEnabled = on;
-
-        legendChanged();
-        itemChanged();
-    }
-}
-
-/*!
-  \brief Enable or disable  minor vertical grid lines.
-  \param on Enable (true) or disable
-  \sa enableX()
-*/
+    if ( m_data->yEnabled != on )
+    {
+        m_data->yEnabled = on;
+
+        legendChanged();
+        itemChanged();
+    }
+}
+
+/*!
+   \brief Enable or disable  minor vertical grid lines.
+   \param on Enable (true) or disable
+   \sa enableX()
+ */
 void QwtPlotGrid::enableXMin( bool on )
 {
-    if ( d_data->xMinEnabled != on )
-    {
-        d_data->xMinEnabled = on;
-
-        legendChanged();
-        itemChanged();
-    }
-}
-
-/*!
-  \brief Enable or disable minor horizontal grid lines
-  \param on Enable (true) or disable
-  \sa enableY()
-*/
+    if ( m_data->xMinEnabled != on )
+    {
+        m_data->xMinEnabled = on;
+
+        legendChanged();
+        itemChanged();
+    }
+}
+
+/*!
+   \brief Enable or disable minor horizontal grid lines
+   \param on Enable (true) or disable
+   \sa enableY()
+ */
 void QwtPlotGrid::enableYMin( bool on )
 {
-    if ( d_data->yMinEnabled != on )
-    {
-        d_data->yMinEnabled = on;
-
-        legendChanged();
-        itemChanged();
-    }
-}
-
-/*!
-  Assign an x axis scale division
-
-  \param scaleDiv Scale division
-*/
-void QwtPlotGrid::setXDiv( const QwtScaleDiv &scaleDiv )
-{
-    if ( d_data->xScaleDiv != scaleDiv )
-    {
-        d_data->xScaleDiv = scaleDiv;
-        itemChanged();
-    }
-}
-
-/*!
-  Assign a y axis division
-
-  \param scaleDiv Scale division
-*/
-void QwtPlotGrid::setYDiv( const QwtScaleDiv &scaleDiv )
-{
-    if ( d_data->yScaleDiv != scaleDiv )
-    {
-        d_data->yScaleDiv = scaleDiv;
-        itemChanged();
-    }
-}
-
-/*!
-  Build and assign a pen for both major and minor grid lines
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtPlotGrid::setPen( const QColor &color, qreal width, Qt::PenStyle style )
+    if ( m_data->yMinEnabled != on )
+    {
+        m_data->yMinEnabled = on;
+
+        legendChanged();
+        itemChanged();
+    }
+}
+
+/*!
+   Assign an x axis scale division
+
+   \param scaleDiv Scale division
+ */
+void QwtPlotGrid::setXDiv( const QwtScaleDiv& scaleDiv )
+{
+    if ( m_data->xScaleDiv != scaleDiv )
+    {
+        m_data->xScaleDiv = scaleDiv;
+        itemChanged();
+    }
+}
+
+/*!
+   Assign a y axis division
+
+   \param scaleDiv Scale division
+ */
+void QwtPlotGrid::setYDiv( const QwtScaleDiv& scaleDiv )
+{
+    if ( m_data->yScaleDiv != scaleDiv )
+    {
+        m_data->yScaleDiv = scaleDiv;
+        itemChanged();
+    }
+}
+
+/*!
+   Build and assign a pen for both major and minor grid lines
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtPlotGrid::setPen( const QColor& color, qreal width, Qt::PenStyle style )
 {
     setPen( QPen( color, width, style ) );
@@ -175,35 +180,35 @@
 
 /*!
-  Assign a pen for both major and minor grid lines
-
-  \param pen Pen
-  \sa setMajorPen(), setMinorPen()
-*/
-void QwtPlotGrid::setPen( const QPen &pen )
-{
-    if ( d_data->majorPen != pen || d_data->minorPen != pen )
-    {
-        d_data->majorPen = pen;
-        d_data->minorPen = pen;
-
-        legendChanged();
-        itemChanged();
-    }
-}
-
-/*!
-  Build and assign a pen for both major grid lines
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtPlotGrid::setMajorPen( const QColor &color, qreal width, Qt::PenStyle style )
+   Assign a pen for both major and minor grid lines
+
+   \param pen Pen
+   \sa setMajorPen(), setMinorPen()
+ */
+void QwtPlotGrid::setPen( const QPen& pen )
+{
+    if ( m_data->majorPen != pen || m_data->minorPen != pen )
+    {
+        m_data->majorPen = pen;
+        m_data->minorPen = pen;
+
+        legendChanged();
+        itemChanged();
+    }
+}
+
+/*!
+   Build and assign a pen for both major grid lines
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtPlotGrid::setMajorPen( const QColor& color, qreal width, Qt::PenStyle style )
 {
     setMajorPen( QPen( color, width, style ) );
@@ -211,34 +216,34 @@
 
 /*!
-  Assign a pen for the major grid lines
-
-  \param pen Pen
-  \sa majorPen(), setMinorPen(), setPen()
-*/
-void QwtPlotGrid::setMajorPen( const QPen &pen )
-{
-    if ( d_data->majorPen != pen )
-    {
-        d_data->majorPen = pen;
-
-        legendChanged();
-        itemChanged();
-    }
-}
-
-/*!
-  Build and assign a pen for the minor grid lines
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtPlotGrid::setMinorPen( const QColor &color, qreal width, Qt::PenStyle style )
+   Assign a pen for the major grid lines
+
+   \param pen Pen
+   \sa majorPen(), setMinorPen(), setPen()
+ */
+void QwtPlotGrid::setMajorPen( const QPen& pen )
+{
+    if ( m_data->majorPen != pen )
+    {
+        m_data->majorPen = pen;
+
+        legendChanged();
+        itemChanged();
+    }
+}
+
+/*!
+   Build and assign a pen for the minor grid lines
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtPlotGrid::setMinorPen( const QColor& color, qreal width, Qt::PenStyle style )
 {
     setMinorPen( QPen( color, width, style ) );
@@ -246,81 +251,81 @@
 
 /*!
-  Assign a pen for the minor grid lines
-
-  \param pen Pen
-  \sa minorPen(), setMajorPen(), setPen()
-*/
-void QwtPlotGrid::setMinorPen( const QPen &pen )
-{
-    if ( d_data->minorPen != pen )
-    {
-        d_data->minorPen = pen;
-
-        legendChanged();
-        itemChanged();
-    }
-}
-
-/*!
-  \brief Draw the grid
-
-  The grid is drawn into the bounding rectangle such that
-  grid lines begin and end at the rectangle's borders. The X and Y
-  maps are used to map the scale divisions into the drawing region
-  screen.
-
-  \param painter  Painter
-  \param xMap X axis map
-  \param yMap Y axis
-  \param canvasRect Contents rectangle of the plot canvas
-*/
-void QwtPlotGrid::draw( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
+   Assign a pen for the minor grid lines
+
+   \param pen Pen
+   \sa minorPen(), setMajorPen(), setPen()
+ */
+void QwtPlotGrid::setMinorPen( const QPen& pen )
+{
+    if ( m_data->minorPen != pen )
+    {
+        m_data->minorPen = pen;
+
+        legendChanged();
+        itemChanged();
+    }
+}
+
+/*!
+   \brief Draw the grid
+
+   The grid is drawn into the bounding rectangle such that
+   grid lines begin and end at the rectangle's borders. The X and Y
+   maps are used to map the scale divisions into the drawing region
+   screen.
+
+   \param painter  Painter
+   \param xMap X axis map
+   \param yMap Y axis
+   \param canvasRect Contents rectangle of the plot canvas
+ */
+void QwtPlotGrid::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
 {
     //  draw minor grid lines
-    QPen minorPen = d_data->minorPen;
+    QPen minorPen = m_data->minorPen;
     minorPen.setCapStyle( Qt::FlatCap );
 
     painter->setPen( minorPen );
 
-    if ( d_data->xEnabled && d_data->xMinEnabled )
+    if ( m_data->xEnabled && m_data->xMinEnabled )
     {
         drawLines( painter, canvasRect, Qt::Vertical, xMap,
-            d_data->xScaleDiv.ticks( QwtScaleDiv::MinorTick ) );
+            m_data->xScaleDiv.ticks( QwtScaleDiv::MinorTick ) );
         drawLines( painter, canvasRect, Qt::Vertical, xMap,
-            d_data->xScaleDiv.ticks( QwtScaleDiv::MediumTick ) );
-    }
-
-    if ( d_data->yEnabled && d_data->yMinEnabled )
+            m_data->xScaleDiv.ticks( QwtScaleDiv::MediumTick ) );
+    }
+
+    if ( m_data->yEnabled && m_data->yMinEnabled )
     {
         drawLines( painter, canvasRect, Qt::Horizontal, yMap,
-            d_data->yScaleDiv.ticks( QwtScaleDiv::MinorTick ) );
+            m_data->yScaleDiv.ticks( QwtScaleDiv::MinorTick ) );
         drawLines( painter, canvasRect, Qt::Horizontal, yMap,
-            d_data->yScaleDiv.ticks( QwtScaleDiv::MediumTick ) );
+            m_data->yScaleDiv.ticks( QwtScaleDiv::MediumTick ) );
     }
 
     //  draw major grid lines
-    QPen majorPen = d_data->majorPen;
+    QPen majorPen = m_data->majorPen;
     majorPen.setCapStyle( Qt::FlatCap );
 
     painter->setPen( majorPen );
 
-    if ( d_data->xEnabled )
+    if ( m_data->xEnabled )
     {
         drawLines( painter, canvasRect, Qt::Vertical, xMap,
-            d_data->xScaleDiv.ticks( QwtScaleDiv::MajorTick ) );
-    }
-
-    if ( d_data->yEnabled )
+            m_data->xScaleDiv.ticks( QwtScaleDiv::MajorTick ) );
+    }
+
+    if ( m_data->yEnabled )
     {
         drawLines( painter, canvasRect, Qt::Horizontal, yMap,
-            d_data->yScaleDiv.ticks( QwtScaleDiv::MajorTick ) );
-    }
-}
-
-void QwtPlotGrid::drawLines( QPainter *painter, const QRectF &canvasRect,
-    Qt::Orientation orientation, const QwtScaleMap &scaleMap,
-    const QList<double> &values ) const
+            m_data->yScaleDiv.ticks( QwtScaleDiv::MajorTick ) );
+    }
+}
+
+void QwtPlotGrid::drawLines( QPainter* painter, const QRectF& canvasRect,
+    Qt::Orientation orientation, const QwtScaleMap& scaleMap,
+    const QList< double >& values ) const
 {
     const double x1 = canvasRect.left();
@@ -340,5 +345,5 @@
         {
             if ( qwtFuzzyGreaterOrEqual( value, y1 ) &&
-                qwtFuzzyLessOrEqual( value, y2 ) )
+                qwtFuzzyGreaterOrEqual( y2, value ) )
             {
                 QwtPainter::drawLine( painter, x1, value, x2, value );
@@ -348,5 +353,5 @@
         {
             if ( qwtFuzzyGreaterOrEqual( value, x1 ) &&
-                qwtFuzzyLessOrEqual( value, x2 ) )
+                qwtFuzzyGreaterOrEqual( x2, value ) )
             {
                 QwtPainter::drawLine( painter, value, y1, value, y2 );
@@ -357,68 +362,68 @@
 
 /*!
-  \return the pen for the major grid lines
-  \sa setMajorPen(), setMinorPen(), setPen()
-*/
-const QPen &QwtPlotGrid::majorPen() const
-{
-    return d_data->majorPen;
-}
-
-/*!
-  \return the pen for the minor grid lines
-  \sa setMinorPen(), setMajorPen(), setPen()
-*/
-const QPen &QwtPlotGrid::minorPen() const
-{
-    return d_data->minorPen;
-}
-
-/*!
-  \return true if vertical grid lines are enabled
-  \sa enableX()
-*/
+   \return the pen for the major grid lines
+   \sa setMajorPen(), setMinorPen(), setPen()
+ */
+const QPen& QwtPlotGrid::majorPen() const
+{
+    return m_data->majorPen;
+}
+
+/*!
+   \return the pen for the minor grid lines
+   \sa setMinorPen(), setMajorPen(), setPen()
+ */
+const QPen& QwtPlotGrid::minorPen() const
+{
+    return m_data->minorPen;
+}
+
+/*!
+   \return true if vertical grid lines are enabled
+   \sa enableX()
+ */
 bool QwtPlotGrid::xEnabled() const
 {
-    return d_data->xEnabled;
-}
-
-/*!
-  \return true if minor vertical grid lines are enabled
-  \sa enableXMin()
-*/
+    return m_data->xEnabled;
+}
+
+/*!
+   \return true if minor vertical grid lines are enabled
+   \sa enableXMin()
+ */
 bool QwtPlotGrid::xMinEnabled() const
 {
-    return d_data->xMinEnabled;
-}
-
-/*!
-  \return true if horizontal grid lines are enabled
-  \sa enableY()
-*/
+    return m_data->xMinEnabled;
+}
+
+/*!
+   \return true if horizontal grid lines are enabled
+   \sa enableY()
+ */
 bool QwtPlotGrid::yEnabled() const
 {
-    return d_data->yEnabled;
-}
-
-/*!
-  \return true if minor horizontal grid lines are enabled
-  \sa enableYMin()
-*/
+    return m_data->yEnabled;
+}
+
+/*!
+   \return true if minor horizontal grid lines are enabled
+   \sa enableYMin()
+ */
 bool QwtPlotGrid::yMinEnabled() const
 {
-    return d_data->yMinEnabled;
+    return m_data->yMinEnabled;
 }
 
 
 /*! \return the scale division of the x axis */
-const QwtScaleDiv &QwtPlotGrid::xScaleDiv() const
-{
-    return d_data->xScaleDiv;
+const QwtScaleDiv& QwtPlotGrid::xScaleDiv() const
+{
+    return m_data->xScaleDiv;
 }
 
 /*! \return the scale division of the y axis */
-const QwtScaleDiv &QwtPlotGrid::yScaleDiv() const
-{
-    return d_data->yScaleDiv;
+const QwtScaleDiv& QwtPlotGrid::yScaleDiv() const
+{
+    return m_data->yScaleDiv;
 }
 
@@ -430,5 +435,5 @@
 
    \sa QwtPlot::updateAxes()
-*/
+ */
 void QwtPlotGrid::updateScaleDiv( const QwtScaleDiv& xScaleDiv,
     const QwtScaleDiv& yScaleDiv )
Index: /trunk/BNC/qwt/qwt_plot_grid.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_grid.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_grid.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,5 +13,4 @@
 #include "qwt_global.h"
 #include "qwt_plot_item.h"
-#include "qwt_scale_div.h"
 
 class QPainter;
@@ -21,22 +20,22 @@
 
 /*!
-  \brief A class which draws a coordinate grid
+   \brief A class which draws a coordinate grid
 
-  The QwtPlotGrid class can be used to draw a coordinate grid.
-  A coordinate grid consists of major and minor vertical
-  and horizontal grid lines. The locations of the grid lines
-  are determined by the X and Y scale divisions which can
-  be assigned with setXDiv() and setYDiv().
-  The draw() member draws the grid within a bounding
-  rectangle.
-*/
+   The QwtPlotGrid class can be used to draw a coordinate grid.
+   A coordinate grid consists of major and minor vertical
+   and horizontal grid lines. The locations of the grid lines
+   are determined by the X and Y scale divisions which can
+   be assigned with setXDiv() and setYDiv().
+   The draw() member draws the grid within a bounding
+   rectangle.
+ */
 
-class QWT_EXPORT QwtPlotGrid: public QwtPlotItem
+class QWT_EXPORT QwtPlotGrid : public QwtPlotItem
 {
-public:
+  public:
     explicit QwtPlotGrid();
     virtual ~QwtPlotGrid();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
     void enableX( bool );
@@ -52,35 +51,39 @@
     bool yMinEnabled() const;
 
-    void setXDiv( const QwtScaleDiv & );
-    const QwtScaleDiv &xScaleDiv() const;
+    void setXDiv( const QwtScaleDiv& );
+    const QwtScaleDiv& xScaleDiv() const;
 
-    void setYDiv( const QwtScaleDiv & );
-    const QwtScaleDiv &yScaleDiv() const;
+    void setYDiv( const QwtScaleDiv& );
+    const QwtScaleDiv& yScaleDiv() const;
 
-    void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setPen( const QPen & );
+    void setPen( const QColor&,
+        qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
 
-    void setMajorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setMajorPen( const QPen & );
+    void setPen( const QPen& );
+
+    void setMajorPen( const QColor&,
+        qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
+
+    void setMajorPen( const QPen& );
     const QPen& majorPen() const;
 
-    void setMinorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setMinorPen( const QPen & );
+    void setMinorPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
+    void setMinorPen( const QPen& );
     const QPen& minorPen() const;
 
-    virtual void draw( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect ) const;
+    virtual void draw( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
 
     virtual void updateScaleDiv(
-        const QwtScaleDiv &xScaleDiv, const QwtScaleDiv &yScaleDiv );
+        const QwtScaleDiv& xScaleDiv, const QwtScaleDiv& yScaleDiv ) QWT_OVERRIDE;
 
-private:
-    void drawLines( QPainter *, const QRectF &,
-        Qt::Orientation, const QwtScaleMap &,
-        const QList<double> & ) const;
+  private:
+    void drawLines( QPainter*, const QRectF&,
+        Qt::Orientation, const QwtScaleMap&,
+        const QList< double >& ) const;
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_histogram.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_histogram.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_histogram.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,13 +9,14 @@
 
 #include "qwt_plot_histogram.h"
-#include "qwt_plot.h"
 #include "qwt_painter.h"
 #include "qwt_column_symbol.h"
 #include "qwt_scale_map.h"
+#include "qwt_graphic.h"
+
 #include <qstring.h>
 #include <qpainter.h>
 
-static inline bool qwtIsCombinable( const QwtInterval &d1,
-    const QwtInterval &d2 )
+static inline bool qwtIsCombinable( const QwtInterval& d1,
+    const QwtInterval& d2 )
 {
     if ( d1.isValid() && d2.isValid() )
@@ -36,9 +37,9 @@
 class QwtPlotHistogram::PrivateData
 {
-public:
-    PrivateData():
-        baseline( 0.0 ),
-        style( Columns ),
-        symbol( NULL )
+  public:
+    PrivateData()
+        : baseline( 0.0 )
+        , style( Columns )
+        , symbol( NULL )
     {
     }
@@ -54,13 +55,13 @@
     QBrush brush;
     QwtPlotHistogram::HistogramStyle style;
-    const QwtColumnSymbol *symbol;
+    const QwtColumnSymbol* symbol;
 };
 
 /*!
-  Constructor
-  \param title Title of the histogram.
-*/
-QwtPlotHistogram::QwtPlotHistogram( const QwtText &title ):
-    QwtPlotSeriesItem( title )
+   Constructor
+   \param title Title of the histogram.
+ */
+QwtPlotHistogram::QwtPlotHistogram( const QwtText& title )
+    : QwtPlotSeriesItem( title )
 {
     init();
@@ -68,9 +69,9 @@
 
 /*!
-  Constructor
-  \param title Title of the histogram.
-*/
-QwtPlotHistogram::QwtPlotHistogram( const QString &title ):
-    QwtPlotSeriesItem( title )
+   Constructor
+   \param title Title of the histogram.
+ */
+QwtPlotHistogram::QwtPlotHistogram( const QString& title )
+    : QwtPlotSeriesItem( title )
 {
     init();
@@ -80,5 +81,5 @@
 QwtPlotHistogram::~QwtPlotHistogram()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -86,5 +87,5 @@
 void QwtPlotHistogram::init()
 {
-    d_data = new PrivateData();
+    m_data = new PrivateData();
     setData( new QwtIntervalSeriesData() );
 
@@ -96,14 +97,14 @@
 
 /*!
-  Set the histogram's drawing style
-
-  \param style Histogram style
-  \sa HistogramStyle, style()
-*/
+   Set the histogram's drawing style
+
+   \param style Histogram style
+   \sa HistogramStyle, style()
+ */
 void QwtPlotHistogram::setStyle( HistogramStyle style )
 {
-    if ( style != d_data->style )
-    {
-        d_data->style = style;
+    if ( style != m_data->style )
+    {
+        m_data->style = style;
 
         legendChanged();
@@ -115,24 +116,24 @@
     \return Style of the histogram
     \sa HistogramStyle, setStyle()
-*/
+ */
 QwtPlotHistogram::HistogramStyle QwtPlotHistogram::style() const
 {
-    return d_data->style;
-}
-
-/*!
-  Build and assign a pen
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtPlotHistogram::setPen( const QColor &color, qreal width, Qt::PenStyle style )
+    return m_data->style;
+}
+
+/*!
+   Build and assign a pen
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtPlotHistogram::setPen( const QColor& color, qreal width, Qt::PenStyle style )
 {
     setPen( QPen( color, width, style ) );
@@ -140,14 +141,14 @@
 
 /*!
-  Assign a pen, that is used in a style() depending way.
-
-  \param pen New pen
-  \sa pen(), brush()
-*/
-void QwtPlotHistogram::setPen( const QPen &pen )
-{
-    if ( pen != d_data->pen )
-    {
-        d_data->pen = pen;
+   Assign a pen, that is used in a style() depending way.
+
+   \param pen New pen
+   \sa pen(), brush()
+ */
+void QwtPlotHistogram::setPen( const QPen& pen )
+{
+    if ( pen != m_data->pen )
+    {
+        m_data->pen = pen;
 
         legendChanged();
@@ -157,23 +158,23 @@
 
 /*!
-  \return Pen used in a style() depending way.
-  \sa setPen(), brush()
-*/
-const QPen &QwtPlotHistogram::pen() const
-{
-    return d_data->pen;
-}
-
-/*!
-  Assign a brush, that is used in a style() depending way.
-
-  \param brush New brush
-  \sa pen(), brush()
-*/
-void QwtPlotHistogram::setBrush( const QBrush &brush )
-{
-    if ( brush != d_data->brush )
-    {
-        d_data->brush = brush;
+   \return Pen used in a style() depending way.
+   \sa setPen(), brush()
+ */
+const QPen& QwtPlotHistogram::pen() const
+{
+    return m_data->pen;
+}
+
+/*!
+   Assign a brush, that is used in a style() depending way.
+
+   \param brush New brush
+   \sa pen(), brush()
+ */
+void QwtPlotHistogram::setBrush( const QBrush& brush )
+{
+    if ( brush != m_data->brush )
+    {
+        m_data->brush = brush;
 
         legendChanged();
@@ -183,32 +184,32 @@
 
 /*!
-  \return Brush used in a style() depending way.
-  \sa setPen(), brush()
-*/
-const QBrush &QwtPlotHistogram::brush() const
-{
-    return d_data->brush;
-}
-
-/*!
-  \brief Assign a symbol
-
-  In Column style an optional symbol can be assigned, that is responsible
-  for displaying the rectangle that is defined by the interval and
-  the distance between baseline() and value. When no symbol has been
-  defined the area is displayed as plain rectangle using pen() and brush().
-
-  \sa style(), symbol(), drawColumn(), pen(), brush()
-
-  \note In applications, where different intervals need to be displayed
+   \return Brush used in a style() depending way.
+   \sa setPen(), brush()
+ */
+const QBrush& QwtPlotHistogram::brush() const
+{
+    return m_data->brush;
+}
+
+/*!
+   \brief Assign a symbol
+
+   In Column style an optional symbol can be assigned, that is responsible
+   for displaying the rectangle that is defined by the interval and
+   the distance between baseline() and value. When no symbol has been
+   defined the area is displayed as plain rectangle using pen() and brush().
+
+   \sa style(), symbol(), drawColumn(), pen(), brush()
+
+   \note In applications, where different intervals need to be displayed
         in a different way ( f.e different colors or even using different symbols)
         it is recommended to overload drawColumn().
-*/
-void QwtPlotHistogram::setSymbol( const QwtColumnSymbol *symbol )
-{
-    if ( symbol != d_data->symbol )
-    {
-        delete d_data->symbol;
-        d_data->symbol = symbol;
+ */
+void QwtPlotHistogram::setSymbol( const QwtColumnSymbol* symbol )
+{
+    if ( symbol != m_data->symbol )
+    {
+        delete m_data->symbol;
+        m_data->symbol = symbol;
 
         legendChanged();
@@ -218,28 +219,28 @@
 
 /*!
-  \return Current symbol or NULL, when no symbol has been assigned
-  \sa setSymbol()
-*/
-const QwtColumnSymbol *QwtPlotHistogram::symbol() const
-{
-    return d_data->symbol;
-}
-
-/*!
-  \brief Set the value of the baseline
-
-  Each column representing an QwtIntervalSample is defined by its
-  interval and the interval between baseline and the value of the sample.
-
-  The default value of the baseline is 0.0.
-
-  \param value Value of the baseline
-  \sa baseline()
-*/
+   \return Current symbol or NULL, when no symbol has been assigned
+   \sa setSymbol()
+ */
+const QwtColumnSymbol* QwtPlotHistogram::symbol() const
+{
+    return m_data->symbol;
+}
+
+/*!
+   \brief Set the value of the baseline
+
+   Each column representing an QwtIntervalSample is defined by its
+   interval and the interval between baseline and the value of the sample.
+
+   The default value of the baseline is 0.0.
+
+   \param value Value of the baseline
+   \sa baseline()
+ */
 void QwtPlotHistogram::setBaseline( double value )
 {
-    if ( d_data->baseline != value )
-    {
-        d_data->baseline = value;
+    if ( m_data->baseline != value )
+    {
+        m_data->baseline = value;
         itemChanged();
     }
@@ -247,16 +248,16 @@
 
 /*!
-  \return Value of the baseline
-  \sa setBaseline()
-*/
+   \return Value of the baseline
+   \sa setBaseline()
+ */
 double QwtPlotHistogram::baseline() const
 {
-    return d_data->baseline;
-}
-
-/*!
-  \return Bounding rectangle of all samples.
-  For an empty series the rectangle is invalid.
-*/
+    return m_data->baseline;
+}
+
+/*!
+   \return Bounding rectangle of all samples.
+   For an empty series the rectangle is invalid.
+ */
 QRectF QwtPlotHistogram::boundingRect() const
 {
@@ -270,15 +271,15 @@
             rect.height(), rect.width() );
 
-        if ( rect.left() > d_data->baseline )
-            rect.setLeft( d_data->baseline );
-        else if ( rect.right() < d_data->baseline )
-            rect.setRight( d_data->baseline );
+        if ( rect.left() > m_data->baseline )
+            rect.setLeft( m_data->baseline );
+        else if ( rect.right() < m_data->baseline )
+            rect.setRight( m_data->baseline );
     }
     else
     {
-        if ( rect.bottom() < d_data->baseline )
-            rect.setBottom( d_data->baseline );
-        else if ( rect.top() > d_data->baseline )
-            rect.setTop( d_data->baseline );
+        if ( rect.bottom() < m_data->baseline )
+            rect.setBottom( m_data->baseline );
+        else if ( rect.top() > m_data->baseline )
+            rect.setTop( m_data->baseline );
     }
 
@@ -293,9 +294,9 @@
 
 /*!
-  Initialize data with an array of samples.
-  \param samples Vector of points
-*/
+   Initialize data with an array of samples.
+   \param samples Vector of points
+ */
 void QwtPlotHistogram::setSamples(
-    const QVector<QwtIntervalSample> &samples )
+    const QVector< QwtIntervalSample >& samples )
 {
     setData( new QwtIntervalSeriesData( samples ) );
@@ -303,15 +304,15 @@
 
 /*!
-  Assign a series of samples
-
-  setSamples() is just a wrapper for setData() without any additional
-  value - beside that it is easier to find for the developer.
-
-  \param data Data
-  \warning The item takes ownership of the data object, deleting
+   Assign a series of samples
+
+   setSamples() is just a wrapper for setData() without any additional
+   value - beside that it is easier to find for the developer.
+
+   \param data Data
+   \warning The item takes ownership of the data object, deleting
            it when its not used anymore.
-*/
+ */
 void QwtPlotHistogram::setSamples(
-    QwtSeriesData<QwtIntervalSample> *data )
+    QwtSeriesData< QwtIntervalSample >* data )
 {
     setData( data );
@@ -319,19 +320,19 @@
 
 /*!
-  Draw a subset of the histogram samples
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
+   Draw a subset of the histogram samples
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
          series will be painted to its last sample.
 
-  \sa drawOutline(), drawLines(), drawColumns
-*/
-void QwtPlotHistogram::drawSeries( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   \sa drawOutline(), drawLines(), drawColumns
+ */
+void QwtPlotHistogram::drawSeries( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     Q_UNUSED( canvasRect )
@@ -343,5 +344,5 @@
         to = dataSize() - 1;
 
-    switch ( d_data->style )
+    switch ( m_data->style )
     {
         case Outline:
@@ -360,19 +361,19 @@
 
 /*!
-  Draw a histogram in Outline style()
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
+   Draw a histogram in Outline style()
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
          histogram will be painted to its last point.
 
-  \sa setStyle(), style()
-  \warning The outline style requires, that the intervals are in increasing
+   \sa setStyle(), style()
+   \warning The outline style requires, that the intervals are in increasing
            order and not overlapping.
-*/
-void QwtPlotHistogram::drawOutline( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
+ */
+void QwtPlotHistogram::drawOutline( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     int from, int to ) const
 {
@@ -447,23 +448,23 @@
 
 /*!
-  Draw a histogram in Columns style()
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
+   Draw a histogram in Columns style()
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
          histogram will be painted to its last point.
 
-  \sa setStyle(), style(), setSymbol(), drawColumn()
-*/
-void QwtPlotHistogram::drawColumns( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
+   \sa setStyle(), style(), setSymbol(), drawColumn()
+ */
+void QwtPlotHistogram::drawColumns( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     int from, int to ) const
 {
-    painter->setPen( d_data->pen );
-    painter->setBrush( d_data->brush );
-
-    const QwtSeriesData<QwtIntervalSample> *series = data();
+    painter->setPen( m_data->pen );
+    painter->setBrush( m_data->brush );
+
+    const QwtSeriesData< QwtIntervalSample >* series = data();
 
     for ( int i = from; i <= to; i++ )
@@ -479,25 +480,25 @@
 
 /*!
-  Draw a histogram in Lines style()
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
+   Draw a histogram in Lines style()
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
          histogram will be painted to its last point.
 
-  \sa setStyle(), style(), setPen()
-*/
-void QwtPlotHistogram::drawLines( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
+   \sa setStyle(), style(), setPen()
+ */
+void QwtPlotHistogram::drawLines( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     int from, int to ) const
 {
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
-    painter->setPen( d_data->pen );
+    painter->setPen( m_data->pen );
     painter->setBrush( Qt::NoBrush );
 
-    const QwtSeriesData<QwtIntervalSample> *series = data();
+    const QwtSeriesData< QwtIntervalSample >* series = data();
 
     for ( int i = from; i <= to; i++ )
@@ -549,6 +550,6 @@
 
 //! Internal, used by the Outline style.
-void QwtPlotHistogram::flushPolygon( QPainter *painter,
-    double baseLine, QPolygonF &polygon ) const
+void QwtPlotHistogram::flushPolygon( QPainter* painter,
+    double baseLine, QPolygonF& polygon ) const
 {
     if ( polygon.size() == 0 )
@@ -560,8 +561,8 @@
         polygon += QPointF( polygon.last().x(), baseLine );
 
-    if ( d_data->brush.style() != Qt::NoBrush )
+    if ( m_data->brush.style() != Qt::NoBrush )
     {
         painter->setPen( Qt::NoPen );
-        painter->setBrush( d_data->brush );
+        painter->setBrush( m_data->brush );
 
         if ( orientation() == Qt::Horizontal )
@@ -581,8 +582,8 @@
         polygon.pop_back();
     }
-    if ( d_data->pen.style() != Qt::NoPen )
+    if ( m_data->pen.style() != Qt::NoPen )
     {
         painter->setBrush( Qt::NoBrush );
-        painter->setPen( d_data->pen );
+        painter->setPen( m_data->pen );
         QwtPainter::drawPolyline( painter, polygon );
     }
@@ -591,18 +592,18 @@
 
 /*!
-  Calculate the area that is covered by a sample
-
-  \param sample Sample
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-
-  \return Rectangle, that is covered by a sample
-*/
-QwtColumnRect QwtPlotHistogram::columnRect( const QwtIntervalSample &sample,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap ) const
+   Calculate the area that is covered by a sample
+
+   \param sample Sample
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+
+   \return Rectangle, that is covered by a sample
+ */
+QwtColumnRect QwtPlotHistogram::columnRect( const QwtIntervalSample& sample,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap ) const
 {
     QwtColumnRect rect;
 
-    const QwtInterval &iv = sample.interval;
+    const QwtInterval& iv = sample.interval;
     if ( !iv.isValid() )
         return rect;
@@ -611,5 +612,5 @@
     {
         const double x0 = xMap.transform( baseline() );
-        const double x  = xMap.transform( sample.value );
+        const double x = xMap.transform( sample.value );
         const double y1 = yMap.transform( iv.minValue() );
         const double y2 = yMap.transform( iv.maxValue() );
@@ -618,5 +619,5 @@
         rect.vInterval.setInterval( y1, y2, iv.borderFlags() );
         rect.direction = ( x < x0 ) ? QwtColumnRect::RightToLeft :
-                         QwtColumnRect::LeftToRight;
+            QwtColumnRect::LeftToRight;
     }
     else
@@ -637,26 +638,26 @@
 
 /*!
-  Draw a column for a sample in Columns style().
-
-  When a symbol() has been set the symbol is used otherwise the
-  column is displayed as plain rectangle using pen() and brush().
-
-  \param painter Painter
-  \param rect Rectangle where to paint the column in paint device coordinates
-  \param sample Sample to be displayed
-
-  \note In applications, where different intervals need to be displayed
+   Draw a column for a sample in Columns style().
+
+   When a symbol() has been set the symbol is used otherwise the
+   column is displayed as plain rectangle using pen() and brush().
+
+   \param painter Painter
+   \param rect Rectangle where to paint the column in paint device coordinates
+   \param sample Sample to be displayed
+
+   \note In applications, where different intervals need to be displayed
         in a different way ( f.e different colors or even using different symbols)
         it is recommended to overload drawColumn().
-*/
-void QwtPlotHistogram::drawColumn( QPainter *painter,
-    const QwtColumnRect &rect, const QwtIntervalSample &sample ) const
+ */
+void QwtPlotHistogram::drawColumn( QPainter* painter,
+    const QwtColumnRect& rect, const QwtIntervalSample& sample ) const
 {
     Q_UNUSED( sample );
 
-    if ( d_data->symbol &&
-        ( d_data->symbol->style() != QwtColumnSymbol::NoStyle ) )
-    {
-        d_data->symbol->draw( painter, rect );
+    if ( m_data->symbol &&
+        ( m_data->symbol->style() != QwtColumnSymbol::NoStyle ) )
+    {
+        m_data->symbol->draw( painter, rect );
     }
     else
@@ -676,17 +677,16 @@
 
 /*!
-  A plain rectangle without pen using the brush()
-
-  \param index Index of the legend entry
+   A plain rectangle without pen using the brush()
+
+   \param index Index of the legend entry
                 ( ignored as there is only one )
-  \param size Icon size
-  \return A graphic displaying the icon
-
-  \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
-*/
-QwtGraphic QwtPlotHistogram::legendIcon( int index,
-    const QSizeF &size ) const
+   \param size Icon size
+   \return A graphic displaying the icon
+
+   \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
+ */
+QwtGraphic QwtPlotHistogram::legendIcon( int index, const QSizeF& size ) const
 {
     Q_UNUSED( index );
-    return defaultIcon( d_data->brush, size );
-}
+    return defaultIcon( m_data->brush, size );
+}
Index: /trunk/BNC/qwt/qwt_plot_histogram.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_histogram.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_histogram.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,20 +13,22 @@
 #include "qwt_global.h"
 #include "qwt_plot_seriesitem.h"
-#include "qwt_column_symbol.h"
-#include <qcolor.h>
-#include <qvector.h>
 
-class QwtIntervalData;
-class QString;
+class QwtColumnSymbol;
+class QwtColumnRect;
+class QColor;
 class QPolygonF;
 
+#if QT_VERSION < 0x060000
+template< typename T > class QVector;
+#endif
+
 /*!
-  \brief QwtPlotHistogram represents a series of samples, where an interval
+   \brief QwtPlotHistogram represents a series of samples, where an interval
          is associated with a value ( \f$y = f([x1,x2])\f$ ).
 
-  The representation depends on the style() and an optional symbol()
-  that is displayed for each interval.
+   The representation depends on the style() and an optional symbol()
+   that is displayed for each interval.
 
-  \note The term "histogram" is used in a different way in the areas of
+   \note The term "histogram" is used in a different way in the areas of
         digital image processing and statistics. Wikipedia introduces the
         terms "image histogram" and "color histogram" to avoid confusions.
@@ -34,11 +36,12 @@
         is no applicable plot item for a "color histogram" yet.
 
-  \sa QwtPlotBarChart, QwtPlotMultiBarChart
-*/
+   \sa QwtPlotBarChart, QwtPlotMultiBarChart
+ */
 
-class QWT_EXPORT QwtPlotHistogram:
-    public QwtPlotSeriesItem, public QwtSeriesStore<QwtIntervalSample>
+class QWT_EXPORT QwtPlotHistogram
+    : public QwtPlotSeriesItem
+    , public QwtSeriesStore< QwtIntervalSample >
 {
-public:
+  public:
     /*!
         Histogram styles.
@@ -46,5 +49,5 @@
 
         \sa setStyle(), style(), setSymbol(), symbol(), setBaseline()
-    */
+     */
     enum HistogramStyle
     {
@@ -77,19 +80,21 @@
     };
 
-    explicit QwtPlotHistogram( const QString &title = QString() );
-    explicit QwtPlotHistogram( const QwtText &title );
+    explicit QwtPlotHistogram( const QString& title = QString() );
+    explicit QwtPlotHistogram( const QwtText& title );
     virtual ~QwtPlotHistogram();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
-    void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setPen( const QPen & );
-    const QPen &pen() const;
+    void setPen( const QColor&,
+        qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
 
-    void setBrush( const QBrush & );
-    const QBrush &brush() const;
+    void setPen( const QPen& );
+    const QPen& pen() const;
 
-    void setSamples( const QVector<QwtIntervalSample> & );
-    void setSamples( QwtSeriesData<QwtIntervalSample> * );
+    void setBrush( const QBrush& );
+    const QBrush& brush() const;
+
+    void setSamples( const QVector< QwtIntervalSample >& );
+    void setSamples( QwtSeriesData< QwtIntervalSample >* );
 
     void setBaseline( double );
@@ -99,40 +104,41 @@
     HistogramStyle style() const;
 
-    void setSymbol( const QwtColumnSymbol * );
-    const QwtColumnSymbol *symbol() const;
+    void setSymbol( const QwtColumnSymbol* );
+    const QwtColumnSymbol* symbol() const;
 
-    virtual void drawSeries( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
+    virtual void drawSeries( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
 
-    virtual QRectF boundingRect() const;
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
 
-    virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
+    virtual QwtGraphic legendIcon(
+        int index, const QSizeF& ) const QWT_OVERRIDE;
 
-protected:
-    virtual QwtColumnRect columnRect( const QwtIntervalSample &,
-        const QwtScaleMap &, const QwtScaleMap & ) const;
+  protected:
+    virtual QwtColumnRect columnRect( const QwtIntervalSample&,
+        const QwtScaleMap&, const QwtScaleMap& ) const;
 
-    virtual void drawColumn( QPainter *, const QwtColumnRect &,
-        const QwtIntervalSample & ) const;
+    virtual void drawColumn( QPainter*, const QwtColumnRect&,
+        const QwtIntervalSample& ) const;
 
-    void drawColumns( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
+    void drawColumns( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
         int from, int to ) const;
 
-    void drawOutline( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
+    void drawOutline( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
         int from, int to ) const;
 
-    void drawLines( QPainter *,
-         const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-         int from, int to ) const;
+    void drawLines( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        int from, int to ) const;
 
-private:
+  private:
     void init();
-    void flushPolygon( QPainter *, double baseLine, QPolygonF & ) const;
+    void flushPolygon( QPainter*, double baseLine, QPolygonF& ) const;
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_intervalcurve.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_intervalcurve.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_intervalcurve.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,9 +13,12 @@
 #include "qwt_clipper.h"
 #include "qwt_painter.h"
-#include <string.h>
+#include "qwt_graphic.h"
+#include "qwt_text.h"
 
 #include <qpainter.h>
-
-static inline bool qwtIsHSampleInside( const QwtIntervalSample &sample,
+#include <qmath.h>
+#include <cstring>
+
+static inline bool qwtIsHSampleInside( const QwtIntervalSample& sample,
     double xMin, double xMax, double yMin, double yMax )
 {
@@ -30,5 +33,5 @@
 }
 
-static inline bool qwtIsVSampleInside( const QwtIntervalSample &sample,
+static inline bool qwtIsVSampleInside( const QwtIntervalSample& sample,
     double xMin, double xMax, double yMin, double yMax )
 {
@@ -43,331 +46,333 @@
 }
 
-class QwtPlotIntervalCurve::PrivateData
-{
-public:
-    PrivateData():
-        style( QwtPlotIntervalCurve::Tube ),
-        symbol( NULL ),
-        pen( Qt::black ),
-        brush( Qt::white )
-    {
-        paintAttributes = QwtPlotIntervalCurve::ClipPolygons;
-        paintAttributes |= QwtPlotIntervalCurve::ClipSymbol;
-
-        pen.setCapStyle( Qt::FlatCap );
-    }
-
-    ~PrivateData()
-    {
-        delete symbol;
-    }
-
-    QwtPlotIntervalCurve::CurveStyle style;
-    const QwtIntervalSymbol *symbol;
-
-    QPen pen;
-    QBrush brush;
-
-    QwtPlotIntervalCurve::PaintAttributes paintAttributes;
-};
-
-/*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotIntervalCurve::QwtPlotIntervalCurve( const QwtText &title ):
-    QwtPlotSeriesItem( title )
-{
-    init();
-}
-
-/*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotIntervalCurve::QwtPlotIntervalCurve( const QString &title ):
-    QwtPlotSeriesItem( QwtText( title ) )
-{
-    init();
-}
-
-//! Destructor
-QwtPlotIntervalCurve::~QwtPlotIntervalCurve()
-{
-    delete d_data;
-}
-
-//! Initialize internal members
-void QwtPlotIntervalCurve::init()
-{
-    setItemAttribute( QwtPlotItem::Legend, true );
-    setItemAttribute( QwtPlotItem::AutoScale, true );
-
-    d_data = new PrivateData;
-    setData( new QwtIntervalSeriesData() );
-
-    setZ( 19.0 );
-}
-
-//! \return QwtPlotItem::Rtti_PlotIntervalCurve
-int QwtPlotIntervalCurve::rtti() const
-{
-    return QwtPlotIntervalCurve::Rtti_PlotIntervalCurve;
-}
-
-/*!
-  Specify an attribute how to draw the curve
-
-  \param attribute Paint attribute
-  \param on On/Off
-  \sa testPaintAttribute()
-*/
-void QwtPlotIntervalCurve::setPaintAttribute(
-    PaintAttribute attribute, bool on )
-{
-    if ( on )
-        d_data->paintAttributes |= attribute;
+static inline int qwtInterpolated( int from, int to, double ratio )
+{
+    return qRound( from + ratio * ( to - from ) );
+}
+
+static int qwtStartIndex( int from, double min, double max,
+    const QwtSeriesData< QwtIntervalSample >* samples )
+{
+    /*
+        As we know, that the value coordinates are montonically
+        increasing/decreasing we can find the first sample before
+        entering the interval using a binary search algo.
+     */
+
+    struct lessThan
+    {
+        inline bool operator()( const double value,
+            const QwtIntervalSample& sample ) const
+        {
+            return value < sample.value;
+        }
+    };
+
+    struct greaterThan
+    {
+        inline bool operator()( const double value,
+            const QwtIntervalSample& sample ) const
+        {
+            return value > sample.value;
+        }
+    };
+
+    int idx;
+
+    if ( samples->firstSample().value < samples->lastSample().value )
+    {
+        idx = qwtUpperSampleIndex< QwtIntervalSample >(
+            *samples, min, lessThan() );
+    }
     else
-        d_data->paintAttributes &= ~attribute;
-}
-
-/*!
-    \return True, when attribute is enabled
-    \sa PaintAttribute, setPaintAttribute()
-*/
-bool QwtPlotIntervalCurve::testPaintAttribute(
-    PaintAttribute attribute ) const
-{
-    return ( d_data->paintAttributes & attribute );
-}
-
-/*!
-  Initialize data with an array of samples.
-  \param samples Vector of samples
-*/
-void QwtPlotIntervalCurve::setSamples(
-    const QVector<QwtIntervalSample> &samples )
-{
-    setData( new QwtIntervalSeriesData( samples ) );
-}
-
-/*!
-  Assign a series of samples
-
-  setSamples() is just a wrapper for setData() without any additional
-  value - beside that it is easier to find for the developer.
-
-  \param data Data
-  \warning The item takes ownership of the data object, deleting
-           it when its not used anymore.
-*/
-void QwtPlotIntervalCurve::setSamples(
-    QwtSeriesData<QwtIntervalSample> *data )
-{
-    setData( data );
-}
-
-/*!
-  Set the curve's drawing style
-
-  \param style Curve style
-  \sa CurveStyle, style()
-*/
-void QwtPlotIntervalCurve::setStyle( CurveStyle style )
-{
-    if ( style != d_data->style )
-    {
-        d_data->style = style;
-
-        legendChanged();
-        itemChanged();
-    }
-}
-
-/*!
-    \return Style of the curve
-    \sa setStyle()
-*/
-QwtPlotIntervalCurve::CurveStyle QwtPlotIntervalCurve::style() const
-{
-    return d_data->style;
-}
-
-/*!
-  Assign a symbol.
-
-  \param symbol Symbol
-  \sa symbol()
-*/
-void QwtPlotIntervalCurve::setSymbol( const QwtIntervalSymbol *symbol )
-{
-    if ( symbol != d_data->symbol )
-    {
-        delete d_data->symbol;
-        d_data->symbol = symbol;
-
-        legendChanged();
-        itemChanged();
-    }
-}
-
-/*!
-  \return Current symbol or NULL, when no symbol has been assigned
-  \sa setSymbol()
-*/
-const QwtIntervalSymbol *QwtPlotIntervalCurve::symbol() const
-{
-    return d_data->symbol;
-}
-
-/*!
-  Build and assign a pen
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtPlotIntervalCurve::setPen( const QColor &color, qreal width, Qt::PenStyle style )
-{
-    setPen( QPen( color, width, style ) );
-}
-
-/*!
-  \brief Assign a pen
-  \param pen New pen
-  \sa pen(), brush()
-*/
-void QwtPlotIntervalCurve::setPen( const QPen &pen )
-{
-    if ( pen != d_data->pen )
-    {
-        d_data->pen = pen;
-
-        legendChanged();
-        itemChanged();
-    }
-}
-
-/*!
-    \return Pen used to draw the lines
-    \sa setPen(), brush()
-*/
-const QPen& QwtPlotIntervalCurve::pen() const
-{
-    return d_data->pen;
-}
-
-/*!
-  Assign a brush.
-
-  The brush is used to fill the area in Tube style().
-
-  \param brush Brush
-  \sa brush(), pen(), setStyle(), CurveStyle
-*/
-void QwtPlotIntervalCurve::setBrush( const QBrush &brush )
-{
-    if ( brush != d_data->brush )
-    {
-        d_data->brush = brush;
-
-        legendChanged();
-        itemChanged();
-    }
-}
-
-/*!
-  \return Brush used to fill the area in Tube style()
-  \sa setBrush(), setStyle(), CurveStyle
-*/
-const QBrush& QwtPlotIntervalCurve::brush() const
-{
-    return d_data->brush;
-}
-
-/*!
-  \return Bounding rectangle of all samples.
-  For an empty series the rectangle is invalid.
-*/
-QRectF QwtPlotIntervalCurve::boundingRect() const
-{
-    QRectF rect = QwtPlotSeriesItem::boundingRect();
-    if ( orientation() == Qt::Vertical )
-        rect.setRect( rect.y(), rect.x(), rect.height(), rect.width() );
-
-    return rect;
-}
-
-/*!
-  Draw a subset of the samples
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
-         series will be painted to its last sample.
-
-  \sa drawTube(), drawSymbols()
-*/
-void QwtPlotIntervalCurve::drawSeries( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
-{
-    if ( to < 0 )
-        to = dataSize() - 1;
-
-    if ( from < 0 )
-        from = 0;
-
-    if ( from > to )
-        return;
-
-    switch ( d_data->style )
-    {
-        case Tube:
-            drawTube( painter, xMap, yMap, canvasRect, from, to );
-            break;
-
-        case NoCurve:
-        default:
-            break;
-    }
-
-    if ( d_data->symbol &&
-        ( d_data->symbol->style() != QwtIntervalSymbol::NoSymbol ) )
-    {
-        drawSymbols( painter, *d_data->symbol,
-            xMap, yMap, canvasRect, from, to );
-    }
-}
-
-/*!
-  Draw a tube
-
-  Builds 2 curves from the upper and lower limits of the intervals
-  and draws them with the pen(). The area between the curves is
-  filled with the brush().
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
-         series will be painted to its last sample.
-
-  \sa drawSeries(), drawSymbols()
-*/
-void QwtPlotIntervalCurve::drawTube( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+    {
+        idx = qwtUpperSampleIndex< QwtIntervalSample >(
+            *samples, max, greaterThan() );
+    }
+
+    if ( idx >= 0 )
+    {
+        idx = qMax( from, idx );
+        if ( idx > 0 )
+        {
+            // we need to fill the area before the first sample
+            idx--;
+        }
+    }
+
+    return idx;
+}
+
+namespace
+{
+    class LinesRenderer
+    {
+      public:
+        LinesRenderer( Qt::Orientation,
+            const QwtScaleMap&, const QwtScaleMap&, const QRectF& );
+
+        void addSamples( const QwtSeriesData< QwtIntervalSample >*, int from, int to );
+
+        QVector< QLine > fillLines;
+        QVector< QLine > borderLines;
+
+      private:
+        bool addSample( const QwtIntervalSample& );
+        void flush();
+
+        bool append( int value, int min, int max );
+
+        void addFillLineAt( int value, int min, int max );
+        void addFillLines( int value, int min, int max );
+
+        void addBorderLineAt( int value, int min, int max );
+        void addBorderLine( int, int, int, int );
+
+        const bool m_vertical;
+
+        const QwtScaleMap& m_valueMap;
+        const QwtScaleMap& m_intervalMap;
+
+        const bool m_inverting;
+        bool m_pending;
+
+        // all ints are in paint device coordinates
+
+        int m_intvMin, m_intvMax;   // interval boundaries of the canvas
+        int m_valueMin, m_valueMax; // value boundaries of the canvas
+
+        int m_value; // value of the last sample being processed
+
+        struct
+        {
+            inline void reset( int value )
+            {
+                min = max = last = value;
+            }
+
+            inline void extend( int value )
+            {
+                if ( value < min )
+                    min = value;
+                else if ( value > max )
+                    max = value;
+
+                last = value;
+            }
+
+            int min, max, last;
+
+        } m_lower, m_upper;
+    };
+
+    LinesRenderer::LinesRenderer( Qt::Orientation orientation,
+            const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& rect )
+        : m_vertical( orientation == Qt::Vertical )
+        , m_valueMap( m_vertical ? xMap : yMap )
+        , m_intervalMap( m_vertical ? yMap : xMap )
+        , m_inverting( m_intervalMap.isInverting() )
+        , m_pending( false )
+        , m_value( 0 )
+    {
+        QRectF r = rect; 
+        if ( !m_vertical )
+            r.setSize( QSizeF( r.height(), r.width() ) );
+
+        m_intvMin = qFloor( r.top() );
+        m_intvMax = qCeil( r.bottom() );
+
+        m_valueMin = qFloor( r.left() );
+        m_valueMax = qCeil( r.right() );
+
+        const int steps = m_valueMax - m_valueMin + 1;
+
+        // one line for each pixel
+        fillLines.reserve( steps );
+
+        /*
+            for both border lines:
+                one line ( min/max ) of the samples lying on the same pixel
+                one line connecting the pixels
+         */
+        borderLines.reserve( 4 * steps );
+    }
+
+    void LinesRenderer::addSamples(
+        const QwtSeriesData< QwtIntervalSample >* samples, int from, int to )
+    {
+        const double v1 = m_valueMap.invTransform( m_valueMin );
+        const double v2 = m_valueMap.invTransform( m_valueMax );
+
+        from = qwtStartIndex( from, qMin( v1, v2 ), qMax( v1, v2 ), samples );
+
+        if ( from >= 0 )
+        {
+            for ( int i = from; i <= to; i++ )
+            {
+                if ( addSample( samples->sample( i ) ) )
+                    break;
+            }
+        }
+
+        flush();
+    }
+
+    inline bool LinesRenderer::addSample( const QwtIntervalSample& sample )
+    {
+        const double value = qRound( m_valueMap.transform( sample.value ) );
+
+        const int min = qRound( m_intervalMap.transform( sample.interval.minValue() ) );
+        const int max = qRound( m_intervalMap.transform( sample.interval.maxValue() ) );
+
+        return m_inverting ? append( value, max, min ) : append( value, max, min );
+    }
+
+    inline bool LinesRenderer::append(
+        const int value, const int lower, const int upper )
+    {
+        if ( !m_pending )
+        {
+            m_value = value;
+            m_lower.reset( lower );
+            m_upper.reset( upper );
+
+            m_pending = true;
+
+            return false;
+        }
+
+        if ( value != m_value )
+        {
+            addFillLines( value, lower, upper );
+            addBorderLineAt( m_value, m_lower.min, m_lower.max );
+            addBorderLineAt( m_value, m_upper.min, m_upper.max );
+
+            addBorderLine( m_value, m_lower.last, value, lower );
+            addBorderLine( m_value, m_upper.last, value, upper );
+
+            if ( ( value > m_value ) ? ( value > m_valueMax ) : ( value < m_valueMin ) )
+            {
+                m_pending = false;
+                return true;
+            }
+
+            m_value = value;
+
+            m_lower.reset( lower );
+            m_upper.reset( upper );
+        }
+        else
+        {
+            m_lower.extend( lower );
+            m_upper.extend( upper );
+        }
+
+        return false;
+    }
+
+    inline void LinesRenderer::flush()
+    {
+        if ( m_pending )
+        {
+            addFillLineAt( m_value, m_lower.min, m_upper.max );
+            addBorderLineAt( m_value, m_lower.min, m_lower.max );
+            addBorderLineAt( m_value, m_upper.min, m_upper.max );
+        }
+    }
+
+    inline void LinesRenderer::addFillLines(
+        const int value, const int lower, const int upper )
+    {
+        addFillLineAt( m_value, m_lower.min, m_upper.max );
+
+        const double delta = value - m_value;
+
+        if ( value > m_value )
+        {
+            for ( int v = m_value + 1; v < value; v++ )
+            {
+                const double ratio = ( v - m_value ) / delta;
+
+                addFillLineAt( v,
+                    qwtInterpolated( m_lower.last, lower, ratio ),
+                    qwtInterpolated( m_upper.last, upper, ratio ) );
+            }
+        }
+        else
+        {
+            for ( int v = m_value - 1; v > value; v-- )
+            {
+                const double ratio = ( v - m_value ) / delta;
+
+                addFillLineAt( v,
+                    qwtInterpolated( m_lower.last, lower, ratio ),
+                    qwtInterpolated( m_upper.last, upper, ratio ) );
+            }
+        }
+    }
+
+    inline void LinesRenderer::addFillLineAt( int value, int min, int max )
+    {
+        if ( ( min != max ) && ( max > m_intvMin ) && ( min < m_intvMax ) )
+        {
+            min = qMax( min, m_intvMin );
+            max = qMin( max, m_intvMax );
+
+            if( m_vertical )
+                fillLines += QLine( value, min, value, max );
+            else
+                fillLines += QLine( min, value, max, value );
+        }
+    }
+
+    inline void LinesRenderer::addBorderLineAt( int value, int min, int max )
+    {
+        if ( min != max )
+            addBorderLine( value, min, value, max );
+    }
+
+    inline void LinesRenderer::addBorderLine( int x1, int y1, int x2, int y2 )
+    {
+        if( m_vertical )
+            borderLines += QLine( x1, y1, x2, y2 );
+        else
+            borderLines += QLine( y1, x1, y2, x2 );
+    }
+}
+
+static void qwtDrawTubeLines(
+    const QwtPlotIntervalCurve* curve, QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to)
+{
+    LinesRenderer renderer( curve->orientation(), xMap, yMap, canvasRect );
+    renderer.addSamples( curve->data(), from, to );
+
+    if ( curve->brush().style() != Qt::NoBrush )
+    {
+        painter->save();
+
+        painter->setPen( curve->brush().color() );
+        painter->setRenderHint( QPainter::Antialiasing, false );
+        painter->drawLines( renderer.fillLines );
+
+        painter->restore();
+    }
+
+    if ( curve->pen().style() != Qt::NoPen )
+    {
+        painter->save();
+
+        painter->setPen( curve->pen() );
+        painter->drawLines( renderer.borderLines );
+
+        painter->restore();
+    }
+}
+
+static void qwtDrawTube(
+    const QwtPlotIntervalCurve* curve, QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to )
 {
     const bool doAlign = QwtPainter::roundingAlignment( painter );
@@ -377,17 +382,18 @@
     const size_t size = to - from + 1;
     QPolygonF polygon( 2 * size );
-    QPointF *points = polygon.data();
+    QPointF* points = polygon.data();
 
     for ( uint i = 0; i < size; i++ )
     {
-        QPointF &minValue = points[i];
-        QPointF &maxValue = points[2 * size - 1 - i];
-
-        const QwtIntervalSample intervalSample = sample( from + i );
-        if ( orientation() == Qt::Vertical )
+        QPointF& minValue = points[i];
+        QPointF& maxValue = points[2 * size - 1 - i];
+
+        const QwtIntervalSample intervalSample = curve->sample( from + i );
+        if ( curve->orientation() == Qt::Vertical )
         {
             double x = xMap.transform( intervalSample.value );
             double y1 = yMap.transform( intervalSample.interval.minValue() );
             double y2 = yMap.transform( intervalSample.interval.maxValue() );
+
             if ( doAlign )
             {
@@ -407,4 +413,5 @@
             double x1 = xMap.transform( intervalSample.interval.minValue() );
             double x2 = xMap.transform( intervalSample.interval.maxValue() );
+
             if ( doAlign )
             {
@@ -421,14 +428,16 @@
     }
 
-    if ( d_data->brush.style() != Qt::NoBrush )
+    const bool doClip = curve->testPaintAttribute( QwtPlotIntervalCurve::ClipPolygons );
+
+    if ( curve->brush().style() != Qt::NoBrush )
     {
         painter->setPen( QPen( Qt::NoPen ) );
-        painter->setBrush( d_data->brush );
-
-        if ( d_data->paintAttributes & ClipPolygons )
+        painter->setBrush( curve->brush() );
+
+        if ( doClip )
         {
             const qreal m = 1.0;
-            const QPolygonF p = QwtClipper::clipPolygonF(
-               canvasRect.adjusted( -m, -m, m, m ), polygon, true );
+            const QPolygonF p = QwtClipper::clippedPolygonF(
+                canvasRect.adjusted( -m, -m, m, m ), polygon, true );
 
             QwtPainter::drawPolygon( painter, p );
@@ -440,25 +449,23 @@
     }
 
-    if ( d_data->pen.style() != Qt::NoPen )
-    {
-        painter->setPen( d_data->pen );
+    if ( curve->pen().style() != Qt::NoPen )
+    {
+        painter->setPen( curve->pen() );
         painter->setBrush( Qt::NoBrush );
 
-        if ( d_data->paintAttributes & ClipPolygons )
-        {
-            qreal pw = qMax( qreal( 1.0 ), painter->pen().widthF() );
+        if ( doClip )
+        {
+            qreal pw = QwtPainter::effectivePenWidth( painter->pen() );
             const QRectF clipRect = canvasRect.adjusted( -pw, -pw, pw, pw );
 
-            QPolygonF p;
-
-            p.resize( size );
-            ::memcpy( p.data(), points, size * sizeof( QPointF ) );
-            p = QwtClipper::clipPolygonF( clipRect, p );
-            QwtPainter::drawPolyline( painter, p );
-
-            p.resize( size );
-            ::memcpy( p.data(), points + size, size * sizeof( QPointF ) );
-            p = QwtClipper::clipPolygonF( clipRect, p );
-            QwtPainter::drawPolyline( painter, p );
+            QPolygonF p( size );
+
+            std::memcpy( p.data(), points, size * sizeof( QPointF ) );
+            QwtPainter::drawPolyline( painter,
+                QwtClipper::clippedPolygonF( clipRect, p ) );
+
+            std::memcpy( p.data(), points + size, size * sizeof( QPointF ) );
+            QwtPainter::drawPolyline( painter,
+                QwtClipper::clippedPolygonF( clipRect, p ) );
         }
         else
@@ -472,21 +479,356 @@
 }
 
-/*!
-  Draw symbols for a subset of the samples
-
-  \param painter Painter
-  \param symbol Interval symbol
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted
-
-  \sa setSymbol(), drawSeries(), drawTube()
-*/
+class QwtPlotIntervalCurve::PrivateData
+{
+  public:
+    PrivateData():
+        style( QwtPlotIntervalCurve::Tube ),
+        symbol( NULL ),
+        pen( Qt::black ),
+        brush( Qt::white )
+    {
+        paintAttributes = QwtPlotIntervalCurve::ClipPolygons;
+        paintAttributes |= QwtPlotIntervalCurve::ClipSymbol;
+
+        pen.setCapStyle( Qt::FlatCap );
+    }
+
+    ~PrivateData()
+    {
+        delete symbol;
+    }
+
+    QwtPlotIntervalCurve::CurveStyle style;
+    const QwtIntervalSymbol* symbol;
+
+    QPen pen;
+    QBrush brush;
+
+    QwtPlotIntervalCurve::PaintAttributes paintAttributes;
+};
+
+/*!
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotIntervalCurve::QwtPlotIntervalCurve( const QwtText& title )
+    : QwtPlotSeriesItem( title )
+{
+    init();
+}
+
+/*!
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotIntervalCurve::QwtPlotIntervalCurve( const QString& title )
+    : QwtPlotSeriesItem( QwtText( title ) )
+{
+    init();
+}
+
+//! Destructor
+QwtPlotIntervalCurve::~QwtPlotIntervalCurve()
+{
+    delete m_data;
+}
+
+//! Initialize internal members
+void QwtPlotIntervalCurve::init()
+{
+    setItemAttribute( QwtPlotItem::Legend, true );
+    setItemAttribute( QwtPlotItem::AutoScale, true );
+
+    m_data = new PrivateData;
+    setData( new QwtIntervalSeriesData() );
+
+    setZ( 19.0 );
+}
+
+//! \return QwtPlotItem::Rtti_PlotIntervalCurve
+int QwtPlotIntervalCurve::rtti() const
+{
+    return QwtPlotIntervalCurve::Rtti_PlotIntervalCurve;
+}
+
+/*!
+   Specify an attribute how to draw the curve
+
+   \param attribute Paint attribute
+   \param on On/Off
+   \sa testPaintAttribute()
+ */
+void QwtPlotIntervalCurve::setPaintAttribute(
+    PaintAttribute attribute, bool on )
+{
+    if ( on )
+        m_data->paintAttributes |= attribute;
+    else
+        m_data->paintAttributes &= ~attribute;
+}
+
+/*!
+    \return True, when attribute is enabled
+    \sa PaintAttribute, setPaintAttribute()
+ */
+bool QwtPlotIntervalCurve::testPaintAttribute(
+    PaintAttribute attribute ) const
+{
+    return ( m_data->paintAttributes & attribute );
+}
+
+/*!
+   Initialize data with an array of samples.
+   \param samples Vector of samples
+ */
+void QwtPlotIntervalCurve::setSamples(
+    const QVector< QwtIntervalSample >& samples )
+{
+    setData( new QwtIntervalSeriesData( samples ) );
+}
+
+/*!
+   Assign a series of samples
+
+   setSamples() is just a wrapper for setData() without any additional
+   value - beside that it is easier to find for the developer.
+
+   \param data Data
+   \warning The item takes ownership of the data object, deleting
+           it when its not used anymore.
+ */
+void QwtPlotIntervalCurve::setSamples(
+    QwtSeriesData< QwtIntervalSample >* data )
+{
+    setData( data );
+}
+
+/*!
+   Set the curve's drawing style
+
+   \param style Curve style
+   \sa CurveStyle, style()
+ */
+void QwtPlotIntervalCurve::setStyle( CurveStyle style )
+{
+    if ( style != m_data->style )
+    {
+        m_data->style = style;
+
+        legendChanged();
+        itemChanged();
+    }
+}
+
+/*!
+    \return Style of the curve
+    \sa setStyle()
+ */
+QwtPlotIntervalCurve::CurveStyle QwtPlotIntervalCurve::style() const
+{
+    return m_data->style;
+}
+
+/*!
+   Assign a symbol.
+
+   \param symbol Symbol
+   \sa symbol()
+ */
+void QwtPlotIntervalCurve::setSymbol( const QwtIntervalSymbol* symbol )
+{
+    if ( symbol != m_data->symbol )
+    {
+        delete m_data->symbol;
+        m_data->symbol = symbol;
+
+        legendChanged();
+        itemChanged();
+    }
+}
+
+/*!
+   \return Current symbol or NULL, when no symbol has been assigned
+   \sa setSymbol()
+ */
+const QwtIntervalSymbol* QwtPlotIntervalCurve::symbol() const
+{
+    return m_data->symbol;
+}
+
+/*!
+   Build and assign a pen
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtPlotIntervalCurve::setPen( const QColor& color, qreal width, Qt::PenStyle style )
+{
+    setPen( QPen( color, width, style ) );
+}
+
+/*!
+   \brief Assign a pen
+   \param pen New pen
+   \sa pen(), brush()
+ */
+void QwtPlotIntervalCurve::setPen( const QPen& pen )
+{
+    if ( pen != m_data->pen )
+    {
+        m_data->pen = pen;
+
+        legendChanged();
+        itemChanged();
+    }
+}
+
+/*!
+    \return Pen used to draw the lines
+    \sa setPen(), brush()
+ */
+const QPen& QwtPlotIntervalCurve::pen() const
+{
+    return m_data->pen;
+}
+
+/*!
+   Assign a brush.
+
+   The brush is used to fill the area in Tube style().
+
+   \param brush Brush
+   \sa brush(), pen(), setStyle(), CurveStyle
+ */
+void QwtPlotIntervalCurve::setBrush( const QBrush& brush )
+{
+    if ( brush != m_data->brush )
+    {
+        m_data->brush = brush;
+
+        legendChanged();
+        itemChanged();
+    }
+}
+
+/*!
+   \return Brush used to fill the area in Tube style()
+   \sa setBrush(), setStyle(), CurveStyle
+ */
+const QBrush& QwtPlotIntervalCurve::brush() const
+{
+    return m_data->brush;
+}
+
+/*!
+   \return Bounding rectangle of all samples.
+   For an empty series the rectangle is invalid.
+ */
+QRectF QwtPlotIntervalCurve::boundingRect() const
+{
+    QRectF rect = QwtPlotSeriesItem::boundingRect();
+    if ( orientation() == Qt::Vertical )
+        rect.setRect( rect.y(), rect.x(), rect.height(), rect.width() );
+
+    return rect;
+}
+
+/*!
+   Draw a subset of the samples
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
+         series will be painted to its last sample.
+
+   \sa drawTube(), drawSymbols()
+ */
+void QwtPlotIntervalCurve::drawSeries( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
+{
+    if ( to < 0 )
+        to = dataSize() - 1;
+
+    if ( from < 0 )
+        from = 0;
+
+    if ( from > to )
+        return;
+
+    if ( m_data->style == Tube )
+        drawTube( painter, xMap, yMap, canvasRect, from, to );
+
+    if ( m_data->symbol &&
+        ( m_data->symbol->style() != QwtIntervalSymbol::NoSymbol ) )
+    {
+        drawSymbols( painter, *m_data->symbol,
+            xMap, yMap, canvasRect, from, to );
+    }
+}
+
+/*!
+   Draw a tube
+
+   Builds 2 curves from the upper and lower limits of the intervals
+   and draws them with the pen(). The area between the curves is
+   filled with the brush().
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
+         series will be painted to its last sample.
+
+   \sa drawSeries(), drawSymbols()
+ */
+void QwtPlotIntervalCurve::drawTube(
+    QPainter* painter, const QwtScaleMap& xMap,
+    const QwtScaleMap& yMap, const QRectF& canvasRect, int from, int to) const
+{
+    if ( ( m_data->pen.style() == Qt::NoPen ) &&
+        ( m_data->brush.style() == Qt::NoBrush ) )
+    {
+        return;
+    }
+
+    const bool useLines = testPaintAttribute( TubeAsLines )
+        && QwtPainter::roundingAlignment( painter );
+
+    if ( useLines )
+        qwtDrawTubeLines( this, painter, xMap, yMap, canvasRect, from, to );
+    else
+        qwtDrawTube( this, painter, xMap, yMap, canvasRect, from, to );
+}
+
+/*!
+   Draw symbols for a subset of the samples
+
+   \param painter Painter
+   \param symbol Interval symbol
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted
+
+   \sa setSymbol(), drawSeries(), drawTube()
+ */
 void QwtPlotIntervalCurve::drawSymbols(
-    QPainter *painter, const QwtIntervalSymbol &symbol,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+    QPainter* painter, const QwtIntervalSymbol& symbol,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     painter->save();
@@ -505,5 +847,5 @@
     const double yMax = tr.bottom();
 
-    const bool doClip = d_data->paintAttributes & ClipSymbol;
+    const bool doClip = m_data->paintAttributes & ClipSymbol;
 
     for ( int i = from; i <= to; i++ )
@@ -541,17 +883,17 @@
 
 /*!
-  \return Icon for the legend
-
-  In case of Tube style() the icon is a plain rectangle filled with the brush().
-  If a symbol is assigned it is scaled to size.
-
-  \param index Index of the legend entry
+   \return Icon for the legend
+
+   In case of Tube style() the icon is a plain rectangle filled with the brush().
+   If a symbol is assigned it is scaled to size.
+
+   \param index Index of the legend entry
                ( ignored as there is only one )
-  \param size Icon size
-
-  \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
-*/
+   \param size Icon size
+
+   \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
+ */
 QwtGraphic QwtPlotIntervalCurve::legendIcon(
-    int index, const QSizeF &size ) const
+    int index, const QSizeF& size ) const
 {
     Q_UNUSED( index );
@@ -568,19 +910,19 @@
         testRenderHint( QwtPlotItem::RenderAntialiased ) );
 
-    if ( d_data->style == Tube )
+    if ( m_data->style == Tube )
     {
         QRectF r( 0, 0, size.width(), size.height() );
-        painter.fillRect( r, d_data->brush );
-    }
-
-    if ( d_data->symbol &&
-        ( d_data->symbol->style() != QwtIntervalSymbol::NoSymbol ) )
-    {
-        QPen pen = d_data->symbol->pen();
+        painter.fillRect( r, m_data->brush );
+    }
+
+    if ( m_data->symbol &&
+        ( m_data->symbol->style() != QwtIntervalSymbol::NoSymbol ) )
+    {
+        QPen pen = m_data->symbol->pen();
         pen.setWidthF( pen.widthF() );
         pen.setCapStyle( Qt::FlatCap );
 
         painter.setPen( pen );
-        painter.setBrush( d_data->symbol->brush() );
+        painter.setBrush( m_data->symbol->brush() );
 
         if ( orientation() == Qt::Vertical )
@@ -588,5 +930,5 @@
             const double x = 0.5 * size.width();
 
-            d_data->symbol->draw( &painter, orientation(),
+            m_data->symbol->draw( &painter, orientation(),
                 QPointF( x, 0 ), QPointF( x, size.height() - 1.0 ) );
         }
@@ -595,5 +937,5 @@
             const double y = 0.5 * size.height();
 
-            d_data->symbol->draw( &painter, orientation(),
+            m_data->symbol->draw( &painter, orientation(),
                 QPointF( 0.0, y ), QPointF( size.width() - 1.0, y ) );
         }
Index: /trunk/BNC/qwt/qwt_plot_intervalcurve.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_intervalcurve.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_intervalcurve.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,20 +13,21 @@
 #include "qwt_global.h"
 #include "qwt_plot_seriesitem.h"
-#include "qwt_series_data.h"
 
 class QwtIntervalSymbol;
+template< typename T > class QwtSeriesData;
 
 /*!
-  \brief QwtPlotIntervalCurve represents a series of samples, where each value
+   \brief QwtPlotIntervalCurve represents a series of samples, where each value
          is associated with an interval ( \f$[y1,y2] = f(x)\f$ ).
 
-  The representation depends on the style() and an optional symbol()
-  that is displayed for each interval. QwtPlotIntervalCurve might be used
-  to display error bars or the area between 2 curves.
-*/
-class QWT_EXPORT QwtPlotIntervalCurve:
-    public QwtPlotSeriesItem, public QwtSeriesStore<QwtIntervalSample>
+   The representation depends on the style() and an optional symbol()
+   that is displayed for each interval. QwtPlotIntervalCurve might be used
+   to display error bars or the area between 2 curves.
+ */
+class QWT_EXPORT QwtPlotIntervalCurve
+    : public QwtPlotSeriesItem
+    , public QwtSeriesStore< QwtIntervalSample >
 {
-public:
+  public:
     /*!
         \brief Curve styles.
@@ -34,5 +35,5 @@
 
         \sa setStyle(), style()
-    */
+     */
     enum CurveStyle
     {
@@ -60,70 +61,93 @@
         Attributes to modify the drawing algorithm.
         \sa setPaintAttribute(), testPaintAttribute()
-    */
+     */
     enum PaintAttribute
     {
         /*!
-          Clip polygons before painting them. In situations, where points
-          are far outside the visible area (f.e when zooming deep) this
-          might be a substantial improvement for the painting performance.
+           Clip polygons before painting them. In situations, where points
+           are far outside the visible area (f.e when zooming deep) this
+           might be a substantial improvement for the painting performance.
          */
         ClipPolygons = 0x01,
 
         //! Check if a symbol is on the plot canvas before painting it.
-        ClipSymbol   = 0x02
+        ClipSymbol   = 0x02,
+
+        /*!
+           Fill the tube with horizontal or vertical lines and unite
+           overlapping border lines. This attribute is useful for large
+           data sets, where consecutive samples are often mapped to the same
+           coordinate.
+
+           Beside other minor visual differences the filling is always
+           monochrome - using brush().color().
+
+           This algorithm is very fast and effective and can be used inside
+           a replot cycle. In the worst case the number of lines to be rendered
+           will be 5 times the ( width/height - depending on the orientation() )
+           of the plot canvas.
+
+           \note Has only an effect, when drawing to a paint device
+                 in integer coordinates ( f.e. all widgets on screen ).
+
+           \sa QwtPlotCurve::FilterPointsAggressive
+         */
+        TubeAsLines = 0x10
     };
 
-    //! Paint attributes
-    typedef QFlags<PaintAttribute> PaintAttributes;
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
 
-    explicit QwtPlotIntervalCurve( const QString &title = QString() );
-    explicit QwtPlotIntervalCurve( const QwtText &title );
+    explicit QwtPlotIntervalCurve( const QString& title = QString() );
+    explicit QwtPlotIntervalCurve( const QwtText& title );
 
     virtual ~QwtPlotIntervalCurve();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
     void setPaintAttribute( PaintAttribute, bool on = true );
     bool testPaintAttribute( PaintAttribute ) const;
 
-    void setSamples( const QVector<QwtIntervalSample> & );
-    void setSamples( QwtSeriesData<QwtIntervalSample> * );
+    void setSamples( const QVector< QwtIntervalSample >& );
+    void setSamples( QwtSeriesData< QwtIntervalSample >* );
 
-    void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setPen( const QPen & );
-    const QPen &pen() const;
+    void setPen( const QColor&,
+        qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
 
-    void setBrush( const QBrush & );
-    const QBrush &brush() const;
+    void setPen( const QPen& );
+    const QPen& pen() const;
+
+    void setBrush( const QBrush& );
+    const QBrush& brush() const;
 
     void setStyle( CurveStyle style );
     CurveStyle style() const;
 
-    void setSymbol( const QwtIntervalSymbol * );
-    const QwtIntervalSymbol *symbol() const;
+    void setSymbol( const QwtIntervalSymbol* );
+    const QwtIntervalSymbol* symbol() const;
 
-    virtual void drawSeries( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
+    virtual void drawSeries( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
 
-    virtual QRectF boundingRect() const;
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
 
-    virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
+    virtual QwtGraphic legendIcon(
+        int index, const QSizeF& ) const QWT_OVERRIDE;
 
-protected:
+  protected:
 
     void init();
 
-    virtual void drawTube( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
+    virtual void drawTube( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const;
 
-    virtual void drawSymbols( QPainter *, const QwtIntervalSymbol &,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
+    virtual void drawSymbols( QPainter*, const QwtIntervalSymbol&,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_item.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_item.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_item.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,26 +12,24 @@
 #include "qwt_plot.h"
 #include "qwt_legend_data.h"
-#include "qwt_scale_div.h"
+#include "qwt_scale_map.h"
 #include "qwt_graphic.h"
+
 #include <qpainter.h>
 
 class QwtPlotItem::PrivateData
 {
-public:
-    PrivateData():
-        plot( NULL ),
-        isVisible( true ),
-        attributes( 0 ),
-        interests( 0 ),
-        renderHints( 0 ),
-        renderThreadCount( 1 ),
-        z( 0.0 ),
-        xAxis( QwtPlot::xBottom ),
-        yAxis( QwtPlot::yLeft ),
-        legendIconSize( 8, 8 )
-    {
-    }
-
-    mutable QwtPlot *plot;
+  public:
+    PrivateData()
+        : plot( NULL )
+        , isVisible( true )
+        , renderThreadCount( 1 )
+        , z( 0.0 )
+        , xAxisId( QwtAxis::XBottom )
+        , yAxisId( QwtAxis::YLeft )
+        , legendIconSize( 8, 8 )
+    {
+    }
+
+    mutable QwtPlot* plot;
 
     bool isVisible;
@@ -45,6 +43,6 @@
     double z;
 
-    int xAxis;
-    int yAxis;
+    QwtAxisId xAxisId;
+    QwtAxisId yAxisId;
 
     QwtText title;
@@ -54,10 +52,28 @@
 /*!
    Constructor
+ */
+QwtPlotItem::QwtPlotItem()
+{
+    m_data = new PrivateData;
+}
+
+/*!
+   Constructor
    \param title Title of the item
-*/
-QwtPlotItem::QwtPlotItem( const QwtText &title )
-{
-    d_data = new PrivateData;
-    d_data->title = title;
+ */
+QwtPlotItem::QwtPlotItem( const QString& title )
+{
+    m_data = new PrivateData;
+    m_data->title = title;
+}
+
+/*!
+   Constructor
+   \param title Title of the item
+ */
+QwtPlotItem::QwtPlotItem( const QwtText& title )
+{
+    m_data = new PrivateData;
+    m_data->title = title;
 }
 
@@ -66,30 +82,30 @@
 {
     attach( NULL );
-    delete d_data;
-}
-
-/*!
-  \brief Attach the item to a plot.
-
-  This method will attach a QwtPlotItem to the QwtPlot argument. It will first
-  detach the QwtPlotItem from any plot from a previous call to attach (if
-  necessary). If a NULL argument is passed, it will detach from any QwtPlot it
-  was attached to.
-
-  \param plot Plot widget
-  \sa detach()
-*/
-void QwtPlotItem::attach( QwtPlot *plot )
-{
-    if ( plot == d_data->plot )
+    delete m_data;
+}
+
+/*!
+   \brief Attach the item to a plot.
+
+   This method will attach a QwtPlotItem to the QwtPlot argument. It will first
+   detach the QwtPlotItem from any plot from a previous call to attach (if
+   necessary). If a NULL argument is passed, it will detach from any QwtPlot it
+   was attached to.
+
+   \param plot Plot widget
+   \sa detach()
+ */
+void QwtPlotItem::attach( QwtPlot* plot )
+{
+    if ( plot == m_data->plot )
         return;
 
-    if ( d_data->plot )
-        d_data->plot->attachItem( this, false );
-
-    d_data->plot = plot;
-
-    if ( d_data->plot )
-        d_data->plot->attachItem( this, true );
+    if ( m_data->plot )
+        m_data->plot->attachItem( this, false );
+
+    m_data->plot = plot;
+
+    if ( m_data->plot )
+        m_data->plot->attachItem( this, true );
 }
 
@@ -100,5 +116,5 @@
    detach() is equivalent to calling attach( NULL )
    \sa attach()
-*/
+ */
 void QwtPlotItem::detach()
 {
@@ -117,5 +133,5 @@
    \return rtti value
    \sa RttiValues
-*/
+ */
 int QwtPlotItem::rtti() const
 {
@@ -124,7 +140,7 @@
 
 //! Return attached plot
-QwtPlot *QwtPlotItem::plot() const
-{
-    return d_data->plot;
+QwtPlot* QwtPlotItem::plot() const
+{
+    return m_data->plot;
 }
 
@@ -133,8 +149,8 @@
 
    \return setZ(), QwtPlotDict::itemList()
-*/
+ */
 double QwtPlotItem::z() const
 {
-    return d_data->z;
+    return m_data->z;
 }
 
@@ -146,16 +162,16 @@
    \param z Z-value
    \sa z(), QwtPlotDict::itemList()
-*/
+ */
 void QwtPlotItem::setZ( double z )
 {
-    if ( d_data->z != z )
-    {
-        if ( d_data->plot ) // update the z order
-            d_data->plot->attachItem( this, false );
-
-        d_data->z = z;
-
-        if ( d_data->plot )
-            d_data->plot->attachItem( this, true );
+    if ( m_data->z != z )
+    {
+        if ( m_data->plot ) // update the z order
+            m_data->plot->attachItem( this, false );
+
+        m_data->z = z;
+
+        if ( m_data->plot )
+            m_data->plot->attachItem( this, true );
 
         itemChanged();
@@ -168,6 +184,6 @@
    \param title Title
    \sa title()
-*/
-void QwtPlotItem::setTitle( const QString &title )
+ */
+void QwtPlotItem::setTitle( const QString& title )
 {
     setTitle( QwtText( title ) );
@@ -179,10 +195,10 @@
    \param title Title
    \sa title()
-*/
-void QwtPlotItem::setTitle( const QwtText &title )
-{
-    if ( d_data->title != title )
-    {
-        d_data->title = title;
+ */
+void QwtPlotItem::setTitle( const QwtText& title )
+{
+    if ( m_data->title != title )
+    {
+        m_data->title = title;
 
         legendChanged();
@@ -196,8 +212,8 @@
    \return Title of the item
    \sa setTitle()
-*/
-const QwtText &QwtPlotItem::title() const
-{
-    return d_data->title;
+ */
+const QwtText& QwtPlotItem::title() const
+{
+    return m_data->title;
 }
 
@@ -209,16 +225,31 @@
 
    \sa testItemAttribute(), ItemInterest
-*/
+ */
 void QwtPlotItem::setItemAttribute( ItemAttribute attribute, bool on )
 {
-    if ( d_data->attributes.testFlag( attribute ) != on )
+    if ( m_data->attributes.testFlag( attribute ) != on )
     {
         if ( on )
-            d_data->attributes |= attribute;
+            m_data->attributes |= attribute;
         else
-            d_data->attributes &= ~attribute;
+            m_data->attributes &= ~attribute;
 
         if ( attribute == QwtPlotItem::Legend )
-            legendChanged();
+        {
+            if ( on )
+            {
+                legendChanged();
+            }
+            else
+            {
+                /*
+                    In the special case of taking an item from
+                    the legend we can't use legendChanged() as
+                    it depends on QwtPlotItem::Legend being enabled
+                 */
+                if ( m_data->plot )
+                    m_data->plot->updateLegend( this );
+            }
+        }
 
         itemChanged();
@@ -232,8 +263,8 @@
    \return true/false
    \sa setItemAttribute(), ItemInterest
-*/
+ */
 bool QwtPlotItem::testItemAttribute( ItemAttribute attribute ) const
 {
-    return d_data->attributes.testFlag( attribute );
+    return m_data->attributes.testFlag( attribute );
 }
 
@@ -245,13 +276,13 @@
 
    \sa testItemInterest(), ItemAttribute
-*/
+ */
 void QwtPlotItem::setItemInterest( ItemInterest interest, bool on )
 {
-    if ( d_data->interests.testFlag( interest ) != on )
+    if ( m_data->interests.testFlag( interest ) != on )
     {
         if ( on )
-            d_data->interests |= interest;
+            m_data->interests |= interest;
         else
-            d_data->interests &= ~interest;
+            m_data->interests &= ~interest;
 
         itemChanged();
@@ -265,8 +296,8 @@
    \return true/false
    \sa setItemInterest(), ItemAttribute
-*/
+ */
 bool QwtPlotItem::testItemInterest( ItemInterest interest ) const
 {
-    return d_data->interests.testFlag( interest );
+    return m_data->interests.testFlag( interest );
 }
 
@@ -278,13 +309,13 @@
 
    \sa testRenderHint(), RenderHint
-*/
+ */
 void QwtPlotItem::setRenderHint( RenderHint hint, bool on )
 {
-    if ( d_data->renderHints.testFlag( hint ) != on )
+    if ( m_data->renderHints.testFlag( hint ) != on )
     {
         if ( on )
-            d_data->renderHints |= hint;
+            m_data->renderHints |= hint;
         else
-            d_data->renderHints &= ~hint;
+            m_data->renderHints &= ~hint;
 
         itemChanged();
@@ -298,8 +329,8 @@
    \return true/false
    \sa setRenderHint(), RenderHint
-*/
+ */
 bool QwtPlotItem::testRenderHint( RenderHint hint ) const
 {
-    return d_data->renderHints.testFlag( hint );
+    return m_data->renderHints.testFlag( hint );
 }
 
@@ -316,8 +347,8 @@
 
    The default thread count is 1 ( = no additional threads )
-*/
+ */
 void QwtPlotItem::setRenderThreadCount( uint numThreads )
 {
-    d_data->renderThreadCount = numThreads;
+    m_data->renderThreadCount = numThreads;
 }
 
@@ -326,8 +357,8 @@
            If numThreads() is set to 0, the system specific
            ideal thread count is used.
-*/
+ */
 uint QwtPlotItem::renderThreadCount() const
 {
-    return d_data->renderThreadCount;
+    return m_data->renderThreadCount;
 }
 
@@ -339,10 +370,10 @@
    \param size Size
    \sa legendIconSize(), legendIcon()
-*/
-void QwtPlotItem::setLegendIconSize( const QSize &size )
-{
-    if ( d_data->legendIconSize != size )
-    {
-        d_data->legendIconSize = size;
+ */
+void QwtPlotItem::setLegendIconSize( const QSize& size )
+{
+    if ( m_data->legendIconSize != size )
+    {
+        m_data->legendIconSize = size;
         legendChanged();
     }
@@ -352,8 +383,8 @@
    \return Legend icon size
    \sa setLegendIconSize(), legendIcon()
-*/
+ */
 QSize QwtPlotItem::legendIconSize() const
 {
-    return d_data->legendIconSize;
+    return m_data->legendIconSize;
 }
 
@@ -370,5 +401,5 @@
  */
 QwtGraphic QwtPlotItem::legendIcon(
-    int index, const QSizeF &size ) const
+    int index, const QSizeF& size ) const
 {
     Q_UNUSED( index )
@@ -390,5 +421,5 @@
  */
 QwtGraphic QwtPlotItem::defaultIcon(
-    const QBrush &brush, const QSizeF &size ) const
+    const QBrush& brush, const QSizeF& size ) const
 {
     QwtGraphic icon;
@@ -423,10 +454,10 @@
     \param on Show if true, otherwise hide
     \sa isVisible(), show(), hide()
-*/
+ */
 void QwtPlotItem::setVisible( bool on )
 {
-    if ( on != d_data->isVisible )
-    {
-        d_data->isVisible = on;
+    if ( on != m_data->isVisible )
+    {
+        m_data->isVisible = on;
         itemChanged();
     }
@@ -436,8 +467,8 @@
     \return true if visible
     \sa setVisible(), show(), hide()
-*/
+ */
 bool QwtPlotItem::isVisible() const
 {
-    return d_data->isVisible;
+    return m_data->isVisible;
 }
 
@@ -447,9 +478,9 @@
 
    \sa QwtPlot::legendChanged(), QwtPlot::autoRefresh()
-*/
+ */
 void QwtPlotItem::itemChanged()
 {
-    if ( d_data->plot )
-        d_data->plot->autoRefresh();
+    if ( m_data->plot )
+        m_data->plot->autoRefresh();
 }
 
@@ -457,9 +488,9 @@
    Update the legend of the parent plot.
    \sa QwtPlot::updateLegend(), itemChanged()
-*/
+ */
 void QwtPlotItem::legendChanged()
 {
-    if ( testItemAttribute( QwtPlotItem::Legend ) && d_data->plot )
-        d_data->plot->updateLegend( this );
+    if ( testItemAttribute( QwtPlotItem::Legend ) && m_data->plot )
+        m_data->plot->updateLegend( this );
 }
 
@@ -469,16 +500,16 @@
    The item will painted according to the coordinates of its Axes.
 
-   \param xAxis X Axis ( QwtPlot::xBottom or QwtPlot::xTop )
-   \param yAxis Y Axis ( QwtPlot::yLeft or QwtPlot::yRight )
-
-   \sa setXAxis(), setYAxis(), xAxis(), yAxis(), QwtPlot::Axis
-*/
-void QwtPlotItem::setAxes( int xAxis, int yAxis )
-{
-    if ( xAxis == QwtPlot::xBottom || xAxis == QwtPlot::xTop )
-        d_data->xAxis = xAxis;
-
-    if ( yAxis == QwtPlot::yLeft || yAxis == QwtPlot::yRight )
-        d_data->yAxis = yAxis;
+   \param xAxisId X Axis
+   \param yAxisId Y Axis
+
+   \sa setXAxis(), setYAxis(), xAxis(), yAxis()
+ */
+void QwtPlotItem::setAxes( QwtAxisId xAxisId, QwtAxisId yAxisId )
+{
+    if ( QwtAxis::isXAxis( xAxisId ) )
+        m_data->xAxisId = xAxisId;
+
+    if ( QwtAxis::isYAxis( yAxisId ) )
+        m_data->yAxisId = yAxisId;
 
     itemChanged();
@@ -490,12 +521,12 @@
    The item will painted according to the coordinates its Axes.
 
-   \param axis X Axis ( QwtPlot::xBottom or QwtPlot::xTop )
-   \sa setAxes(), setYAxis(), xAxis(), QwtPlot::Axis
-*/
-void QwtPlotItem::setXAxis( int axis )
-{
-    if ( axis == QwtPlot::xBottom || axis == QwtPlot::xTop )
-    {
-        d_data->xAxis = axis;
+   \param axisId X Axis
+   \sa setAxes(), setYAxis(), xAxis()
+ */
+void QwtPlotItem::setXAxis( QwtAxisId axisId )
+{
+    if ( QwtAxis::isXAxis( axisId ) )
+    {
+        m_data->xAxisId = axisId;
         itemChanged();
     }
@@ -507,12 +538,12 @@
    The item will painted according to the coordinates its Axes.
 
-   \param axis Y Axis ( QwtPlot::yLeft or QwtPlot::yRight )
-   \sa setAxes(), setXAxis(), yAxis(), QwtPlot::Axis
-*/
-void QwtPlotItem::setYAxis( int axis )
-{
-    if ( axis == QwtPlot::yLeft || axis == QwtPlot::yRight )
-    {
-        d_data->yAxis = axis;
+   \param axisId Y Axis
+   \sa setAxes(), setXAxis(), yAxis()
+ */
+void QwtPlotItem::setYAxis( QwtAxisId axisId )
+{
+    if ( QwtAxis::isYAxis( axisId ) )
+    {
+        m_data->yAxisId = axisId;
         itemChanged();
     }
@@ -520,13 +551,13 @@
 
 //! Return xAxis
-int QwtPlotItem::xAxis() const
-{
-    return d_data->xAxis;
+QwtAxisId QwtPlotItem::xAxis() const
+{
+    return m_data->xAxisId;
 }
 
 //! Return yAxis
-int QwtPlotItem::yAxis() const
-{
-    return d_data->yAxis;
+QwtAxisId QwtPlotItem::yAxis() const
+{
+    return m_data->yAxisId;
 }
 
@@ -534,5 +565,5 @@
    \return An invalid bounding rect: QRectF(1.0, 1.0, -2.0, -2.0)
    \note A width or height < 0.0 is ignored by the autoscaler
-*/
+ */
 QRectF QwtPlotItem::boundingRect() const
 {
@@ -562,7 +593,7 @@
    \sa QwtPlot::getCanvasMarginsHint(), QwtPlot::updateCanvasMargins()
  */
-void QwtPlotItem::getCanvasMarginHint( const QwtScaleMap &xMap,
-    const QwtScaleMap &yMap, const QRectF &canvasRect,
-    double &left, double &top, double &right, double &bottom ) const
+void QwtPlotItem::getCanvasMarginHint( const QwtScaleMap& xMap,
+    const QwtScaleMap& yMap, const QRectF& canvasRect,
+    double& left, double& top, double& right, double& bottom ) const
 {
     Q_UNUSED( xMap );
@@ -593,5 +624,5 @@
    \sa title(), legendIcon(), QwtLegend, QwtPlotLegendItem
  */
-QList<QwtLegendData> QwtPlotItem::legendData() const
+QList< QwtLegendData > QwtPlotItem::legendData() const
 {
     QwtLegendData data;
@@ -600,17 +631,15 @@
     label.setRenderFlags( label.renderFlags() & Qt::AlignLeft );
 
-    QVariant titleValue;
-    qVariantSetValue( titleValue, label );
-    data.setValue( QwtLegendData::TitleRole, titleValue );
+    data.setValue( QwtLegendData::TitleRole,
+        QVariant::fromValue( label ) );
 
     const QwtGraphic graphic = legendIcon( 0, legendIconSize() );
     if ( !graphic.isNull() )
     {
-        QVariant iconValue;
-        qVariantSetValue( iconValue, graphic );
-        data.setValue( QwtLegendData::IconRole, iconValue );
-    }
-
-    QList<QwtLegendData> list;
+        data.setValue( QwtLegendData::IconRole,
+            QVariant::fromValue( graphic ) );
+    }
+
+    QList< QwtLegendData > list;
     list += data;
 
@@ -633,7 +662,7 @@
 
    \sa QwtPlot::updateAxes(), ScaleInterest
-*/
-void QwtPlotItem::updateScaleDiv( const QwtScaleDiv &xScaleDiv,
-    const QwtScaleDiv &yScaleDiv )
+ */
+void QwtPlotItem::updateScaleDiv( const QwtScaleDiv& xScaleDiv,
+    const QwtScaleDiv& yScaleDiv )
 {
     Q_UNUSED( xScaleDiv );
@@ -659,6 +688,6 @@
          legendData() and legendIcon()
  */
-void QwtPlotItem::updateLegend( const QwtPlotItem *item,
-    const QList<QwtLegendData> &data )
+void QwtPlotItem::updateLegend( const QwtPlotItem* item,
+    const QList< QwtLegendData >& data )
 {
     Q_UNUSED( item );
@@ -673,7 +702,7 @@
 
    \return Bounding scale rect of the scale maps, not normalized
-*/
-QRectF QwtPlotItem::scaleRect( const QwtScaleMap &xMap,
-    const QwtScaleMap &yMap ) const
+ */
+QRectF QwtPlotItem::scaleRect( const QwtScaleMap& xMap,
+    const QwtScaleMap& yMap ) const
 {
     return QRectF( xMap.s1(), yMap.s1(),
@@ -688,7 +717,7 @@
 
    \return Bounding paint rectangle of the scale maps, not normalized
-*/
-QRectF QwtPlotItem::paintRect( const QwtScaleMap &xMap,
-    const QwtScaleMap &yMap ) const
+ */
+QRectF QwtPlotItem::paintRect( const QwtScaleMap& xMap,
+    const QwtScaleMap& yMap ) const
 {
     const QRectF rect( xMap.p1(), yMap.p1(),
Index: /trunk/BNC/qwt/qwt_plot_item.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_item.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_item.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,23 +12,25 @@
 
 #include "qwt_global.h"
-#include "qwt_text.h"
-#include "qwt_legend_data.h"
-#include "qwt_graphic.h"
-#include <qrect.h>
-#include <qlist.h>
+#include "qwt_axis_id.h"
 #include <qmetatype.h>
 
-class QPainter;
 class QwtScaleMap;
 class QwtScaleDiv;
 class QwtPlot;
+class QwtText;
+class QwtGraphic;
+class QwtLegendData;
+class QRectF;
+class QPainter;
+class QString;
+template< typename T > class QList;
 
 /*!
-  \brief Base class for items on the plot canvas
-
-  A plot item is "something", that can be painted on the plot canvas,
-  or only affects the scales of the plot widget. They can be categorized as:
-
-  - Representator\n
+   \brief Base class for items on the plot canvas
+
+   A plot item is "something", that can be painted on the plot canvas,
+   or only affects the scales of the plot widget. They can be categorized as:
+
+   - Representator\n
     A "Representator" is an item that represents some sort of data
     on the plot canvas. The different representator classes are organized
@@ -42,5 +44,5 @@
     - ...
 
-  - Decorators\n
+   - Decorators\n
     A "Decorator" is an item, that displays additional information, that
     is not related to any data:
@@ -50,19 +52,19 @@
     - ...
 
-  Depending on the QwtPlotItem::ItemAttribute flags, an item is included
-  into autoscaling or has an entry on the legend.
-
-  Before misusing the existing item classes it might be better to
-  implement a new type of plot item
-  ( don't implement a watermark as spectrogram ).
-  Deriving a new type of QwtPlotItem primarily means to implement
-  the YourPlotItem::draw() method.
-
-  \sa The cpuplot example shows the implementation of additional plot items.
-*/
+   Depending on the QwtPlotItem::ItemAttribute flags, an item is included
+   into autoscaling or has an entry on the legend.
+
+   Before misusing the existing item classes it might be better to
+   implement a new type of plot item
+   ( don't implement a watermark as spectrogram ).
+   Deriving a new type of QwtPlotItem primarily means to implement
+   the YourPlotItem::draw() method.
+
+   \sa The cpuplot example shows the implementation of additional plot items.
+ */
 
 class QWT_EXPORT QwtPlotItem
 {
-public:
+  public:
     /*!
         \brief Runtime type information
@@ -103,6 +105,6 @@
         Rtti_PlotSpectrogram,
 
-        //! For QwtPlotSvgItem
-        Rtti_PlotSVG,
+        //! For QwtPlotGraphicItem, QwtPlotSvgItem
+        Rtti_PlotGraphic,
 
         //! For QwtPlotTradingCurve
@@ -123,4 +125,7 @@
         //! For QwtPlotZoneItem
         Rtti_PlotZone,
+
+        //! For QwtPlotVectorField
+        Rtti_PlotVectorField,
 
         /*!
@@ -160,6 +165,5 @@
     };
 
-    //! Plot Item Attributes
-    typedef QFlags<ItemAttribute> ItemAttributes;
+    Q_DECLARE_FLAGS( ItemAttributes, ItemAttribute )
 
     /*!
@@ -194,6 +198,5 @@
     };
 
-    //! Plot Item Interests
-    typedef QFlags<ItemInterest> ItemInterests;
+    Q_DECLARE_FLAGS( ItemInterests, ItemInterest )
 
     //! Render hints
@@ -204,18 +207,20 @@
     };
 
-    //! Render hints
-    typedef QFlags<RenderHint> RenderHints;
-
-    explicit QwtPlotItem( const QwtText &title = QwtText() );
+    Q_DECLARE_FLAGS( RenderHints, RenderHint )
+
+    explicit QwtPlotItem();
+    explicit QwtPlotItem( const QString& title );
+    explicit QwtPlotItem( const QwtText& title );
+
     virtual ~QwtPlotItem();
 
-    void attach( QwtPlot *plot );
+    void attach( QwtPlot* plot );
     void detach();
 
-    QwtPlot *plot() const;
-
-    void setTitle( const QString &title );
-    void setTitle( const QwtText &title );
-    const QwtText &title() const;
+    QwtPlot* plot() const;
+
+    void setTitle( const QString& title );
+    void setTitle( const QwtText& title );
+    const QwtText& title() const;
 
     virtual int rtti() const;
@@ -233,5 +238,5 @@
     uint renderThreadCount() const;
 
-    void setLegendIconSize( const QSize & );
+    void setLegendIconSize( const QSize& );
     QSize legendIconSize() const;
 
@@ -244,11 +249,11 @@
     bool isVisible () const;
 
-    void setAxes( int xAxis, int yAxis );
-
-    void setXAxis( int axis );
-    int xAxis() const;
-
-    void setYAxis( int axis );
-    int yAxis() const;
+    void setAxes( QwtAxisId xAxis, QwtAxisId yAxis );
+
+    void setXAxis( QwtAxisId );
+    QwtAxisId xAxis() const;
+
+    void setYAxis( QwtAxisId );
+    QwtAxisId yAxis() const;
 
     virtual void itemChanged();
@@ -256,45 +261,43 @@
 
     /*!
-      \brief Draw the item
-
-      \param painter Painter
-      \param xMap Maps x-values into pixel coordinates.
-      \param yMap Maps y-values into pixel coordinates.
-      \param canvasRect Contents rect of the canvas in painter coordinates
-    */
-    virtual void draw( QPainter *painter,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect ) const = 0;
+       \brief Draw the item
+
+       \param painter Painter
+       \param xMap Maps x-values into pixel coordinates.
+       \param yMap Maps y-values into pixel coordinates.
+       \param canvasRect Contents rect of the canvas in painter coordinates
+     */
+    virtual void draw( QPainter* painter,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect ) const = 0;
 
     virtual QRectF boundingRect() const;
 
     virtual void getCanvasMarginHint(
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect,
-        double &left, double &top, double &right, double &bottom) const;
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect,
+        double& left, double& top, double& right, double& bottom) const;
 
     virtual void updateScaleDiv(
         const QwtScaleDiv&, const QwtScaleDiv& );
 
-    virtual void updateLegend( const QwtPlotItem *,
-        const QList<QwtLegendData> & );
-
-    QRectF scaleRect( const QwtScaleMap &, const QwtScaleMap & ) const;
-    QRectF paintRect( const QwtScaleMap &, const QwtScaleMap & ) const;
-
-    virtual QList<QwtLegendData> legendData() const;
-
-    virtual QwtGraphic legendIcon( int index, const QSizeF  & ) const;
-
-protected:
-    QwtGraphic defaultIcon( const QBrush &, const QSizeF & ) const;
-
-private:
-    // Disabled copy constructor and operator=
-    QwtPlotItem( const QwtPlotItem & );
-    QwtPlotItem &operator=( const QwtPlotItem & );
+    virtual void updateLegend( const QwtPlotItem*,
+        const QList< QwtLegendData >& );
+
+    QRectF scaleRect( const QwtScaleMap&, const QwtScaleMap& ) const;
+    QRectF paintRect( const QwtScaleMap&, const QwtScaleMap& ) const;
+
+    virtual QList< QwtLegendData > legendData() const;
+
+    virtual QwtGraphic legendIcon( int index, const QSizeF& ) const;
+
+  protected:
+    QwtGraphic defaultIcon( const QBrush&, const QSizeF& ) const;
+
+  private:
+    Q_DISABLE_COPY(QwtPlotItem)
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
@@ -303,5 +306,5 @@
 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::RenderHints )
 
-Q_DECLARE_METATYPE( QwtPlotItem * )
+Q_DECLARE_METATYPE( QwtPlotItem* )
 
 #endif
Index: /trunk/BNC/qwt/qwt_plot_layout.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_layout.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_layout.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,763 +13,520 @@
 #include "qwt_scale_widget.h"
 #include "qwt_abstract_legend.h"
-#include <qscrollbar.h>
-#include <qmath.h>
-
-class QwtPlotLayout::LayoutData
-{
-public:
-    void init( const QwtPlot *, const QRectF &rect );
-
-    struct t_legendData
-    {
-        int frameWidth;
-        int hScrollExtent;
-        int vScrollExtent;
-        QSize hint;
-    } legend;
-
-    struct t_titleData
-    {
-        QwtText text;
-        int frameWidth;
-    } title;
-
-    struct t_footerData
-    {
-        QwtText text;
-        int frameWidth;
-    } footer;
-
-    struct t_scaleData
-    {
-        bool isEnabled;
-        const QwtScaleWidget *scaleWidget;
-        QFont scaleFont;
-        int start;
-        int end;
-        int baseLineOffset;
-        double tickOffset;
-        int dimWithoutTitle;
-    } scale[QwtPlot::axisCnt];
-
-    struct t_canvasData
-    {
-        int contentsMargins[ QwtPlot::axisCnt ];
-
-    } canvas;
-};
-
-/*
-  Extract all layout relevant data from the plot components
-*/
-void QwtPlotLayout::LayoutData::init( const QwtPlot *plot, const QRectF &rect )
-{
-    // legend
-
-    if ( plot->legend() )
-    {
-        legend.frameWidth = plot->legend()->frameWidth();
-        legend.hScrollExtent =
-            plot->legend()->scrollExtent( Qt::Horizontal );
-        legend.vScrollExtent =
-            plot->legend()->scrollExtent( Qt::Vertical );
-
-        const QSize hint = plot->legend()->sizeHint();
-
-        const int w = qMin( hint.width(), qFloor( rect.width() ) );
-
-        int h = plot->legend()->heightForWidth( w );
-        if ( h <= 0 )
-            h = hint.height();
-
-        legend.hint = QSize( w, h );
-    }
-
-    // title
-
-    title.frameWidth = 0;
-    title.text = QwtText();
-
-    if ( plot->titleLabel() )
-    {
-        const QwtTextLabel *label = plot->titleLabel();
-        title.text = label->text();
-        if ( !( title.text.testPaintAttribute( QwtText::PaintUsingTextFont ) ) )
-            title.text.setFont( label->font() );
-
-        title.frameWidth = plot->titleLabel()->frameWidth();
-    }
-
-    // footer
-
-    footer.frameWidth = 0;
-    footer.text = QwtText();
-
-    if ( plot->footerLabel() )
-    {
-        const QwtTextLabel *label = plot->footerLabel();
-        footer.text = label->text();
-        if ( !( footer.text.testPaintAttribute( QwtText::PaintUsingTextFont ) ) )
-            footer.text.setFont( label->font() );
-
-        footer.frameWidth = plot->footerLabel()->frameWidth();
-    }
-
-    // scales
-
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-    {
-        if ( plot->axisEnabled( axis ) )
-        {
-            const QwtScaleWidget *scaleWidget = plot->axisWidget( axis );
-
-            scale[axis].isEnabled = true;
-
-            scale[axis].scaleWidget = scaleWidget;
-
-            scale[axis].scaleFont = scaleWidget->font();
-
-            scale[axis].start = scaleWidget->startBorderDist();
-            scale[axis].end = scaleWidget->endBorderDist();
-
-            scale[axis].baseLineOffset = scaleWidget->margin();
-            scale[axis].tickOffset = scaleWidget->margin();
-            if ( scaleWidget->scaleDraw()->hasComponent(
-                QwtAbstractScaleDraw::Ticks ) )
-            {
-                scale[axis].tickOffset +=
-                    scaleWidget->scaleDraw()->maxTickLength();
-            }
-
-            scale[axis].dimWithoutTitle = scaleWidget->dimForLength(
-                QWIDGETSIZE_MAX, scale[axis].scaleFont );
-
-            if ( !scaleWidget->title().isEmpty() )
-            {
-                scale[axis].dimWithoutTitle -=
-                    scaleWidget->titleHeightForWidth( QWIDGETSIZE_MAX );
-            }
-        }
-        else
-        {
-            scale[axis].isEnabled = false;
-            scale[axis].start = 0;
-            scale[axis].end = 0;
-            scale[axis].baseLineOffset = 0;
-            scale[axis].tickOffset = 0.0;
-            scale[axis].dimWithoutTitle = 0;
-        }
-    }
-
-    // canvas
-
-    plot->canvas()->getContentsMargins(
-        &canvas.contentsMargins[ QwtPlot::yLeft ],
-        &canvas.contentsMargins[ QwtPlot::xTop ],
-        &canvas.contentsMargins[ QwtPlot::yRight ],
-        &canvas.contentsMargins[ QwtPlot::xBottom ] );
-}
-
-class QwtPlotLayout::PrivateData
-{
-public:
-    PrivateData():
-        spacing( 5 )
-    {
-    }
-
-    QRectF titleRect;
-    QRectF footerRect;
-    QRectF legendRect;
-    QRectF scaleRect[QwtPlot::axisCnt];
-    QRectF canvasRect;
-
-    QwtPlotLayout::LayoutData layoutData;
-
-    QwtPlot::LegendPosition legendPos;
-    double legendRatio;
-    unsigned int spacing;
-    unsigned int canvasMargin[QwtPlot::axisCnt];
-    bool alignCanvasToScales[QwtPlot::axisCnt];
-};
-
-/*!
-  \brief Constructor
- */
-
-QwtPlotLayout::QwtPlotLayout()
-{
-    d_data = new PrivateData;
-
-    setLegendPosition( QwtPlot::BottomLegend );
-    setCanvasMargin( 4 );
-    setAlignCanvasToScales( false );
-
-    invalidate();
-}
-
-//! Destructor
-QwtPlotLayout::~QwtPlotLayout()
-{
-    delete d_data;
-}
-
-/*!
-  Change a margin of the canvas. The margin is the space
-  above/below the scale ticks. A negative margin will
-  be set to -1, excluding the borders of the scales.
-
-  \param margin New margin
-  \param axis One of QwtPlot::Axis. Specifies where the position of the margin.
-              -1 means margin at all borders.
-  \sa canvasMargin()
-
-  \warning The margin will have no effect when alignCanvasToScale() is true
-*/
-
-void QwtPlotLayout::setCanvasMargin( int margin, int axis )
-{
-    if ( margin < -1 )
-        margin = -1;
-
-    if ( axis == -1 )
-    {
-        for ( axis = 0; axis < QwtPlot::axisCnt; axis++ )
-            d_data->canvasMargin[axis] = margin;
-    }
-    else if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        d_data->canvasMargin[axis] = margin;
-}
-
-/*!
-    \param axisId Axis index
-    \return Margin around the scale tick borders
-    \sa setCanvasMargin()
-*/
-int QwtPlotLayout::canvasMargin( int axisId ) const
-{
-    if ( axisId < 0 || axisId >= QwtPlot::axisCnt )
+#include "qwt_math.h"
+
+#include <qmargins.h>
+
+namespace
+{
+    class LayoutData
+    {
+      public:
+        struct LegendData
+        {
+            void init( const QwtAbstractLegend* legend )
+            {
+                if ( legend )
+                {
+                    frameWidth = legend->frameWidth();
+                    hScrollExtent = legend->scrollExtent( Qt::Horizontal );
+                    vScrollExtent = legend->scrollExtent( Qt::Vertical );
+
+                    hint = legend->sizeHint();
+                }
+            }
+
+            QSize legendHint( const QwtAbstractLegend* legend, const QRectF& rect ) const
+            {
+                const int w = qMin( hint.width(), qwtFloor( rect.width() ) );
+
+                int h = legend->heightForWidth( w );
+                if ( h <= 0 )
+                    h = hint.height();
+
+                return QSize( w, h );
+            }
+
+            int frameWidth;
+            int hScrollExtent;
+            int vScrollExtent;
+            QSize hint;
+        };
+
+        struct LabelData
+        {
+            void init( const QwtTextLabel* label )
+            {
+                frameWidth = 0;
+                text = QwtText();
+
+                if ( label )
+                {
+                    text = label->text();
+                    if ( !( text.testPaintAttribute( QwtText::PaintUsingTextFont ) ) )
+                        text.setFont( label->font() );
+
+                    frameWidth = label->frameWidth();
+                }
+            }
+
+            QwtText text;
+            int frameWidth;
+        };
+
+        struct ScaleData
+        {
+            void init( const QwtScaleWidget* axisWidget )
+            {
+                isVisible = true;
+
+                scaleWidget = axisWidget;
+                scaleFont = axisWidget->font();
+
+                start = axisWidget->startBorderDist();
+                end = axisWidget->endBorderDist();
+
+                baseLineOffset = axisWidget->margin();
+
+                tickOffset = axisWidget->margin();
+                if ( axisWidget->scaleDraw()->hasComponent( QwtAbstractScaleDraw::Ticks ) )
+                    tickOffset += axisWidget->scaleDraw()->maxTickLength();
+
+                dimWithoutTitle = axisWidget->dimForLength( QWIDGETSIZE_MAX, scaleFont );
+                if ( !axisWidget->title().isEmpty() )
+                    dimWithoutTitle -= axisWidget->titleHeightForWidth( QWIDGETSIZE_MAX );
+            }
+
+            void reset()
+            {
+                isVisible = false;
+                start = 0;
+                end = 0;
+                baseLineOffset = 0;
+                tickOffset = 0.0;
+                dimWithoutTitle = 0;
+            }
+
+            bool isVisible;
+            const QwtScaleWidget* scaleWidget;
+            QFont scaleFont;
+            int start;
+            int end;
+            int baseLineOffset;
+            double tickOffset;
+            int dimWithoutTitle;
+        };
+
+        struct CanvasData
+        {
+            void init( const QWidget* canvas )
+            {
+                const QMargins m = canvas->contentsMargins();
+
+                contentsMargins[ QwtAxis::YLeft ] = m.left();
+                contentsMargins[ QwtAxis::XTop ] = m.top();
+                contentsMargins[ QwtAxis::YRight ] = m.right();
+                contentsMargins[ QwtAxis::XBottom ] = m.bottom();
+            }
+
+            int contentsMargins[ QwtAxis::AxisPositions ];
+        };
+
+      public:
+        enum Label
+        {
+            Title,
+            Footer,
+
+            NumLabels
+        };
+
+        LayoutData( const QwtPlot* );
+        bool hasSymmetricYAxes() const;
+
+        inline ScaleData& axisData( QwtAxisId axisId )
+        {
+            return m_scaleData[ axisId ];
+        }
+
+        inline const ScaleData& axisData( QwtAxisId axisId ) const
+        {
+            return m_scaleData[ axisId ];
+        }
+
+        inline double tickOffset( int axisPos ) const
+        {
+            return axisData( axisPos ).tickOffset;
+        }
+
+        LegendData legendData;
+        LabelData labelData[ NumLabels ];
+        CanvasData canvasData;
+
+      private:
+        ScaleData m_scaleData[ QwtAxis::AxisPositions ];
+    };
+
+    /*
+       Extract all layout relevant data from the plot components
+     */
+    LayoutData::LayoutData( const QwtPlot* plot )
+    {
+        legendData.init( plot->legend() );
+        labelData[ Title ].init( plot->titleLabel() );
+        labelData[ Footer ].init( plot->footerLabel() );
+
+        for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+        {
+            {
+                const QwtAxisId axisId( axisPos );
+
+                ScaleData& scaleData = axisData( axisId );
+
+                if ( plot->isAxisVisible( axisId ) )
+                {
+                    const QwtScaleWidget* scaleWidget = plot->axisWidget( axisId );
+                    scaleData.init( scaleWidget );
+                }
+                else
+                {
+                    scaleData.reset();
+                }
+            }
+        }
+
+        canvasData.init( plot->canvas() );
+    }
+
+    bool LayoutData::hasSymmetricYAxes() const
+    {
+        using namespace QwtAxis;
+        return m_scaleData[ YLeft ].isVisible == m_scaleData[ YRight ].isVisible;
+    }
+}
+
+namespace
+{
+    class LayoutHintData
+    {
+      public:
+        LayoutHintData( const QwtPlot* plot );
+
+        int alignedSize( const QwtAxisId ) const;
+
+        inline int yAxesWidth() const
+        {
+            using namespace QwtAxis;
+            return axesWidth( YLeft ) + axesWidth( YRight );
+        }
+
+        inline int yAxesHeight() const
+        {
+            using namespace QwtAxis;
+            return qMax( axesHeight( YLeft ), axesHeight( YRight ) );
+        }
+
+        inline int xAxesHeight() const
+        {
+            using namespace QwtAxis;
+            return axesHeight( XTop ) + axesHeight( XBottom );
+        }
+
+        inline int xAxesWidth() const
+        {
+            using namespace QwtAxis;
+            return qMax( axesWidth( XTop ), axesWidth( XBottom ) );
+        }
+
+      private:
+
+        struct ScaleData
+        {
+            ScaleData()
+            {
+                w = h = minLeft = minRight = tickOffset = 0;
+            }
+
+            int w;
+            int h;
+            int minLeft;
+            int minRight;
+            int tickOffset;
+
+        };
+
+        const ScaleData& axisData( QwtAxisId axisId ) const
+        {
+            return m_scaleData[ axisId ];
+        }
+
+        ScaleData& axisData( QwtAxisId axisId )
+        {
+            return m_scaleData[ axisId ];
+        }
+
+        inline int axesWidth( int axisPos ) const
+        {
+            return m_scaleData[axisPos].w;
+        }
+
+        inline int axesHeight( int axisPos ) const
+        {
+            return m_scaleData[axisPos].h;
+        }
+
+        int m_canvasBorder[QwtAxis::AxisPositions];
+        ScaleData m_scaleData[QwtAxis::AxisPositions];
+    };
+
+    LayoutHintData::LayoutHintData( const QwtPlot* plot )
+    {
+        using namespace QwtAxis;
+
+        const QMargins m = plot->canvas()->contentsMargins();
+
+        int contentsMargins[ 4 ];
+        contentsMargins[ YLeft ] = m.left();
+        contentsMargins[ XTop ] = m.top();
+        contentsMargins[ YRight ] = m.right();
+        contentsMargins[ XBottom ] = m.bottom();
+
+        for ( int axisPos = 0; axisPos < AxisPositions; axisPos++ )
+        {
+            m_canvasBorder[axisPos] = contentsMargins[axisPos] +
+                plot->plotLayout()->canvasMargin( axisPos ) + 1;
+            {
+                const QwtAxisId axisId( axisPos );
+
+                if ( plot->isAxisVisible( axisId ) )
+                {
+                    const QwtScaleWidget* scl = plot->axisWidget( axisId );
+
+                    const QSize hint = scl->minimumSizeHint();
+
+                    ScaleData& sd = axisData( axisId );
+                    sd.w = hint.width();
+                    sd.h = hint.height();
+                    scl->getBorderDistHint( sd.minLeft, sd.minRight );
+
+                    {
+                        sd.tickOffset = scl->margin();
+                        if ( scl->scaleDraw()->hasComponent( QwtAbstractScaleDraw::Ticks ) )
+                            sd.tickOffset += qwtCeil( scl->scaleDraw()->maxTickLength() );
+                    }
+                }
+            }
+        }
+
+        for ( int axis = 0; axis < AxisPositions; axis++ )
+        {
+            const int sz = alignedSize( axis );
+
+            ScaleData& sd = axisData( axis );
+            if ( isXAxis( axis ) )
+                sd.w = sz;
+            else
+                sd.h = sz;
+        }
+    }
+
+    int LayoutHintData::alignedSize( const QwtAxisId axisId ) const
+    {
+        using namespace QwtAxis;
+
+        const ScaleData& sd = axisData( axisId );
+
+        if ( sd.w && isXAxis( axisId ) )
+        {
+            int w = sd.w;
+
+            if ( const int leftW = axesWidth( YLeft ) )
+            {
+                const int shiftLeft = sd.minLeft - m_canvasBorder[YLeft];
+                if ( shiftLeft > 0 )
+                    w -= qMin( shiftLeft, leftW );
+            }
+
+            if ( const int rightW = axesWidth( YRight ) )
+            {
+                const int shiftRight = sd.minRight - m_canvasBorder[YRight];
+                if ( shiftRight > 0 )
+                    w -= qMin( shiftRight, rightW );
+            }
+
+            return w;
+        }
+
+        if ( sd.h && isYAxis( axisId ) )
+        {
+            int h = sd.h;
+
+            if ( axesHeight( XBottom ) )
+            {
+                const int shiftBottom = sd.minLeft - m_canvasBorder[XBottom];
+                if ( shiftBottom > 0 )
+                    h -= qMin( shiftBottom, axisData( XBottom ).tickOffset );
+            }
+
+            if ( axesHeight( XTop ) )
+            {
+                const int shiftTop = sd.minRight - m_canvasBorder[XTop];
+                if ( shiftTop > 0 )
+                    h -= qMin( shiftTop, axisData( XTop ).tickOffset );
+            }
+
+            return h;
+        }
+
         return 0;
-
-    return d_data->canvasMargin[axisId];
-}
-
-/*!
-  \brief Set the align-canvas-to-axis-scales flag for all axes
-
-  \param on True/False
-  \sa setAlignCanvasToScale(), alignCanvasToScale()
-*/
-void QwtPlotLayout::setAlignCanvasToScales( bool on )
-{
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-        d_data->alignCanvasToScales[axis] = on;
-}
-
-/*!
-  Change the align-canvas-to-axis-scales setting. The canvas may:
-
-  - extend beyond the axis scale ends to maximize its size,
-  - align with the axis scale ends to control its size.
-
-  The axisId parameter is somehow confusing as it identifies a border
-  of the plot and not the axes, that are aligned. F.e when QwtPlot::yLeft
-  is set, the left end of the the x-axes ( QwtPlot::xTop, QwtPlot::xBottom )
-  is aligned.
-
-  \param axisId Axis index
-  \param on New align-canvas-to-axis-scales setting
-
-  \sa setCanvasMargin(), alignCanvasToScale(), setAlignCanvasToScales()
-  \warning In case of on == true canvasMargin() will have no effect
-*/
-void QwtPlotLayout::setAlignCanvasToScale( int axisId, bool on )
-{
-    if ( axisId >= 0 && axisId < QwtPlot::axisCnt )
-        d_data->alignCanvasToScales[axisId] = on;
-}
-
-/*!
-  Return the align-canvas-to-axis-scales setting. The canvas may:
-  - extend beyond the axis scale ends to maximize its size
-  - align with the axis scale ends to control its size.
-
-  \param axisId Axis index
-  \return align-canvas-to-axis-scales setting
-  \sa setAlignCanvasToScale(), setAlignCanvasToScale(), setCanvasMargin()
-*/
-bool QwtPlotLayout::alignCanvasToScale( int axisId ) const
-{
-    if ( axisId < 0 || axisId >= QwtPlot::axisCnt )
-        return false;
-
-    return d_data->alignCanvasToScales[ axisId ];
-}
-
-/*!
-  Change the spacing of the plot. The spacing is the distance
-  between the plot components.
-
-  \param spacing New spacing
-  \sa setCanvasMargin(), spacing()
-*/
-void QwtPlotLayout::setSpacing( int spacing )
-{
-    d_data->spacing = qMax( 0, spacing );
-}
-
-/*!
-  \return Spacing
-  \sa margin(), setSpacing()
-*/
-int QwtPlotLayout::spacing() const
-{
-    return d_data->spacing;
-}
-
-/*!
-  \brief Specify the position of the legend
-  \param pos The legend's position.
-  \param ratio Ratio between legend and the bounding rectangle
-               of title, footer, canvas and axes. The legend will be shrunk
-               if it would need more space than the given ratio.
-               The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0
-               it will be reset to the default ratio.
-               The default vertical/horizontal ratio is 0.33/0.5.
-
-  \sa QwtPlot::setLegendPosition()
-*/
-
-void QwtPlotLayout::setLegendPosition( QwtPlot::LegendPosition pos, double ratio )
-{
-    if ( ratio > 1.0 )
-        ratio = 1.0;
-
-    switch ( pos )
-    {
-        case QwtPlot::TopLegend:
-        case QwtPlot::BottomLegend:
-            if ( ratio <= 0.0 )
-                ratio = 0.33;
-            d_data->legendRatio = ratio;
-            d_data->legendPos = pos;
-            break;
-        case QwtPlot::LeftLegend:
-        case QwtPlot::RightLegend:
-            if ( ratio <= 0.0 )
-                ratio = 0.5;
-            d_data->legendRatio = ratio;
-            d_data->legendPos = pos;
-            break;
-        default:
-            break;
-    }
-}
-
-/*!
-  \brief Specify the position of the legend
-  \param pos The legend's position. Valid values are
-      \c QwtPlot::LeftLegend, \c QwtPlot::RightLegend,
-      \c QwtPlot::TopLegend, \c QwtPlot::BottomLegend.
-
-  \sa QwtPlot::setLegendPosition()
-*/
-void QwtPlotLayout::setLegendPosition( QwtPlot::LegendPosition pos )
-{
-    setLegendPosition( pos, 0.0 );
-}
-
-/*!
-  \return Position of the legend
-  \sa setLegendPosition(), QwtPlot::setLegendPosition(),
-      QwtPlot::legendPosition()
-*/
-QwtPlot::LegendPosition QwtPlotLayout::legendPosition() const
-{
-    return d_data->legendPos;
-}
-
-/*!
-  Specify the relative size of the legend in the plot
-  \param ratio Ratio between legend and the bounding rectangle
-               of title, footer, canvas and axes. The legend will be shrunk
-               if it would need more space than the given ratio.
-               The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0
-               it will be reset to the default ratio.
-               The default vertical/horizontal ratio is 0.33/0.5.
-*/
-void QwtPlotLayout::setLegendRatio( double ratio )
-{
-    setLegendPosition( legendPosition(), ratio );
-}
-
-/*!
-  \return The relative size of the legend in the plot.
-  \sa setLegendPosition()
-*/
-double QwtPlotLayout::legendRatio() const
-{
-    return d_data->legendRatio;
-}
-
-/*!
-  \brief Set the geometry for the title
-
-  This method is intended to be used from derived layouts
-  overloading activate()
-
-  \sa titleRect(), activate()
- */
-void QwtPlotLayout::setTitleRect( const QRectF &rect )
-{
-    d_data->titleRect = rect;
-}
-
-/*!
-  \return Geometry for the title
-  \sa activate(), invalidate()
-*/
-QRectF QwtPlotLayout::titleRect() const
-{
-    return d_data->titleRect;
-}
-
-/*!
-  \brief Set the geometry for the footer
-
-  This method is intended to be used from derived layouts
-  overloading activate()
-
-  \sa footerRect(), activate()
- */
-void QwtPlotLayout::setFooterRect( const QRectF &rect )
-{
-    d_data->footerRect = rect;
-}
-
-/*!
-  \return Geometry for the footer
-  \sa activate(), invalidate()
-*/
-QRectF QwtPlotLayout::footerRect() const
-{
-    return d_data->footerRect;
-}
-
-/*!
-  \brief Set the geometry for the legend
-
-  This method is intended to be used from derived layouts
-  overloading activate()
-
-  \param rect Rectangle for the legend
-
-  \sa legendRect(), activate()
- */
-void QwtPlotLayout::setLegendRect( const QRectF &rect )
-{
-    d_data->legendRect = rect;
-}
-
-/*!
-  \return Geometry for the legend
-  \sa activate(), invalidate()
-*/
-QRectF QwtPlotLayout::legendRect() const
-{
-    return d_data->legendRect;
-}
-
-/*!
-  \brief Set the geometry for an axis
-
-  This method is intended to be used from derived layouts
-  overloading activate()
-
-  \param axis Axis index
-  \param rect Rectangle for the scale
-
-  \sa scaleRect(), activate()
- */
-void QwtPlotLayout::setScaleRect( int axis, const QRectF &rect )
-{
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        d_data->scaleRect[axis] = rect;
-}
-
-/*!
-  \param axis Axis index
-  \return Geometry for the scale
-  \sa activate(), invalidate()
-*/
-QRectF QwtPlotLayout::scaleRect( int axis ) const
-{
-    if ( axis < 0 || axis >= QwtPlot::axisCnt )
-    {
-        static QRectF dummyRect;
-        return dummyRect;
-    }
-    return d_data->scaleRect[axis];
-}
-
-/*!
-  \brief Set the geometry for the canvas
-
-  This method is intended to be used from derived layouts
-  overloading activate()
-
-  \sa canvasRect(), activate()
- */
-void QwtPlotLayout::setCanvasRect( const QRectF &rect )
-{
-    d_data->canvasRect = rect;
-}
-
-/*!
-  \return Geometry for the canvas
-  \sa activate(), invalidate()
-*/
-QRectF QwtPlotLayout::canvasRect() const
-{
-    return d_data->canvasRect;
-}
-
-/*!
-  Invalidate the geometry of all components.
-  \sa activate()
-*/
-void QwtPlotLayout::invalidate()
-{
-    d_data->titleRect = d_data->footerRect
-        = d_data->legendRect = d_data->canvasRect = QRect();
-
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-        d_data->scaleRect[axis] = QRect();
-}
-
-/*!
-  \return Minimum size hint
-  \param plot Plot widget
-
-  \sa QwtPlot::minimumSizeHint()
-*/
-
-QSize QwtPlotLayout::minimumSizeHint( const QwtPlot *plot ) const
-{
-    class ScaleData
-    {
-    public:
-        ScaleData()
-        {
-            w = h = minLeft = minRight = tickOffset = 0;
-        }
-
-        int w;
-        int h;
-        int minLeft;
-        int minRight;
-        int tickOffset;
-    } scaleData[QwtPlot::axisCnt];
-
-    int canvasBorder[QwtPlot::axisCnt];
-
-    int fw;
-    plot->canvas()->getContentsMargins( &fw, NULL, NULL, NULL );
-
-    int axis;
-    for ( axis = 0; axis < QwtPlot::axisCnt; axis++ )
-    {
-        if ( plot->axisEnabled( axis ) )
-        {
-            const QwtScaleWidget *scl = plot->axisWidget( axis );
-            ScaleData &sd = scaleData[axis];
-
-            const QSize hint = scl->minimumSizeHint();
-            sd.w = hint.width();
-            sd.h = hint.height();
-            scl->getBorderDistHint( sd.minLeft, sd.minRight );
-            sd.tickOffset = scl->margin();
-            if ( scl->scaleDraw()->hasComponent( QwtAbstractScaleDraw::Ticks ) )
-                sd.tickOffset += qCeil( scl->scaleDraw()->maxTickLength() );
-        }
-
-        canvasBorder[axis] = fw + d_data->canvasMargin[axis] + 1;
-    }
-
-
-    for ( axis = 0; axis < QwtPlot::axisCnt; axis++ )
-    {
-        ScaleData &sd = scaleData[axis];
-        if ( sd.w && ( axis == QwtPlot::xBottom || axis == QwtPlot::xTop ) )
-        {
-            if ( ( sd.minLeft > canvasBorder[QwtPlot::yLeft] )
-                && scaleData[QwtPlot::yLeft].w )
-            {
-                int shiftLeft = sd.minLeft - canvasBorder[QwtPlot::yLeft];
-                if ( shiftLeft > scaleData[QwtPlot::yLeft].w )
-                    shiftLeft = scaleData[QwtPlot::yLeft].w;
-
-                sd.w -= shiftLeft;
-            }
-            if ( ( sd.minRight > canvasBorder[QwtPlot::yRight] )
-                && scaleData[QwtPlot::yRight].w )
-            {
-                int shiftRight = sd.minRight - canvasBorder[QwtPlot::yRight];
-                if ( shiftRight > scaleData[QwtPlot::yRight].w )
-                    shiftRight = scaleData[QwtPlot::yRight].w;
-
-                sd.w -= shiftRight;
-            }
-        }
-
-        if ( sd.h && ( axis == QwtPlot::yLeft || axis == QwtPlot::yRight ) )
-        {
-            if ( ( sd.minLeft > canvasBorder[QwtPlot::xBottom] ) &&
-                scaleData[QwtPlot::xBottom].h )
-            {
-                int shiftBottom = sd.minLeft - canvasBorder[QwtPlot::xBottom];
-                if ( shiftBottom > scaleData[QwtPlot::xBottom].tickOffset )
-                    shiftBottom = scaleData[QwtPlot::xBottom].tickOffset;
-
-                sd.h -= shiftBottom;
-            }
-            if ( ( sd.minLeft > canvasBorder[QwtPlot::xTop] ) &&
-                scaleData[QwtPlot::xTop].h )
-            {
-                int shiftTop = sd.minRight - canvasBorder[QwtPlot::xTop];
-                if ( shiftTop > scaleData[QwtPlot::xTop].tickOffset )
-                    shiftTop = scaleData[QwtPlot::xTop].tickOffset;
-
-                sd.h -= shiftTop;
-            }
-        }
-    }
-
-    const QWidget *canvas = plot->canvas();
-
-    int left, top, right, bottom;
-    canvas->getContentsMargins( &left, &top, &right, &bottom );
-
-    const QSize minCanvasSize = canvas->minimumSize();
-
-    int w = scaleData[QwtPlot::yLeft].w + scaleData[QwtPlot::yRight].w;
-    int cw = qMax( scaleData[QwtPlot::xBottom].w, scaleData[QwtPlot::xTop].w )
-        + left + 1 + right + 1;
-    w += qMax( cw, minCanvasSize.width() );
-
-    int h = scaleData[QwtPlot::xBottom].h + scaleData[QwtPlot::xTop].h;
-    int ch = qMax( scaleData[QwtPlot::yLeft].h, scaleData[QwtPlot::yRight].h )
-        + top + 1 + bottom + 1;
-    h += qMax( ch, minCanvasSize.height() );
-
-    const QwtTextLabel *labels[2];
-    labels[0] = plot->titleLabel();
-    labels[1] = plot->footerLabel();
-
-    for ( int i = 0; i < 2; i++ )
-    {
-        const QwtTextLabel *label   = labels[i];
-        if ( label && !label->text().isEmpty() )
-        {
-            // If only QwtPlot::yLeft or QwtPlot::yRight is showing,
-            // we center on the plot canvas.
-            const bool centerOnCanvas = !( plot->axisEnabled( QwtPlot::yLeft )
-                && plot->axisEnabled( QwtPlot::yRight ) );
-
-            int labelW = w;
-            if ( centerOnCanvas )
-            {
-                labelW -= scaleData[QwtPlot::yLeft].w
-                    + scaleData[QwtPlot::yRight].w;
-            }
-
-            int labelH = label->heightForWidth( labelW );
-            if ( labelH > labelW ) // Compensate for a long title
-            {
-                w = labelW = labelH;
-                if ( centerOnCanvas )
-                {
-                    w += scaleData[QwtPlot::yLeft].w
-                        + scaleData[QwtPlot::yRight].w;
-                }
-
-                labelH = label->heightForWidth( labelW );
-            }
-            h += labelH + d_data->spacing;
-        }
-    }
-
-    // Compute the legend contribution
-
-    const QwtAbstractLegend *legend = plot->legend();
-    if ( legend && !legend->isEmpty() )
-    {
-        if ( d_data->legendPos == QwtPlot::LeftLegend
-            || d_data->legendPos == QwtPlot::RightLegend )
-        {
-            int legendW = legend->sizeHint().width();
-            int legendH = legend->heightForWidth( legendW );
-
-            if ( legend->frameWidth() > 0 )
-                w += d_data->spacing;
-
-            if ( legendH > h )
-                legendW += legend->scrollExtent( Qt::Horizontal );
-
-            if ( d_data->legendRatio < 1.0 )
-                legendW = qMin( legendW, int( w / ( 1.0 - d_data->legendRatio ) ) );
-
-            w += legendW + d_data->spacing;
-        }
-        else // QwtPlot::Top, QwtPlot::Bottom
-        {
-            int legendW = qMin( legend->sizeHint().width(), w );
-            int legendH = legend->heightForWidth( legendW );
-
-            if ( legend->frameWidth() > 0 )
-                h += d_data->spacing;
-
-            if ( d_data->legendRatio < 1.0 )
-                legendH = qMin( legendH, int( h / ( 1.0 - d_data->legendRatio ) ) );
-
-            h += legendH + d_data->spacing;
-        }
-    }
-
-    return QSize( w, h );
-}
-
-/*!
-  Find the geometry for the legend
-
-  \param options Options how to layout the legend
-  \param rect Rectangle where to place the legend
-
-  \return Geometry for the legend
-  \sa Options
-*/
-
-QRectF QwtPlotLayout::layoutLegend( Options options,
-    const QRectF &rect ) const
-{
-    const QSize hint( d_data->layoutData.legend.hint );
-
+    }
+}
+
+namespace
+{
+    class LayoutEngine
+    {
+      public:
+        struct Dimensions
+        {
+            Dimensions()
+            {
+                dimTitle = dimFooter = 0;
+                for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+                    m_dimAxes[axisPos] = 0;
+            }
+
+            inline int dimAxis( QwtAxisId axisId ) const
+            {
+                return m_dimAxes[ axisId ];
+            }
+
+            void setDimAxis( QwtAxisId axisId, int dim )
+            {
+                m_dimAxes[ axisId ] = dim;
+            }
+
+            inline int dimAxes( int axisPos ) const
+            {
+                return m_dimAxes[ axisPos ];
+            }
+
+            inline int dimYAxes() const
+            {
+                return dimAxes( QwtAxis::YLeft ) + dimAxes( QwtAxis::YRight );
+            }
+
+            inline int dimXAxes() const
+            {
+                return dimAxes( QwtAxis::XTop ) + dimAxes( QwtAxis::XBottom );
+            }
+
+            inline QRectF centered( const QRectF& rect, const QRectF& labelRect ) const
+            {
+                QRectF r = labelRect;
+                r.setX( rect.left() + dimAxes( QwtAxis::YLeft ) );
+                r.setWidth( rect.width() - dimYAxes() );
+
+                return r;
+            }
+
+            inline QRectF innerRect( const QRectF& rect ) const
+            {
+                QRectF r(
+                    rect.x() + dimAxes( QwtAxis::YLeft ),
+                    rect.y() + dimAxes( QwtAxis::XTop ),
+                    rect.width() - dimYAxes(),
+                    rect.height() - dimXAxes() );
+
+                if ( r.width() < 0 )
+                {
+                    r.setX( rect.center().x() );
+                    r.setWidth( 0 );
+                }
+                if ( r.height() < 0 )
+                {
+                    r.setY( rect.center().y() );
+                    r.setHeight( 0 );
+                }
+
+                return r;
+            }
+
+            int dimTitle;
+            int dimFooter;
+
+          private:
+            int m_dimAxes[QwtAxis::AxisPositions];
+        };
+
+        LayoutEngine()
+            : m_legendPos( QwtPlot::BottomLegend )
+            , m_legendRatio( 1.0 )
+            , m_spacing( 5 )
+        {
+        }
+
+        QRectF layoutLegend( QwtPlotLayout::Options,
+            const LayoutData::LegendData&, const QRectF&, const QSize& ) const;
+
+        QRectF alignLegend( const QSize& legendHint,
+            const QRectF& canvasRect, const QRectF& legendRect ) const;
+
+        void alignScales( QwtPlotLayout::Options,
+            const LayoutData&, QRectF& canvasRect,
+            QRectF scaleRect[QwtAxis::AxisPositions] ) const;
+
+        Dimensions layoutDimensions( QwtPlotLayout::Options,
+            const LayoutData&, const QRectF& ) const;
+
+        inline void setSpacing( unsigned int spacing ) { m_spacing = spacing; }
+        inline unsigned int spacing() const { return m_spacing; }
+
+        inline void setAlignCanvas( int axisPos, bool on ) { m_alignCanvas[ axisPos ] = on; }
+        inline bool alignCanvas( int axisPos ) const { return m_alignCanvas[ axisPos ]; }
+
+        inline void setCanvasMargin( int axisPos, int margin ) { m_canvasMargin[ axisPos ] = margin; }
+        inline int canvasMargin( int axisPos ) const { return m_canvasMargin[ axisPos ]; }
+
+        inline void setLegendPos( QwtPlot::LegendPosition pos ) { m_legendPos = pos; }
+        inline QwtPlot::LegendPosition legendPos() const { return m_legendPos; }
+
+        inline void setLegendRatio( double ratio ) { m_legendRatio = ratio; }
+        inline double legendRatio() const { return m_legendRatio; }
+
+      private:
+        int heightForWidth( LayoutData::Label, const LayoutData&,
+            QwtPlotLayout::Options, double width, int axesWidth ) const;
+
+        QwtPlot::LegendPosition m_legendPos;
+        double m_legendRatio;
+
+        unsigned int m_canvasMargin[QwtAxis::AxisPositions];
+        bool m_alignCanvas[QwtAxis::AxisPositions];
+
+        unsigned int m_spacing;
+    };
+}
+
+QRectF LayoutEngine::layoutLegend( QwtPlotLayout::Options options,
+    const LayoutData::LegendData& legendData,
+    const QRectF& rect, const QSize& legendHint ) const
+{
     int dim;
-    if ( d_data->legendPos == QwtPlot::LeftLegend
-        || d_data->legendPos == QwtPlot::RightLegend )
+    if ( m_legendPos == QwtPlot::LeftLegend
+        || m_legendPos == QwtPlot::RightLegend )
     {
         // We don't allow vertical legends to take more than
         // half of the available space.
 
-        dim = qMin( hint.width(), int( rect.width() * d_data->legendRatio ) );
-
-        if ( !( options & IgnoreScrollbars ) )
-        {
-            if ( hint.height() > rect.height() )
+        dim = qMin( legendHint.width(), int( rect.width() * m_legendRatio ) );
+
+        if ( !( options & QwtPlotLayout::IgnoreScrollbars ) )
+        {
+            if ( legendHint.height() > rect.height() )
             {
                 // The legend will need additional
                 // space for the vertical scrollbar.
 
-                dim += d_data->layoutData.legend.hScrollExtent;
+                dim += legendData.hScrollExtent;
             }
         }
@@ -777,25 +534,33 @@
     else
     {
-        dim = qMin( hint.height(), int( rect.height() * d_data->legendRatio ) );
-        dim = qMax( dim, d_data->layoutData.legend.vScrollExtent );
+        dim = qMin( legendHint.height(), int( rect.height() * m_legendRatio ) );
+        dim = qMax( dim, legendData.vScrollExtent );
     }
 
     QRectF legendRect = rect;
-    switch ( d_data->legendPos )
+    switch ( m_legendPos )
     {
         case QwtPlot::LeftLegend:
+        {
             legendRect.setWidth( dim );
             break;
+        }
         case QwtPlot::RightLegend:
+        {
             legendRect.setX( rect.right() - dim );
             legendRect.setWidth( dim );
             break;
+        }
         case QwtPlot::TopLegend:
+        {
             legendRect.setHeight( dim );
             break;
+        }
         case QwtPlot::BottomLegend:
+        {
             legendRect.setY( rect.bottom() - dim );
             legendRect.setHeight( dim );
             break;
+        }
     }
 
@@ -803,21 +568,13 @@
 }
 
-/*!
-  Align the legend to the canvas
-
-  \param canvasRect Geometry of the canvas
-  \param legendRect Maximum geometry for the legend
-
-  \return Geometry for the aligned legend
-*/
-QRectF QwtPlotLayout::alignLegend( const QRectF &canvasRect,
-    const QRectF &legendRect ) const
+QRectF LayoutEngine::alignLegend( const QSize& legendHint,
+    const QRectF& canvasRect, const QRectF& legendRect ) const
 {
     QRectF alignedRect = legendRect;
 
-    if ( d_data->legendPos == QwtPlot::BottomLegend
-        || d_data->legendPos == QwtPlot::TopLegend )
-    {
-        if ( d_data->layoutData.legend.hint.width() < canvasRect.width() )
+    if ( m_legendPos == QwtPlot::BottomLegend
+        || m_legendPos == QwtPlot::TopLegend )
+    {
+        if ( legendHint.width() < canvasRect.width() )
         {
             alignedRect.setX( canvasRect.x() );
@@ -827,5 +584,5 @@
     else
     {
-        if ( d_data->layoutData.legend.hint.height() < canvasRect.height() )
+        if ( legendHint.height() < canvasRect.height() )
         {
             alignedRect.setY( canvasRect.y() );
@@ -837,32 +594,45 @@
 }
 
-/*!
-  Expand all line breaks in text labels, and calculate the height
-  of their widgets in orientation of the text.
-
-  \param options Options how to layout the legend
-  \param rect Bounding rectangle for title, footer, axes and canvas.
-  \param dimTitle Expanded height of the title widget
-  \param dimFooter Expanded height of the footer widget
-  \param dimAxes Expanded heights of the axis in axis orientation.
-
-  \sa Options
-*/
-void QwtPlotLayout::expandLineBreaks( Options options, const QRectF &rect,
-    int &dimTitle, int &dimFooter, int dimAxes[QwtPlot::axisCnt] ) const
-{
-    dimTitle = dimFooter = 0;
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-        dimAxes[axis] = 0;
-
-    int backboneOffset[QwtPlot::axisCnt];
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-    {
-        backboneOffset[axis] = 0;
-        if ( !( options & IgnoreFrames ) )
-            backboneOffset[axis] += d_data->layoutData.canvas.contentsMargins[ axis ];
-
-        if ( !d_data->alignCanvasToScales[axis] )
-            backboneOffset[axis] += d_data->canvasMargin[axis];
+int LayoutEngine::heightForWidth(
+    LayoutData::Label labelType, const LayoutData& layoutData,
+    QwtPlotLayout::Options options,
+    double width, int axesWidth ) const
+{
+    const LayoutData::LabelData& labelData = layoutData.labelData[ labelType ];
+
+    if ( labelData.text.isEmpty() )
+        return 0;
+
+    double w = width;
+
+    if ( !layoutData.hasSymmetricYAxes() )
+    {
+        // center to the canvas
+        w -= axesWidth;
+    }
+
+    int d = qwtCeil( labelData.text.heightForWidth( w ) );
+    if ( !( options & QwtPlotLayout::IgnoreFrames ) )
+        d += 2 * labelData.frameWidth;
+
+    return d;
+}
+
+LayoutEngine::Dimensions LayoutEngine::layoutDimensions( QwtPlotLayout::Options options,
+    const LayoutData& layoutData, const QRectF& rect ) const
+{
+    using namespace QwtAxis;
+
+    Dimensions dimensions;
+
+    int backboneOffset[AxisPositions];
+    for ( int axisPos = 0; axisPos < AxisPositions; axisPos++ )
+    {
+        backboneOffset[axisPos] = 0;
+        if ( !( options & QwtPlotLayout::IgnoreFrames ) )
+            backboneOffset[axisPos] += layoutData.canvasData.contentsMargins[axisPos];
+
+        if ( !m_alignCanvas[axisPos] )
+            backboneOffset[axisPos] += m_canvasMargin[axisPos];
     }
 
@@ -880,394 +650,862 @@
         // axis ... . So we loop as long until no size changes.
 
-        if ( !( ( options & IgnoreTitle ) ||
-            d_data->layoutData.title.text.isEmpty() ) )
-        {
-            double w = rect.width();
-
-            if ( d_data->layoutData.scale[QwtPlot::yLeft].isEnabled
-                != d_data->layoutData.scale[QwtPlot::yRight].isEnabled )
-            {
-                // center to the canvas
-                w -= dimAxes[QwtPlot::yLeft] + dimAxes[QwtPlot::yRight];
-            }
-
-            int d = qCeil( d_data->layoutData.title.text.heightForWidth( w ) );
-            if ( !( options & IgnoreFrames ) )
-                d += 2 * d_data->layoutData.title.frameWidth;
-
-            if ( d > dimTitle )
-            {
-                dimTitle = d;
+        if ( !( options & QwtPlotLayout::IgnoreTitle ) )
+        {
+            const int d = heightForWidth(
+                LayoutData::Title, layoutData, options,
+                rect.width(), dimensions.dimYAxes() );
+
+            if ( d > dimensions.dimTitle )
+            {
+                dimensions.dimTitle = d;
                 done = false;
             }
         }
 
-        if ( !( ( options & IgnoreFooter ) ||
-            d_data->layoutData.footer.text.isEmpty() ) )
-        {
-            double w = rect.width();
-
-            if ( d_data->layoutData.scale[QwtPlot::yLeft].isEnabled
-                != d_data->layoutData.scale[QwtPlot::yRight].isEnabled )
-            {
-                // center to the canvas
-                w -= dimAxes[QwtPlot::yLeft] + dimAxes[QwtPlot::yRight];
-            }
-
-            int d = qCeil( d_data->layoutData.footer.text.heightForWidth( w ) );
-            if ( !( options & IgnoreFrames ) )
-                d += 2 * d_data->layoutData.footer.frameWidth;
-
-            if ( d > dimFooter )
-            {
-                dimFooter = d;
+        if ( !( options & QwtPlotLayout::IgnoreFooter ) )
+        {
+            const int d = heightForWidth(
+                LayoutData::Footer, layoutData, options,
+                rect.width(), dimensions.dimYAxes() );
+
+            if ( d > dimensions.dimFooter )
+            {
+                dimensions.dimFooter = d;
                 done = false;
             }
         }
 
-        for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-        {
-            const struct LayoutData::t_scaleData &scaleData =
-                d_data->layoutData.scale[axis];
-
-            if ( scaleData.isEnabled )
-            {
-                double length;
-                if ( axis == QwtPlot::xTop || axis == QwtPlot::xBottom )
-                {
-                    length = rect.width() - dimAxes[QwtPlot::yLeft]
-                        - dimAxes[QwtPlot::yRight];
-                    length -= scaleData.start + scaleData.end;
-
-                    if ( dimAxes[QwtPlot::yRight] > 0 )
+        for ( int axisPos = 0; axisPos < AxisPositions; axisPos++ )
+        {
+            {
+                const QwtAxisId axisId( axisPos );
+
+                const LayoutData::ScaleData& scaleData = layoutData.axisData( axisId );
+
+                if ( scaleData.isVisible )
+                {
+                    double length;
+                    if ( isXAxis( axisPos ) )
+                    {
+                        length = rect.width() - dimensions.dimYAxes();
+                        length -= scaleData.start + scaleData.end;
+
+                        if ( dimensions.dimAxes( YRight ) > 0 )
+                            length -= 1;
+
+                        length += qMin( dimensions.dimAxes( YLeft ),
+                            scaleData.start - backboneOffset[YLeft] );
+
+                        length += qMin( dimensions.dimAxes( YRight ),
+                            scaleData.end - backboneOffset[YRight] );
+                    }
+                    else // y axis
+                    {
+                        length = rect.height() - dimensions.dimXAxes();
+                        length -= scaleData.start + scaleData.end;
                         length -= 1;
 
-                    length += qMin( dimAxes[QwtPlot::yLeft],
-                        scaleData.start - backboneOffset[QwtPlot::yLeft] );
-                    length += qMin( dimAxes[QwtPlot::yRight],
-                        scaleData.end - backboneOffset[QwtPlot::yRight] );
-                }
-                else // QwtPlot::yLeft, QwtPlot::yRight
-                {
-                    length = rect.height() - dimAxes[QwtPlot::xTop]
-                        - dimAxes[QwtPlot::xBottom];
-                    length -= scaleData.start + scaleData.end;
-                    length -= 1;
-
-                    if ( dimAxes[QwtPlot::xBottom] <= 0 )
-                        length -= 1;
-                    if ( dimAxes[QwtPlot::xTop] <= 0 )
-                        length -= 1;
-
-                    if ( dimAxes[QwtPlot::xBottom] > 0 )
-                    {
-                        length += qMin(
-                            d_data->layoutData.scale[QwtPlot::xBottom].tickOffset,
-                            double( scaleData.start - backboneOffset[QwtPlot::xBottom] ) );
-                    }
-                    if ( dimAxes[QwtPlot::xTop] > 0 )
-                    {
-                        length += qMin(
-                            d_data->layoutData.scale[QwtPlot::xTop].tickOffset,
-                            double( scaleData.end - backboneOffset[QwtPlot::xTop] ) );
-                    }
-
-                    if ( dimTitle > 0 )
-                        length -= dimTitle + d_data->spacing;
-                }
-
-                int d = scaleData.dimWithoutTitle;
-                if ( !scaleData.scaleWidget->title().isEmpty() )
-                {
-                    d += scaleData.scaleWidget->titleHeightForWidth( qFloor( length ) );
-                }
-
-
-                if ( d > dimAxes[axis] )
-                {
-                    dimAxes[axis] = d;
-                    done = false;
-                }
-            }
-        }
-    }
-}
-
-/*!
-  Align the ticks of the axis to the canvas borders using
-  the empty corners.
-
-  \param options Layout options
-  \param canvasRect Geometry of the canvas ( IN/OUT )
-  \param scaleRect Geometries of the scales ( IN/OUT )
-
-  \sa Options
-*/
-
-void QwtPlotLayout::alignScales( Options options,
-    QRectF &canvasRect, QRectF scaleRect[QwtPlot::axisCnt] ) const
-{
-    int backboneOffset[QwtPlot::axisCnt];
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-    {
-        backboneOffset[axis] = 0;
-
-        if ( !d_data->alignCanvasToScales[axis] )
-        {
-            backboneOffset[axis] += d_data->canvasMargin[axis];
-        }
-
-        if ( !( options & IgnoreFrames ) )
-        {
-            backboneOffset[axis] +=
-                d_data->layoutData.canvas.contentsMargins[axis];
-        }
-    }
-
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-    {
-        if ( !scaleRect[axis].isValid() )
-            continue;
-
-        const int startDist = d_data->layoutData.scale[axis].start;
-        const int endDist = d_data->layoutData.scale[axis].end;
-
-        QRectF &axisRect = scaleRect[axis];
-
-        if ( axis == QwtPlot::xTop || axis == QwtPlot::xBottom )
-        {
-            const QRectF &leftScaleRect = scaleRect[QwtPlot::yLeft];
-            const int leftOffset =
-                backboneOffset[QwtPlot::yLeft] - startDist;
-
-            if ( leftScaleRect.isValid() )
-            {
-                const double dx = leftOffset + leftScaleRect.width();
-                if ( d_data->alignCanvasToScales[QwtPlot::yLeft] && dx < 0.0 )
-                {
-                    /*
-                      The axis needs more space than the width
-                      of the left scale.
-                     */
-                    const double cLeft = canvasRect.left(); // qreal -> double
-                    canvasRect.setLeft( qMax( cLeft, axisRect.left() - dx ) );
+                        if ( dimensions.dimAxes( XBottom ) <= 0 )
+                            length -= 1;
+
+                        if ( dimensions.dimAxes( XTop ) <= 0 )
+                            length -= 1;
+
+                        /*
+                           The tick labels of the y axes are always left/right from the
+                           backbone/ticks of the x axes - but we have to take care,
+                           that the labels don't overlap.
+                         */
+                        if ( dimensions.dimAxes( XBottom ) > 0 )
+                        {
+                            length += qMin(
+                                layoutData.tickOffset( XBottom ),
+                                double( scaleData.start - backboneOffset[XBottom] ) );
+                        }
+
+                        if ( dimensions.dimAxes( XTop ) > 0 )
+                        {
+                            length += qMin(
+                                layoutData.tickOffset( XTop ),
+                                double( scaleData.end - backboneOffset[XTop] ) );
+                        }
+
+                        if ( dimensions.dimTitle > 0 )
+                            length -= dimensions.dimTitle + m_spacing;
+                    }
+
+                    int d = scaleData.dimWithoutTitle;
+                    if ( !scaleData.scaleWidget->title().isEmpty() )
+                    {
+                        d += scaleData.scaleWidget->titleHeightForWidth( qwtFloor( length ) );
+                    }
+
+
+                    if ( d > dimensions.dimAxis( axisId ) )
+                    {
+                        dimensions.setDimAxis( axisId, d );
+                        done = false;
+                    }
+                }
+            }
+        }
+    }
+
+    return dimensions;
+}
+
+void LayoutEngine::alignScales( QwtPlotLayout::Options options,
+    const LayoutData& layoutData, QRectF& canvasRect,
+    QRectF scaleRect[QwtAxis::AxisPositions] ) const
+{
+    using namespace QwtAxis;
+
+    int backboneOffset[AxisPositions];
+    for ( int axisPos = 0; axisPos < AxisPositions; axisPos++ )
+    {
+        backboneOffset[axisPos] = 0;
+
+        if ( !m_alignCanvas[axisPos] )
+        {
+            backboneOffset[axisPos] += m_canvasMargin[axisPos];
+        }
+
+        if ( !( options & QwtPlotLayout::IgnoreFrames ) )
+        {
+            backboneOffset[axisPos] +=
+                layoutData.canvasData.contentsMargins[axisPos];
+        }
+    }
+
+    for ( int axisPos = 0; axisPos < AxisPositions; axisPos++ )
+    {
+        {
+            QRectF& axisRect = scaleRect[axisPos];
+            if ( !axisRect.isValid() )
+                continue;
+
+            const QwtAxisId axisId( axisPos );
+
+            const int startDist = layoutData.axisData( axisId ).start;
+            const int endDist = layoutData.axisData( axisId ).end;
+
+            if ( isXAxis( axisPos ) )
+            {
+                const QRectF& leftScaleRect = scaleRect[YLeft];
+                const int leftOffset = backboneOffset[YLeft] - startDist;
+
+                if ( leftScaleRect.isValid() )
+                {
+                    const double dx = leftOffset + leftScaleRect.width();
+                    if ( m_alignCanvas[YLeft] && dx < 0.0 )
+                    {
+                        /*
+                           The axis needs more space than the width
+                           of the left scale.
+                         */
+                        const double cLeft = canvasRect.left(); // qreal -> double
+                        canvasRect.setLeft( qwtMaxF( cLeft, axisRect.left() - dx ) );
+                    }
+                    else
+                    {
+                        const double minLeft = leftScaleRect.left();
+                        const double left = axisRect.left() + leftOffset;
+                        axisRect.setLeft( qwtMaxF( left, minLeft ) );
+                    }
                 }
                 else
                 {
-                    const double minLeft = leftScaleRect.left();
-                    const double left = axisRect.left() + leftOffset;
-                    axisRect.setLeft( qMax( left, minLeft ) );
+                    if ( m_alignCanvas[YLeft] && leftOffset < 0 )
+                    {
+                        canvasRect.setLeft( qwtMaxF( canvasRect.left(),
+                            axisRect.left() - leftOffset ) );
+                    }
+                    else
+                    {
+                        if ( leftOffset > 0 )
+                            axisRect.setLeft( axisRect.left() + leftOffset );
+                    }
+                }
+
+                const QRectF& rightScaleRect = scaleRect[YRight];
+                const int rightOffset = backboneOffset[YRight] - endDist + 1;
+
+                if ( rightScaleRect.isValid() )
+                {
+                    const double dx = rightOffset + rightScaleRect.width();
+                    if ( m_alignCanvas[YRight] && dx < 0 )
+                    {
+                        /*
+                           The axis needs more space than the width
+                           of the right scale.
+                         */
+                        const double cRight = canvasRect.right(); // qreal -> double
+                        canvasRect.setRight( qwtMinF( cRight, axisRect.right() + dx ) );
+                    }
+
+                    const double maxRight = rightScaleRect.right();
+                    const double right = axisRect.right() - rightOffset;
+                    axisRect.setRight( qwtMinF( right, maxRight ) );
+                }
+                else
+                {
+                    if ( m_alignCanvas[YRight] && rightOffset < 0 )
+                    {
+                        canvasRect.setRight( qwtMinF( canvasRect.right(),
+                            axisRect.right() + rightOffset ) );
+                    }
+                    else
+                    {
+                        if ( rightOffset > 0 )
+                            axisRect.setRight( axisRect.right() - rightOffset );
+                    }
+                }
+            }
+            else // y axes
+            {
+                const QRectF& bottomScaleRect = scaleRect[XBottom];
+                const int bottomOffset = backboneOffset[XBottom] - endDist + 1;
+
+                if ( bottomScaleRect.isValid() )
+                {
+                    const double dy = bottomOffset + bottomScaleRect.height();
+                    if ( m_alignCanvas[XBottom] && dy < 0 )
+                    {
+                        /*
+                           The axis needs more space than the height
+                           of the bottom scale.
+                         */
+                        const double cBottom = canvasRect.bottom(); // qreal -> double
+                        canvasRect.setBottom( qwtMinF( cBottom, axisRect.bottom() + dy ) );
+                    }
+                    else
+                    {
+                        const double maxBottom = bottomScaleRect.top() +
+                            layoutData.tickOffset( XBottom );
+                        const double bottom = axisRect.bottom() - bottomOffset;
+                        axisRect.setBottom( qwtMinF( bottom, maxBottom ) );
+                    }
+                }
+                else
+                {
+                    if ( m_alignCanvas[XBottom] && bottomOffset < 0 )
+                    {
+                        canvasRect.setBottom( qwtMinF( canvasRect.bottom(),
+                            axisRect.bottom() + bottomOffset ) );
+                    }
+                    else
+                    {
+                        if ( bottomOffset > 0 )
+                            axisRect.setBottom( axisRect.bottom() - bottomOffset );
+                    }
+                }
+
+                const QRectF& topScaleRect = scaleRect[XTop];
+                const int topOffset = backboneOffset[XTop] - startDist;
+
+                if ( topScaleRect.isValid() )
+                {
+                    const double dy = topOffset + topScaleRect.height();
+                    if ( m_alignCanvas[XTop] && dy < 0 )
+                    {
+                        /*
+                           The axis needs more space than the height
+                           of the top scale.
+                         */
+                        const double cTop = canvasRect.top(); // qreal -> double
+                        canvasRect.setTop( qwtMaxF( cTop, axisRect.top() - dy ) );
+                    }
+                    else
+                    {
+                        const double minTop = topScaleRect.bottom() -
+                            layoutData.tickOffset( XTop );
+
+                        const double top = axisRect.top() + topOffset;
+                        axisRect.setTop( qwtMaxF( top, minTop ) );
+                    }
+                }
+                else
+                {
+                    if ( m_alignCanvas[XTop] && topOffset < 0 )
+                    {
+                        canvasRect.setTop( qwtMaxF( canvasRect.top(),
+                            axisRect.top() - topOffset ) );
+                    }
+                    else
+                    {
+                        if ( topOffset > 0 )
+                            axisRect.setTop( axisRect.top() + topOffset );
+                    }
+                }
+            }
+        }
+    }
+
+    /*
+       The canvas has been aligned to the scale with largest
+       border distances. Now we have to realign the other scale.
+     */
+
+    for ( int axisPos = 0; axisPos < AxisPositions; axisPos++ )
+    {
+        {
+            const QwtAxisId axisId( axisPos );
+
+            QRectF& sRect = scaleRect[axisPos];
+            const LayoutData::ScaleData& axisData = layoutData.axisData( axisId );
+
+            if ( !sRect.isValid() )
+                continue;
+
+            if ( isXAxis( axisPos ) )
+            {
+                if ( m_alignCanvas[YLeft] )
+                {
+                    double y = canvasRect.left() - axisData.start;
+                    if ( !( options & QwtPlotLayout::IgnoreFrames ) )
+                        y += layoutData.canvasData.contentsMargins[YLeft];
+
+                    sRect.setLeft( y );
+                }
+
+                if ( m_alignCanvas[YRight] )
+                {
+                    double y = canvasRect.right() - 1 + axisData.end;
+                    if ( !( options & QwtPlotLayout::IgnoreFrames ) )
+                        y -= layoutData.canvasData.contentsMargins[YRight];
+
+                    sRect.setRight( y );
+                }
+
+                if ( m_alignCanvas[axisPos] )
+                {
+                    if ( axisPos == XTop )
+                        sRect.setBottom( canvasRect.top() );
+                    else
+                        sRect.setTop( canvasRect.bottom() );
                 }
             }
             else
             {
-                if ( d_data->alignCanvasToScales[QwtPlot::yLeft] && leftOffset < 0 )
-                {
-                    canvasRect.setLeft( qMax( canvasRect.left(),
-                        axisRect.left() - leftOffset ) );
-                }
-                else
-                {
-                    if ( leftOffset > 0 )
-                        axisRect.setLeft( axisRect.left() + leftOffset );
-                }
-            }
-
-            const QRectF &rightScaleRect = scaleRect[QwtPlot::yRight];
-            const int rightOffset =
-                backboneOffset[QwtPlot::yRight] - endDist + 1;
-
-            if ( rightScaleRect.isValid() )
-            {
-                const double dx = rightOffset + rightScaleRect.width();
-                if ( d_data->alignCanvasToScales[QwtPlot::yRight] && dx < 0 )
-                {
-                    /*
-                      The axis needs more space than the width
-                      of the right scale.
-                     */
-                    const double cRight = canvasRect.right(); // qreal -> double
-                    canvasRect.setRight( qMin( cRight, axisRect.right() + dx ) );
-                }
-
-                const double maxRight = rightScaleRect.right();
-                const double right = axisRect.right() - rightOffset;
-                axisRect.setRight( qMin( right, maxRight ) );
-            }
-            else
-            {
-                if ( d_data->alignCanvasToScales[QwtPlot::yRight] && rightOffset < 0 )
-                {
-                    canvasRect.setRight( qMin( canvasRect.right(),
-                        axisRect.right() + rightOffset ) );
-                }
-                else
-                {
-                    if ( rightOffset > 0 )
-                        axisRect.setRight( axisRect.right() - rightOffset );
-                }
-            }
-        }
-        else // QwtPlot::yLeft, QwtPlot::yRight
-        {
-            const QRectF &bottomScaleRect = scaleRect[QwtPlot::xBottom];
-            const int bottomOffset =
-                backboneOffset[QwtPlot::xBottom] - endDist + 1;
-
-            if ( bottomScaleRect.isValid() )
-            {
-                const double dy = bottomOffset + bottomScaleRect.height();
-                if ( d_data->alignCanvasToScales[QwtPlot::xBottom] && dy < 0 )
-                {
-                    /*
-                      The axis needs more space than the height
-                      of the bottom scale.
-                     */
-                    const double cBottom = canvasRect.bottom(); // qreal -> double
-                    canvasRect.setBottom( qMin( cBottom, axisRect.bottom() + dy ) );
-                }
-                else
-                {
-                    const double maxBottom = bottomScaleRect.top() +
-                        d_data->layoutData.scale[QwtPlot::xBottom].tickOffset;
-                    const double bottom = axisRect.bottom() - bottomOffset;
-                    axisRect.setBottom( qMin( bottom, maxBottom ) );
-                }
-            }
-            else
-            {
-                if ( d_data->alignCanvasToScales[QwtPlot::xBottom] && bottomOffset < 0 )
-                {
-                    canvasRect.setBottom( qMin( canvasRect.bottom(),
-                        axisRect.bottom() + bottomOffset ) );
-                }
-                else
-                {
-                    if ( bottomOffset > 0 )
-                        axisRect.setBottom( axisRect.bottom() - bottomOffset );
-                }
-            }
-
-            const QRectF &topScaleRect = scaleRect[QwtPlot::xTop];
-            const int topOffset = backboneOffset[QwtPlot::xTop] - startDist;
-
-            if ( topScaleRect.isValid() )
-            {
-                const double dy = topOffset + topScaleRect.height();
-                if ( d_data->alignCanvasToScales[QwtPlot::xTop] && dy < 0 )
-                {
-                    /*
-                      The axis needs more space than the height
-                      of the top scale.
-                     */
-                    const double cTop = canvasRect.top(); // qreal -> double
-                    canvasRect.setTop( qMax( cTop, axisRect.top() - dy ) );
-                }
-                else
-                {
-                    const double minTop = topScaleRect.bottom() -
-                        d_data->layoutData.scale[QwtPlot::xTop].tickOffset;
-                    const double top = axisRect.top() + topOffset;
-                    axisRect.setTop( qMax( top, minTop ) );
-                }
-            }
-            else
-            {
-                if ( d_data->alignCanvasToScales[QwtPlot::xTop] && topOffset < 0 )
-                {
-                    canvasRect.setTop( qMax( canvasRect.top(),
-                        axisRect.top() - topOffset ) );
-                }
-                else
-                {
-                    if ( topOffset > 0 )
-                        axisRect.setTop( axisRect.top() + topOffset );
-                }
-            }
-        }
-    }
-
-    /*
-      The canvas has been aligned to the scale with largest
-      border distances. Now we have to realign the other scale.
-     */
-
-
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-    {
-        QRectF &sRect = scaleRect[axis];
-
-        if ( !sRect.isValid() )
-            continue;
-
-        if ( axis == QwtPlot::xBottom || axis == QwtPlot::xTop )
-        {
-            if ( d_data->alignCanvasToScales[QwtPlot::yLeft] )
-            {
-                double y = canvasRect.left() - d_data->layoutData.scale[axis].start;
-                if ( !( options & IgnoreFrames ) )
-                    y += d_data->layoutData.canvas.contentsMargins[ QwtPlot::yLeft ];
-
-                sRect.setLeft( y );
-            }
-            if ( d_data->alignCanvasToScales[QwtPlot::yRight] )
-            {
-                double y = canvasRect.right() - 1 + d_data->layoutData.scale[axis].end;
-                if ( !( options & IgnoreFrames ) )
-                    y -= d_data->layoutData.canvas.contentsMargins[ QwtPlot::yRight ];
-
-                sRect.setRight( y );
-            }
-
-            if ( d_data->alignCanvasToScales[ axis ] )
-            {
-                if ( axis == QwtPlot::xTop )
-                    sRect.setBottom( canvasRect.top() );
-                else
-                    sRect.setTop( canvasRect.bottom() );
-            }
+                if ( m_alignCanvas[XTop] )
+                {
+                    double x = canvasRect.top() - axisData.start;
+                    if ( !( options & QwtPlotLayout::IgnoreFrames ) )
+                        x += layoutData.canvasData.contentsMargins[XTop];
+
+                    sRect.setTop( x );
+                }
+
+                if ( m_alignCanvas[XBottom] )
+                {
+                    double x = canvasRect.bottom() - 1 + axisData.end;
+                    if ( !( options & QwtPlotLayout::IgnoreFrames ) )
+                        x -= layoutData.canvasData.contentsMargins[XBottom];
+
+                    sRect.setBottom( x );
+                }
+
+                if ( m_alignCanvas[axisPos] )
+                {
+                    if ( axisPos == YLeft )
+                        sRect.setRight( canvasRect.left() );
+                    else
+                        sRect.setLeft( canvasRect.right() );
+                }
+            }
+        }
+    }
+}
+
+class QwtPlotLayout::PrivateData
+{
+  public:
+    QRectF titleRect;
+    QRectF footerRect;
+    QRectF legendRect;
+    QRectF scaleRects[QwtAxis::AxisPositions];
+    QRectF canvasRect;
+
+    LayoutEngine engine;
+};
+
+/*!
+   \brief Constructor
+ */
+
+QwtPlotLayout::QwtPlotLayout()
+{
+    m_data = new PrivateData;
+
+    setLegendPosition( QwtPlot::BottomLegend );
+    setCanvasMargin( 4 );
+    setAlignCanvasToScales( false );
+
+    invalidate();
+}
+
+//! Destructor
+QwtPlotLayout::~QwtPlotLayout()
+{
+    delete m_data;
+}
+
+/*!
+   Change a margin of the canvas. The margin is the space
+   above/below the scale ticks. A negative margin will
+   be set to -1, excluding the borders of the scales.
+
+   \param margin New margin
+   \param axisPos One of QwtAxis::Position. Specifies where the position of the margin.
+              -1 means margin at all borders.
+   \sa canvasMargin()
+
+   \warning The margin will have no effect when alignCanvasToScale() is true
+ */
+
+void QwtPlotLayout::setCanvasMargin( int margin, int axisPos )
+{
+    if ( margin < -1 )
+        margin = -1;
+
+    LayoutEngine& engine = m_data->engine;
+
+    if ( axisPos == -1 )
+    {
+        for ( axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+            engine.setCanvasMargin( axisPos, margin );
+    }
+    else if ( QwtAxis::isValid( axisPos ) )
+    {
+        engine.setCanvasMargin( axisPos, margin );
+    }
+}
+
+/*!
+    \param axisPos Axis position
+    \return Margin around the scale tick borders
+    \sa setCanvasMargin()
+ */
+int QwtPlotLayout::canvasMargin( int axisPos ) const
+{
+    if ( !QwtAxis::isValid( axisPos ) )
+        return 0;
+
+    return m_data->engine.canvasMargin( axisPos );
+}
+
+/*!
+   \brief Set the align-canvas-to-axis-scales flag for all axes
+
+   \param on True/False
+   \sa setAlignCanvasToScale(), alignCanvasToScale()
+ */
+void QwtPlotLayout::setAlignCanvasToScales( bool on )
+{
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+        m_data->engine.setAlignCanvas( axisPos, on );
+}
+
+/*!
+   Change the align-canvas-to-axis-scales setting. The canvas may:
+
+   - extend beyond the axis scale ends to maximize its size,
+   - align with the axis scale ends to control its size.
+
+   The axisId parameter is somehow confusing as it identifies a border
+   of the plot and not the axes, that are aligned. F.e when QwtAxis::YLeft
+   is set, the left end of the the x-axes ( QwtAxis::XTop, QwtAxis::XBottom )
+   is aligned.
+
+   \param axisPos Axis position
+   \param on New align-canvas-to-axis-scales setting
+
+   \sa setCanvasMargin(), alignCanvasToScale(), setAlignCanvasToScales()
+   \warning In case of on == true canvasMargin() will have no effect
+ */
+void QwtPlotLayout::setAlignCanvasToScale( int axisPos, bool on )
+{
+    if ( QwtAxis::isValid( axisPos ) )
+        m_data->engine.setAlignCanvas( axisPos, on );
+}
+
+/*!
+   Return the align-canvas-to-axis-scales setting. The canvas may:
+   - extend beyond the axis scale ends to maximize its size
+   - align with the axis scale ends to control its size.
+
+   \param axisPos Axis position
+   \return align-canvas-to-axis-scales setting
+   \sa setAlignCanvasToScale(), setAlignCanvasToScale(), setCanvasMargin()
+ */
+bool QwtPlotLayout::alignCanvasToScale( int axisPos ) const
+{
+    if ( !QwtAxis::isValid( axisPos ) )
+        return false;
+
+    return m_data->engine.alignCanvas( axisPos );
+}
+
+/*!
+   Change the spacing of the plot. The spacing is the distance
+   between the plot components.
+
+   \param spacing New spacing
+   \sa setCanvasMargin(), spacing()
+ */
+void QwtPlotLayout::setSpacing( int spacing )
+{
+    m_data->engine.setSpacing( qMax( 0, spacing ) );
+}
+
+/*!
+   \return Spacing
+   \sa margin(), setSpacing()
+ */
+int QwtPlotLayout::spacing() const
+{
+    return m_data->engine.spacing();
+}
+
+/*!
+   \brief Specify the position of the legend
+   \param pos The legend's position.
+   \param ratio Ratio between legend and the bounding rectangle
+               of title, footer, canvas and axes. The legend will be shrunk
+               if it would need more space than the given ratio.
+               The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0
+               it will be reset to the default ratio.
+               The default vertical/horizontal ratio is 0.33/0.5.
+
+   \sa QwtPlot::setLegendPosition()
+ */
+
+void QwtPlotLayout::setLegendPosition( QwtPlot::LegendPosition pos, double ratio )
+{
+    if ( ratio > 1.0 )
+        ratio = 1.0;
+
+    LayoutEngine& engine = m_data->engine;
+
+    switch ( pos )
+    {
+        case QwtPlot::TopLegend:
+        case QwtPlot::BottomLegend:
+        {
+            if ( ratio <= 0.0 )
+                ratio = 0.33;
+
+            engine.setLegendRatio( ratio );
+            engine.setLegendPos( pos );
+
+            break;
+        }
+        case QwtPlot::LeftLegend:
+        case QwtPlot::RightLegend:
+        {
+            if ( ratio <= 0.0 )
+                ratio = 0.5;
+
+            engine.setLegendRatio( ratio );
+            engine.setLegendPos( pos );
+
+            break;
+        }
+        default:
+            break;
+    }
+}
+
+/*!
+   \brief Specify the position of the legend
+   \param pos The legend's position. Valid values are
+      \c QwtPlot::LeftLegend, \c QwtPlot::RightLegend,
+      \c QwtPlot::TopLegend, \c QwtPlot::BottomLegend.
+
+   \sa QwtPlot::setLegendPosition()
+ */
+void QwtPlotLayout::setLegendPosition( QwtPlot::LegendPosition pos )
+{
+    setLegendPosition( pos, 0.0 );
+}
+
+/*!
+   \return Position of the legend
+   \sa setLegendPosition(), QwtPlot::setLegendPosition(),
+      QwtPlot::legendPosition()
+ */
+QwtPlot::LegendPosition QwtPlotLayout::legendPosition() const
+{
+    return m_data->engine.legendPos();
+}
+
+/*!
+   Specify the relative size of the legend in the plot
+   \param ratio Ratio between legend and the bounding rectangle
+               of title, footer, canvas and axes. The legend will be shrunk
+               if it would need more space than the given ratio.
+               The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0
+               it will be reset to the default ratio.
+               The default vertical/horizontal ratio is 0.33/0.5.
+ */
+void QwtPlotLayout::setLegendRatio( double ratio )
+{
+    setLegendPosition( legendPosition(), ratio );
+}
+
+/*!
+   \return The relative size of the legend in the plot.
+   \sa setLegendPosition()
+ */
+double QwtPlotLayout::legendRatio() const
+{
+    return m_data->engine.legendRatio();
+}
+
+/*!
+   \brief Set the geometry for the title
+
+   This method is intended to be used from derived layouts
+   overloading activate()
+
+   \sa titleRect(), activate()
+ */
+void QwtPlotLayout::setTitleRect( const QRectF& rect )
+{
+    m_data->titleRect = rect;
+}
+
+/*!
+   \return Geometry for the title
+   \sa activate(), invalidate()
+ */
+QRectF QwtPlotLayout::titleRect() const
+{
+    return m_data->titleRect;
+}
+
+/*!
+   \brief Set the geometry for the footer
+
+   This method is intended to be used from derived layouts
+   overloading activate()
+
+   \sa footerRect(), activate()
+ */
+void QwtPlotLayout::setFooterRect( const QRectF& rect )
+{
+    m_data->footerRect = rect;
+}
+
+/*!
+   \return Geometry for the footer
+   \sa activate(), invalidate()
+ */
+QRectF QwtPlotLayout::footerRect() const
+{
+    return m_data->footerRect;
+}
+
+/*!
+   \brief Set the geometry for the legend
+
+   This method is intended to be used from derived layouts
+   overloading activate()
+
+   \param rect Rectangle for the legend
+
+   \sa legendRect(), activate()
+ */
+void QwtPlotLayout::setLegendRect( const QRectF& rect )
+{
+    m_data->legendRect = rect;
+}
+
+/*!
+   \return Geometry for the legend
+   \sa activate(), invalidate()
+ */
+QRectF QwtPlotLayout::legendRect() const
+{
+    return m_data->legendRect;
+}
+
+/*!
+   \brief Set the geometry for an axis
+
+   This method is intended to be used from derived layouts
+   overloading activate()
+
+   \param axisId Axis
+   \param rect Rectangle for the scale
+
+   \sa scaleRect(), activate()
+ */
+void QwtPlotLayout::setScaleRect( QwtAxisId axisId, const QRectF& rect )
+{
+    if ( QwtAxis::isValid( axisId ) )
+        m_data->scaleRects[axisId] = rect;
+}
+
+/*!
+   \param axisId Axis
+   \return Geometry for the scale
+   \sa activate(), invalidate()
+ */
+QRectF QwtPlotLayout::scaleRect( QwtAxisId axisId ) const
+{
+    if ( QwtAxis::isValid( axisId ) )
+        return m_data->scaleRects[axisId];
+
+    return QRectF();
+}
+
+/*!
+   \brief Set the geometry for the canvas
+
+   This method is intended to be used from derived layouts
+   overloading activate()
+
+   \sa canvasRect(), activate()
+ */
+void QwtPlotLayout::setCanvasRect( const QRectF& rect )
+{
+    m_data->canvasRect = rect;
+}
+
+/*!
+   \return Geometry for the canvas
+   \sa activate(), invalidate()
+ */
+QRectF QwtPlotLayout::canvasRect() const
+{
+    return m_data->canvasRect;
+}
+
+/*!
+   Invalidate the geometry of all components.
+   \sa activate()
+ */
+void QwtPlotLayout::invalidate()
+{
+    m_data->titleRect = m_data->footerRect =
+        m_data->legendRect = m_data->canvasRect = QRectF();
+
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+        m_data->scaleRects[axisPos] = QRect();
+}
+
+/*!
+   \return Minimum size hint
+   \param plot Plot widget
+
+   \sa QwtPlot::minimumSizeHint()
+ */
+QSize QwtPlotLayout::minimumSizeHint( const QwtPlot* plot ) const
+{
+    LayoutHintData hintData( plot );
+
+    const int xAxesWidth = hintData.xAxesWidth();
+    const int yAxesHeight = hintData.yAxesHeight();
+
+    const QWidget* canvas = plot->canvas();
+
+    const QMargins m = canvas->contentsMargins();
+    const QSize minCanvasSize = canvas->minimumSize();
+
+    int w = hintData.yAxesWidth();
+    int cw = xAxesWidth + m.left() + 1 + m.right() + 1;
+    w += qMax( cw, minCanvasSize.width() );
+
+    int h = hintData.xAxesHeight();
+    int ch = yAxesHeight + m.top() + 1 + m.bottom() + 1;
+    h += qMax( ch, minCanvasSize.height() );
+
+    const QwtTextLabel* labels[2];
+    labels[0] = plot->titleLabel();
+    labels[1] = plot->footerLabel();
+
+    for ( int i = 0; i < 2; i++ )
+    {
+        const QwtTextLabel* label = labels[i];
+        if ( label && !label->text().isEmpty() )
+        {
+            // we center on the plot canvas.
+            const bool centerOnCanvas = !( plot->isAxisVisible( QwtAxis::YLeft )
+                && plot->isAxisVisible( QwtAxis::YRight ) );
+
+            int labelW = w;
+            if ( centerOnCanvas )
+            {
+                labelW -= hintData.yAxesWidth();
+            }
+
+            int labelH = label->heightForWidth( labelW );
+            if ( labelH > labelW ) // Compensate for a long title
+            {
+                w = labelW = labelH;
+                if ( centerOnCanvas )
+                    w += hintData.yAxesWidth();
+
+                labelH = label->heightForWidth( labelW );
+            }
+            h += labelH + spacing();
+        }
+    }
+
+    // Compute the legend contribution
+
+    const QwtAbstractLegend* legend = plot->legend();
+    if ( legend && !legend->isEmpty() )
+    {
+        const LayoutEngine& engine = m_data->engine;
+
+        if ( engine.legendPos() == QwtPlot::LeftLegend
+            || engine.legendPos() == QwtPlot::RightLegend )
+        {
+            int legendW = legend->sizeHint().width();
+            int legendH = legend->heightForWidth( legendW );
+
+            if ( legend->frameWidth() > 0 )
+                w += spacing();
+
+            if ( legendH > h )
+                legendW += legend->scrollExtent( Qt::Horizontal );
+
+            if ( engine.legendRatio() < 1.0 )
+                legendW = qMin( legendW, int( w / ( 1.0 - engine.legendRatio() ) ) );
+
+            w += legendW + spacing();
         }
         else
         {
-            if ( d_data->alignCanvasToScales[QwtPlot::xTop] )
-            {
-                double x = canvasRect.top() - d_data->layoutData.scale[axis].start;
-                if ( !( options & IgnoreFrames ) )
-                    x += d_data->layoutData.canvas.contentsMargins[ QwtPlot::xTop ];
-
-                sRect.setTop( x );
-            }
-            if ( d_data->alignCanvasToScales[QwtPlot::xBottom] )
-            {
-                double x = canvasRect.bottom() - 1 + d_data->layoutData.scale[axis].end;
-                if ( !( options & IgnoreFrames ) )
-                    x -= d_data->layoutData.canvas.contentsMargins[ QwtPlot::xBottom ];
-
-                sRect.setBottom( x );
-            }
-
-            if ( d_data->alignCanvasToScales[ axis ] )
-            {
-                if ( axis == QwtPlot::yLeft )
-                    sRect.setRight( canvasRect.left() );
-                else
-                    sRect.setLeft( canvasRect.right() );
-            }
-        }
-    }
-}
-
-/*!
-  \brief Recalculate the geometry of all components.
-
-  \param plot Plot to be layout
-  \param plotRect Rectangle where to place the components
-  \param options Layout options
-
-  \sa invalidate(), titleRect(), footerRect()
+            int legendW = qMin( legend->sizeHint().width(), w );
+            int legendH = legend->heightForWidth( legendW );
+
+            if ( legend->frameWidth() > 0 )
+                h += spacing();
+
+            if ( engine.legendRatio() < 1.0 )
+                legendH = qMin( legendH, int( h / ( 1.0 - engine.legendRatio() ) ) );
+
+            h += legendH + spacing();
+        }
+    }
+
+    return QSize( w, h );
+}
+
+/*!
+   \brief Recalculate the geometry of all components.
+
+   \param plot Plot to be layout
+   \param plotRect Rectangle where to place the components
+   \param options Layout options
+
+   \sa invalidate(), titleRect(), footerRect()
       legendRect(), scaleRect(), canvasRect()
-*/
-void QwtPlotLayout::activate( const QwtPlot *plot,
-    const QRectF &plotRect, Options options )
+ */
+void QwtPlotLayout::activate( const QwtPlot* plot,
+    const QRectF& plotRect, Options options )
 {
     invalidate();
@@ -1276,32 +1514,45 @@
 
     // We extract all layout relevant parameters from the widgets,
-    // and save them to d_data->layoutData.
-
-    d_data->layoutData.init( plot, rect );
+    // and save them to m_data->layoutData.
+
+    LayoutData layoutData( plot );
+
+    QSize legendHint;
 
     if ( !( options & IgnoreLegend )
         && plot->legend() && !plot->legend()->isEmpty() )
     {
-        d_data->legendRect = layoutLegend( options, rect );
-
-        // subtract d_data->legendRect from rect
+        legendHint = layoutData.legendData.legendHint( plot->legend(), rect );
+
+        m_data->legendRect = m_data->engine.layoutLegend(
+            options, layoutData.legendData, rect, legendHint );
+
+        // subtract m_data->legendRect from rect
 
         const QRegion region( rect.toRect() );
-        rect = region.subtracted( d_data->legendRect.toRect() ).boundingRect();
-
-        switch ( d_data->legendPos )
+        rect = region.subtracted( m_data->legendRect.toRect() ).boundingRect();
+
+        switch ( m_data->engine.legendPos() )
         {
             case QwtPlot::LeftLegend:
-                rect.setLeft( rect.left() + d_data->spacing );
+            {
+                rect.setLeft( rect.left() + spacing() );
                 break;
+            }
             case QwtPlot::RightLegend:
-                rect.setRight( rect.right() - d_data->spacing );
+            {
+                rect.setRight( rect.right() - spacing() );
                 break;
+            }
             case QwtPlot::TopLegend:
-                rect.setTop( rect.top() + d_data->spacing );
+            {
+                rect.setTop( rect.top() + spacing() );
                 break;
+            }
             case QwtPlot::BottomLegend:
-                rect.setBottom( rect.bottom() - d_data->spacing );
+            {
+                rect.setBottom( rect.bottom() - spacing() );
                 break;
+            }
         }
     }
@@ -1322,5 +1573,5 @@
      |      Footer       |
      +---+-----------+---+
-    */
+     */
 
     // title, footer and axes include text labels. The height of each
@@ -1328,84 +1579,95 @@
     // for the label. A line break in a horizontal text will reduce
     // the available width for vertical texts and vice versa.
-    // expandLineBreaks finds the height/width for title, footer and axes
+    // layoutDimensions finds the height/width for title, footer and axes
     // including all line breaks.
 
-    int dimTitle, dimFooter, dimAxes[QwtPlot::axisCnt];
-    expandLineBreaks( options, rect, dimTitle, dimFooter, dimAxes );
-
-    if ( dimTitle > 0 )
-    {
-        d_data->titleRect.setRect(
-            rect.left(), rect.top(), rect.width(), dimTitle );
-
-        rect.setTop( d_data->titleRect.bottom() + d_data->spacing );
-
-        if ( d_data->layoutData.scale[QwtPlot::yLeft].isEnabled !=
-            d_data->layoutData.scale[QwtPlot::yRight].isEnabled )
+    using namespace QwtAxis;
+
+    const LayoutEngine::Dimensions dimensions =
+        m_data->engine.layoutDimensions( options, layoutData, rect );
+
+    if ( dimensions.dimTitle > 0 )
+    {
+        QRectF& labelRect = m_data->titleRect;
+
+        labelRect.setRect( rect.left(), rect.top(), rect.width(), dimensions.dimTitle );
+
+        rect.setTop( labelRect.bottom() + spacing() );
+
+        if ( !layoutData.hasSymmetricYAxes() )
         {
             // if only one of the y axes is missing we align
             // the title centered to the canvas
 
-            d_data->titleRect.setX( rect.left() + dimAxes[QwtPlot::yLeft] );
-            d_data->titleRect.setWidth( rect.width()
-                - dimAxes[QwtPlot::yLeft] - dimAxes[QwtPlot::yRight] );
-        }
-    }
-
-    if ( dimFooter > 0 )
-    {
-        d_data->footerRect.setRect(
-            rect.left(), rect.bottom() - dimFooter, rect.width(), dimFooter );
-
-        rect.setBottom( d_data->footerRect.top() - d_data->spacing );
-
-        if ( d_data->layoutData.scale[QwtPlot::yLeft].isEnabled !=
-            d_data->layoutData.scale[QwtPlot::yRight].isEnabled )
+            labelRect = dimensions.centered( rect, labelRect );
+        }
+    }
+
+    if ( dimensions.dimFooter > 0 )
+    {
+        QRectF& labelRect = m_data->footerRect;
+
+        labelRect.setRect( rect.left(), rect.bottom() - dimensions.dimFooter,
+            rect.width(), dimensions.dimFooter );
+
+        rect.setBottom( labelRect.top() - spacing() );
+
+        if ( !layoutData.hasSymmetricYAxes() )
         {
             // if only one of the y axes is missing we align
             // the footer centered to the canvas
 
-            d_data->footerRect.setX( rect.left() + dimAxes[QwtPlot::yLeft] );
-            d_data->footerRect.setWidth( rect.width()
-                - dimAxes[QwtPlot::yLeft] - dimAxes[QwtPlot::yRight] );
-        }
-    }
-
-    d_data->canvasRect.setRect(
-        rect.x() + dimAxes[QwtPlot::yLeft],
-        rect.y() + dimAxes[QwtPlot::xTop],
-        rect.width() - dimAxes[QwtPlot::yRight] - dimAxes[QwtPlot::yLeft],
-        rect.height() - dimAxes[QwtPlot::xBottom] - dimAxes[QwtPlot::xTop] );
-
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
+            labelRect = dimensions.centered( rect, labelRect );
+        }
+    }
+
+    m_data->canvasRect = dimensions.innerRect( rect );
+
+    for ( int axisPos = 0; axisPos < AxisPositions; axisPos++ )
     {
         // set the rects for the axes
 
-        if ( dimAxes[axis] )
-        {
-            int dim = dimAxes[axis];
-            QRectF &scaleRect = d_data->scaleRect[axis];
-
-            scaleRect = d_data->canvasRect;
-            switch ( axis )
-            {
-                case QwtPlot::yLeft:
-                    scaleRect.setX( d_data->canvasRect.left() - dim );
-                    scaleRect.setWidth( dim );
-                    break;
-                case QwtPlot::yRight:
-                    scaleRect.setX( d_data->canvasRect.right() );
-                    scaleRect.setWidth( dim );
-                    break;
-                case QwtPlot::xBottom:
-                    scaleRect.setY( d_data->canvasRect.bottom() );
-                    scaleRect.setHeight( dim );
-                    break;
-                case QwtPlot::xTop:
-                    scaleRect.setY( d_data->canvasRect.top() - dim );
-                    scaleRect.setHeight( dim );
-                    break;
-            }
-            scaleRect = scaleRect.normalized();
+        const int pos = 0;
+        {
+            const QwtAxisId axisId( axisPos );
+
+            if ( dimensions.dimAxis( axisId ) )
+            {
+                const int dim = dimensions.dimAxis( axisId );
+
+                const QRectF& canvasRect = m_data->canvasRect;
+
+                QRectF& scaleRect = m_data->scaleRects[axisId];
+                scaleRect = canvasRect;
+
+                switch ( axisPos )
+                {
+                    case YLeft:
+                    {
+                        scaleRect.setX( canvasRect.left() - pos - dim );
+                        scaleRect.setWidth( dim );
+                        break;
+                    }
+                    case YRight:
+                    {
+                        scaleRect.setX( canvasRect.right() + pos );
+                        scaleRect.setWidth( dim );
+                        break;
+                    }
+                    case XBottom:
+                    {
+                        scaleRect.setY( canvasRect.bottom() + pos );
+                        scaleRect.setHeight( dim );
+                        break;
+                    }
+                    case XTop:
+                    {
+                        scaleRect.setY( canvasRect.top() - pos - dim );
+                        scaleRect.setHeight( dim );
+                        break;
+                    }
+                }
+                scaleRect = scaleRect.normalized();
+            }
         }
     }
@@ -1431,12 +1693,14 @@
     // left/right of the min/max ticks are moved into them.
 
-    alignScales( options, d_data->canvasRect, d_data->scaleRect );
-
-    if ( !d_data->legendRect.isEmpty() )
+    m_data->engine.alignScales( options, layoutData,
+        m_data->canvasRect, m_data->scaleRects );
+
+    if ( !m_data->legendRect.isEmpty() )
     {
         // We prefer to align the legend to the canvas - not to
         // the complete plot - if possible.
 
-        d_data->legendRect = alignLegend( d_data->canvasRect, d_data->legendRect );
-    }
-}
+        m_data->legendRect = m_data->engine.alignLegend(
+            legendHint, m_data->canvasRect, m_data->legendRect );
+    }
+}
Index: /trunk/BNC/qwt/qwt_plot_layout.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_layout.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_layout.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,21 +13,22 @@
 #include "qwt_global.h"
 #include "qwt_plot.h"
+#include "qwt_axis_id.h"
 
 /*!
-  \brief Layout engine for QwtPlot.
+   \brief Layout engine for QwtPlot.
 
-  It is used by the QwtPlot widget to organize its internal widgets
-  or by QwtPlot::print() to render its content to a QPaintDevice like
-  a QPrinter, QPixmap/QImage or QSvgRenderer.
+   It is used by the QwtPlot widget to organize its internal widgets
+   or by QwtPlot::print() to render its content to a QPaintDevice like
+   a QPrinter, QPixmap/QImage or QSvgRenderer.
 
-  \sa QwtPlot::setPlotLayout()
-*/
+   \sa QwtPlot::setPlotLayout()
+ */
 
 class QWT_EXPORT QwtPlotLayout
 {
-public:
+  public:
     /*!
-      Options to configure the plot layout engine
-      \sa activate(), QwtPlotRenderer
+       Options to configure the plot layout engine
+       \sa activate(), QwtPlotRenderer
      */
     enum Option
@@ -37,6 +38,6 @@
 
         /*!
-          Ignore the dimension of the scrollbars. There are no
-          scrollbars, when the plot is not rendered to widgets.
+           Ignore the dimension of the scrollbars. There are no
+           scrollbars, when the plot is not rendered to widgets.
          */
         IgnoreScrollbars = 0x02,
@@ -55,6 +56,5 @@
     };
 
-    //! Layout options
-    typedef QFlags<Option> Options;
+    Q_DECLARE_FLAGS( Options, Option )
 
     explicit QwtPlotLayout();
@@ -79,8 +79,8 @@
     double legendRatio() const;
 
-    virtual QSize minimumSizeHint( const QwtPlot * ) const;
+    virtual QSize minimumSizeHint( const QwtPlot* ) const;
 
-    virtual void activate( const QwtPlot *,
-        const QRectF &plotRect, Options options = Options() );
+    virtual void activate( const QwtPlot*,
+        const QRectF& plotRect, Options options = Options() );
 
     virtual void invalidate();
@@ -89,31 +89,20 @@
     QRectF footerRect() const;
     QRectF legendRect() const;
-    QRectF scaleRect( int axis ) const;
+    QRectF scaleRect( QwtAxisId ) const;
     QRectF canvasRect() const;
 
-    class LayoutData;
+  protected:
 
-protected:
+    void setTitleRect( const QRectF& );
+    void setFooterRect( const QRectF& );
+    void setLegendRect( const QRectF& );
+    void setScaleRect( QwtAxisId, const QRectF& );
+    void setCanvasRect( const QRectF& );
 
-    void setTitleRect( const QRectF & );
-    void setFooterRect( const QRectF & );
-    void setLegendRect( const QRectF & );
-    void setScaleRect( int axis, const QRectF & );
-    void setCanvasRect( const QRectF & );
+  private:
+    Q_DISABLE_COPY(QwtPlotLayout)
 
-    QRectF layoutLegend( Options options, const QRectF & ) const;
-    QRectF alignLegend( const QRectF &canvasRect,
-        const QRectF &legendRect ) const;
-
-    void expandLineBreaks( Options options, const QRectF &rect,
-        int &dimTitle, int &dimFooter, int dimAxes[QwtPlot::axisCnt] ) const;
-
-    void alignScales( Options options, QRectF &canvasRect,
-        QRectF scaleRect[QwtPlot::axisCnt] ) const;
-
-private:
     class PrivateData;
-
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_legenditem.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_legenditem.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_legenditem.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,132 +10,137 @@
 #include "qwt_plot_legenditem.h"
 #include "qwt_dyngrid_layout.h"
-#include "qwt_scale_map.h"
-#include "qwt_painter.h"
+#include "qwt_text.h"
+#include "qwt_graphic.h"
+#include "qwt_legend_data.h"
+#include "qwt_math.h"
+
 #include <qlayoutitem.h>
 #include <qpen.h>
 #include <qbrush.h>
 #include <qpainter.h>
-#include <qmath.h>
-
-class QwtLegendLayoutItem: public QLayoutItem
-{
-public:
-    QwtLegendLayoutItem( const QwtPlotLegendItem *, const QwtPlotItem * );
-    virtual ~QwtLegendLayoutItem();
-
-    const QwtPlotItem *plotItem() const;
-
-    void setData( const QwtLegendData & );
-    const QwtLegendData &data() const;
-
-    virtual Qt::Orientations expandingDirections() const;
-    virtual QRect geometry() const;
-    virtual bool hasHeightForWidth() const;
-    virtual int heightForWidth( int w ) const;
-    virtual bool isEmpty() const;
-    virtual QSize maximumSize() const;
-    virtual int minimumHeightForWidth( int w ) const;
-    virtual QSize minimumSize() const;
-    virtual void setGeometry( const QRect & r );
-    virtual QSize sizeHint() const;
-
-private:
-
-    const QwtPlotLegendItem *d_legendItem;
-    const QwtPlotItem *d_plotItem;
-    QwtLegendData d_data;
-
-    QRect d_rect;
-};
-
-QwtLegendLayoutItem::QwtLegendLayoutItem(
-        const QwtPlotLegendItem *legendItem, const QwtPlotItem *plotItem ):
-    d_legendItem( legendItem ),
-    d_plotItem( plotItem)
-{
-}
-
-QwtLegendLayoutItem::~QwtLegendLayoutItem()
-{
-}
-
-const QwtPlotItem *QwtLegendLayoutItem::plotItem() const
-{
-    return d_plotItem;
-}
-
-void QwtLegendLayoutItem::setData( const QwtLegendData &data )
-{
-    d_data = data;
-}
-
-const QwtLegendData &QwtLegendLayoutItem::data() const
-{
-    return d_data;
-}
-
-Qt::Orientations QwtLegendLayoutItem::expandingDirections() const
-{
-    return Qt::Horizontal;
-}
-
-bool QwtLegendLayoutItem::hasHeightForWidth() const
-{
-    return !d_data.title().isEmpty();
-}
-
-int QwtLegendLayoutItem::minimumHeightForWidth( int w ) const
-{
-    return d_legendItem->heightForWidth( d_data, w );
-}
-
-int QwtLegendLayoutItem::heightForWidth( int w ) const
-{
-    return d_legendItem->heightForWidth( d_data, w );
-}
-
-bool QwtLegendLayoutItem::isEmpty() const
-{
-    return false;
-}
-
-QSize QwtLegendLayoutItem::maximumSize() const
-{
-    return QSize( QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX );
-}
-
-QSize QwtLegendLayoutItem::minimumSize() const
-{
-    return d_legendItem->minimumSize( d_data );
-}
-
-QSize QwtLegendLayoutItem::sizeHint() const
-{
-    return minimumSize();
-}
-
-void QwtLegendLayoutItem::setGeometry( const QRect &rect )
-{
-    d_rect = rect;
-}
-
-QRect QwtLegendLayoutItem::geometry() const
-{
-    return d_rect;
+
+namespace
+{
+    class LayoutItem QWT_FINAL : public QLayoutItem
+    {
+      public:
+        LayoutItem( const QwtPlotLegendItem*, const QwtPlotItem* );
+        virtual ~LayoutItem();
+
+        const QwtPlotItem* plotItem() const;
+
+        void setData( const QwtLegendData& );
+        const QwtLegendData& data() const;
+
+        virtual Qt::Orientations expandingDirections() const QWT_OVERRIDE;
+        virtual QRect geometry() const QWT_OVERRIDE;
+        virtual bool hasHeightForWidth() const QWT_OVERRIDE;
+        virtual int heightForWidth( int ) const QWT_OVERRIDE;
+        virtual bool isEmpty() const QWT_OVERRIDE;
+        virtual QSize maximumSize() const QWT_OVERRIDE;
+        virtual int minimumHeightForWidth( int ) const QWT_OVERRIDE;
+        virtual QSize minimumSize() const QWT_OVERRIDE;
+        virtual void setGeometry( const QRect& ) QWT_OVERRIDE;
+        virtual QSize sizeHint() const QWT_OVERRIDE;
+
+      private:
+
+        const QwtPlotLegendItem* m_legendItem;
+        const QwtPlotItem* m_plotItem;
+        QwtLegendData m_data;
+
+        QRect m_rect;
+    };
+
+    LayoutItem::LayoutItem(
+            const QwtPlotLegendItem* legendItem, const QwtPlotItem* plotItem )
+        : m_legendItem( legendItem )
+        , m_plotItem( plotItem)
+    {
+    }
+
+    LayoutItem::~LayoutItem()
+    {
+    }
+
+    const QwtPlotItem* LayoutItem::plotItem() const
+    {
+        return m_plotItem;
+    }
+
+    void LayoutItem::setData( const QwtLegendData& data )
+    {
+        m_data = data;
+    }
+
+    const QwtLegendData& LayoutItem::data() const
+    {
+        return m_data;
+    }
+
+    Qt::Orientations LayoutItem::expandingDirections() const
+    {
+        return Qt::Horizontal;
+    }
+
+    bool LayoutItem::hasHeightForWidth() const
+    {
+        return !m_data.title().isEmpty();
+    }
+
+    int LayoutItem::minimumHeightForWidth( int w ) const
+    {
+        return m_legendItem->heightForWidth( m_data, w );
+    }
+
+    int LayoutItem::heightForWidth( int w ) const
+    {
+        return m_legendItem->heightForWidth( m_data, w );
+    }
+
+    bool LayoutItem::isEmpty() const
+    {
+        return false;
+    }
+
+    QSize LayoutItem::maximumSize() const
+    {
+        return QSize( QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX );
+    }
+
+    QSize LayoutItem::minimumSize() const
+    {
+        return m_legendItem->minimumSize( m_data );
+    }
+
+    QSize LayoutItem::sizeHint() const
+    {
+        return minimumSize();
+    }
+
+    void LayoutItem::setGeometry( const QRect& rect )
+    {
+        m_rect = rect;
+    }
+
+    QRect LayoutItem::geometry() const
+    {
+        return m_rect;
+    }
 }
 
 class QwtPlotLegendItem::PrivateData
 {
-public:
-    PrivateData():
-        itemMargin( 4 ),
-        itemSpacing( 4 ),
-        borderRadius( 0.0 ),
-        borderPen( Qt::NoPen ),
-        backgroundBrush( Qt::NoBrush ),
-        backgroundMode( QwtPlotLegendItem::LegendBackground ),
-        borderDistance( 10 ),
-        alignment( Qt::AlignRight | Qt::AlignBottom )
-    {
+  public:
+    PrivateData()
+        : itemMargin( 4 )
+        , itemSpacing( 4 )
+        , borderRadius( 0.0 )
+        , borderPen( Qt::NoPen )
+        , backgroundBrush( Qt::NoBrush )
+        , backgroundMode( QwtPlotLegendItem::LegendBackground )
+        , canvasAlignment( Qt::AlignRight | Qt::AlignBottom )
+    {
+        canvasOffset[ 0 ] = canvasOffset[1] = 10;
         layout = new QwtDynGridLayout();
         layout->setMaxColumns( 2 );
@@ -160,16 +165,16 @@
     QwtPlotLegendItem::BackgroundMode backgroundMode;
 
-    int borderDistance;
-    Qt::Alignment alignment;
-
-    QMap< const QwtPlotItem *, QList<QwtLegendLayoutItem *> > map;
-    QwtDynGridLayout *layout;
+    int canvasOffset[2];
+    Qt::Alignment canvasAlignment;
+
+    QMap< const QwtPlotItem*, QList< LayoutItem* > > map;
+    QwtDynGridLayout* layout;
 };
 
 //! Constructor
-QwtPlotLegendItem::QwtPlotLegendItem():
-    QwtPlotItem( QwtText( "Legend" ) )
-{
-    d_data = new PrivateData;
+QwtPlotLegendItem::QwtPlotLegendItem()
+    : QwtPlotItem( QwtText( "Legend" ) )
+{
+    m_data = new PrivateData;
 
     setItemInterest( QwtPlotItem::LegendInterest, true );
@@ -181,5 +186,5 @@
 {
     clearLegend();
-    delete d_data;
+    delete m_data;
 }
 
@@ -191,69 +196,69 @@
 
 /*!
-  \brief Set the alignmnet
-
-  Alignment means the position of the legend relative
-  to the geometry of the plot canvas.
-
-  \param alignment Alignment flags
-
-  \sa alignment(), setMaxColumns()
-
-  \note To align a legend with many items horizontally
+   \brief Set the alignmnet
+
+   Alignment means the position of the legend relative
+   to the geometry of the plot canvas.
+
+   \param alignment Alignment flags
+
+   \sa alignmentInCanvas(), setMaxColumns()
+
+   \note To align a legend with many items horizontally
         the number of columns need to be limited
  */
-void QwtPlotLegendItem::setAlignment( Qt::Alignment alignment )
-{
-    if ( d_data->alignment != alignment )
-    {
-        d_data->alignment = alignment;
-        itemChanged();
-    }
-}
-
-/*!
-  \return Alignment flags
-  \sa setAlignment()
- */
-Qt::Alignment QwtPlotLegendItem::alignment() const
-{
-    return d_data->alignment;
-}
-
-/*!
-  \brief Limit the number of columns
-
-  When aligning the legend horizontally ( Qt::AlignLeft, Qt::AlignRight )
-  the number of columns needs to be limited to avoid, that
-  the width of the legend grows with an increasing number of entries.
-
-  \param maxColumns Maximum number of columns. 0 means unlimited.
-  \sa maxColumns(), QwtDynGridLayout::setMaxColumns()
+void QwtPlotLegendItem::setAlignmentInCanvas( Qt::Alignment alignment )
+{
+    if ( m_data->canvasAlignment != alignment )
+    {
+        m_data->canvasAlignment = alignment;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Alignment flags
+   \sa setAlignmentInCanvas()
+ */
+Qt::Alignment QwtPlotLegendItem::alignmentInCanvas() const
+{
+    return m_data->canvasAlignment;
+}
+
+/*!
+   \brief Limit the number of columns
+
+   When aligning the legend horizontally ( Qt::AlignLeft, Qt::AlignRight )
+   the number of columns needs to be limited to avoid, that
+   the width of the legend grows with an increasing number of entries.
+
+   \param maxColumns Maximum number of columns. 0 means unlimited.
+   \sa maxColumns(), QwtDynGridLayout::setMaxColumns()
  */
 void QwtPlotLegendItem::setMaxColumns( uint maxColumns )
 {
-    if ( maxColumns != d_data->layout->maxColumns() )
-    {
-        d_data->layout->setMaxColumns( maxColumns );
-        itemChanged();
-    }
-}
-
-/*!
-  \return Maximum number of columns
-  \sa maxColumns(), QwtDynGridLayout::maxColumns()
+    if ( maxColumns != m_data->layout->maxColumns() )
+    {
+        m_data->layout->setMaxColumns( maxColumns );
+        itemChanged();
+    }
+}
+
+/*!
+   \return Maximum number of columns
+   \sa maxColumns(), QwtDynGridLayout::maxColumns()
  */
 uint QwtPlotLegendItem::maxColumns() const
 {
-    return d_data->layout->maxColumns();
-}
-
-/*!
-  \brief Set the margin around legend items
-
-  The default setting for the margin is 0.
-
-  \param margin Margin in pixels
-  \sa margin(), setSpacing(), setItemMargin(), setItemSpacing
+    return m_data->layout->maxColumns();
+}
+
+/*!
+   \brief Set the margin around legend items
+
+   The default setting for the margin is 0.
+
+   \param margin Margin in pixels
+   \sa margin(), setSpacing(), setItemMargin(), setItemSpacing
  */
 void QwtPlotLegendItem::setMargin( int margin )
@@ -262,5 +267,5 @@
     if ( margin != this->margin() )
     {
-        d_data->layout->setContentsMargins(
+        m_data->layout->setContentsMargins(
             margin, margin, margin, margin );
 
@@ -270,11 +275,11 @@
 
 /*!
-  \return Margin around the legend items
-  \sa setMargin(), spacing(), itemMargin(), itemSpacing()
+   \return Margin around the legend items
+   \sa setMargin(), spacing(), itemMargin(), itemSpacing()
  */
 int QwtPlotLegendItem::margin() const
 {
     int left;
-    d_data->layout->getContentsMargins( &left, NULL, NULL, NULL );
+    m_data->layout->getContentsMargins( &left, NULL, NULL, NULL );
 
     return left;
@@ -282,81 +287,81 @@
 
 /*!
-  \brief Set the spacing between the legend items
-
-  \param spacing Spacing in pixels
-  \sa spacing(), setMargin()
-*/
+   \brief Set the spacing between the legend items
+
+   \param spacing Spacing in pixels
+   \sa spacing(), setMargin()
+ */
 void QwtPlotLegendItem::setSpacing( int spacing )
 {
     spacing = qMax( spacing, 0 );
-    if ( spacing != d_data->layout->spacing() )
-    {
-        d_data->layout->setSpacing( spacing );
-        itemChanged();
-    }
-}
-
-/*!
-  \return Spacing between the legend items
-  \sa setSpacing(), margin(), itemSpacing(), itemMargin()
+    if ( spacing != m_data->layout->spacing() )
+    {
+        m_data->layout->setSpacing( spacing );
+        itemChanged();
+    }
+}
+
+/*!
+   \return Spacing between the legend items
+   \sa setSpacing(), margin(), itemSpacing(), itemMargin()
  */
 int QwtPlotLegendItem::spacing() const
 {
-    return d_data->layout->spacing();
-}
-
-/*!
-  Set the margin around each item
-
-  \param margin Margin
-  \sa itemMargin(), setItemSpacing(), setMargin(), setSpacing()
+    return m_data->layout->spacing();
+}
+
+/*!
+   Set the margin around each item
+
+   \param margin Margin
+   \sa itemMargin(), setItemSpacing(), setMargin(), setSpacing()
  */
 void QwtPlotLegendItem::setItemMargin( int margin )
 {
     margin = qMax( margin, 0 );
-    if ( margin != d_data->itemMargin )
-    {
-        d_data->itemMargin = margin;
-
-        d_data->layout->invalidate();
-        itemChanged();
-    }
-}
-
-/*!
-  \return Margin around each item
-  \sa setItemMargin(), itemSpacing(), margin(), spacing()
-*/
+    if ( margin != m_data->itemMargin )
+    {
+        m_data->itemMargin = margin;
+
+        m_data->layout->invalidate();
+        itemChanged();
+    }
+}
+
+/*!
+   \return Margin around each item
+   \sa setItemMargin(), itemSpacing(), margin(), spacing()
+ */
 int QwtPlotLegendItem::itemMargin() const
 {
-    return d_data->itemMargin;
-}
-
-/*!
-  Set the spacing inside of each item
-
-  \param spacing Spacing
-  \sa itemSpacing(), setItemMargin(), setMargin(), setSpacing()
+    return m_data->itemMargin;
+}
+
+/*!
+   Set the spacing inside of each item
+
+   \param spacing Spacing
+   \sa itemSpacing(), setItemMargin(), setMargin(), setSpacing()
  */
 void QwtPlotLegendItem::setItemSpacing( int spacing )
 {
     spacing = qMax( spacing, 0 );
-    if ( spacing != d_data->itemSpacing )
-    {
-        d_data->itemSpacing = spacing;
-
-        d_data->layout->invalidate();
-        itemChanged();
-    }
-
-}
-
-/*!
-  \return Spacing inside of each item
-  \sa setItemSpacing(), itemMargin(), margin(), spacing()
-*/
+    if ( spacing != m_data->itemSpacing )
+    {
+        m_data->itemSpacing = spacing;
+
+        m_data->layout->invalidate();
+        itemChanged();
+    }
+
+}
+
+/*!
+   \return Spacing inside of each item
+   \sa setItemSpacing(), itemMargin(), margin(), spacing()
+ */
 int QwtPlotLegendItem::itemSpacing() const
 {
-    return d_data->itemSpacing;
+    return m_data->itemSpacing;
 }
 
@@ -366,12 +371,12 @@
    \param font Legend font
    \sa font()
-*/
-void QwtPlotLegendItem::setFont( const QFont &font )
-{
-    if ( font != d_data->font )
-    {
-        d_data->font = font;
-
-        d_data->layout->invalidate();
+ */
+void QwtPlotLegendItem::setFont( const QFont& font )
+{
+    if ( font != m_data->font )
+    {
+        m_data->font = font;
+
+        m_data->layout->invalidate();
         itemChanged();
     }
@@ -381,122 +386,150 @@
    \return Font used for drawing the text label
    \sa setFont()
-*/
+ */
 QFont QwtPlotLegendItem::font() const
 {
-    return d_data->font;
-}
-
-/*!
-  \brief Set the margin between the legend and the canvas border
-
-  The default setting for the margin is 10 pixels.
-
-  \param distance Margin in pixels
-  \sa setMargin()
- */
-void QwtPlotLegendItem::setBorderDistance( int distance )
-{
-    if ( distance < 0 )
-        distance = -1;
-
-    if ( distance != d_data->borderDistance )
-    {
-        d_data->borderDistance = distance;
-        itemChanged();
-    }
-}
-
-/*!
-  \return Margin between the legend and the canvas border
-  \sa margin()
- */
-int QwtPlotLegendItem::borderDistance() const
-{
-    return d_data->borderDistance;
-}
-
-/*!
-  Set the radius for the border
-
-  \param radius A value <= 0 defines a rectangular border
-  \sa borderRadius(), setBorderPen()
+    return m_data->font;
+}
+
+/*!
+   \brief Set the distance between the legend and the canvas border
+
+   The default setting is 10 pixels.
+
+   \param orientations Qt::Horizontal is for the left/right,
+                      Qt::Vertical for the top/bottom offset.
+
+   \param numPixels Distance in pixels
+   \sa setMargin()
+ */
+void QwtPlotLegendItem::setOffsetInCanvas(
+    Qt::Orientations orientations, int numPixels )
+{
+    if ( numPixels < 0 )
+        numPixels = -1;
+
+    bool isChanged = false;
+
+    int* offset = m_data->canvasOffset;
+
+    if ( orientations & Qt::Horizontal )
+    {
+        if ( numPixels != offset[0] )
+        {
+            offset[0] = numPixels;
+            isChanged = true;
+        }
+    }
+
+    if ( orientations & Qt::Vertical )
+    {
+        if ( numPixels != offset[1] )
+        {
+            offset[1] = numPixels;
+            isChanged = true;
+        }
+    }
+
+    if ( isChanged )
+        itemChanged();
+}
+
+/*!
+   \param orientation Qt::Horizontal is for the left/right,
+                      Qt::Vertical for the top/bottom padding.
+
+   \return Distance between the legend and the canvas border
+   \sa setOffsetInCanvas()
+ */
+int QwtPlotLegendItem::offsetInCanvas(
+    Qt::Orientation orientation ) const
+{
+    const int index = ( orientation == Qt::Vertical ) ? 1 : 0;
+    return m_data->canvasOffset[index];
+}
+
+/*!
+   Set the radius for the border
+
+   \param radius A value <= 0 defines a rectangular border
+   \sa borderRadius(), setBorderPen()
  */
 void QwtPlotLegendItem::setBorderRadius( double radius )
 {
-    radius = qMax( 0.0, radius );
-
-    if ( radius != d_data->borderRadius )
-    {
-        d_data->borderRadius = radius;
-        itemChanged();
-    }
-}
-
-/*!
-  \return Radius of the border
-  \sa setBorderRadius(), setBorderPen()
+    radius = qwtMaxF( 0.0, radius );
+
+    if ( radius != m_data->borderRadius )
+    {
+        m_data->borderRadius = radius;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Radius of the border
+   \sa setBorderRadius(), setBorderPen()
  */
 double QwtPlotLegendItem::borderRadius() const
 {
-    return d_data->borderRadius;
-}
-
-/*!
-  Set the pen for drawing the border
-
-  \param pen Border pen
-  \sa borderPen(), setBackgroundBrush()
- */
-void QwtPlotLegendItem::setBorderPen( const QPen &pen )
-{
-    if ( d_data->borderPen != pen )
-    {
-        d_data->borderPen = pen;
-        itemChanged();
-    }
-}
-
-/*!
-  \return Pen for drawing the border
-  \sa setBorderPen(), backgroundBrush()
+    return m_data->borderRadius;
+}
+
+/*!
+   Set the pen for drawing the border
+
+   \param pen Border pen
+   \sa borderPen(), setBackgroundBrush()
+ */
+void QwtPlotLegendItem::setBorderPen( const QPen& pen )
+{
+    if ( m_data->borderPen != pen )
+    {
+        m_data->borderPen = pen;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Pen for drawing the border
+   \sa setBorderPen(), backgroundBrush()
  */
 QPen QwtPlotLegendItem::borderPen() const
 {
-    return d_data->borderPen;
-}
-
-/*!
-  \brief Set the background brush
-
-  The brush is used to fill the background
-
-  \param brush Brush
-  \sa backgroundBrush(), setBackgroundMode(), drawBackground()
- */
-void QwtPlotLegendItem::setBackgroundBrush( const QBrush &brush )
-{
-    if ( d_data->backgroundBrush != brush )
-    {
-        d_data->backgroundBrush = brush;
-        itemChanged();
-    }
-}
-
-/*!
-  \return Brush is used to fill the background
-  \sa setBackgroundBrush(), backgroundMode(), drawBackground()
+    return m_data->borderPen;
+}
+
+/*!
+   \brief Set the background brush
+
+   The brush is used to fill the background
+
+   \param brush Brush
+   \sa backgroundBrush(), setBackgroundMode(), drawBackground()
+ */
+void QwtPlotLegendItem::setBackgroundBrush( const QBrush& brush )
+{
+    if ( m_data->backgroundBrush != brush )
+    {
+        m_data->backgroundBrush = brush;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Brush is used to fill the background
+   \sa setBackgroundBrush(), backgroundMode(), drawBackground()
  */
 QBrush QwtPlotLegendItem::backgroundBrush() const
 {
-    return d_data->backgroundBrush;
-}
-
-/*!
-  \brief Set the background mode
-
-  Depending on the mode the complete legend or each item
-  might have an background.
-
-  The default setting is LegendBackground.
+    return m_data->backgroundBrush;
+}
+
+/*!
+   \brief Set the background mode
+
+   Depending on the mode the complete legend or each item
+   might have an background.
+
+   The default setting is LegendBackground.
 
    \sa backgroundMode(), setBackgroundBrush(), drawBackground()
@@ -504,61 +537,61 @@
 void QwtPlotLegendItem::setBackgroundMode( BackgroundMode mode )
 {
-    if ( mode != d_data->backgroundMode )
-    {
-        d_data->backgroundMode = mode;
-        itemChanged();
-    }
-}
-
-/*!
-  \return backgroundMode
-  \sa setBackgroundMode(), backgroundBrush(), drawBackground()
+    if ( mode != m_data->backgroundMode )
+    {
+        m_data->backgroundMode = mode;
+        itemChanged();
+    }
+}
+
+/*!
+   \return backgroundMode
+   \sa setBackgroundMode(), backgroundBrush(), drawBackground()
  */
 QwtPlotLegendItem::BackgroundMode QwtPlotLegendItem::backgroundMode() const
 {
-    return d_data->backgroundMode;
-}
-
-/*!
-  \brief Set the pen for drawing text labels
-
-  \param pen Text pen
-  \sa textPen(), setFont()
- */
-void QwtPlotLegendItem::setTextPen( const QPen &pen )
-{
-    if ( d_data->textPen != pen )
-    {
-        d_data->textPen = pen;
-        itemChanged();
-    }
-}
-
-/*!
-  \return Pen for drawing text labels
-  \sa setTextPen(), font()
+    return m_data->backgroundMode;
+}
+
+/*!
+   \brief Set the pen for drawing text labels
+
+   \param pen Text pen
+   \sa textPen(), setFont()
+ */
+void QwtPlotLegendItem::setTextPen( const QPen& pen )
+{
+    if ( m_data->textPen != pen )
+    {
+        m_data->textPen = pen;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Pen for drawing text labels
+   \sa setTextPen(), font()
  */
 QPen QwtPlotLegendItem::textPen() const
 {
-    return d_data->textPen;
-}
-
-/*!
-  Draw the legend
-
-  \param painter Painter
-  \param xMap x Scale Map
-  \param yMap y Scale Map
-  \param canvasRect Contents rectangle of the canvas in painter coordinates
-*/
-void QwtPlotLegendItem::draw( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
+    return m_data->textPen;
+}
+
+/*!
+   Draw the legend
+
+   \param painter Painter
+   \param xMap x Scale Map
+   \param yMap y Scale Map
+   \param canvasRect Contents rectangle of the canvas in painter coordinates
+ */
+void QwtPlotLegendItem::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
 {
     Q_UNUSED( xMap );
     Q_UNUSED( yMap );
 
-    d_data->layout->setGeometry( geometry( canvasRect ) );
-    if ( d_data->layout->geometry().isEmpty() )
+    m_data->layout->setGeometry( geometry( canvasRect ) );
+    if ( m_data->layout->geometry().isEmpty() )
     {
         // don't draw a legend when having no content
@@ -566,13 +599,13 @@
     }
 
-    if ( d_data->backgroundMode == QwtPlotLegendItem::LegendBackground )
-        drawBackground( painter, d_data->layout->geometry() );
-
-    for ( int i = 0; i <  d_data->layout->count(); i++ )
-    {
-        const QwtLegendLayoutItem *layoutItem =
-            static_cast<QwtLegendLayoutItem *>( d_data->layout->itemAt( i ) );
-
-        if ( d_data->backgroundMode == QwtPlotLegendItem::ItemBackground )
+    if ( m_data->backgroundMode == QwtPlotLegendItem::LegendBackground )
+        drawBackground( painter, m_data->layout->geometry() );
+
+    for ( int i = 0; i < m_data->layout->count(); i++ )
+    {
+        const LayoutItem* layoutItem =
+            static_cast< LayoutItem* >( m_data->layout->itemAt( i ) );
+
+        if ( m_data->backgroundMode == QwtPlotLegendItem::ItemBackground )
             drawBackground( painter, layoutItem->geometry() );
 
@@ -587,21 +620,21 @@
 
 /*!
-  Draw a rounded rect
-
-  \param painter Painter
-  \param rect Bounding rectangle
-
-  \sa setBorderRadius(), setBorderPen(),
+   Draw a rounded rect
+
+   \param painter Painter
+   \param rect Bounding rectangle
+
+   \sa setBorderRadius(), setBorderPen(),
       setBackgroundBrush(), setBackgroundMode()
  */
 void QwtPlotLegendItem::drawBackground(
-    QPainter *painter, const QRectF &rect ) const
+    QPainter* painter, const QRectF& rect ) const
 {
     painter->save();
 
-    painter->setPen( d_data->borderPen );
-    painter->setBrush( d_data->backgroundBrush );
-
-    const double radius = d_data->borderRadius;
+    painter->setPen( m_data->borderPen );
+    painter->setBrush( m_data->backgroundBrush );
+
+    const double radius = m_data->borderRadius;
     painter->drawRoundedRect( rect, radius, radius );
 
@@ -610,41 +643,44 @@
 
 /*!
-  Calculate the geometry of the legend on the canvas
-
-  \param canvasRect Geometry of the canvas
-  \return Geometry of the legend
-*/
-QRect QwtPlotLegendItem::geometry( const QRectF &canvasRect ) const
+   Calculate the geometry of the legend on the canvas
+
+   \param canvasRect Geometry of the canvas
+   \return Geometry of the legend
+ */
+QRect QwtPlotLegendItem::geometry( const QRectF& canvasRect ) const
 {
     QRect rect;
-    rect.setSize( d_data->layout->sizeHint() );
-
-    int margin = d_data->borderDistance;
-    if ( d_data->alignment & Qt::AlignHCenter )
+    rect.setSize( m_data->layout->sizeHint() );
+
+    if ( m_data->canvasAlignment & Qt::AlignHCenter )
     {
         int x = qRound( canvasRect.center().x() );
         rect.moveCenter( QPoint( x, rect.center().y() ) );
     }
-    else if ( d_data->alignment & Qt::AlignRight )
-    {
-        rect.moveRight( qFloor( canvasRect.right() - margin ) );
+    else if ( m_data->canvasAlignment & Qt::AlignRight )
+    {
+        const int offset = offsetInCanvas( Qt::Horizontal );
+        rect.moveRight( qwtFloor( canvasRect.right() - offset ) );
     }
     else
     {
-        rect.moveLeft( qCeil( canvasRect.left() + margin ) );
-    }
-
-    if ( d_data->alignment & Qt::AlignVCenter )
+        const int offset = offsetInCanvas( Qt::Horizontal );
+        rect.moveLeft( qwtCeil( canvasRect.left() + offset ) );
+    }
+
+    if ( m_data->canvasAlignment & Qt::AlignVCenter )
     {
         int y = qRound( canvasRect.center().y() );
         rect.moveCenter( QPoint( rect.center().x(), y ) );
     }
-    else if ( d_data->alignment & Qt::AlignBottom )
-    {
-        rect.moveBottom( qFloor( canvasRect.bottom() - margin ) );
+    else if ( m_data->canvasAlignment & Qt::AlignBottom )
+    {
+        const int offset = offsetInCanvas( Qt::Vertical );
+        rect.moveBottom( qwtFloor( canvasRect.bottom() - offset ) );
     }
     else
     {
-        rect.moveTop( qCeil( canvasRect.top() + margin ) );
+        const int offset = offsetInCanvas( Qt::Vertical );
+        rect.moveTop( qwtCeil( canvasRect.top() + offset ) );
     }
 
@@ -653,21 +689,21 @@
 
 /*!
-  Update the legend items according to modifications of a
-  plot item
-
-  \param plotItem Plot item
-  \param data Attributes of the legend entries
- */
-void QwtPlotLegendItem::updateLegend( const QwtPlotItem *plotItem,
-        const QList<QwtLegendData> &data )
+   Update the legend items according to modifications of a
+   plot item
+
+   \param plotItem Plot item
+   \param data Attributes of the legend entries
+ */
+void QwtPlotLegendItem::updateLegend( const QwtPlotItem* plotItem,
+    const QList< QwtLegendData >& data )
 {
     if ( plotItem == NULL )
         return;
 
-    QList<QwtLegendLayoutItem *> layoutItems;
-
-    QMap<const QwtPlotItem *, QList<QwtLegendLayoutItem *> >::iterator it =
-        d_data->map.find( plotItem );
-    if ( it != d_data->map.end() )
+    QList< LayoutItem* > layoutItems;
+
+    QMap< const QwtPlotItem*, QList< LayoutItem* > >::const_iterator it =
+        m_data->map.constFind( plotItem );
+    if ( it != m_data->map.constEnd() )
         layoutItems = it.value();
 
@@ -680,23 +716,25 @@
         for ( int i = 0; i < layoutItems.size(); i++ )
         {
-            d_data->layout->removeItem( layoutItems[i] );
+            m_data->layout->removeItem( layoutItems[i] );
             delete layoutItems[i];
         }
         layoutItems.clear();
 
-        if ( it != d_data->map.end() )
-            d_data->map.remove( plotItem );
+        if ( it != m_data->map.constEnd() )
+            m_data->map.remove( plotItem );
 
         if ( !data.isEmpty() )
         {
+            layoutItems.reserve( data.size() );
+
             for ( int i = 0; i < data.size(); i++ )
             {
-                QwtLegendLayoutItem *layoutItem =
-                    new QwtLegendLayoutItem( this, plotItem );
-                d_data->layout->addItem( layoutItem );
+                LayoutItem* layoutItem =
+                    new LayoutItem( this, plotItem );
+                m_data->layout->addItem( layoutItem );
                 layoutItems += layoutItem;
             }
 
-            d_data->map.insert( plotItem, layoutItems );
+            m_data->map.insert( plotItem, layoutItems );
         }
     }
@@ -713,5 +751,5 @@
     if ( changed )
     {
-        d_data->layout->invalidate();
+        m_data->layout->invalidate();
         itemChanged();
     }
@@ -721,30 +759,30 @@
 void QwtPlotLegendItem::clearLegend()
 {
-    if ( !d_data->map.isEmpty() )
-    {
-        d_data->map.clear();
-
-        for ( int i = d_data->layout->count() - 1; i >= 0; i-- )
-            delete d_data->layout->takeAt( i );
-
-        itemChanged();
-    }
-}
-
-/*!
-  Draw an entry on the legend
-
-  \param painter Qt Painter
-  \param plotItem Plot item, represented by the entry
-  \param data Attributes of the legend entry
-  \param rect Bounding rectangle for the entry
- */
-void QwtPlotLegendItem::drawLegendData( QPainter *painter,
-    const QwtPlotItem *plotItem, const QwtLegendData &data,
-    const QRectF &rect ) const
+    if ( !m_data->map.isEmpty() )
+    {
+        m_data->map.clear();
+
+        for ( int i = m_data->layout->count() - 1; i >= 0; i-- )
+            delete m_data->layout->takeAt( i );
+
+        itemChanged();
+    }
+}
+
+/*!
+   Draw an entry on the legend
+
+   \param painter Qt Painter
+   \param plotItem Plot item, represented by the entry
+   \param data Attributes of the legend entry
+   \param rect Bounding rectangle for the entry
+ */
+void QwtPlotLegendItem::drawLegendData( QPainter* painter,
+    const QwtPlotItem* plotItem, const QwtLegendData& data,
+    const QRectF& rect ) const
 {
     Q_UNUSED( plotItem );
 
-    const int m = d_data->itemMargin;
+    const int m = m_data->itemMargin;
     const QRectF r = rect.toRect().adjusted( m, m, -m, -m );
 
@@ -763,5 +801,5 @@
         graphic.render( painter, iconRect, Qt::KeepAspectRatio );
 
-        titleOff += iconRect.width() + d_data->itemSpacing;
+        titleOff += iconRect.width() + m_data->itemSpacing;
     }
 
@@ -778,12 +816,12 @@
 
 /*!
-  Minimum size hint needed to display an entry
-
-  \param data Attributes of the legend entry
-  \return Minimum size
- */
-QSize QwtPlotLegendItem::minimumSize( const QwtLegendData &data ) const
-{
-    QSize size( 2 * d_data->itemMargin, 2 * d_data->itemMargin );
+   Minimum size hint needed to display an entry
+
+   \param data Attributes of the legend entry
+   \return Minimum size
+ */
+QSize QwtPlotLegendItem::minimumSize( const QwtLegendData& data ) const
+{
+    QSize size( 2 * m_data->itemMargin, 2 * m_data->itemMargin );
 
     if ( !data.isValid() )
@@ -806,10 +844,10 @@
         const QSizeF sz = text.textSize( font() );
 
-        w += qCeil( sz.width() );
-        h = qMax( h, qCeil( sz.height() ) );
+        w += qwtCeil( sz.width() );
+        h = qMax( h, qwtCeil( sz.height() ) );
     }
 
     if ( graphic.width() > 0 && !text.isEmpty() )
-        w += d_data->itemSpacing;
+        w += m_data->itemSpacing;
 
     size += QSize( w, h );
@@ -818,12 +856,12 @@
 
 /*!
-  \return The preferred height, for a width.
-  \param data Attributes of the legend entry
-  \param width Width
-*/
+   \return The preferred height, for a width.
+   \param data Attributes of the legend entry
+   \param width Width
+ */
 int QwtPlotLegendItem::heightForWidth(
-    const QwtLegendData &data, int width ) const
-{
-    width -= 2 * d_data->itemMargin;
+    const QwtLegendData& data, int width ) const
+{
+    width -= 2 * m_data->itemMargin;
 
     const QwtGraphic graphic = data.icon();
@@ -834,8 +872,8 @@
 
     if ( graphic.width() > 0 )
-        width -= graphic.width() + d_data->itemSpacing;
+        width -= graphic.width() + m_data->itemSpacing;
 
     int h = text.heightForWidth( width, font() );
-    h += 2 * d_data->itemMargin;
+    h += 2 * m_data->itemMargin;
 
     return qMax( graphic.height(), h );
@@ -843,27 +881,29 @@
 
 /*!
-  \return All plot items with an entry on the legend
-  \note A plot item might have more than one entry on the legend
- */
-QList< const QwtPlotItem * > QwtPlotLegendItem::plotItems() const
-{
-    return d_data->map.keys();
-}
-
-/*!
-  \return Geometries of the items of a plot item
-  \note Usually a plot item has only one entry on the legend
-*/
+   \return All plot items with an entry on the legend
+   \note A plot item might have more than one entry on the legend
+ */
+QList< const QwtPlotItem* > QwtPlotLegendItem::plotItems() const
+{
+    return m_data->map.keys();
+}
+
+/*!
+   \return Geometries of the items of a plot item
+   \note Usually a plot item has only one entry on the legend
+ */
 QList< QRect > QwtPlotLegendItem::legendGeometries(
-    const QwtPlotItem *plotItem ) const
-{
-    QList<QwtLegendLayoutItem *> layoutItems;
-
-    QMap<const QwtPlotItem *, QList<QwtLegendLayoutItem *> >::iterator it =
-        d_data->map.find( plotItem );
-    if ( it != d_data->map.end() )
+    const QwtPlotItem* plotItem ) const
+{
+    QList< LayoutItem* > layoutItems;
+
+    QMap< const QwtPlotItem*, QList< LayoutItem* > >::const_iterator it =
+        m_data->map.constFind( plotItem );
+    if ( it != m_data->map.constEnd() )
         layoutItems = it.value();
 
-    QList<QRect> geometries;
+    QList< QRect > geometries;
+    geometries.reserve(layoutItems.size() );
+
     for ( int i = 0; i < layoutItems.size(); i++ )
         geometries += layoutItems[i]->geometry();
Index: /trunk/BNC/qwt/qwt_plot_legenditem.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_legenditem.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_legenditem.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,41 +13,40 @@
 #include "qwt_global.h"
 #include "qwt_plot_item.h"
-#include "qwt_legend_data.h"
 
 class QFont;
 
 /*!
-  \brief A class which draws a legend inside the plot canvas
+   \brief A class which draws a legend inside the plot canvas
 
-  QwtPlotLegendItem can be used to draw a inside the plot canvas.
-  It can be used together with a QwtLegend or instead of it
-  to have more space for the plot canvas.
+   QwtPlotLegendItem can be used to draw a inside the plot canvas.
+   It can be used together with a QwtLegend or instead of it
+   to have more space for the plot canvas.
 
-  In opposite to QwtLegend the legend item is not interactive.
-  To identify mouse clicks on a legend item an event filter
-  needs to be installed catching mouse events ob the plot canvas.
-  The geometries of the legend items are available using
-  legendGeometries().
+   In opposite to QwtLegend the legend item is not interactive.
+   To identify mouse clicks on a legend item an event filter
+   needs to be installed catching mouse events ob the plot canvas.
+   The geometries of the legend items are available using
+   legendGeometries().
 
-  The legend item is aligned to plot canvas according to
-  its alignment() flags. It might have a background for the
-  complete legend ( usually semi transparent ) or for
-  each legend item.
+   The legend item is aligned to plot canvas according to
+   its alignment() flags. It might have a background for the
+   complete legend ( usually semi transparent ) or for
+   each legend item.
 
-  \note An external QwtLegend with a transparent background
+   \note An external QwtLegend with a transparent background
         on top the plot canvas might be another option
         with a similar effect.
-*/
+ */
 
-class QWT_EXPORT QwtPlotLegendItem: public QwtPlotItem
+class QWT_EXPORT QwtPlotLegendItem : public QwtPlotItem
 {
-public:
+  public:
     /*!
-      \brief Background mode
+       \brief Background mode
 
-      Depending on the mode the complete legend or each item
-      might have an background.
+       Depending on the mode the complete legend or each item
+       might have an background.
 
-      The default setting is LegendBackground.
+       The default setting is LegendBackground.
 
        \sa setBackgroundMode(), setBackgroundBrush(), drawBackground()
@@ -65,8 +64,11 @@
     virtual ~QwtPlotLegendItem();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
-    void setAlignment( Qt::Alignment );
-    Qt::Alignment alignment() const;
+    void setAlignmentInCanvas( Qt::Alignment );
+    Qt::Alignment alignmentInCanvas() const;
+
+    void setOffsetInCanvas( Qt::Orientations, int numPixels );
+    int offsetInCanvas( Qt::Orientation ) const;
 
     void setMaxColumns( uint );
@@ -88,14 +90,11 @@
     QFont font() const;
 
-    void setBorderDistance( int );
-    int borderDistance() const;
-
     void setBorderRadius( double );
     double borderRadius() const;
 
-    void setBorderPen( const QPen & );
+    void setBorderPen( const QPen& );
     QPen borderPen() const;
 
-    void setBackgroundBrush( const QBrush & );
+    void setBackgroundBrush( const QBrush& );
     QBrush backgroundBrush() const;
 
@@ -103,33 +102,33 @@
     BackgroundMode backgroundMode() const;
 
-    void setTextPen( const QPen & );
+    void setTextPen( const QPen& );
     QPen textPen() const;
 
-    virtual void draw( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect ) const;
+    virtual void draw( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
 
     void clearLegend();
 
-    virtual void updateLegend( const QwtPlotItem *,
-        const QList<QwtLegendData> & );
+    virtual void updateLegend( const QwtPlotItem*,
+        const QList< QwtLegendData >& ) QWT_OVERRIDE;
 
-    virtual QRect geometry( const QRectF &canvasRect ) const;
+    virtual QRect geometry( const QRectF& canvasRect ) const;
 
-    virtual QSize minimumSize( const QwtLegendData & ) const;
-    virtual int heightForWidth( const QwtLegendData &, int width ) const;
+    virtual QSize minimumSize( const QwtLegendData& ) const;
+    virtual int heightForWidth( const QwtLegendData&, int width ) const;
 
-    QList< const QwtPlotItem * > plotItems() const;
-    QList< QRect > legendGeometries( const QwtPlotItem * ) const;
+    QList< const QwtPlotItem* > plotItems() const;
+    QList< QRect > legendGeometries( const QwtPlotItem* ) const;
 
-protected:
-    virtual void drawLegendData( QPainter *painter,
-        const QwtPlotItem *, const QwtLegendData &, const QRectF & ) const;
+  protected:
+    virtual void drawLegendData( QPainter*,
+        const QwtPlotItem*, const QwtLegendData&, const QRectF& ) const;
 
-    virtual void drawBackground( QPainter *, const QRectF &rect ) const;
+    virtual void drawBackground( QPainter*, const QRectF& rect ) const;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_magnifier.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_magnifier.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_magnifier.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,18 +9,17 @@
 
 #include "qwt_plot.h"
-#include "qwt_scale_div.h"
+#include "qwt_scale_map.h"
 #include "qwt_plot_magnifier.h"
-#include <qevent.h>
 
 class QwtPlotMagnifier::PrivateData
 {
-public:
+  public:
     PrivateData()
     {
-        for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
+        for ( int axis = 0; axis < QwtAxis::AxisPositions; axis++ )
             isAxisEnabled[axis] = true;
     }
 
-    bool isAxisEnabled[QwtPlot::axisCnt];
+    bool isAxisEnabled[QwtAxis::AxisPositions];
 };
 
@@ -28,9 +27,9 @@
    Constructor
    \param canvas Plot canvas to be magnified
-*/
-QwtPlotMagnifier::QwtPlotMagnifier( QWidget *canvas ):
-    QwtMagnifier( canvas )
+ */
+QwtPlotMagnifier::QwtPlotMagnifier( QWidget* canvas )
+    : QwtMagnifier( canvas )
 {
-    d_data = new PrivateData();
+    m_data = new PrivateData();
 }
 
@@ -38,5 +37,5 @@
 QwtPlotMagnifier::~QwtPlotMagnifier()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -47,13 +46,13 @@
    All other axes will remain unchanged.
 
-   \param axis Axis, see QwtPlot::Axis
+   \param axisId Axis
    \param on On/Off
 
    \sa isAxisEnabled()
-*/
-void QwtPlotMagnifier::setAxisEnabled( int axis, bool on )
+ */
+void QwtPlotMagnifier::setAxisEnabled( QwtAxisId axisId, bool on )
 {
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        d_data->isAxisEnabled[axis] = on;
+    if ( QwtAxis::isValid( axisId ) )
+        m_data->isAxisEnabled[axisId] = on;
 }
 
@@ -61,13 +60,13 @@
    Test if an axis is enabled
 
-   \param axis Axis, see QwtPlot::Axis
+   \param axisId Axis
    \return True, if the axis is enabled
 
    \sa setAxisEnabled()
-*/
-bool QwtPlotMagnifier::isAxisEnabled( int axis ) const
+ */
+bool QwtPlotMagnifier::isAxisEnabled( QwtAxisId axisId ) const
 {
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        return d_data->isAxisEnabled[axis];
+    if ( QwtAxis::isValid( axisId ) )
+        return m_data->isAxisEnabled[axisId];
 
     return true;
@@ -75,5 +74,5 @@
 
 //! Return observed plot canvas
-QWidget *QwtPlotMagnifier::canvas()
+QWidget* QwtPlotMagnifier::canvas()
 {
     return parentWidget();
@@ -81,5 +80,5 @@
 
 //! Return Observed plot canvas
-const QWidget *QwtPlotMagnifier::canvas() const
+const QWidget* QwtPlotMagnifier::canvas() const
 {
     return parentWidget();
@@ -87,21 +86,21 @@
 
 //! Return plot widget, containing the observed plot canvas
-QwtPlot *QwtPlotMagnifier::plot()
+QwtPlot* QwtPlotMagnifier::plot()
 {
-    QWidget *w = canvas();
+    QWidget* w = canvas();
     if ( w )
         w = w->parentWidget();
 
-    return qobject_cast<QwtPlot *>( w );
+    return qobject_cast< QwtPlot* >( w );
 }
 
 //! Return plot widget, containing the observed plot canvas
-const QwtPlot *QwtPlotMagnifier::plot() const
+const QwtPlot* QwtPlotMagnifier::plot() const
 {
-    const QWidget *w = canvas();
+    const QWidget* w = canvas();
     if ( w )
         w = w->parentWidget();
 
-    return qobject_cast<const QwtPlot *>( w );
+    return qobject_cast< const QwtPlot* >( w );
 }
 
@@ -109,5 +108,5 @@
    Zoom in/out the axes scales
    \param factor A value < 1.0 zooms in, a value > 1.0 zooms out.
-*/
+ */
 void QwtPlotMagnifier::rescale( double factor )
 {
@@ -125,35 +124,39 @@
     plt->setAutoReplot( false );
 
-    for ( int axisId = 0; axisId < QwtPlot::axisCnt; axisId++ )
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
     {
-        if ( isAxisEnabled( axisId ) )
         {
-            const QwtScaleMap scaleMap = plt->canvasMap( axisId );
+            const QwtAxisId axisId( axisPos );
 
-            double v1 = scaleMap.s1();
-            double v2 = scaleMap.s2();
+            if ( isAxisEnabled( axisId ) )
+            {
+                const QwtScaleMap scaleMap = plt->canvasMap( axisId );
 
-            if ( scaleMap.transformation() )
-            {
-                // the coordinate system of the paint device is always linear
+                double v1 = scaleMap.s1();
+                double v2 = scaleMap.s2();
 
-                v1 = scaleMap.transform( v1 ); // scaleMap.p1()
-                v2 = scaleMap.transform( v2 ); // scaleMap.p2()
+                if ( scaleMap.transformation() )
+                {
+                    // the coordinate system of the paint device is always linear
+
+                    v1 = scaleMap.transform( v1 ); // scaleMap.p1()
+                    v2 = scaleMap.transform( v2 ); // scaleMap.p2()
+                }
+
+                const double center = 0.5 * ( v1 + v2 );
+                const double width_2 = 0.5 * ( v2 - v1 ) * factor;
+
+                v1 = center - width_2;
+                v2 = center + width_2;
+
+                if ( scaleMap.transformation() )
+                {
+                    v1 = scaleMap.invTransform( v1 );
+                    v2 = scaleMap.invTransform( v2 );
+                }
+
+                plt->setAxisScale( axisId, v1, v2 );
+                doReplot = true;
             }
-
-            const double center = 0.5 * ( v1 + v2 );
-            const double width_2 = 0.5 * ( v2 - v1 ) * factor;
-
-            v1 = center - width_2;
-            v2 = center + width_2;
-
-            if ( scaleMap.transformation() )
-            {
-                v1 = scaleMap.invTransform( v1 );
-                v2 = scaleMap.invTransform( v2 );
-            }
-
-            plt->setAxisScale( axisId, v1, v2 );
-            doReplot = true;
         }
     }
@@ -164,2 +167,4 @@
         plt->replot();
 }
+
+#include "moc_qwt_plot_magnifier.cpp"
Index: /trunk/BNC/qwt/qwt_plot_magnifier.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_magnifier.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_magnifier.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,7 +9,8 @@
 
 #ifndef QWT_PLOT_MAGNIFIER_H
-#define QWT_PLOT_MAGNIFIER_H 1
+#define QWT_PLOT_MAGNIFIER_H
 
 #include "qwt_global.h"
+#include "qwt_axis_id.h"
 #include "qwt_magnifier.h"
 
@@ -17,37 +18,37 @@
 
 /*!
-  \brief QwtPlotMagnifier provides zooming, by magnifying in steps.
+   \brief QwtPlotMagnifier provides zooming, by magnifying in steps.
 
-  Using QwtPlotMagnifier a plot can be zoomed in/out in steps using
-  keys, the mouse wheel or moving a mouse button in vertical direction.
+   Using QwtPlotMagnifier a plot can be zoomed in/out in steps using
+   keys, the mouse wheel or moving a mouse button in vertical direction.
 
-  Together with QwtPlotZoomer and QwtPlotPanner it is possible to implement
-  individual and powerful navigation of the plot canvas.
+   Together with QwtPlotZoomer and QwtPlotPanner it is possible to implement
+   individual and powerful navigation of the plot canvas.
 
-  \sa QwtPlotZoomer, QwtPlotPanner, QwtPlot
-*/
-class QWT_EXPORT QwtPlotMagnifier: public QwtMagnifier
+   \sa QwtPlotZoomer, QwtPlotPanner, QwtPlot
+ */
+class QWT_EXPORT QwtPlotMagnifier : public QwtMagnifier
 {
     Q_OBJECT
 
-public:
-    explicit QwtPlotMagnifier( QWidget * );
+  public:
+    explicit QwtPlotMagnifier( QWidget* );
     virtual ~QwtPlotMagnifier();
 
-    void setAxisEnabled( int axis, bool on );
-    bool isAxisEnabled( int axis ) const;
+    void setAxisEnabled( QwtAxisId, bool on );
+    bool isAxisEnabled( QwtAxisId ) const;
 
-    QWidget *canvas();
-    const QWidget *canvas() const;
+    QWidget* canvas();
+    const QWidget* canvas() const;
 
-    QwtPlot *plot();
-    const QwtPlot *plot() const;
+    QwtPlot* plot();
+    const QwtPlot* plot() const;
 
-protected:
-    virtual void rescale( double factor );
+  public Q_SLOTS:
+    virtual void rescale( double factor ) QWT_OVERRIDE;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_marker.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_marker.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_marker.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,18 +13,20 @@
 #include "qwt_symbol.h"
 #include "qwt_text.h"
+#include "qwt_graphic.h"
 #include "qwt_math.h"
+
 #include <qpainter.h>
 
 class QwtPlotMarker::PrivateData
 {
-public:
-    PrivateData():
-        labelAlignment( Qt::AlignCenter ),
-        labelOrientation( Qt::Horizontal ),
-        spacing( 2 ),
-        symbol( NULL ),
-        style( QwtPlotMarker::NoLine ),
-        xValue( 0.0 ),
-        yValue( 0.0 )
+  public:
+    PrivateData()
+        : labelAlignment( Qt::AlignCenter )
+        , labelOrientation( Qt::Horizontal )
+        , spacing( 2 )
+        , symbol( NULL )
+        , style( QwtPlotMarker::NoLine )
+        , xValue( 0.0 )
+        , yValue( 0.0 )
     {
     }
@@ -41,5 +43,5 @@
 
     QPen pen;
-    const QwtSymbol *symbol;
+    const QwtSymbol* symbol;
     LineStyle style;
 
@@ -49,16 +51,23 @@
 
 //! Sets alignment to Qt::AlignCenter, and style to QwtPlotMarker::NoLine
-QwtPlotMarker::QwtPlotMarker( const QString &title ):
-    QwtPlotItem( QwtText( title ) )
-{
-    d_data = new PrivateData;
+QwtPlotMarker::QwtPlotMarker()
+{
+    m_data = new PrivateData;
     setZ( 30.0 );
 }
 
 //! Sets alignment to Qt::AlignCenter, and style to QwtPlotMarker::NoLine
-QwtPlotMarker::QwtPlotMarker( const QwtText &title ):
-    QwtPlotItem( title )
-{
-    d_data = new PrivateData;
+QwtPlotMarker::QwtPlotMarker( const QString& title )
+    : QwtPlotItem( QwtText( title ) )
+{
+    m_data = new PrivateData;
+    setZ( 30.0 );
+}
+
+//! Sets alignment to Qt::AlignCenter, and style to QwtPlotMarker::NoLine
+QwtPlotMarker::QwtPlotMarker( const QwtText& title )
+    : QwtPlotItem( title )
+{
+    m_data = new PrivateData;
     setZ( 30.0 );
 }
@@ -67,5 +76,5 @@
 QwtPlotMarker::~QwtPlotMarker()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -79,5 +88,5 @@
 QPointF QwtPlotMarker::value() const
 {
-    return QPointF( d_data->xValue, d_data->yValue );
+    return QPointF( m_data->xValue, m_data->yValue );
 }
 
@@ -85,5 +94,5 @@
 double QwtPlotMarker::xValue() const
 {
-    return d_data->xValue;
+    return m_data->xValue;
 }
 
@@ -91,5 +100,5 @@
 double QwtPlotMarker::yValue() const
 {
-    return d_data->yValue;
+    return m_data->yValue;
 }
 
@@ -103,8 +112,8 @@
 void QwtPlotMarker::setValue( double x, double y )
 {
-    if ( x != d_data->xValue || y != d_data->yValue )
-    {
-        d_data->xValue = x;
-        d_data->yValue = y;
+    if ( x != m_data->xValue || y != m_data->yValue )
+    {
+        m_data->xValue = x;
+        m_data->yValue = y;
         itemChanged();
     }
@@ -114,5 +123,5 @@
 void QwtPlotMarker::setXValue( double x )
 {
-    setValue( x, d_data->yValue );
+    setValue( x, m_data->yValue );
 }
 
@@ -120,62 +129,47 @@
 void QwtPlotMarker::setYValue( double y )
 {
-    setValue( d_data->xValue, y );
-}
-
-/*!
-  Draw the marker
-
-  \param painter Painter
-  \param xMap x Scale Map
-  \param yMap y Scale Map
-  \param canvasRect Contents rectangle of the canvas in painter coordinates
-*/
-void QwtPlotMarker::draw( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
-{
-    const QPointF pos( xMap.transform( d_data->xValue ),
-        yMap.transform( d_data->yValue ) );
-
-    // draw lines
+    setValue( m_data->xValue, y );
+}
+
+/*!
+   Draw the marker
+
+   \param painter Painter
+   \param xMap x Scale Map
+   \param yMap y Scale Map
+   \param canvasRect Contents rectangle of the canvas in painter coordinates
+ */
+void QwtPlotMarker::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
+{
+    const QPointF pos( xMap.transform( m_data->xValue ),
+        yMap.transform( m_data->yValue ) );
 
     drawLines( painter, canvasRect, pos );
-
-    // draw symbol
-    if ( d_data->symbol &&
-        ( d_data->symbol->style() != QwtSymbol::NoSymbol ) )
-    {
-        const QSizeF sz = d_data->symbol->size();
-
-        const QRectF clipRect = canvasRect.adjusted(
-            -sz.width(), -sz.height(), sz.width(), sz.height() );
-
-        if ( clipRect.contains( pos ) )
-            d_data->symbol->drawSymbol( painter, pos );
-    }
-
+    drawSymbol( painter, canvasRect, pos );
     drawLabel( painter, canvasRect, pos );
 }
 
 /*!
-  Draw the lines marker
-
-  \param painter Painter
-  \param canvasRect Contents rectangle of the canvas in painter coordinates
-  \param pos Position of the marker, translated into widget coordinates
-
-  \sa drawLabel(), QwtSymbol::drawSymbol()
-*/
-void QwtPlotMarker::drawLines( QPainter *painter,
-    const QRectF &canvasRect, const QPointF &pos ) const
-{
-    if ( d_data->style == NoLine )
+   Draw the lines marker
+
+   \param painter Painter
+   \param canvasRect Contents rectangle of the canvas in painter coordinates
+   \param pos Position of the marker, translated into widget coordinates
+
+   \sa drawLabel(), drawSymbol()
+ */
+void QwtPlotMarker::drawLines( QPainter* painter,
+    const QRectF& canvasRect, const QPointF& pos ) const
+{
+    if ( m_data->style == NoLine )
         return;
 
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
-    painter->setPen( d_data->pen );
-    if ( d_data->style == QwtPlotMarker::HLine ||
-        d_data->style == QwtPlotMarker::Cross )
+    painter->setPen( m_data->pen );
+    if ( m_data->style == QwtPlotMarker::HLine ||
+        m_data->style == QwtPlotMarker::Cross )
     {
         double y = pos.y();
@@ -186,6 +180,6 @@
             y, canvasRect.right() - 1.0, y );
     }
-    if ( d_data->style == QwtPlotMarker::VLine ||
-        d_data->style == QwtPlotMarker::Cross )
+    if ( m_data->style == QwtPlotMarker::VLine ||
+        m_data->style == QwtPlotMarker::Cross )
     {
         double x = pos.x();
@@ -199,24 +193,53 @@
 
 /*!
-  Align and draw the text label of the marker
-
-  \param painter Painter
-  \param canvasRect Contents rectangle of the canvas in painter coordinates
-  \param pos Position of the marker, translated into widget coordinates
-
-  \sa drawLabel(), QwtSymbol::drawSymbol()
-*/
-void QwtPlotMarker::drawLabel( QPainter *painter,
-    const QRectF &canvasRect, const QPointF &pos ) const
-{
-    if ( d_data->label.isEmpty() )
+   Draw the symbol of the marker
+
+   \param painter Painter
+   \param canvasRect Contents rectangle of the canvas in painter coordinates
+   \param pos Position of the marker, translated into widget coordinates
+
+   \sa drawLabel(), QwtSymbol::drawSymbol()
+ */
+void QwtPlotMarker::drawSymbol( QPainter* painter,
+    const QRectF& canvasRect, const QPointF& pos ) const
+{
+    if ( m_data->symbol == NULL )
         return;
 
-    Qt::Alignment align = d_data->labelAlignment;
+    const QwtSymbol& symbol = *m_data->symbol;
+
+    if ( symbol.style() != QwtSymbol::NoSymbol )
+    {
+        const QSizeF sz = symbol.size();
+
+        const QRectF clipRect = canvasRect.adjusted(
+            -sz.width(), -sz.height(), sz.width(), sz.height() );
+
+        if ( clipRect.contains( pos ) )
+            symbol.drawSymbol( painter, pos );
+    }
+}
+
+/*!
+   Align and draw the text label of the marker
+
+   \param painter Painter
+   \param canvasRect Contents rectangle of the canvas in painter coordinates
+   \param pos Position of the marker, translated into widget coordinates
+
+   \sa drawLabel(), drawSymbol()
+ */
+void QwtPlotMarker::drawLabel( QPainter* painter,
+    const QRectF& canvasRect, const QPointF& pos ) const
+{
+    if ( m_data->label.isEmpty() )
+        return;
+
+    Qt::Alignment align = m_data->labelAlignment;
     QPointF alignPos = pos;
 
     QSizeF symbolOff( 0, 0 );
 
-    switch ( d_data->style )
+    switch ( m_data->style )
     {
         case QwtPlotMarker::VLine:
@@ -225,5 +248,5 @@
             // the alignment flags are relative to the canvas
 
-            if ( d_data->labelAlignment & Qt::AlignTop )
+            if ( m_data->labelAlignment & Qt::AlignTop )
             {
                 alignPos.setY( canvasRect.top() );
@@ -231,5 +254,5 @@
                 align |= Qt::AlignBottom;
             }
-            else if ( d_data->labelAlignment & Qt::AlignBottom )
+            else if ( m_data->labelAlignment & Qt::AlignBottom )
             {
                 // In HLine-style the x-position is pointless and
@@ -248,5 +271,5 @@
         case QwtPlotMarker::HLine:
         {
-            if ( d_data->labelAlignment & Qt::AlignLeft )
+            if ( m_data->labelAlignment & Qt::AlignLeft )
             {
                 alignPos.setX( canvasRect.left() );
@@ -254,5 +277,5 @@
                 align |= Qt::AlignRight;
             }
-            else if ( d_data->labelAlignment & Qt::AlignRight )
+            else if ( m_data->labelAlignment & Qt::AlignRight )
             {
                 alignPos.setX( canvasRect.right() - 1 );
@@ -268,8 +291,8 @@
         default:
         {
-            if ( d_data->symbol &&
-                ( d_data->symbol->style() != QwtSymbol::NoSymbol ) )
+            if ( m_data->symbol &&
+                ( m_data->symbol->style() != QwtSymbol::NoSymbol ) )
             {
-                symbolOff = d_data->symbol->size() + QSizeF( 1, 1 );
+                symbolOff = m_data->symbol->size() + QSizeF( 1, 1 );
                 symbolOff /= 2;
             }
@@ -277,19 +300,19 @@
     }
 
-    qreal pw2 = d_data->pen.widthF() / 2.0;
+    qreal pw2 = m_data->pen.widthF() / 2.0;
     if ( pw2 == 0.0 )
         pw2 = 0.5;
 
-    const int spacing = d_data->spacing;
-
-    const qreal xOff = qMax( pw2, symbolOff.width() );
-    const qreal yOff = qMax( pw2, symbolOff.height() );
-
-    const QSizeF textSize = d_data->label.textSize( painter->font() );
+    const int spacing = m_data->spacing;
+
+    const qreal xOff = qwtMaxF( pw2, symbolOff.width() );
+    const qreal yOff = qwtMaxF( pw2, symbolOff.height() );
+
+    const QSizeF textSize = m_data->label.textSize( painter->font() );
 
     if ( align & Qt::AlignLeft )
     {
         alignPos.rx() -= xOff + spacing;
-        if ( d_data->labelOrientation == Qt::Vertical )
+        if ( m_data->labelOrientation == Qt::Vertical )
             alignPos.rx() -= textSize.height();
         else
@@ -302,5 +325,5 @@
     else
     {
-        if ( d_data->labelOrientation == Qt::Vertical )
+        if ( m_data->labelOrientation == Qt::Vertical )
             alignPos.rx() -= textSize.height() / 2;
         else
@@ -311,5 +334,5 @@
     {
         alignPos.ry() -= yOff + spacing;
-        if ( d_data->labelOrientation != Qt::Vertical )
+        if ( m_data->labelOrientation != Qt::Vertical )
             alignPos.ry() -= textSize.height();
     }
@@ -317,10 +340,10 @@
     {
         alignPos.ry() += yOff + spacing;
-        if ( d_data->labelOrientation == Qt::Vertical )
+        if ( m_data->labelOrientation == Qt::Vertical )
             alignPos.ry() += textSize.width();
     }
     else
     {
-        if ( d_data->labelOrientation == Qt::Vertical )
+        if ( m_data->labelOrientation == Qt::Vertical )
             alignPos.ry() += textSize.width() / 2;
         else
@@ -329,21 +352,21 @@
 
     painter->translate( alignPos.x(), alignPos.y() );
-    if ( d_data->labelOrientation == Qt::Vertical )
+    if ( m_data->labelOrientation == Qt::Vertical )
         painter->rotate( -90.0 );
 
     const QRectF textRect( 0, 0, textSize.width(), textSize.height() );
-    d_data->label.draw( painter, textRect );
-}
-
-/*!
-  \brief Set the line style
-  \param style Line style.
-  \sa lineStyle()
-*/
+    m_data->label.draw( painter, textRect );
+}
+
+/*!
+   \brief Set the line style
+   \param style Line style.
+   \sa lineStyle()
+ */
 void QwtPlotMarker::setLineStyle( LineStyle style )
 {
-    if ( style != d_data->style )
-    {
-        d_data->style = style;
+    if ( style != m_data->style )
+    {
+        m_data->style = style;
 
         legendChanged();
@@ -353,23 +376,23 @@
 
 /*!
-  \return the line style
-  \sa setLineStyle()
-*/
+   \return the line style
+   \sa setLineStyle()
+ */
 QwtPlotMarker::LineStyle QwtPlotMarker::lineStyle() const
 {
-    return d_data->style;
-}
-
-/*!
-  \brief Assign a symbol
-  \param symbol New symbol
-  \sa symbol()
-*/
-void QwtPlotMarker::setSymbol( const QwtSymbol *symbol )
-{
-    if ( symbol != d_data->symbol )
-    {
-        delete d_data->symbol;
-        d_data->symbol = symbol;
+    return m_data->style;
+}
+
+/*!
+   \brief Assign a symbol
+   \param symbol New symbol
+   \sa symbol()
+ */
+void QwtPlotMarker::setSymbol( const QwtSymbol* symbol )
+{
+    if ( symbol != m_data->symbol )
+    {
+        delete m_data->symbol;
+        m_data->symbol = symbol;
 
         if ( symbol )
@@ -382,22 +405,22 @@
 
 /*!
-  \return the symbol
-  \sa setSymbol(), QwtSymbol
-*/
-const QwtSymbol *QwtPlotMarker::symbol() const
-{
-    return d_data->symbol;
-}
-
-/*!
-  \brief Set the label
-  \param label Label text
-  \sa label()
-*/
+   \return the symbol
+   \sa setSymbol(), QwtSymbol
+ */
+const QwtSymbol* QwtPlotMarker::symbol() const
+{
+    return m_data->symbol;
+}
+
+/*!
+   \brief Set the label
+   \param label Label text
+   \sa label()
+ */
 void QwtPlotMarker::setLabel( const QwtText& label )
 {
-    if ( label != d_data->label )
-    {
-        d_data->label = label;
+    if ( label != m_data->label )
+    {
+        m_data->label = label;
         itemChanged();
     }
@@ -405,31 +428,31 @@
 
 /*!
-  \return the label
-  \sa setLabel()
-*/
+   \return the label
+   \sa setLabel()
+ */
 QwtText QwtPlotMarker::label() const
 {
-    return d_data->label;
-}
-
-/*!
-  \brief Set the alignment of the label
-
-  In case of QwtPlotMarker::HLine the alignment is relative to the
-  y position of the marker, but the horizontal flags correspond to the
-  canvas rectangle. In case of QwtPlotMarker::VLine the alignment is
-  relative to the x position of the marker, but the vertical flags
-  correspond to the canvas rectangle.
-
-  In all other styles the alignment is relative to the marker's position.
-
-  \param align Alignment.
-  \sa labelAlignment(), labelOrientation()
-*/
+    return m_data->label;
+}
+
+/*!
+   \brief Set the alignment of the label
+
+   In case of QwtPlotMarker::HLine the alignment is relative to the
+   y position of the marker, but the horizontal flags correspond to the
+   canvas rectangle. In case of QwtPlotMarker::VLine the alignment is
+   relative to the x position of the marker, but the vertical flags
+   correspond to the canvas rectangle.
+
+   In all other styles the alignment is relative to the marker's position.
+
+   \param align Alignment.
+   \sa labelAlignment(), labelOrientation()
+ */
 void QwtPlotMarker::setLabelAlignment( Qt::Alignment align )
 {
-    if ( align != d_data->labelAlignment )
-    {
-        d_data->labelAlignment = align;
+    if ( align != m_data->labelAlignment )
+    {
+        m_data->labelAlignment = align;
         itemChanged();
     }
@@ -437,27 +460,27 @@
 
 /*!
-  \return the label alignment
-  \sa setLabelAlignment(), setLabelOrientation()
-*/
+   \return the label alignment
+   \sa setLabelAlignment(), setLabelOrientation()
+ */
 Qt::Alignment QwtPlotMarker::labelAlignment() const
 {
-    return d_data->labelAlignment;
-}
-
-/*!
-  \brief Set the orientation of the label
-
-  When orientation is Qt::Vertical the label is rotated by 90.0 degrees
-  ( from bottom to top ).
-
-  \param orientation Orientation of the label
-
-  \sa labelOrientation(), setLabelAlignment()
-*/
+    return m_data->labelAlignment;
+}
+
+/*!
+   \brief Set the orientation of the label
+
+   When orientation is Qt::Vertical the label is rotated by 90.0 degrees
+   ( from bottom to top ).
+
+   \param orientation Orientation of the label
+
+   \sa labelOrientation(), setLabelAlignment()
+ */
 void QwtPlotMarker::setLabelOrientation( Qt::Orientation orientation )
 {
-    if ( orientation != d_data->labelOrientation )
-    {
-        d_data->labelOrientation = orientation;
+    if ( orientation != m_data->labelOrientation )
+    {
+        m_data->labelOrientation = orientation;
         itemChanged();
     }
@@ -465,21 +488,21 @@
 
 /*!
-  \return the label orientation
-  \sa setLabelOrientation(), labelAlignment()
-*/
+   \return the label orientation
+   \sa setLabelOrientation(), labelAlignment()
+ */
 Qt::Orientation QwtPlotMarker::labelOrientation() const
 {
-    return d_data->labelOrientation;
-}
-
-/*!
-  \brief Set the spacing
-
-  When the label is not centered on the marker position, the spacing
-  is the distance between the position and the label.
-
-  \param spacing Spacing
-  \sa spacing(), setLabelAlignment()
-*/
+    return m_data->labelOrientation;
+}
+
+/*!
+   \brief Set the spacing
+
+   When the label is not centered on the marker position, the spacing
+   is the distance between the position and the label.
+
+   \param spacing Spacing
+   \sa spacing(), setLabelAlignment()
+ */
 void QwtPlotMarker::setSpacing( int spacing )
 {
@@ -487,34 +510,34 @@
         spacing = 0;
 
-    if ( spacing == d_data->spacing )
+    if ( spacing == m_data->spacing )
         return;
 
-    d_data->spacing = spacing;
+    m_data->spacing = spacing;
     itemChanged();
 }
 
 /*!
-  \return the spacing
-  \sa setSpacing()
-*/
+   \return the spacing
+   \sa setSpacing()
+ */
 int QwtPlotMarker::spacing() const
 {
-    return d_data->spacing;
-}
-
-/*!
-  Build and assign a line pen
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtPlotMarker::setLinePen( const QColor &color, qreal width, Qt::PenStyle style )
+    return m_data->spacing;
+}
+
+/*!
+   Build and assign a line pen
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtPlotMarker::setLinePen( const QColor& color, qreal width, Qt::PenStyle style )
 {
     setLinePen( QPen( color, width, style ) );
@@ -522,14 +545,14 @@
 
 /*!
-  Specify a pen for the line.
-
-  \param pen New pen
-  \sa linePen()
-*/
-void QwtPlotMarker::setLinePen( const QPen &pen )
-{
-    if ( pen != d_data->pen )
-    {
-        d_data->pen = pen;
+   Specify a pen for the line.
+
+   \param pen New pen
+   \sa linePen()
+ */
+void QwtPlotMarker::setLinePen( const QPen& pen )
+{
+    if ( pen != m_data->pen )
+    {
+        m_data->pen = pen;
 
         legendChanged();
@@ -539,10 +562,10 @@
 
 /*!
-  \return the line pen
-  \sa setLinePen()
-*/
-const QPen &QwtPlotMarker::linePen() const
-{
-    return d_data->pen;
+   \return the line pen
+   \sa setLinePen()
+ */
+const QPen& QwtPlotMarker::linePen() const
+{
+    return m_data->pen;
 }
 
@@ -551,14 +574,14 @@
     // width/height of -1 does not affect the autoscale calculation
 
-    switch (d_data->style)
+    switch (m_data->style)
     {
         case QwtPlotMarker::HLine:
-            return QRectF( d_data->xValue, d_data->yValue, -1.0, 0.0 );
+            return QRectF( m_data->xValue, m_data->yValue, -1.0, 0.0 );
 
         case QwtPlotMarker::VLine:
-            return QRectF( d_data->xValue, d_data->yValue, 0.0, -1.0 );
-
-        default :
-            return QRectF( d_data->xValue, d_data->yValue, 0.0, 0.0 );
+            return QRectF( m_data->xValue, m_data->yValue, 0.0, -1.0 );
+
+        default:
+            return QRectF( m_data->xValue, m_data->yValue, 0.0, 0.0 );
     }
 }
@@ -572,7 +595,6 @@
 
    \sa setLegendIconSize(), legendData()
-*/
-QwtGraphic QwtPlotMarker::legendIcon( int index,
-    const QSizeF &size ) const
+ */
+QwtGraphic QwtPlotMarker::legendIcon( int index, const QSizeF& size ) const
 {
     Q_UNUSED( index );
@@ -589,10 +611,10 @@
         testRenderHint( QwtPlotItem::RenderAntialiased ) );
 
-    if ( d_data->style != QwtPlotMarker::NoLine )
-    {
-        painter.setPen( d_data->pen );
-
-        if ( d_data->style == QwtPlotMarker::HLine ||
-            d_data->style == QwtPlotMarker::Cross )
+    if ( m_data->style != QwtPlotMarker::NoLine )
+    {
+        painter.setPen( m_data->pen );
+
+        if ( m_data->style == QwtPlotMarker::HLine ||
+            m_data->style == QwtPlotMarker::Cross )
         {
             const double y = 0.5 * size.height();
@@ -602,6 +624,6 @@
         }
 
-        if ( d_data->style == QwtPlotMarker::VLine ||
-            d_data->style == QwtPlotMarker::Cross )
+        if ( m_data->style == QwtPlotMarker::VLine ||
+            m_data->style == QwtPlotMarker::Cross )
         {
             const double x = 0.5 * size.width();
@@ -612,8 +634,8 @@
     }
 
-    if ( d_data->symbol )
+    if ( m_data->symbol )
     {
         const QRect r( 0.0, 0.0, size.width(), size.height() );
-        d_data->symbol->drawSymbol( &painter, r );
+        m_data->symbol->drawSymbol( &painter, r );
     }
 
Index: /trunk/BNC/qwt/qwt_plot_marker.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_marker.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_marker.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,11 +11,8 @@
 #define QWT_PLOT_MARKER_H
 
-#include <qpen.h>
-#include <qfont.h>
-#include <qstring.h>
-#include <qbrush.h>
 #include "qwt_global.h"
 #include "qwt_plot_item.h"
 
+class QString;
 class QRectF;
 class QwtText;
@@ -23,35 +20,35 @@
 
 /*!
-  \brief A class for drawing markers
+   \brief A class for drawing markers
 
-  A marker can be a horizontal line, a vertical line,
-  a symbol, a label or any combination of them, which can
-  be drawn around a center point inside a bounding rectangle.
+   A marker can be a horizontal line, a vertical line,
+   a symbol, a label or any combination of them, which can
+   be drawn around a center point inside a bounding rectangle.
 
-  The setSymbol() member assigns a symbol to the marker.
-  The symbol is drawn at the specified point.
+   The setSymbol() member assigns a symbol to the marker.
+   The symbol is drawn at the specified point.
 
-  With setLabel(), a label can be assigned to the marker.
-  The setLabelAlignment() member specifies where the label is
-  drawn. All the Align*-constants in Qt::AlignmentFlags (see Qt documentation)
-  are valid. The interpretation of the alignment depends on the marker's
-  line style. The alignment refers to the center point of
-  the marker, which means, for example, that the label would be printed
-  left above the center point if the alignment was set to
-  Qt::AlignLeft | Qt::AlignTop.
+   With setLabel(), a label can be assigned to the marker.
+   The setLabelAlignment() member specifies where the label is
+   drawn. All the Align*-constants in Qt::AlignmentFlags (see Qt documentation)
+   are valid. The interpretation of the alignment depends on the marker's
+   line style. The alignment refers to the center point of
+   the marker, which means, for example, that the label would be printed
+   left above the center point if the alignment was set to
+   Qt::AlignLeft | Qt::AlignTop.
 
-  \note QwtPlotTextLabel is intended to align a text label
+   \note QwtPlotTextLabel is intended to align a text label
         according to the geometry of canvas
         ( unrelated to plot coordinates )
-*/
+ */
 
-class QWT_EXPORT QwtPlotMarker: public QwtPlotItem
+class QWT_EXPORT QwtPlotMarker : public QwtPlotItem
 {
-public:
+  public:
 
     /*!
         Line styles.
         \sa setLineStyle(), lineStyle()
-    */
+     */
     enum LineStyle
     {
@@ -69,10 +66,11 @@
     };
 
-    explicit QwtPlotMarker( const QString &title = QString() );
-    explicit QwtPlotMarker( const QwtText &title );
+    explicit QwtPlotMarker();
+    explicit QwtPlotMarker( const QString& title );
+    explicit QwtPlotMarker( const QwtText& title );
 
     virtual ~QwtPlotMarker();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
     double xValue() const;
@@ -83,15 +81,15 @@
     void setYValue( double );
     void setValue( double, double );
-    void setValue( const QPointF & );
+    void setValue( const QPointF& );
 
     void setLineStyle( LineStyle );
     LineStyle lineStyle() const;
 
-    void setLinePen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setLinePen( const QPen & );
-    const QPen &linePen() const;
+    void setLinePen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
+    void setLinePen( const QPen& );
+    const QPen& linePen() const;
 
-    void setSymbol( const QwtSymbol * );
-    const QwtSymbol *symbol() const;
+    void setSymbol( const QwtSymbol* );
+    const QwtSymbol* symbol() const;
 
     void setLabel( const QwtText& );
@@ -107,23 +105,27 @@
     int spacing() const;
 
-    virtual void draw( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF & ) const;
+    virtual void draw( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& ) const QWT_OVERRIDE;
 
-    virtual QRectF boundingRect() const;
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
 
-    virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
+    virtual QwtGraphic legendIcon(
+        int index, const QSizeF& ) const QWT_OVERRIDE;
 
-protected:
-    virtual void drawLines( QPainter *,
-        const QRectF &, const QPointF & ) const;
+  protected:
+    virtual void drawLines( QPainter*,
+        const QRectF&, const QPointF& ) const;
 
-    virtual void drawLabel( QPainter *,
-        const QRectF &, const QPointF & ) const;
+    virtual void drawSymbol( QPainter*,
+        const QRectF&, const QPointF& ) const;
 
-private:
+    virtual void drawLabel( QPainter*,
+        const QRectF&, const QPointF& ) const;
+
+  private:
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_multi_barchart.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_multi_barchart.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_multi_barchart.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,11 +11,13 @@
 #include "qwt_scale_map.h"
 #include "qwt_column_symbol.h"
-#include "qwt_painter.h"
-#include <qpainter.h>
-#include <qpalette.h>
+#include "qwt_text.h"
+#include "qwt_graphic.h"
+#include "qwt_legend_data.h"
+#include "qwt_math.h"
+
 #include <qmap.h>
 
 inline static bool qwtIsIncreasing(
-    const QwtScaleMap &map, const QVector<double> &values )
+    const QwtScaleMap& map, const QVector< double >& values )
 {
     bool isInverting = map.isInverting();
@@ -33,21 +35,21 @@
 class QwtPlotMultiBarChart::PrivateData
 {
-public:
-    PrivateData():
-        style( QwtPlotMultiBarChart::Grouped )
+  public:
+    PrivateData()
+        : style( QwtPlotMultiBarChart::Grouped )
     {
     }
 
     QwtPlotMultiBarChart::ChartStyle style;
-    QList<QwtText> barTitles;
-    QMap<int, QwtColumnSymbol *> symbolMap;
+    QList< QwtText > barTitles;
+    QMap< int, QwtColumnSymbol* > symbolMap;
 };
 
 /*!
-  Constructor
-  \param title Title of the chart
-*/
-QwtPlotMultiBarChart::QwtPlotMultiBarChart( const QwtText &title ):
-    QwtPlotAbstractBarChart( title )
+   Constructor
+   \param title Title of the chart
+ */
+QwtPlotMultiBarChart::QwtPlotMultiBarChart( const QwtText& title )
+    : QwtPlotAbstractBarChart( title )
 {
     init();
@@ -55,9 +57,9 @@
 
 /*!
-  Constructor
-  \param title Title of the chart
-*/
-QwtPlotMultiBarChart::QwtPlotMultiBarChart( const QString &title ):
-    QwtPlotAbstractBarChart( QwtText( title ) )
+   Constructor
+   \param title Title of the chart
+ */
+QwtPlotMultiBarChart::QwtPlotMultiBarChart( const QString& title )
+    : QwtPlotAbstractBarChart( QwtText( title ) )
 {
     init();
@@ -68,10 +70,10 @@
 {
     resetSymbolMap();
-    delete d_data;
+    delete m_data;
 }
 
 void QwtPlotMultiBarChart::init()
 {
-    d_data = new PrivateData;
+    m_data = new PrivateData;
     setData( new QwtSetSeriesData() );
 }
@@ -84,9 +86,9 @@
 
 /*!
-  Initialize data with an array of samples.
-  \param samples Vector of points
-*/
+   Initialize data with an array of samples.
+   \param samples Vector of points
+ */
 void QwtPlotMultiBarChart::setSamples(
-    const QVector<QwtSetSample> &samples )
+    const QVector< QwtSetSample >& samples )
 {
     setData( new QwtSetSeriesData( samples ) );
@@ -94,11 +96,13 @@
 
 /*!
-  Initialize data with an array of samples.
-  \param samples Vector of points
-*/
+   Initialize data with an array of samples.
+   \param samples Vector of points
+ */
 void QwtPlotMultiBarChart::setSamples(
-    const QVector< QVector<double> > &samples )
-{
-    QVector<QwtSetSample> s;
+    const QVector< QVector< double > >& samples )
+{
+    QVector< QwtSetSample > s;
+    s.reserve( samples.size() );
+
     for ( int i = 0; i < samples.size(); i++ )
         s += QwtSetSample( i, samples[ i ] );
@@ -108,15 +112,15 @@
 
 /*!
-  Assign a series of samples
-
-  setSamples() is just a wrapper for setData() without any additional
-  value - beside that it is easier to find for the developer.
-
-  \param data Data
-  \warning The item takes ownership of the data object, deleting
+   Assign a series of samples
+
+   setSamples() is just a wrapper for setData() without any additional
+   value - beside that it is easier to find for the developer.
+
+   \param data Data
+   \warning The item takes ownership of the data object, deleting
            it when its not used anymore.
-*/
+ */
 void QwtPlotMultiBarChart::setSamples(
-    QwtSeriesData<QwtSetSample> *data )
+    QwtSeriesData< QwtSetSample >* data )
 {
     setData( data );
@@ -124,50 +128,50 @@
 
 /*!
-  \brief Set the titles for the bars
-
-  The titles are used for the legend.
-
-  \param titles Bar titles
-
-  \sa barTitles(), legendData()
- */
-void QwtPlotMultiBarChart::setBarTitles( const QList<QwtText> &titles )
-{
-    d_data->barTitles = titles;
+   \brief Set the titles for the bars
+
+   The titles are used for the legend.
+
+   \param titles Bar titles
+
+   \sa barTitles(), legendData()
+ */
+void QwtPlotMultiBarChart::setBarTitles( const QList< QwtText >& titles )
+{
+    m_data->barTitles = titles;
     itemChanged();
 }
 
 /*!
-  \return Bar titles
-  \sa setBarTitles(), legendData()
- */
-QList<QwtText> QwtPlotMultiBarChart::barTitles() const
-{
-    return d_data->barTitles;
-}
-
-/*!
-  \brief Add a symbol to the symbol map
-
-  Assign a default symbol for drawing the bar representing all values
-  with the same index in a set.
-
-  \param valueIndex Index of a value in a set
-  \param symbol Symbol used for drawing a bar
-
-  \sa symbol(), resetSymbolMap(), specialSymbol()
-*/
-void QwtPlotMultiBarChart::setSymbol( int valueIndex, QwtColumnSymbol *symbol )
+   \return Bar titles
+   \sa setBarTitles(), legendData()
+ */
+QList< QwtText > QwtPlotMultiBarChart::barTitles() const
+{
+    return m_data->barTitles;
+}
+
+/*!
+   \brief Add a symbol to the symbol map
+
+   Assign a default symbol for drawing the bar representing all values
+   with the same index in a set.
+
+   \param valueIndex Index of a value in a set
+   \param symbol Symbol used for drawing a bar
+
+   \sa symbol(), resetSymbolMap(), specialSymbol()
+ */
+void QwtPlotMultiBarChart::setSymbol( int valueIndex, QwtColumnSymbol* symbol )
 {
     if ( valueIndex < 0 )
         return;
 
-    QMap<int, QwtColumnSymbol *>::iterator it =
-        d_data->symbolMap.find(valueIndex);
-    if ( it == d_data->symbolMap.end() )
+    QMap< int, QwtColumnSymbol* >::iterator it =
+        m_data->symbolMap.find(valueIndex);
+    if ( it == m_data->symbolMap.end() )
     {
         if ( symbol != NULL )
         {
-            d_data->symbolMap.insert( valueIndex, symbol );
+            m_data->symbolMap.insert( valueIndex, symbol );
 
             legendChanged();
@@ -183,5 +187,5 @@
             if ( symbol == NULL )
             {
-                d_data->symbolMap.remove( valueIndex );
+                m_data->symbolMap.remove( valueIndex );
             }
             else
@@ -197,65 +201,65 @@
 
 /*!
-  Find a symbol in the symbol map
-
-  \param valueIndex Index of a value in a set
-  \return The symbol, that had been set by setSymbol() or NULL.
-
-  \sa setSymbol(), specialSymbol(), drawBar()
-*/
-const QwtColumnSymbol *QwtPlotMultiBarChart::symbol( int valueIndex ) const
-{
-    QMap<int, QwtColumnSymbol *>::const_iterator it =
-        d_data->symbolMap.constFind( valueIndex );
-
-    return ( it == d_data->symbolMap.constEnd() ) ? NULL : it.value();
-}
-
-/*!
-  Find a symbol in the symbol map
-
-  \param valueIndex Index of a value in a set
-  \return The symbol, that had been set by setSymbol() or NULL.
-
-  \sa setSymbol(), specialSymbol(), drawBar()
-*/
-QwtColumnSymbol *QwtPlotMultiBarChart::symbol( int valueIndex )
-{
-    QMap<int, QwtColumnSymbol *>::const_iterator it =
-        d_data->symbolMap.constFind( valueIndex );
-
-    return ( it == d_data->symbolMap.constEnd() ) ? NULL : it.value();
-}
-
-/*!
-  Remove all symbols from the symbol map
+   Find a symbol in the symbol map
+
+   \param valueIndex Index of a value in a set
+   \return The symbol, that had been set by setSymbol() or NULL.
+
+   \sa setSymbol(), specialSymbol(), drawBar()
+ */
+const QwtColumnSymbol* QwtPlotMultiBarChart::symbol( int valueIndex ) const
+{
+    QMap< int, QwtColumnSymbol* >::const_iterator it =
+        m_data->symbolMap.constFind( valueIndex );
+
+    return ( it == m_data->symbolMap.constEnd() ) ? NULL : it.value();
+}
+
+/*!
+   Find a symbol in the symbol map
+
+   \param valueIndex Index of a value in a set
+   \return The symbol, that had been set by setSymbol() or NULL.
+
+   \sa setSymbol(), specialSymbol(), drawBar()
+ */
+QwtColumnSymbol* QwtPlotMultiBarChart::symbol( int valueIndex )
+{
+    QMap< int, QwtColumnSymbol* >::const_iterator it =
+        m_data->symbolMap.constFind( valueIndex );
+
+    return ( it == m_data->symbolMap.constEnd() ) ? NULL : it.value();
+}
+
+/*!
+   Remove all symbols from the symbol map
  */
 void QwtPlotMultiBarChart::resetSymbolMap()
 {
-    qDeleteAll( d_data->symbolMap );
-    d_data->symbolMap.clear();
-}
-
-/*!
-  \brief Create a symbol for special values
-
-  Usually the symbols for displaying a bar are set by setSymbols() and
-  common for all sets. By overloading specialSymbol() it is possible to
-  create a temporary symbol() for displaying a special value.
-
-  The symbol has to be created by new each time specialSymbol() is
-  called. As soon as the symbol is painted this symbol gets deleted.
-
-  When no symbol ( NULL ) is returned, the value will be displayed
-  with the standard symbol that is used for all symbols with the same
-  valueIndex.
-
-  \param sampleIndex Index of the sample
-  \param valueIndex Index of the value in the set
-
-  \return NULL, meaning that the value is not special
-
- */
-QwtColumnSymbol *QwtPlotMultiBarChart::specialSymbol(
+    qDeleteAll( m_data->symbolMap );
+    m_data->symbolMap.clear();
+}
+
+/*!
+   \brief Create a symbol for special values
+
+   Usually the symbols for displaying a bar are set by setSymbols() and
+   common for all sets. By overloading specialSymbol() it is possible to
+   create a temporary symbol() for displaying a special value.
+
+   The symbol has to be created by new each time specialSymbol() is
+   called. As soon as the symbol is painted this symbol gets deleted.
+
+   When no symbol ( NULL ) is returned, the value will be displayed
+   with the standard symbol that is used for all symbols with the same
+   valueIndex.
+
+   \param sampleIndex Index of the sample
+   \param valueIndex Index of the value in the set
+
+   \return NULL, meaning that the value is not special
+
+ */
+QwtColumnSymbol* QwtPlotMultiBarChart::specialSymbol(
     int sampleIndex, int valueIndex ) const
 {
@@ -267,14 +271,14 @@
 
 /*!
-  Set the style of the chart
-
-  \param style Chart style
-  \sa style()
+   Set the style of the chart
+
+   \param style Chart style
+   \sa style()
  */
 void QwtPlotMultiBarChart::setStyle( ChartStyle style )
 {
-    if ( style != d_data->style )
-    {
-        d_data->style = style;
+    if ( style != m_data->style )
+    {
+        m_data->style = style;
 
         legendChanged();
@@ -284,16 +288,16 @@
 
 /*!
-  \return Style of the chart
-  \sa setStyle()
+   \return Style of the chart
+   \sa setStyle()
  */
 QwtPlotMultiBarChart::ChartStyle QwtPlotMultiBarChart::style() const
 {
-    return d_data->style;
-}
-
-/*!
-  \return Bounding rectangle of all samples.
-  For an empty series the rectangle is invalid.
-*/
+    return m_data->style;
+}
+
+/*!
+   \return Bounding rectangle of all samples.
+   For an empty series the rectangle is invalid.
+ */
 QRectF QwtPlotMultiBarChart::boundingRect() const
 {
@@ -307,5 +311,5 @@
     QRectF rect;
 
-    if ( d_data->style != QwtPlotMultiBarChart::Stacked )
+    if ( m_data->style != QwtPlotMultiBarChart::Stacked )
     {
         rect = QwtPlotSeriesItem::boundingRect();
@@ -326,5 +330,5 @@
         yMin = yMax = baseLine;
 
-        const QwtSeriesData<QwtSetSample> *series = data();
+        const QwtSeriesData< QwtSetSample >* series = data();
 
         for ( size_t i = 0; i < numSamples; i++ )
@@ -337,12 +341,12 @@
             else
             {
-                xMin = qMin( xMin, sample.value );
-                xMax = qMax( xMax, sample.value );
+                xMin = qwtMinF( xMin, sample.value );
+                xMax = qwtMaxF( xMax, sample.value );
             }
 
             const double y = baseLine + sample.added();
 
-            yMin = qMin( yMin, y );
-            yMax = qMax( yMax, y );
+            yMin = qwtMinF( yMin, y );
+            yMax = qwtMaxF( yMax, y );
         }
         rect.setRect( xMin, yMin, xMax - xMin, yMax - yMin );
@@ -356,19 +360,19 @@
 
 /*!
-  Draw an interval of the bar chart
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted. If to < 0 the
+   Draw an interval of the bar chart
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted. If to < 0 the
          curve will be painted to its last point.
 
-  \sa drawSymbols()
-*/
-void QwtPlotMultiBarChart::drawSeries( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   \sa drawSymbols()
+ */
+void QwtPlotMultiBarChart::drawSeries( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     if ( to < 0 )
@@ -397,19 +401,19 @@
 
 /*!
-  Draw a sample
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param boundingInterval Bounding interval of sample values
-  \param index Index of the sample to be painted
-  \param sample Sample value
-
-  \sa drawSeries()
-*/
-void QwtPlotMultiBarChart::drawSample( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, const QwtInterval &boundingInterval,
+   Draw a sample
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param boundingInterval Bounding interval of sample values
+   \param index Index of the sample to be painted
+   \param sample Sample value
+
+   \sa drawSeries()
+ */
+void QwtPlotMultiBarChart::drawSample( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, const QwtInterval& boundingInterval,
     int index, const QwtSetSample& sample ) const
 {
@@ -430,5 +434,5 @@
     }
 
-    if ( d_data->style == Stacked )
+    if ( m_data->style == Stacked )
     {
         drawStackedBars( painter, xMap, yMap,
@@ -443,19 +447,19 @@
 
 /*!
-  Draw a grouped sample
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param index Index of the sample to be painted
-  \param sampleWidth Boundng width for all bars of the smaple
-  \param sample Sample
-
-  \sa drawSeries(), sampleWidth()
-*/
-void QwtPlotMultiBarChart::drawGroupedBars( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int index, double sampleWidth,
+   Draw a grouped sample
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param index Index of the sample to be painted
+   \param sampleWidth Bounding width for all bars of the sample
+   \param sample Sample
+
+   \sa drawSeries(), sampleWidth()
+ */
+void QwtPlotMultiBarChart::drawGroupedBars( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int index, double sampleWidth,
     const QwtSetSample& sample ) const
 {
@@ -523,19 +527,19 @@
 
 /*!
-  Draw a stacked sample
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param index Index of the sample to be painted
-  \param sampleWidth Width of the bars
-  \param sample Sample
-
-  \sa drawSeries(), sampleWidth()
-*/
-void QwtPlotMultiBarChart::drawStackedBars( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int index,
+   Draw a stacked sample
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param index Index of the sample to be painted
+   \param sampleWidth Width of the bars
+   \param sample Sample
+
+   \sa drawSeries(), sampleWidth()
+ */
+void QwtPlotMultiBarChart::drawStackedBars( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int index,
     double sampleWidth, const QwtSetSample& sample ) const
 {
@@ -636,22 +640,22 @@
 
 /*!
-  Draw a bar
-
-  \param painter Painter
-  \param sampleIndex Index of the sample - might be -1 when the
+   Draw a bar
+
+   \param painter Painter
+   \param sampleIndex Index of the sample - might be -1 when the
                      bar is painted for the legend
-  \param valueIndex Index of a value in a set
-  \param rect Directed target rectangle for the bar
-
-  \sa drawSeries()
-*/
-void QwtPlotMultiBarChart::drawBar( QPainter *painter,
-    int sampleIndex, int valueIndex, const QwtColumnRect &rect ) const
-{
-    const QwtColumnSymbol *specialSym = NULL;
+   \param valueIndex Index of a value in a set
+   \param rect Directed target rectangle for the bar
+
+   \sa drawSeries()
+ */
+void QwtPlotMultiBarChart::drawBar( QPainter* painter,
+    int sampleIndex, int valueIndex, const QwtColumnRect& rect ) const
+{
+    const QwtColumnSymbol* specialSym = NULL;
     if ( sampleIndex >= 0 )
         specialSym = specialSymbol( sampleIndex, valueIndex );
 
-    const QwtColumnSymbol *sym = specialSym;
+    const QwtColumnSymbol* sym = specialSym;
     if ( sym == NULL )
         sym = symbol( valueIndex );
@@ -674,30 +678,27 @@
 
 /*!
-  \return Information to be displayed on the legend
-
-  The chart is represented by a list of entries - one for each bar title.
-  Each element contains a bar title and an icon showing its corresponding bar.
-
-  \sa barTitles(), legendIcon(), legendIconSize()
-*/
-QList<QwtLegendData> QwtPlotMultiBarChart::legendData() const
-{
-    QList<QwtLegendData> list;
-
-    for ( int i = 0; i < d_data->barTitles.size(); i++ )
+   \return Information to be displayed on the legend
+
+   The chart is represented by a list of entries - one for each bar title.
+   Each element contains a bar title and an icon showing its corresponding bar.
+
+   \sa barTitles(), legendIcon(), legendIconSize()
+ */
+QList< QwtLegendData > QwtPlotMultiBarChart::legendData() const
+{
+    QList< QwtLegendData > list;
+    list.reserve( m_data->barTitles.size() );
+
+    for ( int i = 0; i < m_data->barTitles.size(); i++ )
     {
         QwtLegendData data;
 
-        QVariant titleValue;
-        qVariantSetValue( titleValue, d_data->barTitles[i] );
-        data.setValue( QwtLegendData::TitleRole, titleValue );
+        data.setValue( QwtLegendData::TitleRole,
+            QVariant::fromValue( m_data->barTitles[i] ) );
 
         if ( !legendIconSize().isEmpty() )
         {
-            QVariant iconValue;
-            qVariantSetValue( iconValue,
-                legendIcon( i, legendIconSize() ) );
-
-            data.setValue( QwtLegendData::IconRole, iconValue );
+            data.setValue( QwtLegendData::IconRole,
+                QVariant::fromValue( legendIcon( i, legendIconSize() ) ) );
         }
 
@@ -709,14 +710,14 @@
 
 /*!
-  \return Icon for representing a bar on the legend
-
-  \param index Index of the bar
-  \param size Icon size
-
-  \return An icon showing a bar
-  \sa drawBar(), legendData()
+   \return Icon for representing a bar on the legend
+
+   \param index Index of the bar
+   \param size Icon size
+
+   \return An icon showing a bar
+   \sa drawBar(), legendData()
  */
 QwtGraphic QwtPlotMultiBarChart::legendIcon( int index,
-    const QSizeF &size ) const
+    const QSizeF& size ) const
 {
     QwtColumnRect column;
Index: /trunk/BNC/qwt/qwt_plot_multi_barchart.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_multi_barchart.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_multi_barchart.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,34 +13,35 @@
 #include "qwt_global.h"
 #include "qwt_plot_abstract_barchart.h"
-#include "qwt_series_data.h"
 
 class QwtColumnRect;
 class QwtColumnSymbol;
+template< typename T > class QwtSeriesData;
 
 /*!
-  \brief QwtPlotMultiBarChart displays a series of a samples that consist
+   \brief QwtPlotMultiBarChart displays a series of a samples that consist
          each of a set of values.
 
-  Each value is displayed as a bar, the bars of each set can be organized
-  side by side or accumulated.
+   Each value is displayed as a bar, the bars of each set can be organized
+   side by side or accumulated.
 
-  Each bar of a set is rendered by a QwtColumnSymbol, that is set by setSymbol().
-  The bars of different sets use the same symbols. Exceptions are possible
-  by overloading specialSymbol() or overloading drawBar().
+   Each bar of a set is rendered by a QwtColumnSymbol, that is set by setSymbol().
+   The bars of different sets use the same symbols. Exceptions are possible
+   by overloading specialSymbol() or overloading drawBar().
 
-  Depending on its orientation() the bars are displayed horizontally
-  or vertically. The bars cover the interval between the baseline()
-  and the value.
+   Depending on its orientation() the bars are displayed horizontally
+   or vertically. The bars cover the interval between the baseline()
+   and the value.
 
-  In opposite to most other plot items, QwtPlotMultiBarChart returns more
-  than one entry for the legend - one for each symbol.
+   In opposite to most other plot items, QwtPlotMultiBarChart returns more
+   than one entry for the legend - one for each symbol.
 
-  \sa QwtPlotBarChart, QwtPlotHistogram
+   \sa QwtPlotBarChart, QwtPlotHistogram
       QwtPlotSeriesItem::orientation(), QwtPlotAbstractBarChart::baseline()
  */
-class QWT_EXPORT QwtPlotMultiBarChart:
-    public QwtPlotAbstractBarChart, public QwtSeriesStore<QwtSetSample>
+class QWT_EXPORT QwtPlotMultiBarChart
+    : public QwtPlotAbstractBarChart
+    , public QwtSeriesStore< QwtSetSample >
 {
-public:
+  public:
     /*!
         \brief Chart styles.
@@ -48,5 +49,5 @@
         The default setting is QwtPlotMultiBarChart::Grouped.
         \sa setStyle(), style()
-    */
+     */
     enum ChartStyle
     {
@@ -62,65 +63,66 @@
     };
 
-    explicit QwtPlotMultiBarChart( const QString &title = QString() );
-    explicit QwtPlotMultiBarChart( const QwtText &title );
+    explicit QwtPlotMultiBarChart( const QString& title = QString() );
+    explicit QwtPlotMultiBarChart( const QwtText& title );
 
     virtual ~QwtPlotMultiBarChart();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
-    void setBarTitles( const QList<QwtText> & );
-    QList<QwtText> barTitles() const;
+    void setBarTitles( const QList< QwtText >& );
+    QList< QwtText > barTitles() const;
 
-    void setSamples( const QVector<QwtSetSample> & );
-    void setSamples( const QVector< QVector<double> > & );
-    void setSamples( QwtSeriesData<QwtSetSample> * );
+    void setSamples( const QVector< QwtSetSample >& );
+    void setSamples( const QVector< QVector< double > >& );
+    void setSamples( QwtSeriesData< QwtSetSample >* );
 
     void setStyle( ChartStyle style );
     ChartStyle style() const;
 
-    void setSymbol( int valueIndex, QwtColumnSymbol * );
-    const QwtColumnSymbol *symbol( int valueIndex ) const;
+    void setSymbol( int valueIndex, QwtColumnSymbol* );
+    const QwtColumnSymbol* symbol( int valueIndex ) const;
 
     void resetSymbolMap();
 
-    virtual void drawSeries( QPainter *painter,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
+    virtual void drawSeries( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
 
-    virtual QRectF boundingRect() const;
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
 
-    virtual QList<QwtLegendData> legendData() const;
+    virtual QList< QwtLegendData > legendData() const QWT_OVERRIDE;
 
-    virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
+    virtual QwtGraphic legendIcon(
+        int index, const QSizeF& ) const QWT_OVERRIDE;
 
-protected:
-    QwtColumnSymbol *symbol( int valueIndex );
+  protected:
+    QwtColumnSymbol* symbol( int valueIndex );
 
-    virtual QwtColumnSymbol *specialSymbol(
+    virtual QwtColumnSymbol* specialSymbol(
         int sampleIndex, int valueIndex ) const;
 
-    virtual void drawSample( QPainter *painter,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, const QwtInterval &boundingInterval,
-        int index, const QwtSetSample& sample ) const;
+    virtual void drawSample( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, const QwtInterval& boundingInterval,
+        int index, const QwtSetSample& ) const;
 
-    virtual void drawBar( QPainter *, int sampleIndex,
-        int valueIndex, const QwtColumnRect & ) const;
+    virtual void drawBar( QPainter*, int sampleIndex,
+        int valueIndex, const QwtColumnRect& ) const;
 
-    void drawStackedBars( QPainter *painter,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int index,
-        double sampleWidth, const QwtSetSample& sample ) const;
+    void drawStackedBars( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int index,
+        double sampleWidth, const QwtSetSample& ) const;
 
-    void drawGroupedBars( QPainter *painter,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int index,
-        double sampleWidth, const QwtSetSample& sample ) const;
+    void drawGroupedBars( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int index,
+        double sampleWidth, const QwtSetSample& ) const;
 
-private:
+  private:
     void init();
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_opengl_canvas.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_opengl_canvas.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_plot_opengl_canvas.cpp	(revision 11158)
@@ -0,0 +1,275 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_plot_opengl_canvas.h"
+#include "qwt_plot.h"
+#include "qwt_painter.h"
+
+#include <qpainter.h>
+#include <qpainterpath.h>
+#include <qcoreevent.h>
+#include <qopenglframebufferobject.h>
+#include <qopenglpaintdevice.h>
+
+class QwtPlotOpenGLCanvas::PrivateData
+{
+  public:
+    PrivateData()
+        : numFBOSamples( -1 )
+        , isPolished( false )
+        , fboDirty( true )
+        , fbo( NULL )
+    {
+    }
+
+    ~PrivateData()
+    {
+        delete fbo;
+    }
+
+    int numFBOSamples;
+
+    bool isPolished;
+    bool fboDirty;
+    QOpenGLFramebufferObject* fbo;
+};
+
+/*!
+   \brief Constructor
+
+   \param plot Parent plot widget
+   \sa QwtPlot::setCanvas()
+ */
+QwtPlotOpenGLCanvas::QwtPlotOpenGLCanvas( QwtPlot* plot )
+    : QOpenGLWidget( plot )
+    , QwtPlotAbstractGLCanvas( this )
+{
+    init();
+}
+
+/*!
+   \brief Constructor
+
+   \param numSamples Number of samples, see QSurfaceFormat::samples()
+   \param plot Parent plot widget
+   \sa QwtPlot::setCanvas()
+ */
+QwtPlotOpenGLCanvas::QwtPlotOpenGLCanvas( int numSamples, QwtPlot* plot )
+    : QOpenGLWidget( plot )
+    , QwtPlotAbstractGLCanvas( this )
+{
+    if ( numSamples < -1 )
+        numSamples = -1;
+
+    QSurfaceFormat fmt = format();
+    if ( numSamples != fmt.samples() )
+    {
+        fmt.setSamples( numSamples );
+        setFormat( fmt );
+    }
+
+    init();
+}
+
+void QwtPlotOpenGLCanvas::init()
+{
+    m_data = new PrivateData;
+
+#if 1
+    setAttribute( Qt::WA_OpaquePaintEvent, true );
+#endif
+
+    setLineWidth( 2 );
+    setFrameShadow( QFrame::Sunken );
+    setFrameShape( QFrame::Panel );
+}
+
+//! Destructor
+QwtPlotOpenGLCanvas::~QwtPlotOpenGLCanvas()
+{
+    delete m_data;
+}
+
+/*!
+   Paint event
+
+   \param event Paint event
+   \sa QwtPlot::drawCanvas()
+ */
+void QwtPlotOpenGLCanvas::paintEvent( QPaintEvent* event )
+{
+    if ( m_data->isPolished )
+        QOpenGLWidget::paintEvent( event );
+}
+
+/*!
+   Qt event handler for QEvent::PolishRequest and QEvent::StyleChange
+   \param event Qt Event
+   \return See QGLWidget::event()
+ */
+bool QwtPlotOpenGLCanvas::event( QEvent* event )
+{
+    if ( event->type() == QEvent::Resize )
+    {
+        if ( m_data->numFBOSamples < 0  )
+        {
+            /*
+                QOpenGLWidget always uses a FBO and sets the number of samples for
+                the FBO not for the widget itself. So format().samples() does not
+                return the correct value after the first QEvent::Resize.
+             */
+            m_data->numFBOSamples = qMax( format().samples(), 0 );
+        }
+    }
+
+    const bool ok = QOpenGLWidget::event( event );
+
+    if ( event->type() == QEvent::PolishRequest )
+    {
+        // In opposite to non OpenGL widgets receive pointless
+        // early repaints. As we always have a QEvent::PolishRequest
+        // followed by QEvent::Paint, we can ignore all these repaints.
+
+        m_data->isPolished = true;
+    }
+
+    if ( event->type() == QEvent::PolishRequest ||
+        event->type() == QEvent::StyleChange )
+    {
+        // assuming, that we always have a styled background
+        // when we have a style sheet
+
+        setAttribute( Qt::WA_StyledBackground,
+            testAttribute( Qt::WA_StyleSheet ) );
+    }
+
+    return ok;
+}
+
+/*!
+   Invalidate the paint cache and repaint the canvas
+   \sa invalidatePaintCache()
+ */
+void QwtPlotOpenGLCanvas::replot()
+{
+    QwtPlotAbstractGLCanvas::replot();
+}
+
+//! Invalidate the internal backing store
+void QwtPlotOpenGLCanvas::invalidateBackingStore()
+{
+    m_data->fboDirty = true;
+}
+
+void QwtPlotOpenGLCanvas::clearBackingStore()
+{
+    delete m_data->fbo;
+    m_data->fbo = NULL;
+}
+
+/*!
+   Calculate the painter path for a styled or rounded border
+
+   When the canvas has no styled background or rounded borders
+   the painter path is empty.
+
+   \param rect Bounding rectangle of the canvas
+   \return Painter path, that can be used for clipping
+ */
+QPainterPath QwtPlotOpenGLCanvas::borderPath( const QRect& rect ) const
+{
+    return canvasBorderPath( rect );
+}
+
+//! No operation - reserved for some potential use in the future
+void QwtPlotOpenGLCanvas::initializeGL()
+{
+}
+
+//! Paint the plot
+void QwtPlotOpenGLCanvas::paintGL()
+{
+    const bool hasFocusIndicator =
+        hasFocus() && focusIndicator() == CanvasFocusIndicator;
+
+    QPainter painter;
+
+    if ( testPaintAttribute( QwtPlotOpenGLCanvas::BackingStore ) &&
+        QOpenGLFramebufferObject::hasOpenGLFramebufferBlit() )
+    {
+        const qreal pixelRatio = QwtPainter::devicePixelRatio( this );
+        const QSize fboSize = size() * pixelRatio;
+
+        if ( hasFocusIndicator )
+            painter.begin( this );
+
+        /*
+           QOpenGLWidget has its own internal FBO, that is used to restore
+           its content without having to repaint. This works fine when f.e
+           a rubberband is moving on top, but there are still situations,
+           where we can repaint without an potentially expensive replot:
+
+               - when having the focus the top level window gets activated/deactivated
+               - ???
+         */
+
+        if ( m_data->fbo )
+        {
+            if ( m_data->fbo->size() != fboSize )
+            {
+                delete m_data->fbo;
+                m_data->fbo = NULL;
+            }
+        }
+
+        if ( m_data->fbo == NULL )
+        {
+            QOpenGLFramebufferObjectFormat fboFormat;
+            fboFormat.setAttachment( QOpenGLFramebufferObject::CombinedDepthStencil );
+
+            if ( m_data->numFBOSamples > 0 )
+                fboFormat.setSamples( m_data->numFBOSamples );
+
+            m_data->fbo = new QOpenGLFramebufferObject( fboSize, fboFormat );
+            m_data->fboDirty = true;
+        }
+
+        if ( m_data->fboDirty )
+        {
+            m_data->fbo->bind();
+
+            QOpenGLPaintDevice pd( fboSize );
+
+            QPainter fboPainter( &pd );
+            fboPainter.scale( pixelRatio, pixelRatio );
+            draw( &fboPainter);
+            fboPainter.end();
+
+            m_data->fboDirty = false;
+        }
+
+        QOpenGLFramebufferObject::blitFramebuffer( NULL, m_data->fbo );
+    }
+    else
+    {
+        painter.begin( this );
+        draw( &painter );
+    }
+
+    if ( hasFocusIndicator )
+        drawFocusIndicator( &painter );
+}
+
+//! No operation - reserved for some potential use in the future
+void QwtPlotOpenGLCanvas::resizeGL( int, int )
+{
+    // nothing to do
+}
+
+#include "moc_qwt_plot_opengl_canvas.cpp"
Index: /trunk/BNC/qwt/qwt_plot_opengl_canvas.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_opengl_canvas.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_plot_opengl_canvas.h	(revision 11158)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_PLOT_OPENGL_CANVAS_H
+#define QWT_PLOT_OPENGL_CANVAS_H
+
+#include "qwt_global.h"
+#include "qwt_plot_abstract_canvas.h"
+
+#include <qopenglwidget.h>
+
+class QwtPlot;
+
+/*!
+   \brief An alternative canvas for a QwtPlot derived from QOpenGLWidget
+
+   Even if QwtPlotOpenGLCanvas is not derived from QFrame it imitates
+   its API. When using style sheets it supports the box model - beside
+   backgrounds with rounded borders.
+
+   \sa QwtPlot::setCanvas(), QwtPlotCanvas, QwtPlotCanvas::OpenGLBuffer
+
+   \note Another way for getting hardware accelerated graphics is using
+        an OpenGL offscreen buffer ( QwtPlotCanvas::OpenGLBuffer ) with QwtPlotCanvas.
+        Performance is worse, than rendering straight to a QOpenGLWidget, but is usually
+        better integrated into a desktop application.
+ */
+class QWT_EXPORT QwtPlotOpenGLCanvas : public QOpenGLWidget, public QwtPlotAbstractGLCanvas
+{
+    Q_OBJECT
+
+    Q_PROPERTY( QFrame::Shadow frameShadow READ frameShadow WRITE setFrameShadow )
+    Q_PROPERTY( QFrame::Shape frameShape READ frameShape WRITE setFrameShape )
+    Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
+    Q_PROPERTY( int midLineWidth READ midLineWidth WRITE setMidLineWidth )
+    Q_PROPERTY( int frameWidth READ frameWidth )
+    Q_PROPERTY( QRect frameRect READ frameRect DESIGNABLE false )
+
+    Q_PROPERTY( double borderRadius READ borderRadius WRITE setBorderRadius )
+
+  public:
+    explicit QwtPlotOpenGLCanvas( QwtPlot* = NULL );
+    explicit QwtPlotOpenGLCanvas( int samples, QwtPlot* = NULL);
+    virtual ~QwtPlotOpenGLCanvas();
+
+    Q_INVOKABLE virtual void invalidateBackingStore() QWT_OVERRIDE;
+    Q_INVOKABLE QPainterPath borderPath( const QRect& ) const;
+
+    virtual bool event( QEvent* ) QWT_OVERRIDE;
+
+  public Q_SLOTS:
+    void replot();
+
+  protected:
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
+
+    virtual void initializeGL() QWT_OVERRIDE;
+    virtual void paintGL() QWT_OVERRIDE;
+    virtual void resizeGL( int width, int height ) QWT_OVERRIDE;
+
+  private:
+    void init();
+    virtual void clearBackingStore() QWT_OVERRIDE;
+
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_plot_panner.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_panner.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_panner.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,31 +11,18 @@
 #include "qwt_scale_div.h"
 #include "qwt_plot.h"
+#include "qwt_scale_map.h"
 #include "qwt_painter.h"
+
 #include <qbitmap.h>
 #include <qstyle.h>
 #include <qstyleoption.h>
+#include <qpainter.h>
 #include <qpainterpath.h>
 
+static QBitmap qwtBorderMask( const QWidget* canvas, const QSize& size )
+{
 #if QT_VERSION >= 0x050000
-#if QT_VERSION < 0x050100
-#define QWT_USE_WINDOW_HANDLE 1
+    const qreal pixelRatio = QwtPainter::devicePixelRatio( canvas );
 #endif
-#endif
-
-#ifdef QWT_USE_WINDOW_HANDLE
-#include <qwindow.h>
-#endif
-
-static QBitmap qwtBorderMask( const QWidget *canvas, const QSize &size )
-{
-#if QT_VERSION >= 0x050000
-    qreal pixelRatio = 1.0;
-
-#ifdef QWT_USE_WINDOW_HANDLE
-    pixelRatio = canvas->windowHandle()->devicePixelRatio();
-#else
-    pixelRatio = canvas->devicePixelRatio();
-#endif
-#endif
 
     const QRect r( 0, 0, size.width(), size.height() );
@@ -44,5 +31,5 @@
 
     ( void )QMetaObject::invokeMethod(
-        const_cast< QWidget *>( canvas ), "borderPath", Qt::DirectConnection,
+        const_cast< QWidget* >( canvas ), "borderPath", Qt::DirectConnection,
         Q_RETURN_ARG( QPainterPath, borderPath ), Q_ARG( QRect, r ) );
 
@@ -53,5 +40,5 @@
 
 #if QT_VERSION >= 0x050000
-        QBitmap mask( size * pixelRatio );
+        QBitmap mask( size* pixelRatio );
         mask.setDevicePixelRatio( pixelRatio );
 #else
@@ -67,5 +54,5 @@
 
 #if QT_VERSION >= 0x050000
-    QImage image( size * pixelRatio, QImage::Format_ARGB32_Premultiplied );
+    QImage image( size* pixelRatio, QImage::Format_ARGB32_Premultiplied );
     image.setDevicePixelRatio( pixelRatio );
 #else
@@ -94,9 +81,8 @@
         const QVariant frameWidth = canvas->property( "frameWidth" );
 
-        if ( borderRadius.type() == QVariant::Double
-            && frameWidth.type() == QVariant::Int )
+        if ( borderRadius.canConvert< double >() && frameWidth.canConvert< int >() )
         {
-            const double br = borderRadius.toDouble();
-            const int fw = frameWidth.toInt();
+            const double br = borderRadius.value< double >();
+            const int fw = frameWidth.value< int >();
 
             if ( br > 0.0 && fw > 0 )
@@ -121,27 +107,27 @@
 class QwtPlotPanner::PrivateData
 {
-public:
+  public:
     PrivateData()
     {
-        for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
+        for ( int axis = 0; axis < QwtAxis::AxisPositions; axis++ )
             isAxisEnabled[axis] = true;
     }
 
-    bool isAxisEnabled[QwtPlot::axisCnt];
+    bool isAxisEnabled[QwtAxis::AxisPositions];
 };
 
 /*!
-  \brief A panner for the canvas of a QwtPlot
-
-  The panner is enabled for all axes
-
-  \param canvas Plot canvas to pan, also the parent object
-
-  \sa setAxisEnabled()
-*/
-QwtPlotPanner::QwtPlotPanner( QWidget *canvas ):
-    QwtPanner( canvas )
-{
-    d_data = new PrivateData();
+   \brief A panner for the canvas of a QwtPlot
+
+   The panner is enabled for all axes
+
+   \param canvas Plot canvas to pan, also the parent object
+
+   \sa setAxisEnabled()
+ */
+QwtPlotPanner::QwtPlotPanner( QWidget* canvas )
+    : QwtPanner( canvas )
+{
+    m_data = new PrivateData();
 
     connect( this, SIGNAL(panned(int,int)),
@@ -152,5 +138,5 @@
 QwtPlotPanner::~QwtPlotPanner()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -161,13 +147,13 @@
    result of panning. All other axes will remain unchanged.
 
-   \param axis Axis, see QwtPlot::Axis
+   \param axisId Axis id
    \param on On/Off
 
    \sa isAxisEnabled(), moveCanvas()
-*/
-void QwtPlotPanner::setAxisEnabled( int axis, bool on )
-{
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        d_data->isAxisEnabled[axis] = on;
+ */
+void QwtPlotPanner::setAxisEnabled( QwtAxisId axisId, bool on )
+{
+    if ( QwtAxis::isValid( axisId ) )
+        m_data->isAxisEnabled[axisId] = on;
 }
 
@@ -175,13 +161,13 @@
    Test if an axis is enabled
 
-   \param axis Axis, see QwtPlot::Axis
+   \param axisId Axis
    \return True, if the axis is enabled
 
    \sa setAxisEnabled(), moveCanvas()
-*/
-bool QwtPlotPanner::isAxisEnabled( int axis ) const
-{
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        return d_data->isAxisEnabled[axis];
+ */
+bool QwtPlotPanner::isAxisEnabled( QwtAxisId axisId ) const
+{
+    if ( QwtAxis::isValid( axisId ) )
+        return m_data->isAxisEnabled[axisId];
 
     return true;
@@ -189,5 +175,5 @@
 
 //! Return observed plot canvas
-QWidget *QwtPlotPanner::canvas()
+QWidget* QwtPlotPanner::canvas()
 {
     return parentWidget();
@@ -195,5 +181,5 @@
 
 //! Return Observed plot canvas
-const QWidget *QwtPlotPanner::canvas() const
+const QWidget* QwtPlotPanner::canvas() const
 {
     return parentWidget();
@@ -201,21 +187,21 @@
 
 //! Return plot widget, containing the observed plot canvas
-QwtPlot *QwtPlotPanner::plot()
-{
-    QWidget *w = canvas();
+QwtPlot* QwtPlotPanner::plot()
+{
+    QWidget* w = canvas();
     if ( w )
         w = w->parentWidget();
 
-    return qobject_cast<QwtPlot *>( w );
+    return qobject_cast< QwtPlot* >( w );
 }
 
 //! Return plot widget, containing the observed plot canvas
-const QwtPlot *QwtPlotPanner::plot() const
-{
-    const QWidget *w = canvas();
+const QwtPlot* QwtPlotPanner::plot() const
+{
+    const QWidget* w = canvas();
     if ( w )
         w = w->parentWidget();
 
-    return qobject_cast<const QwtPlot *>( w );
+    return qobject_cast< const QwtPlot* >( w );
 }
 
@@ -227,5 +213,5 @@
 
    \sa QwtPanner::panned()
-*/
+ */
 void QwtPlotPanner::moveCanvas( int dx, int dy )
 {
@@ -233,5 +219,5 @@
         return;
 
-    QwtPlot *plot = this->plot();
+    QwtPlot* plot = this->plot();
     if ( plot == NULL )
         return;
@@ -240,27 +226,31 @@
     plot->setAutoReplot( false );
 
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-    {
-        if ( !d_data->isAxisEnabled[axis] )
-            continue;
-
-        const QwtScaleMap map = plot->canvasMap( axis );
-
-        const double p1 = map.transform( plot->axisScaleDiv( axis ).lowerBound() );
-        const double p2 = map.transform( plot->axisScaleDiv( axis ).upperBound() );
-
-        double d1, d2;
-        if ( axis == QwtPlot::xBottom || axis == QwtPlot::xTop )
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
         {
-            d1 = map.invTransform( p1 - dx );
-            d2 = map.invTransform( p2 - dx );
+            const QwtAxisId axisId( axisPos );
+
+            if ( !m_data->isAxisEnabled[axisId] )
+                continue;
+
+            const QwtScaleMap map = plot->canvasMap( axisId );
+
+            const double p1 = map.transform( plot->axisScaleDiv( axisId ).lowerBound() );
+            const double p2 = map.transform( plot->axisScaleDiv( axisId ).upperBound() );
+
+            double d1, d2;
+            if ( QwtAxis::isXAxis( axisPos ) )
+            {
+                d1 = map.invTransform( p1 - dx );
+                d2 = map.invTransform( p2 - dx );
+            }
+            else
+            {
+                d1 = map.invTransform( p1 - dy );
+                d2 = map.invTransform( p2 - dy );
+            }
+
+            plot->setAxisScale( axisId, d1, d2 );
         }
-        else
-        {
-            d1 = map.invTransform( p1 - dy );
-            d2 = map.invTransform( p2 - dy );
-        }
-
-        plot->setAxisScale( axis, d1, d2 );
     }
 
@@ -274,5 +264,5 @@
    \return Mask as bitmap
    \sa QwtPlotCanvas::borderPath()
-*/
+ */
 QBitmap QwtPlotPanner::contentsMask() const
 {
@@ -288,5 +278,5 @@
 QPixmap QwtPlotPanner::grab() const
 {
-    const QWidget *cv = canvas();
+    const QWidget* cv = canvas();
     if ( cv && cv->inherits( "QGLWidget" ) )
     {
@@ -297,5 +287,5 @@
 
         QPainter painter( &pm );
-        const_cast<QwtPlot *>( plot() )->drawCanvas( &painter );
+        const_cast< QwtPlot* >( plot() )->drawCanvas( &painter );
 
         return pm;
@@ -305,2 +295,3 @@
 }
 
+#include "moc_qwt_plot_panner.cpp"
Index: /trunk/BNC/qwt/qwt_plot_panner.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_panner.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_panner.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,51 +9,52 @@
 
 #ifndef QWT_PLOT_PANNER_H
-#define QWT_PLOT_PANNER_H 1
+#define QWT_PLOT_PANNER_H
 
 #include "qwt_global.h"
 #include "qwt_panner.h"
+#include "qwt_axis_id.h"
 
 class QwtPlot;
 
 /*!
-  \brief QwtPlotPanner provides panning of a plot canvas
+   \brief QwtPlotPanner provides panning of a plot canvas
 
-  QwtPlotPanner is a panner for a plot canvas, that
-  adjusts the scales of the axes after dropping
-  the canvas on its new position.
+   QwtPlotPanner is a panner for a plot canvas, that
+   adjusts the scales of the axes after dropping
+   the canvas on its new position.
 
-  Together with QwtPlotZoomer and QwtPlotMagnifier powerful ways
-  of navigating on a QwtPlot widget can be implemented easily.
+   Together with QwtPlotZoomer and QwtPlotMagnifier powerful ways
+   of navigating on a QwtPlot widget can be implemented easily.
 
-  \note The axes are not updated, while dragging the canvas
-  \sa QwtPlotZoomer, QwtPlotMagnifier
-*/
-class QWT_EXPORT QwtPlotPanner: public QwtPanner
+   \note The axes are not updated, while dragging the canvas
+   \sa QwtPlotZoomer, QwtPlotMagnifier
+ */
+class QWT_EXPORT QwtPlotPanner : public QwtPanner
 {
     Q_OBJECT
 
-public:
-    explicit QwtPlotPanner( QWidget * );
+  public:
+    explicit QwtPlotPanner( QWidget* );
     virtual ~QwtPlotPanner();
 
-    QWidget *canvas();
-    const QWidget *canvas() const;
+    QWidget* canvas();
+    const QWidget* canvas() const;
 
-    QwtPlot *plot();
-    const QwtPlot *plot() const;
+    QwtPlot* plot();
+    const QwtPlot* plot() const;
 
-    void setAxisEnabled( int axis, bool on );
-    bool isAxisEnabled( int axis ) const;
+    void setAxisEnabled( QwtAxisId axisId, bool on );
+    bool isAxisEnabled( QwtAxisId ) const;
 
-protected Q_SLOTS:
+  public Q_SLOTS:
     virtual void moveCanvas( int dx, int dy );
 
-protected:
-    virtual QBitmap contentsMask() const;
-    virtual QPixmap grab() const;
+  protected:
+    virtual QBitmap contentsMask() const QWT_OVERRIDE;
+    virtual QPixmap grab() const QWT_OVERRIDE;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_picker.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_picker.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_picker.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,88 +10,97 @@
 #include "qwt_plot_picker.h"
 #include "qwt_plot.h"
+#include "qwt_text.h"
 #include "qwt_scale_div.h"
-#include "qwt_painter.h"
 #include "qwt_scale_map.h"
 #include "qwt_picker_machine.h"
 
-/*!
-  \brief Create a plot picker
-
-  The picker is set to those x- and y-axis of the plot
-  that are enabled. If both or no x-axis are enabled, the picker
-  is set to QwtPlot::xBottom. If both or no y-axis are
-  enabled, it is set to QwtPlot::yLeft.
-
-  \param canvas Plot canvas to observe, also the parent object
-
-  \sa QwtPlot::autoReplot(), QwtPlot::replot(), scaleRect()
-*/
-
-QwtPlotPicker::QwtPlotPicker( QWidget *canvas ):
-    QwtPicker( canvas ),
-    d_xAxis( -1 ),
-    d_yAxis( -1 )
-{
+class QwtPlotPicker::PrivateData
+{
+  public:
+    PrivateData():
+        xAxisId( -1 ),
+        yAxisId( -1 )
+    {
+    }
+
+    QwtAxisId xAxisId;
+    QwtAxisId yAxisId;
+};
+
+/*!
+   \brief Create a plot picker
+
+   The picker is set to those x- and y-axis of the plot
+   that are enabled. If both or no x-axis are enabled, the picker
+   is set to QwtAxis::XBottom. If both or no y-axis are
+   enabled, it is set to QwtAxis::YLeft.
+
+   \param canvas Plot canvas to observe, also the parent object
+
+   \sa QwtPlot::autoReplot(), QwtPlot::replot(), scaleRect()
+ */
+
+QwtPlotPicker::QwtPlotPicker( QWidget* canvas )
+    : QwtPicker( canvas )
+{
+    m_data = new PrivateData;
+
     if ( !canvas )
         return;
 
+    const QwtPlot* plot = QwtPlotPicker::plot();
     // attach axes
 
-    int xAxis = QwtPlot::xBottom;
-
-    const QwtPlot *plot = QwtPlotPicker::plot();
-    if ( !plot->axisEnabled( QwtPlot::xBottom ) &&
-        plot->axisEnabled( QwtPlot::xTop ) )
-    {
-        xAxis = QwtPlot::xTop;
-    }
-
-    int yAxis = QwtPlot::yLeft;
-    if ( !plot->axisEnabled( QwtPlot::yLeft ) &&
-        plot->axisEnabled( QwtPlot::yRight ) )
-    {
-        yAxis = QwtPlot::yRight;
-    }
-
-    setAxis( xAxis, yAxis );
-}
-
-/*!
-  Create a plot picker
-
-  \param xAxis Set the x axis of the picker
-  \param yAxis Set the y axis of the picker
-  \param canvas Plot canvas to observe, also the parent object
-
-  \sa QwtPlot::autoReplot(), QwtPlot::replot(), scaleRect()
-*/
-QwtPlotPicker::QwtPlotPicker( int xAxis, int yAxis, QWidget *canvas ):
-    QwtPicker( canvas ),
-    d_xAxis( xAxis ),
-    d_yAxis( yAxis )
-{
-}
-
-/*!
-  Create a plot picker
-
-  \param xAxis X axis of the picker
-  \param yAxis Y axis of the picker
-  \param rubberBand Rubber band style
-  \param trackerMode Tracker mode
-  \param canvas Plot canvas to observe, also the parent object
-
-  \sa QwtPicker, QwtPicker::setSelectionFlags(), QwtPicker::setRubberBand(),
+    using namespace QwtAxis;
+
+    int xAxis = XBottom;
+    if ( !plot->isAxisVisible( XBottom ) && plot->isAxisVisible( XTop ) )
+        xAxis = XTop;
+
+    int yAxis = YLeft;
+    if ( !plot->isAxisVisible( YLeft ) && plot->isAxisVisible( YRight ) )
+        yAxis = YRight;
+
+    setAxes( xAxis, yAxis );
+}
+
+/*!
+   Create a plot picker
+
+   \param xAxisId X axis of the picker
+   \param yAxisId Y axis of the picker
+   \param canvas Plot canvas to observe, also the parent object
+
+   \sa QwtPlot::autoReplot(), QwtPlot::replot(), scaleRect()
+ */
+QwtPlotPicker::QwtPlotPicker( QwtAxisId xAxisId, QwtAxisId yAxisId, QWidget* canvas )
+    : QwtPicker( canvas )
+{
+    m_data = new PrivateData;
+    m_data->xAxisId = xAxisId;
+    m_data->yAxisId = yAxisId;
+}
+
+/*!
+   Create a plot picker
+
+   \param xAxisId X axis of the picker
+   \param yAxisId Y axis of the picker
+   \param rubberBand Rubber band style
+   \param trackerMode Tracker mode
+   \param canvas Plot canvas to observe, also the parent object
+
+   \sa QwtPicker, QwtPicker::setSelectionFlags(), QwtPicker::setRubberBand(),
       QwtPicker::setTrackerMode
 
-  \sa QwtPlot::autoReplot(), QwtPlot::replot(), scaleRect()
-*/
-QwtPlotPicker::QwtPlotPicker( int xAxis, int yAxis,
-        RubberBand rubberBand, DisplayMode trackerMode,
-        QWidget *canvas ):
-    QwtPicker( rubberBand, trackerMode, canvas ),
-    d_xAxis( xAxis ),
-    d_yAxis( yAxis )
-{
+   \sa QwtPlot::autoReplot(), QwtPlot::replot(), scaleRect()
+ */
+QwtPlotPicker::QwtPlotPicker( QwtAxisId xAxisId, QwtAxisId yAxisId,
+        RubberBand rubberBand, DisplayMode trackerMode, QWidget* canvas )
+    : QwtPicker( rubberBand, trackerMode, canvas )
+{
+    m_data = new PrivateData;
+    m_data->xAxisId = xAxisId;
+    m_data->yAxisId = yAxisId;
 }
 
@@ -99,8 +108,9 @@
 QwtPlotPicker::~QwtPlotPicker()
 {
+    delete m_data;
 }
 
 //! \return Observed plot canvas
-QWidget *QwtPlotPicker::canvas()
+QWidget* QwtPlotPicker::canvas()
 {
     return parentWidget();
@@ -108,5 +118,5 @@
 
 //! \return Observed plot canvas
-const QWidget *QwtPlotPicker::canvas() const
+const QWidget* QwtPlotPicker::canvas() const
 {
     return parentWidget();
@@ -114,27 +124,27 @@
 
 //! \return Plot widget, containing the observed plot canvas
-QwtPlot *QwtPlotPicker::plot()
-{
-    QWidget *w = canvas();
+QwtPlot* QwtPlotPicker::plot()
+{
+    QWidget* w = canvas();
     if ( w )
         w = w->parentWidget();
 
-    return qobject_cast<QwtPlot *>( w );
+    return qobject_cast< QwtPlot* >( w );
 }
 
 //! \return Plot widget, containing the observed plot canvas
-const QwtPlot *QwtPlotPicker::plot() const
-{
-    const QWidget *w = canvas();
+const QwtPlot* QwtPlotPicker::plot() const
+{
+    const QWidget* w = canvas();
     if ( w )
         w = w->parentWidget();
 
-    return qobject_cast<const QwtPlot *>( w );
-}
-
-/*!
-  \return Normalized bounding rectangle of the axes
-  \sa QwtPlot::autoReplot(), QwtPlot::replot().
-*/
+    return qobject_cast< const QwtPlot* >( w );
+}
+
+/*!
+   \return Normalized bounding rectangle of the axes
+   \sa QwtPlot::autoReplot(), QwtPlot::replot().
+ */
 QRectF QwtPlotPicker::scaleRect() const
 {
@@ -143,6 +153,6 @@
     if ( plot() )
     {
-        const QwtScaleDiv &xs = plot()->axisScaleDiv( xAxis() );
-        const QwtScaleDiv &ys = plot()->axisScaleDiv( yAxis() );
+        const QwtScaleDiv& xs = plot()->axisScaleDiv( xAxis() );
+        const QwtScaleDiv& ys = plot()->axisScaleDiv( yAxis() );
 
         rect = QRectF( xs.lowerBound(), ys.lowerBound(),
@@ -155,41 +165,41 @@
 
 /*!
-  Set the x and y axes of the picker
-
-  \param xAxis X axis
-  \param yAxis Y axis
-*/
-void QwtPlotPicker::setAxis( int xAxis, int yAxis )
-{
-    const QwtPlot *plt = plot();
+   Set the x and y axes of the picker
+
+   \param xAxisId X axis
+   \param yAxisId Y axis
+ */
+void QwtPlotPicker::setAxes( QwtAxisId xAxisId, QwtAxisId yAxisId )
+{
+    const QwtPlot* plt = plot();
     if ( !plt )
         return;
 
-    if ( xAxis != d_xAxis || yAxis != d_yAxis )
-    {
-        d_xAxis = xAxis;
-        d_yAxis = yAxis;
+    if ( xAxisId != m_data->xAxisId || yAxisId != m_data->yAxisId )
+    {
+        m_data->xAxisId = xAxisId;
+        m_data->yAxisId = yAxisId;
     }
 }
 
 //! Return x axis
-int QwtPlotPicker::xAxis() const
-{
-    return d_xAxis;
+QwtAxisId QwtPlotPicker::xAxis() const
+{
+    return m_data->xAxisId;
 }
 
 //! Return y axis
-int QwtPlotPicker::yAxis() const
-{
-    return d_yAxis;
-}
-
-/*!
-  Translate a pixel position into a position string
-
-  \param pos Position in pixel coordinates
-  \return Position string
-*/
-QwtText QwtPlotPicker::trackerText( const QPoint &pos ) const
+QwtAxisId QwtPlotPicker::yAxis() const
+{
+    return m_data->yAxisId;
+}
+
+/*!
+   Translate a pixel position into a position string
+
+   \param pos Position in pixel coordinates
+   \return Position string
+ */
+QwtText QwtPlotPicker::trackerText( const QPoint& pos ) const
 {
     if ( plot() == NULL )
@@ -200,16 +210,16 @@
 
 /*!
-  \brief Translate a position into a position string
-
-  In case of HLineRubberBand the label is the value of the
-  y position, in case of VLineRubberBand the value of the x position.
-  Otherwise the label contains x and y position separated by a ',' .
-
-  The format for the double to string conversion is "%.4f".
-
-  \param pos Position
-  \return Position string
-*/
-QwtText QwtPlotPicker::trackerTextF( const QPointF &pos ) const
+   \brief Translate a position into a position string
+
+   In case of HLineRubberBand the label is the value of the
+   y position, in case of VLineRubberBand the value of the x position.
+   Otherwise the label contains x and y position separated by a ',' .
+
+   The format for the double to string conversion is "%.4f".
+
+   \param pos Position
+   \return Position string
+ */
+QwtText QwtPlotPicker::trackerTextF( const QPointF& pos ) const
 {
     QString text;
@@ -218,11 +228,12 @@
     {
         case HLineRubberBand:
-            text.sprintf( "%.4f", pos.y() );
+            text = QString::number( pos.y(), 'f', 4 );
             break;
         case VLineRubberBand:
-            text.sprintf( "%.4f", pos.x() );
+            text = QString::number( pos.x(), 'f', 4 );
             break;
         default:
-            text.sprintf( "%.4f, %.4f", pos.x(), pos.y() );
+            text = QString::number( pos.x(), 'f', 4 )
+                + ", " + QString::number( pos.y(), 'f', 4 );
     }
     return QwtText( text );
@@ -230,13 +241,13 @@
 
 /*!
-  Append a point to the selection and update rubber band and tracker.
-
-  \param pos Additional point
-  \sa isActive, begin(), end(), move(), appended()
-
-  \note The appended(const QPoint &), appended(const QDoublePoint &)
+   Append a point to the selection and update rubber band and tracker.
+
+   \param pos Additional point
+   \sa isActive, begin(), end(), move(), appended()
+
+   \note The appended(const QPoint &), appended(const QDoublePoint &)
         signals are emitted.
-*/
-void QwtPlotPicker::append( const QPoint &pos )
+ */
+void QwtPlotPicker::append( const QPoint& pos )
 {
     QwtPicker::append( pos );
@@ -245,13 +256,13 @@
 
 /*!
-  Move the last point of the selection
-
-  \param pos New position
-  \sa isActive, begin(), end(), append()
-
-  \note The moved(const QPoint &), moved(const QDoublePoint &)
+   Move the last point of the selection
+
+   \param pos New position
+   \sa isActive, begin(), end(), append()
+
+   \note The moved(const QPoint &), moved(const QDoublePoint &)
         signals are emitted.
-*/
-void QwtPlotPicker::move( const QPoint &pos )
+ */
+void QwtPlotPicker::move( const QPoint& pos )
 {
     QwtPicker::move( pos );
@@ -260,10 +271,10 @@
 
 /*!
-  Close a selection setting the state to inactive.
-
-  \param ok If true, complete the selection and emit selected signals
+   Close a selection setting the state to inactive.
+
+   \param ok If true, complete the selection and emit selected signals
             otherwise discard the selection.
-  \return True if the selection has been accepted, false otherwise
-*/
+   \return True if the selection has been accepted, false otherwise
+ */
 
 bool QwtPlotPicker::end( bool ok )
@@ -273,5 +284,5 @@
         return false;
 
-    QwtPlot *plot = QwtPlotPicker::plot();
+    QwtPlot* plot = QwtPlotPicker::plot();
     if ( !plot )
         return false;
@@ -309,5 +320,5 @@
         case QwtPickerMachine::PolygonSelection:
         {
-            QVector<QPointF> dpa( points.count() );
+            QVector< QPointF > dpa( points.count() );
             for ( int i = 0; i < points.count(); i++ )
                 dpa[i] = invTransform( points[i] );
@@ -327,9 +338,9 @@
     \return Rectangle in plot coordinates
     \sa transform()
-*/
-QRectF QwtPlotPicker::invTransform( const QRect &rect ) const
-{
-    const QwtScaleMap xMap = plot()->canvasMap( d_xAxis );
-    const QwtScaleMap yMap = plot()->canvasMap( d_yAxis );
+ */
+QRectF QwtPlotPicker::invTransform( const QRect& rect ) const
+{
+    const QwtScaleMap xMap = plot()->canvasMap( xAxis() );
+    const QwtScaleMap yMap = plot()->canvasMap( yAxis() );
 
     return QwtScaleMap::invTransform( xMap, yMap, rect );
@@ -340,9 +351,9 @@
     \return Rectangle in pixel coordinates
     \sa invTransform()
-*/
-QRect QwtPlotPicker::transform( const QRectF &rect ) const
-{
-    const QwtScaleMap xMap = plot()->canvasMap( d_xAxis );
-    const QwtScaleMap yMap = plot()->canvasMap( d_yAxis );
+ */
+QRect QwtPlotPicker::transform( const QRectF& rect ) const
+{
+    const QwtScaleMap xMap = plot()->canvasMap( xAxis() );
+    const QwtScaleMap yMap = plot()->canvasMap( yAxis() );
 
     return QwtScaleMap::transform( xMap, yMap, rect ).toRect();
@@ -353,14 +364,14 @@
     \return Point in plot coordinates
     \sa transform()
-*/
-QPointF QwtPlotPicker::invTransform( const QPoint &pos ) const
-{
-    QwtScaleMap xMap = plot()->canvasMap( d_xAxis );
-    QwtScaleMap yMap = plot()->canvasMap( d_yAxis );
+ */
+QPointF QwtPlotPicker::invTransform( const QPoint& pos ) const
+{
+    const QwtScaleMap xMap = plot()->canvasMap( xAxis() );
+    const QwtScaleMap yMap = plot()->canvasMap( yAxis() );
 
     return QPointF(
         xMap.invTransform( pos.x() ),
         yMap.invTransform( pos.y() )
-    );
+        );
 }
 
@@ -369,13 +380,14 @@
     \return Point in pixel coordinates
     \sa invTransform()
-*/
-QPoint QwtPlotPicker::transform( const QPointF &pos ) const
-{
-    QwtScaleMap xMap = plot()->canvasMap( d_xAxis );
-    QwtScaleMap yMap = plot()->canvasMap( d_yAxis );
-
-    const QPointF p( xMap.transform( pos.x() ),
-        yMap.transform( pos.y() ) );
+ */
+QPoint QwtPlotPicker::transform( const QPointF& pos ) const
+{
+    const QwtScaleMap xMap = plot()->canvasMap( xAxis() );
+    const QwtScaleMap yMap = plot()->canvasMap( yAxis() );
+
+    const QPointF p( xMap.transform( pos.x() ), yMap.transform( pos.y() ) );
 
     return p.toPoint();
 }
+
+#include "moc_qwt_plot_picker.cpp"
Index: /trunk/BNC/qwt/qwt_plot_picker.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_picker.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_picker.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,98 +13,104 @@
 #include "qwt_global.h"
 #include "qwt_picker.h"
-#include <qvector.h>
+#include "qwt_axis_id.h"
 
 class QwtPlot;
+class QPointF;
+class QRectF;
+
+#if QT_VERSION < 0x060000
+template< typename T > class QVector;
+#endif
 
 /*!
-  \brief QwtPlotPicker provides selections on a plot canvas
+   \brief QwtPlotPicker provides selections on a plot canvas
 
-  QwtPlotPicker is a QwtPicker tailored for selections on
-  a plot canvas. It is set to a x-Axis and y-Axis and
-  translates all pixel coordinates into this coordinate system.
-*/
+   QwtPlotPicker is a QwtPicker tailored for selections on
+   a plot canvas. It is set to a x-Axis and y-Axis and
+   translates all pixel coordinates into this coordinate system.
+ */
 
-class QWT_EXPORT QwtPlotPicker: public QwtPicker
+class QWT_EXPORT QwtPlotPicker : public QwtPicker
 {
     Q_OBJECT
 
-public:
-    explicit QwtPlotPicker( QWidget *canvas );
+  public:
+    explicit QwtPlotPicker( QWidget* canvas );
     virtual ~QwtPlotPicker();
 
-    explicit QwtPlotPicker( int xAxis, int yAxis, QWidget * );
+    explicit QwtPlotPicker( QwtAxisId xAxisId, QwtAxisId yAxisId, QWidget* );
 
-    explicit QwtPlotPicker( int xAxis, int yAxis,
-        RubberBand rubberBand, DisplayMode trackerMode, QWidget * );
+    explicit QwtPlotPicker( QwtAxisId xAxisId, QwtAxisId yAxisId,
+        RubberBand rubberBand, DisplayMode trackerMode, QWidget* );
 
-    virtual void setAxis( int xAxis, int yAxis );
+    virtual void setAxes( QwtAxisId xAxisId, QwtAxisId yAxisId );
 
-    int xAxis() const;
-    int yAxis() const;
+    QwtAxisId xAxis() const;
+    QwtAxisId yAxis() const;
 
-    QwtPlot *plot();
-    const QwtPlot *plot() const;
+    QwtPlot* plot();
+    const QwtPlot* plot() const;
 
-    QWidget *canvas();
-    const QWidget *canvas() const;
+    QWidget* canvas();
+    const QWidget* canvas() const;
 
-Q_SIGNALS:
+  Q_SIGNALS:
 
     /*!
-      A signal emitted in case of QwtPickerMachine::PointSelection.
-      \param pos Selected point
-    */
-    void selected( const QPointF &pos );
+       A signal emitted in case of QwtPickerMachine::PointSelection.
+       \param pos Selected point
+     */
+    void selected( const QPointF& pos );
 
     /*!
-      A signal emitted in case of QwtPickerMachine::RectSelection.
-      \param rect Selected rectangle
-    */
-    void selected( const QRectF &rect );
+       A signal emitted in case of QwtPickerMachine::RectSelection.
+       \param rect Selected rectangle
+     */
+    void selected( const QRectF& rect );
 
     /*!
-      A signal emitting the selected points,
-      at the end of a selection.
+       A signal emitting the selected points,
+       at the end of a selection.
 
-      \param pa Selected points
-    */
-    void selected( const QVector<QPointF> &pa );
+       \param pa Selected points
+     */
+    void selected( const QVector< QPointF >& pa );
 
     /*!
-      A signal emitted when a point has been appended to the selection
+       A signal emitted when a point has been appended to the selection
 
-      \param pos Position of the appended point.
-      \sa append(). moved()
-    */
-    void appended( const QPointF &pos );
+       \param pos Position of the appended point.
+       \sa append(). moved()
+     */
+    void appended( const QPointF& pos );
 
     /*!
-      A signal emitted whenever the last appended point of the
-      selection has been moved.
+       A signal emitted whenever the last appended point of the
+       selection has been moved.
 
-      \param pos Position of the moved last point of the selection.
-      \sa move(), appended()
-    */
-    void moved( const QPointF &pos );
+       \param pos Position of the moved last point of the selection.
+       \sa move(), appended()
+     */
+    void moved( const QPointF& pos );
 
-protected:
+  protected:
     QRectF scaleRect() const;
 
-    QRectF invTransform( const QRect & ) const;
-    QRect transform( const QRectF & ) const;
+    QRectF invTransform( const QRect& ) const;
+    QRect transform( const QRectF& ) const;
 
-    QPointF invTransform( const QPoint & ) const;
-    QPoint transform( const QPointF & ) const;
+    QPointF invTransform( const QPoint& ) const;
+    QPoint transform( const QPointF& ) const;
 
-    virtual QwtText trackerText( const QPoint & ) const;
-    virtual QwtText trackerTextF( const QPointF & ) const;
+    virtual QwtText trackerText( const QPoint& ) const QWT_OVERRIDE;
+    virtual QwtText trackerTextF( const QPointF& ) const;
 
-    virtual void move( const QPoint & );
-    virtual void append( const QPoint & );
-    virtual bool end( bool ok = true );
+    virtual void move( const QPoint& ) QWT_OVERRIDE;
+    virtual void append( const QPoint& ) QWT_OVERRIDE;
+    virtual bool end( bool ok = true ) QWT_OVERRIDE;
 
-private:
-    int d_xAxis;
-    int d_yAxis;
+  private:
+    class PrivateData;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_rasteritem.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_rasteritem.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_rasteritem.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,22 +11,22 @@
 #include "qwt_scale_map.h"
 #include "qwt_painter.h"
-#include <qapplication.h>
-#include <qdesktopwidget.h>
+#include "qwt_text.h"
+#include "qwt_interval.h"
+#include "qwt_math.h"
+
 #include <qpainter.h>
 #include <qpaintengine.h>
-#include <qmath.h>
-#if QT_VERSION >= 0x040400
 #include <qthread.h>
 #include <qfuture.h>
 #include <qtconcurrentrun.h>
-#endif
-#include <float.h>
+
+#include <limits>
 
 class QwtPlotRasterItem::PrivateData
 {
-public:
-    PrivateData():
-        alpha( -1 ),
-        paintAttributes( QwtPlotRasterItem::PaintInDeviceResolution )
+  public:
+    PrivateData()
+        : alpha( -1 )
+        , paintAttributes( QwtPlotRasterItem::PaintInDeviceResolution )
     {
         cache.policy = QwtPlotRasterItem::NoCache;
@@ -47,5 +47,5 @@
 
 
-static QRectF qwtAlignRect(const QRectF &rect)
+static QRectF qwtAlignRect(const QRectF& rect)
 {
     QRectF r;
@@ -58,7 +58,7 @@
 }
 
-static QRectF qwtStripRect(const QRectF &rect, const QRectF &area,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtInterval &xInterval, const QwtInterval &yInterval)
+static QRectF qwtStripRect(const QRectF& rect, const QRectF& area,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtInterval& xInterval, const QwtInterval& yInterval)
 {
     QRectF r = rect;
@@ -110,8 +110,8 @@
 }
 
-static QImage qwtExpandImage(const QImage &image,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &area, const QRectF &area2, const QRectF &paintRect,
-    const QwtInterval &xInterval, const QwtInterval &yInterval )
+static QImage qwtExpandImage(const QImage& image,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& area, const QRectF& area2, const QRectF& paintRect,
+    const QwtInterval& xInterval, const QwtInterval& yInterval )
 {
     const QRectF strippedRect = qwtStripRect(paintRect, area2,
@@ -123,6 +123,6 @@
 
     const QRectF r = QwtScaleMap::transform(xMap, yMap, area).normalized();
-    const double pw = ( r.width() - 1) / w;
-    const double ph = ( r.height() - 1) / h;
+    const double pw = ( r.width() - 1 ) / w;
+    const double ph = ( r.height() - 1 ) / h;
 
     double px0, py0;
@@ -193,6 +193,6 @@
                 }
 
-                const quint32 *line1 =
-                    reinterpret_cast<const quint32 *>( image.scanLine( y1 ) );
+                const quint32* line1 =
+                    reinterpret_cast< const quint32* >( image.scanLine( y1 ) );
 
                 for ( int x1 = 0; x1 < w; x1++ )
@@ -225,5 +225,5 @@
                     for ( int y2 = yy1; y2 < yy2; y2++ )
                     {
-                        quint32 *line2 = reinterpret_cast<quint32 *>(
+                        quint32* line2 = reinterpret_cast< quint32* >(
                             expanded.scanLine( y2 ) );
 
@@ -263,5 +263,5 @@
                 }
 
-                const uchar *line1 = image.scanLine( y1 );
+                const uchar* line1 = image.scanLine( y1 );
 
                 for ( int x1 = 0; x1 < w; x1++ )
@@ -293,5 +293,5 @@
                     for ( int y2 = yy1; y2 < yy2; y2++ )
                     {
-                        uchar *line2 = expanded.scanLine( y2 );
+                        uchar* line2 = expanded.scanLine( y2 );
                         memset( line2 + xx1, line1[x1], xx2 - xx1 );
                     }
@@ -307,5 +307,5 @@
 }
 
-static QRectF qwtExpandToPixels(const QRectF &rect, const QRectF &pixelRect)
+static QRectF qwtExpandToPixels(const QRectF& rect, const QRectF& pixelRect)
 {
     const double pw = pixelRect.width();
@@ -318,15 +318,15 @@
 
     QRectF r;
-    r.setLeft( pixelRect.left() - qCeil( dx1 / pw ) * pw );
-    r.setTop( pixelRect.top() - qCeil( dy1 / ph ) * ph );
-    r.setRight( pixelRect.right() - qFloor( dx2 / pw ) * pw );
-    r.setBottom( pixelRect.bottom() - qFloor( dy2 / ph ) * ph );
+    r.setLeft( pixelRect.left() - qwtCeil( dx1 / pw ) * pw );
+    r.setTop( pixelRect.top() - qwtCeil( dy1 / ph ) * ph );
+    r.setRight( pixelRect.right() - qwtFloor( dx2 / pw ) * pw );
+    r.setBottom( pixelRect.bottom() - qwtFloor( dy2 / ph ) * ph );
 
     return r;
 }
 
-static void qwtTransformMaps( const QTransform &tr,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    QwtScaleMap &xxMap, QwtScaleMap &yyMap )
+static void qwtTransformMaps( const QTransform& tr,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    QwtScaleMap& xxMap, QwtScaleMap& yyMap )
 {
     const QPointF p1 = tr.map( QPointF( xMap.p1(), yMap.p1() ) );
@@ -340,6 +340,6 @@
 }
 
-static void qwtAdjustMaps( QwtScaleMap &xMap, QwtScaleMap &yMap,
-    const QRectF &area, const QRectF &paintRect)
+static void qwtAdjustMaps( QwtScaleMap& xMap, QwtScaleMap& yMap,
+    const QRectF& area, const QRectF& paintRect)
 {
     double sx1 = area.left();
@@ -354,13 +354,13 @@
         qSwap(sy1, sy2);
 
-    xMap.setPaintInterval(paintRect.left(), paintRect.right());
+    xMap.setPaintInterval(paintRect.left(), paintRect.right() );
     xMap.setScaleInterval(sx1, sx2);
 
-    yMap.setPaintInterval(paintRect.top(), paintRect.bottom());
+    yMap.setPaintInterval(paintRect.top(), paintRect.bottom() );
     yMap.setScaleInterval(sy1, sy2);
 }
 
 static bool qwtUseCache( QwtPlotRasterItem::CachePolicy policy,
-    const QPainter *painter )
+    const QPainter* painter )
 {
     bool doCache = false;
@@ -375,5 +375,7 @@
             case QPaintEngine::SVG:
             case QPaintEngine::Pdf:
+#if QT_VERSION < 0x060000
             case QPaintEngine::PostScript:
+#endif
             case QPaintEngine::MacPrinter:
             case QPaintEngine::Picture:
@@ -403,6 +405,6 @@
         for ( int y = y0; y <= y1; y++ )
         {
-            QRgb *alphaLine = reinterpret_cast<QRgb *>( to->scanLine( y ) );
-            const unsigned char *line = from->scanLine( y );
+            QRgb* alphaLine = reinterpret_cast< QRgb* >( to->scanLine( y ) );
+            const unsigned char* line = from->scanLine( y );
 
             for ( int x = x0; x <= x1; x++ )
@@ -414,6 +416,6 @@
         for ( int y = y0; y <= y1; y++ )
         {
-            QRgb *alphaLine = reinterpret_cast<QRgb *>( to->scanLine( y ) );
-            const QRgb *line = reinterpret_cast<const QRgb *>( from->scanLine( y ) );
+            QRgb* alphaLine = reinterpret_cast< QRgb* >( to->scanLine( y ) );
+            const QRgb* line = reinterpret_cast< const QRgb* >( from->scanLine( y ) );
 
             for ( int x = x0; x <= x1; x++ )
@@ -430,6 +432,6 @@
 
 //! Constructor
-QwtPlotRasterItem::QwtPlotRasterItem( const QString& title ):
-    QwtPlotItem( QwtText( title ) )
+QwtPlotRasterItem::QwtPlotRasterItem( const QString& title )
+    : QwtPlotItem( QwtText( title ) )
 {
     init();
@@ -437,6 +439,6 @@
 
 //! Constructor
-QwtPlotRasterItem::QwtPlotRasterItem( const QwtText& title ):
-    QwtPlotItem( title )
+QwtPlotRasterItem::QwtPlotRasterItem( const QwtText& title )
+    : QwtPlotItem( title )
 {
     init();
@@ -446,10 +448,10 @@
 QwtPlotRasterItem::~QwtPlotRasterItem()
 {
-    delete d_data;
+    delete m_data;
 }
 
 void QwtPlotRasterItem::init()
 {
-    d_data = new PrivateData();
+    m_data = new PrivateData();
 
     setItemAttribute( QwtPlotItem::AutoScale, true );
@@ -460,16 +462,16 @@
 
 /*!
-  Specify an attribute how to draw the raster item
-
-  \param attribute Paint attribute
-  \param on On/Off
-  /sa PaintAttribute, testPaintAttribute()
-*/
+   Specify an attribute how to draw the raster item
+
+   \param attribute Paint attribute
+   \param on On/Off
+   /sa PaintAttribute, testPaintAttribute()
+ */
 void QwtPlotRasterItem::setPaintAttribute( PaintAttribute attribute, bool on )
 {
     if ( on )
-        d_data->paintAttributes |= attribute;
+        m_data->paintAttributes |= attribute;
     else
-        d_data->paintAttributes &= ~attribute;
+        m_data->paintAttributes &= ~attribute;
 }
 
@@ -477,8 +479,8 @@
     \return True, when attribute is enabled
     \sa PaintAttribute, setPaintAttribute()
-*/
+ */
 bool QwtPlotRasterItem::testPaintAttribute( PaintAttribute attribute ) const
 {
-    return ( d_data->paintAttributes & attribute );
+    return ( m_data->paintAttributes & attribute );
 }
 
@@ -505,5 +507,5 @@
 
    \sa alpha()
-*/
+ */
 void QwtPlotRasterItem::setAlpha( int alpha )
 {
@@ -514,7 +516,7 @@
         alpha = 255;
 
-    if ( alpha != d_data->alpha )
-    {
-        d_data->alpha = alpha;
+    if ( alpha != m_data->alpha )
+    {
+        m_data->alpha = alpha;
 
         itemChanged();
@@ -523,26 +525,26 @@
 
 /*!
-  \return Alpha value of the raster item
-  \sa setAlpha()
-*/
+   \return Alpha value of the raster item
+   \sa setAlpha()
+ */
 int QwtPlotRasterItem::alpha() const
 {
-    return d_data->alpha;
-}
-
-/*!
-  Change the cache policy
-
-  The default policy is NoCache
-
-  \param policy Cache policy
-  \sa CachePolicy, cachePolicy()
-*/
+    return m_data->alpha;
+}
+
+/*!
+   Change the cache policy
+
+   The default policy is NoCache
+
+   \param policy Cache policy
+   \sa CachePolicy, cachePolicy()
+ */
 void QwtPlotRasterItem::setCachePolicy(
     QwtPlotRasterItem::CachePolicy policy )
 {
-    if ( d_data->cache.policy != policy )
-    {
-        d_data->cache.policy = policy;
+    if ( m_data->cache.policy != policy )
+    {
+        m_data->cache.policy = policy;
 
         invalidateCache();
@@ -552,10 +554,10 @@
 
 /*!
-  \return Cache policy
-  \sa CachePolicy, setCachePolicy()
-*/
+   \return Cache policy
+   \sa CachePolicy, setCachePolicy()
+ */
 QwtPlotRasterItem::CachePolicy QwtPlotRasterItem::cachePolicy() const
 {
-    return d_data->cache.policy;
+    return m_data->cache.policy;
 }
 
@@ -563,10 +565,10 @@
    Invalidate the paint cache
    \sa setCachePolicy()
-*/
+ */
 void QwtPlotRasterItem::invalidateCache()
 {
-    d_data->cache.image = QImage();
-    d_data->cache.area = QRect();
-    d_data->cache.size = QSize();
+    m_data->cache.image = QImage();
+    m_data->cache.area = QRect();
+    m_data->cache.size = QSize();
 }
 
@@ -596,6 +598,6 @@
 
    \sa render(), renderImage()
-*/
-QRectF QwtPlotRasterItem::pixelHint( const QRectF &area ) const
+ */
+QRectF QwtPlotRasterItem::pixelHint( const QRectF& area ) const
 {
     Q_UNUSED( area );
@@ -604,18 +606,18 @@
 
 /*!
-  \brief Draw the raster data
-  \param painter Painter
-  \param xMap X-Scale Map
-  \param yMap Y-Scale Map
-  \param canvasRect Contents rectangle of the plot canvas
-*/
-void QwtPlotRasterItem::draw( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
-{
-    if ( canvasRect.isEmpty() || d_data->alpha == 0 )
+   \brief Draw the raster data
+   \param painter Painter
+   \param xMap X-Scale Map
+   \param yMap Y-Scale Map
+   \param canvasRect Contents rectangle of the plot canvas
+ */
+void QwtPlotRasterItem::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
+{
+    if ( canvasRect.isEmpty() || m_data->alpha == 0 )
         return;
 
-    const bool doCache = qwtUseCache( d_data->cache.policy, painter );
+    const bool doCache = qwtUseCache( m_data->cache.policy, painter );
 
     const QwtInterval xInterval = interval( Qt::XAxis );
@@ -626,5 +628,5 @@
         precision/quality. So we always render the image in
         paint device resolution.
-    */
+     */
 
     QwtScaleMap xxMap, yyMap;
@@ -657,7 +659,7 @@
         {
             /*
-              When the resolution of the data pixels is higher than
-              the resolution of the target device we render in
-              target device resolution.
+               When the resolution of the data pixels is higher than
+               the resolution of the target device we render in
+               target device resolution.
              */
             pixelRect = QRectF();
@@ -666,6 +668,6 @@
         {
             /*
-              If only one dimension is of the data pixel is higher
-              we expand the pixel rect to the resolution of the target device.
+               If only one dimension is of the data pixel is higher
+               we expand the pixel rect to the resolution of the target device.
              */
 
@@ -692,9 +694,21 @@
         // data pixels we render in resolution of the paint device.
 
+        auto imageSize = paintRect.size();
+
+#if QT_VERSION >= 0x050000
+        const auto pixelRatio = QwtPainter::devicePixelRatio( painter->device() );
+        imageSize *= pixelRatio;
+#endif
+
         image = compose(xxMap, yyMap,
-            area, paintRect, paintRect.size().toSize(), doCache);
+            area, paintRect, imageSize.toSize(), doCache);
+
         if ( image.isNull() )
             return;
 
+#if QT_VERSION >= 0x050000
+        image.setDevicePixelRatio( pixelRatio );
+#endif
+
         // Remove pixels at the boundaries, when explicitly
         // excluded in the intervals
@@ -706,5 +720,5 @@
         {
             const QRect r(
-                qRound( imageRect.x() - paintRect.x()),
+                qRound( imageRect.x() - paintRect.x() ),
                 qRound( imageRect.y() - paintRect.y() ),
                 qRound( imageRect.width() ),
@@ -773,5 +787,5 @@
 
    \param axis X, Y, or Z axis
-*/
+ */
 QwtInterval QwtPlotRasterItem::interval(Qt::Axis axis) const
 {
@@ -783,5 +797,5 @@
    \return Bounding rectangle of the data
    \sa QwtPlotRasterItem::interval()
-*/
+ */
 QRectF QwtPlotRasterItem::boundingRect() const
 {
@@ -801,6 +815,8 @@
     else
     {
-        r.setLeft(-0.5 * FLT_MAX);
-        r.setWidth(FLT_MAX);
+        const qreal max = std::numeric_limits< float >::max();
+
+        r.setLeft( -0.5 * max );
+        r.setWidth( max );
     }
 
@@ -812,6 +828,8 @@
     else
     {
-        r.setTop(-0.5 * FLT_MAX);
-        r.setHeight(FLT_MAX);
+        const qreal max = std::numeric_limits< float >::max();
+
+        r.setTop( -0.5 * max );
+        r.setHeight( max );
     }
 
@@ -820,7 +838,7 @@
 
 QImage QwtPlotRasterItem::compose(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &imageArea, const QRectF &paintRect,
-    const QSize &imageSize, bool doCache) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& imageArea, const QRectF& paintRect,
+    const QSize& imageSize, bool doCache) const
 {
     QImage image;
@@ -830,9 +848,9 @@
     if ( doCache )
     {
-        if ( !d_data->cache.image.isNull()
-            && d_data->cache.area == imageArea
-            && d_data->cache.size == paintRect.size() )
-        {
-            image = d_data->cache.image;
+        if ( !m_data->cache.image.isNull()
+            && m_data->cache.area == imageArea
+            && m_data->cache.size == paintRect.size() )
+        {
+            image = m_data->cache.image;
         }
     }
@@ -858,15 +876,15 @@
         if ( doCache )
         {
-            d_data->cache.area = imageArea;
-            d_data->cache.size = paintRect.size();
-            d_data->cache.image = image;
-        }
-    }
-
-    if ( d_data->alpha >= 0 && d_data->alpha < 255 )
+            m_data->cache.area = imageArea;
+            m_data->cache.size = paintRect.size();
+            m_data->cache.image = image;
+        }
+    }
+
+    if ( m_data->alpha >= 0 && m_data->alpha < 255 )
     {
         QImage alphaImage( image.size(), QImage::Format_ARGB32 );
 
-#if QT_VERSION >= 0x040400 && !defined(QT_NO_QFUTURE)
+#if !defined( QT_NO_QFUTURE )
         uint numThreads = renderThreadCount();
 
@@ -879,5 +897,7 @@
         const int numRows = image.height() / numThreads;
 
-        QList< QFuture<void> > futures;
+        QVector< QFuture< void > > futures;
+        futures.reserve( numThreads - 1 );
+
         for ( uint i = 0; i < numThreads; i++ )
         {
@@ -886,10 +906,10 @@
             {
                 tile.setHeight( image.height() - i * numRows );
-                qwtToRgba( &image, &alphaImage, tile, d_data->alpha );
+                qwtToRgba( &image, &alphaImage, tile, m_data->alpha );
             }
             else
             {
                 futures += QtConcurrent::run(
-                    &qwtToRgba, &image, &alphaImage, tile, d_data->alpha );
+                    &qwtToRgba, &image, &alphaImage, tile, m_data->alpha );
             }
         }
@@ -898,5 +918,5 @@
 #else
         const QRect tile( 0, 0, image.width(), image.height() );
-        qwtToRgba( &image, &alphaImage, tile, d_data->alpha );
+        qwtToRgba( &image, &alphaImage, tile, m_data->alpha );
 #endif
         image = alphaImage;
@@ -916,9 +936,9 @@
 
    \return Calculated scale map
-*/
+ */
 QwtScaleMap QwtPlotRasterItem::imageMap(
     Qt::Orientation orientation,
-    const QwtScaleMap &map, const QRectF &area,
-    const QSize &imageSize, double pixelSize) const
+    const QwtScaleMap& map, const QRectF& area,
+    const QSize& imageSize, double pixelSize) const
 {
     double p1, p2, s1, s2;
Index: /trunk/BNC/qwt/qwt_plot_rasteritem.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_rasteritem.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_rasteritem.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,47 +13,47 @@
 #include "qwt_global.h"
 #include "qwt_plot_item.h"
-#include "qwt_interval.h"
-#include <qglobal.h>
+
 #include <qstring.h>
-#include <qimage.h>
+
+class QwtInterval;
 
 /*!
-  \brief A class, which displays raster data
+   \brief A class, which displays raster data
 
-  Raster data is a grid of pixel values, that can be represented
-  as a QImage. It is used for many types of information like
-  spectrograms, cartograms, geographical maps ...
+   Raster data is a grid of pixel values, that can be represented
+   as a QImage. It is used for many types of information like
+   spectrograms, cartograms, geographical maps ...
 
-  Often a plot has several types of raster data organized in layers.
-  ( f.e a geographical map, with weather statistics ).
-  Using setAlpha() raster items can be stacked easily.
+   Often a plot has several types of raster data organized in layers.
+   ( f.e a geographical map, with weather statistics ).
+   Using setAlpha() raster items can be stacked easily.
 
-  QwtPlotRasterItem is only implemented for images of the following formats:
-  QImage::Format_Indexed8, QImage::Format_ARGB32.
+   QwtPlotRasterItem is only implemented for images of the following formats:
+   QImage::Format_Indexed8, QImage::Format_ARGB32.
 
-  \sa QwtPlotSpectrogram
-*/
+   \sa QwtPlotSpectrogram
+ */
 
-class QWT_EXPORT QwtPlotRasterItem: public QwtPlotItem
+class QWT_EXPORT QwtPlotRasterItem : public QwtPlotItem
 {
-public:
+  public:
     /*!
-      \brief Cache policy
-      The default policy is NoCache
+       \brief Cache policy
+       The default policy is NoCache
      */
     enum CachePolicy
     {
         /*!
-          renderImage() is called each time the item has to be repainted
+           renderImage() is called each time the item has to be repainted
          */
         NoCache,
 
         /*!
-          renderImage() is called, whenever the image cache is not valid,
-          or the scales, or the size of the canvas has changed.
+           renderImage() is called, whenever the image cache is not valid,
+           or the scales, or the size of the canvas has changed.
 
-          This type of cache is useful for improving the performance
-          of hide/show operations or manipulations of the alpha value.
-          All other situations are handled by the canvas backing store.
+           This type of cache is useful for improving the performance
+           of hide/show operations or manipulations of the alpha value.
+           All other situations are handled by the canvas backing store.
          */
         PaintCache
@@ -63,17 +63,17 @@
         Attributes to modify the drawing algorithm.
         \sa setPaintAttribute(), testPaintAttribute()
-    */
+     */
     enum PaintAttribute
     {
         /*!
-          When the image is rendered according to the data pixels
-          ( QwtRasterData::pixelHint() ) it can be expanded to paint
-          device resolution before it is passed to QPainter.
-          The expansion algorithm rounds the pixel borders in the same
-          way as the axis ticks, what is usually better than the
-          scaling algorithm implemented in Qt.
-          Disabling this flag might make sense, to reduce the size of a
-          document/file. If this is possible for a document format
-          depends on the implementation of the specific QPaintEngine.
+           When the image is rendered according to the data pixels
+           ( QwtRasterData::pixelHint() ) it can be expanded to paint
+           device resolution before it is passed to QPainter.
+           The expansion algorithm rounds the pixel borders in the same
+           way as the axis ticks, what is usually better than the
+           scaling algorithm implemented in Qt.
+           Disabling this flag might make sense, to reduce the size of a
+           document/file. If this is possible for a document format
+           depends on the implementation of the specific QPaintEngine.
          */
 
@@ -81,6 +81,5 @@
     };
 
-    //! Paint attributes
-    typedef QFlags<PaintAttribute> PaintAttributes;
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
 
     explicit QwtPlotRasterItem( const QString& title = QString() );
@@ -99,51 +98,51 @@
     void invalidateCache();
 
-    virtual void draw( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect ) const;
+    virtual void draw( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
 
-    virtual QRectF pixelHint( const QRectF & ) const;
+    virtual QRectF pixelHint( const QRectF& ) const;
 
     virtual QwtInterval interval(Qt::Axis) const;
-    virtual QRectF boundingRect() const;
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
 
-protected:
+  protected:
     /*!
-      \brief Render an image
+       \brief Render an image
 
-      An implementation of render() might iterate over all
-      pixels of imageRect. Each pixel has to be translated into
-      the corresponding position in scale coordinates using the maps.
-      This position can be used to look up a value in a implementation
-      specific way and to map it into a color.
+       An implementation of render() might iterate over all
+       pixels of imageRect. Each pixel has to be translated into
+       the corresponding position in scale coordinates using the maps.
+       This position can be used to look up a value in a implementation
+       specific way and to map it into a color.
 
-      \param xMap X-Scale Map
-      \param yMap Y-Scale Map
-      \param area Requested area for the image in scale coordinates
-      \param imageSize Requested size of the image
+       \param xMap X-Scale Map
+       \param yMap Y-Scale Map
+       \param area Requested area for the image in scale coordinates
+       \param imageSize Requested size of the image
 
-      \return Rendered image
+       \return Rendered image
      */
-    virtual QImage renderImage( const QwtScaleMap &xMap,
-        const QwtScaleMap &yMap, const QRectF &area,
-        const QSize &imageSize ) const = 0;
+    virtual QImage renderImage( const QwtScaleMap& xMap,
+        const QwtScaleMap& yMap, const QRectF& area,
+        const QSize& imageSize ) const = 0;
 
     virtual QwtScaleMap imageMap( Qt::Orientation,
-        const QwtScaleMap &map, const QRectF &area,
-        const QSize &imageSize, double pixelSize) const;
+        const QwtScaleMap& map, const QRectF& area,
+        const QSize& imageSize, double pixelSize) const;
 
-private:
-    QwtPlotRasterItem( const QwtPlotRasterItem & );
-    QwtPlotRasterItem &operator=( const QwtPlotRasterItem & );
+  private:
+    explicit QwtPlotRasterItem( const QwtPlotRasterItem& );
+    QwtPlotRasterItem& operator=( const QwtPlotRasterItem& );
 
     void init();
 
-    QImage compose( const QwtScaleMap &, const QwtScaleMap &,
-        const QRectF &imageArea, const QRectF &paintRect,
-        const QSize &imageSize, bool doCache) const;
+    QImage compose( const QwtScaleMap&, const QwtScaleMap&,
+        const QRectF& imageArea, const QRectF& paintRect,
+        const QSize& imageSize, bool doCache) const;
 
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_renderer.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_renderer.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_renderer.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -28,10 +28,9 @@
 #include <qimagewriter.h>
 #include <qvariant.h>
+#include <qmargins.h>
 
 #ifndef QWT_NO_SVG
 #ifdef QT_SVG_LIB
-#if QT_VERSION >= 0x040500
 #define QWT_FORMAT_SVG 1
-#endif
 #endif
 #endif
@@ -73,6 +72,25 @@
 #endif
 
+static qreal qwtScalePenWidth( const QwtPlot* plot )
+{
+    qreal pw = 0.0;
+
+    for ( int axisId = 0; axisId < QwtAxis::AxisPositions; axisId++ )
+    {
+        if ( plot->isAxisVisible( axisId ) )
+            pw = qMax( pw, plot->axisScaleDraw( axisId )->penWidthF() );
+    }
+
+    return pw;
+}
+
+static QColor qwtScalePenColor( const QwtPlot* plot )
+{
+    const QPalette pal = plot->axisWidget( QwtAxis::YLeft )->palette();
+    return pal.color( QPalette::WindowText );
+}
+
 static QPainterPath qwtCanvasClip(
-    const QWidget* canvas, const QRectF &canvasRect )
+    const QWidget* canvas, const QRectF& canvasRect )
 {
     // The clip region is calculated in integers
@@ -80,8 +98,8 @@
     // calculate it in target device resolution
 
-    int x1 = qCeil( canvasRect.left() );
-    int x2 = qFloor( canvasRect.right() );
-    int y1 = qCeil( canvasRect.top() );
-    int y2 = qFloor( canvasRect.bottom() );
+    int x1 = qwtCeil( canvasRect.left() );
+    int x2 = qwtFloor( canvasRect.right() );
+    int y1 = qwtCeil( canvasRect.top() );
+    int y2 = qwtFloor( canvasRect.bottom() );
 
     const QRect r( x1, y1, x2 - x1 - 1, y2 - y1 - 1 );
@@ -90,5 +108,5 @@
 
     ( void ) QMetaObject::invokeMethod(
-        const_cast< QWidget *>( canvas ), "borderPath",
+        const_cast< QWidget* >( canvas ), "borderPath",
         Qt::DirectConnection,
         Q_RETURN_ARG( QPainterPath, clipPath ), Q_ARG( QRect, r ) );
@@ -97,8 +115,12 @@
 }
 
-static inline QFont qwtResolvedFont( const QWidget *widget )
+static inline QFont qwtResolvedFont( const QWidget* widget )
 {
     QFont font = widget->font();
+#if QT_VERSION >= 0x060000
+    font.setResolveMask( QFont::AllPropertiesResolved );
+#else
     font.resolve( QFont::AllPropertiesResolved );
+#endif
 
     return font;
@@ -107,8 +129,8 @@
 class QwtPlotRenderer::PrivateData
 {
-public:
-    PrivateData():
-        discardFlags( QwtPlotRenderer::DiscardNone ),
-        layoutFlags( QwtPlotRenderer::DefaultLayout )
+  public:
+    PrivateData()
+        : discardFlags( QwtPlotRenderer::DiscardNone )
+        , layoutFlags( QwtPlotRenderer::DefaultLayout )
     {
     }
@@ -121,9 +143,9 @@
    Constructor
    \param parent Parent object
-*/
-QwtPlotRenderer::QwtPlotRenderer( QObject *parent ):
-    QObject( parent )
-{
-    d_data = new PrivateData;
+ */
+QwtPlotRenderer::QwtPlotRenderer( QObject* parent )
+    : QObject( parent )
+{
+    m_data = new PrivateData;
 }
 
@@ -131,112 +153,112 @@
 QwtPlotRenderer::~QwtPlotRenderer()
 {
-    delete d_data;
-}
-
-/*!
-  Change a flag, indicating what to discard from rendering
-
-  \param flag Flag to change
-  \param on On/Off
-
-  \sa DiscardFlag, testDiscardFlag(), setDiscardFlags(), discardFlags()
-*/
+    delete m_data;
+}
+
+/*!
+   Change a flag, indicating what to discard from rendering
+
+   \param flag Flag to change
+   \param on On/Off
+
+   \sa DiscardFlag, testDiscardFlag(), setDiscardFlags(), discardFlags()
+ */
 void QwtPlotRenderer::setDiscardFlag( DiscardFlag flag, bool on )
 {
     if ( on )
-        d_data->discardFlags |= flag;
+        m_data->discardFlags |= flag;
     else
-        d_data->discardFlags &= ~flag;
-}
-
-/*!
-  \return True, if flag is enabled.
-  \param flag Flag to be tested
-  \sa DiscardFlag, setDiscardFlag(), setDiscardFlags(), discardFlags()
-*/
+        m_data->discardFlags &= ~flag;
+}
+
+/*!
+   \return True, if flag is enabled.
+   \param flag Flag to be tested
+   \sa DiscardFlag, setDiscardFlag(), setDiscardFlags(), discardFlags()
+ */
 bool QwtPlotRenderer::testDiscardFlag( DiscardFlag flag ) const
 {
-    return d_data->discardFlags & flag;
-}
-
-/*!
-  Set the flags, indicating what to discard from rendering
-
-  \param flags Flags
-  \sa DiscardFlag, setDiscardFlag(), testDiscardFlag(), discardFlags()
-*/
+    return m_data->discardFlags & flag;
+}
+
+/*!
+   Set the flags, indicating what to discard from rendering
+
+   \param flags Flags
+   \sa DiscardFlag, setDiscardFlag(), testDiscardFlag(), discardFlags()
+ */
 void QwtPlotRenderer::setDiscardFlags( DiscardFlags flags )
 {
-    d_data->discardFlags = flags;
-}
-
-/*!
-  \return Flags, indicating what to discard from rendering
-  \sa DiscardFlag, setDiscardFlags(), setDiscardFlag(), testDiscardFlag()
-*/
+    m_data->discardFlags = flags;
+}
+
+/*!
+   \return Flags, indicating what to discard from rendering
+   \sa DiscardFlag, setDiscardFlags(), setDiscardFlag(), testDiscardFlag()
+ */
 QwtPlotRenderer::DiscardFlags QwtPlotRenderer::discardFlags() const
 {
-    return d_data->discardFlags;
-}
-
-/*!
-  Change a layout flag
-
-  \param flag Flag to change
-  \param on On/Off
-
-  \sa LayoutFlag, testLayoutFlag(), setLayoutFlags(), layoutFlags()
-*/
+    return m_data->discardFlags;
+}
+
+/*!
+   Change a layout flag
+
+   \param flag Flag to change
+   \param on On/Off
+
+   \sa LayoutFlag, testLayoutFlag(), setLayoutFlags(), layoutFlags()
+ */
 void QwtPlotRenderer::setLayoutFlag( LayoutFlag flag, bool on )
 {
     if ( on )
-        d_data->layoutFlags |= flag;
+        m_data->layoutFlags |= flag;
     else
-        d_data->layoutFlags &= ~flag;
-}
-
-/*!
-  \return True, if flag is enabled.
-  \param flag Flag to be tested
-  \sa LayoutFlag, setLayoutFlag(), setLayoutFlags(), layoutFlags()
-*/
+        m_data->layoutFlags &= ~flag;
+}
+
+/*!
+   \return True, if flag is enabled.
+   \param flag Flag to be tested
+   \sa LayoutFlag, setLayoutFlag(), setLayoutFlags(), layoutFlags()
+ */
 bool QwtPlotRenderer::testLayoutFlag( LayoutFlag flag ) const
 {
-    return d_data->layoutFlags & flag;
-}
-
-/*!
-  Set the layout flags
-
-  \param flags Flags
-  \sa LayoutFlag, setLayoutFlag(), testLayoutFlag(), layoutFlags()
-*/
+    return m_data->layoutFlags & flag;
+}
+
+/*!
+   Set the layout flags
+
+   \param flags Flags
+   \sa LayoutFlag, setLayoutFlag(), testLayoutFlag(), layoutFlags()
+ */
 void QwtPlotRenderer::setLayoutFlags( LayoutFlags flags )
 {
-    d_data->layoutFlags = flags;
-}
-
-/*!
-  \return Layout flags
-  \sa LayoutFlag, setLayoutFlags(), setLayoutFlag(), testLayoutFlag()
-*/
+    m_data->layoutFlags = flags;
+}
+
+/*!
+   \return Layout flags
+   \sa LayoutFlag, setLayoutFlags(), setLayoutFlag(), testLayoutFlag()
+ */
 QwtPlotRenderer::LayoutFlags QwtPlotRenderer::layoutFlags() const
 {
-    return d_data->layoutFlags;
-}
-
-/*!
-  Render a plot to a file
-
-  The format of the document will be auto-detected from the
-  suffix of the file name.
-
-  \param plot Plot widget
-  \param fileName Path of the file, where the document will be stored
-  \param sizeMM Size for the document in millimeters.
-  \param resolution Resolution in dots per Inch (dpi)
-*/
-void QwtPlotRenderer::renderDocument( QwtPlot *plot,
-    const QString &fileName, const QSizeF &sizeMM, int resolution )
+    return m_data->layoutFlags;
+}
+
+/*!
+   Render a plot to a file
+
+   The format of the document will be auto-detected from the
+   suffix of the file name.
+
+   \param plot Plot widget
+   \param fileName Path of the file, where the document will be stored
+   \param sizeMM Size for the document in millimeters.
+   \param resolution Resolution in dots per Inch (dpi)
+ */
+void QwtPlotRenderer::renderDocument( QwtPlot* plot,
+    const QString& fileName, const QSizeF& sizeMM, int resolution )
 {
     renderDocument( plot, fileName,
@@ -245,31 +267,31 @@
 
 /*!
-  Render a plot to a file
-
-  Supported formats are:
-
-  - pdf\n
+   Render a plot to a file
+
+   Supported formats are:
+
+   - pdf\n
     Portable Document Format PDF
-  - ps\n
+   - ps\n
     Postcript
-  - svg\n
+   - svg\n
     Scalable Vector Graphics SVG
-  - all image formats supported by Qt\n
+   - all image formats supported by Qt\n
     see QImageWriter::supportedImageFormats()
 
-  Scalable vector graphic formats like PDF or SVG are superior to
-  raster graphics formats.
-
-  \param plot Plot widget
-  \param fileName Path of the file, where the document will be stored
-  \param format Format for the document
-  \param sizeMM Size for the document in millimeters.
-  \param resolution Resolution in dots per Inch (dpi)
-
-  \sa renderTo(), render(), QwtPainter::setRoundingAlignment()
-*/
-void QwtPlotRenderer::renderDocument( QwtPlot *plot,
-    const QString &fileName, const QString &format,
-    const QSizeF &sizeMM, int resolution )
+   Scalable vector graphic formats like PDF or SVG are superior to
+   raster graphics formats.
+
+   \param plot Plot widget
+   \param fileName Path of the file, where the document will be stored
+   \param format Format for the document
+   \param sizeMM Size for the document in millimeters.
+   \param resolution Resolution in dots per Inch (dpi)
+
+   \sa renderTo(), render(), QwtPainter::setRoundingAlignment()
+ */
+void QwtPlotRenderer::renderDocument( QwtPlot* plot,
+    const QString& fileName, const QString& format,
+    const QSizeF& sizeMM, int resolution )
 {
     if ( plot == NULL || sizeMM.isEmpty() || resolution <= 0 )
@@ -292,5 +314,5 @@
 #if QWT_PDF_WRITER
         QPdfWriter pdfWriter( fileName );
-        pdfWriter.setPageSizeMM( sizeMM );
+        pdfWriter.setPageSize( QPageSize( sizeMM, QPageSize::Millimeter ) );
         pdfWriter.setTitle( title );
         pdfWriter.setPageMargins( QMarginsF() );
@@ -366,18 +388,18 @@
 
 /*!
-  \brief Render the plot to a \c QPaintDevice
-
-  This function renders the contents of a QwtPlot instance to
-  \c QPaintDevice object. The target rectangle is derived from
-  its device metrics.
-
-  \param plot Plot to be rendered
-  \param paintDevice device to paint on, f.e a QImage
-
-  \sa renderDocument(), render(), QwtPainter::setRoundingAlignment()
-*/
+   \brief Render the plot to a \c QPaintDevice
+
+   This function renders the contents of a QwtPlot instance to
+   \c QPaintDevice object. The target rectangle is derived from
+   its device metrics.
+
+   \param plot Plot to be rendered
+   \param paintDevice device to paint on, f.e a QImage
+
+   \sa renderDocument(), render(), QwtPainter::setRoundingAlignment()
+ */
 
 void QwtPlotRenderer::renderTo(
-    QwtPlot *plot, QPaintDevice &paintDevice ) const
+    QwtPlot* plot, QPaintDevice& paintDevice ) const
 {
     int w = paintDevice.width();
@@ -389,20 +411,20 @@
 
 /*!
-  \brief Render the plot to a QPrinter
-
-  This function renders the contents of a QwtPlot instance to
-  \c QPaintDevice object. The size is derived from the printer
-  metrics.
-
-  \param plot Plot to be rendered
-  \param printer Printer to paint on
-
-  \sa renderDocument(), render(), QwtPainter::setRoundingAlignment()
-*/
+   \brief Render the plot to a QPrinter
+
+   This function renders the contents of a QwtPlot instance to
+   \c QPaintDevice object. The size is derived from the printer
+   metrics.
+
+   \param plot Plot to be rendered
+   \param printer Printer to paint on
+
+   \sa renderDocument(), render(), QwtPainter::setRoundingAlignment()
+ */
 
 #ifndef QT_NO_PRINTER
 
 void QwtPlotRenderer::renderTo(
-    QwtPlot *plot, QPrinter &printer ) const
+    QwtPlot* plot, QPrinter& printer ) const
 {
     int w = printer.width();
@@ -423,16 +445,16 @@
 
 /*!
-  \brief Render the plot to a QSvgGenerator
-
-  If the generator has a view box, the plot will be rendered into it.
-  If it has no viewBox but a valid size the target coordinates
-  will be (0, 0, generator.width(), generator.height()). Otherwise
-  the target rectangle will be QRectF(0, 0, 800, 600);
-
-  \param plot Plot to be rendered
-  \param generator SVG generator
-*/
+   \brief Render the plot to a QSvgGenerator
+
+   If the generator has a view box, the plot will be rendered into it.
+   If it has no viewBox but a valid size the target coordinates
+   will be (0, 0, generator.width(), generator.height()). Otherwise
+   the target rectangle will be QRectF(0, 0, 800, 600);
+
+   \param plot Plot to be rendered
+   \param generator SVG generator
+ */
 void QwtPlotRenderer::renderTo(
-    QwtPlot *plot, QSvgGenerator &generator ) const
+    QwtPlot* plot, QSvgGenerator& generator ) const
 {
     QRectF rect = generator.viewBoxF();
@@ -450,28 +472,28 @@
 
 /*!
-  Paint the contents of a QwtPlot instance into a given rectangle.
-
-  \param plot Plot to be rendered
-  \param painter Painter
-  \param plotRect Bounding rectangle
-
-  \sa renderDocument(), renderTo(), QwtPainter::setRoundingAlignment()
-*/
-void QwtPlotRenderer::render( QwtPlot *plot,
-    QPainter *painter, const QRectF &plotRect ) const
+   Paint the contents of a QwtPlot instance into a given rectangle.
+
+   \param plot Plot to be rendered
+   \param painter Painter
+   \param plotRect Bounding rectangle
+
+   \sa renderDocument(), renderTo(), QwtPainter::setRoundingAlignment()
+ */
+void QwtPlotRenderer::render( QwtPlot* plot,
+    QPainter* painter, const QRectF& plotRect ) const
 {
     if ( painter == 0 || !painter->isActive() ||
-            !plotRect.isValid() || plot->size().isNull() )
+        !plotRect.isValid() || plot->size().isNull() )
     {
         return;
     }
 
-    if ( !( d_data->discardFlags & DiscardBackground ) )
+    if ( !( m_data->discardFlags & DiscardBackground ) )
         QwtPainter::drawBackgound( painter, plotRect, plot );
 
     /*
-      The layout engine uses the same methods as they are used
-      by the Qt layout system. Therefore we need to calculate the
-      layout in screen coordinates and paint with a scaled painter.
+       The layout engine uses the same methods as they are used
+       by the Qt layout system. Therefore we need to calculate the
+       layout in screen coordinates and paint with a scaled painter.
      */
     QTransform transform;
@@ -482,32 +504,33 @@
     QRectF layoutRect = transform.inverted().mapRect( plotRect );
 
-    if ( !( d_data->discardFlags & DiscardBackground ) )
+    if ( !( m_data->discardFlags & DiscardBackground ) )
     {
         // subtract the contents margins
 
-        int left, top, right, bottom;
-        plot->getContentsMargins( &left, &top, &right, &bottom );
-        layoutRect.adjust( left, top, -right, -bottom );
-    }
-
-    QwtPlotLayout *layout = plot->plotLayout();
-
-    int baseLineDists[QwtPlot::axisCnt];
-    int canvasMargins[QwtPlot::axisCnt];
-
-    for ( int axisId = 0; axisId < QwtPlot::axisCnt; axisId++ )
-    {
-        canvasMargins[ axisId ] = layout->canvasMargin( axisId );
-
-        if ( d_data->layoutFlags & FrameWithScales )
-        {
-            QwtScaleWidget *scaleWidget = plot->axisWidget( axisId );
+        const QMargins m = plot->contentsMargins();
+        layoutRect.adjust( m.left(), m.top(), -m.right(), -m.bottom() );
+    }
+
+    QwtPlotLayout* layout = plot->plotLayout();
+
+    int baseLineDists[QwtAxis::AxisPositions];
+    int canvasMargins[QwtAxis::AxisPositions];
+
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
+        canvasMargins[axisPos] = layout->canvasMargin( axisPos );
+
+        if ( m_data->layoutFlags & FrameWithScales )
+        {
+            const QwtAxisId axisId( axisPos );
+
+            QwtScaleWidget* scaleWidget = plot->axisWidget( axisId );
             if ( scaleWidget )
             {
-                baseLineDists[axisId] = scaleWidget->margin();
+                baseLineDists[axisPos] = scaleWidget->margin();
                 scaleWidget->setMargin( 0 );
             }
 
-            if ( !plot->axisEnabled( axisId ) )
+            if ( !plot->isAxisVisible( axisId ) )
             {
                 // When we have a scale the frame is painted on
@@ -515,20 +538,26 @@
                 // need to introduce a margin around the canvas
 
-                switch( axisId )
+                const qreal fw = qwtScalePenWidth( plot );
+
+                switch( axisPos )
                 {
-                    case QwtPlot::yLeft:
-                        layoutRect.adjust( 1, 0, 0, 0 );
+                    case QwtAxis::YLeft:
+                        layoutRect.adjust( fw, 0, 0, 0 );
                         break;
-                    case QwtPlot::yRight:
-                        layoutRect.adjust( 0, 0, -1, 0 );
+
+                    case QwtAxis::YRight:
+                        layoutRect.adjust( 0, 0, -fw, 0 );
                         break;
-                    case QwtPlot::xTop:
-                        layoutRect.adjust( 0, 1, 0, 0 );
+
+                    case QwtAxis::XTop:
+                        layoutRect.adjust( 0, fw, 0, 0 );
                         break;
-                    case QwtPlot::xBottom:
-                        layoutRect.adjust( 0, 0, 0, -1 );
+
+                    case QwtAxis::XBottom:
+                        layoutRect.adjust( 0, 0, 0, -fw );
                         break;
+
                     default:
-                        break;
+                        ;
                 }
             }
@@ -540,17 +569,17 @@
     QwtPlotLayout::Options layoutOptions = QwtPlotLayout::IgnoreScrollbars;
 
-    if ( ( d_data->layoutFlags & FrameWithScales ) ||
-        ( d_data->discardFlags & DiscardCanvasFrame ) )
+    if ( ( m_data->layoutFlags & FrameWithScales ) ||
+        ( m_data->discardFlags & DiscardCanvasFrame ) )
     {
         layoutOptions |= QwtPlotLayout::IgnoreFrames;
     }
 
-    if ( d_data->discardFlags & DiscardLegend )
+    if ( m_data->discardFlags & DiscardLegend )
         layoutOptions |= QwtPlotLayout::IgnoreLegend;
 
-    if ( d_data->discardFlags & DiscardTitle )
+    if ( m_data->discardFlags & DiscardTitle )
         layoutOptions |= QwtPlotLayout::IgnoreTitle;
 
-    if ( d_data->discardFlags & DiscardFooter )
+    if ( m_data->discardFlags & DiscardFooter )
         layoutOptions |= QwtPlotLayout::IgnoreFooter;
 
@@ -559,5 +588,5 @@
     // canvas
 
-    QwtScaleMap maps[QwtPlot::axisCnt];
+    QwtScaleMap maps[QwtAxis::AxisPositions];
     buildCanvasMaps( plot, layout->canvasRect(), maps );
     if ( updateCanvasMargins( plot, layout->canvasRect(), maps ) )
@@ -577,5 +606,5 @@
     renderCanvas( plot, painter, layout->canvasRect(), maps );
 
-    if ( !( d_data->discardFlags & DiscardTitle )
+    if ( !( m_data->discardFlags & DiscardTitle )
         && ( !plot->titleLabel()->text().isEmpty() ) )
     {
@@ -583,5 +612,5 @@
     }
 
-    if ( !( d_data->discardFlags & DiscardFooter )
+    if ( !( m_data->discardFlags & DiscardFooter )
         && ( !plot->footerLabel()->text().isEmpty() ) )
     {
@@ -589,5 +618,5 @@
     }
 
-    if ( !( d_data->discardFlags & DiscardLegend )
+    if ( !( m_data->discardFlags & DiscardLegend )
         && plot->legend() && !plot->legend()->isEmpty() )
     {
@@ -595,16 +624,20 @@
     }
 
-    for ( int axisId = 0; axisId < QwtPlot::axisCnt; axisId++ )
-    {
-        QwtScaleWidget *scaleWidget = plot->axisWidget( axisId );
-        if ( scaleWidget )
-        {
-            int baseDist = scaleWidget->margin();
-
-            int startDist, endDist;
-            scaleWidget->getBorderDistHint( startDist, endDist );
-
-            renderScale( plot, painter, axisId, startDist, endDist,
-                baseDist, layout->scaleRect( axisId ) );
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
+        {
+            const QwtAxisId axisId( axisPos );
+
+            QwtScaleWidget* scaleWidget = plot->axisWidget( axisId );
+            if ( scaleWidget )
+            {
+                int baseDist = scaleWidget->margin();
+
+                int startDist, endDist;
+                scaleWidget->getBorderDistHint( startDist, endDist );
+
+                renderScale( plot, painter, axisId, startDist, endDist,
+                    baseDist, layout->scaleRect( axisId ) );
+            }
         }
     }
@@ -613,14 +646,16 @@
 
     // restore all setting to their original attributes.
-    for ( int axisId = 0; axisId < QwtPlot::axisCnt; axisId++ )
-    {
-        if ( d_data->layoutFlags & FrameWithScales )
-        {
-            QwtScaleWidget *scaleWidget = plot->axisWidget( axisId );
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
+        if ( m_data->layoutFlags & FrameWithScales )
+        {
+            const QwtAxisId axisId( axisPos );
+
+            QwtScaleWidget* scaleWidget = plot->axisWidget( axisId );
             if ( scaleWidget  )
-                scaleWidget->setMargin( baseLineDists[axisId] );
-        }
-
-        layout->setCanvasMargin( canvasMargins[axisId] );
+                scaleWidget->setMargin( baseLineDists[axisPos] );
+        }
+
+        layout->setCanvasMargin( canvasMargins[axisPos] );
     }
 
@@ -630,17 +665,17 @@
 
 /*!
-  Render the title into a given rectangle.
-
-  \param plot Plot widget
-  \param painter Painter
-  \param titleRect Bounding rectangle for the title
-*/
-void QwtPlotRenderer::renderTitle( const QwtPlot *plot,
-    QPainter *painter, const QRectF &titleRect ) const
+   Render the title into a given rectangle.
+
+   \param plot Plot widget
+   \param painter Painter
+   \param titleRect Bounding rectangle for the title
+ */
+void QwtPlotRenderer::renderTitle( const QwtPlot* plot,
+    QPainter* painter, const QRectF& titleRect ) const
 {
     painter->setFont( qwtResolvedFont( plot->titleLabel() ) );
 
     const QColor color = plot->titleLabel()->palette().color(
-            QPalette::Active, QPalette::Text );
+        QPalette::Active, QPalette::Text );
 
     painter->setPen( color );
@@ -649,17 +684,17 @@
 
 /*!
-  Render the footer into a given rectangle.
-
-  \param plot Plot widget
-  \param painter Painter
-  \param footerRect Bounding rectangle for the footer
-*/
-void QwtPlotRenderer::renderFooter( const QwtPlot *plot,
-    QPainter *painter, const QRectF &footerRect ) const
+   Render the footer into a given rectangle.
+
+   \param plot Plot widget
+   \param painter Painter
+   \param footerRect Bounding rectangle for the footer
+ */
+void QwtPlotRenderer::renderFooter( const QwtPlot* plot,
+    QPainter* painter, const QRectF& footerRect ) const
 {
     painter->setFont( qwtResolvedFont( plot->footerLabel() ) );
 
     const QColor color = plot->footerLabel()->palette().color(
-            QPalette::Active, QPalette::Text );
+        QPalette::Active, QPalette::Text );
 
     painter->setPen( color );
@@ -668,16 +703,16 @@
 
 /*!
-  Render the legend into a given rectangle.
-
-  \param plot Plot widget
-  \param painter Painter
-  \param legendRect Bounding rectangle for the legend
-*/
-void QwtPlotRenderer::renderLegend( const QwtPlot *plot,
-    QPainter *painter, const QRectF &legendRect ) const
+   Render the legend into a given rectangle.
+
+   \param plot Plot widget
+   \param painter Painter
+   \param legendRect Bounding rectangle for the legend
+ */
+void QwtPlotRenderer::renderLegend( const QwtPlot* plot,
+    QPainter* painter, const QRectF& legendRect ) const
 {
     if ( plot->legend() )
     {
-        bool fillBackground = !( d_data->discardFlags & DiscardBackground );
+        bool fillBackground = !( m_data->discardFlags & DiscardBackground );
         plot->legend()->renderLegend( painter, legendRect, fillBackground );
     }
@@ -685,24 +720,23 @@
 
 /*!
-  \brief Paint a scale into a given rectangle.
-  Paint the scale into a given rectangle.
-
-  \param plot Plot widget
-  \param painter Painter
-  \param axisId Axis
-  \param startDist Start border distance
-  \param endDist End border distance
-  \param baseDist Base distance
-  \param scaleRect Bounding rectangle for the scale
-*/
-void QwtPlotRenderer::renderScale( const QwtPlot *plot,
-    QPainter *painter,
-    int axisId, int startDist, int endDist, int baseDist,
-    const QRectF &scaleRect ) const
-{
-    if ( !plot->axisEnabled( axisId ) )
+   \brief Paint a scale into a given rectangle.
+   Paint the scale into a given rectangle.
+
+   \param plot Plot widget
+   \param painter Painter
+   \param axisId Axis
+   \param startDist Start border distance
+   \param endDist End border distance
+   \param baseDist Base distance
+   \param scaleRect Bounding rectangle for the scale
+ */
+void QwtPlotRenderer::renderScale( const QwtPlot* plot, QPainter* painter,
+    QwtAxisId axisId, int startDist, int endDist, int baseDist,
+    const QRectF& scaleRect ) const
+{
+    if ( !plot->isAxisVisible( axisId ) )
         return;
 
-    const QwtScaleWidget *scaleWidget = plot->axisWidget( axisId );
+    const QwtScaleWidget* scaleWidget = plot->axisWidget( axisId );
     if ( scaleWidget->isColorBarEnabled()
         && scaleWidget->colorBarWidth() > 0 )
@@ -717,9 +751,13 @@
     double x, y, w;
 
+    qreal off = 0.0;
+    if ( m_data->layoutFlags & FrameWithScales )
+        off = qwtScalePenWidth( plot );
+
     switch ( axisId )
     {
-        case QwtPlot::yLeft:
-        {
-            x = scaleRect.right() - 1.0 - baseDist;
+        case QwtAxis::YLeft:
+        {
+            x = scaleRect.right() - 1.0 - baseDist - off;
             y = scaleRect.y() + startDist;
             w = scaleRect.height() - startDist - endDist;
@@ -727,7 +765,7 @@
             break;
         }
-        case QwtPlot::yRight:
-        {
-            x = scaleRect.left() + baseDist;
+        case QwtAxis::YRight:
+        {
+            x = scaleRect.left() + baseDist + off;
             y = scaleRect.y() + startDist;
             w = scaleRect.height() - startDist - endDist;
@@ -735,16 +773,16 @@
             break;
         }
-        case QwtPlot::xTop:
+        case QwtAxis::XTop:
         {
             x = scaleRect.left() + startDist;
-            y = scaleRect.bottom() - 1.0 - baseDist;
+            y = scaleRect.bottom() - 1.0 - baseDist - off;
             w = scaleRect.width() - startDist - endDist;
             align = QwtScaleDraw::TopScale;
             break;
         }
-        case QwtPlot::xBottom:
+        case QwtAxis::XBottom:
         {
             x = scaleRect.left() + startDist;
-            y = scaleRect.top() + baseDist;
+            y = scaleRect.top() + baseDist + off;
             w = scaleRect.width() - startDist - endDist;
             align = QwtScaleDraw::BottomScale;
@@ -759,7 +797,12 @@
     painter->setFont( qwtResolvedFont( scaleWidget ) );
 
-    QwtScaleDraw *sd = const_cast<QwtScaleDraw *>( scaleWidget->scaleDraw() );
+    QwtScaleDraw* sd = const_cast< QwtScaleDraw* >( scaleWidget->scaleDraw() );
     const QPointF sdPos = sd->pos();
     const double sdLength = sd->length();
+
+    const bool hasBackbone = sd->hasComponent( QwtAbstractScaleDraw::Backbone );
+
+    if ( m_data->layoutFlags & FrameWithScales )
+        sd->enableComponent( QwtAbstractScaleDraw::Backbone, false );
 
     sd->move( x, y );
@@ -773,4 +816,5 @@
     sd->move( sdPos );
     sd->setLength( sdLength );
+    sd->enableComponent( QwtAbstractScaleDraw::Backbone, hasBackbone );
 
     painter->restore();
@@ -778,27 +822,34 @@
 
 /*!
-  Render the canvas into a given rectangle.
-
-  \param plot Plot widget
-  \param painter Painter
-  \param maps Maps mapping between plot and paint device coordinates
-  \param canvasRect Canvas rectangle
-*/
-void QwtPlotRenderer::renderCanvas( const QwtPlot *plot,
-    QPainter *painter, const QRectF &canvasRect,
-    const QwtScaleMap *maps ) const
-{
-    const QWidget *canvas = plot->canvas();
+   Render the canvas into a given rectangle.
+
+   \param plot Plot widget
+   \param painter Painter
+   \param maps Maps mapping between plot and paint device coordinates
+   \param canvasRect Canvas rectangle
+ */
+void QwtPlotRenderer::renderCanvas( const QwtPlot* plot,
+    QPainter* painter, const QRectF& canvasRect,
+    const QwtScaleMap* maps ) const
+{
+    const QWidget* canvas = plot->canvas();
 
     QRectF r = canvasRect.adjusted( 0.0, 0.0, -1.0, -1.0 );
 
-    if ( d_data->layoutFlags & FrameWithScales )
+    if ( m_data->layoutFlags & FrameWithScales )
     {
         painter->save();
 
-        r.adjust( -1.0, -1.0, 1.0, 1.0 );
-        painter->setPen( QPen( Qt::black ) );
-
-        if ( !( d_data->discardFlags & DiscardCanvasBackground ) )
+        QPen pen;
+        pen.setColor( qwtScalePenColor( plot ) );
+        pen.setWidth( qwtScalePenWidth( plot ) );
+        pen.setJoinStyle( Qt::MiterJoin );
+
+        painter->setPen( pen );
+
+        const qreal pw2 = 0.5 * pen.widthF();
+        r.adjust( -pw2, -pw2, pw2, pw2 );
+
+        if ( !( m_data->discardFlags & DiscardCanvasBackground ) )
         {
             const QBrush bgBrush =
@@ -823,5 +874,5 @@
         painter->save();
 
-        if ( !( d_data->discardFlags & DiscardCanvasBackground ) )
+        if ( !( m_data->discardFlags & DiscardCanvasBackground ) )
         {
             QwtPainter::drawBackgound( painter, r, canvas );
@@ -845,11 +896,11 @@
         QPainterPath clipPath;
 
-        int frameWidth = 0;
-
-        if ( !( d_data->discardFlags & DiscardCanvasFrame ) )
+        double frameWidth = 0.0;
+
+        if ( !( m_data->discardFlags & DiscardCanvasFrame ) )
         {
             const QVariant fw = canvas->property( "frameWidth" );
-            if ( fw.type() == QVariant::Int )
-                frameWidth = fw.toInt();
+            if ( fw.canConvert< double >() )
+                frameWidth = fw.value< double >();
 
             clipPath = qwtCanvasClip( canvas, canvasRect );
@@ -870,5 +921,5 @@
         }
 
-        if ( !( d_data->discardFlags & DiscardCanvasBackground ) )
+        if ( !( m_data->discardFlags & DiscardCanvasBackground ) )
         {
             QwtPainter::drawBackgound( painter, innerRect, canvas );
@@ -888,8 +939,8 @@
 
             const QVariant borderRadius = canvas->property( "borderRadius" );
-            if ( borderRadius.type() == QVariant::Double
-                && borderRadius.toDouble() > 0.0 )
+            if ( borderRadius.canConvert< double >()
+                && borderRadius.value< double >() > 0.0 )
             {
-                const double radius = borderRadius.toDouble();
+                const double radius = borderRadius.value< double >();
 
                 QwtPainter::drawRoundedFrame( painter, canvasRect,
@@ -915,70 +966,77 @@
    \param canvasRect Target rectangle
    \param maps Scale maps to be calculated
-*/
-void QwtPlotRenderer::buildCanvasMaps( const QwtPlot *plot,
-    const QRectF &canvasRect, QwtScaleMap maps[] ) const
-{
-    for ( int axisId = 0; axisId < QwtPlot::axisCnt; axisId++ )
-    {
-        maps[axisId].setTransformation(
-            plot->axisScaleEngine( axisId )->transformation() );
-
-        const QwtScaleDiv &scaleDiv = plot->axisScaleDiv( axisId );
-        maps[axisId].setScaleInterval(
-            scaleDiv.lowerBound(), scaleDiv.upperBound() );
-
-        double from, to;
-        if ( plot->axisEnabled( axisId ) )
-        {
-            const int sDist = plot->axisWidget( axisId )->startBorderDist();
-            const int eDist = plot->axisWidget( axisId )->endBorderDist();
-            const QRectF scaleRect = plot->plotLayout()->scaleRect( axisId );
-
-            if ( axisId == QwtPlot::xTop || axisId == QwtPlot::xBottom )
+ */
+void QwtPlotRenderer::buildCanvasMaps( const QwtPlot* plot,
+    const QRectF& canvasRect, QwtScaleMap maps[] ) const
+{
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
+        {
+            const QwtAxisId axisId( axisPos );
+
+            QwtScaleMap& scaleMap = maps[axisId];
+
+            scaleMap.setTransformation(
+                plot->axisScaleEngine( axisId )->transformation() );
+
+            const QwtScaleDiv& scaleDiv = plot->axisScaleDiv( axisId );
+            scaleMap.setScaleInterval(
+                scaleDiv.lowerBound(), scaleDiv.upperBound() );
+
+            double from, to;
+            if ( plot->isAxisVisible( axisId ) )
             {
-                from = scaleRect.left() + sDist;
-                to = scaleRect.right() - eDist;
+                const int sDist = plot->axisWidget( axisId )->startBorderDist();
+                const int eDist = plot->axisWidget( axisId )->endBorderDist();
+                const QRectF scaleRect = plot->plotLayout()->scaleRect( axisId );
+
+                if ( QwtAxis::isXAxis( axisPos ) )
+                {
+                    from = scaleRect.left() + sDist;
+                    to = scaleRect.right() - eDist;
+                }
+                else
+                {
+                    from = scaleRect.bottom() - eDist;
+                    to = scaleRect.top() + sDist;
+                }
             }
             else
             {
-                from = scaleRect.bottom() - eDist;
-                to = scaleRect.top() + sDist;
+                int margin = 0;
+                if ( !plot->plotLayout()->alignCanvasToScale( axisPos ) )
+                    margin = plot->plotLayout()->canvasMargin( axisPos );
+
+                if ( QwtAxis::isYAxis( axisPos ) )
+                {
+                    from = canvasRect.bottom() - margin;
+                    to = canvasRect.top() + margin;
+                }
+                else
+                {
+                    from = canvasRect.left() + margin;
+                    to = canvasRect.right() - margin;
+                }
             }
-        }
-        else
-        {
-            int margin = 0;
-            if ( !plot->plotLayout()->alignCanvasToScale( axisId ) )
-                margin = plot->plotLayout()->canvasMargin( axisId );
-
-            if ( axisId == QwtPlot::yLeft || axisId == QwtPlot::yRight )
-            {
-                from = canvasRect.bottom() - margin;
-                to = canvasRect.top() + margin;
-            }
-            else
-            {
-                from = canvasRect.left() + margin;
-                to = canvasRect.right() - margin;
-            }
-        }
-        maps[axisId].setPaintInterval( from, to );
-    }
-}
-
-bool QwtPlotRenderer::updateCanvasMargins( QwtPlot *plot,
-    const QRectF &canvasRect, const QwtScaleMap maps[] ) const
-{
-    double margins[QwtPlot::axisCnt];
+            scaleMap.setPaintInterval( from, to );
+        }
+    }
+}
+
+bool QwtPlotRenderer::updateCanvasMargins( QwtPlot* plot,
+    const QRectF& canvasRect, const QwtScaleMap maps[] ) const
+{
+    using namespace QwtAxis;
+
+    double margins[AxisPositions];
     plot->getCanvasMarginsHint( maps, canvasRect,
-        margins[QwtPlot::yLeft], margins[QwtPlot::xTop],
-        margins[QwtPlot::yRight], margins[QwtPlot::xBottom] );
+        margins[YLeft], margins[XTop], margins[YRight], margins[XBottom] );
 
     bool marginsChanged = false;
-    for ( int axisId = 0; axisId < QwtPlot::axisCnt; axisId++ )
+    for ( int axisId = 0; axisId < AxisPositions; axisId++ )
     {
         if ( margins[axisId] >= 0.0 )
         {
-            const int m = qCeil( margins[axisId] );
+            const int m = qwtCeil( margins[axisId] );
             plot->plotLayout()->setCanvasMargin( m, axisId);
             marginsChanged = true;
@@ -999,7 +1057,7 @@
    \return True, when exporting was successful
    \sa renderDocument()
-*/
-bool QwtPlotRenderer::exportTo( QwtPlot *plot, const QString &documentName,
-     const QSizeF &sizeMM, int resolution )
+ */
+bool QwtPlotRenderer::exportTo( QwtPlot* plot, const QString& documentName,
+    const QSizeF& sizeMM, int resolution )
 {
     if ( plot == NULL )
@@ -1011,5 +1069,5 @@
 
 #ifndef QT_NO_FILEDIALOG
-    const QList<QByteArray> imageFormats =
+    const QList< QByteArray > imageFormats =
         QImageWriter::supportedImageFormats();
 
@@ -1052,2 +1110,4 @@
     return true;
 }
+
+#include "moc_qwt_plot_renderer.cpp"
Index: /trunk/BNC/qwt/qwt_plot_renderer.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_renderer.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_renderer.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,4 +12,6 @@
 
 #include "qwt_global.h"
+#include "qwt_axis_id.h"
+
 #include <qobject.h>
 #include <qsize.h>
@@ -34,11 +36,11 @@
     \brief Renderer for exporting a plot to a document, a printer
            or anything else, that is supported by QPainter/QPaintDevice
-*/
-class QWT_EXPORT QwtPlotRenderer: public QObject
+ */
+class QWT_EXPORT QwtPlotRenderer : public QObject
 {
     Q_OBJECT
 
-public:
-    //! Disard flags
+  public:
+    //! Discard flags
     enum DiscardFlag
     {
@@ -72,6 +74,5 @@
     };
 
-    //! Disard flags
-    typedef QFlags<DiscardFlag> DiscardFlags;
+    Q_DECLARE_FLAGS( DiscardFlags, DiscardFlag )
 
     /*!
@@ -85,14 +86,13 @@
 
         /*!
-          Instead of the scales a box is painted around the plot canvas,
-          where the scale ticks are aligned to.
+           Instead of the scales a box is painted around the plot canvas,
+           where the scale ticks are aligned to.
          */
         FrameWithScales = 0x01
     };
 
-    //! Layout flags
-    typedef QFlags<LayoutFlag> LayoutFlags;
+    Q_DECLARE_FLAGS( LayoutFlags, LayoutFlag )
 
-    explicit QwtPlotRenderer( QObject * = NULL );
+    explicit QwtPlotRenderer( QObject* = NULL );
     virtual ~QwtPlotRenderer();
 
@@ -109,58 +109,56 @@
     LayoutFlags layoutFlags() const;
 
-    void renderDocument( QwtPlot *, const QString &fileName,
-        const QSizeF &sizeMM, int resolution = 85 );
+    void renderDocument( QwtPlot*, const QString& fileName,
+        const QSizeF& sizeMM, int resolution = 85 );
 
-    void renderDocument( QwtPlot *,
-        const QString &fileName, const QString &format,
-        const QSizeF &sizeMM, int resolution = 85 );
+    void renderDocument( QwtPlot*,
+        const QString& fileName, const QString& format,
+        const QSizeF& sizeMM, int resolution = 85 );
 
 #ifndef QWT_NO_SVG
 #ifdef QT_SVG_LIB
-#if QT_VERSION >= 0x040500
-    void renderTo( QwtPlot *, QSvgGenerator & ) const;
-#endif
+    void renderTo( QwtPlot*, QSvgGenerator& ) const;
 #endif
 #endif
 
 #ifndef QT_NO_PRINTER
-    void renderTo( QwtPlot *, QPrinter & ) const;
+    void renderTo( QwtPlot*, QPrinter& ) const;
 #endif
 
-    void renderTo( QwtPlot *, QPaintDevice & ) const;
+    void renderTo( QwtPlot*, QPaintDevice& ) const;
 
-    virtual void render( QwtPlot *,
-        QPainter *, const QRectF &plotRect ) const;
+    virtual void render( QwtPlot*,
+        QPainter*, const QRectF& plotRect ) const;
 
-    virtual void renderTitle( const QwtPlot *,
-        QPainter *, const QRectF &titleRect ) const;
+    virtual void renderTitle( const QwtPlot*,
+        QPainter*, const QRectF& titleRect ) const;
 
-    virtual void renderFooter( const QwtPlot *,
-        QPainter *, const QRectF &footerRect ) const;
+    virtual void renderFooter( const QwtPlot*,
+        QPainter*, const QRectF& footerRect ) const;
 
-    virtual void renderScale( const QwtPlot *, QPainter *,
-        int axisId, int startDist, int endDist,
-        int baseDist, const QRectF &scaleRect ) const;
+    virtual void renderScale( const QwtPlot*, QPainter*,
+        QwtAxisId, int startDist, int endDist,
+        int baseDist, const QRectF& scaleRect ) const;
 
-    virtual void renderCanvas( const QwtPlot *,
-        QPainter *, const QRectF &canvasRect,
+    virtual void renderCanvas( const QwtPlot*,
+        QPainter*, const QRectF& canvasRect,
         const QwtScaleMap* maps ) const;
 
     virtual void renderLegend(
-        const QwtPlot *, QPainter *, const QRectF &legendRect ) const;
+        const QwtPlot*, QPainter*, const QRectF& legendRect ) const;
 
-    bool exportTo( QwtPlot *, const QString &documentName,
-        const QSizeF &sizeMM = QSizeF( 300, 200 ), int resolution = 85 );
+    bool exportTo( QwtPlot*, const QString& documentName,
+        const QSizeF& sizeMM = QSizeF( 300, 200 ), int resolution = 85 );
 
-private:
-    void buildCanvasMaps( const QwtPlot *,
-        const QRectF &, QwtScaleMap maps[] ) const;
+  private:
+    void buildCanvasMaps( const QwtPlot*,
+        const QRectF&, QwtScaleMap maps[] ) const;
 
-    bool updateCanvasMargins( QwtPlot *,
-        const QRectF &, const QwtScaleMap maps[] ) const;
+    bool updateCanvasMargins( QwtPlot*,
+        const QRectF&, const QwtScaleMap maps[] ) const;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_rescaler.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_rescaler.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_rescaler.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,13 +13,13 @@
 #include "qwt_interval.h"
 #include "qwt_plot_canvas.h"
+
 #include <qevent.h>
-#include <qalgorithms.h>
 
 class QwtPlotRescaler::AxisData
 {
-public:
-    AxisData():
-        aspectRatio( 1.0 ),
-        expandingDirection( QwtPlotRescaler::ExpandUp )
+  public:
+    AxisData()
+        : aspectRatio( 1.0 )
+        , expandingDirection( QwtPlotRescaler::ExpandUp )
     {
     }
@@ -33,19 +33,29 @@
 class QwtPlotRescaler::PrivateData
 {
-public:
-    PrivateData():
-        referenceAxis( QwtPlot::xBottom ),
-        rescalePolicy( QwtPlotRescaler::Expanding ),
-        isEnabled( false ),
-        inReplot( 0 )
-    {
-    }
-
-    int referenceAxis;
+  public:
+    PrivateData()
+        : referenceAxis( QwtAxis::XBottom )
+        , rescalePolicy( QwtPlotRescaler::Expanding )
+        , isEnabled( false )
+        , inReplot( 0 )
+    {
+    }
+
+    QwtPlotRescaler::AxisData* axisData( QwtAxisId axisId )
+    {
+        if ( !QwtAxis::isValid( axisId ) )
+            return NULL;
+
+        return &m_axisData[ axisId];
+    }
+
+    QwtAxisId referenceAxis;
     RescalePolicy rescalePolicy;
-    QwtPlotRescaler::AxisData axisData[QwtPlot::axisCnt];
     bool isEnabled;
 
     mutable int inReplot;
+
+  private:
+    QwtPlotRescaler::AxisData m_axisData[QwtAxis::AxisPositions];
 };
 
@@ -58,12 +68,12 @@
 
    \sa setRescalePolicy(), setReferenceAxis()
-*/
-QwtPlotRescaler::QwtPlotRescaler( QWidget *canvas,
-        int referenceAxis, RescalePolicy policy ):
-    QObject( canvas )
-{
-    d_data = new PrivateData;
-    d_data->referenceAxis = referenceAxis;
-    d_data->rescalePolicy = policy;
+ */
+QwtPlotRescaler::QwtPlotRescaler( QWidget* canvas,
+        QwtAxisId referenceAxis, RescalePolicy policy )
+    : QObject( canvas )
+{
+    m_data = new PrivateData;
+    m_data->referenceAxis = referenceAxis;
+    m_data->rescalePolicy = policy;
 
     setEnabled( true );
@@ -73,26 +83,26 @@
 QwtPlotRescaler::~QwtPlotRescaler()
 {
-    delete d_data;
-}
-
-/*!
-  \brief En/disable the rescaler
-
-  When enabled is true an event filter is installed for
-  the canvas, otherwise the event filter is removed.
-
-  \param on true or false
-  \sa isEnabled(), eventFilter()
-*/
+    delete m_data;
+}
+
+/*!
+   \brief En/disable the rescaler
+
+   When enabled is true an event filter is installed for
+   the canvas, otherwise the event filter is removed.
+
+   \param on true or false
+   \sa isEnabled(), eventFilter()
+ */
 void QwtPlotRescaler::setEnabled( bool on )
 {
-    if ( d_data->isEnabled != on )
-    {
-        d_data->isEnabled = on;
-
-        QWidget *w = canvas();
+    if ( m_data->isEnabled != on )
+    {
+        m_data->isEnabled = on;
+
+        QWidget* w = canvas();
         if ( w )
         {
-            if ( d_data->isEnabled )
+            if ( m_data->isEnabled )
                 w->installEventFilter( this );
             else
@@ -103,90 +113,90 @@
 
 /*!
-  \return true when enabled, false otherwise
-  \sa setEnabled, eventFilter()
-*/
+   \return true when enabled, false otherwise
+   \sa setEnabled, eventFilter()
+ */
 bool QwtPlotRescaler::isEnabled() const
 {
-    return d_data->isEnabled;
-}
-
-/*!
-  Change the rescale policy
-
-  \param policy Rescale policy
-  \sa rescalePolicy()
-*/
+    return m_data->isEnabled;
+}
+
+/*!
+   Change the rescale policy
+
+   \param policy Rescale policy
+   \sa rescalePolicy()
+ */
 void QwtPlotRescaler::setRescalePolicy( RescalePolicy policy )
 {
-    d_data->rescalePolicy = policy;
-}
-
-/*!
-  \return Rescale policy
-  \sa setRescalePolicy()
-*/
+    m_data->rescalePolicy = policy;
+}
+
+/*!
+   \return Rescale policy
+   \sa setRescalePolicy()
+ */
 QwtPlotRescaler::RescalePolicy QwtPlotRescaler::rescalePolicy() const
 {
-    return d_data->rescalePolicy;
-}
-
-/*!
-  Set the reference axis ( see RescalePolicy )
-
-  \param axis Axis index ( QwtPlot::Axis )
-  \sa referenceAxis()
-*/
-void QwtPlotRescaler::setReferenceAxis( int axis )
-{
-    d_data->referenceAxis = axis;
-}
-
-/*!
-  \return Reference axis ( see RescalePolicy )
-  \sa setReferenceAxis()
-*/
-int QwtPlotRescaler::referenceAxis() const
-{
-    return d_data->referenceAxis;
-}
-
-/*!
-  Set the direction in which all axis should be expanded
-
-  \param direction Direction
-  \sa expandingDirection()
-*/
+    return m_data->rescalePolicy;
+}
+
+/*!
+   Set the reference axis ( see RescalePolicy )
+
+   \param axisId Axis
+   \sa referenceAxis()
+ */
+void QwtPlotRescaler::setReferenceAxis( QwtAxisId axisId )
+{
+    m_data->referenceAxis = axisId;
+}
+
+/*!
+   \return Reference axis ( see RescalePolicy )
+   \sa setReferenceAxis()
+ */
+QwtAxisId QwtPlotRescaler::referenceAxis() const
+{
+    return m_data->referenceAxis;
+}
+
+/*!
+   Set the direction in which all axis should be expanded
+
+   \param direction Direction
+   \sa expandingDirection()
+ */
 void QwtPlotRescaler::setExpandingDirection(
     ExpandingDirection direction )
 {
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
+    for ( int axis = 0; axis < QwtAxis::AxisPositions; axis++ )
         setExpandingDirection( axis, direction );
 }
 
 /*!
-  Set the direction in which an axis should be expanded
-
-  \param axis Axis index ( see QwtPlot::AxisId )
-  \param direction Direction
-  \sa expandingDirection()
-*/
+   Set the direction in which an axis should be expanded
+
+   \param axisId Axis
+   \param direction Direction
+   \sa expandingDirection()
+ */
 void QwtPlotRescaler::setExpandingDirection(
-    int axis, ExpandingDirection direction )
-{
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        d_data->axisData[axis].expandingDirection = direction;
-}
-
-/*!
-  \return Direction in which an axis should be expanded
-
-  \param axis Axis index ( see QwtPlot::AxisId )
-  \sa setExpandingDirection()
-*/
+    QwtAxisId axisId, ExpandingDirection direction )
+{
+    if ( AxisData* axisData = m_data->axisData( axisId ) )
+        axisData->expandingDirection = direction;
+}
+
+/*!
+   \return Direction in which an axis should be expanded
+
+   \param axisId Axis
+   \sa setExpandingDirection()
+ */
 QwtPlotRescaler::ExpandingDirection
-QwtPlotRescaler::expandingDirection( int axis ) const
-{
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        return d_data->axisData[axis].expandingDirection;
+QwtPlotRescaler::expandingDirection( QwtAxisId axisId ) const
+{
+    if ( const AxisData* axisData = m_data->axisData( axisId ) )
+        return axisData->expandingDirection;
 
     return ExpandBoth;
@@ -194,43 +204,45 @@
 
 /*!
-  Set the aspect ratio between the scale of the reference axis
-  and the other scales. The default ratio is 1.0
-
-  \param ratio Aspect ratio
-  \sa aspectRatio()
-*/
+   Set the aspect ratio between the scale of the reference axis
+   and the other scales. The default ratio is 1.0
+
+   \param ratio Aspect ratio
+   \sa aspectRatio()
+ */
 void QwtPlotRescaler::setAspectRatio( double ratio )
 {
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
+    for ( int axis = 0; axis < QwtAxis::AxisPositions; axis++ )
         setAspectRatio( axis, ratio );
 }
 
 /*!
-  Set the aspect ratio between the scale of the reference axis
-  and another scale. The default ratio is 1.0
-
-  \param axis Axis index ( see QwtPlot::AxisId )
-  \param ratio Aspect ratio
-  \sa aspectRatio()
-*/
-void QwtPlotRescaler::setAspectRatio( int axis, double ratio )
-{
-    if ( ratio < 0.0 )
-        ratio = 0.0;
-
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        d_data->axisData[axis].aspectRatio = ratio;
-}
-
-/*!
-  \return Aspect ratio between an axis and the reference axis.
-
-  \param axis Axis index ( see QwtPlot::AxisId )
-  \sa setAspectRatio()
-*/
-double QwtPlotRescaler::aspectRatio( int axis ) const
-{
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        return d_data->axisData[axis].aspectRatio;
+   Set the aspect ratio between the scale of the reference axis
+   and another scale. The default ratio is 1.0
+
+   \param axisId Axis
+   \param ratio Aspect ratio
+   \sa aspectRatio()
+ */
+void QwtPlotRescaler::setAspectRatio( QwtAxisId axisId, double ratio )
+{
+    if ( AxisData* axisData = m_data->axisData( axisId ) )
+    {
+        if ( ratio < 0.0 )
+            ratio = 0.0;
+
+        axisData->aspectRatio = ratio;
+    }
+}
+
+/*!
+   \return Aspect ratio between an axis and the reference axis.
+
+   \param axisId Axis
+   \sa setAspectRatio()
+ */
+double QwtPlotRescaler::aspectRatio( QwtAxisId axisId ) const
+{
+    if ( AxisData* axisData = m_data->axisData( axisId ) )
+        return axisData->aspectRatio;
 
     return 0.0;
@@ -238,29 +250,29 @@
 
 /*!
-  Set an interval hint for an axis
-
-  In Fitting mode, the hint is used as minimal interval
-  that always needs to be displayed.
-
-  \param axis Axis, see QwtPlot::Axis
-  \param interval Axis
-  \sa intervalHint(), RescalePolicy
-*/
-void QwtPlotRescaler::setIntervalHint( int axis,
-    const QwtInterval &interval )
-{
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        d_data->axisData[axis].intervalHint = interval;
-}
-
-/*!
-  \param axis Axis, see QwtPlot::Axis
-  \return Interval hint
-  \sa setIntervalHint(), RescalePolicy
-*/
-QwtInterval QwtPlotRescaler::intervalHint( int axis ) const
-{
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        return d_data->axisData[axis].intervalHint;
+   Set an interval hint for an axis
+
+   In Fitting mode, the hint is used as minimal interval
+   that always needs to be displayed.
+
+   \param axisId Axis
+   \param interval Axis
+   \sa intervalHint(), RescalePolicy
+ */
+void QwtPlotRescaler::setIntervalHint( QwtAxisId axisId,
+    const QwtInterval& interval )
+{
+    if ( AxisData* axisData = m_data->axisData( axisId ) )
+        axisData->intervalHint = interval;
+}
+
+/*!
+   \param axisId Axis
+   \return Interval hint
+   \sa setIntervalHint(), RescalePolicy
+ */
+QwtInterval QwtPlotRescaler::intervalHint( QwtAxisId axisId ) const
+{
+    if ( AxisData* axisData = m_data->axisData( axisId ) )
+        return axisData->intervalHint;
 
     return QwtInterval();
@@ -268,37 +280,37 @@
 
 //! \return plot canvas
-QWidget *QwtPlotRescaler::canvas()
-{
-    return qobject_cast<QWidget *>( parent() );
+QWidget* QwtPlotRescaler::canvas()
+{
+    return qobject_cast< QWidget* >( parent() );
 }
 
 //! \return plot canvas
-const QWidget *QwtPlotRescaler::canvas() const
-{
-    return qobject_cast<const QWidget *>( parent() );
+const QWidget* QwtPlotRescaler::canvas() const
+{
+    return qobject_cast< const QWidget* >( parent() );
 }
 
 //! \return plot widget
-QwtPlot *QwtPlotRescaler::plot()
-{
-    QWidget *w = canvas();
+QwtPlot* QwtPlotRescaler::plot()
+{
+    QWidget* w = canvas();
     if ( w )
         w = w->parentWidget();
 
-    return qobject_cast<QwtPlot *>( w );
+    return qobject_cast< QwtPlot* >( w );
 }
 
 //! \return plot widget
-const QwtPlot *QwtPlotRescaler::plot() const
-{
-    const QWidget *w = canvas();
+const QwtPlot* QwtPlotRescaler::plot() const
+{
+    const QWidget* w = canvas();
     if ( w )
         w = w->parentWidget();
 
-    return qobject_cast<const QwtPlot *>( w );
+    return qobject_cast< const QwtPlot* >( w );
 }
 
 //!  Event filter for the plot canvas
-bool QwtPlotRescaler::eventFilter( QObject *object, QEvent *event )
+bool QwtPlotRescaler::eventFilter( QObject* object, QEvent* event )
 {
     if ( object && object == canvas() )
@@ -308,5 +320,5 @@
             case QEvent::Resize:
             {
-                canvasResizeEvent( static_cast<QResizeEvent *>( event ) );
+                canvasResizeEvent( static_cast< QResizeEvent* >( event ) );
                 break;
             }
@@ -324,15 +336,13 @@
 
 /*!
-  Event handler for resize events of the plot canvas
-
-  \param event Resize event
-  \sa rescale()
-*/
+   Event handler for resize events of the plot canvas
+
+   \param event Resize event
+   \sa rescale()
+ */
 void QwtPlotRescaler::canvasResizeEvent( QResizeEvent* event )
 {
-    int left, top, right, bottom;
-    canvas()->getContentsMargins( &left, &top, &right, &bottom );
-
-    const QSize marginSize( left + right, top + bottom );
+    const QMargins m = canvas()->contentsMargins();
+    const QSize marginSize( m.left() + m.right(), m.top() + m.bottom() );
 
     const QSize newSize = event->size() - marginSize;
@@ -354,22 +364,29 @@
    \param oldSize Previous size of the canvas
    \param newSize New size of the canvas
-*/
+ */
 void QwtPlotRescaler::rescale(
-    const QSize &oldSize, const QSize &newSize ) const
+    const QSize& oldSize, const QSize& newSize ) const
 {
     if ( newSize.isEmpty() )
         return;
 
-    QwtInterval intervals[QwtPlot::axisCnt];
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-        intervals[axis] = interval( axis );
-
-    const int refAxis = referenceAxis();
+    QwtInterval intervals[QwtAxis::AxisPositions];
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
+        const QwtAxisId axisId( axisPos );
+        intervals[axisPos] = interval( axisId );
+    }
+
+    const QwtAxisId refAxis = referenceAxis();
     intervals[refAxis] = expandScale( refAxis, oldSize, newSize );
 
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-    {
-        if ( aspectRatio( axis ) > 0.0 && axis != refAxis )
-            intervals[axis] = syncScale( axis, intervals[refAxis], newSize );
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
+        const QwtAxisId axisId( axisPos );
+        if ( aspectRatio( axisId ) > 0.0 && axisId != refAxis )
+        {
+            intervals[axisPos] = syncScale(
+                axisId, intervals[refAxis], newSize );
+        }
     }
 
@@ -378,16 +395,16 @@
 
 /*!
-  Calculate the new scale interval of a plot axis
-
-  \param axis Axis index ( see QwtPlot::AxisId )
-  \param oldSize Previous size of the canvas
-  \param newSize New size of the canvas
-
-  \return Calculated new interval for the axis
-*/
-QwtInterval QwtPlotRescaler::expandScale( int axis,
-        const QSize &oldSize, const QSize &newSize ) const
-{
-    const QwtInterval oldInterval = interval( axis );
+   Calculate the new scale interval of a plot axis
+
+   \param axisId Axis
+   \param oldSize Previous size of the canvas
+   \param newSize New size of the canvas
+
+   \return Calculated new interval for the axis
+ */
+QwtInterval QwtPlotRescaler::expandScale( QwtAxisId axisId,
+    const QSize& oldSize, const QSize& newSize ) const
+{
+    const QwtInterval oldInterval = interval( axisId );
 
     QwtInterval expanded = oldInterval;
@@ -403,5 +420,5 @@
             {
                 double width = oldInterval.width();
-                if ( orientation( axis ) == Qt::Horizontal )
+                if ( orientation( axisId ) == Qt::Horizontal )
                     width *= double( newSize.width() ) / oldSize.width();
                 else
@@ -409,5 +426,5 @@
 
                 expanded = expandInterval( oldInterval,
-                    width, expandingDirection( axis ) );
+                    width, expandingDirection( axisId ) );
             }
             break;
@@ -416,7 +433,8 @@
         {
             double dist = 0.0;
-            for ( int ax = 0; ax < QwtPlot::axisCnt; ax++ )
+            for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
             {
-                const double d = pixelDist( ax, newSize );
+                const QwtAxisId axisId( axisPos );
+                const double d = pixelDist( axisId, newSize );
                 if ( d > dist )
                     dist = d;
@@ -425,11 +443,11 @@
             {
                 double width;
-                if ( orientation( axis ) == Qt::Horizontal )
+                if ( orientation( axisId ) == Qt::Horizontal )
                     width = newSize.width() * dist;
                 else
                     width = newSize.height() * dist;
 
-                expanded = expandInterval( intervalHint( axis ),
-                    width, expandingDirection( axis ) );
+                expanded = expandInterval( intervalHint( axisId ),
+                    width, expandingDirection( axisId ) );
             }
             break;
@@ -441,14 +459,14 @@
 
 /*!
-  Synchronize an axis scale according to the scale of the reference axis
-
-  \param axis Axis index ( see QwtPlot::AxisId )
-  \param reference Interval of the reference axis
-  \param size Size of the canvas
-
-  \return New interval for axis
-*/
-QwtInterval QwtPlotRescaler::syncScale( int axis,
-    const QwtInterval& reference, const QSize &size ) const
+   Synchronize an axis scale according to the scale of the reference axis
+
+   \param axisId Axis
+   \param reference Interval of the reference axis
+   \param size Size of the canvas
+
+   \return New interval for axis
+ */
+QwtInterval QwtPlotRescaler::syncScale( QwtAxisId axisId,
+    const QwtInterval& reference, const QSize& size ) const
 {
     double dist;
@@ -458,18 +476,18 @@
         dist = reference.width() / size.height();
 
-    if ( orientation( axis ) == Qt::Horizontal )
+    if ( orientation( axisId ) == Qt::Horizontal )
         dist *= size.width();
     else
         dist *= size.height();
 
-    dist /= aspectRatio( axis );
+    dist /= aspectRatio( axisId );
 
     QwtInterval intv;
     if ( rescalePolicy() == Fitting )
-        intv = intervalHint( axis );
+        intv = intervalHint( axisId );
     else
-        intv = interval( axis );
-
-    intv = expandInterval( intv, dist, expandingDirection( axis ) );
+        intv = interval( axisId );
+
+    intv = expandInterval( intv, dist, expandingDirection( axisId ) );
 
     return intv;
@@ -477,38 +495,35 @@
 
 /*!
-  \return Orientation of an axis
-  \param axis Axis index ( see QwtPlot::AxisId )
-*/
-Qt::Orientation QwtPlotRescaler::orientation( int axis ) const
-{
-    if ( axis == QwtPlot::yLeft || axis == QwtPlot::yRight )
-        return Qt::Vertical;
-
-    return Qt::Horizontal;
-}
-
-/*!
-  \param axis Axis index ( see QwtPlot::AxisId )
-  \return Normalized interval of an axis
-*/
-QwtInterval QwtPlotRescaler::interval( int axis ) const
-{
-    if ( axis < 0 || axis >= QwtPlot::axisCnt )
+   \return Orientation of an axis
+   \param axisId Axis
+ */
+Qt::Orientation QwtPlotRescaler::orientation( QwtAxisId axisId ) const
+{
+    return QwtAxis::isYAxis( axisId ) ? Qt::Vertical : Qt::Horizontal;
+}
+
+/*!
+   \param axisId Axis
+   \return Normalized interval of an axis
+ */
+QwtInterval QwtPlotRescaler::interval( QwtAxisId axisId ) const
+{
+    if ( !plot()->isAxisValid( axisId ) )
         return QwtInterval();
 
-    return plot()->axisScaleDiv( axis ).interval().normalized();
-}
-
-/*!
-  Expand the interval
-
-  \param interval Interval to be expanded
-  \param width Distance to be added to the interval
-  \param direction Direction of the expand operation
-
-  \return Expanded interval
-*/
+    return plot()->axisScaleDiv( axisId ).interval().normalized();
+}
+
+/*!
+   Expand the interval
+
+   \param interval Interval to be expanded
+   \param width Distance to be added to the interval
+   \param direction Direction of the expand operation
+
+   \return Expanded interval
+ */
 QwtInterval QwtPlotRescaler::expandInterval(
-    const QwtInterval &interval, double width,
+    const QwtInterval& interval, double width,
     ExpandingDirection direction ) const
 {
@@ -536,16 +551,18 @@
 }
 
-double QwtPlotRescaler::pixelDist( int axis, const QSize &size ) const
-{
-    const QwtInterval intv = intervalHint( axis );
+double QwtPlotRescaler::pixelDist( QwtAxisId axisId, const QSize& size ) const
+{
+    const QwtInterval intv = intervalHint( axisId );
 
     double dist = 0.0;
     if ( !intv.isNull() )
     {
-        if ( axis == referenceAxis() )
+        if ( axisId == referenceAxis() )
+        {
             dist = intv.width();
+        }
         else
         {
-            const double r = aspectRatio( axis );
+            const double r = aspectRatio( axisId );
             if ( r > 0.0 )
                 dist = intv.width() * r;
@@ -555,5 +572,5 @@
     if ( dist > 0.0 )
     {
-        if ( orientation( axis ) == Qt::Horizontal )
+        if ( orientation( axisId ) == Qt::Horizontal )
             dist /= size.width();
         else
@@ -568,47 +585,51 @@
 
    \param intervals Scale intervals
-*/
+ */
 void QwtPlotRescaler::updateScales(
-    QwtInterval intervals[QwtPlot::axisCnt] ) const
-{
-    if ( d_data->inReplot >= 5 )
+    QwtInterval intervals[QwtAxis::AxisPositions] ) const
+{
+    if ( m_data->inReplot >= 5 )
     {
         return;
     }
 
-    QwtPlot *plt = const_cast<QwtPlot *>( plot() );
+    QwtPlot* plt = const_cast< QwtPlot* >( plot() );
 
     const bool doReplot = plt->autoReplot();
     plt->setAutoReplot( false );
 
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-    {
-        if ( axis == referenceAxis() || aspectRatio( axis ) > 0.0 )
-        {
-            double v1 = intervals[axis].minValue();
-            double v2 = intervals[axis].maxValue();
-
-            if ( !plt->axisScaleDiv( axis ).isIncreasing() )
-                qSwap( v1, v2 );
-
-            if ( d_data->inReplot >= 1 )
-                d_data->axisData[axis].scaleDiv = plt->axisScaleDiv( axis );
-
-            if ( d_data->inReplot >= 2 )
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
+        {
+            const QwtAxisId axisId( axisPos );
+
+            if ( axisId == referenceAxis() || aspectRatio( axisId ) > 0.0 )
             {
-                QList<double> ticks[QwtScaleDiv::NTickTypes];
-                for ( int i = 0; i < QwtScaleDiv::NTickTypes; i++ )
-                    ticks[i] = d_data->axisData[axis].scaleDiv.ticks( i );
-
-                plt->setAxisScaleDiv( axis, QwtScaleDiv( v1, v2, ticks ) );
+                double v1 = intervals[axisPos].minValue();
+                double v2 = intervals[axisPos].maxValue();
+
+                if ( !plt->axisScaleDiv( axisId ).isIncreasing() )
+                    qSwap( v1, v2 );
+
+                if ( m_data->inReplot >= 1 )
+                    m_data->axisData( axisId )->scaleDiv = plt->axisScaleDiv( axisId );
+
+                if ( m_data->inReplot >= 2 )
+                {
+                    QList< double > ticks[QwtScaleDiv::NTickTypes];
+                    for ( int t = 0; t < QwtScaleDiv::NTickTypes; t++ )
+                        ticks[t] = m_data->axisData( axisId )->scaleDiv.ticks( t );
+
+                    plt->setAxisScaleDiv( axisId, QwtScaleDiv( v1, v2, ticks ) );
+                }
+                else
+                {
+                    plt->setAxisScale( axisId, v1, v2 );
+                }
             }
-            else
-            {
-                plt->setAxisScale( axis, v1, v2 );
-            }
-        }
-    }
-
-    QwtPlotCanvas *canvas = qobject_cast<QwtPlotCanvas *>( plt->canvas() );
+        }
+    }
+
+    QwtPlotCanvas* canvas = qobject_cast< QwtPlotCanvas* >( plt->canvas() );
 
     bool immediatePaint = false;
@@ -621,7 +642,7 @@
     plt->setAutoReplot( doReplot );
 
-    d_data->inReplot++;
+    m_data->inReplot++;
     plt->replot();
-    d_data->inReplot--;
+    m_data->inReplot--;
 
     if ( canvas && immediatePaint )
@@ -630,2 +651,4 @@
     }
 }
+
+#include "moc_qwt_plot_rescaler.cpp"
Index: /trunk/BNC/qwt/qwt_plot_rescaler.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_rescaler.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_rescaler.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,12 +9,13 @@
 
 #ifndef QWT_PLOT_RESCALER_H
-#define QWT_PLOT_RESCALER_H 1
+#define QWT_PLOT_RESCALER_H
 
 #include "qwt_global.h"
-#include "qwt_interval.h"
 #include "qwt_plot.h"
+
 #include <qobject.h>
 
 class QwtPlot;
+class QwtInterval;
 class QResizeEvent;
 
@@ -24,30 +25,32 @@
     QwtPlotRescaler auto adjusts the axes of a QwtPlot according
     to fixed aspect ratios.
-*/
+ */
 
-class QWT_EXPORT QwtPlotRescaler: public QObject
+class QWT_EXPORT QwtPlotRescaler : public QObject
 {
-public:
+    Q_OBJECT
+
+  public:
     /*!
-      The rescale policy defines how to rescale the reference axis and
-      their depending axes.
+       The rescale policy defines how to rescale the reference axis and
+       their depending axes.
 
-      \sa ExpandingDirection, setIntervalHint()
-    */
+       \sa ExpandingDirection, setIntervalHint()
+     */
     enum RescalePolicy
     {
         /*!
-          The interval of the reference axis remains unchanged, when the
-          geometry of the canvas changes. All other axes
-          will be adjusted according to their aspect ratio.
+           The interval of the reference axis remains unchanged, when the
+           geometry of the canvas changes. All other axes
+           will be adjusted according to their aspect ratio.
          */
         Fixed,
 
         /*!
-          The interval of the reference axis will be shrunk/expanded,
-          when the geometry of the canvas changes. All other axes
-          will be adjusted according to their aspect ratio.
+           The interval of the reference axis will be shrunk/expanded,
+           when the geometry of the canvas changes. All other axes
+           will be adjusted according to their aspect ratio.
 
-          The interval, that is represented by one pixel is fixed.
+           The interval, that is represented by one pixel is fixed.
 
          */
@@ -55,6 +58,6 @@
 
         /*!
-          The intervals of the axes are calculated, so that all axes include
-          their interval hint.
+           The intervals of the axes are calculated, so that all axes include
+           their interval hint.
          */
         Fitting
@@ -77,6 +80,6 @@
     };
 
-    explicit QwtPlotRescaler( QWidget *canvas,
-        int referenceAxis = QwtPlot::xBottom,
+    explicit QwtPlotRescaler( QWidget* canvas,
+        QwtAxisId referenceAxis = QwtAxis::XBottom,
         RescalePolicy = Expanding );
 
@@ -90,52 +93,51 @@
 
     void setExpandingDirection( ExpandingDirection );
-    void setExpandingDirection( int axis, ExpandingDirection );
-    ExpandingDirection expandingDirection( int axis ) const;
+    void setExpandingDirection( QwtAxisId, ExpandingDirection );
+    ExpandingDirection expandingDirection( QwtAxisId ) const;
 
-    void setReferenceAxis( int axis );
-    int referenceAxis() const;
+    void setReferenceAxis( QwtAxisId );
+    QwtAxisId referenceAxis() const;
 
     void setAspectRatio( double ratio );
-    void setAspectRatio( int axis, double ratio );
-    double aspectRatio( int axis ) const;
+    void setAspectRatio( QwtAxisId, double ratio );
+    double aspectRatio( QwtAxisId ) const;
 
-    void setIntervalHint( int axis, const QwtInterval& );
-    QwtInterval intervalHint( int axis ) const;
+    void setIntervalHint( QwtAxisId, const QwtInterval& );
+    QwtInterval intervalHint( QwtAxisId ) const;
 
-    QWidget *canvas();
-    const QWidget *canvas() const;
+    QWidget* canvas();
+    const QWidget* canvas() const;
 
-    QwtPlot *plot();
-    const QwtPlot *plot() const;
+    QwtPlot* plot();
+    const QwtPlot* plot() const;
 
-    virtual bool eventFilter( QObject *, QEvent * );
+    virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
 
     void rescale() const;
 
-protected:
-    virtual void canvasResizeEvent( QResizeEvent * );
+  protected:
+    virtual void canvasResizeEvent( QResizeEvent* );
 
-    virtual void rescale( const QSize &oldSize, const QSize &newSize ) const;
+    virtual void rescale( const QSize& oldSize, const QSize& newSize ) const;
     virtual QwtInterval expandScale(
-        int axis, const QSize &oldSize, const QSize &newSize ) const;
+        QwtAxisId, const QSize& oldSize, const QSize& newSize ) const;
 
     virtual QwtInterval syncScale(
-        int axis, const QwtInterval& reference,
-        const QSize &size ) const;
+        QwtAxisId, const QwtInterval& reference, const QSize& size ) const;
 
     virtual void updateScales(
-        QwtInterval intervals[QwtPlot::axisCnt] ) const;
+        QwtInterval intervals[QwtAxis::AxisPositions] ) const;
 
-    Qt::Orientation orientation( int axis ) const;
-    QwtInterval interval( int axis ) const;
-    QwtInterval expandInterval( const QwtInterval &,
+    Qt::Orientation orientation( QwtAxisId ) const;
+    QwtInterval interval( QwtAxisId ) const;
+    QwtInterval expandInterval( const QwtInterval&,
         double width, ExpandingDirection ) const;
 
-private:
-    double pixelDist( int axis, const QSize & ) const;
+  private:
+    double pixelDist( QwtAxisId, const QSize& ) const;
 
     class AxisData;
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_scaleitem.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_scaleitem.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_scaleitem.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,4 +12,6 @@
 #include "qwt_scale_map.h"
 #include "qwt_interval.h"
+#include "qwt_text.h"
+
 #include <qpalette.h>
 #include <qpainter.h>
@@ -17,10 +19,10 @@
 class QwtPlotScaleItem::PrivateData
 {
-public:
-    PrivateData():
-        position( 0.0 ),
-        borderDistance( -1 ),
-        scaleDivFromAxis( true ),
-        scaleDraw( new QwtScaleDraw() )
+  public:
+    PrivateData()
+        : position( 0.0 )
+        , borderDistance( -1 )
+        , scaleDivFromAxis( true )
+        , scaleDraw( new QwtScaleDraw() )
     {
     }
@@ -31,6 +33,6 @@
     }
 
-    QwtInterval scaleInterval( const QRectF &,
-        const QwtScaleMap &, const QwtScaleMap & ) const;
+    QwtInterval scaleInterval( const QRectF&,
+        const QwtScaleMap&, const QwtScaleMap& ) const;
 
     QPalette palette;
@@ -39,9 +41,9 @@
     int borderDistance;
     bool scaleDivFromAxis;
-    QwtScaleDraw *scaleDraw;
+    QwtScaleDraw* scaleDraw;
 };
 
-QwtInterval QwtPlotScaleItem::PrivateData::scaleInterval( const QRectF &canvasRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap ) const
+QwtInterval QwtPlotScaleItem::PrivateData::scaleInterval( const QRectF& canvasRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap ) const
 {
     QwtInterval interval;
@@ -70,12 +72,12 @@
 
    \sa setPosition(), setAlignment()
-*/
+ */
 QwtPlotScaleItem::QwtPlotScaleItem(
-        QwtScaleDraw::Alignment alignment, const double pos ):
-    QwtPlotItem( QwtText( "Scale" ) )
-{
-    d_data = new PrivateData;
-    d_data->position = pos;
-    d_data->scaleDraw->setAlignment( alignment );
+        QwtScaleDraw::Alignment alignment, const double pos )
+    : QwtPlotItem( QwtText( "Scale" ) )
+{
+    m_data = new PrivateData;
+    m_data->position = pos;
+    m_data->scaleDraw->setAlignment( alignment );
 
     setItemInterest( QwtPlotItem::ScaleInterest, true );
@@ -86,5 +88,5 @@
 QwtPlotScaleItem::~QwtPlotScaleItem()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -103,9 +105,9 @@
    \param scaleDiv Scale division
    \sa scaleDiv(), setScaleDivFromAxis(), isScaleDivFromAxis()
-*/
+ */
 void QwtPlotScaleItem::setScaleDiv( const QwtScaleDiv& scaleDiv )
 {
-    d_data->scaleDivFromAxis = false;
-    d_data->scaleDraw->setScaleDiv( scaleDiv );
+    m_data->scaleDivFromAxis = false;
+    m_data->scaleDraw->setScaleDiv( scaleDiv );
 }
 
@@ -113,5 +115,5 @@
 const QwtScaleDiv& QwtPlotScaleItem::scaleDiv() const
 {
-    return d_data->scaleDraw->scaleDiv();
+    return m_data->scaleDraw->scaleDiv();
 }
 
@@ -122,13 +124,13 @@
    \param on true/false
    \sa isScaleDivFromAxis()
-*/
+ */
 void QwtPlotScaleItem::setScaleDivFromAxis( bool on )
 {
-    if ( on != d_data->scaleDivFromAxis )
-    {
-        d_data->scaleDivFromAxis = on;
+    if ( on != m_data->scaleDivFromAxis )
+    {
+        m_data->scaleDivFromAxis = on;
         if ( on )
         {
-            const QwtPlot *plt = plot();
+            const QwtPlot* plt = plot();
             if ( plt )
             {
@@ -145,8 +147,8 @@
            the corresponding axis is enabled.
    \sa setScaleDiv(), setScaleDivFromAxis()
-*/
+ */
 bool QwtPlotScaleItem::isScaleDivFromAxis() const
 {
-    return d_data->scaleDivFromAxis;
+    return m_data->scaleDivFromAxis;
 }
 
@@ -154,10 +156,10 @@
    Set the palette
    \sa QwtAbstractScaleDraw::draw(), palette()
-*/
-void QwtPlotScaleItem::setPalette( const QPalette &palette )
-{
-    if ( palette != d_data->palette )
-    {
-        d_data->palette = palette;
+ */
+void QwtPlotScaleItem::setPalette( const QPalette& palette )
+{
+    if ( palette != m_data->palette )
+    {
+        m_data->palette = palette;
 
         legendChanged();
@@ -169,8 +171,8 @@
    \return palette
    \sa setPalette()
-*/
+ */
 QPalette QwtPlotScaleItem::palette() const
 {
-    return d_data->palette;
+    return m_data->palette;
 }
 
@@ -178,10 +180,10 @@
    Change the tick label font
    \sa font()
-*/
-void QwtPlotScaleItem::setFont( const QFont &font )
-{
-    if ( font != d_data->font )
-    {
-        d_data->font = font;
+ */
+void QwtPlotScaleItem::setFont( const QFont& font )
+{
+    if ( font != m_data->font )
+    {
+        m_data->font = font;
         itemChanged();
     }
@@ -191,32 +193,32 @@
    \return tick label font
    \sa setFont()
-*/
+ */
 QFont QwtPlotScaleItem::font() const
 {
-    return d_data->font;
-}
-
-/*!
-  \brief Set a scale draw
-
-  \param scaleDraw object responsible for drawing scales.
-
-  The main use case for replacing the default QwtScaleDraw is
-  to overload QwtAbstractScaleDraw::label, to replace or swallow
-  tick labels.
-
-  \sa scaleDraw()
-*/
-void QwtPlotScaleItem::setScaleDraw( QwtScaleDraw *scaleDraw )
+    return m_data->font;
+}
+
+/*!
+   \brief Set a scale draw
+
+   \param scaleDraw object responsible for drawing scales.
+
+   The main use case for replacing the default QwtScaleDraw is
+   to overload QwtAbstractScaleDraw::label, to replace or swallow
+   tick labels.
+
+   \sa scaleDraw()
+ */
+void QwtPlotScaleItem::setScaleDraw( QwtScaleDraw* scaleDraw )
 {
     if ( scaleDraw == NULL )
         return;
 
-    if ( scaleDraw != d_data->scaleDraw )
-        delete d_data->scaleDraw;
-
-    d_data->scaleDraw = scaleDraw;
-
-    const QwtPlot *plt = plot();
+    if ( scaleDraw != m_data->scaleDraw )
+        delete m_data->scaleDraw;
+
+    m_data->scaleDraw = scaleDraw;
+
+    const QwtPlot* plt = plot();
     if ( plt )
     {
@@ -231,8 +233,8 @@
    \return Scale draw
    \sa setScaleDraw()
-*/
-const QwtScaleDraw *QwtPlotScaleItem::scaleDraw() const
-{
-    return d_data->scaleDraw;
+ */
+const QwtScaleDraw* QwtPlotScaleItem::scaleDraw() const
+{
+    return m_data->scaleDraw;
 }
 
@@ -240,8 +242,8 @@
    \return Scale draw
    \sa setScaleDraw()
-*/
-QwtScaleDraw *QwtPlotScaleItem::scaleDraw()
-{
-    return d_data->scaleDraw;
+ */
+QwtScaleDraw* QwtPlotScaleItem::scaleDraw()
+{
+    return m_data->scaleDraw;
 }
 
@@ -256,11 +258,11 @@
    \param pos New position
    \sa position(), setAlignment()
-*/
+ */
 void QwtPlotScaleItem::setPosition( double pos )
 {
-    if ( d_data->position != pos )
-    {
-        d_data->position = pos;
-        d_data->borderDistance = -1;
+    if ( m_data->position != pos )
+    {
+        m_data->position = pos;
+        m_data->borderDistance = -1;
         itemChanged();
     }
@@ -270,8 +272,8 @@
    \return Position of the scale
    \sa setPosition(), setAlignment()
-*/
+ */
 double QwtPlotScaleItem::position() const
 {
-    return d_data->position;
+    return m_data->position;
 }
 
@@ -291,5 +293,5 @@
 
    \sa setPosition(), borderDistance()
-*/
+ */
 void QwtPlotScaleItem::setBorderDistance( int distance )
 {
@@ -297,7 +299,7 @@
         distance = -1;
 
-    if ( distance != d_data->borderDistance )
-    {
-        d_data->borderDistance = distance;
+    if ( distance != m_data->borderDistance )
+    {
+        m_data->borderDistance = distance;
         itemChanged();
     }
@@ -307,8 +309,8 @@
    \return Distance from a canvas border
    \sa setBorderDistance(), setPosition()
-*/
+ */
 int QwtPlotScaleItem::borderDistance() const
 {
-    return d_data->borderDistance;
+    return m_data->borderDistance;
 }
 
@@ -328,8 +330,8 @@
 
    \sa scaleDraw(), QwtScaleDraw::alignment(), setPosition()
-*/
+ */
 void QwtPlotScaleItem::setAlignment( QwtScaleDraw::Alignment alignment )
 {
-    QwtScaleDraw *sd = d_data->scaleDraw;
+    QwtScaleDraw* sd = m_data->scaleDraw;
     if ( sd->alignment() != alignment )
     {
@@ -340,16 +342,16 @@
 
 /*!
-  \brief Draw the scale
-*/
-void QwtPlotScaleItem::draw( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
-{
-    QwtScaleDraw *sd = d_data->scaleDraw;
-
-    if ( d_data->scaleDivFromAxis )
+   \brief Draw the scale
+ */
+void QwtPlotScaleItem::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
+{
+    QwtScaleDraw* sd = m_data->scaleDraw;
+
+    if ( m_data->scaleDivFromAxis )
     {
         const QwtInterval interval =
-            d_data->scaleInterval( canvasRect, xMap, yMap );
+            m_data->scaleInterval( canvasRect, xMap, yMap );
 
         if ( interval != sd->scaleDiv().interval() )
@@ -368,11 +370,11 @@
     {
         double y;
-        if ( d_data->borderDistance >= 0 )
+        if ( m_data->borderDistance >= 0 )
         {
             if ( sd->alignment() == QwtScaleDraw::BottomScale )
-                y = canvasRect.top() + d_data->borderDistance;
+                y = canvasRect.top() + m_data->borderDistance;
             else
             {
-                y = canvasRect.bottom() - d_data->borderDistance;
+                y = canvasRect.bottom() - m_data->borderDistance;
             }
 
@@ -380,5 +382,5 @@
         else
         {
-            y = yMap.transform( d_data->position );
+            y = yMap.transform( m_data->position );
         }
 
@@ -389,5 +391,5 @@
         sd->setLength( canvasRect.width() - 1 );
 
-        QwtTransform *transform = NULL;
+        QwtTransform* transform = NULL;
         if ( xMap.transformation() )
             transform = xMap.transformation()->copy();
@@ -398,16 +400,16 @@
     {
         double x;
-        if ( d_data->borderDistance >= 0 )
+        if ( m_data->borderDistance >= 0 )
         {
             if ( sd->alignment() == QwtScaleDraw::RightScale )
-                x = canvasRect.left() + d_data->borderDistance;
+                x = canvasRect.left() + m_data->borderDistance;
             else
             {
-                x = canvasRect.right() - d_data->borderDistance;
+                x = canvasRect.right() - m_data->borderDistance;
             }
         }
         else
         {
-            x = xMap.transform( d_data->position );
+            x = xMap.transform( m_data->position );
         }
         if ( x < canvasRect.left() || x > canvasRect.right() )
@@ -417,5 +419,5 @@
         sd->setLength( canvasRect.height() - 1 );
 
-        QwtTransform *transform = NULL;
+        QwtTransform* transform = NULL;
         if ( yMap.transformation() )
             transform = yMap.transformation()->copy();
@@ -424,7 +426,7 @@
     }
 
-    painter->setFont( d_data->font );
-
-    sd->draw( painter, d_data->palette );
+    painter->setFont( m_data->font );
+
+    sd->draw( painter, m_data->palette );
 }
 
@@ -439,22 +441,22 @@
 
    \sa QwtPlot::updateAxes()
-*/
+ */
 
 void QwtPlotScaleItem::updateScaleDiv( const QwtScaleDiv& xScaleDiv,
     const QwtScaleDiv& yScaleDiv )
 {
-    QwtScaleDraw *scaleDraw = d_data->scaleDraw;
-
-    if ( d_data->scaleDivFromAxis && scaleDraw )
-    {
-        const QwtScaleDiv &scaleDiv =
+    QwtScaleDraw* scaleDraw = m_data->scaleDraw;
+
+    if ( m_data->scaleDivFromAxis && scaleDraw )
+    {
+        const QwtScaleDiv& scaleDiv =
             scaleDraw->orientation() == Qt::Horizontal ? xScaleDiv : yScaleDiv;
 
-        const QwtPlot *plt = plot();
+        const QwtPlot* plt = plot();
         if ( plt != NULL )
         {
             const QRectF canvasRect = plt->canvas()->contentsRect();
 
-            const QwtInterval interval = d_data->scaleInterval(
+            const QwtInterval interval = m_data->scaleInterval(
                 canvasRect, plt->canvasMap( xAxis() ), plt->canvasMap( yAxis() ) );
 
Index: /trunk/BNC/qwt/qwt_plot_scaleitem.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_scaleitem.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_scaleitem.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -18,34 +18,33 @@
 
 /*!
-  \brief A class which draws a scale inside the plot canvas
+   \brief A class which draws a scale inside the plot canvas
 
-  QwtPlotScaleItem can be used to draw an axis inside the plot canvas.
-  It might by synchronized to one of the axis of the plot, but can
-  also display its own ticks and labels.
+   QwtPlotScaleItem can be used to draw an axis inside the plot canvas.
+   It might by synchronized to one of the axis of the plot, but can
+   also display its own ticks and labels.
 
-  It is allowed to synchronize the scale item with a disabled axis.
-  In plots with vertical and horizontal scale items, it might be
-  necessary to remove ticks at the intersections, by overloading
-  updateScaleDiv().
+   It is allowed to synchronize the scale item with a disabled axis.
+   In plots with vertical and horizontal scale items, it might be
+   necessary to remove ticks at the intersections, by overloading
+   updateScaleDiv().
 
-  The scale might be at a specific position (f.e 0.0) or it might be
-  aligned to a canvas border.
+   The scale might be at a specific position (f.e 0.0) or it might be
+   aligned to a canvas border.
 
-  \par Example
+   \par Example
     The following example shows how to replace the left axis, by a scale item
     at the x position 0.0.
     \code
       QwtPlotScaleItem *scaleItem = new QwtPlotScaleItem( QwtScaleDraw::RightScale, 0.0 );
-      scaleItem->setFont( plot->axisWidget( QwtPlot::yLeft )->font() );
+      scaleItem->setFont( plot->axisWidget( QwtAxis::YLeft )->font() );
       scaleItem->attach(plot);
 
-      plot->enableAxis( QwtPlot::yLeft, false );
+      plot->setAxisVisible( QwtAxis::YLeft, false );
     \endcode
-  \endpar
-*/
+ */
 
-class QWT_EXPORT QwtPlotScaleItem: public QwtPlotItem
+class QWT_EXPORT QwtPlotScaleItem : public QwtPlotItem
 {
-public:
+  public:
     explicit QwtPlotScaleItem(
         QwtScaleDraw::Alignment = QwtScaleDraw::BottomScale,
@@ -54,5 +53,5 @@
     virtual ~QwtPlotScaleItem();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
     void setScaleDiv( const QwtScaleDiv& );
@@ -62,5 +61,5 @@
     bool isScaleDivFromAxis() const;
 
-    void setPalette( const QPalette & );
+    void setPalette( const QPalette& );
     QPalette palette() const;
 
@@ -68,8 +67,8 @@
     QFont font() const;
 
-    void setScaleDraw( QwtScaleDraw * );
+    void setScaleDraw( QwtScaleDraw* );
 
-    const QwtScaleDraw *scaleDraw() const;
-    QwtScaleDraw *scaleDraw();
+    const QwtScaleDraw* scaleDraw() const;
+    QwtScaleDraw* scaleDraw();
 
     void setPosition( double pos );
@@ -81,13 +80,14 @@
     void setAlignment( QwtScaleDraw::Alignment );
 
-    virtual void draw( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect ) const;
+    virtual void draw( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
 
-    virtual void updateScaleDiv( const QwtScaleDiv &, const QwtScaleDiv & );
+    virtual void updateScaleDiv(
+        const QwtScaleDiv&, const QwtScaleDiv& ) QWT_OVERRIDE;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_seriesitem.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_seriesitem.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_seriesitem.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,10 +9,12 @@
 
 #include "qwt_plot_seriesitem.h"
+#include "qwt_scale_div.h"
+#include "qwt_text.h"
 
 class QwtPlotSeriesItem::PrivateData
 {
-public:
-    PrivateData():
-        orientation( Qt::Vertical )
+  public:
+    PrivateData()
+        : orientation( Qt::Vertical )
     {
     }
@@ -22,22 +24,22 @@
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotSeriesItem::QwtPlotSeriesItem( const QwtText &title ):
-    QwtPlotItem( title )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotSeriesItem::QwtPlotSeriesItem( const QwtText& title )
+    : QwtPlotItem( title )
 {
-    d_data = new PrivateData();
+    m_data = new PrivateData();
     setItemInterest( QwtPlotItem::ScaleInterest, true );
 }
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotSeriesItem::QwtPlotSeriesItem( const QString &title ):
-    QwtPlotItem( QwtText( title ) )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotSeriesItem::QwtPlotSeriesItem( const QString& title )
+    : QwtPlotItem( QwtText( title ) )
 {
-    d_data = new PrivateData();
+    m_data = new PrivateData();
     setItemInterest( QwtPlotItem::ScaleInterest, true );
 }
@@ -46,21 +48,21 @@
 QwtPlotSeriesItem::~QwtPlotSeriesItem()
 {
-    delete d_data;
+    delete m_data;
 }
 
 /*!
-  Set the orientation of the item.
+   Set the orientation of the item.
 
-  The orientation() might be used in specific way by a plot item.
-  F.e. a QwtPlotCurve uses it to identify how to display the curve
-  int QwtPlotCurve::Steps or QwtPlotCurve::Sticks style.
+   The orientation() might be used in specific way by a plot item.
+   F.e. a QwtPlotCurve uses it to identify how to display the curve
+   int QwtPlotCurve::Steps or QwtPlotCurve::Sticks style.
 
-  \sa orientation()
-*/
+   \sa orientation()
+ */
 void QwtPlotSeriesItem::setOrientation( Qt::Orientation orientation )
 {
-    if ( d_data->orientation != orientation )
+    if ( m_data->orientation != orientation )
     {
-        d_data->orientation = orientation;
+        m_data->orientation = orientation;
 
         legendChanged();
@@ -70,23 +72,23 @@
 
 /*!
-  \return Orientation of the plot item
-  \sa setOrientation()
-*/
+   \return Orientation of the plot item
+   \sa setOrientation()
+ */
 Qt::Orientation QwtPlotSeriesItem::orientation() const
 {
-    return d_data->orientation;
+    return m_data->orientation;
 }
 
 /*!
-  \brief Draw the complete series
+   \brief Draw the complete series
 
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-*/
-void QwtPlotSeriesItem::draw( QPainter *painter,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect ) const
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+ */
+void QwtPlotSeriesItem::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
 {
     drawSeries( painter, xMap, yMap, canvasRect, 0, -1 );
@@ -99,5 +101,5 @@
 
 void QwtPlotSeriesItem::updateScaleDiv(
-    const QwtScaleDiv &xScaleDiv, const QwtScaleDiv &yScaleDiv )
+    const QwtScaleDiv& xScaleDiv, const QwtScaleDiv& yScaleDiv )
 {
     const QRectF rect = QRectF(
Index: /trunk/BNC/qwt/qwt_plot_seriesitem.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_seriesitem.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_seriesitem.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,17 +13,19 @@
 #include "qwt_global.h"
 #include "qwt_plot_item.h"
-#include "qwt_scale_div.h"
-#include "qwt_series_data.h"
 #include "qwt_series_store.h"
 
+#include <qstring.h>
+
+class QwtScaleDiv;
+
 /*!
-  \brief Base class for plot items representing a series of samples
-*/
-class QWT_EXPORT QwtPlotSeriesItem: public QwtPlotItem,
+   \brief Base class for plot items representing a series of samples
+ */
+class QWT_EXPORT QwtPlotSeriesItem : public QwtPlotItem,
     public virtual QwtAbstractSeriesStore
 {
-public:
-    explicit QwtPlotSeriesItem( const QString &title = QString() );
-    explicit QwtPlotSeriesItem( const QwtText &title );
+  public:
+    explicit QwtPlotSeriesItem( const QString& title = QString() );
+    explicit QwtPlotSeriesItem( const QwtText& title );
 
     virtual ~QwtPlotSeriesItem();
@@ -32,34 +34,34 @@
     Qt::Orientation orientation() const;
 
-    virtual void draw( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF & ) const;
+    virtual void draw( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
 
     /*!
-      Draw a subset of the samples
+       Draw a subset of the samples
 
-      \param painter Painter
-      \param xMap Maps x-values into pixel coordinates.
-      \param yMap Maps y-values into pixel coordinates.
-      \param canvasRect Contents rectangle of the canvas
-      \param from Index of the first point to be painted
-      \param to Index of the last point to be painted. If to < 0 the
+       \param painter Painter
+       \param xMap Maps x-values into pixel coordinates.
+       \param yMap Maps y-values into pixel coordinates.
+       \param canvasRect Contents rectangle of the canvas
+       \param from Index of the first point to be painted
+       \param to Index of the last point to be painted. If to < 0 the
              curve will be painted to its last point.
-    */
-    virtual void drawSeries( QPainter *painter,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const = 0;
+     */
+    virtual void drawSeries( QPainter* painter,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const = 0;
 
-    virtual QRectF boundingRect() const;
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
 
     virtual void updateScaleDiv(
-        const QwtScaleDiv &, const QwtScaleDiv & );
+        const QwtScaleDiv&, const QwtScaleDiv& ) QWT_OVERRIDE;
 
-protected:
-    virtual void dataChanged();
+  protected:
+    virtual void dataChanged() QWT_OVERRIDE;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_shapeitem.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_shapeitem.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_shapeitem.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,10 +10,16 @@
 #include "qwt_plot_shapeitem.h"
 #include "qwt_scale_map.h"
+#include "qwt_text.h"
+#include "qwt_graphic.h"
 #include "qwt_painter.h"
-#include "qwt_curve_fitter.h"
+#include "qwt_weeding_curve_fitter.h"
 #include "qwt_clipper.h"
-
-static QPainterPath qwtTransformPath( const QwtScaleMap &xMap,
-        const QwtScaleMap &yMap, const QPainterPath &path, bool doAlign )
+#include "qwt_math.h"
+
+#include <qpainter.h>
+#include <qpainterpath.h>
+
+static QPainterPath qwtTransformPath( const QwtScaleMap& xMap,
+    const QwtScaleMap& yMap, const QPainterPath& path, bool doAlign )
 {
     QPainterPath shape;
@@ -22,5 +28,5 @@
     for ( int i = 0; i < path.elementCount(); i++ )
     {
-        const QPainterPath::Element &element = path.elementAt( i );
+        const QPainterPath::Element element = path.elementAt( i );
 
         double x = xMap.transform( element.x );
@@ -53,9 +59,9 @@
             case QPainterPath::CurveToElement:
             {
-                const QPainterPath::Element& element1 = path.elementAt( ++i );
+                const QPainterPath::Element element1 = path.elementAt( ++i );
                 const double x1 = xMap.transform( element1.x );
                 const double y1 = yMap.transform( element1.y );
 
-                const QPainterPath::Element& element2 = path.elementAt( ++i );
+                const QPainterPath::Element element2 = path.elementAt( ++i );
                 const double x2 = xMap.transform( element2.x );
                 const double y2 = yMap.transform( element2.y );
@@ -77,8 +83,8 @@
 class QwtPlotShapeItem::PrivateData
 {
-public:
-    PrivateData():
-        legendMode( QwtPlotShapeItem::LegendColor ),
-        renderTolerance( 0.0 )
+  public:
+    PrivateData()
+        : legendMode( QwtPlotShapeItem::LegendColor )
+        , renderTolerance( 0.0 )
     {
     }
@@ -103,7 +109,7 @@
 
    \param title Title
-*/
-QwtPlotShapeItem::QwtPlotShapeItem( const QString& title ):
-    QwtPlotItem( QwtText( title ) )
+ */
+QwtPlotShapeItem::QwtPlotShapeItem( const QString& title )
+    : QwtPlotItem( QwtText( title ) )
 {
     init();
@@ -118,7 +124,7 @@
 
    \param title Title
-*/
-QwtPlotShapeItem::QwtPlotShapeItem( const QwtText& title ):
-    QwtPlotItem( title )
+ */
+QwtPlotShapeItem::QwtPlotShapeItem( const QwtText& title )
+    : QwtPlotItem( title )
 {
     init();
@@ -128,11 +134,11 @@
 QwtPlotShapeItem::~QwtPlotShapeItem()
 {
-    delete d_data;
+    delete m_data;
 }
 
 void QwtPlotShapeItem::init()
 {
-    d_data = new PrivateData();
-    d_data->boundingRect = QwtPlotItem::boundingRect();
+    m_data = new PrivateData();
+    m_data->boundingRect = QwtPlotItem::boundingRect();
 
     setItemAttribute( QwtPlotItem::AutoScale, true );
@@ -149,38 +155,38 @@
 
 /*!
-  Specify an attribute how to draw the shape
-
-  \param attribute Paint attribute
-  \param on On/Off
-  \sa testPaintAttribute()
-*/
+   Specify an attribute how to draw the shape
+
+   \param attribute Paint attribute
+   \param on On/Off
+   \sa testPaintAttribute()
+ */
 void QwtPlotShapeItem::setPaintAttribute( PaintAttribute attribute, bool on )
 {
     if ( on )
-        d_data->paintAttributes |= attribute;
+        m_data->paintAttributes |= attribute;
     else
-        d_data->paintAttributes &= ~attribute;
-}
-
-/*!
-  \return True, when attribute is enabled
-  \sa setPaintAttribute()
-*/
+        m_data->paintAttributes &= ~attribute;
+}
+
+/*!
+   \return True, when attribute is enabled
+   \sa setPaintAttribute()
+ */
 bool QwtPlotShapeItem::testPaintAttribute( PaintAttribute attribute ) const
 {
-    return ( d_data->paintAttributes & attribute );
-}
-
-/*!
-  Set the mode how to represent the item on the legend
-
-  \param mode Mode
-  \sa legendMode()
+    return ( m_data->paintAttributes & attribute );
+}
+
+/*!
+   Set the mode how to represent the item on the legend
+
+   \param mode Mode
+   \sa legendMode()
  */
 void QwtPlotShapeItem::setLegendMode( LegendMode mode )
 {
-    if ( mode != d_data->legendMode )
-    {
-        d_data->legendMode = mode;
+    if ( mode != m_data->legendMode )
+    {
+        m_data->legendMode = mode;
         legendChanged();
     }
@@ -188,10 +194,10 @@
 
 /*!
-  \return Mode how to represent the item on the legend
-  \sa legendMode()
+   \return Mode how to represent the item on the legend
+   \sa legendMode()
  */
 QwtPlotShapeItem::LegendMode QwtPlotShapeItem::legendMode() const
 {
-    return d_data->legendMode;
+    return m_data->legendMode;
 }
 
@@ -199,14 +205,14 @@
 QRectF QwtPlotShapeItem::boundingRect() const
 {
-    return d_data->boundingRect;
-}
-
-/*!
-  \brief Set a path built from a rectangle
-
-  \param rect Rectangle
-  \sa setShape(), setPolygon(), shape()
- */
-void QwtPlotShapeItem::setRect( const QRectF &rect )
+    return m_data->boundingRect;
+}
+
+/*!
+   \brief Set a path built from a rectangle
+
+   \param rect Rectangle
+   \sa setShape(), setPolygon(), shape()
+ */
+void QwtPlotShapeItem::setRect( const QRectF& rect )
 {
     QPainterPath path;
@@ -217,10 +223,10 @@
 
 /*!
-  \brief Set a path built from a polygon
-
-  \param polygon Polygon
-  \sa setShape(), setRect(), shape()
- */
-void QwtPlotShapeItem::setPolygon( const QPolygonF &polygon )
+   \brief Set a path built from a polygon
+
+   \param polygon Polygon
+   \sa setShape(), setRect(), shape()
+ */
+void QwtPlotShapeItem::setPolygon( const QPolygonF& polygon )
 {
     QPainterPath shape;
@@ -231,21 +237,21 @@
 
 /*!
-  \brief Set the shape to be displayed
-
-  \param shape Shape
-  \sa setShape(), shape()
- */
-void QwtPlotShapeItem::setShape( const QPainterPath &shape )
-{
-    if ( shape != d_data->shape )
-    {
-        d_data->shape = shape;
+   \brief Set the shape to be displayed
+
+   \param shape Shape
+   \sa setShape(), shape()
+ */
+void QwtPlotShapeItem::setShape( const QPainterPath& shape )
+{
+    if ( shape != m_data->shape )
+    {
+        m_data->shape = shape;
         if ( shape.isEmpty() )
         {
-            d_data->boundingRect = QwtPlotItem::boundingRect();
+            m_data->boundingRect = QwtPlotItem::boundingRect();
         }
         else
         {
-            d_data->boundingRect = shape.boundingRect();
+            m_data->boundingRect = shape.boundingRect();
         }
 
@@ -255,26 +261,26 @@
 
 /*!
-  \return Shape to be displayed
-  \sa setShape()
+   \return Shape to be displayed
+   \sa setShape()
  */
 QPainterPath QwtPlotShapeItem::shape() const
 {
-    return d_data->shape;
-}
-
-/*!
-  Build and assign a pen
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtPlotShapeItem::setPen( const QColor &color, qreal width, Qt::PenStyle style )
+    return m_data->shape;
+}
+
+/*!
+   Build and assign a pen
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtPlotShapeItem::setPen( const QColor& color, qreal width, Qt::PenStyle style )
 {
     setPen( QPen( color, width, style ) );
@@ -282,16 +288,16 @@
 
 /*!
-  \brief Assign a pen
-
-  The pen is used to draw the outline of the shape
-
-  \param pen Pen
-  \sa pen(), brush()
-*/
-void QwtPlotShapeItem::setPen( const QPen &pen )
-{
-    if ( pen != d_data->pen )
-    {
-        d_data->pen = pen;
+   \brief Assign a pen
+
+   The pen is used to draw the outline of the shape
+
+   \param pen Pen
+   \sa pen(), brush()
+ */
+void QwtPlotShapeItem::setPen( const QPen& pen )
+{
+    if ( pen != m_data->pen )
+    {
+        m_data->pen = pen;
         itemChanged();
     }
@@ -301,23 +307,23 @@
     \return Pen used to draw the outline of the shape
     \sa setPen(), brush()
-*/
+ */
 QPen QwtPlotShapeItem::pen() const
 {
-    return d_data->pen;
-}
-
-/*!
-  Assign a brush.
-
-  The brush is used to fill the path
-
-  \param brush Brush
-  \sa brush(), pen()
-*/
-void QwtPlotShapeItem::setBrush( const QBrush &brush )
-{
-    if ( brush != d_data->brush )
-    {
-        d_data->brush = brush;
+    return m_data->pen;
+}
+
+/*!
+   Assign a brush.
+
+   The brush is used to fill the path
+
+   \param brush Brush
+   \sa brush(), pen()
+ */
+void QwtPlotShapeItem::setBrush( const QBrush& brush )
+{
+    if ( brush != m_data->brush )
+    {
+        m_data->brush = brush;
         itemChanged();
     }
@@ -325,35 +331,35 @@
 
 /*!
-  \return Brush used to fill the shape
-  \sa setBrush(), pen()
-*/
+   \return Brush used to fill the shape
+   \sa setBrush(), pen()
+ */
 QBrush QwtPlotShapeItem::brush() const
 {
-    return d_data->brush;
-}
-
-/*!
-  \brief Set the tolerance for the weeding optimization
-
-  After translating the shape into target device coordinate
-  ( usually widget geometries ) the painter path can be simplified
-  by a point weeding algorithm ( Douglas-Peucker ).
-
-  For shapes built from curves and ellipses weeding might
-  have the opposite effect because they have to be expanded
-  to polygons.
-
-  \param tolerance Accepted error when reducing the number of points
+    return m_data->brush;
+}
+
+/*!
+   \brief Set the tolerance for the weeding optimization
+
+   After translating the shape into target device coordinate
+   ( usually widget geometries ) the painter path can be simplified
+   by a point weeding algorithm ( Douglas-Peucker ).
+
+   For shapes built from curves and ellipses weeding might
+   have the opposite effect because they have to be expanded
+   to polygons.
+
+   \param tolerance Accepted error when reducing the number of points
                    A value <= 0.0 disables weeding.
 
-  \sa renderTolerance(), QwtWeedingCurveFitter
+   \sa renderTolerance(), QwtWeedingCurveFitter
  */
 void QwtPlotShapeItem::setRenderTolerance( double tolerance )
 {
-    tolerance = qMax( tolerance, 0.0 );
-
-    if ( tolerance != d_data->renderTolerance )
-    {
-        d_data->renderTolerance = tolerance;
+    tolerance = qwtMaxF( tolerance, 0.0 );
+
+    if ( tolerance != m_data->renderTolerance )
+    {
+        m_data->renderTolerance = tolerance;
         itemChanged();
     }
@@ -361,29 +367,29 @@
 
 /*!
-  \return Tolerance for the weeding optimization
-  \sa setRenderTolerance()
+   \return Tolerance for the weeding optimization
+   \sa setRenderTolerance()
  */
 double QwtPlotShapeItem::renderTolerance() const
 {
-    return d_data->renderTolerance;
-}
-
-/*!
-  Draw the shape item
-
-  \param painter Painter
-  \param xMap X-Scale Map
-  \param yMap Y-Scale Map
-  \param canvasRect Contents rect of the plot canvas
-*/
-void QwtPlotShapeItem::draw( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
-{
-    if ( d_data->shape.isEmpty() )
+    return m_data->renderTolerance;
+}
+
+/*!
+   Draw the shape item
+
+   \param painter Painter
+   \param xMap X-Scale Map
+   \param yMap Y-Scale Map
+   \param canvasRect Contents rect of the plot canvas
+ */
+void QwtPlotShapeItem::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
+{
+    if ( m_data->shape.isEmpty() )
         return;
 
-    if ( d_data->pen.style() == Qt::NoPen
-        && d_data->brush.style() == Qt::NoBrush )
+    if ( m_data->pen.style() == Qt::NoPen
+        && m_data->brush.style() == Qt::NoBrush )
     {
         return;
@@ -393,10 +399,10 @@
         xMap, yMap, canvasRect.toRect() );
 
-    const QRectF &br = d_data->boundingRect;
+    const QRectF& br = m_data->boundingRect;
 
     if ( ( br.left() > cr.right() ) || ( br.right() < cr.left() )
         || ( br.top() > cr.bottom() ) || ( br.bottom() < cr.top() ) )
     {
-        // outside the visisble area
+        // outside the visible area
         return;
     }
@@ -405,21 +411,19 @@
 
     QPainterPath path = qwtTransformPath( xMap, yMap,
-        d_data->shape, doAlign );
+        m_data->shape, doAlign );
 
     if ( testPaintAttribute( QwtPlotShapeItem::ClipPolygons ) )
     {
-        qreal pw = qMax( qreal( 1.0 ), painter->pen().widthF());
-        QRectF clipRect = canvasRect.adjusted( -pw, -pw, pw, pw );
+        const qreal pw = QwtPainter::effectivePenWidth( painter->pen() );
+        const QRectF clipRect = canvasRect.adjusted( -pw, -pw, pw, pw );
 
         QPainterPath clippedPath;
         clippedPath.setFillRule( path.fillRule() );
 
-        const QList<QPolygonF> polygons = path.toSubpathPolygons();
+        QList< QPolygonF > polygons = path.toSubpathPolygons();
         for ( int i = 0; i < polygons.size(); i++ )
         {
-            const QPolygonF p = QwtClipper::clipPolygonF(
-                clipRect, polygons[i], true );
-
-            clippedPath.addPolygon( p );
+            QwtClipper::clipPolygonF( clipRect, polygons[i], true );
+            clippedPath.addPolygon( polygons[i] );
 
         }
@@ -428,12 +432,12 @@
     }
 
-    if ( d_data->renderTolerance > 0.0 )
-    {
-        QwtWeedingCurveFitter fitter( d_data->renderTolerance );
+    if ( m_data->renderTolerance > 0.0 )
+    {
+        QwtWeedingCurveFitter fitter( m_data->renderTolerance );
 
         QPainterPath fittedPath;
         fittedPath.setFillRule( path.fillRule() );
 
-        const QList<QPolygonF> polygons = path.toSubpathPolygons();
+        const QList< QPolygonF > polygons = path.toSubpathPolygons();
         for ( int i = 0; i < polygons.size(); i++ )
             fittedPath.addPolygon( fitter.fitCurve( polygons[ i ] ) );
@@ -442,6 +446,6 @@
     }
 
-    painter->setPen( d_data->pen );
-    painter->setBrush( d_data->brush );
+    painter->setPen( m_data->pen );
+    painter->setBrush( m_data->brush );
 
     painter->drawPath( path );
@@ -449,14 +453,14 @@
 
 /*!
-  \return A rectangle filled with the color of the brush ( or the pen )
-
-  \param index Index of the legend entry
+   \return A rectangle filled with the color of the brush ( or the pen )
+
+   \param index Index of the legend entry
                 ( usually there is only one )
-  \param size Icon size
-
-  \sa setLegendIconSize(), legendData()
-*/
+   \param size Icon size
+
+   \sa setLegendIconSize(), legendData()
+ */
 QwtGraphic QwtPlotShapeItem::legendIcon( int index,
-    const QSizeF &size ) const
+    const QSizeF& size ) const
 {
     Q_UNUSED( index );
@@ -468,7 +472,7 @@
         return icon;
 
-    if ( d_data->legendMode == QwtPlotShapeItem::LegendShape )
-    {
-        const QRectF &br = d_data->boundingRect;
+    if ( m_data->legendMode == QwtPlotShapeItem::LegendShape )
+    {
+        const QRectF& br = m_data->boundingRect;
 
         QPainter painter( &icon );
@@ -478,15 +482,15 @@
         painter.translate( -br.topLeft() );
 
-        painter.setPen( d_data->pen );
-        painter.setBrush( d_data->brush );
-        painter.drawPath( d_data->shape );
+        painter.setPen( m_data->pen );
+        painter.setBrush( m_data->brush );
+        painter.drawPath( m_data->shape );
     }
     else
     {
         QColor iconColor;
-        if ( d_data->brush.style() != Qt::NoBrush )
-            iconColor = d_data->brush.color();
+        if ( m_data->brush.style() != Qt::NoBrush )
+            iconColor = m_data->brush.color();
         else
-            iconColor = d_data->pen.color();
+            iconColor = m_data->pen.color();
 
         icon = defaultIcon( iconColor, size );
Index: /trunk/BNC/qwt/qwt_plot_shapeitem.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_shapeitem.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_shapeitem.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,23 +13,30 @@
 #include "qwt_global.h"
 #include "qwt_plot_item.h"
-#include <qpainterpath.h>
+
+#include <qstring.h>
+
+class QPainterPath;
+class QPolygonF;
 
 /*!
-  \brief A plot item, which displays any graphical shape,
+   \brief A plot item, which displays any graphical shape,
          that can be defined by a QPainterPath
 
-  A QPainterPath is a shape composed from intersecting and uniting
-  regions, rectangles, ellipses or irregular areas defined by lines, and curves.
-  QwtPlotShapeItem displays a shape with a pen and brush.
+   A QPainterPath is a shape composed from intersecting and uniting
+   regions, rectangles, ellipses or irregular areas defined by lines, and curves.
+   QwtPlotShapeItem displays a shape with a pen and brush.
 
-  QwtPlotShapeItem offers a couple of optimizations like clipping or weeding.
-  These algorithms need to convert the painter path into polygons that might be
-  less performant for paths built from curves and ellipses.
+   QwtPlotShapeItem offers a couple of optimizations like clipping or weeding.
+   These algorithms need to convert the painter path into polygons that might be
+   less performant for paths built from curves and ellipses.
 
-  \sa QwtPlotZone
-*/
-class QWT_EXPORT QwtPlotShapeItem: public QwtPlotItem
+   More complex shapes, that can't be expressed by a QPainterPath can be displayed
+   using QwtPlotGraphicItem.
+
+   \sa QwtPlotZone, QwtPlotGraphicItem
+ */
+class QWT_EXPORT QwtPlotShapeItem : public QwtPlotItem
 {
-public:
+  public:
     /*!
         Attributes to modify the drawing algorithm.
@@ -37,21 +44,20 @@
 
         \sa setPaintAttribute(), testPaintAttribute()
-    */
+     */
     enum PaintAttribute
     {
         /*!
-          Clip polygons before painting them. In situations, where points
-          are far outside the visible area (f.e when zooming deep) this
-          might be a substantial improvement for the painting performance
+           Clip polygons before painting them. In situations, where points
+           are far outside the visible area (f.e when zooming deep) this
+           might be a substantial improvement for the painting performance
 
-          But polygon clipping will convert the painter path into
-          polygons what might introduce a negative impact on the
-          performance of paths composed from curves or ellipses.
+           But polygon clipping will convert the painter path into
+           polygons what might introduce a negative impact on the
+           performance of paths composed from curves or ellipses.
          */
         ClipPolygons = 0x01,
     };
 
-    //! Paint attributes
-    typedef QFlags<PaintAttribute> PaintAttributes;
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
 
     //! Mode how to display the item on the legend
@@ -65,6 +71,6 @@
     };
 
-    explicit QwtPlotShapeItem( const QString &title = QString() );
-    explicit QwtPlotShapeItem( const QwtText &title );
+    explicit QwtPlotShapeItem( const QString& title = QString() );
+    explicit QwtPlotShapeItem( const QwtText& title );
 
     virtual ~QwtPlotShapeItem();
@@ -76,15 +82,15 @@
     LegendMode legendMode() const;
 
-    void setRect( const QRectF & );
-    void setPolygon( const QPolygonF & );
+    void setRect( const QRectF& );
+    void setPolygon( const QPolygonF& );
 
-    void setShape( const QPainterPath & );
+    void setShape( const QPainterPath& );
     QPainterPath shape() const;
 
-    void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setPen( const QPen & );
+    void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
+    void setPen( const QPen& );
     QPen pen() const;
 
-    void setBrush( const QBrush & );
+    void setBrush( const QBrush& );
     QBrush brush() const;
 
@@ -92,19 +98,20 @@
     double renderTolerance() const;
 
-    virtual QRectF boundingRect() const;
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
 
-    virtual void draw( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect ) const;
+    virtual void draw( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
 
-    virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
+    virtual QwtGraphic legendIcon(
+        int index, const QSizeF& ) const QWT_OVERRIDE;
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
-private:
+  private:
     void init();
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_spectrocurve.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_spectrocurve.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_spectrocurve.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,13 +12,15 @@
 #include "qwt_scale_map.h"
 #include "qwt_painter.h"
+#include "qwt_text.h"
+
 #include <qpainter.h>
 
 class QwtPlotSpectroCurve::PrivateData
 {
-public:
-    PrivateData():
-        colorRange( 0.0, 1000.0 ),
-        penWidth(0.0),
-        paintAttributes( QwtPlotSpectroCurve::ClipPoints )
+  public:
+    PrivateData()
+        : colorRange( 0.0, 1000.0 )
+        , penWidth( 0.0 )
+        , paintAttributes( QwtPlotSpectroCurve::ClipPoints )
     {
         colorMap = new QwtLinearColorMap();
@@ -30,7 +32,7 @@
     }
 
-    QwtColorMap *colorMap;
+    QwtColorMap* colorMap;
     QwtInterval colorRange;
-    QVector<QRgb> colorTable;
+    QVector< QRgb > colorTable;
     double penWidth;
     QwtPlotSpectroCurve::PaintAttributes paintAttributes;
@@ -38,9 +40,9 @@
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotSpectroCurve::QwtPlotSpectroCurve( const QwtText &title ):
-    QwtPlotSeriesItem( title )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotSpectroCurve::QwtPlotSpectroCurve( const QwtText& title )
+    : QwtPlotSeriesItem( title )
 {
     init();
@@ -48,9 +50,9 @@
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotSpectroCurve::QwtPlotSpectroCurve( const QString &title ):
-    QwtPlotSeriesItem( QwtText( title ) )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotSpectroCurve::QwtPlotSpectroCurve( const QString& title )
+    : QwtPlotSeriesItem( QwtText( title ) )
 {
     init();
@@ -60,10 +62,10 @@
 QwtPlotSpectroCurve::~QwtPlotSpectroCurve()
 {
-    delete d_data;
-}
-
-/*!
-  \brief Initialize data members
-*/
+    delete m_data;
+}
+
+/*!
+   \brief Initialize data members
+ */
 void QwtPlotSpectroCurve::init()
 {
@@ -71,5 +73,5 @@
     setItemAttribute( QwtPlotItem::AutoScale );
 
-    d_data = new PrivateData;
+    m_data = new PrivateData;
     setData( new QwtPoint3DSeriesData() );
 
@@ -84,16 +86,16 @@
 
 /*!
-  Specify an attribute how to draw the curve
-
-  \param attribute Paint attribute
-  \param on On/Off
-  /sa PaintAttribute, testPaintAttribute()
-*/
+   Specify an attribute how to draw the curve
+
+   \param attribute Paint attribute
+   \param on On/Off
+   /sa PaintAttribute, testPaintAttribute()
+ */
 void QwtPlotSpectroCurve::setPaintAttribute( PaintAttribute attribute, bool on )
 {
     if ( on )
-        d_data->paintAttributes |= attribute;
+        m_data->paintAttributes |= attribute;
     else
-        d_data->paintAttributes &= ~attribute;
+        m_data->paintAttributes &= ~attribute;
 }
 
@@ -101,15 +103,15 @@
     \return True, when attribute is enabled
     \sa PaintAttribute, setPaintAttribute()
-*/
+ */
 bool QwtPlotSpectroCurve::testPaintAttribute( PaintAttribute attribute ) const
 {
-    return ( d_data->paintAttributes & attribute );
-}
-
-/*!
-  Initialize data with an array of samples.
-  \param samples Vector of points
-*/
-void QwtPlotSpectroCurve::setSamples( const QVector<QwtPoint3D> &samples )
+    return ( m_data->paintAttributes & attribute );
+}
+
+/*!
+   Initialize data with an array of samples.
+   \param samples Vector of points
+ */
+void QwtPlotSpectroCurve::setSamples( const QVector< QwtPoint3D >& samples )
 {
     setData( new QwtPoint3DSeriesData( samples ) );
@@ -117,15 +119,15 @@
 
 /*!
-  Assign a series of samples
-
-  setSamples() is just a wrapper for setData() without any additional
-  value - beside that it is easier to find for the developer.
-
-  \param data Data
-  \warning The item takes ownership of the data object, deleting
+   Assign a series of samples
+
+   setSamples() is just a wrapper for setData() without any additional
+   value - beside that it is easier to find for the developer.
+
+   \param data Data
+   \warning The item takes ownership of the data object, deleting
            it when its not used anymore.
-*/
+ */
 void QwtPlotSpectroCurve::setSamples(
-    QwtSeriesData<QwtPoint3D> *data )
+    QwtSeriesData< QwtPoint3D >* data )
 {
     setData( data );
@@ -133,20 +135,20 @@
 
 /*!
-  Change the color map
-
-  Often it is useful to display the mapping between intensities and
-  colors as an additional plot axis, showing a color bar.
-
-  \param colorMap Color Map
-
-  \sa colorMap(), setColorRange(), QwtColorMap::color(),
+   Change the color map
+
+   Often it is useful to display the mapping between intensities and
+   colors as an additional plot axis, showing a color bar.
+
+   \param colorMap Color Map
+
+   \sa colorMap(), setColorRange(), QwtColorMap::color(),
       QwtScaleWidget::setColorBarEnabled(), QwtScaleWidget::setColorMap()
-*/
-void QwtPlotSpectroCurve::setColorMap( QwtColorMap *colorMap )
-{
-    if ( colorMap != d_data->colorMap )
-    {
-        delete d_data->colorMap;
-        d_data->colorMap = colorMap;
+ */
+void QwtPlotSpectroCurve::setColorMap( QwtColorMap* colorMap )
+{
+    if ( colorMap != m_data->colorMap )
+    {
+        delete m_data->colorMap;
+        m_data->colorMap = colorMap;
     }
 
@@ -158,8 +160,8 @@
    \return Color Map used for mapping the intensity values to colors
    \sa setColorMap(), setColorRange(), QwtColorMap::color()
-*/
-const QwtColorMap *QwtPlotSpectroCurve::colorMap() const
-{
-    return d_data->colorMap;
+ */
+const QwtColorMap* QwtPlotSpectroCurve::colorMap() const
+{
+    return m_data->colorMap;
 }
 
@@ -171,10 +173,10 @@
 
    \sa colorRange(), setColorMap(), QwtColorMap::color()
-*/
-void QwtPlotSpectroCurve::setColorRange( const QwtInterval &interval )
-{
-    if ( interval != d_data->colorRange )
-    {
-        d_data->colorRange = interval;
+ */
+void QwtPlotSpectroCurve::setColorRange( const QwtInterval& interval )
+{
+    if ( interval != m_data->colorRange )
+    {
+        m_data->colorRange = interval;
 
         legendChanged();
@@ -184,18 +186,18 @@
 
 /*!
-  \return Value interval, that corresponds to the color map
-  \sa setColorRange(), setColorMap(), QwtColorMap::color()
-*/
-QwtInterval &QwtPlotSpectroCurve::colorRange() const
-{
-    return d_data->colorRange;
-}
-
-/*!
-  Assign a pen width
-
-  \param penWidth New pen width
-  \sa penWidth()
-*/
+   \return Value interval, that corresponds to the color map
+   \sa setColorRange(), setColorMap(), QwtColorMap::color()
+ */
+QwtInterval& QwtPlotSpectroCurve::colorRange() const
+{
+    return m_data->colorRange;
+}
+
+/*!
+   Assign a pen width
+
+   \param penWidth New pen width
+   \sa penWidth()
+ */
 void QwtPlotSpectroCurve::setPenWidth(double penWidth)
 {
@@ -203,7 +205,7 @@
         penWidth = 0.0;
 
-    if ( d_data->penWidth != penWidth )
-    {
-        d_data->penWidth = penWidth;
+    if ( m_data->penWidth != penWidth )
+    {
+        m_data->penWidth = penWidth;
 
         legendChanged();
@@ -213,28 +215,28 @@
 
 /*!
-  \return Pen width used to draw a dot
-  \sa setPenWidth()
-*/
+   \return Pen width used to draw a dot
+   \sa setPenWidth()
+ */
 double QwtPlotSpectroCurve::penWidth() const
 {
-    return d_data->penWidth;
-}
-
-/*!
-  Draw a subset of the points
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
+    return m_data->penWidth;
+}
+
+/*!
+   Draw a subset of the points
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
          series will be painted to its last sample.
 
-  \sa drawDots()
-*/
-void QwtPlotSpectroCurve::drawSeries( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   \sa drawDots()
+ */
+void QwtPlotSpectroCurve::drawSeries( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     if ( !painter || dataSize() <= 0 )
@@ -254,30 +256,30 @@
 
 /*!
-  Draw a subset of the points
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
+   Draw a subset of the points
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
          series will be painted to its last sample.
 
-  \sa drawSeries()
-*/
-void QwtPlotSpectroCurve::drawDots( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
-{
-    if ( !d_data->colorRange.isValid() )
+   \sa drawSeries()
+ */
+void QwtPlotSpectroCurve::drawDots( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
+{
+    if ( !m_data->colorRange.isValid() )
         return;
 
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
-    const QwtColorMap::Format format = d_data->colorMap->format();
+    const QwtColorMap::Format format = m_data->colorMap->format();
     if ( format == QwtColorMap::Indexed )
-        d_data->colorTable = d_data->colorMap->colorTable( d_data->colorRange );
-
-    const QwtSeriesData<QwtPoint3D> *series = data();
+        m_data->colorTable = m_data->colorMap->colorTable256();
+
+    const QwtSeriesData< QwtPoint3D >* series = data();
 
     for ( int i = from; i <= to; i++ )
@@ -293,5 +295,5 @@
         }
 
-        if ( d_data->paintAttributes & QwtPlotSpectroCurve::ClipPoints )
+        if ( m_data->paintAttributes & QwtPlotSpectroCurve::ClipPoints )
         {
             if ( !canvasRect.contains( xi, yi ) )
@@ -301,16 +303,16 @@
         if ( format == QwtColorMap::RGB )
         {
-            const QRgb rgb = d_data->colorMap->rgb(
-                d_data->colorRange, sample.z() );
-
-            painter->setPen( QPen( QColor::fromRgba( rgb ), d_data->penWidth ) );
+            const QRgb rgb = m_data->colorMap->rgb(
+                m_data->colorRange, sample.z() );
+
+            painter->setPen( QPen( QColor::fromRgba( rgb ), m_data->penWidth ) );
         }
         else
         {
-            const unsigned char index = d_data->colorMap->colorIndex(
-                d_data->colorRange, sample.z() );
-
-            painter->setPen( QPen( QColor::fromRgba( d_data->colorTable[index] ),
-                d_data->penWidth ) );
+            const unsigned char index = m_data->colorMap->colorIndex(
+                256, m_data->colorRange, sample.z() );
+
+            painter->setPen( QPen( QColor::fromRgba( m_data->colorTable[index] ),
+                m_data->penWidth ) );
         }
 
@@ -318,4 +320,4 @@
     }
 
-    d_data->colorTable.clear();
-}
+    m_data->colorTable.clear();
+}
Index: /trunk/BNC/qwt/qwt_plot_spectrocurve.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_spectrocurve.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_spectrocurve.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,7 +13,5 @@
 #include "qwt_global.h"
 #include "qwt_plot_seriesitem.h"
-#include "qwt_series_data.h"
 
-class QwtSymbol;
 class QwtColorMap;
 
@@ -21,9 +19,10 @@
     \brief Curve that displays 3D points as dots, where the z coordinate is
            mapped to a color.
-*/
-class QWT_EXPORT QwtPlotSpectroCurve:
-    public QwtPlotSeriesItem, public QwtSeriesStore<QwtPoint3D>
+ */
+class QWT_EXPORT QwtPlotSpectroCurve
+    : public QwtPlotSeriesItem
+    , public QwtSeriesStore< QwtPoint3D >
 {
-public:
+  public:
     //! Paint attributes
     enum PaintAttribute
@@ -33,44 +32,43 @@
     };
 
-    //! Paint attributes
-    typedef QFlags<PaintAttribute> PaintAttributes;
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
 
-    explicit QwtPlotSpectroCurve( const QString &title = QString() );
-    explicit QwtPlotSpectroCurve( const QwtText &title );
+    explicit QwtPlotSpectroCurve( const QString& title = QString() );
+    explicit QwtPlotSpectroCurve( const QwtText& title );
 
     virtual ~QwtPlotSpectroCurve();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
     void setPaintAttribute( PaintAttribute, bool on = true );
     bool testPaintAttribute( PaintAttribute ) const;
 
-    void setSamples( const QVector<QwtPoint3D> & );
-    void setSamples( QwtSeriesData<QwtPoint3D> * );
+    void setSamples( const QVector< QwtPoint3D >& );
+    void setSamples( QwtSeriesData< QwtPoint3D >* );
 
 
-    void setColorMap( QwtColorMap * );
-    const QwtColorMap *colorMap() const;
+    void setColorMap( QwtColorMap* );
+    const QwtColorMap* colorMap() const;
 
-    void setColorRange( const QwtInterval & );
-    QwtInterval & colorRange() const;
+    void setColorRange( const QwtInterval& );
+    QwtInterval& colorRange() const;
 
-    virtual void drawSeries( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
+    virtual void drawSeries( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
 
     void setPenWidth( double );
     double penWidth() const;
 
-protected:
-    virtual void drawDots( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
+  protected:
+    virtual void drawDots( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const;
 
-private:
+  private:
     void init();
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_spectrogram.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_spectrogram.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_spectrogram.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,26 +13,43 @@
 #include "qwt_scale_map.h"
 #include "qwt_color_map.h"
+#include "qwt_math.h"
+
 #include <qimage.h>
 #include <qpen.h>
 #include <qpainter.h>
-#include <qmath.h>
-#include <qalgorithms.h>
-#if QT_VERSION >= 0x040400
 #include <qthread.h>
 #include <qfuture.h>
 #include <qtconcurrentrun.h>
+
+#define DEBUG_RENDER 0
+
+#if DEBUG_RENDER
+#include <qelapsedtimer.h>
 #endif
 
-#define DEBUG_RENDER 0
-
-#if DEBUG_RENDER
-#include <QElapsedTimer>
-#endif
+#include <algorithm>
+
+static inline bool qwtIsNaN( double d )
+{
+    // qt_is_nan is private header and qIsNaN is not inlined
+    // so we need these code here too
+
+    const uchar* ch = (const uchar*)&d;
+    if ( QSysInfo::ByteOrder == QSysInfo::BigEndian )
+    {
+        return ( ch[0] & 0x7f ) == 0x7f && ch[1] > 0xf0;
+    }
+    else
+    {
+        return ( ch[7] & 0x7f ) == 0x7f && ch[6] > 0xf0;
+    }
+}
 
 class QwtPlotSpectrogram::PrivateData
 {
-public:
-    PrivateData():
-        data( NULL )
+  public:
+    PrivateData()
+        : data( NULL )
+        , colorTableSize( 0 )
     {
         colorMap = new QwtLinearColorMap();
@@ -44,4 +61,5 @@
 #endif
     }
+
     ~PrivateData()
     {
@@ -50,11 +68,29 @@
     }
 
-    QwtRasterData *data;
-    QwtColorMap *colorMap;
+    void updateColorTable()
+    {
+        if ( colorMap->format() == QwtColorMap::Indexed )
+        {
+            colorTable = colorMap->colorTable256();
+        }
+        else
+        {
+            if ( colorTableSize == 0 )
+                colorTable.clear();
+            else
+                colorTable = colorMap->colorTable( colorTableSize );
+        }
+    }
+
+    QwtRasterData* data;
+    QwtColorMap* colorMap;
     DisplayModes displayMode;
 
-    QList<double> contourLevels;
+    QList< double > contourLevels;
     QPen defaultContourPen;
     QwtRasterData::ConrecFlags conrecFlags;
+
+    int colorTableSize;
+    QVector< QRgb > colorTable;
 };
 
@@ -69,9 +105,9 @@
 
    \sa QwtPlotItem::setItemAttribute(), QwtPlotItem::setZ()
-*/
-QwtPlotSpectrogram::QwtPlotSpectrogram( const QString &title ):
-    QwtPlotRasterItem( title )
-{
-    d_data = new PrivateData();
+ */
+QwtPlotSpectrogram::QwtPlotSpectrogram( const QString& title )
+    : QwtPlotRasterItem( title )
+{
+    m_data = new PrivateData();
 
     setItemAttribute( QwtPlotItem::AutoScale, true );
@@ -84,5 +120,5 @@
 QwtPlotSpectrogram::~QwtPlotSpectrogram()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -102,13 +138,13 @@
 
    \sa DisplayMode, displayMode()
-*/
+ */
 void QwtPlotSpectrogram::setDisplayMode( DisplayMode mode, bool on )
 {
-    if ( on != bool( mode & d_data->displayMode ) )
+    if ( on != bool( mode & m_data->displayMode ) )
     {
         if ( on )
-            d_data->displayMode |= mode;
+            m_data->displayMode |= mode;
         else
-            d_data->displayMode &= ~mode;
+            m_data->displayMode &= ~mode;
     }
 
@@ -122,28 +158,33 @@
    \param mode Display mode
    \return true if mode is enabled
-*/
+ */
 bool QwtPlotSpectrogram::testDisplayMode( DisplayMode mode ) const
 {
-    return ( d_data->displayMode & mode );
-}
-
-/*!
-  Change the color map
-
-  Often it is useful to display the mapping between intensities and
-  colors as an additional plot axis, showing a color bar.
-
-  \param colorMap Color Map
-
-  \sa colorMap(), QwtScaleWidget::setColorBarEnabled(),
+    return ( m_data->displayMode & mode );
+}
+
+/*!
+   Change the color map
+
+   Often it is useful to display the mapping between intensities and
+   colors as an additional plot axis, showing a color bar.
+
+   \param colorMap Color Map
+
+   \sa colorMap(), QwtScaleWidget::setColorBarEnabled(),
       QwtScaleWidget::setColorMap()
-*/
-void QwtPlotSpectrogram::setColorMap( QwtColorMap *colorMap )
-{
-    if ( d_data->colorMap != colorMap )
-    {
-        delete d_data->colorMap;
-        d_data->colorMap = colorMap;
-    }
+ */
+void QwtPlotSpectrogram::setColorMap( QwtColorMap* colorMap )
+{
+    if ( colorMap == NULL )
+        return;
+
+    if ( colorMap != m_data->colorMap )
+    {
+        delete m_data->colorMap;
+        m_data->colorMap = colorMap;
+    }
+
+    m_data->updateColorTable();
 
     invalidateCache();
@@ -156,25 +197,63 @@
    \return Color Map used for mapping the intensity values to colors
    \sa setColorMap()
-*/
-const QwtColorMap *QwtPlotSpectrogram::colorMap() const
-{
-    return d_data->colorMap;
-}
-
-/*!
-  Build and assign the default pen for the contour lines
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
+ */
+const QwtColorMap* QwtPlotSpectrogram::colorMap() const
+{
+    return m_data->colorMap;
+}
+
+/*!
+    Limit the number of colors being used by the color map
+
+    When using a color table the mapping from the value into a color
+    is usually faster as it can be done by simple lookups into a
+    precalculated color table.
+
+    Setting a table size > 0 enables using a color table, while setting
+    the size to 0 disables it.
+
+    The default size = 0, and no color table is used.
+
+    \param numColors Number of colors. 0 means not using a color table
+    \note The colorTableSize has no effect when using a color table
+          of QwtColorMap::Indexed, where the size is always 256.
+
+
+    \sa QwtColorMap::colorTable(), colorTableSize()
+ */
+void QwtPlotSpectrogram::setColorTableSize( int numColors )
+{
+    numColors = qMax( numColors, 0 );
+    if ( numColors != m_data->colorTableSize )
+    {
+        m_data->colorTableSize = numColors;
+        m_data->updateColorTable();
+        invalidateCache();
+    }
+}
+/*!
+    \return Size of the color table, 0 means not using a color table
+    \sa QwtColorMap::colorTable(), setColorTableSize()
+ */
+int QwtPlotSpectrogram::colorTableSize() const
+{
+    return m_data->colorTableSize;
+}
+
+/*!
+   Build and assign the default pen for the contour lines
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
  */
 void QwtPlotSpectrogram::setDefaultContourPen(
-    const QColor &color, qreal width, Qt::PenStyle style )
+    const QColor& color, qreal width, Qt::PenStyle style )
 {
     setDefaultContourPen( QPen( color, width, style ) );
@@ -190,10 +269,10 @@
 
    \sa defaultContourPen(), contourPen()
-*/
-void QwtPlotSpectrogram::setDefaultContourPen( const QPen &pen )
-{
-    if ( pen != d_data->defaultContourPen )
-    {
-        d_data->defaultContourPen = pen;
+ */
+void QwtPlotSpectrogram::setDefaultContourPen( const QPen& pen )
+{
+    if ( pen != m_data->defaultContourPen )
+    {
+        m_data->defaultContourPen = pen;
 
         legendChanged();
@@ -205,8 +284,8 @@
    \return Default contour pen
    \sa setDefaultContourPen()
-*/
+ */
 QPen QwtPlotSpectrogram::defaultContourPen() const
 {
-    return d_data->defaultContourPen;
+    return m_data->defaultContourPen;
 }
 
@@ -221,12 +300,12 @@
 
    \sa setDefaultContourPen(), setColorMap(), setContourLevels()
-*/
+ */
 QPen QwtPlotSpectrogram::contourPen( double level ) const
 {
-    if ( d_data->data == NULL || d_data->colorMap == NULL )
+    if ( m_data->data == NULL || m_data->colorMap == NULL )
         return QPen();
 
-    const QwtInterval intensityRange = d_data->data->interval(Qt::ZAxis);
-    const QColor c( d_data->colorMap->rgb( intensityRange, level ) );
+    const QwtInterval intensityRange = m_data->data->interval(Qt::ZAxis);
+    const QColor c( m_data->colorMap->rgb( intensityRange, level ) );
 
     return QPen( c );
@@ -242,15 +321,15 @@
    \sa testConrecFlag(), renderContourLines(),
        QwtRasterData::contourLines()
-*/
+ */
 void QwtPlotSpectrogram::setConrecFlag(
     QwtRasterData::ConrecFlag flag, bool on )
 {
-    if ( bool( d_data->conrecFlags & flag ) == on )
+    if ( bool( m_data->conrecFlags & flag ) == on )
         return;
 
     if ( on )
-        d_data->conrecFlags |= flag;
+        m_data->conrecFlags |= flag;
     else
-        d_data->conrecFlags &= ~flag;
+        m_data->conrecFlags &= ~flag;
 
     itemChanged();
@@ -268,9 +347,9 @@
    \sa setConrecClag(), renderContourLines(),
        QwtRasterData::contourLines()
-*/
+ */
 bool QwtPlotSpectrogram::testConrecFlag(
     QwtRasterData::ConrecFlag flag ) const
 {
-    return d_data->conrecFlags & flag;
+    return m_data->conrecFlags & flag;
 }
 
@@ -283,9 +362,9 @@
 
    \note contourLevels returns the same levels but sorted.
-*/
-void QwtPlotSpectrogram::setContourLevels( const QList<double> &levels )
-{
-    d_data->contourLevels = levels;
-    qSort( d_data->contourLevels );
+ */
+void QwtPlotSpectrogram::setContourLevels( const QList< double >& levels )
+{
+    m_data->contourLevels = levels;
+    std::sort( m_data->contourLevels.begin(), m_data->contourLevels.end() );
 
     legendChanged();
@@ -300,22 +379,22 @@
    \sa contourLevels(), renderContourLines(),
        QwtRasterData::contourLines()
-*/
-QList<double> QwtPlotSpectrogram::contourLevels() const
-{
-    return d_data->contourLevels;
-}
-
-/*!
-  Set the data to be displayed
-
-  \param data Spectrogram Data
-  \sa data()
-*/
-void QwtPlotSpectrogram::setData( QwtRasterData *data )
-{
-    if ( data != d_data->data )
-    {
-        delete d_data->data;
-        d_data->data = data;
+ */
+QList< double > QwtPlotSpectrogram::contourLevels() const
+{
+    return m_data->contourLevels;
+}
+
+/*!
+   Set the data to be displayed
+
+   \param data Spectrogram Data
+   \sa data()
+ */
+void QwtPlotSpectrogram::setData( QwtRasterData* data )
+{
+    if ( data != m_data->data )
+    {
+        delete m_data->data;
+        m_data->data = data;
 
         invalidateCache();
@@ -325,19 +404,19 @@
 
 /*!
-  \return Spectrogram data
-  \sa setData()
-*/
-const QwtRasterData *QwtPlotSpectrogram::data() const
-{
-    return d_data->data;
-}
-
-/*!
-  \return Spectrogram data
-  \sa setData()
-*/
-QwtRasterData *QwtPlotSpectrogram::data()
-{
-    return d_data->data;
+   \return Spectrogram data
+   \sa setData()
+ */
+const QwtRasterData* QwtPlotSpectrogram::data() const
+{
+    return m_data->data;
+}
+
+/*!
+   \return Spectrogram data
+   \sa setData()
+ */
+QwtRasterData* QwtPlotSpectrogram::data()
+{
+    return m_data->data;
 }
 
@@ -350,11 +429,11 @@
    \param axis X, Y, or Z axis
    \sa QwtRasterData::interval()
-*/
+ */
 QwtInterval QwtPlotSpectrogram::interval(Qt::Axis axis) const
 {
-    if ( d_data->data == NULL )
+    if ( m_data->data == NULL )
         return QwtInterval();
 
-    return d_data->data->interval( axis );
+    return m_data->data->interval( axis );
 }
 
@@ -374,11 +453,11 @@
    \sa QwtPlotRasterItem::pixelHint(), QwtRasterData::pixelHint(),
        render(), renderImage()
-*/
-QRectF QwtPlotSpectrogram::pixelHint( const QRectF &area ) const
-{
-    if ( d_data->data == NULL )
+ */
+QRectF QwtPlotSpectrogram::pixelHint( const QRectF& area ) const
+{
+    if ( m_data->data == NULL )
         return QRectF();
 
-    return d_data->data->pixelHint( area );
+    return m_data->data->pixelHint( area );
 }
 
@@ -388,8 +467,8 @@
    For each pixel of area the value is mapped into a color.
 
-  \param xMap X-Scale Map
-  \param yMap Y-Scale Map
-  \param area Requested area for the image in scale coordinates
-  \param imageSize Size of the requested image
+   \param xMap X-Scale Map
+   \param yMap Y-Scale Map
+   \param area Requested area for the image in scale coordinates
+   \param imageSize Size of the requested image
 
    \return A QImage::Format_Indexed8 or QImage::Format_ARGB32 depending
@@ -398,28 +477,28 @@
    \sa QwtRasterData::value(), QwtColorMap::rgb(),
        QwtColorMap::colorIndex()
-*/
+ */
 QImage QwtPlotSpectrogram::renderImage(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &area, const QSize &imageSize ) const
-{
-    if ( imageSize.isEmpty() || d_data->data == NULL
-        || d_data->colorMap == NULL )
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& area, const QSize& imageSize ) const
+{
+    if ( imageSize.isEmpty() || m_data->data == NULL
+        || m_data->colorMap == NULL )
     {
         return QImage();
     }
 
-    const QwtInterval intensityRange = d_data->data->interval( Qt::ZAxis );
+    const QwtInterval intensityRange = m_data->data->interval( Qt::ZAxis );
     if ( !intensityRange.isValid() )
         return QImage();
 
-    QImage::Format format = ( d_data->colorMap->format() == QwtColorMap::RGB )
+    const QImage::Format format = ( m_data->colorMap->format() == QwtColorMap::RGB )
         ? QImage::Format_ARGB32 : QImage::Format_Indexed8;
 
     QImage image( imageSize, format );
 
-    if ( d_data->colorMap->format() == QwtColorMap::Indexed )
-        image.setColorTable( d_data->colorMap->colorTable( intensityRange ) );
-
-    d_data->data->initRaster( area, image.size() );
+    if ( m_data->colorMap->format() == QwtColorMap::Indexed )
+        image.setColorTable( m_data->colorMap->colorTable256() );
+
+    m_data->data->initRaster( area, image.size() );
 
 #if DEBUG_RENDER
@@ -428,5 +507,5 @@
 #endif
 
-#if QT_VERSION >= 0x040400 && !defined(QT_NO_QFUTURE)
+#if !defined( QT_NO_QFUTURE )
     uint numThreads = renderThreadCount();
 
@@ -439,5 +518,7 @@
     const int numRows = imageSize.height() / numThreads;
 
-    QList< QFuture<void> > futures;
+    QVector< QFuture< void > > futures;
+    futures.reserve( numThreads - 1 );
+
     for ( uint i = 0; i < numThreads; i++ )
     {
@@ -451,12 +532,17 @@
         {
             futures += QtConcurrent::run(
+#if QT_VERSION >= 0x060000
+                &QwtPlotSpectrogram::renderTile, this,
+#else
                 this, &QwtPlotSpectrogram::renderTile,
+#endif
                 xMap, yMap, tile, &image );
         }
     }
+
     for ( int i = 0; i < futures.size(); i++ )
         futures[i].waitForFinished();
 
-#else // QT_VERSION < 0x040400
+#else
     const QRect tile( 0, 0, image.width(), image.height() );
     renderTile( xMap, yMap, tile, &image );
@@ -468,5 +554,5 @@
 #endif
 
-    d_data->data->discardRaster();
+    m_data->data->discardRaster();
 
     return image;
@@ -483,20 +569,26 @@
     \param tile Geometry of the tile in image coordinates
     \param image Image to be rendered
-*/
+ */
 void QwtPlotSpectrogram::renderTile(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRect &tile, QImage *image ) const
-{
-    const QwtInterval range = d_data->data->interval( Qt::ZAxis );
-    if ( !range.isValid() )
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRect& tile, QImage* image ) const
+{
+    const QwtInterval range = m_data->data->interval( Qt::ZAxis );
+    if ( range.width() <= 0.0 )
         return;
 
-    if ( d_data->colorMap->format() == QwtColorMap::RGB )
-    {
+    const bool hasGaps = !m_data->data->testAttribute( QwtRasterData::WithoutGaps );
+
+    if ( m_data->colorMap->format() == QwtColorMap::RGB )
+    {
+        const int numColors = m_data->colorTable.size();
+        const QRgb* rgbTable = m_data->colorTable.constData();
+        const QwtColorMap* colorMap = m_data->colorMap;
+
         for ( int y = tile.top(); y <= tile.bottom(); y++ )
         {
             const double ty = yMap.invTransform( y );
 
-            QRgb *line = reinterpret_cast<QRgb *>( image->scanLine( y ) );
+            QRgb* line = reinterpret_cast< QRgb* >( image->scanLine( y ) );
             line += tile.left();
 
@@ -505,10 +597,23 @@
                 const double tx = xMap.invTransform( x );
 
-                *line++ = d_data->colorMap->rgb( range,
-                    d_data->data->value( tx, ty ) );
+                const double value = m_data->data->value( tx, ty );
+
+                if ( hasGaps && qwtIsNaN( value ) )
+                {
+                    *line++ = 0u;
+                }
+                else if ( numColors == 0 )
+                {
+                    *line++ = colorMap->rgb( range, value );
+                }
+                else
+                {
+                    const uint index = colorMap->colorIndex( numColors, range, value );
+                    *line++ = rgbTable[index];
+                }
             }
         }
     }
-    else if ( d_data->colorMap->format() == QwtColorMap::Indexed )
+    else if ( m_data->colorMap->format() == QwtColorMap::Indexed )
     {
         for ( int y = tile.top(); y <= tile.bottom(); y++ )
@@ -516,5 +621,5 @@
             const double ty = yMap.invTransform( y );
 
-            unsigned char *line = image->scanLine( y );
+            unsigned char* line = image->scanLine( y );
             line += tile.left();
 
@@ -523,6 +628,15 @@
                 const double tx = xMap.invTransform( x );
 
-                *line++ = d_data->colorMap->colorIndex( range,
-                    d_data->data->value( tx, ty ) );
+                const double value = m_data->data->value( tx, ty );
+
+                if ( hasGaps && qwtIsNaN( value ) )
+                {
+                    *line++ = 0;
+                }
+                else
+                {
+                    const uint index = m_data->colorMap->colorIndex( 256, range, value );
+                    *line++ = static_cast< unsigned char >( index );
+                }
             }
         }
@@ -546,7 +660,7 @@
 
    \sa drawContourLines(), QwtRasterData::contourLines()
-*/
+ */
 QSize QwtPlotSpectrogram::contourRasterSize(
-    const QRectF &area, const QRect &rect ) const
+    const QRectF& area, const QRect& rect ) const
 {
     QSize raster = rect.size() / 2;
@@ -555,6 +669,6 @@
     if ( !pixelRect.isEmpty() )
     {
-        const QSize res( qCeil( rect.width() / pixelRect.width() ),
-            qCeil( rect.height() / pixelRect.height() ) );
+        const QSize res( qwtCeil( rect.width() / pixelRect.width() ),
+            qwtCeil( rect.height() / pixelRect.height() ) );
         raster = raster.boundedTo( res );
     }
@@ -572,13 +686,13 @@
    \sa contourLevels(), setConrecFlag(),
        QwtRasterData::contourLines()
-*/
+ */
 QwtRasterData::ContourLines QwtPlotSpectrogram::renderContourLines(
-    const QRectF &rect, const QSize &raster ) const
-{
-    if ( d_data->data == NULL )
+    const QRectF& rect, const QSize& raster ) const
+{
+    if ( m_data->data == NULL )
         return QwtRasterData::ContourLines();
 
-    return d_data->data->contourLines( rect, raster,
-        d_data->contourLevels, d_data->conrecFlags );
+    return m_data->data->contourLines( rect, raster,
+        m_data->contourLevels, m_data->conrecFlags );
 }
 
@@ -592,16 +706,16 @@
 
    \sa renderContourLines(), defaultContourPen(), contourPen()
-*/
-void QwtPlotSpectrogram::drawContourLines( QPainter *painter,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QwtRasterData::ContourLines &contourLines ) const
-{
-    if ( d_data->data == NULL )
+ */
+void QwtPlotSpectrogram::drawContourLines( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtRasterData::ContourLines& contourLines ) const
+{
+    if ( m_data->data == NULL )
         return;
 
-    const int numLevels = d_data->contourLevels.size();
+    const int numLevels = m_data->contourLevels.size();
     for ( int l = 0; l < numLevels; l++ )
     {
-        const double level = d_data->contourLevels[l];
+        const double level = m_data->contourLevels[l];
 
         QPen pen = defaultContourPen();
@@ -614,11 +728,11 @@
         painter->setPen( pen );
 
-        const QPolygonF &lines = contourLines[level];
+        const QPolygonF& lines = contourLines[level];
         for ( int i = 0; i < lines.size(); i += 2 )
         {
             const QPointF p1( xMap.transform( lines[i].x() ),
                 yMap.transform( lines[i].y() ) );
-            const QPointF p2( xMap.transform( lines[i+1].x() ),
-                yMap.transform( lines[i+1].y() ) );
+            const QPointF p2( xMap.transform( lines[i + 1].x() ),
+                yMap.transform( lines[i + 1].y() ) );
 
             QwtPainter::drawLine( painter, p1, p2 );
@@ -628,22 +742,22 @@
 
 /*!
-  \brief Draw the spectrogram
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas in painter coordinates
-
-  \sa setDisplayMode(), renderImage(),
+   \brief Draw the spectrogram
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas in painter coordinates
+
+   \sa setDisplayMode(), renderImage(),
       QwtPlotRasterItem::draw(), drawContourLines()
-*/
-void QwtPlotSpectrogram::draw( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
-{
-    if ( d_data->displayMode & ImageMode )
+ */
+void QwtPlotSpectrogram::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
+{
+    if ( m_data->displayMode & ImageMode )
         QwtPlotRasterItem::draw( painter, xMap, yMap, canvasRect );
 
-    if ( d_data->displayMode & ContourMode )
+    if ( m_data->displayMode & ContourMode )
     {
         // Add some pixels at the borders
Index: /trunk/BNC/qwt/qwt_plot_spectrogram.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_spectrogram.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_spectrogram.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -14,33 +14,31 @@
 #include "qwt_raster_data.h"
 #include "qwt_plot_rasteritem.h"
-#include <qlist.h>
 
 class QwtColorMap;
+template< typename T > class QList;
 
 /*!
-  \brief A plot item, which displays a spectrogram
+   \brief A plot item, which displays a spectrogram
 
-  A spectrogram displays 3-dimensional data, where the 3rd dimension
-  ( the intensity ) is displayed using colors. The colors are calculated
-  from the values using a color map.
+   A spectrogram displays 3-dimensional data, where the 3rd dimension
+   ( the intensity ) is displayed using colors. The colors are calculated
+   from the values using a color map.
 
-  On multi-core systems the performance of the image composition
-  can often be improved by dividing the area into tiles - each of them
-  rendered in a different thread ( see QwtPlotItem::setRenderThreadCount() ).
+   On multi-core systems the performance of the image composition
+   can often be improved by dividing the area into tiles - each of them
+   rendered in a different thread ( see QwtPlotItem::setRenderThreadCount() ).
 
-  In ContourMode contour lines are painted for the contour levels.
+   In ContourMode contour lines are painted for the contour levels.
 
-  \image html spectrogram3.png
+   \sa QwtRasterData, QwtColorMap, QwtPlotItem::setRenderThreadCount()
+ */
 
-  \sa QwtRasterData, QwtColorMap, QwtPlotItem::setRenderThreadCount()
-*/
-
-class QWT_EXPORT QwtPlotSpectrogram: public QwtPlotRasterItem
+class QWT_EXPORT QwtPlotSpectrogram : public QwtPlotRasterItem
 {
-public:
+  public:
     /*!
-      The display mode controls how the raster data will be represented.
-      \sa setDisplayMode(), testDisplayMode()
-    */
+       The display mode controls how the raster data will be represented.
+       \sa setDisplayMode(), testDisplayMode()
+     */
 
     enum DisplayMode
@@ -53,8 +51,7 @@
     };
 
-    //! Display modes
-    typedef QFlags<DisplayMode> DisplayModes;
+    Q_DECLARE_FLAGS( DisplayModes, DisplayMode )
 
-    explicit QwtPlotSpectrogram( const QString &title = QString() );
+    explicit QwtPlotSpectrogram( const QString& title = QString() );
     virtual ~QwtPlotSpectrogram();
 
@@ -62,17 +59,20 @@
     bool testDisplayMode( DisplayMode ) const;
 
-    void setData( QwtRasterData *data );
-    const QwtRasterData *data() const;
-    QwtRasterData *data();
+    void setData( QwtRasterData* data );
+    const QwtRasterData* data() const;
+    QwtRasterData* data();
 
-    void setColorMap( QwtColorMap * );
-    const QwtColorMap *colorMap() const;
+    void setColorMap( QwtColorMap* );
+    const QwtColorMap* colorMap() const;
 
-    virtual QwtInterval interval(Qt::Axis) const;
-    virtual QRectF pixelHint( const QRectF & ) const;
+    void setColorTableSize( int numColors );
+    int colorTableSize() const;
 
-    void setDefaultContourPen( const QColor &,
+    virtual QwtInterval interval( Qt::Axis ) const QWT_OVERRIDE;
+    virtual QRectF pixelHint( const QRectF& ) const QWT_OVERRIDE;
+
+    void setDefaultContourPen( const QColor&,
         qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setDefaultContourPen( const QPen & );
+    void setDefaultContourPen( const QPen& );
     QPen defaultContourPen() const;
 
@@ -82,34 +82,34 @@
     bool testConrecFlag( QwtRasterData::ConrecFlag ) const;
 
-    void setContourLevels( const QList<double> & );
-    QList<double> contourLevels() const;
+    void setContourLevels( const QList< double >& );
+    QList< double > contourLevels() const;
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
-    virtual void draw( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect ) const;
+    virtual void draw( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
 
-protected:
+  protected:
     virtual QImage renderImage(
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &area, const QSize &imageSize ) const;
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& area, const QSize& imageSize ) const QWT_OVERRIDE;
 
     virtual QSize contourRasterSize(
-        const QRectF &, const QRect & ) const;
+        const QRectF&, const QRect& ) const;
 
     virtual QwtRasterData::ContourLines renderContourLines(
-        const QRectF &rect, const QSize &raster ) const;
+        const QRectF& rect, const QSize& raster ) const;
 
-    virtual void drawContourLines( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
+    virtual void drawContourLines( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
         const QwtRasterData::ContourLines& ) const;
 
-    void renderTile( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRect &tile, QImage * ) const;
+    void renderTile( const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRect& tile, QImage* ) const;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_svgitem.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_svgitem.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_svgitem.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,48 +9,25 @@
 
 #include "qwt_plot_svgitem.h"
-#include "qwt_scale_map.h"
-#include "qwt_painter.h"
-#include <qpainter.h>
+#include "qwt_text.h"
+#include "qwt_graphic.h"
+
 #include <qsvgrenderer.h>
-
-class QwtPlotSvgItem::PrivateData
-{
-public:
-    PrivateData()
-    {
-    }
-
-    QRectF boundingRect;
-    QSvgRenderer renderer;
-};
 
 /*!
    \brief Constructor
-
-   Sets the following item attributes:
-   - QwtPlotItem::AutoScale: true
-   - QwtPlotItem::Legend:    false
-
    \param title Title
-*/
-QwtPlotSvgItem::QwtPlotSvgItem( const QString& title ):
-    QwtPlotItem( QwtText( title ) )
+ */
+QwtPlotSvgItem::QwtPlotSvgItem( const QString& title )
+    : QwtPlotGraphicItem( QwtText( title ) )
 {
-    init();
 }
 
 /*!
    \brief Constructor
-
-   Sets the following item attributes:
-   - QwtPlotItem::AutoScale: true
-   - QwtPlotItem::Legend:    false
-
    \param title Title
-*/
-QwtPlotSvgItem::QwtPlotSvgItem( const QwtText& title ):
-    QwtPlotItem( title )
+ */
+QwtPlotSvgItem::QwtPlotSvgItem( const QwtText& title )
+    : QwtPlotGraphicItem( title )
 {
-    init();
 }
 
@@ -58,22 +35,4 @@
 QwtPlotSvgItem::~QwtPlotSvgItem()
 {
-    delete d_data;
-}
-
-void QwtPlotSvgItem::init()
-{
-    d_data = new PrivateData();
-    d_data->boundingRect = QwtPlotItem::boundingRect();
-
-    setItemAttribute( QwtPlotItem::AutoScale, true );
-    setItemAttribute( QwtPlotItem::Legend, false );
-
-    setZ( 8.0 );
-}
-
-//! \return QwtPlotItem::Rtti_PlotSVG
-int QwtPlotSvgItem::rtti() const
-{
-    return QwtPlotItem::Rtti_PlotSVG;
 }
 
@@ -85,13 +44,20 @@
 
    \return true, if the SVG file could be loaded
-*/
-bool QwtPlotSvgItem::loadFile( const QRectF &rect,
-    const QString &fileName )
+ */
+bool QwtPlotSvgItem::loadFile( const QRectF& rect,
+    const QString& fileName )
 {
-    d_data->boundingRect = rect;
-    const bool ok = d_data->renderer.load( fileName );
+    QwtGraphic graphic;
 
-    legendChanged();
-    itemChanged();
+    QSvgRenderer renderer;
+
+    const bool ok = renderer.load( fileName );
+    if ( ok )
+    {
+        QPainter p( &graphic );
+        renderer.render( &p );
+    }
+
+    setGraphic( rect, graphic );
 
     return ok;
@@ -105,115 +71,21 @@
 
    \return true, if the SVG data could be loaded
-*/
-bool QwtPlotSvgItem::loadData( const QRectF &rect,
-    const QByteArray &data )
+ */
+bool QwtPlotSvgItem::loadData( const QRectF& rect,
+    const QByteArray& data )
 {
-    d_data->boundingRect = rect;
-    const bool ok = d_data->renderer.load( data );
+    QwtGraphic graphic;
 
-    legendChanged();
-    itemChanged();
+    QSvgRenderer renderer;
+
+    const bool ok = renderer.load( data );
+    if ( ok )
+    {
+        QPainter p( &graphic );
+        renderer.render( &p );
+    }
+
+    setGraphic( rect, graphic );
 
     return ok;
 }
-
-//! Bounding rectangle of the item
-QRectF QwtPlotSvgItem::boundingRect() const
-{
-    return d_data->boundingRect;
-}
-
-//! \return Renderer used to render the SVG data
-const QSvgRenderer &QwtPlotSvgItem::renderer() const
-{
-    return d_data->renderer;
-}
-
-//! \return Renderer used to render the SVG data
-QSvgRenderer &QwtPlotSvgItem::renderer()
-{
-    return d_data->renderer;
-}
-
-/*!
-  Draw the SVG item
-
-  \param painter Painter
-  \param xMap X-Scale Map
-  \param yMap Y-Scale Map
-  \param canvasRect Contents rect of the plot canvas
-*/
-void QwtPlotSvgItem::draw( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
-{
-    const QRectF cRect = QwtScaleMap::invTransform(
-        xMap, yMap, canvasRect.toRect() );
-    const QRectF bRect = boundingRect();
-    if ( bRect.isValid() && cRect.isValid() )
-    {
-        QRectF rect = bRect;
-        if ( bRect.contains( cRect ) )
-            rect = cRect;
-
-        const QRectF r = QwtScaleMap::transform( xMap, yMap, rect );
-        render( painter, viewBox( rect ), r );
-    }
-}
-
-/*!
-  Render the SVG data
-
-  \param painter Painter
-  \param viewBox View Box, see QSvgRenderer::viewBox()
-  \param rect Target rectangle on the paint device
-*/
-void QwtPlotSvgItem::render( QPainter *painter,
-    const QRectF &viewBox, const QRectF &rect ) const
-{
-    if ( !viewBox.isValid() )
-        return;
-
-    QRectF r = rect;
-
-    if ( QwtPainter::roundingAlignment( painter ) )
-    {
-        r.setLeft ( qRound( r.left() ) );
-        r.setRight ( qRound( r.right() ) );
-        r.setTop ( qRound( r.top() ) );
-        r.setBottom ( qRound( r.bottom() ) );
-    }
-
-    d_data->renderer.setViewBox( viewBox );
-    d_data->renderer.render( painter, r );
-}
-
-/*!
-  Calculate the view box from rect and boundingRect().
-
-  \param rect Rectangle in scale coordinates
-  \return View box, see QSvgRenderer::viewBox()
-*/
-QRectF QwtPlotSvgItem::viewBox( const QRectF &rect ) const
-{
-    const QSize sz = d_data->renderer.defaultSize();
-    const QRectF br = boundingRect();
-
-    if ( !rect.isValid() || !br.isValid() || sz.isNull() )
-        return QRectF();
-
-    QwtScaleMap xMap;
-    xMap.setScaleInterval( br.left(), br.right() );
-    xMap.setPaintInterval( 0, sz.width() );
-
-    QwtScaleMap yMap;
-    yMap.setScaleInterval( br.top(), br.bottom() );
-    yMap.setPaintInterval( sz.height(), 0 );
-
-    const double x1 = xMap.transform( rect.left() );
-    const double x2 = xMap.transform( rect.right() );
-    const double y1 = yMap.transform( rect.bottom() );
-    const double y2 = yMap.transform( rect.top() );
-
-    return QRectF( x1, y1, x2 - x1, y2 - y1 );
-}
Index: /trunk/BNC/qwt/qwt_plot_svgitem.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_svgitem.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_svgitem.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -8,53 +8,31 @@
  *****************************************************************************/
 
-#ifndef QWT_PLOT_SVGITEM_H
-#define QWT_PLOT_SVGITEM_H
+#ifndef QWT_PLOT_SVG_ITEM_H
+#define QWT_PLOT_SVG_ITEM_H
 
 #include "qwt_global.h"
-#include "qwt_plot_item.h"
-#include <qstring.h>
+#include "qwt_plot_graphicitem.h"
 
-class QSvgRenderer;
 class QByteArray;
 
 /*!
-  \brief A plot item, which displays
+   \brief A plot item, which displays
          data in Scalable Vector Graphics (SVG) format.
 
-  SVG images are often used to display maps
-*/
+   SVG images are often used to display maps
 
-class QWT_EXPORT QwtPlotSvgItem: public QwtPlotItem
+   QwtPlotSvgItem is only a small convenience wrapper class for
+   QwtPlotGraphicItem, that creates a QwtGraphic from SVG data.
+ */
+
+class QWT_EXPORT QwtPlotSvgItem : public QwtPlotGraphicItem
 {
-public:
+  public:
     explicit QwtPlotSvgItem( const QString& title = QString() );
     explicit QwtPlotSvgItem( const QwtText& title );
     virtual ~QwtPlotSvgItem();
 
-    bool loadFile( const QRectF&, const QString &fileName );
-    bool loadData( const QRectF&, const QByteArray & );
-
-    virtual QRectF boundingRect() const;
-
-    virtual void draw( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect ) const;
-
-    virtual int rtti() const;
-
-protected:
-    const QSvgRenderer &renderer() const;
-    QSvgRenderer &renderer();
-
-    void render( QPainter *,
-        const QRectF &viewBox, const QRectF &rect ) const;
-
-    QRectF viewBox( const QRectF &rect ) const;
-
-private:
-    void init();
-
-    class PrivateData;
-    PrivateData *d_data;
+    bool loadFile( const QRectF&, const QString& fileName );
+    bool loadData( const QRectF&, const QByteArray& );
 };
 
Index: /trunk/BNC/qwt/qwt_plot_textlabel.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_textlabel.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_textlabel.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,11 +10,13 @@
 #include "qwt_plot_textlabel.h"
 #include "qwt_painter.h"
-#include "qwt_scale_map.h"
+#include "qwt_text.h"
+#include "qwt_math.h"
+
 #include <qpainter.h>
+#include <qpaintengine.h>
 #include <qpixmap.h>
-#include <qmath.h>
 
 static QRect qwtItemRect( int renderFlags,
-    const QRectF &rect, const QSizeF &itemSize )
+    const QRectF& rect, const QSizeF& itemSize )
 {
     int x;
@@ -51,7 +53,7 @@
 class QwtPlotTextLabel::PrivateData
 {
-public:
-    PrivateData():
-        margin( 5 )
+  public:
+    PrivateData()
+        : margin( 5 )
     {
     }
@@ -76,10 +78,10 @@
 
    \sa QwtPlotItem::setItemAttribute(), QwtPlotItem::setZ()
-*/
-
-QwtPlotTextLabel::QwtPlotTextLabel():
-    QwtPlotItem( QwtText( "Label" ) )
-{
-    d_data = new PrivateData;
+ */
+
+QwtPlotTextLabel::QwtPlotTextLabel()
+    : QwtPlotItem( QwtText( "Label" ) )
+{
+    m_data = new PrivateData;
 
     setItemAttribute( QwtPlotItem::AutoScale, false );
@@ -92,5 +94,5 @@
 QwtPlotTextLabel::~QwtPlotTextLabel()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -102,18 +104,18 @@
 
 /*!
-  Set the text
-
-  The label will be aligned to the plot canvas according to
-  the alignment flags of text.
-
-  \param text Text to be displayed
-
-  \sa text(), QwtText::renderFlags()
-*/
-void QwtPlotTextLabel::setText( const QwtText &text )
-{
-    if ( d_data->text != text )
-    {
-        d_data->text = text;
+   Set the text
+
+   The label will be aligned to the plot canvas according to
+   the alignment flags of text.
+
+   \param text Text to be displayed
+
+   \sa text(), QwtText::renderFlags()
+ */
+void QwtPlotTextLabel::setText( const QwtText& text )
+{
+    if ( m_data->text != text )
+    {
+        m_data->text = text;
 
         invalidateCache();
@@ -123,29 +125,29 @@
 
 /*!
-  \return Text to be displayed
-  \sa setText()
-*/
+   \return Text to be displayed
+   \sa setText()
+ */
 QwtText QwtPlotTextLabel::text() const
 {
-    return d_data->text;
-}
-
-/*!
-  Set the margin
-
-  The margin is the distance between the contentsRect()
-  of the plot canvas and the rectangle where the label can
-  be displayed.
-
-  \param margin Margin
-
-  \sa margin(), textRect()
+    return m_data->text;
+}
+
+/*!
+   Set the margin
+
+   The margin is the distance between the contentsRect()
+   of the plot canvas and the rectangle where the label can
+   be displayed.
+
+   \param margin Margin
+
+   \sa margin(), textRect()
  */
 void QwtPlotTextLabel::setMargin( int margin )
 {
     margin = qMax( margin, 0 );
-    if ( d_data->margin != margin )
-    {
-        d_data->margin = margin;
+    if ( m_data->margin != margin )
+    {
+        m_data->margin = margin;
         itemChanged();
     }
@@ -153,34 +155,34 @@
 
 /*!
-  \return Margin added to the contentsMargins() of the canvas
-  \sa setMargin()
-*/
+   \return Margin added to the contentsMargins() of the canvas
+   \sa setMargin()
+ */
 int QwtPlotTextLabel::margin() const
 {
-    return d_data->margin;
-}
-
-/*!
-  Draw the text label
-
-  \param painter Painter
-  \param xMap x Scale Map
-  \param yMap y Scale Map
-  \param canvasRect Contents rectangle of the canvas in painter coordinates
-
-  \sa textRect()
-*/
-
-void QwtPlotTextLabel::draw( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
+    return m_data->margin;
+}
+
+/*!
+   Draw the text label
+
+   \param painter Painter
+   \param xMap x Scale Map
+   \param yMap y Scale Map
+   \param canvasRect Contents rectangle of the canvas in painter coordinates
+
+   \sa textRect()
+ */
+
+void QwtPlotTextLabel::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
 {
     Q_UNUSED( xMap );
     Q_UNUSED( yMap );
 
-    const int m = d_data->margin;
+    const int m = m_data->margin;
 
     const QRectF rect = textRect( canvasRect.adjusted( m, m, -m, -m ),
-        d_data->text.textSize( painter->font() ) );
+        m_data->text.textSize( painter->font() ) );
 
     bool doCache = QwtPainter::roundingAlignment( painter );
@@ -208,42 +210,41 @@
 
         int pw = 0;
-        if ( d_data->text.borderPen().style() != Qt::NoPen )
-            pw = qMax( d_data->text.borderPen().width(), 1 );
+        if ( m_data->text.borderPen().style() != Qt::NoPen )
+            pw = qMax( m_data->text.borderPen().width(), 1 );
 
         QRect pixmapRect;
-        pixmapRect.setLeft( qFloor( rect.left() ) - pw );
-        pixmapRect.setTop( qFloor( rect.top() ) - pw );
-        pixmapRect.setRight( qCeil( rect.right() ) + pw );
-        pixmapRect.setBottom( qCeil( rect.bottom() ) + pw );
-
-#define QWT_HIGH_DPI 1
-
-#if QT_VERSION >= 0x050100 && QWT_HIGH_DPI
-        const qreal pixelRatio = painter->device()->devicePixelRatio();
+        pixmapRect.setLeft( qwtFloor( rect.left() ) - pw );
+        pixmapRect.setTop( qwtFloor( rect.top() ) - pw );
+        pixmapRect.setRight( qwtCeil( rect.right() ) + pw );
+        pixmapRect.setBottom( qwtCeil( rect.bottom() ) + pw );
+
+#if QT_VERSION >= 0x050000
+        const qreal pixelRatio = QwtPainter::devicePixelRatio( painter->device() );
         const QSize scaledSize = pixmapRect.size() * pixelRatio;
 #else
         const QSize scaledSize = pixmapRect.size();
 #endif
-        if ( d_data->pixmap.isNull() ||
-            ( scaledSize != d_data->pixmap.size() )  )
+
+        if ( m_data->pixmap.isNull() ||
+            ( scaledSize != m_data->pixmap.size() ) )
         {
-            d_data->pixmap = QPixmap( scaledSize );
-#if QT_VERSION >= 0x050100 && QWT_HIGH_DPI
-            d_data->pixmap.setDevicePixelRatio( pixelRatio );
+            m_data->pixmap = QPixmap( scaledSize );
+#if QT_VERSION >= 0x050000
+            m_data->pixmap.setDevicePixelRatio( pixelRatio );
 #endif
-            d_data->pixmap.fill( Qt::transparent );
+            m_data->pixmap.fill( Qt::transparent );
 
             const QRect r( pw, pw,
                 pixmapRect.width() - 2 * pw, pixmapRect.height() - 2 * pw );
 
-            QPainter pmPainter( &d_data->pixmap );
-            d_data->text.draw( &pmPainter, r );
+            QPainter pmPainter( &m_data->pixmap );
+            m_data->text.draw( &pmPainter, r );
         }
 
-        painter->drawPixmap( pixmapRect, d_data->pixmap );
+        painter->drawPixmap( pixmapRect, m_data->pixmap );
     }
     else
     {
-        d_data->text.draw( painter, rect );
+        m_data->text.draw( painter, rect );
     }
 }
@@ -261,7 +262,7 @@
  */
 QRectF QwtPlotTextLabel::textRect(
-    const QRectF &rect, const QSizeF &textSize ) const
-{
-    return qwtItemRect( d_data->text.renderFlags(), rect, textSize );
+    const QRectF& rect, const QSizeF& textSize ) const
+{
+    return qwtItemRect( m_data->text.renderFlags(), rect, textSize );
 }
 
@@ -269,4 +270,4 @@
 void QwtPlotTextLabel::invalidateCache()
 {
-    d_data->pixmap = QPixmap();
-}
+    m_data->pixmap = QPixmap();
+}
Index: /trunk/BNC/qwt/qwt_plot_textlabel.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_textlabel.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_textlabel.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,22 +9,23 @@
 
 #ifndef QWT_PLOT_TEXT_LABEL_H
-#define QWT_PLOT_TEXT_LABEL_H 1
+#define QWT_PLOT_TEXT_LABEL_H
 
 #include "qwt_global.h"
 #include "qwt_plot_item.h"
-#include "qwt_text.h"
+
+class QwtText;
 
 /*!
-  \brief A plot item, which displays a text label
+   \brief A plot item, which displays a text label
 
-  QwtPlotTextLabel displays a text label aligned to the plot canvas.
+   QwtPlotTextLabel displays a text label aligned to the plot canvas.
 
-  In opposite to QwtPlotMarker the position of the label is unrelated to
-  plot coordinates.
+   In opposite to QwtPlotMarker the position of the label is unrelated to
+   plot coordinates.
 
-  As drawing a text is an expensive operation the label is cached
-  in a pixmap to speed up replots.
+   As drawing a text is an expensive operation the label is cached
+   in a pixmap to speed up replots.
 
-  \par Example
+   \par Example
     The following code shows how to add a title.
     \code
@@ -40,18 +41,17 @@
       titleItem->attach( plot );
     \endcode
-  \endpar
 
-  \sa QwtPlotMarker
-*/
+   \sa QwtPlotMarker
+ */
 
-class QWT_EXPORT QwtPlotTextLabel: public QwtPlotItem
+class QWT_EXPORT QwtPlotTextLabel : public QwtPlotItem
 {
-public:
+  public:
     QwtPlotTextLabel();
     virtual ~QwtPlotTextLabel();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
-    void setText( const QwtText & );
+    void setText( const QwtText& );
     QwtText text() const;
 
@@ -59,16 +59,16 @@
     int margin() const;
 
-    virtual QRectF textRect( const QRectF &, const QSizeF & ) const;
+    virtual QRectF textRect( const QRectF&, const QSizeF& ) const;
 
-protected:
-    virtual void draw( QPainter *,
-        const QwtScaleMap &, const QwtScaleMap &,
-        const QRectF &) const;
+  protected:
+    virtual void draw( QPainter*,
+        const QwtScaleMap&, const QwtScaleMap&,
+        const QRectF&) const QWT_OVERRIDE;
 
     void invalidateCache();
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_tradingcurve.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_tradingcurve.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_tradingcurve.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,9 +10,12 @@
 #include "qwt_plot_tradingcurve.h"
 #include "qwt_scale_map.h"
-#include "qwt_clipper.h"
 #include "qwt_painter.h"
+#include "qwt_text.h"
+#include "qwt_graphic.h"
+#include "qwt_math.h"
+
 #include <qpainter.h>
 
-static inline bool qwtIsSampleInside( const QwtOHLCSample &sample,
+static inline bool qwtIsSampleInside( const QwtOHLCSample& sample,
     double tMin, double tMax, double vMin, double vMax )
 {
@@ -28,11 +31,11 @@
 class QwtPlotTradingCurve::PrivateData
 {
-public:
-    PrivateData():
-        symbolStyle( QwtPlotTradingCurve::CandleStick ),
-        symbolExtent( 0.6 ),
-        minSymbolWidth( 2.0 ),
-        maxSymbolWidth( -1.0 ),
-        paintAttributes( QwtPlotTradingCurve::ClipSymbols )
+  public:
+    PrivateData()
+        : symbolStyle( QwtPlotTradingCurve::CandleStick )
+        , symbolExtent( 0.6 )
+        , minSymbolWidth( 2.0 )
+        , maxSymbolWidth( -1.0 )
+        , paintAttributes( QwtPlotTradingCurve::ClipSymbols )
     {
         symbolBrush[0] = QBrush( Qt::white );
@@ -52,9 +55,9 @@
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotTradingCurve::QwtPlotTradingCurve( const QwtText &title ):
-    QwtPlotSeriesItem( title )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotTradingCurve::QwtPlotTradingCurve( const QwtText& title )
+    : QwtPlotSeriesItem( title )
 {
     init();
@@ -62,9 +65,9 @@
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotTradingCurve::QwtPlotTradingCurve( const QString &title ):
-    QwtPlotSeriesItem( QwtText( title ) )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotTradingCurve::QwtPlotTradingCurve( const QString& title )
+    : QwtPlotSeriesItem( QwtText( title ) )
 {
     init();
@@ -74,5 +77,5 @@
 QwtPlotTradingCurve::~QwtPlotTradingCurve()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -83,5 +86,5 @@
     setItemAttribute( QwtPlotItem::AutoScale, true );
 
-    d_data = new PrivateData;
+    m_data = new PrivateData;
     setData( new QwtTradingChartData() );
 
@@ -96,17 +99,17 @@
 
 /*!
-  Specify an attribute how to draw the curve
-
-  \param attribute Paint attribute
-  \param on On/Off
-  \sa testPaintAttribute()
-*/
+   Specify an attribute how to draw the curve
+
+   \param attribute Paint attribute
+   \param on On/Off
+   \sa testPaintAttribute()
+ */
 void QwtPlotTradingCurve::setPaintAttribute(
     PaintAttribute attribute, bool on )
 {
     if ( on )
-        d_data->paintAttributes |= attribute;
+        m_data->paintAttributes |= attribute;
     else
-        d_data->paintAttributes &= ~attribute;
+        m_data->paintAttributes &= ~attribute;
 }
 
@@ -114,19 +117,19 @@
     \return True, when attribute is enabled
     \sa PaintAttribute, setPaintAttribute()
-*/
+ */
 bool QwtPlotTradingCurve::testPaintAttribute(
     PaintAttribute attribute ) const
 {
-    return ( d_data->paintAttributes & attribute );
-}
-
-/*!
-  Initialize data with an array of samples.
-  \param samples Vector of samples
-
-  \sa QwtPlotSeriesItem::setData()
-*/
+    return ( m_data->paintAttributes & attribute );
+}
+
+/*!
+   Initialize data with an array of samples.
+   \param samples Vector of samples
+
+   \sa QwtPlotSeriesItem::setData()
+ */
 void QwtPlotTradingCurve::setSamples(
-    const QVector<QwtOHLCSample> &samples )
+    const QVector< QwtOHLCSample >& samples )
 {
     setData( new QwtTradingChartData( samples ) );
@@ -134,15 +137,15 @@
 
 /*!
-  Assign a series of samples
-
-  setSamples() is just a wrapper for setData() without any additional
-  value - beside that it is easier to find for the developer.
-
-  \param data Data
-  \warning The item takes ownership of the data object, deleting
+   Assign a series of samples
+
+   setSamples() is just a wrapper for setData() without any additional
+   value - beside that it is easier to find for the developer.
+
+   \param data Data
+   \warning The item takes ownership of the data object, deleting
            it when its not used anymore.
-*/
+ */
 void QwtPlotTradingCurve::setSamples(
-    QwtSeriesData<QwtOHLCSample> *data )
+    QwtSeriesData< QwtOHLCSample >* data )
 {
     setData( data );
@@ -150,16 +153,16 @@
 
 /*!
-  Set the symbol style
-
-  \param style Symbol style
-
-  \sa symbolStyle(), setSymbolExtent(),
+   Set the symbol style
+
+   \param style Symbol style
+
+   \sa symbolStyle(), setSymbolExtent(),
       setSymbolPen(), setSymbolBrush()
-*/
+ */
 void QwtPlotTradingCurve::setSymbolStyle( SymbolStyle style )
 {
-    if ( style != d_data->symbolStyle )
-    {
-        d_data->symbolStyle = style;
+    if ( style != m_data->symbolStyle )
+    {
+        m_data->symbolStyle = style;
 
         legendChanged();
@@ -169,27 +172,27 @@
 
 /*!
-  \return Symbol style
-  \sa setSymbolStyle(), symbolExtent(), symbolPen(), symbolBrush()
-*/
+   \return Symbol style
+   \sa setSymbolStyle(), symbolExtent(), symbolPen(), symbolBrush()
+ */
 QwtPlotTradingCurve::SymbolStyle QwtPlotTradingCurve::symbolStyle() const
 {
-    return d_data->symbolStyle;
-}
-
-/*!
-  Build and assign the symbol pen
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
+    return m_data->symbolStyle;
+}
+
+/*!
+   Build and assign the symbol pen
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
  */
 void QwtPlotTradingCurve::setSymbolPen(
-    const QColor &color, qreal width, Qt::PenStyle style )
+    const QColor& color, qreal width, Qt::PenStyle style )
 {
     setSymbolPen( QPen( color, width, style ) );
@@ -197,16 +200,16 @@
 
 /*!
-  \brief Set the symbol pen
-
-  The symbol pen is used for rendering the lines of the
-  bar or candlestick symbols
-
-  \sa symbolPen(), setSymbolBrush()
-*/
-void QwtPlotTradingCurve::setSymbolPen( const QPen &pen )
-{
-    if ( pen != d_data->symbolPen )
-    {
-        d_data->symbolPen = pen;
+   \brief Set the symbol pen
+
+   The symbol pen is used for rendering the lines of the
+   bar or candlestick symbols
+
+   \sa symbolPen(), setSymbolBrush()
+ */
+void QwtPlotTradingCurve::setSymbolPen( const QPen& pen )
+{
+    if ( pen != m_data->symbolPen )
+    {
+        m_data->symbolPen = pen;
 
         legendChanged();
@@ -216,23 +219,23 @@
 
 /*!
-  \return Symbol pen
-  \sa setSymbolPen(), symbolBrush()
-*/
+   \return Symbol pen
+   \sa setSymbolPen(), symbolBrush()
+ */
 QPen QwtPlotTradingCurve::symbolPen() const
 {
-    return d_data->symbolPen;
-}
-
-/*!
-  Set the symbol brush
-
-  \param direction Direction type
-  \param brush Brush used to fill the body of all candlestick
+    return m_data->symbolPen;
+}
+
+/*!
+   Set the symbol brush
+
+   \param direction Direction type
+   \param brush Brush used to fill the body of all candlestick
                symbols with the direction
 
-  \sa symbolBrush(), setSymbolPen()
-*/
+   \sa symbolBrush(), setSymbolPen()
+ */
 void QwtPlotTradingCurve::setSymbolBrush(
-    Direction direction, const QBrush &brush )
+    Direction direction, const QBrush& brush )
 {
     // silencing -Wtautological-constant-out-of-range-compare
@@ -241,7 +244,7 @@
         return;
 
-    if ( brush != d_data->symbolBrush[ index ] )
-    {
-        d_data->symbolBrush[ index ] = brush;
+    if ( brush != m_data->symbolBrush[ index ] )
+    {
+        m_data->symbolBrush[ index ] = brush;
 
         legendChanged();
@@ -251,10 +254,10 @@
 
 /*!
-  \param direction
-  \return Brush used to fill the body of all candlestick
+   \param direction
+   \return Brush used to fill the body of all candlestick
           symbols with the direction
 
-  \sa setSymbolPen(), symbolBrush()
-*/
+   \sa setSymbolPen(), symbolBrush()
+ */
 QBrush QwtPlotTradingCurve::symbolBrush( Direction direction ) const
 {
@@ -263,26 +266,26 @@
         return QBrush();
 
-    return d_data->symbolBrush[ index ];
-}
-
-/*!
-  \brief Set the extent of the symbol
-
-  The width of the symbol is given in scale coordinates. When painting
-  a symbol the width is scaled into paint device coordinates
-  by scaledSymbolWidth(). The scaled width is bounded by
-  minSymbolWidth(), maxSymbolWidth()
-
-  \param extent Symbol width in scale coordinates
-
-  \sa symbolExtent(), scaledSymbolWidth(),
+    return m_data->symbolBrush[ index ];
+}
+
+/*!
+   \brief Set the extent of the symbol
+
+   The width of the symbol is given in scale coordinates. When painting
+   a symbol the width is scaled into paint device coordinates
+   by scaledSymbolWidth(). The scaled width is bounded by
+   minSymbolWidth(), maxSymbolWidth()
+
+   \param extent Symbol width in scale coordinates
+
+   \sa symbolExtent(), scaledSymbolWidth(),
       setMinSymbolWidth(), setMaxSymbolWidth()
-*/
+ */
 void QwtPlotTradingCurve::setSymbolExtent( double extent )
 {
-    extent = qMax( 0.0, extent );
-    if ( extent != d_data->symbolExtent )
-    {
-        d_data->symbolExtent = extent;
+    extent = qwtMaxF( 0.0, extent );
+    if ( extent != m_data->symbolExtent )
+    {
+        m_data->symbolExtent = extent;
 
         legendChanged();
@@ -292,25 +295,25 @@
 
 /*!
-  \return Extent of a symbol in scale coordinates
-  \sa setSymbolExtent(), scaledSymbolWidth(),
+   \return Extent of a symbol in scale coordinates
+   \sa setSymbolExtent(), scaledSymbolWidth(),
       minSymbolWidth(), maxSymbolWidth()
-*/
+ */
 double QwtPlotTradingCurve::symbolExtent() const
 {
-    return d_data->symbolExtent;
-}
-
-/*!
-  Set a minimum for the symbol width
-
-  \param width Width in paint device coordinates
-  \sa minSymbolWidth(), setMaxSymbolWidth(), setSymbolExtent()
+    return m_data->symbolExtent;
+}
+
+/*!
+   Set a minimum for the symbol width
+
+   \param width Width in paint device coordinates
+   \sa minSymbolWidth(), setMaxSymbolWidth(), setSymbolExtent()
  */
 void QwtPlotTradingCurve::setMinSymbolWidth( double width )
 {
-    width = qMax( width, 0.0 );
-    if ( width != d_data->minSymbolWidth )
-    {
-        d_data->minSymbolWidth = width;
+    width = qwtMaxF( width, 0.0 );
+    if ( width != m_data->minSymbolWidth )
+    {
+        m_data->minSymbolWidth = width;
 
         legendChanged();
@@ -320,25 +323,25 @@
 
 /*!
-  \return Minmum for the symbol width
-  \sa setMinSymbolWidth(), maxSymbolWidth(), symbolExtent()
+   \return Minmum for the symbol width
+   \sa setMinSymbolWidth(), maxSymbolWidth(), symbolExtent()
  */
 double QwtPlotTradingCurve::minSymbolWidth() const
 {
-    return d_data->minSymbolWidth;
-}
-
-/*!
-  Set a maximum for the symbol width
-
-  A value <= 0.0 means an unlimited width
-
-  \param width Width in paint device coordinates
-  \sa maxSymbolWidth(), setMinSymbolWidth(), setSymbolExtent()
+    return m_data->minSymbolWidth;
+}
+
+/*!
+   Set a maximum for the symbol width
+
+   A value <= 0.0 means an unlimited width
+
+   \param width Width in paint device coordinates
+   \sa maxSymbolWidth(), setMinSymbolWidth(), setSymbolExtent()
  */
 void QwtPlotTradingCurve::setMaxSymbolWidth( double width )
 {
-    if ( width != d_data->maxSymbolWidth )
-    {
-        d_data->maxSymbolWidth = width;
+    if ( width != m_data->maxSymbolWidth )
+    {
+        m_data->maxSymbolWidth = width;
 
         legendChanged();
@@ -348,16 +351,16 @@
 
 /*!
-  \return Maximum for the symbol width
-  \sa setMaxSymbolWidth(), minSymbolWidth(), symbolExtent()
+   \return Maximum for the symbol width
+   \sa setMaxSymbolWidth(), minSymbolWidth(), symbolExtent()
  */
 double QwtPlotTradingCurve::maxSymbolWidth() const
 {
-    return d_data->maxSymbolWidth;
-}
-
-/*!
-  \return Bounding rectangle of all samples.
-  For an empty series the rectangle is invalid.
-*/
+    return m_data->maxSymbolWidth;
+}
+
+/*!
+   \return Bounding rectangle of all samples.
+   For an empty series the rectangle is invalid.
+ */
 QRectF QwtPlotTradingCurve::boundingRect() const
 {
@@ -370,19 +373,19 @@
 
 /*!
-  Draw an interval of the curve
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted. If to < 0 the
+   Draw an interval of the curve
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted. If to < 0 the
          curve will be painted to its last point.
 
-  \sa drawSymbols()
-*/
-void QwtPlotTradingCurve::drawSeries( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   \sa drawSymbols()
+ */
+void QwtPlotTradingCurve::drawSeries( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     if ( to < 0 )
@@ -397,5 +400,5 @@
     painter->save();
 
-    if ( d_data->symbolStyle != QwtPlotTradingCurve::NoSymbol )
+    if ( m_data->symbolStyle != QwtPlotTradingCurve::NoSymbol )
         drawSymbols( painter, xMap, yMap, canvasRect, from, to );
 
@@ -404,22 +407,22 @@
 
 /*!
-  Draw symbols
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-
-  \sa drawSeries()
-*/
-void QwtPlotTradingCurve::drawSymbols( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   Draw symbols
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+
+   \sa drawSeries()
+ */
+void QwtPlotTradingCurve::drawSymbols( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     const QRectF tr = QwtScaleMap::invTransform( xMap, yMap, canvasRect );
 
-    const QwtScaleMap *timeMap, *valueMap;
+    const QwtScaleMap* timeMap, * valueMap;
     double tMin, tMax, vMin, vMax;
 
@@ -447,12 +450,12 @@
 
     const bool inverted = timeMap->isInverting();
-    const bool doClip = d_data->paintAttributes & ClipSymbols;
+    const bool doClip = m_data->paintAttributes & ClipSymbols;
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
     double symbolWidth = scaledSymbolWidth( xMap, yMap, canvasRect );
     if ( doAlign )
-        symbolWidth = qFloor( 0.5 * symbolWidth ) * 2.0;
-
-    QPen pen = d_data->symbolPen;
+        symbolWidth = std::floor( 0.5 * symbolWidth ) * 2.0;
+
+    QPen pen = m_data->symbolPen;
     pen.setCapStyle( Qt::FlatCap );
 
@@ -486,5 +489,5 @@
             }
 
-            switch( d_data->symbolStyle )
+            switch( m_data->symbolStyle )
             {
                 case Bar:
@@ -496,5 +499,5 @@
                 case CandleStick:
                 {
-                    painter->setBrush( d_data->symbolBrush[ brushIndex ] );
+                    painter->setBrush( m_data->symbolBrush[ brushIndex ] );
                     drawCandleStick( painter, translatedSample,
                         orient, symbolWidth );
@@ -503,8 +506,8 @@
                 default:
                 {
-                    if ( d_data->symbolStyle >= UserSymbol )
+                    if ( m_data->symbolStyle >= UserSymbol )
                     {
-                        painter->setBrush( d_data->symbolBrush[ brushIndex ] );
-                        drawUserSymbol( painter, d_data->symbolStyle,
+                        painter->setBrush( m_data->symbolBrush[ brushIndex ] );
+                        drawUserSymbol( painter, m_data->symbolStyle,
                             translatedSample, orient, inverted, symbolWidth );
                     }
@@ -516,19 +519,19 @@
 
 /*!
-  \brief Draw a symbol for a symbol style >= UserSymbol
-
-  The implementation does nothing and is intended to be overloaded
-
-  \param painter Qt painter, initialized with pen/brush
-  \param symbolStyle Symbol style
-  \param sample Samples already translated into paint device coordinates
-  \param orientation Vertical or horizontal
-  \param inverted True, when the opposite scale
+   \brief Draw a symbol for a symbol style >= UserSymbol
+
+   The implementation does nothing and is intended to be overloaded
+
+   \param painter Qt painter, initialized with pen/brush
+   \param symbolStyle Symbol style
+   \param sample Samples already translated into paint device coordinates
+   \param orientation Vertical or horizontal
+   \param inverted True, when the opposite scale
                   ( Qt::Vertical: x, Qt::Horizontal: y ) is increasing
                   in the opposite direction as QPainter coordinates.
-  \param symbolWidth Width of the symbol in paint device coordinates
-*/
-void QwtPlotTradingCurve::drawUserSymbol( QPainter *painter,
-    SymbolStyle symbolStyle, const QwtOHLCSample &sample,
+   \param symbolWidth Width of the symbol in paint device coordinates
+ */
+void QwtPlotTradingCurve::drawUserSymbol( QPainter* painter,
+    SymbolStyle symbolStyle, const QwtOHLCSample& sample,
     Qt::Orientation orientation, bool inverted, double symbolWidth ) const
 {
@@ -542,10 +545,10 @@
 
 /*!
-  \brief Draw a bar
-
-  \param painter Qt painter, initialized with pen/brush
-  \param sample Sample, already translated into paint device coordinates
-  \param orientation Vertical or horizontal
-  \param inverted When inverted is false the open tick is painted
+   \brief Draw a bar
+
+   \param painter Qt painter, initialized with pen/brush
+   \param sample Sample, already translated into paint device coordinates
+   \param orientation Vertical or horizontal
+   \param inverted When inverted is false the open tick is painted
                   to the left/top, otherwise it is painted right/bottom.
                   The close tick is painted in the opposite direction
@@ -553,10 +556,10 @@
                   painted in the opposite d
                   opposite direction.
-  \param width Width or height of the candle, depending on the orientation
-
-  \sa Bar
-*/
-void QwtPlotTradingCurve::drawBar( QPainter *painter,
-    const QwtOHLCSample &sample, Qt::Orientation orientation,
+   \param width Width or height of the candle, depending on the orientation
+
+   \sa Bar
+ */
+void QwtPlotTradingCurve::drawBar( QPainter* painter,
+    const QwtOHLCSample& sample, Qt::Orientation orientation,
     bool inverted, double width ) const
 {
@@ -587,22 +590,22 @@
 
 /*!
-  \brief Draw a candle stick
-
-  \param painter Qt painter, initialized with pen/brush
-  \param sample Samples already translated into paint device coordinates
-  \param orientation Vertical or horizontal
-  \param width Width or height of the candle, depending on the orientation
-
-  \sa CandleStick
-*/
-void QwtPlotTradingCurve::drawCandleStick( QPainter *painter,
-    const QwtOHLCSample &sample, Qt::Orientation orientation,
+   \brief Draw a candle stick
+
+   \param painter Qt painter, initialized with pen/brush
+   \param sample Samples already translated into paint device coordinates
+   \param orientation Vertical or horizontal
+   \param width Width or height of the candle, depending on the orientation
+
+   \sa CandleStick
+ */
+void QwtPlotTradingCurve::drawCandleStick( QPainter* painter,
+    const QwtOHLCSample& sample, Qt::Orientation orientation,
     double width ) const
 {
     const double t = sample.time;
-    const double v1 = qMin( sample.low, sample.high );
-    const double v2 = qMin( sample.open, sample.close );
-    const double v3 = qMax( sample.low, sample.high );
-    const double v4 = qMax( sample.open, sample.close );
+    const double v1 = qwtMinF( sample.low, sample.high );
+    const double v2 = qwtMinF( sample.open, sample.close );
+    const double v3 = qwtMaxF( sample.low, sample.high );
+    const double v4 = qwtMaxF( sample.open, sample.close );
 
     if ( orientation == Qt::Vertical )
@@ -629,56 +632,56 @@
 
 /*!
-  \return A rectangle filled with the color of the symbol pen
-
-  \param index Index of the legend entry
+   \return A rectangle filled with the color of the symbol pen
+
+   \param index Index of the legend entry
                 ( usually there is only one )
-  \param size Icon size
-
-  \sa setLegendIconSize(), legendData()
-*/
+   \param size Icon size
+
+   \sa setLegendIconSize(), legendData()
+ */
 QwtGraphic QwtPlotTradingCurve::legendIcon( int index,
-    const QSizeF &size ) const
+    const QSizeF& size ) const
 {
     Q_UNUSED( index );
-    return defaultIcon( d_data->symbolPen.color(), size );
-}
-
-/*!
-  Calculate the symbol width in paint coordinates
-
-  The width is calculated by scaling the symbol extent into
-  paint device coordinates bounded by the minimum/maximum
-  symbol width.
-
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-
-  \return Symbol width in paint coordinates
-
-  \sa symbolExtent(), minSymbolWidth(), maxSymbolWidth()
-*/
+    return defaultIcon( m_data->symbolPen.color(), size );
+}
+
+/*!
+   Calculate the symbol width in paint coordinates
+
+   The width is calculated by scaling the symbol extent into
+   paint device coordinates bounded by the minimum/maximum
+   symbol width.
+
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+
+   \return Symbol width in paint coordinates
+
+   \sa symbolExtent(), minSymbolWidth(), maxSymbolWidth()
+ */
 double QwtPlotTradingCurve::scaledSymbolWidth(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
 {
     Q_UNUSED( canvasRect );
 
-    if ( d_data->maxSymbolWidth > 0.0 &&
-        d_data->minSymbolWidth >= d_data->maxSymbolWidth )
-    {
-        return d_data->minSymbolWidth;
-    }
-
-    const QwtScaleMap *map =
+    if ( m_data->maxSymbolWidth > 0.0 &&
+        m_data->minSymbolWidth >= m_data->maxSymbolWidth )
+    {
+        return m_data->minSymbolWidth;
+    }
+
+    const QwtScaleMap* map =
         ( orientation() == Qt::Vertical ) ? &xMap : &yMap;
 
-    const double pos = map->transform( map->s1() + d_data->symbolExtent );
+    const double pos = map->transform( map->s1() + m_data->symbolExtent );
 
     double width = qAbs( pos - map->p1() );
 
-    width = qMax( width,  d_data->minSymbolWidth );
-    if ( d_data->maxSymbolWidth > 0.0 )
-        width = qMin( width, d_data->maxSymbolWidth );
+    width = qwtMaxF( width,  m_data->minSymbolWidth );
+    if ( m_data->maxSymbolWidth > 0.0 )
+        width = qwtMinF( width, m_data->maxSymbolWidth );
 
     return width;
Index: /trunk/BNC/qwt/qwt_plot_tradingcurve.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_tradingcurve.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_tradingcurve.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,31 +13,31 @@
 #include "qwt_global.h"
 #include "qwt_plot_seriesitem.h"
-#include "qwt_series_data.h"
 
 /*!
-  \brief QwtPlotTradingCurve illustrates movements in the price of a
+   \brief QwtPlotTradingCurve illustrates movements in the price of a
          financial instrument over time.
 
-  QwtPlotTradingCurve supports candlestick or bar ( OHLC ) charts
-  that are used in the domain of technical analysis.
+   QwtPlotTradingCurve supports candlestick or bar ( OHLC ) charts
+   that are used in the domain of technical analysis.
 
-  While the length ( height or width depending on orientation() )
-  of each symbol depends on the corresponding OHLC sample the size
-  of the other dimension can be controlled using:
+   While the length ( height or width depending on orientation() )
+   of each symbol depends on the corresponding OHLC sample the size
+   of the other dimension can be controlled using:
 
-  - setSymbolExtent()
-  - setSymbolMinWidth()
-  - setSymbolMaxWidth()
+   - setSymbolExtent()
+   - setSymbolMinWidth()
+   - setSymbolMaxWidth()
 
-  The extent is a size in scale coordinates, so that the symbol width
-  is increasing when the plot is zoomed in. Minimum/Maximum width
-  is in widget coordinates independent from the zoom level.
-  When setting the minimum and maximum to the same value, the width of
-  the symbol is fixed.
-*/
-class QWT_EXPORT QwtPlotTradingCurve:
-    public QwtPlotSeriesItem, public QwtSeriesStore<QwtOHLCSample>
+   The extent is a size in scale coordinates, so that the symbol width
+   is increasing when the plot is zoomed in. Minimum/Maximum width
+   is in widget coordinates independent from the zoom level.
+   When setting the minimum and maximum to the same value, the width of
+   the symbol is fixed.
+ */
+class QWT_EXPORT QwtPlotTradingCurve
+    : public QwtPlotSeriesItem
+    , public QwtSeriesStore< QwtOHLCSample >
 {
-public:
+  public:
     /*!
         \brief Symbol styles.
@@ -45,5 +45,5 @@
         The default setting is QwtPlotSeriesItem::CandleStick.
         \sa setSymbolStyle(), symbolStyle()
-    */
+     */
     enum SymbolStyle
     {
@@ -52,26 +52,26 @@
 
         /*!
-          A line on the chart shows the price range (the highest and lowest
-          prices) over one unit of time, e.g. one day or one hour.
-          Tick marks project from each side of the line indicating the
-          opening and closing price.
+           A line on the chart shows the price range (the highest and lowest
+           prices) over one unit of time, e.g. one day or one hour.
+           Tick marks project from each side of the line indicating the
+           opening and closing price.
          */
         Bar,
 
         /*!
-          The range between opening/closing price are displayed as
-          a filled box. The fill brush depends on the direction of the
-          price movement. The box is connected to the highest/lowest
-          values by lines.
-        */
+           The range between opening/closing price are displayed as
+           a filled box. The fill brush depends on the direction of the
+           price movement. The box is connected to the highest/lowest
+           values by lines.
+         */
         CandleStick,
 
         /*!
-          SymbolTypes >= UserSymbol are displayed by drawUserSymbol(),
-          that needs to be overloaded and implemented in derived
-          curve classes.
+           SymbolTypes >= UserSymbol are displayed by drawUserSymbol(),
+           that needs to be overloaded and implemented in derived
+           curve classes.
 
-          \sa drawUserSymbol()
-        */
+           \sa drawUserSymbol()
+         */
         UserSymbol = 100
     };
@@ -92,5 +92,5 @@
         Attributes to modify the drawing algorithm.
         \sa setPaintAttribute(), testPaintAttribute()
-    */
+     */
     enum PaintAttribute
     {
@@ -99,29 +99,28 @@
     };
 
-    //! Paint attributes
-    typedef QFlags<PaintAttribute> PaintAttributes;
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
 
-    explicit QwtPlotTradingCurve( const QString &title = QString() );
-    explicit QwtPlotTradingCurve( const QwtText &title );
+    explicit QwtPlotTradingCurve( const QString& title = QString() );
+    explicit QwtPlotTradingCurve( const QwtText& title );
 
     virtual ~QwtPlotTradingCurve();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
     void setPaintAttribute( PaintAttribute, bool on = true );
     bool testPaintAttribute( PaintAttribute ) const;
 
-    void setSamples( const QVector<QwtOHLCSample> & );
-    void setSamples( QwtSeriesData<QwtOHLCSample> * );
+    void setSamples( const QVector< QwtOHLCSample >& );
+    void setSamples( QwtSeriesData< QwtOHLCSample >* );
 
     void setSymbolStyle( SymbolStyle style );
     SymbolStyle symbolStyle() const;
 
-    void setSymbolPen( const QColor &,
+    void setSymbolPen( const QColor&,
         qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setSymbolPen( const QPen & );
+    void setSymbolPen( const QPen& );
     QPen symbolPen() const;
 
-    void setSymbolBrush( Direction, const QBrush & );
+    void setSymbolBrush( Direction, const QBrush& );
     QBrush symbolBrush( Direction ) const;
 
@@ -135,37 +134,37 @@
     double maxSymbolWidth() const;
 
-    virtual void drawSeries( QPainter *painter,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
+    virtual void drawSeries( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
 
-    virtual QRectF boundingRect() const;
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
 
-    virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
+    virtual QwtGraphic legendIcon( int index, const QSizeF& ) const QWT_OVERRIDE;
 
-protected:
+  protected:
 
     void init();
 
-    virtual void drawSymbols( QPainter *,
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect, int from, int to ) const;
+    virtual void drawSymbols( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const;
 
-    virtual void drawUserSymbol( QPainter *,
-        SymbolStyle, const QwtOHLCSample &,
+    virtual void drawUserSymbol( QPainter*,
+        SymbolStyle, const QwtOHLCSample&,
         Qt::Orientation, bool inverted, double symbolWidth ) const;
 
-    void drawBar( QPainter *painter, const QwtOHLCSample &,
+    void drawBar( QPainter*, const QwtOHLCSample&,
         Qt::Orientation, bool inverted, double width ) const;
 
-    void drawCandleStick( QPainter *, const QwtOHLCSample &,
+    void drawCandleStick( QPainter*, const QwtOHLCSample&,
         Qt::Orientation, double width ) const;
 
     virtual double scaledSymbolWidth(
-        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QRectF &canvasRect ) const;
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect ) const;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_vectorfield.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_vectorfield.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_plot_vectorfield.cpp	(revision 11158)
@@ -0,0 +1,1038 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_plot_vectorfield.h"
+#include "qwt_vectorfield_symbol.h"
+#include "qwt_scale_map.h"
+#include "qwt_color_map.h"
+#include "qwt_painter.h"
+#include "qwt_text.h"
+#include "qwt_graphic.h"
+#include "qwt_math.h"
+
+#include <qpainter.h>
+#include <qpainterpath.h>
+#include <qdebug.h>
+#include <cstdlib>
+#include <limits>
+
+#define DEBUG_RENDER 0
+
+#if DEBUG_RENDER
+#include <qelapsedtimer.h>
+#endif
+
+
+static inline double qwtVector2Radians( double vx, double vy )
+{
+    if ( vx == 0.0 )
+        return ( vy >= 0 ) ? M_PI_2 : 3 * M_PI_2;
+
+    return std::atan2( vy, vx );
+}
+
+static inline double qwtVector2Magnitude( double vx, double vy )
+{
+    return sqrt( vx * vx + vy * vy );
+}
+
+static QwtInterval qwtMagnitudeRange(
+    const QwtSeriesData< QwtVectorFieldSample >* series )
+{
+    if ( series->size() == 0 )
+        return QwtInterval( 0, 1 );
+
+    const QwtVectorFieldSample s0 = series->sample( 0 );
+
+    double min = s0.vx * s0.vx + s0.vy * s0.vy;
+    double max = min;
+
+    for ( uint i = 1; i < series->size(); i++ )
+    {
+        const QwtVectorFieldSample s = series->sample( i );
+        const double l = s.vx * s.vx + s.vy * s.vy;
+
+        if ( l < min )
+            min = l;
+
+        if ( l > max )
+            max = l;
+    }
+
+    min = std::sqrt( min );
+    max = std::sqrt( max );
+
+    if ( max == min )
+        max += 1.0;
+
+    return QwtInterval( min, max );
+}
+
+static inline QTransform qwtSymbolTransformation(
+    const QTransform& oldTransform, double x, double y,
+    double vx, double vy, double magnitude )
+{
+    QTransform transform = oldTransform;
+
+    if ( !transform.isIdentity() )
+    {
+        transform.translate( x, y );
+
+        const double radians = qwtVector2Radians( vx, vy );
+        transform.rotateRadians( radians );
+    }
+    else
+    {
+        /*
+            When starting with no transformation ( f.e on screen )
+            the matrix can be found without having to use
+            trigonometric functions
+         */
+
+        qreal sin, cos;
+        if ( magnitude == 0.0 )
+        {
+            // something
+            sin = 1.0;
+            cos = 0.0;
+        }
+        else
+        {
+            sin = vy / magnitude;
+            cos = vx / magnitude;
+        }
+
+        transform.setMatrix( cos, sin, 0.0, -sin, cos, 0.0, x, y, 1.0 );
+    }
+
+    return transform;
+}
+
+namespace
+{
+    class FilterMatrix
+    {
+      public:
+        class Entry
+        {
+          public:
+            inline void addSample( double sx, double sy,
+                double svx, double svy )
+            {
+                x += sx;
+                y += sy;
+
+                vx += svx;
+                vy += svy;
+
+                count++;
+            }
+
+            quint32 count;
+
+            // screen positions -> float is good enough
+            float x;
+            float y;
+            float vx;
+            float vy;
+        };
+
+        FilterMatrix( const QRectF& dataRect,
+            const QRectF& canvasRect, const QSizeF& cellSize )
+        {
+            m_dx = cellSize.width();
+            m_dy = cellSize.height();
+
+            m_x0 = dataRect.x();
+            if ( m_x0 < canvasRect.x() )
+                m_x0 += int( ( canvasRect.x() - m_x0 ) / m_dx ) * m_dx;
+
+            m_y0 = dataRect.y();
+            if ( m_y0 < canvasRect.y() )
+                m_y0 += int( ( canvasRect.y() - m_y0 ) / m_dy ) * m_dy;
+
+            m_numColumns = canvasRect.width() / m_dx + 1;
+            m_numRows = canvasRect.height() / m_dy + 1;
+
+#if 1
+            /*
+                limit column and row count to a maximum of 1000000,
+                so that memory usage is not an issue
+             */
+            if ( m_numColumns > 1000 )
+            {
+                m_dx = canvasRect.width() / 1000;
+                m_numColumns = canvasRect.width() / m_dx + 1;
+            }
+
+            if ( m_numRows > 1000 )
+            {
+                m_dy = canvasRect.height() / 1000;
+                m_numRows = canvasRect.height() / m_dx + 1;
+            }
+#endif
+
+            m_x1 = m_x0 + m_numColumns * m_dx;
+            m_y1 = m_y0 + m_numRows * m_dy;
+
+            m_entries = ( Entry* )::calloc( m_numRows * m_numColumns, sizeof( Entry ) );
+            if ( m_entries == NULL )
+            {
+                qWarning() << "QwtPlotVectorField: raster for filtering too fine - running out of memory";
+            }
+        }
+
+        ~FilterMatrix()
+        {
+            if ( m_entries )
+                std::free( m_entries );
+        }
+
+        inline int numColumns() const
+        {
+            return m_numColumns;
+        }
+
+        inline int numRows() const
+        {
+            return m_numRows;
+        }
+
+        inline void addSample( double x, double y,
+            double u, double v )
+        {
+            if ( x >= m_x0 && x < m_x1
+                && y >= m_y0 && y < m_y1 )
+            {
+                Entry& entry = m_entries[ indexOf( x, y ) ];
+                entry.addSample( x, y, u, v );
+            }
+        }
+
+        const FilterMatrix::Entry* entries() const
+        {
+            return m_entries;
+        }
+
+      private:
+        inline int indexOf( qreal x, qreal y ) const
+        {
+            const int col = ( x - m_x0 ) / m_dx;
+            const int row = ( y - m_y0 ) / m_dy;
+
+            return row * m_numColumns + col;
+        }
+
+        qreal m_x0, m_x1, m_y0, m_y1, m_dx, m_dy;
+        int m_numColumns;
+        int m_numRows;
+
+        Entry* m_entries;
+    };
+}
+
+class QwtPlotVectorField::PrivateData
+{
+  public:
+    PrivateData()
+        : pen( Qt::black )
+        , brush( Qt::black )
+        , indicatorOrigin( QwtPlotVectorField::OriginHead )
+        , magnitudeScaleFactor( 1.0 )
+        , rasterSize( 20, 20 )
+        , minArrowLength( 0.0 )
+        , maxArrowLength( std::numeric_limits< short >::max() )
+        , magnitudeModes( MagnitudeAsLength )
+    {
+        colorMap = NULL;
+        symbol = new QwtVectorFieldThinArrow();
+    }
+
+    ~PrivateData()
+    {
+        delete colorMap;
+        delete symbol;
+    }
+
+    QPen pen;
+    QBrush brush;
+
+    IndicatorOrigin indicatorOrigin;
+    QwtVectorFieldSymbol* symbol;
+    QwtColorMap* colorMap;
+
+    /*
+        Stores the range of magnitudes to be used for the color map.
+        If invalid (min=max or negative values), the range is determined
+        from the data samples themselves.
+     */
+    QwtInterval magnitudeRange;
+    QwtInterval boundingMagnitudeRange;
+
+    qreal magnitudeScaleFactor;
+    QSizeF rasterSize;
+
+    double minArrowLength;
+    double maxArrowLength;
+
+    PaintAttributes paintAttributes;
+    MagnitudeModes magnitudeModes;
+};
+
+/*!
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotVectorField::QwtPlotVectorField( const QwtText& title )
+    : QwtPlotSeriesItem( title )
+{
+    init();
+}
+
+/*!
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotVectorField::QwtPlotVectorField( const QString& title )
+    : QwtPlotSeriesItem( QwtText( title ) )
+{
+    init();
+}
+
+//! Destructor
+QwtPlotVectorField::~QwtPlotVectorField()
+{
+    delete m_data;
+}
+
+/*!
+   \brief Initialize data members
+ */
+void QwtPlotVectorField::init()
+{
+    setItemAttribute( QwtPlotItem::Legend );
+    setItemAttribute( QwtPlotItem::AutoScale );
+
+    m_data = new PrivateData;
+    setData( new QwtVectorFieldData() );
+
+    setZ( 20.0 );
+}
+
+/*!
+   Assign a pen
+
+   \param pen New pen
+   \sa pen(), brush()
+
+   \note the pen is ignored in MagnitudeAsColor mode
+ */
+void QwtPlotVectorField::setPen( const QPen& pen )
+{
+    if ( m_data->pen != pen )
+    {
+        m_data->pen = pen;
+
+        itemChanged();
+        legendChanged();
+    }
+}
+
+/*!
+   \return Pen used to draw the lines
+   \sa setPen(), brush()
+ */
+QPen QwtPlotVectorField::pen() const
+{
+    return m_data->pen;
+}
+
+/*!
+   \brief Assign a brush.
+
+   \param brush New brush
+   \sa brush(), pen()
+
+   \note the brush is ignored in MagnitudeAsColor mode
+ */
+void QwtPlotVectorField::setBrush( const QBrush& brush )
+{
+    if ( m_data->brush != brush )
+    {
+        m_data->brush = brush;
+
+        itemChanged();
+        legendChanged();
+    }
+}
+
+/*!
+   \return Brush used to fill the symbol
+   \sa setBrush(), pen()
+ */
+QBrush QwtPlotVectorField::brush() const
+{
+    return m_data->brush;
+}
+
+/*!
+   Set the origin for the symbols/arrows
+
+   \param origin Origin
+   \sa indicatorOrigin()
+ */
+void QwtPlotVectorField::setIndicatorOrigin( IndicatorOrigin origin )
+{
+    m_data->indicatorOrigin = origin;
+    if ( m_data->indicatorOrigin != origin )
+    {
+        m_data->indicatorOrigin = origin;
+        itemChanged();
+    }
+}
+
+//! \return origin for the symbols/arrows
+QwtPlotVectorField::IndicatorOrigin QwtPlotVectorField::indicatorOrigin() const
+{
+    return m_data->indicatorOrigin;
+}
+
+/*!
+   \brief Set the magnitudeScaleFactor
+
+   The length of the arrow in screen coordinate units is calculated by
+   scaling the magnitude by the magnitudeScaleFactor.
+
+   \param factor Scale factor
+
+   \sa magnitudeScaleFactor(), arrowLength()
+   \note Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
+ */
+void QwtPlotVectorField::setMagnitudeScaleFactor( double factor )
+{
+    if ( factor != m_data->magnitudeScaleFactor )
+    {
+        m_data->magnitudeScaleFactor = factor;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Scale factor used to calculate the arrow length from the magnitude
+
+   The length of the arrow in screen coordinate units is calculated by
+   scaling the magnitude by the magnitudeScaleFactor.
+
+   Default implementation simply scales the vector using the magnitudeScaleFactor
+   property.  Re-implement this function to provide special handling for
+   zero/non-zero magnitude arrows, or impose minimum/maximum arrow length limits.
+
+   \return Length of arrow to be drawn in dependence of vector magnitude.
+   \sa magnitudeScaleFactor
+   \note Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
+ */
+double QwtPlotVectorField::magnitudeScaleFactor() const
+{
+    return m_data->magnitudeScaleFactor;
+}
+
+/*!
+   Set the raster size used for filtering samples
+
+   \sa rasterSize(), QwtPlotVectorField::FilterVectors
+ */
+void QwtPlotVectorField::setRasterSize( const QSizeF& size )
+{
+    if ( size != m_data->rasterSize )
+    {
+        m_data->rasterSize = size;
+        itemChanged();
+    }
+}
+
+/*!
+   \return raster size used for filtering samples
+   \sa setRasterSize(), QwtPlotVectorField::FilterVectors
+ */
+QSizeF QwtPlotVectorField::rasterSize() const
+{
+    return m_data->rasterSize;
+}
+
+/*!
+   Specify an attribute how to draw the curve
+
+   \param attribute Paint attribute
+   \param on On/Off
+   \sa testPaintAttribute()
+ */
+void QwtPlotVectorField::setPaintAttribute(
+    PaintAttribute attribute, bool on )
+{
+    PaintAttributes attributes = m_data->paintAttributes;
+
+    if ( on )
+        attributes |= attribute;
+    else
+        attributes &= ~attribute;
+
+    if ( m_data->paintAttributes != attributes )
+    {
+        m_data->paintAttributes = attributes;
+        itemChanged();
+    }
+}
+
+/*!
+    \return True, when attribute is enabled
+    \sa PaintAttribute, setPaintAttribute()
+ */
+bool QwtPlotVectorField::testPaintAttribute(
+    PaintAttribute attribute ) const
+{
+    return ( m_data->paintAttributes & attribute );
+}
+
+//! \return QwtPlotItem::Rtti_PlotField
+int QwtPlotVectorField::rtti() const
+{
+    return QwtPlotItem::Rtti_PlotVectorField;
+}
+
+/*!
+   Sets a new arrow symbol (implementation of arrow drawing code).
+
+   \param symbol Arrow symbol
+
+   \sa symbol(), drawSymbol()
+   \note Ownership is transferred to QwtPlotVectorField.
+ */
+void QwtPlotVectorField::setSymbol( QwtVectorFieldSymbol* symbol )
+{
+    if ( m_data->symbol == symbol )
+        return;
+
+    delete m_data->symbol;
+    m_data->symbol = symbol;
+
+    itemChanged();
+    legendChanged();
+}
+
+/*!
+   \return arrow symbol
+   \sa setSymbol(), drawSymbol()
+ */
+const QwtVectorFieldSymbol* QwtPlotVectorField::symbol() const
+{
+    return m_data->symbol;
+}
+
+/*!
+   Initialize data with an array of samples.
+   \param samples Vector of points
+ */
+void QwtPlotVectorField::setSamples( const QVector< QwtVectorFieldSample >& samples )
+{
+    setData( new QwtVectorFieldData( samples ) );
+}
+
+/*!
+   Assign a series of samples
+
+   setSamples() is just a wrapper for setData() without any additional
+   value - beside that it is easier to find for the developer.
+
+   \param data Data
+   \warning The item takes ownership of the data object, deleting
+           it when its not used anymore.
+ */
+void QwtPlotVectorField::setSamples( QwtVectorFieldData* data )
+{
+    setData( data );
+}
+
+/*!
+   Change the color map
+
+   The color map is used to map the magnitude of a sample into
+   a color using a known range for the magnitudes.
+
+   \param colorMap Color Map
+
+   \sa colorMap(), magnitudeRange()
+ */
+void QwtPlotVectorField::setColorMap( QwtColorMap* colorMap )
+{
+    if ( colorMap == NULL )
+        return;
+
+    if ( colorMap != m_data->colorMap )
+    {
+        delete m_data->colorMap;
+        m_data->colorMap = colorMap;
+    }
+
+    legendChanged();
+    itemChanged();
+}
+
+/*!
+   \return Color Map used for mapping the intensity values to colors
+   \sa setColorMap()
+ */
+const QwtColorMap* QwtPlotVectorField::colorMap() const
+{
+    return m_data->colorMap;
+}
+
+/*!
+   Specify a mode how to represent the magnitude a n arrow/symbol
+
+   \param mode Mode
+   \param on On/Off
+   \sa testMagnitudeMode()
+ */
+void QwtPlotVectorField::setMagnitudeMode( MagnitudeMode mode, bool on )
+{
+    if ( on == testMagnitudeMode( mode ) )
+        return;
+
+    if ( on )
+        m_data->magnitudeModes |= mode;
+    else
+        m_data->magnitudeModes &= ~mode;
+
+    itemChanged();
+}
+
+/*!
+    \return True, when mode is enabled
+    \sa MagnitudeMode, setMagnitudeMode()
+ */
+bool QwtPlotVectorField::testMagnitudeMode( MagnitudeMode mode ) const
+{
+    return m_data->magnitudeModes & mode;
+}
+
+/*!
+   Sets the min/max magnitudes to be used for color map lookups.
+
+   If invalid (min=max=0 or negative values), the range is determined from
+   the current range of magnitudes in the vector samples.
+
+   \sa magnitudeRange(), colorMap()
+ */
+void QwtPlotVectorField::setMagnitudeRange( const QwtInterval& magnitudeRange )
+{
+    if ( m_data->magnitudeRange != magnitudeRange )
+    {
+        m_data->magnitudeRange = magnitudeRange;
+        itemChanged();
+    }
+}
+
+/*!
+    \return min/max magnitudes to be used for color map lookups
+   \sa setMagnitudeRange(), colorMap()
+ */
+QwtInterval QwtPlotVectorField::magnitudeRange() const
+{
+    return m_data->magnitudeRange;
+}
+
+/*!
+   Set a minimum for the arrow length of non zero vectors
+
+   \param length Minimum for the arrow length in pixels
+
+   \sa minArrowLength(), setMaxArrowLength(), arrowLength()
+   \note Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
+ */
+void QwtPlotVectorField::setMinArrowLength( double length )
+{
+    length = qMax( length, 0.0 );
+
+    if ( m_data->minArrowLength != length )
+    {
+        m_data->minArrowLength = length;
+        itemChanged();
+    }
+}
+
+/*!
+   \return minimum for the arrow length of non zero vectors
+
+   \sa setMinArrowLength(), maxArrowLength(), arrowLength()
+   \note Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
+ */
+double QwtPlotVectorField::minArrowLength() const
+{
+    return m_data->minArrowLength;
+}
+
+/*!
+   Set a maximum for the arrow length
+
+   \param length Maximum for the arrow length in pixels
+
+   \sa maxArrowLength(), setMinArrowLength(), arrowLength()
+   \note Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
+ */
+void QwtPlotVectorField::setMaxArrowLength( double length )
+{
+    length = qMax( length, 0.0 );
+
+    if ( m_data->maxArrowLength != length )
+    {
+        m_data->maxArrowLength = length;
+        itemChanged();
+    }
+}
+
+/*!
+   \return maximum for the arrow length
+
+   \sa setMinArrowLength(), maxArrowLength(), arrowLength()
+   \note Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
+ */
+double QwtPlotVectorField::maxArrowLength() const
+{
+    return m_data->maxArrowLength;
+}
+
+/*!
+   Computes length of the arrow in screen coordinate units based on its magnitude.
+
+   Default implementation simply scales the vector using the magnitudeScaleFactor()
+   If the result is not null, the length is then bounded into the interval
+   [ minArrowLength(), maxArrowLength() ].
+
+   Re-implement this function to provide special handling for
+   zero/non-zero magnitude arrows, or impose minimum/maximum arrow length limits.
+
+   \param magnitude Magnitude
+   \return Length of arrow to be drawn in dependence of vector magnitude.
+
+   \sa magnitudeScaleFactor, minArrowLength(), maxArrowLength()
+   \note Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
+ */
+double QwtPlotVectorField::arrowLength( double magnitude ) const
+{
+#if 0
+    /*
+       Normalize magnitude with respect to value range.  Then, magnitudeScaleFactor
+       is the number of pixels to draw for a vector of length equal to
+       magnitudeRange.maxValue(). The relative scaling ensures that change of data
+       samples of very different magnitudes will always lead to a reasonable
+       display on screen.
+     */
+    const QwtVectorFieldData* vectorData = dynamic_cast< const QwtVectorFieldData* >( data() );
+    if ( m_data->magnitudeRange.maxValue() > 0 )
+        magnitude /= m_data->magnitudeRange.maxValue();
+#endif
+
+    double length = magnitude * m_data->magnitudeScaleFactor;
+
+    if ( length > 0.0 )
+        length = qBound( m_data->minArrowLength, length, m_data->maxArrowLength );
+
+    return length;
+}
+
+QRectF QwtPlotVectorField::boundingRect() const
+{
+#if 0
+    /*
+        The bounding rectangle of the samples comes from the origins
+        only, but as we know the scaling factor for the magnitude
+        ( qwtVector2Magnitude ) here, we could try to include it ?
+     */
+#endif
+
+    return QwtPlotSeriesItem::boundingRect();
+}
+
+/*!
+   \return Icon representing the vector fields on the legend
+
+   \param index Index of the legend entry ( ignored as there is only one )
+   \param size Icon size
+
+   \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
+ */
+QwtGraphic QwtPlotVectorField::legendIcon(
+    int index, const QSizeF& size ) const
+{
+    Q_UNUSED( index );
+
+    QwtGraphic icon;
+    icon.setDefaultSize( size );
+
+    if ( size.isEmpty() )
+        return icon;
+
+    QPainter painter( &icon );
+    painter.setRenderHint( QPainter::Antialiasing,
+        testRenderHint( QwtPlotItem::RenderAntialiased ) );
+
+    painter.translate( -size.width(), -0.5 * size.height() );
+
+    painter.setPen( m_data->pen );
+    painter.setBrush( m_data->brush );
+
+    m_data->symbol->setLength( size.width() - 2 );
+    m_data->symbol->paint( &painter );
+
+    return icon;
+}
+
+/*!
+   Draw a subset of the points
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
+         series will be painted to its last sample.
+ */
+void QwtPlotVectorField::drawSeries( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
+{
+    if ( !painter || dataSize() <= 0 )
+        return;
+
+    if ( to < 0 )
+        to = dataSize() - 1;
+
+    if ( from < 0 )
+        from = 0;
+
+    if ( from > to )
+        return;
+
+#if DEBUG_RENDER
+    QElapsedTimer timer;
+    timer.start();
+#endif
+
+    drawSymbols( painter, xMap, yMap, canvasRect, from, to );
+
+#if DEBUG_RENDER
+    qDebug() << timer.elapsed();
+#endif
+}
+
+/*!
+   Draw symbols
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted
+
+   \sa setSymbol(), drawSymbol(), drawSeries()
+ */
+void QwtPlotVectorField::drawSymbols( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
+{
+    const bool doAlign = QwtPainter::roundingAlignment( painter );
+    const bool doClip = false;
+
+    const bool isInvertingX = xMap.isInverting();
+    const bool isInvertingY = yMap.isInverting();
+
+    const QwtSeriesData< QwtVectorFieldSample >* series = data();
+
+    if ( m_data->magnitudeModes & MagnitudeAsColor )
+    {
+        // user input error, can't draw without color map
+        // TODO: Discuss! Without colormap, silently fall back to uniform colors?
+        if ( m_data->colorMap == NULL)
+            return;
+    }
+    else
+    {
+        painter->setPen( m_data->pen );
+        painter->setBrush( m_data->brush );
+    }
+
+    if ( ( m_data->paintAttributes & FilterVectors ) && !m_data->rasterSize.isEmpty() )
+    {
+        const QRectF dataRect = QwtScaleMap::transform(
+            xMap, yMap, boundingRect() );
+
+        // TODO: Discuss. How to handle raster size when switching from screen to print size!
+        //       DPI-aware adjustment of rastersize? Or make "rastersize in screen coordinate"
+        //       or "rastersize in plotcoordinetes" a user option?
+#if 1
+        // define filter matrix based on screen/print coordinates
+        FilterMatrix matrix( dataRect, canvasRect, m_data->rasterSize );
+#else
+        // define filter matrix based on real coordinates
+
+        // get scale factor from real coordinates to screen coordinates
+        double xScale = 1;
+        if (xMap.sDist() != 0)
+            xScale = xMap.pDist() / xMap.sDist();
+
+        double yScale = 1;
+        if (yMap.sDist() != 0)
+            yScale = yMap.pDist() / yMap.sDist();
+
+        QSizeF canvasRasterSize(xScale * m_data->rasterSize.width(), yScale * m_data->rasterSize.height() );
+        FilterMatrix matrix( dataRect, canvasRect, canvasRasterSize );
+#endif
+
+        for ( int i = from; i <= to; i++ )
+        {
+            const QwtVectorFieldSample sample = series->sample( i );
+            if ( !sample.isNull() )
+            {
+                matrix.addSample( xMap.transform( sample.x ),
+                    yMap.transform( sample.y ), sample.vx, sample.vy );
+            }
+        }
+
+        const int numEntries = matrix.numRows() * matrix.numColumns();
+        const FilterMatrix::Entry* entries = matrix.entries();
+
+        for ( int i = 0; i < numEntries; i++ )
+        {
+            const FilterMatrix::Entry& entry = entries[i];
+
+            if ( entry.count == 0 )
+                continue;
+
+            double xi = entry.x / entry.count;
+            double yi = entry.y / entry.count;
+
+            if ( doAlign )
+            {
+                xi = qRound( xi );
+                yi = qRound( yi );
+            }
+
+            const double vx = entry.vx / entry.count;
+            const double vy = entry.vy / entry.count;
+
+            drawSymbol( painter, xi, yi,
+                isInvertingX ? -vx : vx, isInvertingY ? -vy : vy );
+        }
+    }
+    else
+    {
+        for ( int i = from; i <= to; i++ )
+        {
+            const QwtVectorFieldSample sample = series->sample( i );
+
+            // arrows with zero length are never drawn
+            if ( sample.isNull() )
+                continue;
+
+            double xi = xMap.transform( sample.x );
+            double yi = yMap.transform( sample.y );
+
+            if ( doAlign )
+            {
+                xi = qRound( xi );
+                yi = qRound( yi );
+            }
+
+            if ( doClip )
+            {
+                if ( !canvasRect.contains( xi, yi ) )
+                    continue;
+            }
+
+            drawSymbol( painter, xi, yi,
+                isInvertingX ? -sample.vx : sample.vx,
+                isInvertingY ? -sample.vy : sample.vy );
+        }
+    }
+}
+
+/*!
+   Draw a arrow/symbols at a specific position
+
+   x, y, are paint device coordinates, while vx, vy are from
+   the corresponding sample.
+
+   \sa setSymbol(), drawSeries()
+ */
+void QwtPlotVectorField::drawSymbol( QPainter* painter,
+    double x, double y, double vx, double vy ) const
+{
+    const double magnitude = qwtVector2Magnitude( vx, vy );
+
+    const QTransform oldTransform = painter->transform();
+
+    QTransform transform = qwtSymbolTransformation( oldTransform,
+        x, y, vx, vy, magnitude );
+
+    QwtVectorFieldSymbol* symbol = m_data->symbol;
+
+    double length = 0.0;
+
+    if ( m_data->magnitudeModes & MagnitudeAsLength )
+    {
+        length = arrowLength( magnitude );
+    }
+
+    symbol->setLength( length );
+
+    if( m_data->indicatorOrigin == OriginTail )
+    {
+        const qreal dx = symbol->length();
+        transform.translate( dx, 0.0 );
+    }
+    else if ( m_data->indicatorOrigin == OriginCenter )
+    {
+        const qreal dx = symbol->length();
+        transform.translate( 0.5 * dx, 0.0 );
+    }
+
+    if ( m_data->magnitudeModes & MagnitudeAsColor )
+    {
+        // Determine color for arrow if colored by magnitude.
+
+        QwtInterval range = m_data->magnitudeRange;
+
+        if ( !range.isValid() )
+        {
+            if ( !m_data->boundingMagnitudeRange.isValid() )
+                m_data->boundingMagnitudeRange = qwtMagnitudeRange( data() );
+
+            range = m_data->boundingMagnitudeRange;
+        }
+
+        const QColor c = m_data->colorMap->rgb( range, magnitude );
+
+#if 1
+        painter->setBrush( c );
+        painter->setPen( c );
+#endif
+    }
+
+    painter->setWorldTransform( transform, false );
+    symbol->paint( painter );
+    painter->setWorldTransform( oldTransform, false );
+}
+
+void QwtPlotVectorField::dataChanged()
+{
+    m_data->boundingMagnitudeRange.invalidate();
+    QwtPlotSeriesItem::dataChanged();
+}
Index: /trunk/BNC/qwt/qwt_plot_vectorfield.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_vectorfield.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_plot_vectorfield.h	(revision 11158)
@@ -0,0 +1,169 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_PLOT_VECTOR_FIELD_H
+#define QWT_PLOT_VECTOR_FIELD_H
+
+#include "qwt_global.h"
+#include "qwt_plot_seriesitem.h"
+
+class QwtVectorFieldSymbol;
+class QwtColorMap;
+class QPen;
+class QBrush;
+
+/*!
+    \brief A plot item, that represents a vector field
+
+    A vector field is a representation of a points with a given magnitude and direction
+    as arrows. While the direction affects the direction of the arrow, the magnitude
+    might be represented as a color or by the length of the arrow.
+
+    \sa QwtVectorFieldSymbol, QwtVectorFieldSample
+ */
+class QWT_EXPORT QwtPlotVectorField
+    : public QwtPlotSeriesItem
+    , public QwtSeriesStore< QwtVectorFieldSample >
+{
+  public:
+    /*!
+        Depending on the origin the indicator symbol ( usually an arrow )
+        will be to the position of the corresponding sample.
+     */
+    enum IndicatorOrigin
+    {
+        //! symbol points to the sample position
+        OriginHead,
+
+        //! The arrow starts at the sample position
+        OriginTail,
+
+        //! The arrow is centered at the sample position
+        OriginCenter
+    };
+
+    /*!
+        Attributes to modify the rendering
+        \sa setPaintAttribute(), testPaintAttribute()
+     */
+    enum PaintAttribute
+    {
+        /*
+            FilterVectors calculates an average sample from all samples
+            that lie in the same cell of a grid that is determined by
+            setting the rasterSize().
+
+            \sa setRasterSize()
+         */
+        FilterVectors        = 0x01
+    };
+
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
+
+    /*!
+        Depending on the MagnitudeMode the magnitude component will have
+        an impact on the attributes of the symbol/arrow.
+
+        \sa setMagnitudeMode()
+     */
+    enum MagnitudeMode
+    {
+        /*!
+           The magnitude will be mapped to a color using a color map
+           \sa magnitudeRange(), colorMap()
+         */
+        MagnitudeAsColor = 0x01,
+
+        /*!
+           The magnitude will have an impact on the length of the arrow/symbol
+           \sa arrowLength(), magnitudeScaleFactor()
+         */
+        MagnitudeAsLength = 0x02
+    };
+
+    Q_DECLARE_FLAGS( MagnitudeModes, MagnitudeMode )
+
+    explicit QwtPlotVectorField( const QString& title = QString() );
+    explicit QwtPlotVectorField( const QwtText& title );
+
+    virtual ~QwtPlotVectorField();
+
+    void setPaintAttribute( PaintAttribute, bool on = true );
+    bool testPaintAttribute( PaintAttribute ) const;
+
+    void setMagnitudeMode( MagnitudeMode, bool on = true );
+    bool testMagnitudeMode( MagnitudeMode ) const;
+
+    void setSymbol( QwtVectorFieldSymbol* );
+    const QwtVectorFieldSymbol* symbol() const;
+
+    void setPen( const QPen& );
+    QPen pen() const;
+
+    void setBrush( const QBrush& );
+    QBrush brush() const;
+
+    void setRasterSize( const QSizeF& );
+    QSizeF rasterSize() const;
+
+    void setIndicatorOrigin( IndicatorOrigin );
+    IndicatorOrigin indicatorOrigin() const;
+
+    void setSamples( const QVector< QwtVectorFieldSample >& );
+    void setSamples( QwtVectorFieldData* );
+
+    void setColorMap( QwtColorMap* );
+    const QwtColorMap* colorMap() const;
+
+    void setMagnitudeRange( const QwtInterval& );
+    QwtInterval magnitudeRange() const;
+
+    void setMinArrowLength( double );
+    double minArrowLength() const;
+
+    void setMaxArrowLength( double );
+    double maxArrowLength() const;
+
+    virtual double arrowLength( double magnitude ) const;
+
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
+
+    virtual void drawSeries( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
+
+    virtual int rtti() const QWT_OVERRIDE;
+
+    virtual QwtGraphic legendIcon(
+        int index, const QSizeF& ) const QWT_OVERRIDE;
+
+    void setMagnitudeScaleFactor( double factor );
+    double magnitudeScaleFactor() const;
+
+  protected:
+    virtual void drawSymbols( QPainter*,
+        const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QRectF& canvasRect, int from, int to ) const;
+
+    virtual void drawSymbol( QPainter*,
+        double x, double y, double vx, double vy ) const;
+
+    virtual void dataChanged() QWT_OVERRIDE;
+
+  private:
+    void init();
+
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotVectorField::PaintAttributes )
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotVectorField::MagnitudeModes )
+
+#endif
Index: unk/BNC/qwt/qwt_plot_xml.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_xml.cpp	(revision 11157)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
- * Qwt Widget Library
- * Copyright (C) 1997   Josef Wilgen
- * Copyright (C) 2002   Uwe Rathmann
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the Qwt License, Version 1.0
- *****************************************************************************/
-
-#include "qwt_plot.h"
-
-/*!
-  This method is intended for manipulating the plot widget
-  from a specific editor in the Qwt designer plugin.
-
-  \warning The plot editor has never been implemented.
-*/
-void QwtPlot::applyProperties( const QString & /* xmlDocument */ )
-{
-#if 0
-    // Temporary dummy code, for designer tests
-    setTitle( xmlDocument );
-    replot();
-#endif
-}
-
-/*!
-  This method is intended for manipulating the plot widget
-  from a specific editor in the Qwt designer plugin.
-
-  \return QString()
-  \warning The plot editor has never been implemented.
-*/
-QString QwtPlot::grabProperties() const
-{
-#if 0
-    // Temporary dummy code, for designer tests
-    return title().text();
-#else
-    return QString();
-#endif
-}
Index: /trunk/BNC/qwt/qwt_plot_zoneitem.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_zoneitem.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_zoneitem.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,12 +11,15 @@
 #include "qwt_painter.h"
 #include "qwt_scale_map.h"
+#include "qwt_text.h"
+#include "qwt_interval.h"
+
 #include <qpainter.h>
 
 class QwtPlotZoneItem::PrivateData
 {
-public:
-    PrivateData():
-        orientation( Qt::Vertical ),
-        pen( Qt::NoPen )
+  public:
+    PrivateData()
+        : orientation( Qt::Vertical )
+        , pen( Qt::NoPen )
     {
         QColor c( Qt::darkGray );
@@ -44,9 +47,9 @@
 
    \sa QwtPlotItem::setItemAttribute(), QwtPlotItem::setZ()
-*/
-QwtPlotZoneItem::QwtPlotZoneItem():
-    QwtPlotItem( QwtText( "Zone" ) )
-{
-    d_data = new PrivateData;
+ */
+QwtPlotZoneItem::QwtPlotZoneItem()
+    : QwtPlotItem( QwtText( "Zone" ) )
+{
+    m_data = new PrivateData;
 
     setItemAttribute( QwtPlotItem::AutoScale, false );
@@ -59,5 +62,5 @@
 QwtPlotZoneItem::~QwtPlotZoneItem()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -69,17 +72,17 @@
 
 /*!
-  Build and assign a pen
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtPlotZoneItem::setPen( const QColor &color, qreal width, Qt::PenStyle style )
+   Build and assign a pen
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtPlotZoneItem::setPen( const QColor& color, qreal width, Qt::PenStyle style )
 {
     setPen( QPen( color, width, style ) );
@@ -87,16 +90,16 @@
 
 /*!
-  \brief Assign a pen
-
-  The pen is used to draw the border lines of the zone
-
-  \param pen Pen
-  \sa pen(), setBrush()
-*/
-void QwtPlotZoneItem::setPen( const QPen &pen )
-{
-    if ( d_data->pen != pen )
-    {
-        d_data->pen = pen;
+   \brief Assign a pen
+
+   The pen is used to draw the border lines of the zone
+
+   \param pen Pen
+   \sa pen(), setBrush()
+ */
+void QwtPlotZoneItem::setPen( const QPen& pen )
+{
+    if ( m_data->pen != pen )
+    {
+        m_data->pen = pen;
         itemChanged();
     }
@@ -104,25 +107,25 @@
 
 /*!
-  \return Pen used to draw the border lines
-  \sa setPen(), brush()
-*/
-const QPen &QwtPlotZoneItem::pen() const
-{
-    return d_data->pen;
-}
-
-/*!
-  \brief Assign a brush
-
-  The brush is used to fill the zone
-
-  \param brush Brush
-  \sa pen(), setBrush()
-*/
-void QwtPlotZoneItem::setBrush( const QBrush &brush )
-{
-    if ( d_data->brush != brush )
-    {
-        d_data->brush = brush;
+   \return Pen used to draw the border lines
+   \sa setPen(), brush()
+ */
+const QPen& QwtPlotZoneItem::pen() const
+{
+    return m_data->pen;
+}
+
+/*!
+   \brief Assign a brush
+
+   The brush is used to fill the zone
+
+   \param brush Brush
+   \sa pen(), setBrush()
+ */
+void QwtPlotZoneItem::setBrush( const QBrush& brush )
+{
+    if ( m_data->brush != brush )
+    {
+        m_data->brush = brush;
         itemChanged();
     }
@@ -130,26 +133,26 @@
 
 /*!
-  \return Brush used to fill the zone
-  \sa setPen(), brush()
-*/
-const QBrush &QwtPlotZoneItem::brush() const
-{
-    return d_data->brush;
-}
-
-/*!
-  \brief Set the orientation of the zone
-
-  A horizontal zone highlights an interval of the y axis,
-  a vertical zone of the x axis. It is unbounded in the
-  opposite direction.
-
-  \sa orientation(), QwtPlotItem::setAxes()
-*/
+   \return Brush used to fill the zone
+   \sa setPen(), brush()
+ */
+const QBrush& QwtPlotZoneItem::brush() const
+{
+    return m_data->brush;
+}
+
+/*!
+   \brief Set the orientation of the zone
+
+   A horizontal zone highlights an interval of the y axis,
+   a vertical zone of the x axis. It is unbounded in the
+   opposite direction.
+
+   \sa orientation(), QwtPlotItem::setAxes()
+ */
 void QwtPlotZoneItem::setOrientation( Qt::Orientation orientation )
 {
-    if ( d_data->orientation != orientation )
-    {
-        d_data->orientation = orientation;
+    if ( m_data->orientation != orientation )
+    {
+        m_data->orientation = orientation;
         itemChanged();
     }
@@ -157,22 +160,22 @@
 
 /*!
-  \return Orientation of the zone
-  \sa setOrientation()
- */
-Qt::Orientation QwtPlotZoneItem::orientation()
-{
-    return d_data->orientation;
-}
-
-/*!
-  Set the interval of the zone
-
-  For a horizontal zone the interval is related to the y axis,
-  for a vertical zone it is related to the x axis.
-
-  \param min Minimum of the interval
-  \param max Maximum of the interval
-
-  \sa interval(), setOrientation()
+   \return Orientation of the zone
+   \sa setOrientation()
+ */
+Qt::Orientation QwtPlotZoneItem::orientation() const
+{
+    return m_data->orientation;
+}
+
+/*!
+   Set the interval of the zone
+
+   For a horizontal zone the interval is related to the y axis,
+   for a vertical zone it is related to the x axis.
+
+   \param min Minimum of the interval
+   \param max Maximum of the interval
+
+   \sa interval(), setOrientation()
  */
 void QwtPlotZoneItem::setInterval( double min, double max )
@@ -182,18 +185,18 @@
 
 /*!
-  Set the interval of the zone
-
-  For a horizontal zone the interval is related to the y axis,
-  for a vertical zone it is related to the x axis.
-
-  \param interval Zone interval
-
-  \sa interval(), setOrientation()
- */
-void QwtPlotZoneItem::setInterval( const QwtInterval &interval )
-{
-    if ( d_data->interval != interval )
-    {
-        d_data->interval = interval;
+   Set the interval of the zone
+
+   For a horizontal zone the interval is related to the y axis,
+   for a vertical zone it is related to the x axis.
+
+   \param interval Zone interval
+
+   \sa interval(), setOrientation()
+ */
+void QwtPlotZoneItem::setInterval( const QwtInterval& interval )
+{
+    if ( m_data->interval != interval )
+    {
+        m_data->interval = interval;
         itemChanged();
     }
@@ -201,37 +204,37 @@
 
 /*!
-  \return Zone interval
-  \sa setInterval(), orientation()
+   \return Zone interval
+   \sa setInterval(), orientation()
  */
 QwtInterval QwtPlotZoneItem::interval() const
 {
-    return d_data->interval;
-}
-
-/*!
-  Draw the zone
-
-  \param painter Painter
-  \param xMap x Scale Map
-  \param yMap y Scale Map
-  \param canvasRect Contents rectangle of the canvas in painter coordinates
-*/
-
-void QwtPlotZoneItem::draw( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
-{
-    if ( !d_data->interval.isValid() )
+    return m_data->interval;
+}
+
+/*!
+   Draw the zone
+
+   \param painter Painter
+   \param xMap x Scale Map
+   \param yMap y Scale Map
+   \param canvasRect Contents rectangle of the canvas in painter coordinates
+ */
+
+void QwtPlotZoneItem::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
+{
+    if ( !m_data->interval.isValid() )
         return;
 
-    QPen pen = d_data->pen;
+    QPen pen = m_data->pen;
     pen.setCapStyle( Qt::FlatCap );
 
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
-    if ( d_data->orientation == Qt::Horizontal )
-    {
-        double y1 = yMap.transform( d_data->interval.minValue() );
-        double y2 = yMap.transform( d_data->interval.maxValue() );
+    if ( m_data->orientation == Qt::Horizontal )
+    {
+        double y1 = yMap.transform( m_data->interval.minValue() );
+        double y2 = yMap.transform( m_data->interval.maxValue() );
 
         if ( doAlign )
@@ -244,12 +247,12 @@
         r = r.normalized();
 
-        if ( ( d_data->brush.style() != Qt::NoBrush ) && ( y1 != y2 ) )
-        {
-            QwtPainter::fillRect( painter, r, d_data->brush );
-        }
-
-        if ( d_data->pen.style() != Qt::NoPen )
-        {
-            painter->setPen( d_data->pen );
+        if ( ( m_data->brush.style() != Qt::NoBrush ) && ( y1 != y2 ) )
+        {
+            QwtPainter::fillRect( painter, r, m_data->brush );
+        }
+
+        if ( m_data->pen.style() != Qt::NoPen )
+        {
+            painter->setPen( m_data->pen );
 
             QwtPainter::drawLine( painter, r.left(), r.top(), r.right(), r.top() );
@@ -259,6 +262,6 @@
     else
     {
-        double x1 = xMap.transform( d_data->interval.minValue() );
-        double x2 = xMap.transform( d_data->interval.maxValue() );
+        double x1 = xMap.transform( m_data->interval.minValue() );
+        double x2 = xMap.transform( m_data->interval.maxValue() );
 
         if ( doAlign )
@@ -271,12 +274,12 @@
         r = r.normalized();
 
-        if ( ( d_data->brush.style() != Qt::NoBrush ) && ( x1 != x2 ) )
-        {
-            QwtPainter::fillRect( painter, r, d_data->brush );
-        }
-
-        if ( d_data->pen.style() != Qt::NoPen )
-        {
-            painter->setPen( d_data->pen );
+        if ( ( m_data->brush.style() != Qt::NoBrush ) && ( x1 != x2 ) )
+        {
+            QwtPainter::fillRect( painter, r, m_data->brush );
+        }
+
+        if ( m_data->pen.style() != Qt::NoPen )
+        {
+            painter->setPen( m_data->pen );
 
             QwtPainter::drawLine( painter, r.left(), r.top(), r.left(), r.bottom() );
@@ -287,18 +290,18 @@
 
 /*!
-  The bounding rectangle is build from the interval in one direction
-  and something invalid for the opposite direction.
-
-  \return An invalid rectangle with valid boundaries in one direction
-*/
+   The bounding rectangle is build from the interval in one direction
+   and something invalid for the opposite direction.
+
+   \return An invalid rectangle with valid boundaries in one direction
+ */
 QRectF QwtPlotZoneItem::boundingRect() const
 {
     QRectF br = QwtPlotItem::boundingRect();
 
-    const QwtInterval &intv = d_data->interval;
+    const QwtInterval& intv = m_data->interval;
 
     if ( intv.isValid() )
     {
-        if ( d_data->orientation == Qt::Horizontal )
+        if ( m_data->orientation == Qt::Horizontal )
         {
             br.setTop( intv.minValue() );
Index: /trunk/BNC/qwt/qwt_plot_zoneitem.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_zoneitem.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_zoneitem.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,52 +13,54 @@
 #include "qwt_global.h"
 #include "qwt_plot_item.h"
-#include "qwt_interval.h"
 
+#include <qnamespace.h>
+
+class QwtInterval;
 class QPen;
 class QBrush;
 
 /*!
-  \brief A plot item, which displays a zone
+   \brief A plot item, which displays a zone
 
-  A horizontal zone highlights an interval of the y axis - a vertical
-  zone an interval of the x axis - and is unbounded in the opposite direction.
-  It is filled with a brush and its border lines are optionally displayed with a pen.
+   A horizontal zone highlights an interval of the y axis - a vertical
+   zone an interval of the x axis - and is unbounded in the opposite direction.
+   It is filled with a brush and its border lines are optionally displayed with a pen.
 
-  \note For displaying an area that is bounded for x and y coordinates
+   \note For displaying an area that is bounded for x and y coordinates
         use QwtPlotShapeItem
-*/
+ */
 
-class QWT_EXPORT QwtPlotZoneItem:
+class QWT_EXPORT QwtPlotZoneItem :
     public QwtPlotItem
 {
-public:
+  public:
     explicit QwtPlotZoneItem();
     virtual ~QwtPlotZoneItem();
 
-    virtual int rtti() const;
+    virtual int rtti() const QWT_OVERRIDE;
 
     void setOrientation( Qt::Orientation );
-    Qt::Orientation orientation();
+    Qt::Orientation orientation() const;
 
     void setInterval( double min, double max );
-    void setInterval( const QwtInterval & );
+    void setInterval( const QwtInterval& );
     QwtInterval interval() const;
 
-    void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setPen( const QPen & );
-    const QPen &pen() const;
+    void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
+    void setPen( const QPen& );
+    const QPen& pen() const;
 
-    void setBrush( const QBrush & );
-    const QBrush &brush() const;
+    void setBrush( const QBrush& );
+    const QBrush& brush() const;
 
-    virtual void draw( QPainter *,
-        const QwtScaleMap &, const QwtScaleMap &,
-        const QRectF &) const;
+    virtual void draw( QPainter*,
+        const QwtScaleMap&, const QwtScaleMap&,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
 
-    virtual QRectF boundingRect() const;
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_plot_zoomer.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_plot_zoomer.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_zoomer.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,6 +11,9 @@
 #include "qwt_plot.h"
 #include "qwt_scale_div.h"
+#include "qwt_scale_map.h"
+#include "qwt_interval.h"
 #include "qwt_picker_machine.h"
-#include <qalgorithms.h>
+
+#include <qstack.h>
 
 static QwtInterval qwtExpandedZoomInterval( double v1, double v2,
@@ -50,5 +53,5 @@
 }
 
-static QRectF qwtExpandedZoomRect( const QRectF &zoomRect, const QSizeF &minSize,
+static QRectF qwtExpandedZoomRect( const QRectF& zoomRect, const QSizeF& minSize,
     const QwtTransform* transformX, const QwtTransform* transformY )
 {
@@ -78,7 +81,7 @@
 class QwtPlotZoomer::PrivateData
 {
-public:
+  public:
     uint zoomRectIndex;
-    QStack<QRectF> zoomStack;
+    QStack< QRectF > zoomStack;
 
     int maxStackDepth;
@@ -86,24 +89,24 @@
 
 /*!
-  \brief Create a zoomer for a plot canvas.
-
-  The zoomer is set to those x- and y-axis of the parent plot of the
-  canvas that are enabled. If both or no x-axis are enabled, the picker
-  is set to QwtPlot::xBottom. If both or no y-axis are
-  enabled, it is set to QwtPlot::yLeft.
-
-  The zoomer is initialized with a QwtPickerDragRectMachine,
-  the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
-  is set to QwtPicker::RectRubberBand
-
-  \param canvas Plot canvas to observe, also the parent object
-  \param doReplot Call QwtPlot::replot() for the attached plot before initializing
+   \brief Create a zoomer for a plot canvas.
+
+   The zoomer is set to those x- and y-axis of the parent plot of the
+   canvas that are enabled. If both or no x-axis are enabled, the picker
+   is set to QwtAxis::XBottom. If both or no y-axis are
+   enabled, it is set to QwtAxis::YLeft.
+
+   The zoomer is initialized with a QwtPickerDragRectMachine,
+   the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
+   is set to QwtPicker::RectRubberBand
+
+   \param canvas Plot canvas to observe, also the parent object
+   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
                   the zoomer with its scales. This might be necessary,
                   when the plot is in a state with pending scale changes.
 
-  \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
-*/
-QwtPlotZoomer::QwtPlotZoomer( QWidget *canvas, bool doReplot ):
-    QwtPlotPicker( canvas )
+   \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
+ */
+QwtPlotZoomer::QwtPlotZoomer( QWidget* canvas, bool doReplot )
+    : QwtPlotPicker( canvas )
 {
     if ( canvas )
@@ -112,23 +115,23 @@
 
 /*!
-  \brief Create a zoomer for a plot canvas.
-
-  The zoomer is initialized with a QwtPickerDragRectMachine,
-  the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
-  is set to QwtPicker;;RectRubberBand
-
-  \param xAxis X axis of the zoomer
-  \param yAxis Y axis of the zoomer
-  \param canvas Plot canvas to observe, also the parent object
-  \param doReplot Call QwtPlot::replot() for the attached plot before initializing
+   \brief Create a zoomer for a plot canvas.
+
+   The zoomer is initialized with a QwtPickerDragRectMachine,
+   the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
+   is set to QwtPicker::RectRubberBand
+
+   \param xAxisId X axis of the zoomer
+   \param yAxisId Y axis of the zoomer
+   \param canvas Plot canvas to observe, also the parent object
+   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
                   the zoomer with its scales. This might be necessary,
                   when the plot is in a state with pending scale changes.
 
-  \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
-*/
-
-QwtPlotZoomer::QwtPlotZoomer( int xAxis, int yAxis,
-        QWidget *canvas, bool doReplot ):
-    QwtPlotPicker( xAxis, yAxis, canvas )
+   \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
+ */
+
+QwtPlotZoomer::QwtPlotZoomer( QwtAxisId xAxisId, QwtAxisId yAxisId,
+        QWidget* canvas, bool doReplot )
+    : QwtPlotPicker( xAxisId, yAxisId, canvas )
 {
     if ( canvas )
@@ -139,7 +142,7 @@
 void QwtPlotZoomer::init( bool doReplot )
 {
-    d_data = new PrivateData;
-
-    d_data->maxStackDepth = -1;
+    m_data = new PrivateData;
+
+    m_data->maxStackDepth = -1;
 
     setTrackerMode( ActiveOnly );
@@ -155,36 +158,36 @@
 QwtPlotZoomer::~QwtPlotZoomer()
 {
-    delete d_data;
-}
-
-/*!
-  \brief Limit the number of recursive zoom operations to depth.
-
-  A value of -1 set the depth to unlimited, 0 disables zooming.
-  If the current zoom rectangle is below depth, the plot is unzoomed.
-
-  \param depth Maximum for the stack depth
-  \sa maxStackDepth()
-  \note depth doesn't include the zoom base, so zoomStack().count() might be
+    delete m_data;
+}
+
+/*!
+   \brief Limit the number of recursive zoom operations to depth.
+
+   A value of -1 set the depth to unlimited, 0 disables zooming.
+   If the current zoom rectangle is below depth, the plot is unzoomed.
+
+   \param depth Maximum for the stack depth
+   \sa maxStackDepth()
+   \note depth doesn't include the zoom base, so zoomStack().count() might be
               maxStackDepth() + 1.
-*/
+ */
 void QwtPlotZoomer::setMaxStackDepth( int depth )
 {
-    d_data->maxStackDepth = depth;
+    m_data->maxStackDepth = depth;
 
     if ( depth >= 0 )
     {
-        // unzoom if the current depth is below d_data->maxStackDepth
+        // unzoom if the current depth is below m_data->maxStackDepth
 
         const int zoomOut =
-            int( d_data->zoomStack.count() ) - 1 - depth; // -1 for the zoom base
+            m_data->zoomStack.count() - 1 - depth; // -1 for the zoom base
 
         if ( zoomOut > 0 )
         {
             zoom( -zoomOut );
-            for ( int i = int( d_data->zoomStack.count() ) - 1;
-                i > int( d_data->zoomRectIndex ); i-- )
+            for ( int i = m_data->zoomStack.count() - 1;
+                i > int( m_data->zoomRectIndex ); i-- )
             {
-                ( void )d_data->zoomStack.pop(); // remove trailing rects
+                ( void )m_data->zoomStack.pop(); // remove trailing rects
             }
         }
@@ -193,44 +196,44 @@
 
 /*!
-  \return Maximal depth of the zoom stack.
-  \sa setMaxStackDepth()
-*/
+   \return Maximal depth of the zoom stack.
+   \sa setMaxStackDepth()
+ */
 int QwtPlotZoomer::maxStackDepth() const
 {
-    return d_data->maxStackDepth;
-}
-
-/*!
-  \return The zoom stack. zoomStack()[0] is the zoom base,
+    return m_data->maxStackDepth;
+}
+
+/*!
+   \return The zoom stack. zoomStack()[0] is the zoom base,
           zoomStack()[1] the first zoomed rectangle.
 
-  \sa setZoomStack(), zoomRectIndex()
-*/
-const QStack<QRectF> &QwtPlotZoomer::zoomStack() const
-{
-    return d_data->zoomStack;
-}
-
-/*!
-  \return Initial rectangle of the zoomer
-  \sa setZoomBase(), zoomRect()
-*/
+   \sa setZoomStack(), zoomRectIndex()
+ */
+const QStack< QRectF >& QwtPlotZoomer::zoomStack() const
+{
+    return m_data->zoomStack;
+}
+
+/*!
+   \return Initial rectangle of the zoomer
+   \sa setZoomBase(), zoomRect()
+ */
 QRectF QwtPlotZoomer::zoomBase() const
 {
-    return d_data->zoomStack[0];
-}
-
-/*!
-  Reinitialized the zoom stack with scaleRect() as base.
-
-  \param doReplot Call QwtPlot::replot() for the attached plot before initializing
+    return m_data->zoomStack[0];
+}
+
+/*!
+   Reinitialized the zoom stack with scaleRect() as base.
+
+   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
                   the zoomer with its scales. This might be necessary,
                   when the plot is in a state with pending scale changes.
 
-  \sa zoomBase(), scaleRect() QwtPlot::autoReplot(), QwtPlot::replot().
-*/
+   \sa zoomBase(), scaleRect() QwtPlot::autoReplot(), QwtPlot::replot().
+ */
 void QwtPlotZoomer::setZoomBase( bool doReplot )
 {
-    QwtPlot *plt = plot();
+    QwtPlot* plt = plot();
     if ( plt == NULL )
         return;
@@ -239,7 +242,7 @@
         plt->replot();
 
-    d_data->zoomStack.clear();
-    d_data->zoomStack.push( scaleRect() );
-    d_data->zoomRectIndex = 0;
+    m_data->zoomStack.clear();
+    m_data->zoomStack.push( scaleRect() );
+    m_data->zoomRectIndex = 0;
 
     rescale();
@@ -247,16 +250,16 @@
 
 /*!
-  \brief Set the initial size of the zoomer.
-
-  base is united with the current scaleRect() and the zoom stack is
-  reinitialized with it as zoom base. plot is zoomed to scaleRect().
-
-  \param base Zoom base
-
-  \sa zoomBase(), scaleRect()
-*/
-void QwtPlotZoomer::setZoomBase( const QRectF &base )
-{
-    const QwtPlot *plt = plot();
+   \brief Set the initial size of the zoomer.
+
+   base is united with the current scaleRect() and the zoom stack is
+   reinitialized with it as zoom base. plot is zoomed to scaleRect().
+
+   \param base Zoom base
+
+   \sa zoomBase(), scaleRect()
+ */
+void QwtPlotZoomer::setZoomBase( const QRectF& base )
+{
+    const QwtPlot* plt = plot();
     if ( !plt )
         return;
@@ -265,12 +268,12 @@
     const QRectF bRect = base | sRect;
 
-    d_data->zoomStack.clear();
-    d_data->zoomStack.push( bRect );
-    d_data->zoomRectIndex = 0;
+    m_data->zoomStack.clear();
+    m_data->zoomStack.push( bRect );
+    m_data->zoomRectIndex = 0;
 
     if ( base != sRect )
     {
-        d_data->zoomStack.push( sRect );
-        d_data->zoomRectIndex++;
+        m_data->zoomStack.push( sRect );
+        m_data->zoomRectIndex++;
     }
 
@@ -279,34 +282,34 @@
 
 /*!
-  \return Rectangle at the current position on the zoom stack.
-  \sa zoomRectIndex(), scaleRect().
-*/
+   \return Rectangle at the current position on the zoom stack.
+   \sa zoomRectIndex(), scaleRect().
+ */
 QRectF QwtPlotZoomer::zoomRect() const
 {
-    return d_data->zoomStack[d_data->zoomRectIndex];
-}
-
-/*!
-  \return Index of current position of zoom stack.
-*/
+    return m_data->zoomStack[m_data->zoomRectIndex];
+}
+
+/*!
+   \return Index of current position of zoom stack.
+ */
 uint QwtPlotZoomer::zoomRectIndex() const
 {
-    return d_data->zoomRectIndex;
-}
-
-/*!
-  \brief Zoom in
-
-  Clears all rectangles above the current position of the
-  zoom stack and pushes the normalized rectangle on it.
-
-  \note If the maximal stack depth is reached, zoom is ignored.
-  \note The zoomed signal is emitted.
-*/
-
-void QwtPlotZoomer::zoom( const QRectF &rect )
-{
-    if ( d_data->maxStackDepth >= 0 &&
-            int( d_data->zoomRectIndex ) >= d_data->maxStackDepth )
+    return m_data->zoomRectIndex;
+}
+
+/*!
+   \brief Zoom in
+
+   Clears all rectangles above the current position of the
+   zoom stack and pushes the normalized rectangle on it.
+
+   \note If the maximal stack depth is reached, zoom is ignored.
+   \note The zoomed signal is emitted.
+ */
+
+void QwtPlotZoomer::zoom( const QRectF& rect )
+{
+    if ( m_data->maxStackDepth >= 0 &&
+        int( m_data->zoomRectIndex ) >= m_data->maxStackDepth )
     {
         return;
@@ -314,14 +317,14 @@
 
     const QRectF zoomRect = rect.normalized();
-    if ( zoomRect != d_data->zoomStack[d_data->zoomRectIndex] )
-    {
-        for ( uint i = int( d_data->zoomStack.count() ) - 1;
-           i > d_data->zoomRectIndex; i-- )
+    if ( zoomRect != m_data->zoomStack[m_data->zoomRectIndex] )
+    {
+        for ( uint i = m_data->zoomStack.count() - 1;
+            i > m_data->zoomRectIndex; i-- )
         {
-            ( void )d_data->zoomStack.pop();
+            ( void )m_data->zoomStack.pop();
         }
 
-        d_data->zoomStack.push( zoomRect );
-        d_data->zoomRectIndex++;
+        m_data->zoomStack.push( zoomRect );
+        m_data->zoomRectIndex++;
 
         rescale();
@@ -332,65 +335,69 @@
 
 /*!
-  \brief Zoom in or out
-
-  Activate a rectangle on the zoom stack with an offset relative
-  to the current position. Negative values of offset will zoom out,
-  positive zoom in. A value of 0 zooms out to the zoom base.
-
-  \param offset Offset relative to the current position of the zoom stack.
-  \note The zoomed signal is emitted.
-  \sa zoomRectIndex()
-*/
+   \brief Zoom in or out
+
+   Activate a rectangle on the zoom stack with an offset relative
+   to the current position. Negative values of offset will zoom out,
+   positive zoom in. A value of 0 zooms out to the zoom base.
+
+   \param offset Offset relative to the current position of the zoom stack.
+   \note The zoomed signal is emitted.
+   \sa zoomRectIndex()
+ */
 void QwtPlotZoomer::zoom( int offset )
 {
+    int newIndex;
+
     if ( offset == 0 )
-        d_data->zoomRectIndex = 0;
+    {
+        newIndex = 0;
+    }
     else
     {
-        int newIndex = d_data->zoomRectIndex + offset;
-        newIndex = qMax( 0, newIndex );
-        newIndex = qMin( int( d_data->zoomStack.count() ) - 1, newIndex );
-
-        d_data->zoomRectIndex = uint( newIndex );
-    }
-
-    rescale();
-
-    Q_EMIT zoomed( zoomRect() );
-}
-
-/*!
-  \brief Assign a zoom stack
-
-  In combination with other types of navigation it might be useful to
-  modify to manipulate the complete zoom stack.
-
-  \param zoomStack New zoom stack
-  \param zoomRectIndex Index of the current position of zoom stack.
+        newIndex = m_data->zoomRectIndex + offset;
+        newIndex = qBound( 0, newIndex, m_data->zoomStack.count() - 1 );
+    }
+
+    if ( newIndex != static_cast< int >( m_data->zoomRectIndex ) )
+    {
+        m_data->zoomRectIndex = newIndex;
+        rescale();
+        Q_EMIT zoomed( zoomRect() );
+    }
+}
+
+/*!
+   \brief Assign a zoom stack
+
+   In combination with other types of navigation it might be useful to
+   modify to manipulate the complete zoom stack.
+
+   \param zoomStack New zoom stack
+   \param zoomRectIndex Index of the current position of zoom stack.
                        In case of -1 the current position is at the top
                        of the stack.
 
-  \note The zoomed signal might be emitted.
-  \sa zoomStack(), zoomRectIndex()
-*/
+   \note The zoomed signal might be emitted.
+   \sa zoomStack(), zoomRectIndex()
+ */
 void QwtPlotZoomer::setZoomStack(
-    const QStack<QRectF> &zoomStack, int zoomRectIndex )
+    const QStack< QRectF >& zoomStack, int zoomRectIndex )
 {
     if ( zoomStack.isEmpty() )
         return;
 
-    if ( d_data->maxStackDepth >= 0 &&
-        int( zoomStack.count() ) > d_data->maxStackDepth )
+    if ( m_data->maxStackDepth >= 0 &&
+        zoomStack.count() > m_data->maxStackDepth )
     {
         return;
     }
 
-    if ( zoomRectIndex < 0 || zoomRectIndex > int( zoomStack.count() ) )
+    if ( zoomRectIndex < 0 || zoomRectIndex > zoomStack.count() )
         zoomRectIndex = zoomStack.count() - 1;
 
     const bool doRescale = zoomStack[zoomRectIndex] != zoomRect();
 
-    d_data->zoomStack = zoomStack;
-    d_data->zoomRectIndex = uint( zoomRectIndex );
+    m_data->zoomStack = zoomStack;
+    m_data->zoomRectIndex = uint( zoomRectIndex );
 
     if ( doRescale )
@@ -402,16 +409,16 @@
 
 /*!
-  Adjust the observed plot to zoomRect()
-
-  \note Initiates QwtPlot::replot()
-*/
+   Adjust the observed plot to zoomRect()
+
+   \note Initiates QwtPlot::replot()
+ */
 
 void QwtPlotZoomer::rescale()
 {
-    QwtPlot *plt = plot();
+    QwtPlot* plt = plot();
     if ( !plt )
         return;
 
-    const QRectF &rect = d_data->zoomStack[d_data->zoomRectIndex];
+    const QRectF& rect = m_data->zoomStack[m_data->zoomRectIndex];
     if ( rect != scaleRect() )
     {
@@ -440,15 +447,15 @@
 
 /*!
-  Reinitialize the axes, and set the zoom base to their scales.
-
-  \param xAxis X axis
-  \param yAxis Y axis
-*/
-
-void QwtPlotZoomer::setAxis( int xAxis, int yAxis )
-{
-    if ( xAxis != QwtPlotPicker::xAxis() || yAxis != QwtPlotPicker::yAxis() )
-    {
-        QwtPlotPicker::setAxis( xAxis, yAxis );
+   Reinitialize the axes, and set the zoom base to their scales.
+
+   \param xAxisId X axis
+   \param yAxisId Y axis
+ */
+
+void QwtPlotZoomer::setAxes( QwtAxisId xAxisId, QwtAxisId yAxisId )
+{
+    if ( xAxisId != QwtPlotPicker::xAxis() || yAxisId != QwtPlotPicker::yAxis() )
+    {
+        QwtPlotPicker::setAxes( xAxisId, yAxisId );
         setZoomBase( scaleRect() );
     }
@@ -464,6 +471,6 @@
    \note The mouse events can be changed, using
          QwtEventPattern::setMousePattern: 2, 1
-*/
-void QwtPlotZoomer::widgetMouseReleaseEvent( QMouseEvent *me )
+ */
+void QwtPlotZoomer::widgetMouseReleaseEvent( QMouseEvent* me )
 {
     if ( mouseMatch( MouseSelect2, me ) )
@@ -486,7 +493,7 @@
    \note The keys codes can be changed, using
          QwtEventPattern::setKeyPattern: 3, 4, 5
-*/
-
-void QwtPlotZoomer::widgetKeyPressEvent( QKeyEvent *ke )
+ */
+
+void QwtPlotZoomer::widgetKeyPressEvent( QKeyEvent* ke )
 {
     if ( !isActive() )
@@ -504,26 +511,26 @@
 
 /*!
-  Move the current zoom rectangle.
-
-  \param dx X offset
-  \param dy Y offset
-
-  \note The changed rectangle is limited by the zoom base
-*/
+   Move the current zoom rectangle.
+
+   \param dx X offset
+   \param dy Y offset
+
+   \note The changed rectangle is limited by the zoom base
+ */
 void QwtPlotZoomer::moveBy( double dx, double dy )
 {
-    const QRectF &rect = d_data->zoomStack[d_data->zoomRectIndex];
+    const QRectF& rect = m_data->zoomStack[m_data->zoomRectIndex];
     moveTo( QPointF( rect.left() + dx, rect.top() + dy ) );
 }
 
 /*!
-  Move the the current zoom rectangle.
-
-  \param pos New position
-
-  \sa QRectF::moveTo()
-  \note The changed rectangle is limited by the zoom base
-*/
-void QwtPlotZoomer::moveTo( const QPointF &pos )
+   Move the the current zoom rectangle.
+
+   \param pos New position
+
+   \sa QRectF::moveTo()
+   \note The changed rectangle is limited by the zoom base
+ */
+void QwtPlotZoomer::moveTo( const QPointF& pos )
 {
     double x = pos.x();
@@ -542,5 +549,5 @@
     if ( x != zoomRect().left() || y != zoomRect().top() )
     {
-        d_data->zoomStack[d_data->zoomRectIndex].moveTo( x, y );
+        m_data->zoomStack[m_data->zoomRectIndex].moveTo( x, y );
         rescale();
     }
@@ -548,20 +555,20 @@
 
 /*!
-  \brief Check and correct a selected rectangle
-
-  Reject rectangles with a height or width < 2, otherwise
-  expand the selected rectangle to a minimum size of 11x11
-  and accept it.
-
-  \return true If the rectangle is accepted, or has been changed
+   \brief Check and correct a selected rectangle
+
+   Reject rectangles with a height or width < 2, otherwise
+   expand the selected rectangle to a minimum size of 11x11
+   and accept it.
+
+   \return true If the rectangle is accepted, or has been changed
           to an accepted one.
-*/
-
-bool QwtPlotZoomer::accept( QPolygon &pa ) const
+ */
+
+bool QwtPlotZoomer::accept( QPolygon& pa ) const
 {
     if ( pa.count() < 2 )
         return false;
 
-    QRect rect = QRect( pa[0], pa[int( pa.count() ) - 1] );
+    QRect rect = QRect( pa.first(), pa.last() );
     rect = rect.normalized();
 
@@ -584,25 +591,25 @@
 
 /*!
-  \brief Limit zooming by a minimum rectangle
-
-  \return zoomBase().width() / 10e4, zoomBase().height() / 10e4
-*/
+   \brief Limit zooming by a minimum rectangle
+
+   \return zoomBase().width() / 10e4, zoomBase().height() / 10e4
+ */
 QSizeF QwtPlotZoomer::minZoomSize() const
 {
-    return QSizeF( d_data->zoomStack[0].width() / 10e4,
-        d_data->zoomStack[0].height() / 10e4 );
-}
-
-/*!
-  Rejects selections, when the stack depth is too deep, or
-  the zoomed rectangle is minZoomSize().
-
-  \sa minZoomSize(), maxStackDepth()
-*/
+    return QSizeF( m_data->zoomStack[0].width() / 10e4,
+        m_data->zoomStack[0].height() / 10e4 );
+}
+
+/*!
+   Rejects selections, when the stack depth is too deep, or
+   the zoomed rectangle is minZoomSize().
+
+   \sa minZoomSize(), maxStackDepth()
+ */
 void QwtPlotZoomer::begin()
 {
-    if ( d_data->maxStackDepth >= 0 )
-    {
-        if ( d_data->zoomRectIndex >= uint( d_data->maxStackDepth ) )
+    if ( m_data->maxStackDepth >= 0 )
+    {
+        if ( m_data->zoomRectIndex >= uint( m_data->maxStackDepth ) )
             return;
     }
@@ -612,5 +619,5 @@
     {
         const QSizeF sz =
-            d_data->zoomStack[d_data->zoomRectIndex].size() * 0.9999;
+            m_data->zoomStack[m_data->zoomRectIndex].size() * 0.9999;
 
         if ( minSize.width() >= sz.width() &&
@@ -625,13 +632,13 @@
 
 /*!
-  Expand the selected rectangle to minZoomSize() and zoom in
-  if accepted.
-
-  \param ok If true, complete the selection and emit selected signals
+   Expand the selected rectangle to minZoomSize() and zoom in
+   if accepted.
+
+   \param ok If true, complete the selection and emit selected signals
             otherwise discard the selection.
 
-  \sa accept(), minZoomSize()
-  \return True if the selection has been accepted, false otherwise
-*/
+   \sa accept(), minZoomSize()
+   \return True if the selection has been accepted, false otherwise
+ */
 bool QwtPlotZoomer::end( bool ok )
 {
@@ -640,13 +647,13 @@
         return false;
 
-    QwtPlot *plot = QwtPlotZoomer::plot();
+    QwtPlot* plot = QwtPlotZoomer::plot();
     if ( !plot )
         return false;
 
-    const QPolygon &pa = selection();
+    const QPolygon& pa = selection();
     if ( pa.count() < 2 )
         return false;
 
-    QRect rect = QRect( pa[0], pa[int( pa.count() - 1 )] );
+    QRect rect = QRect( pa.first(), pa.last() );
     rect = rect.normalized();
 
@@ -663,2 +670,4 @@
     return true;
 }
+
+#include "moc_qwt_plot_zoomer.cpp"
Index: /trunk/BNC/qwt/qwt_plot_zoomer.h
===================================================================
--- /trunk/BNC/qwt/qwt_plot_zoomer.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_plot_zoomer.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,127 +13,129 @@
 #include "qwt_global.h"
 #include "qwt_plot_picker.h"
-#include <qstack.h>
+
+class QSizeF;
+template< typename T > class QStack;
 
 /*!
-  \brief QwtPlotZoomer provides stacked zooming for a plot widget
+   \brief QwtPlotZoomer provides stacked zooming for a plot widget
 
-  QwtPlotZoomer selects rectangles from user inputs ( mouse or keyboard )
-  translates them into plot coordinates and adjusts the axes to them.
-  The selection is supported by a rubber band and optionally by displaying
-  the coordinates of the current mouse position.
+   QwtPlotZoomer selects rectangles from user inputs ( mouse or keyboard )
+   translates them into plot coordinates and adjusts the axes to them.
+   The selection is supported by a rubber band and optionally by displaying
+   the coordinates of the current mouse position.
 
-  Zooming can be repeated as often as possible, limited only by
-  maxStackDepth() or minZoomSize().  Each rectangle is pushed on a stack.
+   Zooming can be repeated as often as possible, limited only by
+   maxStackDepth() or minZoomSize().  Each rectangle is pushed on a stack.
 
-  The default setting how to select rectangles is
-  a QwtPickerDragRectMachine with the following bindings:
+   The default setting how to select rectangles is
+   a QwtPickerDragRectMachine with the following bindings:
 
-  - QwtEventPattern::MouseSelect1\n
+   - QwtEventPattern::MouseSelect1\n
     The first point of the zoom rectangle is selected by a mouse press,
     the second point from the position, where the mouse is released.
 
-  - QwtEventPattern::KeySelect1\n
+   - QwtEventPattern::KeySelect1\n
     The first key press selects the first, the second key press
     selects the second point.
 
-  - QwtEventPattern::KeyAbort\n
+   - QwtEventPattern::KeyAbort\n
     Discard the selection in the state, where the first point
     is selected.
 
-  To traverse the zoom stack the following bindings are used:
+   To traverse the zoom stack the following bindings are used:
 
-  - QwtEventPattern::MouseSelect3, QwtEventPattern::KeyUndo\n
+   - QwtEventPattern::MouseSelect3, QwtEventPattern::KeyUndo\n
     Zoom out one position on the zoom stack
 
-  - QwtEventPattern::MouseSelect6, QwtEventPattern::KeyRedo\n
+   - QwtEventPattern::MouseSelect6, QwtEventPattern::KeyRedo\n
     Zoom in one position on the zoom stack
 
-  - QwtEventPattern::MouseSelect2, QwtEventPattern::KeyHome\n
+   - QwtEventPattern::MouseSelect2, QwtEventPattern::KeyHome\n
     Zoom to the zoom base
 
-  The setKeyPattern() and setMousePattern() functions can be used
-  to configure the zoomer actions. The following example
-  shows, how to configure the 'I' and 'O' keys for zooming in and out
-  one position on the zoom stack. The "Home" key is used to
-  "unzoom" the plot.
+   The setKeyPattern() and setMousePattern() functions can be used
+   to configure the zoomer actions. The following example
+   shows, how to configure the 'I' and 'O' keys for zooming in and out
+   one position on the zoom stack. The "Home" key is used to
+   "unzoom" the plot.
 
-  \code
+   \code
    zoomer = new QwtPlotZoomer( plot );
    zoomer->setKeyPattern( QwtEventPattern::KeyRedo, Qt::Key_I, Qt::ShiftModifier );
    zoomer->setKeyPattern( QwtEventPattern::KeyUndo, Qt::Key_O, Qt::ShiftModifier );
    zoomer->setKeyPattern( QwtEventPattern::KeyHome, Qt::Key_Home );
-  \endcode
+   \endcode
 
-  QwtPlotZoomer is tailored for plots with one x and y axis, but it is
-  allowed to attach a second QwtPlotZoomer ( without rubber band and tracker )
-  for the other axes.
+   QwtPlotZoomer is tailored for plots with one x and y axis, but it is
+   allowed to attach a second QwtPlotZoomer ( without rubber band and tracker )
+   for the other axes.
 
-  \note The realtime example includes an derived zoomer class that adds
+   \note The realtime example includes an derived zoomer class that adds
         scrollbars to the plot canvas.
 
-  \sa QwtPlotPanner, QwtPlotMagnifier
-*/
+   \sa QwtPlotPanner, QwtPlotMagnifier
+ */
 
-class QWT_EXPORT QwtPlotZoomer: public QwtPlotPicker
+class QWT_EXPORT QwtPlotZoomer : public QwtPlotPicker
 {
     Q_OBJECT
-public:
-    explicit QwtPlotZoomer( QWidget *, bool doReplot = true );
-    explicit QwtPlotZoomer( int xAxis, int yAxis,
-                            QWidget *, bool doReplot = true );
+  public:
+    explicit QwtPlotZoomer( QWidget*, bool doReplot = true );
+    explicit QwtPlotZoomer( QwtAxisId xAxis, QwtAxisId yAxis,
+        QWidget*, bool doReplot = true );
 
     virtual ~QwtPlotZoomer();
 
     virtual void setZoomBase( bool doReplot = true );
-    virtual void setZoomBase( const QRectF & );
+    virtual void setZoomBase( const QRectF& );
 
     QRectF zoomBase() const;
     QRectF zoomRect() const;
 
-    virtual void setAxis( int xAxis, int yAxis );
+    virtual void setAxes( QwtAxisId xAxis, QwtAxisId yAxis ) QWT_OVERRIDE;
 
     void setMaxStackDepth( int );
     int maxStackDepth() const;
 
-    const QStack<QRectF> &zoomStack() const;
-    void setZoomStack( const QStack<QRectF> &,
+    const QStack< QRectF >& zoomStack() const;
+    void setZoomStack( const QStack< QRectF >&,
         int zoomRectIndex = -1 );
 
     uint zoomRectIndex() const;
 
-public Q_SLOTS:
+  public Q_SLOTS:
     void moveBy( double dx, double dy );
-    virtual void moveTo( const QPointF & );
+    virtual void moveTo( const QPointF& );
 
-    virtual void zoom( const QRectF & );
+    virtual void zoom( const QRectF& );
     virtual void zoom( int offset );
 
-Q_SIGNALS:
+  Q_SIGNALS:
     /*!
-      A signal emitting the zoomRect(), when the plot has been
-      zoomed in or out.
+       A signal emitting the zoomRect(), when the plot has been
+       zoomed in or out.
 
-      \param rect Current zoom rectangle.
-    */
+       \param rect Current zoom rectangle.
+     */
 
-    void zoomed( const QRectF &rect );
+    void zoomed( const QRectF& rect );
 
-protected:
+  protected:
     virtual void rescale();
 
     virtual QSizeF minZoomSize() const;
 
-    virtual void widgetMouseReleaseEvent( QMouseEvent * );
-    virtual void widgetKeyPressEvent( QKeyEvent * );
+    virtual void widgetMouseReleaseEvent( QMouseEvent* ) QWT_OVERRIDE;
+    virtual void widgetKeyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
 
-    virtual void begin();
-    virtual bool end( bool ok = true );
-    virtual bool accept( QPolygon & ) const;
+    virtual void begin() QWT_OVERRIDE;
+    virtual bool end( bool ok = true ) QWT_OVERRIDE;
+    virtual bool accept( QPolygon& ) const QWT_OVERRIDE;
 
-private:
+  private:
     void init( bool doReplot );
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_point_3d.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_point_3d.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_point_3d.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,10 +10,36 @@
 #include "qwt_point_3d.h"
 
+#if QT_VERSION >= 0x050200
+
+static QwtPoint3D qwtPointToPoint3D( const QPointF& point )
+{
+    return QwtPoint3D( point );
+}
+
+#endif
+
+namespace
+{
+    static const struct RegisterQwtPoint3D
+    {
+        inline RegisterQwtPoint3D()
+        {
+            qRegisterMetaType< QwtPoint3D >();
+
+#if QT_VERSION >= 0x050200
+            QMetaType::registerConverter< QPointF, QwtPoint3D >( qwtPointToPoint3D );
+#endif
+        }
+    } qwtRegisterQwtPoint3D;
+}
+
 #ifndef QT_NO_DEBUG_STREAM
 
-QDebug operator<<( QDebug debug, const QwtPoint3D &point )
+#include <qdebug.h>
+
+QDebug operator<<( QDebug debug, const QwtPoint3D& point )
 {
     debug.nospace() << "QwtPoint3D(" << point.x()
-        << "," << point.y() << "," << point.z() << ")";
+                    << "," << point.y() << "," << point.z() << ")";
     return debug.space();
 }
Index: /trunk/BNC/qwt/qwt_point_3d.h
===================================================================
--- /trunk/BNC/qwt/qwt_point_3d.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_point_3d.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,23 +10,20 @@
 /*! \file */
 #ifndef QWT_POINT_3D_H
-#define QWT_POINT_3D_H 1
+#define QWT_POINT_3D_H
 
 #include "qwt_global.h"
 #include <qpoint.h>
-#ifndef QT_NO_DEBUG_STREAM
-#include <qdebug.h>
-#endif
+#include <qmetatype.h>
 
 /*!
-  \brief QwtPoint3D class defines a 3D point in double coordinates
-*/
+   \brief QwtPoint3D class defines a 3D point in double coordinates
+ */
 
 class QWT_EXPORT QwtPoint3D
 {
-public:
+  public:
     QwtPoint3D();
     QwtPoint3D( double x, double y, double z );
-    QwtPoint3D( const QwtPoint3D & );
-    QwtPoint3D( const QPointF & );
+    QwtPoint3D( const QPointF& );
 
     bool isNull()    const;
@@ -36,7 +33,7 @@
     double z() const;
 
-    double &rx();
-    double &ry();
-    double &rz();
+    double& rx();
+    double& ry();
+    double& rz();
 
     void setX( double x );
@@ -46,17 +43,18 @@
     QPointF toPoint() const;
 
-    bool operator==( const QwtPoint3D & ) const;
-    bool operator!=( const QwtPoint3D & ) const;
+    bool operator==( const QwtPoint3D& ) const;
+    bool operator!=( const QwtPoint3D& ) const;
 
-private:
-    double d_x;
-    double d_y;
-    double d_z;
+  private:
+    double m_x;
+    double m_y;
+    double m_z;
 };
 
-Q_DECLARE_TYPEINFO(QwtPoint3D, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO( QwtPoint3D, Q_MOVABLE_TYPE );
+Q_DECLARE_METATYPE( QwtPoint3D )
 
 #ifndef QT_NO_DEBUG_STREAM
-QWT_EXPORT QDebug operator<<( QDebug, const QwtPoint3D & );
+QWT_EXPORT QDebug operator<<( QDebug, const QwtPoint3D& );
 #endif
 
@@ -64,28 +62,17 @@
     Constructs a null point.
     \sa isNull()
-*/
-inline QwtPoint3D::QwtPoint3D():
-    d_x( 0.0 ),
-    d_y( 0.0 ),
-    d_z( 0.0 )
+ */
+inline QwtPoint3D::QwtPoint3D()
+    : m_x( 0.0 )
+    , m_y( 0.0 )
+    , m_z( 0.0 )
 {
 }
 
 //! Constructs a point with coordinates specified by x, y and z.
-inline QwtPoint3D::QwtPoint3D( double x, double y, double z = 0.0 ):
-    d_x( x ),
-    d_y( y ),
-    d_z( z )
-{
-}
-
-/*!
-    Copy constructor.
-    Constructs a point using the values of the point specified.
-*/
-inline QwtPoint3D::QwtPoint3D( const QwtPoint3D &other ):
-    d_x( other.d_x ),
-    d_y( other.d_y ),
-    d_z( other.d_z )
+inline QwtPoint3D::QwtPoint3D( double x, double y, double z = 0.0 )
+    : m_x( x )
+    , m_y( y )
+    , m_z( z )
 {
 }
@@ -94,9 +81,9 @@
     Constructs a point with x and y coordinates from a 2D point,
     and a z coordinate of 0.
-*/
-inline QwtPoint3D::QwtPoint3D( const QPointF &other ):
-    d_x( other.x() ),
-    d_y( other.y() ),
-    d_z( 0.0 )
+ */
+inline QwtPoint3D::QwtPoint3D( const QPointF& other )
+    : m_x( other.x() )
+    , m_y( other.y() )
+    , m_z( 0.0 )
 {
 }
@@ -107,8 +94,8 @@
     A point is considered to be null if x, y and z-coordinates
     are equal to zero.
-*/
+ */
 inline bool QwtPoint3D::isNull() const
 {
-    return d_x == 0.0 && d_y == 0.0 && d_z == 0.0;
+    return m_x == 0.0 && m_y == 0.0 && m_z == 0.0;
 }
 
@@ -116,5 +103,5 @@
 inline double QwtPoint3D::x() const
 {
-    return d_x;
+    return m_x;
 }
 
@@ -122,5 +109,5 @@
 inline double QwtPoint3D::y() const
 {
-    return d_y;
+    return m_y;
 }
 
@@ -128,23 +115,23 @@
 inline double QwtPoint3D::z() const
 {
-    return d_z;
+    return m_z;
 }
 
 //! \return A reference to the x-coordinate of the point.
-inline double &QwtPoint3D::rx()
+inline double& QwtPoint3D::rx()
 {
-    return d_x;
+    return m_x;
 }
 
 //! \return A reference to the y-coordinate of the point.
-inline double &QwtPoint3D::ry()
+inline double& QwtPoint3D::ry()
 {
-    return d_y;
+    return m_y;
 }
 
 //! \return A reference to the z-coordinate of the point.
-inline double &QwtPoint3D::rz()
+inline double& QwtPoint3D::rz()
 {
-    return d_z;
+    return m_z;
 }
 
@@ -152,5 +139,5 @@
 inline void QwtPoint3D::setX( double x )
 {
-    d_x = x;
+    m_x = x;
 }
 
@@ -158,5 +145,5 @@
 inline void QwtPoint3D::setY( double y )
 {
-    d_y = y;
+    m_y = y;
 }
 
@@ -164,23 +151,23 @@
 inline void QwtPoint3D::setZ( double z )
 {
-    d_z = z;
+    m_z = z;
 }
 
 /*!
    \return 2D point, where the z coordinate is dropped.
-*/
+ */
 inline QPointF QwtPoint3D::toPoint() const
 {
-    return QPointF( d_x, d_y );
+    return QPointF( m_x, m_y );
 }
 
 //! \return True, if this point and other are equal; otherwise returns false.
-inline bool QwtPoint3D::operator==( const QwtPoint3D &other ) const
+inline bool QwtPoint3D::operator==( const QwtPoint3D& other ) const
 {
-    return ( d_x == other.d_x ) && ( d_y == other.d_y ) && ( d_z == other.d_z );
+    return ( m_x == other.m_x ) && ( m_y == other.m_y ) && ( m_z == other.m_z );
 }
 
 //! \return True if this rect and other are different; otherwise returns false.
-inline bool QwtPoint3D::operator!=( const QwtPoint3D &other ) const
+inline bool QwtPoint3D::operator!=( const QwtPoint3D& other ) const
 {
     return !operator==( other );
Index: /trunk/BNC/qwt/qwt_point_data.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_point_data.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_point_data.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,150 +9,4 @@
 
 #include "qwt_point_data.h"
-#include "qwt_math.h"
-#include <string.h>
-
-/*!
-  Constructor
-
-  \param x Array of x values
-  \param y Array of y values
-
-  \sa QwtPlotCurve::setData(), QwtPlotCurve::setSamples()
-*/
-QwtPointArrayData::QwtPointArrayData(
-        const QVector<double> &x, const QVector<double> &y ):
-    d_x( x ),
-    d_y( y )
-{
-}
-
-/*!
-  Constructor
-
-  \param x Array of x values
-  \param y Array of y values
-  \param size Size of the x and y arrays
-  \sa QwtPlotCurve::setData(), QwtPlotCurve::setSamples()
-*/
-QwtPointArrayData::QwtPointArrayData( const double *x,
-        const double *y, size_t size )
-{
-    d_x.resize( size );
-    ::memcpy( d_x.data(), x, size * sizeof( double ) );
-
-    d_y.resize( size );
-    ::memcpy( d_y.data(), y, size * sizeof( double ) );
-}
-
-/*!
-  \brief Calculate the bounding rectangle
-
-  The bounding rectangle is calculated once by iterating over all
-  points and is stored for all following requests.
-
-  \return Bounding rectangle
-*/
-QRectF QwtPointArrayData::boundingRect() const
-{
-    if ( d_boundingRect.width() < 0 )
-        d_boundingRect = qwtBoundingRect( *this );
-
-    return d_boundingRect;
-}
-
-//! \return Size of the data set
-size_t QwtPointArrayData::size() const
-{
-    return qMin( d_x.size(), d_y.size() );
-}
-
-/*!
-  Return the sample at position i
-
-  \param index Index
-  \return Sample at position i
-*/
-QPointF QwtPointArrayData::sample( size_t index ) const
-{
-    return QPointF( d_x[int( index )], d_y[int( index )] );
-}
-
-//! \return Array of the x-values
-const QVector<double> &QwtPointArrayData::xData() const
-{
-    return d_x;
-}
-
-//! \return Array of the y-values
-const QVector<double> &QwtPointArrayData::yData() const
-{
-    return d_y;
-}
-
-/*!
-  Constructor
-
-  \param x Array of x values
-  \param y Array of y values
-  \param size Size of the x and y arrays
-
-  \warning The programmer must assure that the memory blocks referenced
-           by the pointers remain valid during the lifetime of the
-           QwtPlotCPointer object.
-
-  \sa QwtPlotCurve::setData(), QwtPlotCurve::setRawSamples()
-*/
-QwtCPointerData::QwtCPointerData(
-        const double *x, const double *y, size_t size ):
-    d_x( x ),
-    d_y( y ),
-    d_size( size )
-{
-}
-
-/*!
-  \brief Calculate the bounding rectangle
-
-  The bounding rectangle is calculated once by iterating over all
-  points and is stored for all following requests.
-
-  \return Bounding rectangle
-*/
-QRectF QwtCPointerData::boundingRect() const
-{
-    if ( d_boundingRect.width() < 0 )
-        d_boundingRect = qwtBoundingRect( *this );
-
-    return d_boundingRect;
-}
-
-//! \return Size of the data set
-size_t QwtCPointerData::size() const
-{
-    return d_size;
-}
-
-/*!
-  Return the sample at position i
-
-  \param index Index
-  \return Sample at position i
-*/
-QPointF QwtCPointerData::sample( size_t index ) const
-{
-    return QPointF( d_x[int( index )], d_y[int( index )] );
-}
-
-//! \return Array of the x-values
-const double *QwtCPointerData::xData() const
-{
-    return d_x;
-}
-
-//! \return Array of the y-values
-const double *QwtCPointerData::yData() const
-{
-    return d_y;
-}
 
 /*!
@@ -163,30 +17,30 @@
 
    \sa setInterval(), setSize()
-*/
+ */
 QwtSyntheticPointData::QwtSyntheticPointData(
-        size_t size, const QwtInterval &interval ):
-    d_size( size ),
-    d_interval( interval )
+        size_t size, const QwtInterval& interval )
+    : m_size( size )
+    , m_interval( interval )
 {
 }
 
 /*!
-  Change the number of points
+   Change the number of points
 
-  \param size Number of points
-  \sa size(), setInterval()
-*/
+   \param size Number of points
+   \sa size(), setInterval()
+ */
 void QwtSyntheticPointData::setSize( size_t size )
 {
-    d_size = size;
+    m_size = size;
 }
 
 /*!
-  \return Number of points
-  \sa setSize(), interval()
-*/
+   \return Number of points
+   \sa setSize(), interval()
+ */
 size_t QwtSyntheticPointData::size() const
 {
-    return d_size;
+    return m_size;
 }
 
@@ -196,8 +50,8 @@
    \param interval Interval
    \sa interval(), setSize()
-*/
-void QwtSyntheticPointData::setInterval( const QwtInterval &interval )
+ */
+void QwtSyntheticPointData::setInterval( const QwtInterval& interval )
 {
-    d_interval = interval.normalized();
+    m_interval = interval.normalized();
 }
 
@@ -205,8 +59,8 @@
    \return Bounding interval
    \sa setInterval(), size()
-*/
+ */
 QwtInterval QwtSyntheticPointData::interval() const
 {
-    return d_interval;
+    return m_interval;
 }
 
@@ -221,9 +75,9 @@
 
    \sa rectOfInterest()
-*/
-void QwtSyntheticPointData::setRectOfInterest( const QRectF &rect )
+ */
+void QwtSyntheticPointData::setRectOfInterest( const QRectF& rect )
 {
-    d_rectOfInterest = rect;
-    d_intervalOfInterest = QwtInterval(
+    m_rectOfInterest = rect;
+    m_intervalOfInterest = QwtInterval(
         rect.left(), rect.right() ).normalized();
 }
@@ -232,25 +86,25 @@
    \return "rectangle of interest"
    \sa setRectOfInterest()
-*/
+ */
 QRectF QwtSyntheticPointData::rectOfInterest() const
 {
-    return d_rectOfInterest;
+    return m_rectOfInterest;
 }
 
 /*!
-  \brief Calculate the bounding rectangle
+   \brief Calculate the bounding rectangle
 
-  This implementation iterates over all points, what could often
-  be implemented much faster using the characteristics of the series.
-  When there are many points it is recommended to overload and
-  reimplement this method using the characteristics of the series
-  ( if possible ).
+   This implementation iterates over all points, what could often
+   be implemented much faster using the characteristics of the series.
+   When there are many points it is recommended to overload and
+   reimplement this method using the characteristics of the series
+   ( if possible ).
 
-  \return Bounding rectangle
-*/
+   \return Bounding rectangle
+ */
 QRectF QwtSyntheticPointData::boundingRect() const
 {
-    if ( d_size == 0 ||
-        !( d_interval.isValid() || d_intervalOfInterest.isValid() ) )
+    if ( m_size == 0 ||
+        !( m_interval.isValid() || m_intervalOfInterest.isValid() ) )
     {
         return QRectF( 1.0, 1.0, -2.0, -2.0 ); // something invalid
@@ -268,8 +122,8 @@
    \warning For invalid indices ( index < 0 || index >= size() )
             (0, 0) is returned.
-*/
+ */
 QPointF QwtSyntheticPointData::sample( size_t index ) const
 {
-    if ( index >= d_size )
+    if ( index >= m_size )
         return QPointF( 0, 0 );
 
@@ -291,17 +145,17 @@
 
    \sa interval(), rectOfInterest(), y()
-*/
+ */
 double QwtSyntheticPointData::x( uint index ) const
 {
-    const QwtInterval &interval = d_interval.isValid() ?
-        d_interval : d_intervalOfInterest;
+    const QwtInterval& interval = m_interval.isValid() ?
+        m_interval : m_intervalOfInterest;
 
     if ( !interval.isValid() )
         return 0.0;
 
-    if ( d_size <= 1 )
+    if ( m_size <= 1 )
         return interval.minValue();
 
-    const double dx = interval.width() / ( d_size - 1 );
+    const double dx = interval.width() / ( m_size - 1 );
     return interval.minValue() + index * dx;
 }
Index: /trunk/BNC/qwt/qwt_point_data.h
===================================================================
--- /trunk/BNC/qwt/qwt_point_data.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_point_data.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,77 +9,122 @@
 
 #ifndef QWT_POINT_DATA_H
-#define QWT_POINT_DATA_H 1
+#define QWT_POINT_DATA_H
 
 #include "qwt_global.h"
 #include "qwt_series_data.h"
 
-/*!
-  \brief Interface for iterating over two QVector<double> objects.
-*/
-class QWT_EXPORT QwtPointArrayData: public QwtSeriesData<QPointF>
-{
-public:
-    QwtPointArrayData( const QVector<double> &x, const QVector<double> &y );
-    QwtPointArrayData( const double *x, const double *y, size_t size );
-
-    virtual QRectF boundingRect() const;
-
-    virtual size_t size() const;
-    virtual QPointF sample( size_t index ) const;
-
-    const QVector<double> &xData() const;
-    const QVector<double> &yData() const;
-
-private:
-    QVector<double> d_x;
-    QVector<double> d_y;
+#include <cstring>
+
+/*!
+   \brief Interface for iterating over two QVector<T> objects.
+ */
+template< typename T >
+class QwtPointArrayData : public QwtSeriesData< QPointF >
+{
+  public:
+    QwtPointArrayData( const QVector< T >& x, const QVector< T >& y );
+    QwtPointArrayData( const T* x, const T* y, size_t size );
+
+    virtual size_t size() const QWT_OVERRIDE;
+    virtual QPointF sample( size_t index ) const QWT_OVERRIDE;
+
+    const QVector< T >& xData() const;
+    const QVector< T >& yData() const;
+
+  private:
+    QVector< T > m_x;
+    QVector< T > m_y;
 };
 
 /*!
-  \brief Data class containing two pointers to memory blocks of doubles.
- */
-class QWT_EXPORT QwtCPointerData: public QwtSeriesData<QPointF>
-{
-public:
-    QwtCPointerData( const double *x, const double *y, size_t size );
-
-    virtual QRectF boundingRect() const;
-    virtual size_t size() const;
-    virtual QPointF sample( size_t index ) const;
-
-    const double *xData() const;
-    const double *yData() const;
-
-private:
-    const double *d_x;
-    const double *d_y;
-    size_t d_size;
+   \brief Data class containing two pointers to memory blocks of T.
+ */
+template< typename T >
+class QwtCPointerData : public QwtSeriesData< QPointF >
+{
+  public:
+    QwtCPointerData( const T* x, const T* y, size_t size );
+
+    virtual size_t size() const QWT_OVERRIDE;
+    virtual QPointF sample( size_t index ) const QWT_OVERRIDE;
+
+    const T* xData() const;
+    const T* yData() const;
+
+  private:
+    const T* m_x;
+    const T* m_y;
+    size_t m_size;
 };
 
 /*!
-  \brief Synthetic point data
-
-  QwtSyntheticPointData provides a fixed number of points for an interval.
-  The points are calculated in equidistant steps in x-direction.
-
-  If the interval is invalid, the points are calculated for
-  the "rectangle of interest", what normally is the displayed area on the
-  plot canvas. In this mode you get different levels of detail, when
-  zooming in/out.
-
-  \par Example
-
-  The following example shows how to implement a sinus curve.
-
-  \code
-#include <cmath>
-#include <qwt_series_data.h>
-#include <qwt_plot_curve.h>
-#include <qwt_plot.h>
-#include <qapplication.h>
-
-class SinusData: public QwtSyntheticPointData
-{
-public:
+   \brief Interface for iterating over a QVector<T>.
+
+   The memory contains the y coordinates, while the index is
+   interpreted as x coordinate.
+ */
+template< typename T >
+class QwtValuePointData : public QwtSeriesData< QPointF >
+{
+  public:
+    QwtValuePointData( const QVector< T >& y );
+    QwtValuePointData( const T* y, size_t size );
+
+    virtual size_t size() const QWT_OVERRIDE;
+    virtual QPointF sample( size_t index ) const QWT_OVERRIDE;
+
+    const QVector< T >& yData() const;
+
+  private:
+    QVector< T > m_y;
+};
+
+/*!
+   \brief Data class containing a pointer to memory of y coordinates
+
+   The memory contains the y coordinates, while the index is
+   interpreted as x coordinate.
+ */
+template< typename T >
+class QwtCPointerValueData : public QwtSeriesData< QPointF >
+{
+  public:
+    QwtCPointerValueData( const T* y, size_t size );
+
+    virtual size_t size() const QWT_OVERRIDE;
+    virtual QPointF sample( size_t index ) const QWT_OVERRIDE;
+
+    const T* yData() const;
+
+  private:
+    const T* m_y;
+    size_t m_size;
+};
+
+/*!
+   \brief Synthetic point data
+
+   QwtSyntheticPointData provides a fixed number of points for an interval.
+   The points are calculated in equidistant steps in x-direction.
+
+   If the interval is invalid, the points are calculated for
+   the "rectangle of interest", what normally is the displayed area on the
+   plot canvas. In this mode you get different levels of detail, when
+   zooming in/out.
+
+   \par Example
+
+   The following example shows how to implement a sinus curve.
+
+   \code
+ #include <cmath>
+ #include <qwt_series_data.h>
+ #include <qwt_plot_curve.h>
+ #include <qwt_plot.h>
+ #include <qapplication.h>
+
+   class SinusData: public QwtSyntheticPointData
+   {
+   public:
     SinusData():
         QwtSyntheticPointData( 100 )
@@ -91,13 +136,13 @@
         return qSin( x );
     }
-};
-
-int main(int argc, char **argv)
-{
+   };
+
+   int main(int argc, char **argv)
+   {
     QApplication a( argc, argv );
 
     QwtPlot plot;
-    plot.setAxisScale( QwtPlot::xBottom, 0.0, 10.0 );
-    plot.setAxisScale( QwtPlot::yLeft, -1.0, 1.0 );
+    plot.setAxisScale( QwtAxis::XBottom, 0.0, 10.0 );
+    plot.setAxisScale( QwtAxis::YLeft, -1.0, 1.0 );
 
     QwtPlotCurve *curve = new QwtPlotCurve( "y = sin(x)" );
@@ -107,21 +152,21 @@
     plot.show();
     return a.exec();
-}
+   }
    \endcode
-*/
-class QWT_EXPORT QwtSyntheticPointData: public QwtSeriesData<QPointF>
-{
-public:
+ */
+class QWT_EXPORT QwtSyntheticPointData : public QwtSeriesData< QPointF >
+{
+  public:
     QwtSyntheticPointData( size_t size,
-        const QwtInterval & = QwtInterval() );
+        const QwtInterval& = QwtInterval() );
 
     void setSize( size_t size );
-    virtual size_t size() const;
+    virtual size_t size() const QWT_OVERRIDE;
 
     void setInterval( const QwtInterval& );
     QwtInterval interval() const;
 
-    virtual QRectF boundingRect() const;
-    virtual QPointF sample( size_t index ) const;
+    virtual QRectF boundingRect() const QWT_OVERRIDE;
+    virtual QPointF sample( size_t index ) const QWT_OVERRIDE;
 
     /*!
@@ -134,13 +179,234 @@
     virtual double x( uint index ) const;
 
-    virtual void setRectOfInterest( const QRectF & );
+    virtual void setRectOfInterest( const QRectF& ) QWT_OVERRIDE;
     QRectF rectOfInterest() const;
 
-private:
-    size_t d_size;
-    QwtInterval d_interval;
-    QRectF d_rectOfInterest;
-    QwtInterval d_intervalOfInterest;
+  private:
+    size_t m_size;
+    QwtInterval m_interval;
+    QRectF m_rectOfInterest;
+    QwtInterval m_intervalOfInterest;
 };
 
+/*!
+   Constructor
+
+   \param x Array of x values
+   \param y Array of y values
+
+   \sa QwtPlotCurve::setData(), QwtPlotCurve::setSamples()
+ */
+template< typename T >
+QwtPointArrayData< T >::QwtPointArrayData(
+        const QVector< T >& x, const QVector< T >& y )
+    : m_x( x )
+    , m_y( y )
+{
+}
+
+/*!
+   Constructor
+
+   \param x Array of x values
+   \param y Array of y values
+   \param size Size of the x and y arrays
+   \sa QwtPlotCurve::setData(), QwtPlotCurve::setSamples()
+ */
+template< typename T >
+QwtPointArrayData< T >::QwtPointArrayData( const T* x, const T* y, size_t size )
+{
+    m_x.resize( size );
+    std::memcpy( m_x.data(), x, size * sizeof( T ) );
+
+    m_y.resize( size );
+    std::memcpy( m_y.data(), y, size * sizeof( T ) );
+}
+
+//! \return Size of the data set
+template< typename T >
+size_t QwtPointArrayData< T >::size() const
+{
+    return qMin( m_x.size(), m_y.size() );
+}
+
+/*!
+   Return the sample at position i
+
+   \param index Index
+   \return Sample at position i
+ */
+template< typename T >
+QPointF QwtPointArrayData< T >::sample( size_t index ) const
+{
+    return QPointF( m_x[int( index )], m_y[int( index )] );
+}
+
+//! \return Array of the x-values
+template< typename T >
+const QVector< T >& QwtPointArrayData< T >::xData() const
+{
+    return m_x;
+}
+
+//! \return Array of the y-values
+template< typename T >
+const QVector< T >& QwtPointArrayData< T >::yData() const
+{
+    return m_y;
+}
+
+/*!
+   Constructor
+
+   \param y Array of y values
+
+   \sa QwtPlotCurve::setData(), QwtPlotCurve::setSamples()
+ */
+template< typename T >
+QwtValuePointData< T >::QwtValuePointData( const QVector< T >& y )
+    : m_y( y )
+{
+}
+
+/*!
+   Constructor
+
+   \param y Array of y values
+   \param size Size of the x and y arrays
+   \sa QwtPlotCurve::setData(), QwtPlotCurve::setSamples()
+ */
+template< typename T >
+QwtValuePointData< T >::QwtValuePointData( const T* y, size_t size )
+{
+    m_y.resize( size );
+    std::memcpy( m_y.data(), y, size * sizeof( T ) );
+}
+
+//! \return Size of the data set
+template< typename T >
+size_t QwtValuePointData< T >::size() const
+{
+    return m_y.size();
+}
+
+/*!
+   Return the sample at position i
+
+   \param index Index
+   \return Sample at position i
+ */
+template< typename T >
+QPointF QwtValuePointData< T >::sample( size_t index ) const
+{
+    return QPointF( index, m_y[int( index )] );
+}
+
+//! \return Array of the y-values
+template< typename T >
+const QVector< T >& QwtValuePointData< T >::yData() const
+{
+    return m_y;
+}
+
+/*!
+   Constructor
+
+   \param x Array of x values
+   \param y Array of y values
+   \param size Size of the x and y arrays
+
+   \warning The programmer must assure that the memory blocks referenced
+           by the pointers remain valid during the lifetime of the
+           QwtPlotCPointer object.
+
+   \sa QwtPlotCurve::setData(), QwtPlotCurve::setRawSamples()
+ */
+
+template< typename T >
+QwtCPointerData< T >::QwtCPointerData( const T* x, const T* y, size_t size )
+    : m_x( x )
+    , m_y( y )
+    , m_size( size )
+{
+}
+
+//! \return Size of the data set
+template< typename T >
+size_t QwtCPointerData< T >::size() const
+{
+    return m_size;
+}
+
+/*!
+   Return the sample at position i
+
+   \param index Index
+   \return Sample at position i
+ */
+template< typename T >
+QPointF QwtCPointerData< T >::sample( size_t index ) const
+{
+    return QPointF( m_x[int( index )], m_y[int( index )] );
+}
+
+//! \return Array of the x-values
+template< typename T >
+const T* QwtCPointerData< T >::xData() const
+{
+    return m_x;
+}
+
+//! \return Array of the y-values
+template< typename T >
+const T* QwtCPointerData< T >::yData() const
+{
+    return m_y;
+}
+
+/*!
+   Constructor
+
+   \param y Array of y values
+   \param size Size of the x and y arrays
+
+   \warning The programmer must assure that the memory blocks referenced
+           by the pointers remain valid during the lifetime of the
+           QwtCPointerValueData object.
+
+   \sa QwtPlotCurve::setData(), QwtPlotCurve::setRawSamples()
+ */
+
+template< typename T >
+QwtCPointerValueData< T >::QwtCPointerValueData( const T* y, size_t size )
+    : m_y( y )
+    , m_size( size )
+{
+}
+
+//! \return Size of the data set
+template< typename T >
+size_t QwtCPointerValueData< T >::size() const
+{
+    return m_size;
+}
+
+/*!
+   Return the sample at position i
+
+   \param index Index
+   \return Sample at position i
+ */
+template< typename T >
+QPointF QwtCPointerValueData< T >::sample( size_t index ) const
+{
+    return QPointF( index, m_y[ int( index ) ] );
+}
+
+//! \return Array of the y-values
+template< typename T >
+const T* QwtCPointerValueData< T >::yData() const
+{
+    return m_y;
+}
+
 #endif
Index: /trunk/BNC/qwt/qwt_point_mapper.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_point_mapper.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_point_mapper.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,4 +11,7 @@
 #include "qwt_scale_map.h"
 #include "qwt_pixel_matrix.h"
+#include "qwt_series_data.h"
+#include "qwt_math.h"
+
 #include <qpolygon.h>
 #include <qimage.h>
@@ -16,17 +19,263 @@
 #include <qpainter.h>
 
-#if QT_VERSION >= 0x040400
-
 #include <qthread.h>
 #include <qfuture.h>
 #include <qtconcurrentrun.h>
 
-#if !defined(QT_NO_QFUTURE)
+#if !defined( QT_NO_QFUTURE )
 #define QWT_USE_THREADS 1
 #endif
 
+static QRectF qwtInvalidRect( 0.0, 0.0, -1.0, -1.0 );
+
+static inline int qwtRoundValue( double value )
+{
+    return qRound( value );
+}
+
+static inline double qwtRoundValueF( double value )
+{
+#if 1
+    // MS Windows and at least IRIX does not have C99's nearbyint() function
+    return ( value >= 0.0 ) ? std::floor( value + 0.5 ) : std::ceil( value - 0.5 );
+#else
+    return nearbyint( value );
 #endif
-
-static QRectF qwtInvalidRect( 0.0, 0.0, -1.0, -1.0 );
+}
+
+static Qt::Orientation qwtProbeOrientation(
+    const QwtSeriesData< QPointF >* series, int from, int to )
+{
+    if ( to - from < 20 )
+    {
+        // not enough points to "have an orientation"
+        return Qt::Horizontal;
+    }
+
+    const double x0 = series->sample( from ).x();
+    const double xn = series->sample( to ).x();
+
+    if ( x0 == xn )
+        return Qt::Vertical;
+
+    const int step = ( to - from ) / 10;
+    const bool isIncreasing = xn > x0;
+
+    double x1 = x0;
+    for ( int i = from + step; i < to; i += step )
+    {
+        const double x2 = series->sample( i ).x();
+        if ( x2 != x1 )
+        {
+            if ( ( x2 > x1 ) != isIncreasing )
+                return Qt::Vertical;
+        }
+
+        x1 = x2;
+    }
+
+    return Qt::Horizontal;
+}
+
+namespace
+{
+    template< class Polygon, class Point >
+    class QwtPolygonQuadrupelX
+    {
+      public:
+        inline void start( int x, int y )
+        {
+            m_x0 = x;
+            m_y1 = m_yMin = m_yMax = m_y2 = y;
+        }
+
+        inline bool append( int x, int y )
+        {
+            if ( m_x0 != x )
+                return false;
+
+            if ( y < m_yMin )
+                m_yMin = y;
+            else if ( y > m_yMax )
+                m_yMax = y;
+
+            m_y2 = y;
+
+            return true;
+        }
+
+        inline void flush( Polygon& polyline )
+        {
+            appendTo( m_y1, polyline );
+
+            if ( m_y2 > m_y1 )
+                qSwap( m_yMin, m_yMax );
+
+            if ( m_yMax != m_y1 )
+                appendTo( m_yMax, polyline );
+
+            if ( m_yMin != m_yMax )
+                appendTo( m_yMin, polyline );
+
+            if ( m_y2 != m_yMin )
+                appendTo( m_y2, polyline );
+        }
+
+      private:
+        inline void appendTo( int y, Polygon& polyline )
+        {
+            polyline += Point( m_x0, y );
+        }
+
+      private:
+        int m_x0, m_y1, m_yMin, m_yMax, m_y2;
+    };
+
+    template< class Polygon, class Point >
+    class QwtPolygonQuadrupelY
+    {
+      public:
+        inline void start( int x, int y )
+        {
+            m_y0 = y;
+            m_x1 = m_xMin = m_xMax = m_x2 = x;
+        }
+
+        inline bool append( int x, int y )
+        {
+            if ( m_y0 != y )
+                return false;
+
+            if ( x < m_xMin )
+                m_xMin = x;
+            else if ( x > m_xMax )
+                m_xMax = x;
+
+            m_x2 = x;
+
+            return true;
+        }
+
+        inline void flush( Polygon& polyline )
+        {
+            appendTo( m_x1, polyline );
+
+            if ( m_x2 > m_x1 )
+                qSwap( m_xMin, m_xMax );
+
+            if ( m_xMax != m_x1 )
+                appendTo( m_xMax, polyline );
+
+            if ( m_xMin != m_xMax )
+                appendTo( m_xMin, polyline );
+
+            if ( m_x2 != m_xMin )
+                appendTo( m_x2, polyline );
+        }
+
+      private:
+        inline void appendTo( int x, Polygon& polyline )
+        {
+            polyline += Point( x, m_y0 );
+        }
+
+        int m_y0, m_x1, m_xMin, m_xMax, m_x2;
+    };
+}
+
+template< class Polygon, class Point, class PolygonQuadrupel >
+static Polygon qwtMapPointsQuad( const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to )
+{
+    const QPointF sample0 = series->sample( from );
+
+    PolygonQuadrupel q;
+    q.start( qwtRoundValue( xMap.transform( sample0.x() ) ),
+        qwtRoundValue( yMap.transform( sample0.y() ) ) );
+
+    Polygon polyline;
+    for ( int i = from; i <= to; i++ )
+    {
+        const QPointF sample = series->sample( i );
+
+        const int x = qwtRoundValue( xMap.transform( sample.x() ) );
+        const int y = qwtRoundValue( yMap.transform( sample.y() ) );
+
+        if ( !q.append( x, y ) )
+        {
+            q.flush( polyline );
+            q.start( x, y );
+        }
+    }
+    q.flush( polyline );
+
+    return polyline;
+}
+
+template< class Polygon, class Point, class PolygonQuadrupel >
+static Polygon qwtMapPointsQuad( const Polygon& polyline )
+{
+    const int numPoints = polyline.size();
+
+    if ( numPoints < 3 )
+        return polyline;
+
+    const Point* points = polyline.constData();
+
+    Polygon polylineXY;
+
+    PolygonQuadrupel q;
+    q.start( points[0].x(), points[0].y() );
+
+    for ( int i = 0; i < numPoints; i++ )
+    {
+        const int x = points[i].x();
+        const int y = points[i].y();
+
+        if ( !q.append( x, y ) )
+        {
+            q.flush( polylineXY );
+            q.start( x, y );
+        }
+    }
+    q.flush( polylineXY );
+
+    return polylineXY;
+}
+
+
+template< class Polygon, class Point >
+static Polygon qwtMapPointsQuad( const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to )
+{
+    Polygon polyline;
+    if ( from > to )
+        return polyline;
+
+    /*
+        probing some values, to decide if it is better
+        to start with x or y coordinates
+     */
+    const Qt::Orientation orientation = qwtProbeOrientation( series, from, to );
+
+    if ( orientation == Qt::Horizontal )
+    {
+        polyline = qwtMapPointsQuad< Polygon, Point,
+            QwtPolygonQuadrupelY< Polygon, Point > >( xMap, yMap, series, from, to );
+
+        polyline = qwtMapPointsQuad< Polygon, Point,
+            QwtPolygonQuadrupelX< Polygon, Point > >( polyline );
+    }
+    else
+    {
+        polyline = qwtMapPointsQuad< Polygon, Point,
+            QwtPolygonQuadrupelX< Polygon, Point > >( xMap, yMap, series, from, to );
+
+        polyline = qwtMapPointsQuad< Polygon, Point,
+            QwtPolygonQuadrupelY< Polygon, Point > >( polyline );
+    }
+
+    return polyline;
+}
 
 // Helper class to work around the 5 parameters
@@ -34,6 +283,6 @@
 class QwtDotsCommand
 {
-public:
-    const QwtSeriesData<QPointF> *series;
+  public:
+    const QwtSeriesData< QPointF >* series;
     int from;
     int to;
@@ -42,9 +291,9 @@
 
 static void qwtRenderDots(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtDotsCommand command, const QPoint &pos, QImage *image )
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtDotsCommand& command, const QPoint& pos, QImage* image )
 {
     const QRgb rgb = command.rgb;
-    QRgb *bits = reinterpret_cast<QRgb *>( image->bits() );
+    QRgb* bits = reinterpret_cast< QRgb* >( image->bits() );
 
     const int w = image->width();
@@ -58,6 +307,6 @@
         const QPointF sample = command.series->sample( i );
 
-        const int x = static_cast<int>( xMap.transform( sample.x() ) + 0.5 ) - x0;
-        const int y = static_cast<int>( yMap.transform( sample.y() ) + 0.5 ) - y0;
+        const int x = static_cast< int >( xMap.transform( sample.x() ) + 0.5 ) - x0;
+        const int y = static_cast< int >( yMap.transform( sample.y() ) + 0.5 ) - y0;
 
         if ( x >= 0 && x < w && y >= 0 && y < h )
@@ -66,13 +315,8 @@
 }
 
-static inline int qwtRoundValue( double value )
-{
-    return qRound( value );
-}
-
 // some functors, so that the compile can inline
 struct QwtRoundI
 {
-    inline int operator()( double value )
+    inline int operator()( double value ) const
     {
         return qwtRoundValue( value );
@@ -82,13 +326,7 @@
 struct QwtRoundF
 {
-    inline double operator()( double value )
-    {
-#if 1
-        // MS Windows and at least IRIX does not have C99's nearbyint() function
-        return ( value >= 0.0 ) ? ::floor( value + 0.5 ) : ::ceil( value - 0.5 );
-#else
-        // slightly faster than the code above
-        return nearbyint( value );
-#endif
+    inline double operator()( double value ) const
+    {
+        return qwtRoundValueF( value );
     }
 };
@@ -96,5 +334,5 @@
 struct QwtNoRoundF
 {
-    inline double operator()( double value )
+    inline double operator()( double value ) const
     {
         return value;
@@ -105,13 +343,13 @@
 // the bounding rectangle
 
-template<class Polygon, class Point, class Round>
+template< class Polygon, class Point, class Round >
 static inline Polygon qwtToPoints(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QRectF& boundingRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to, Round round )
 {
     Polygon polyline( to - from + 1 );
-    Point *points = polyline.data();
+    Point* points = polyline.data();
 
     int numPoints = 0;
@@ -164,21 +402,21 @@
 
 static inline QPolygon qwtToPointsI(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QRectF& boundingRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to )
 {
-    return qwtToPoints<QPolygon, QPoint>(
+    return qwtToPoints< QPolygon, QPoint >(
         boundingRect, xMap, yMap, series, from, to, QwtRoundI() );
 }
 
-template<class Round>
+template< class Round >
 static inline QPolygonF qwtToPointsF(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QRectF& boundingRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to, Round round )
 {
-    return qwtToPoints<QPolygonF, QPointF>(
+    return qwtToPoints< QPolygonF, QPointF >(
         boundingRect, xMap, yMap, series, from, to, round );
 }
@@ -187,8 +425,8 @@
 // points mapped to the same position
 
-template<class Polygon, class Point, class Round>
+template< class Polygon, class Point, class Round >
 static inline Polygon qwtToPolylineFiltered(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to, Round round )
 {
@@ -199,5 +437,5 @@
 
     Polygon polyline( to - from + 1 );
-    Point *points = polyline.data();
+    Point* points = polyline.data();
 
     const QPointF sample0 = series->sample( from );
@@ -223,27 +461,27 @@
 
 static inline QPolygon qwtToPolylineFilteredI(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to )
 {
-    return qwtToPolylineFiltered<QPolygon, QPoint>(
+    return qwtToPolylineFiltered< QPolygon, QPoint >(
         xMap, yMap, series, from, to, QwtRoundI() );
 }
 
-template<class Round>
+template< class Round >
 static inline QPolygonF qwtToPolylineFilteredF(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to, Round round )
 {
-    return qwtToPolylineFiltered<QPolygonF, QPointF>(
+    return qwtToPolylineFiltered< QPolygonF, QPointF >(
         xMap, yMap, series, from, to, round );
 }
 
-template<class Polygon, class Point>
+template< class Polygon, class Point >
 static inline Polygon qwtToPointsFiltered(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to )
+    const QRectF& boundingRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to )
 {
     // F.e. in scatter plots ( no connecting lines ) we
@@ -251,5 +489,5 @@
 
     Polygon polygon( to - from + 1 );
-    Point *points = polygon.data();
+    Point* points = polygon.data();
 
     QwtPixelMatrix pixelMatrix( boundingRect.toAlignedRect() );
@@ -277,18 +515,18 @@
 
 static inline QPolygon qwtToPointsFilteredI(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to )
-{
-    return qwtToPointsFiltered<QPolygon, QPoint>(
+    const QRectF& boundingRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to )
+{
+    return qwtToPointsFiltered< QPolygon, QPoint >(
         boundingRect, xMap, yMap, series, from, to );
 }
 
 static inline QPolygonF qwtToPointsFilteredF(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to )
-{
-    return qwtToPointsFiltered<QPolygonF, QPointF>(
+    const QRectF& boundingRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to )
+{
+    return qwtToPointsFiltered< QPolygonF, QPointF >(
         boundingRect, xMap, yMap, series, from, to );
 }
@@ -296,7 +534,7 @@
 class QwtPointMapper::PrivateData
 {
-public:
-    PrivateData():
-        boundingRect( qwtInvalidRect )
+  public:
+    PrivateData()
+        : boundingRect( qwtInvalidRect )
     {
     }
@@ -309,5 +547,5 @@
 QwtPointMapper::QwtPointMapper()
 {
-    d_data = new PrivateData();
+    m_data = new PrivateData();
 }
 
@@ -315,102 +553,110 @@
 QwtPointMapper::~QwtPointMapper()
 {
-    delete d_data;
-}
-
-/*!
-  Set the flags affecting the transformation process
-
-  \param flags Flags
-  \sa flags(), setFlag()
+    delete m_data;
+}
+
+/*!
+   Set the flags affecting the transformation process
+
+   \param flags Flags
+   \sa flags(), setFlag()
  */
 void QwtPointMapper::setFlags( TransformationFlags flags )
 {
-    d_data->flags = flags;
-}
-
-/*!
-  \return Flags affecting the transformation process
-  \sa setFlags(), setFlag()
+    m_data->flags = flags;
+}
+
+/*!
+   \return Flags affecting the transformation process
+   \sa setFlags(), setFlag()
  */
 QwtPointMapper::TransformationFlags QwtPointMapper::flags() const
 {
-    return d_data->flags;
-}
-
-/*!
-  Modify a flag affecting the transformation process
-
-  \param flag Flag type
-  \param on Value
-
-  \sa flag(), setFlags()
+    return m_data->flags;
+}
+
+/*!
+   Modify a flag affecting the transformation process
+
+   \param flag Flag type
+   \param on Value
+
+   \sa flag(), setFlags()
  */
 void QwtPointMapper::setFlag( TransformationFlag flag, bool on )
 {
     if ( on )
-        d_data->flags |= flag;
+        m_data->flags |= flag;
     else
-        d_data->flags &= ~flag;
-}
-
-/*!
-  \return True, when the flag is set
-  \param flag Flag type
-  \sa setFlag(), setFlags()
+        m_data->flags &= ~flag;
+}
+
+/*!
+   \return True, when the flag is set
+   \param flag Flag type
+   \sa setFlag(), setFlags()
  */
 bool QwtPointMapper::testFlag( TransformationFlag flag ) const
 {
-    return d_data->flags & flag;
-}
-
-/*!
-  Set a bounding rectangle for the point mapping algorithm
-
-  A valid bounding rectangle can be used for optimizations
-
-  \param rect Bounding rectangle
-  \sa boundingRect()
- */
-void QwtPointMapper::setBoundingRect( const QRectF &rect )
-{
-    d_data->boundingRect = rect;
-}
-
-/*!
-  \return Bounding rectangle
-  \sa setBoundingRect()
+    return m_data->flags & flag;
+}
+
+/*!
+   Set a bounding rectangle for the point mapping algorithm
+
+   A valid bounding rectangle can be used for optimizations
+
+   \param rect Bounding rectangle
+   \sa boundingRect()
+ */
+void QwtPointMapper::setBoundingRect( const QRectF& rect )
+{
+    m_data->boundingRect = rect;
+}
+
+/*!
+   \return Bounding rectangle
+   \sa setBoundingRect()
  */
 QRectF QwtPointMapper::boundingRect() const
 {
-    return d_data->boundingRect;
-}
-
-/*!
-  \brief Translate a series of points into a QPolygonF
-
-  When the WeedOutPoints flag is enabled consecutive points,
-  that are mapped to the same position will be one point.
-
-  When RoundPoints is set all points are rounded to integers
-  but returned as PolygonF - what only makes sense
-  when the further processing of the values need a QPolygonF.
-
-  \param xMap x map
-  \param yMap y map
-  \param series Series of points to be mapped
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-
-  \return Translated polygon
-*/
+    return m_data->boundingRect;
+}
+
+/*!
+   \brief Translate a series of points into a QPolygonF
+
+   When the WeedOutPoints flag is enabled consecutive points,
+   that are mapped to the same position will be one point.
+
+   When RoundPoints is set all points are rounded to integers
+   but returned as PolygonF - what only makes sense
+   when the further processing of the values need a QPolygonF.
+
+   When RoundPoints & WeedOutIntermediatePoints is enabled an even more
+   aggressive weeding algorithm is enabled.
+
+   \param xMap x map
+   \param yMap y map
+   \param series Series of points to be mapped
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+
+   \return Translated polygon
+ */
 QPolygonF QwtPointMapper::toPolygonF(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to ) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to ) const
 {
     QPolygonF polyline;
 
-    if ( d_data->flags & WeedOutPoints )
-    {
-        if ( d_data->flags & RoundPoints )
+    if ( m_data->flags & RoundPoints )
+    {
+        if ( m_data->flags & WeedOutIntermediatePoints )
+        {
+            polyline = qwtMapPointsQuad< QPolygonF, QPointF >(
+                xMap, yMap, series, from, to );
+        }
+        else if ( m_data->flags & WeedOutPoints )
         {
             polyline = qwtToPolylineFilteredF(
@@ -419,15 +665,15 @@
         else
         {
+            polyline = qwtToPointsF( qwtInvalidRect,
+                xMap, yMap, series, from, to, QwtRoundF() );
+        }
+    }
+    else
+    {
+        if ( m_data->flags & WeedOutPoints )
+        {
             polyline = qwtToPolylineFilteredF(
                 xMap, yMap, series, from, to, QwtNoRoundF() );
         }
-    }
-    else
-    {
-        if ( d_data->flags & RoundPoints )
-        {
-            polyline = qwtToPointsF( qwtInvalidRect,
-                xMap, yMap, series, from, to, QwtRoundF() );
-        }
         else
         {
@@ -441,24 +687,30 @@
 
 /*!
-  \brief Translate a series of points into a QPolygon
-
-  When the WeedOutPoints flag is enabled consecutive points,
-  that are mapped to the same position will be one point.
-
-  \param xMap x map
-  \param yMap y map
-  \param series Series of points to be mapped
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-
-  \return Translated polygon
-*/
+   \brief Translate a series of points into a QPolygon
+
+   When the WeedOutPoints flag is enabled consecutive points,
+   that are mapped to the same position will be one point.
+
+   \param xMap x map
+   \param yMap y map
+   \param series Series of points to be mapped
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+
+   \return Translated polygon
+ */
 QPolygon QwtPointMapper::toPolygon(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to ) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to ) const
 {
     QPolygon polyline;
 
-    if ( d_data->flags & WeedOutPoints )
+    if ( m_data->flags & WeedOutIntermediatePoints )
+    {
+        // TODO WeedOutIntermediatePointsY ...
+        polyline = qwtMapPointsQuad< QPolygon, QPoint >(
+            xMap, yMap, series, from, to );
+    }
+    else if ( m_data->flags & WeedOutPoints )
     {
         polyline = qwtToPolylineFilteredI(
@@ -475,47 +727,47 @@
 
 /*!
-  \brief Translate a series into a QPolygonF
-
-  - WeedOutPoints & RoundPoints & boundingRect().isValid()
+   \brief Translate a series into a QPolygonF
+
+   - WeedOutPoints & RoundPoints & boundingRect().isValid()
     All points that are mapped to the same position
     will be one point. Points outside of the bounding
     rectangle are ignored.
 
-  - WeedOutPoints & RoundPoints & !boundingRect().isValid()
+   - WeedOutPoints & RoundPoints & !boundingRect().isValid()
     All consecutive points that are mapped to the same position
     will one point
 
-  - WeedOutPoints & !RoundPoints
+   - WeedOutPoints & !RoundPoints
     All consecutive points that are mapped to the same position
     will one point
 
-  - !WeedOutPoints & boundingRect().isValid()
+   - !WeedOutPoints & boundingRect().isValid()
     Points outside of the bounding rectangle are ignored.
 
-  When RoundPoints is set all points are rounded to integers
-  but returned as PolygonF - what only makes sense
-  when the further processing of the values need a QPolygonF.
-
-  \param xMap x map
-  \param yMap y map
-  \param series Series of points to be mapped
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-
-  \return Translated polygon
-*/
+   When RoundPoints is set all points are rounded to integers
+   but returned as PolygonF - what only makes sense
+   when the further processing of the values need a QPolygonF.
+
+   \param xMap x map
+   \param yMap y map
+   \param series Series of points to be mapped
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+
+   \return Translated polygon
+ */
 QPolygonF QwtPointMapper::toPointsF(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to ) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to ) const
 {
     QPolygonF points;
 
-    if ( d_data->flags & WeedOutPoints )
-    {
-        if ( d_data->flags & RoundPoints )
-        {
-            if ( d_data->boundingRect.isValid() )
+    if ( m_data->flags & WeedOutPoints )
+    {
+        if ( m_data->flags & RoundPoints )
+        {
+            if ( m_data->boundingRect.isValid() )
             {
-                points = qwtToPointsFilteredF( d_data->boundingRect,
+                points = qwtToPointsFilteredF( m_data->boundingRect,
                     xMap, yMap, series, from, to );
             }
@@ -541,12 +793,12 @@
     else
     {
-        if ( d_data->flags & RoundPoints )
-        {
-            points = qwtToPointsF( d_data->boundingRect,
+        if ( m_data->flags & RoundPoints )
+        {
+            points = qwtToPointsF( m_data->boundingRect,
                 xMap, yMap, series, from, to, QwtRoundF() );
         }
         else
         {
-            points = qwtToPointsF( d_data->boundingRect,
+            points = qwtToPointsF( m_data->boundingRect,
                 xMap, yMap, series, from, to, QwtNoRoundF() );
         }
@@ -557,37 +809,37 @@
 
 /*!
-  \brief Translate a series of points into a QPolygon
-
-  - WeedOutPoints & boundingRect().isValid()
+   \brief Translate a series of points into a QPolygon
+
+   - WeedOutPoints & boundingRect().isValid()
     All points that are mapped to the same position
     will be one point. Points outside of the bounding
     rectangle are ignored.
 
-  - WeedOutPoints & !boundingRect().isValid()
+   - WeedOutPoints & !boundingRect().isValid()
     All consecutive points that are mapped to the same position
     will one point
 
-  - !WeedOutPoints & boundingRect().isValid()
+   - !WeedOutPoints & boundingRect().isValid()
     Points outside of the bounding rectangle are ignored.
 
-  \param xMap x map
-  \param yMap y map
-  \param series Series of points to be mapped
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-
-  \return Translated polygon
-*/
+   \param xMap x map
+   \param yMap y map
+   \param series Series of points to be mapped
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+
+   \return Translated polygon
+ */
 QPolygon QwtPointMapper::toPoints(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to ) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to ) const
 {
     QPolygon points;
 
-    if ( d_data->flags & WeedOutPoints )
-    {
-        if ( d_data->boundingRect.isValid() )
-        {
-            points = qwtToPointsFilteredI( d_data->boundingRect,
+    if ( m_data->flags & WeedOutPoints )
+    {
+        if ( m_data->boundingRect.isValid() )
+        {
+            points = qwtToPointsFilteredI( m_data->boundingRect,
                 xMap, yMap, series, from, to );
         }
@@ -604,5 +856,5 @@
     {
         points = qwtToPointsI(
-            d_data->boundingRect, xMap, yMap, series, from, to );
+            m_data->boundingRect, xMap, yMap, series, from, to );
     }
 
@@ -612,25 +864,25 @@
 
 /*!
-  \brief Translate a series into a QImage
-
-  \param xMap x map
-  \param yMap y map
-  \param series Series of points to be mapped
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-  \param pen Pen used for drawing a point
+   \brief Translate a series into a QImage
+
+   \param xMap x map
+   \param yMap y map
+   \param series Series of points to be mapped
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+   \param pen Pen used for drawing a point
              of the image, where a point is mapped to
-  \param antialiased True, when the dots should be displayed
+   \param antialiased True, when the dots should be displayed
                      antialiased
-  \param numThreads Number of threads to be used for rendering.
+   \param numThreads Number of threads to be used for rendering.
                    If numThreads is set to 0, the system specific
                    ideal thread count is used.
 
-  \return Image displaying the series
-*/
+   \return Image displaying the series
+ */
 QImage QwtPointMapper::toImage(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to,
-    const QPen &pen, bool antialiased, uint numThreads ) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to,
+    const QPen& pen, bool antialiased, uint numThreads ) const
 {
     Q_UNUSED( antialiased )
@@ -649,5 +901,5 @@
     // where every sample is mapped to one pixel only.
 
-    const QRect rect = d_data->boundingRect.toAlignedRect();
+    const QRect rect = m_data->boundingRect.toAlignedRect();
 
     QImage image( rect.size(), QImage::Format_ARGB32 );
@@ -663,5 +915,5 @@
         const int numPoints = ( to - from + 1 ) / numThreads;
 
-        QList< QFuture<void> > futures;
+        QList< QFuture< void > > futures;
         for ( uint i = 0; i < numThreads; i++ )
         {
Index: /trunk/BNC/qwt/qwt_point_mapper.h
===================================================================
--- /trunk/BNC/qwt/qwt_point_mapper.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_point_mapper.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,25 +12,28 @@
 
 #include "qwt_global.h"
-#include "qwt_series_data.h"
-#include <qimage.h>
 
 class QwtScaleMap;
+template< typename T > class QwtSeriesData;
 class QPolygonF;
+class QPointF;
+class QRectF;
 class QPolygon;
+class QPen;
+class QImage;
 
 /*!
-  \brief A helper class for translating a series of points
+   \brief A helper class for translating a series of points
 
-  QwtPointMapper is a collection of methods and optimizations
-  for translating a series of points into paint device coordinates.
-  It is used by QwtPlotCurve but might also be useful for
-  similar plot items displaying a QwtSeriesData<QPointF>.
+   QwtPointMapper is a collection of methods and optimizations
+   for translating a series of points into paint device coordinates.
+   It is used by QwtPlotCurve but might also be useful for
+   similar plot items displaying a QwtSeriesData<QPointF>.
  */
 class QWT_EXPORT QwtPointMapper
 {
-public:
+  public:
     /*!
-      \brief Flags affecting the transformation process
-      \sa setFlag(), setFlags()
+       \brief Flags affecting the transformation process
+       \sa setFlag(), setFlags()
      */
     enum TransformationFlag
@@ -40,15 +43,31 @@
 
         /*!
-          Try to remove points, that are translated to the
-          same position.
+           Try to remove points, that are translated to the
+           same position.
          */
-        WeedOutPoints = 0x02
+        WeedOutPoints = 0x02,
+
+        /*!
+           An even more aggressive weeding algorithm, that
+           can be used in toPolygon().
+
+           A consecutive chunk of points being mapped to the
+           same x coordinate is reduced to 4 points:
+
+              - first point
+              - point with the minimum y coordinate
+              - point with the maximum y coordinate
+              - last point
+
+           In the worst case ( first and last points are never one of the extremes )
+           the number of points will be 4 times the width.
+
+           As the algorithm is fast it can be used inside of
+           a polyline render cycle.
+         */
+        WeedOutIntermediatePoints = 0x04
     };
 
-    /*!
-      \brief Flags affecting the transformation process
-      \sa setFlag(), setFlags()
-     */
-    typedef QFlags<TransformationFlag> TransformationFlags;
+    Q_DECLARE_FLAGS( TransformationFlags, TransformationFlag )
 
     QwtPointMapper();
@@ -61,26 +80,28 @@
     bool testFlag( TransformationFlag ) const;
 
-    void setBoundingRect( const QRectF & );
+    void setBoundingRect( const QRectF& );
     QRectF boundingRect() const;
 
-    QPolygonF toPolygonF( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QwtSeriesData<QPointF> *series, int from, int to ) const;
+    QPolygonF toPolygonF( const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QwtSeriesData< QPointF >* series, int from, int to ) const;
 
-    QPolygon toPolygon( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QwtSeriesData<QPointF> *series, int from, int to ) const;
+    QPolygon toPolygon( const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QwtSeriesData< QPointF >* series, int from, int to ) const;
 
-    QPolygon toPoints( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QwtSeriesData<QPointF> *series, int from, int to ) const;
+    QPolygon toPoints( const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QwtSeriesData< QPointF >* series, int from, int to ) const;
 
-    QPolygonF toPointsF( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QwtSeriesData<QPointF> *series, int from, int to ) const;
+    QPolygonF toPointsF( const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QwtSeriesData< QPointF >* series, int from, int to ) const;
 
-    QImage toImage( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-        const QwtSeriesData<QPointF> *series, int from, int to,
-        const QPen &, bool antialiased, uint numThreads ) const;
+    QImage toImage( const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+        const QwtSeriesData< QPointF >* series, int from, int to,
+        const QPen&, bool antialiased, uint numThreads ) const;
 
-private:
+  private:
+    Q_DISABLE_COPY(QwtPointMapper)
+
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_point_polar.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_point_polar.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_point_polar.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * QwtPolar Widget Library
  * Copyright (C) 2008   Uwe Rathmann
@@ -10,7 +10,29 @@
 #include "qwt_math.h"
 
-#if QT_VERSION < 0x040601
-#define qAtan2(y, x) ::atan2(y, x)
+#if QT_VERSION >= 0x050200
+
+static QwtPointPolar qwtPointToPolar( const QPointF& point )
+{
+    return QwtPointPolar( point );
+}
+
 #endif
+
+namespace
+{
+    static const struct RegisterQwtPointPolar
+    {
+        inline RegisterQwtPointPolar()
+        {
+            qRegisterMetaType< QwtPointPolar >();
+
+#if QT_VERSION >= 0x050200
+            QMetaType::registerConverter< QPointF, QwtPointPolar >( qwtPointToPolar );
+            QMetaType::registerConverter< QwtPointPolar, QPointF >( &QwtPointPolar::toPoint );
+#endif
+        }
+
+    } qwtRegisterQwtPointPolar;
+}
 
 /*!
@@ -19,9 +41,9 @@
    \param p Point in Cartesian coordinates
    \sa setPoint(), toPoint()
-*/
-QwtPointPolar::QwtPointPolar( const QPointF &p )
+ */
+QwtPointPolar::QwtPointPolar( const QPointF& p )
 {
-    d_radius = qSqrt( qwtSqr( p.x() ) + qwtSqr( p.y() ) );
-    d_azimuth = qAtan2( p.y(), p.x() );
+    m_radius = std::sqrt( qwtSqr( p.x() ) + qwtSqr( p.y() ) );
+    m_azimuth = std::atan2( p.y(), p.x() );
 }
 
@@ -29,9 +51,9 @@
    Convert and assign values from a point in Cartesian coordinates
    \param p Point in Cartesian coordinates
-*/
-void QwtPointPolar::setPoint( const QPointF &p )
+ */
+void QwtPointPolar::setPoint( const QPointF& p )
 {
-    d_radius = qSqrt( qwtSqr( p.x() ) + qwtSqr( p.y() ) );
-    d_azimuth = qAtan2( p.y(), p.x() );
+    m_radius = std::sqrt( qwtSqr( p.x() ) + qwtSqr( p.y() ) );
+    m_azimuth = std::atan2( p.y(), p.x() );
 }
 
@@ -43,12 +65,12 @@
    \note Invalid or null points will be returned as QPointF(0.0, 0.0)
    \sa isValid(), isNull()
-*/
+ */
 QPointF QwtPointPolar::toPoint() const
 {
-    if ( d_radius <= 0.0 )
+    if ( m_radius <= 0.0 )
         return QPointF( 0.0, 0.0 );
 
-    const double x = d_radius * qCos( d_azimuth );
-    const double y = d_radius * qSin( d_azimuth );
+    const double x = m_radius * std::cos( m_azimuth );
+    const double y = m_radius * std::sin( m_azimuth );
 
     return QPointF( x, y );
@@ -65,8 +87,8 @@
 
     \sa normalized()
-*/
-bool QwtPointPolar::operator==( const QwtPointPolar &other ) const
+ */
+bool QwtPointPolar::operator==( const QwtPointPolar& other ) const
 {
-    return d_radius == other.d_radius && d_azimuth == other.d_azimuth;
+    return m_radius == other.m_radius && m_azimuth == other.m_azimuth;
 }
 
@@ -80,8 +102,8 @@
     \return True if the point is not equal to other; otherwise return false.
     \sa normalized()
-*/
-bool QwtPointPolar::operator!=( const QwtPointPolar &other ) const
+ */
+bool QwtPointPolar::operator!=( const QwtPointPolar& other ) const
 {
-    return d_radius != other.d_radius || d_azimuth != other.d_azimuth;
+    return m_radius != other.m_radius || m_azimuth != other.m_azimuth;
 }
 
@@ -93,12 +115,12 @@
 
    \return Normalized point
-*/
+ */
 QwtPointPolar QwtPointPolar::normalized() const
 {
-    const double radius = qMax( d_radius, 0.0 );
+    const double radius = qwtMaxF( m_radius, 0.0 );
 
-    double azimuth = d_azimuth;
+    double azimuth = m_azimuth;
     if ( azimuth < -2.0 * M_PI || azimuth >= 2 * M_PI )
-        azimuth = ::fmod( d_azimuth, 2 * M_PI );
+        azimuth = std::fmod( m_azimuth, 2 * M_PI );
 
     if ( azimuth < 0.0 )
@@ -110,8 +132,10 @@
 #ifndef QT_NO_DEBUG_STREAM
 
-QDebug operator<<( QDebug debug, const QwtPointPolar &point )
+#include <qdebug.h>
+
+QDebug operator<<( QDebug debug, const QwtPointPolar& point )
 {
     debug.nospace() << "QwtPointPolar("
-        << point.azimuth() << "," << point.radius() << ")";
+                    << point.azimuth() << "," << point.radius() << ")";
 
     return debug.space();
Index: /trunk/BNC/qwt/qwt_point_polar.h
===================================================================
--- /trunk/BNC/qwt/qwt_point_polar.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_point_polar.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,29 +9,29 @@
 
 /*! \file */
-#ifndef _QWT_POINT_POLAR_H_
-#define _QWT_POINT_POLAR_H_ 1
+#ifndef QWT_POINT_POLAR_H
+#define QWT_POINT_POLAR_H
 
 #include "qwt_global.h"
 #include "qwt_math.h"
+
 #include <qpoint.h>
-#ifndef QT_NO_DEBUG_STREAM
-#include <qdebug.h>
-#endif
+#include <qmetatype.h>
+#include <qmath.h>
 
 /*!
-  \brief A point in polar coordinates
+   \brief A point in polar coordinates
 
-  In polar coordinates a point is determined by an angle and a distance.
-  See http://en.wikipedia.org/wiki/Polar_coordinate_system
-*/
+   In polar coordinates a point is determined by an angle and a distance.
+   See http://en.wikipedia.org/wiki/Polar_coordinate_system
+ */
 
 class QWT_EXPORT QwtPointPolar
 {
-public:
+  public:
     QwtPointPolar();
     QwtPointPolar( double azimuth, double radius );
-    QwtPointPolar( const QPointF & );
+    QwtPointPolar( const QPointF& );
 
-    void setPoint( const QPointF & );
+    void setPoint( const QPointF& );
     QPointF toPoint() const;
 
@@ -42,29 +42,34 @@
     double azimuth() const;
 
-    double &rRadius();
-    double &rAzimuth();
+    double& rRadius();
+    double& rAzimuth();
 
     void setRadius( double );
     void setAzimuth( double );
 
-    bool operator==( const QwtPointPolar & ) const;
-    bool operator!=( const QwtPointPolar & ) const;
+    bool operator==( const QwtPointPolar& ) const;
+    bool operator!=( const QwtPointPolar& ) const;
 
     QwtPointPolar normalized() const;
 
-    double _value; // Change by LM
+  private:
+    double m_azimuth;
+    double m_radius;
+};
 
-private:
-    double d_azimuth;
-    double d_radius;
-};
+Q_DECLARE_TYPEINFO( QwtPointPolar, Q_MOVABLE_TYPE );
+Q_DECLARE_METATYPE( QwtPointPolar )
+
+#ifndef QT_NO_DEBUG_STREAM
+QWT_EXPORT QDebug operator<<( QDebug, const QwtPointPolar& );
+#endif
 
 /*!
     Constructs a null point, with a radius and azimuth set to 0.0.
     \sa QPointF::isNull()
-*/
-inline QwtPointPolar::QwtPointPolar():
-    d_azimuth( 0.0 ),
-    d_radius( 0.0 )
+ */
+inline QwtPointPolar::QwtPointPolar()
+    : m_azimuth( 0.0 )
+    , m_radius( 0.0 )
 {
 }
@@ -75,8 +80,8 @@
    \param azimuth Azimuth
    \param radius Radius
-*/
-inline QwtPointPolar::QwtPointPolar( double azimuth, double radius ):
-    d_azimuth( azimuth ),
-    d_radius( radius )
+ */
+inline QwtPointPolar::QwtPointPolar( double azimuth, double radius )
+    : m_azimuth( azimuth )
+    , m_radius( radius )
 {
 }
@@ -85,5 +90,5 @@
 inline bool QwtPointPolar::isValid() const
 {
-    return d_radius >= 0.0;
+    return m_radius >= 0.0;
 }
 
@@ -91,5 +96,5 @@
 inline bool QwtPointPolar::isNull() const
 {
-    return d_radius == 0.0;
+    return m_radius == 0.0;
 }
 
@@ -97,5 +102,5 @@
 inline double QwtPointPolar::radius() const
 {
-    return d_radius;
+    return m_radius;
 }
 
@@ -103,17 +108,17 @@
 inline double QwtPointPolar::azimuth() const
 {
-    return d_azimuth;
+    return m_azimuth;
 }
 
 //! Returns the radius.
-inline double &QwtPointPolar::rRadius()
+inline double& QwtPointPolar::rRadius()
 {
-    return d_radius;
+    return m_radius;
 }
 
 //! Returns the azimuth.
-inline double &QwtPointPolar::rAzimuth()
+inline double& QwtPointPolar::rAzimuth()
 {
-    return d_azimuth;
+    return m_azimuth;
 }
 
@@ -121,27 +126,23 @@
 inline void QwtPointPolar::setRadius( double radius )
 {
-    d_radius = radius;
+    m_radius = radius;
 }
 
-//! Sets the atimuth to atimuth.
+//! Sets the azimuth to azimuth.
 inline void QwtPointPolar::setAzimuth( double azimuth )
 {
-    d_azimuth = azimuth;
+    m_azimuth = azimuth;
 }
 
-#ifndef QT_NO_DEBUG_STREAM
-QWT_EXPORT QDebug operator<<( QDebug, const QwtPointPolar & );
-#endif
-
-inline QPoint qwtPolar2Pos( const QPoint &pole,
+inline QPoint qwtPolar2Pos( const QPoint& pole,
     double radius, double angle )
 {
-    const double x = pole.x() + radius * qCos( angle );
-    const double y = pole.y() - radius * qSin( angle );
+    const double x = pole.x() + radius * std::cos( angle );
+    const double y = pole.y() - radius * std::sin( angle );
 
     return QPoint( qRound( x ), qRound( y ) );
 }
 
-inline QPoint qwtDegree2Pos( const QPoint &pole,
+inline QPoint qwtDegree2Pos( const QPoint& pole,
     double radius, double angle )
 {
@@ -149,14 +150,14 @@
 }
 
-inline QPointF qwtPolar2Pos( const QPointF &pole,
+inline QPointF qwtPolar2Pos( const QPointF& pole,
     double radius, double angle )
 {
-    const double x = pole.x() + radius * qCos( angle );
-    const double y = pole.y() - radius * qSin( angle );
+    const double x = pole.x() + radius * std::cos( angle );
+    const double y = pole.y() - radius * std::sin( angle );
 
     return QPointF( x, y);
 }
 
-inline QPointF qwtDegree2Pos( const QPointF &pole,
+inline QPointF qwtDegree2Pos( const QPointF& pole,
     double radius, double angle )
 {
@@ -164,19 +165,14 @@
 }
 
-inline QPointF qwtFastPolar2Pos( const QPointF &pole,
+inline QPointF qwtFastPolar2Pos( const QPointF& pole,
     double radius, double angle )
 {
-#if QT_VERSION < 0x040601
-    const double x = pole.x() + radius * ::cos( angle );
-    const double y = pole.y() - radius * ::sin( angle );
-#else
     const double x = pole.x() + radius * qFastCos( angle );
     const double y = pole.y() - radius * qFastSin( angle );
-#endif
 
     return QPointF( x, y);
 }
 
-inline QPointF qwtFastDegree2Pos( const QPointF &pole,
+inline QPointF qwtFastDegree2Pos( const QPointF& pole,
     double radius, double angle )
 {
@@ -184,5 +180,5 @@
 }
 
-inline QwtPointPolar qwtFastPos2Polar( const QPointF &pos )
+inline QwtPointPolar qwtFastPos2Polar( const QPointF& pos )
 {
     return QwtPointPolar( qwtFastAtan2( pos.y(), pos.x() ),
Index: /trunk/BNC/qwt/qwt_polar.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar.h	(revision 11158)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_H
+#define QWT_POLAR_H
+
+#include "qwt_polar.h"
+
+namespace QwtPolar
+{
+    //! Unit of an angle
+    enum AngleUnit
+    {
+        //! 0.0 -> 2_M_PI
+        Radians,
+
+        //! 0.0 -> 360.0
+        Degrees,
+
+        //! 0.0 - 400.0
+        Gradians,
+
+        //! 0.0 - 1.0
+        Turns
+    };
+
+    //! An enum, that identifies the type of a coordinate
+    enum Coordinate
+    {
+        //! Azimuth
+        Azimuth,
+
+        //! Radius
+        Radius
+    };
+
+    /*!
+       Indices used to identify an axis.
+       \sa Scale
+     */
+    enum Axis
+    {
+        //! Azimuth axis
+        AxisAzimuth,
+
+        //! Left axis
+        AxisLeft,
+
+        //! Right axis
+        AxisRight,
+
+        //! Top axis
+        AxisTop,
+
+        //! Bottom axis
+        AxisBottom,
+
+        //! Number of available axis
+        AxesCount
+    };
+
+    /*!
+       Indices used to identify a scale.
+       \sa Axis
+     */
+    enum Scale
+    {
+        //! Azimuth scale
+        ScaleAzimuth = Azimuth,
+
+        //! Radial scale
+        ScaleRadius = Radius,
+
+        //! Number of scales
+        ScaleCount
+    };
+}
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_canvas.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_canvas.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_canvas.cpp	(revision 11158)
@@ -0,0 +1,326 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_canvas.h"
+#include "qwt_polar_plot.h"
+#include "qwt_painter.h"
+
+#include <qpainter.h>
+#include <qevent.h>
+#include <qpixmap.h>
+#include <qstyle.h>
+#include <qstyleoption.h>
+#ifdef Q_WS_X11
+#include <qx11info_x11.h>
+#endif
+
+static inline void qwtDrawStyledBackground(
+    QWidget* widget, QPainter* painter )
+{
+    QStyleOption opt;
+    opt.initFrom( widget );
+    widget->style()->drawPrimitive( QStyle::PE_Widget, &opt, painter, widget );
+}
+
+static QWidget* qwtBackgroundWidget( QWidget* w )
+{
+    if ( w->parentWidget() == NULL )
+        return w;
+
+    if ( w->autoFillBackground() )
+    {
+        const QBrush brush = w->palette().brush( w->backgroundRole() );
+        if ( brush.color().alpha() > 0 )
+            return w;
+    }
+
+    if ( w->testAttribute( Qt::WA_StyledBackground ) )
+    {
+        QImage image( 1, 1, QImage::Format_ARGB32 );
+        image.fill( Qt::transparent );
+
+        QPainter painter( &image );
+        painter.translate( -w->rect().center() );
+        qwtDrawStyledBackground( w, &painter );
+        painter.end();
+
+        if ( qAlpha( image.pixel( 0, 0 ) ) != 0 )
+            return w;
+    }
+
+    return qwtBackgroundWidget( w->parentWidget() );
+}
+
+class QwtPolarCanvas::PrivateData
+{
+  public:
+    PrivateData()
+        : backingStore( NULL )
+    {
+    }
+
+    ~PrivateData()
+    {
+        delete backingStore;
+    }
+
+    QwtPolarCanvas::PaintAttributes paintAttributes;
+    QPixmap* backingStore;
+};
+
+//! Constructor
+QwtPolarCanvas::QwtPolarCanvas( QwtPolarPlot* plot )
+    : QFrame( plot )
+{
+    m_data = new PrivateData;
+
+#ifndef QT_NO_CURSOR
+    setCursor( Qt::CrossCursor );
+#endif
+    setFocusPolicy( Qt::WheelFocus );
+
+    setPaintAttribute( BackingStore, true );
+}
+
+//! Destructor
+QwtPolarCanvas::~QwtPolarCanvas()
+{
+    delete m_data;
+}
+
+//! \return Parent plot widget
+QwtPolarPlot* QwtPolarCanvas::plot()
+{
+    return qobject_cast< QwtPolarPlot* >( parent() );
+}
+
+//! \return Parent plot widget
+const QwtPolarPlot* QwtPolarCanvas::plot() const
+{
+    return qobject_cast< QwtPolarPlot* >( parent() );
+}
+
+/*!
+   \brief Changing the paint attributes
+
+   \param attribute Paint attribute
+   \param on On/Off
+
+   The default setting enables BackingStore
+
+   \sa testPaintAttribute(), paintCache()
+ */
+void QwtPolarCanvas::setPaintAttribute( PaintAttribute attribute, bool on )
+{
+    if ( bool( m_data->paintAttributes & attribute ) == on )
+        return;
+
+    if ( on )
+        m_data->paintAttributes |= attribute;
+    else
+        m_data->paintAttributes &= ~attribute;
+
+    switch( attribute )
+    {
+        case BackingStore:
+        {
+            if ( on )
+            {
+                if ( m_data->backingStore == NULL )
+                    m_data->backingStore = new QPixmap();
+
+                if ( isVisible() )
+                {
+                    const QRect cr = contentsRect();
+#if QT_VERSION >= 0x050000
+                    *m_data->backingStore = grab( cr );
+#else
+                    *m_data->backingStore = QPixmap::grabWidget( this, cr );
+#endif
+                }
+            }
+            else
+            {
+                delete m_data->backingStore;
+                m_data->backingStore = NULL;
+            }
+            break;
+        }
+    }
+}
+
+/*!
+   Test whether a paint attribute is enabled
+
+   \param attribute Paint attribute
+   \return true if the attribute is enabled
+   \sa setPaintAttribute()
+ */
+bool QwtPolarCanvas::testPaintAttribute( PaintAttribute attribute ) const
+{
+    return ( m_data->paintAttributes & attribute ) != 0;
+}
+
+//! \return Backing store, might be null
+const QPixmap* QwtPolarCanvas::backingStore() const
+{
+    return m_data->backingStore;
+}
+
+//! Invalidate the internal backing store
+void QwtPolarCanvas::invalidateBackingStore()
+{
+    if ( m_data->backingStore )
+        *m_data->backingStore = QPixmap();
+}
+
+/*!
+   Paint event
+   \param event Paint event
+ */
+void QwtPolarCanvas::paintEvent( QPaintEvent* event )
+{
+    QPainter painter( this );
+    painter.setClipRegion( event->region() );
+
+    if ( ( m_data->paintAttributes & BackingStore )
+        && m_data->backingStore != NULL )
+    {
+        QPixmap& bs = *m_data->backingStore;
+        if ( bs.size() != size() )
+        {
+            bs = QPixmap( size() );
+#ifdef Q_WS_X11
+            if ( bs.x11Info().screen() != x11Info().screen() )
+                bs.x11SetScreen( x11Info().screen() );
+#endif
+
+            QPainter p;
+
+            if ( testAttribute( Qt::WA_StyledBackground ) )
+            {
+                p.begin( &bs );
+                qwtDrawStyledBackground( this, &p );
+            }
+            else
+            {
+                if ( autoFillBackground() )
+                {
+                    p.begin( &bs );
+                    p.fillRect( rect(), palette().brush( backgroundRole() ) );
+                }
+                else
+                {
+                    QWidget* bgWidget = qwtBackgroundWidget( plot() );
+
+                    QwtPainter::fillPixmap( bgWidget, bs,
+                        mapTo( bgWidget, rect().topLeft() ) );
+
+                    p.begin( &bs );
+                }
+            }
+
+            plot()->drawCanvas( &p, contentsRect() );
+
+            if ( frameWidth() > 0 )
+                drawFrame( &p );
+        }
+
+        painter.drawPixmap( 0, 0, *m_data->backingStore );
+    }
+    else
+    {
+        qwtDrawStyledBackground( this, &painter );
+
+        plot()->drawCanvas( &painter, contentsRect() );
+
+        if ( frameWidth() > 0 )
+            drawFrame( &painter );
+    }
+}
+
+/*!
+   Resize event
+   \param event Resize event
+ */
+void QwtPolarCanvas::resizeEvent( QResizeEvent* event )
+{
+    QFrame::resizeEvent( event );
+
+    for ( int scaleId = 0; scaleId < QwtPolar::ScaleCount; scaleId++ )
+        plot()->updateScale( scaleId );
+}
+
+/*!
+    Translate a point from widget into plot coordinates
+
+    \param pos Point in widget coordinates of the plot canvas
+    \return Point in plot coordinates
+
+    \sa transform()
+ */
+QwtPointPolar QwtPolarCanvas::invTransform( const QPoint& pos ) const
+{
+    const QwtPolarPlot* pl = plot();
+
+    const QwtScaleMap azimuthMap = pl->scaleMap( QwtPolar::Azimuth );
+    const QwtScaleMap radialMap = pl->scaleMap( QwtPolar::Radius );
+
+    const QPointF center = pl->plotRect().center();
+
+    double dx = pos.x() - center.x();
+    double dy = -( pos.y() - center.y() );
+
+    const QwtPointPolar polarPos = QwtPointPolar( QPoint( dx, dy ) ).normalized();
+
+    double azimuth = azimuthMap.invTransform( polarPos.azimuth() );
+
+    // normalize the azimuth
+    double min = azimuthMap.s1();
+    double max = azimuthMap.s2();
+    if ( max < min )
+        qSwap( min, max );
+
+    if ( azimuth < min )
+    {
+        azimuth += max - min;
+    }
+    else if ( azimuth > max )
+    {
+        azimuth -= max - min;
+    }
+
+    const double radius = radialMap.invTransform( polarPos.radius() );
+
+    return QwtPointPolar( azimuth, radius );
+}
+
+/*!
+    Translate a point from plot into widget coordinates
+
+    \param polarPos Point in plot coordinates
+    \return Point in widget coordinates
+    \sa transform()
+ */
+QPoint QwtPolarCanvas::transform( const QwtPointPolar& polarPos ) const
+{
+    const QwtPolarPlot* pl = plot();
+
+    const QwtScaleMap azimuthMap = pl->scaleMap( QwtPolar::Azimuth );
+    const QwtScaleMap radialMap = pl->scaleMap( QwtPolar::Radius );
+
+    const double radius = radialMap.transform( polarPos.radius() );
+    const double azimuth = azimuthMap.transform( polarPos.azimuth() );
+
+    const QPointF pos = qwtPolar2Pos(
+        pl->plotRect().center(), radius, azimuth );
+
+    return pos.toPoint();
+}
+
+#include "moc_qwt_polar_canvas.cpp"
Index: /trunk/BNC/qwt/qwt_polar_canvas.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_canvas.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_canvas.h	(revision 11158)
@@ -0,0 +1,78 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_CANVAS_H
+#define QWT_POLAR_CANVAS_H
+
+#include "qwt_global.h"
+#include "qwt_point_polar.h"
+#include <qframe.h>
+
+class QPainter;
+class QwtPolarPlot;
+
+/*!
+   \brief Canvas of a QwtPolarPlot.
+
+   The canvas is the widget, where all polar items are painted to.
+
+   \note In opposite to QwtPlot all axes are painted on the canvas.
+   \sa QwtPolarPlot
+ */
+class QWT_EXPORT QwtPolarCanvas : public QFrame
+{
+    Q_OBJECT
+
+  public:
+    /*!
+       \brief Paint attributes
+
+       The default setting enables BackingStore
+
+       \sa setPaintAttribute(), testPaintAttribute(), backingStore()
+     */
+
+    enum PaintAttribute
+    {
+        /*!
+           Paint double buffered and reuse the content of the pixmap buffer
+           for some spontaneous repaints that happen when a plot gets unhidden,
+           deiconified or changes the focus.
+         */
+        BackingStore = 0x01
+    };
+
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
+
+    explicit QwtPolarCanvas( QwtPolarPlot* );
+    virtual ~QwtPolarCanvas();
+
+    QwtPolarPlot* plot();
+    const QwtPolarPlot* plot() const;
+
+    void setPaintAttribute( PaintAttribute, bool on = true );
+    bool testPaintAttribute( PaintAttribute ) const;
+
+    const QPixmap* backingStore() const;
+    void invalidateBackingStore();
+
+    QwtPointPolar invTransform( const QPoint& ) const;
+    QPoint transform( const QwtPointPolar& ) const;
+
+  protected:
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
+    virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarCanvas::PaintAttributes )
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_curve.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_curve.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_curve.cpp	(revision 11158)
@@ -0,0 +1,596 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_curve.h"
+#include "qwt_polar.h"
+#include "qwt_painter.h"
+#include "qwt_scale_map.h"
+#include "qwt_math.h"
+#include "qwt_symbol.h"
+#include "qwt_legend.h"
+#include "qwt_curve_fitter.h"
+#include "qwt_clipper.h"
+
+#include <qpainter.h>
+
+static inline bool qwtInsidePole( const QwtScaleMap& map, double radius )
+{
+    return map.isInverting() ? ( radius > map.s1() ) : ( radius < map.s1() );
+}
+
+static int qwtVerifyRange( int size, int& i1, int& i2 )
+{
+    if ( size < 1 )
+        return 0;
+
+    i1 = qBound( 0, i1, size - 1 );
+    i2 = qBound( 0, i2, size - 1 );
+
+    if ( i1 > i2 )
+        qSwap( i1, i2 );
+
+    return ( i2 - i1 + 1 );
+}
+
+class QwtPolarCurve::PrivateData
+{
+  public:
+    PrivateData()
+        : style( QwtPolarCurve::Lines )
+        , curveFitter( NULL )
+    {
+        symbol = new QwtSymbol();
+        pen = QPen( Qt::black );
+    }
+
+    ~PrivateData()
+    {
+        delete symbol;
+        delete curveFitter;
+    }
+
+    QwtPolarCurve::CurveStyle style;
+    const QwtSymbol* symbol;
+    QPen pen;
+    QwtCurveFitter* curveFitter;
+
+    QwtPolarCurve::LegendAttributes legendAttributes;
+};
+
+//! Constructor
+QwtPolarCurve::QwtPolarCurve()
+    : QwtPolarItem( QwtText() )
+{
+    init();
+}
+
+/*!
+   Constructor
+   \param title title of the curve
+ */
+QwtPolarCurve::QwtPolarCurve( const QwtText& title )
+    : QwtPolarItem( title )
+{
+    init();
+}
+
+/*!
+   Constructor
+   \param title title of the curve
+ */
+QwtPolarCurve::QwtPolarCurve( const QString& title )
+    : QwtPolarItem( QwtText( title ) )
+{
+    init();
+}
+
+//! Destructor
+QwtPolarCurve::~QwtPolarCurve()
+{
+    delete m_series;
+    delete m_data;
+}
+
+//! Initialize data members
+void QwtPolarCurve::init()
+{
+    m_data = new PrivateData;
+    m_series = NULL;
+
+    setItemAttribute( QwtPolarItem::AutoScale );
+    setItemAttribute( QwtPolarItem::Legend );
+    setZ( 20.0 );
+
+    setRenderHint( RenderAntialiased, true );
+}
+
+//! \return QwtPolarCurve::Rtti_PolarCurve
+int QwtPolarCurve::rtti() const
+{
+    return QwtPolarItem::Rtti_PolarCurve;
+}
+
+/*!
+   Specify an attribute how to draw the legend identifier
+
+   \param attribute Attribute
+   \param on On/Off
+   /sa LegendAttribute, testLegendAttribute()
+ */
+void QwtPolarCurve::setLegendAttribute( LegendAttribute attribute, bool on )
+{
+    if ( on )
+        m_data->legendAttributes |= attribute;
+    else
+        m_data->legendAttributes &= ~attribute;
+}
+
+/*!
+    \brief Test if a legend attribute is enabled
+
+    \param attribute Legend attribute
+
+    \return True if attribute is enabled
+    \sa LegendAttribute, setLegendAttribute()
+ */
+bool QwtPolarCurve::testLegendAttribute( LegendAttribute attribute ) const
+{
+    return ( m_data->legendAttributes & attribute );
+}
+
+/*!
+   Set the curve's drawing style
+
+   \param style Curve style
+   \sa CurveStyle, style()
+ */
+void QwtPolarCurve::setStyle( CurveStyle style )
+{
+    if ( style != m_data->style )
+    {
+        m_data->style = style;
+        itemChanged();
+    }
+}
+
+/*!
+    \return Current style
+    \sa CurveStyle, setStyle()
+ */
+QwtPolarCurve::CurveStyle QwtPolarCurve::style() const
+{
+    return m_data->style;
+}
+
+/*!
+   \brief Assign a symbol
+   \param symbol Symbol
+   \sa symbol()
+ */
+void QwtPolarCurve::setSymbol( QwtSymbol* symbol )
+{
+    if ( symbol != m_data->symbol )
+    {
+        delete m_data->symbol;
+        m_data->symbol = symbol;
+        itemChanged();
+    }
+}
+
+/*!
+    \return The current symbol
+    \sa setSymbol()
+ */
+const QwtSymbol* QwtPolarCurve::symbol() const
+{
+    return m_data->symbol;
+}
+
+/*!
+   \brief Assign a pen
+   \param pen New pen
+   \sa pen()
+ */
+void QwtPolarCurve::setPen( const QPen& pen )
+{
+    if ( pen != m_data->pen )
+    {
+        m_data->pen = pen;
+        itemChanged();
+    }
+}
+
+/*!
+    \return Pen used to draw the lines
+    \sa setPen()
+ */
+const QPen& QwtPolarCurve::pen() const
+{
+    return m_data->pen;
+}
+
+/*!
+   Initialize data with a pointer to QwtSeriesData<QwtPointPolar>.
+
+   The x-values of the data object represent the azimuth,
+   the y-value represents the radius.
+
+   \param data Data
+ */
+void QwtPolarCurve::setData( QwtSeriesData< QwtPointPolar >* data )
+{
+    if ( m_series != data )
+    {
+        delete m_series;
+        m_series = data;
+        itemChanged();
+    }
+}
+
+/*!
+   \brief Insert a curve fitter
+
+   \param curveFitter Curve fitter
+
+   A curve fitter interpolates the curve points. F.e QwtPolarFitter
+   adds equidistant points so that the connection gets rounded instead
+   of having straight lines. If curveFitter is NULL fitting is disabled.
+
+   \sa curveFitter()
+ */
+void QwtPolarCurve::setCurveFitter( QwtCurveFitter* curveFitter )
+{
+    if ( curveFitter != m_data->curveFitter )
+    {
+        delete m_data->curveFitter;
+        m_data->curveFitter = curveFitter;
+
+        itemChanged();
+    }
+}
+
+/*!
+   \return The curve fitter
+   \sa setCurveFitter()
+ */
+QwtCurveFitter* QwtPolarCurve::curveFitter() const
+{
+    return m_data->curveFitter;
+}
+
+/*!
+   Draw the curve
+
+   \param painter Painter
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param radius Radius of the complete plot area in painter coordinates
+   \param canvasRect Contents rect of the canvas in painter coordinates
+ */
+void QwtPolarCurve::draw( QPainter* painter,
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, double radius,
+    const QRectF& canvasRect ) const
+{
+    Q_UNUSED( radius );
+    Q_UNUSED( canvasRect );
+
+    draw( painter, azimuthMap, radialMap, pole, 0, -1 );
+}
+
+/*!
+   \brief Draw an interval of the curve
+   \param painter Painter
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted. If to < 0 the
+         curve will be painted to its last point.
+
+   \sa drawCurve(), drawSymbols(),
+ */
+void QwtPolarCurve::draw( QPainter* painter,
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, int from, int to ) const
+{
+    if ( !painter || dataSize() <= 0 )
+        return;
+
+    if ( to < 0 )
+        to = dataSize() - 1;
+
+    if ( qwtVerifyRange( dataSize(), from, to ) > 0 )
+    {
+        painter->save();
+        painter->setPen( m_data->pen );
+
+        drawCurve( painter, m_data->style,
+            azimuthMap, radialMap, pole, from, to );
+
+        painter->restore();
+
+        if ( m_data->symbol->style() != QwtSymbol::NoSymbol )
+        {
+            painter->save();
+            drawSymbols( painter, *m_data->symbol,
+                azimuthMap, radialMap, pole, from, to );
+            painter->restore();
+        }
+    }
+}
+
+/*!
+   Draw the line part (without symbols) of a curve interval.
+
+   \param painter Painter
+   \param style Curve style, see QwtPolarCurve::CurveStyle
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted.
+   \sa draw(), drawLines()
+ */
+void QwtPolarCurve::drawCurve( QPainter* painter, int style,
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, int from, int to ) const
+{
+    switch ( style )
+    {
+        case Lines:
+            drawLines( painter, azimuthMap, radialMap, pole, from, to );
+            break;
+        case NoCurve:
+        default:
+            break;
+    }
+}
+
+/*!
+   Draw lines
+
+   \param painter Painter
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted.
+   \sa draw(), drawLines(), setCurveFitter()
+ */
+void QwtPolarCurve::drawLines( QPainter* painter,
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, int from, int to ) const
+{
+    int size = to - from + 1;
+    if ( size <= 0 )
+        return;
+
+    QPolygonF polyline;
+
+    if ( m_data->curveFitter )
+    {
+        QPolygonF points( size );
+        for ( int j = from; j <= to; j++ )
+        {
+            const QwtPointPolar point = sample( j );
+            points[j - from] = QPointF( point.azimuth(), point.radius() );
+        }
+
+        points = m_data->curveFitter->fitCurve( points );
+
+        polyline.resize( points.size() );
+
+        QPointF* polylineData = polyline.data();
+        QPointF* pointsData = points.data();
+
+        for ( int i = 0; i < points.size(); i++ )
+        {
+            const QwtPointPolar point( pointsData[i].x(), pointsData[i].y() );
+
+            double r = radialMap.transform( point.radius() );
+            const double a = azimuthMap.transform( point.azimuth() );
+
+            polylineData[i] = qwtPolar2Pos( pole, r, a );
+        }
+    }
+    else
+    {
+        polyline.resize( size );
+        QPointF* polylineData = polyline.data();
+
+        for ( int i = from; i <= to; i++ )
+        {
+            QwtPointPolar point = sample( i );
+            if ( !qwtInsidePole( radialMap, point.radius() ) )
+            {
+                double r = radialMap.transform( point.radius() );
+                const double a = azimuthMap.transform( point.azimuth() );
+                polylineData[i - from] = qwtPolar2Pos( pole, r, a );
+            }
+            else
+            {
+                polylineData[i - from] = pole;
+            }
+        }
+    }
+
+    QRectF clipRect;
+    if ( painter->hasClipping() )
+    {
+        clipRect = painter->clipRegion().boundingRect();
+    }
+    else
+    {
+        clipRect = painter->window();
+        if ( !clipRect.isEmpty() )
+            clipRect = painter->transform().inverted().mapRect( clipRect );
+    }
+
+    if ( !clipRect.isEmpty() )
+    {
+        double off = qCeil( qMax( qreal( 1.0 ), painter->pen().widthF() ) );
+        clipRect = clipRect.toRect().adjusted( -off, -off, off, off );
+        QwtClipper::clipPolygonF( clipRect, polyline );
+    }
+
+    QwtPainter::drawPolyline( painter, polyline );
+}
+
+/*!
+   Draw symbols
+
+   \param painter Painter
+   \param symbol Curve symbol
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted.
+
+   \sa setSymbol(), draw(), drawCurve()
+ */
+void QwtPolarCurve::drawSymbols( QPainter* painter, const QwtSymbol& symbol,
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, int from, int to ) const
+{
+    painter->setBrush( symbol.brush() );
+    painter->setPen( symbol.pen() );
+
+    const int chunkSize = 500;
+
+    for ( int i = from; i <= to; i += chunkSize )
+    {
+        const int n = qMin( chunkSize, to - i + 1 );
+
+        QPolygonF points;
+        for ( int j = 0; j < n; j++ )
+        {
+            const QwtPointPolar point = sample( i + j );
+
+            if ( !qwtInsidePole( radialMap, point.radius() ) )
+            {
+                const double r = radialMap.transform( point.radius() );
+                const double a = azimuthMap.transform( point.azimuth() );
+
+                points += qwtPolar2Pos( pole, r, a );
+            }
+            else
+            {
+                points += pole;
+            }
+        }
+
+        if ( points.size() > 0 )
+            symbol.drawSymbols( painter, points );
+    }
+}
+
+/*!
+   \return Number of points
+   \sa setData()
+ */
+size_t QwtPolarCurve::dataSize() const
+{
+    return m_series->size();
+}
+
+/*!
+   \return Icon representing the curve on the legend
+
+   \param index Index of the legend entry
+                ( ignored as there is only one )
+   \param size Icon size
+
+   \sa QwtPolarItem::setLegendIconSize(), QwtPolarItem::legendData()
+ */
+QwtGraphic QwtPolarCurve::legendIcon( int index,
+    const QSizeF& size ) const
+{
+    Q_UNUSED( index );
+
+    if ( size.isEmpty() )
+        return QwtGraphic();
+
+    QwtGraphic graphic;
+    graphic.setDefaultSize( size );
+    graphic.setRenderHint( QwtGraphic::RenderPensUnscaled, true );
+
+    QPainter painter( &graphic );
+    painter.setRenderHint( QPainter::Antialiasing,
+        testRenderHint( QwtPolarItem::RenderAntialiased ) );
+
+    if ( m_data->legendAttributes == 0 )
+    {
+        QBrush brush;
+
+        if ( style() != QwtPolarCurve::NoCurve )
+        {
+            brush = QBrush( pen().color() );
+        }
+        else if ( m_data->symbol &&
+            ( m_data->symbol->style() != QwtSymbol::NoSymbol ) )
+        {
+            brush = QBrush( m_data->symbol->pen().color() );
+        }
+
+        if ( brush.style() != Qt::NoBrush )
+        {
+            QRectF r( 0, 0, size.width(), size.height() );
+            painter.fillRect( r, brush );
+        }
+    }
+
+    if ( m_data->legendAttributes & QwtPolarCurve::LegendShowLine )
+    {
+        if ( pen() != Qt::NoPen )
+        {
+            QPen pn = pen();
+            pn.setCapStyle( Qt::FlatCap );
+
+            painter.setPen( pn );
+
+            const double y = 0.5 * size.height();
+            QwtPainter::drawLine( &painter, 0.0, y, size.width(), y );
+        }
+    }
+
+    if ( m_data->legendAttributes & QwtPolarCurve::LegendShowSymbol )
+    {
+        if ( m_data->symbol )
+        {
+            QRectF r( 0, 0, size.width(), size.height() );
+            m_data->symbol->drawSymbol( &painter, r );
+        }
+    }
+
+    return graphic;
+}
+
+/*!
+   Interval, that is necessary to display the item
+   This interval can be useful for operations like clipping or autoscaling
+
+   \param scaleId Scale index
+   \return bounding interval
+
+   \sa QwtData::boundingRect()
+ */
+QwtInterval QwtPolarCurve::boundingInterval( int scaleId ) const
+{
+    const QRectF boundingRect = m_series->boundingRect();
+
+    if ( scaleId == QwtPolar::ScaleAzimuth )
+        return QwtInterval( boundingRect.left(), boundingRect.right() );
+
+    if ( scaleId == QwtPolar::ScaleRadius )
+        return QwtInterval( boundingRect.top(), boundingRect.bottom() );
+
+    return QwtInterval();
+}
Index: /trunk/BNC/qwt/qwt_polar_curve.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_curve.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_curve.h	(revision 11158)
@@ -0,0 +1,160 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_CURVE_H
+#define QWT_POLAR_CURVE_H
+
+#include "qwt_global.h"
+#include "qwt_polar_item.h"
+#include "qwt_point_polar.h"
+#include "qwt_series_data.h"
+
+class QPainter;
+class QwtSymbol;
+class QwtCurveFitter;
+
+/*!
+   \brief An item, that represents a series of points
+
+   A curve is the representation of a series of points in polar coordinates.
+   The points are connected to the curve using the abstract QwtData interface.
+
+   \sa QwtPolarPlot, QwtSymbol, QwtScaleMap
+ */
+
+class QWT_EXPORT QwtPolarCurve : public QwtPolarItem
+{
+  public:
+    /*!
+        Curve styles.
+        \sa setStyle(), style()
+     */
+    enum CurveStyle
+    {
+        //! Don't draw a curve. Note: This doesn't affect the symbols.
+        NoCurve,
+
+        /*!
+           Connect the points with straight lines. The lines might
+           be interpolated depending on the 'Fitted' attribute. Curve
+           fitting can be configured using setCurveFitter().
+         */
+        Lines,
+
+        //! Values > 100 are reserved for user specific curve styles
+        UserCurve = 100
+    };
+
+    /*!
+        \brief Attributes how to represent the curve on the legend
+
+        If none of the flags is activated QwtPlotCurve tries to find
+        a color representing the curve and paints a rectangle with it.
+        In the default setting all attributes are off.
+
+        \sa setLegendAttribute(), testLegendAttribute()
+     */
+
+    enum LegendAttribute
+    {
+        /*!
+           If the curveStyle() is not NoCurve a line is painted with the
+           curvePen().
+         */
+        LegendShowLine = 0x01,
+
+        //! If the curve has a valid symbol it is painted.
+        LegendShowSymbol = 0x02
+    };
+
+    Q_DECLARE_FLAGS( LegendAttributes, LegendAttribute )
+
+
+    explicit QwtPolarCurve();
+    explicit QwtPolarCurve( const QwtText& title );
+    explicit QwtPolarCurve( const QString& title );
+
+    virtual ~QwtPolarCurve();
+
+    virtual int rtti() const QWT_OVERRIDE;
+
+    void setLegendAttribute( LegendAttribute, bool on = true );
+    bool testLegendAttribute( LegendAttribute ) const;
+
+    void setData( QwtSeriesData< QwtPointPolar >* data );
+    const QwtSeriesData< QwtPointPolar >* data() const;
+
+    size_t dataSize() const;
+    QwtPointPolar sample( int i ) const;
+
+    void setPen( const QPen& );
+    const QPen& pen() const;
+
+    void setStyle( CurveStyle style );
+    CurveStyle style() const;
+
+    void setSymbol( QwtSymbol* );
+    const QwtSymbol* symbol() const;
+
+    void setCurveFitter( QwtCurveFitter* );
+    QwtCurveFitter* curveFitter() const;
+
+    virtual void draw( QPainter* p,
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, double radius,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
+
+    virtual void draw( QPainter* p,
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, int from, int to ) const;
+
+    virtual QwtInterval boundingInterval( int scaleId ) const QWT_OVERRIDE;
+
+    virtual QwtGraphic legendIcon( int index, const QSizeF& ) const QWT_OVERRIDE;
+
+  protected:
+
+    void init();
+
+    virtual void drawCurve( QPainter*, int style,
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, int from, int to ) const;
+
+    virtual void drawSymbols( QPainter*, const QwtSymbol&,
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, int from, int to ) const;
+
+    void drawLines( QPainter*,
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, int from, int to ) const;
+
+  private:
+    QwtSeriesData< QwtPointPolar >* m_series;
+
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+//! \return the the curve data
+inline const QwtSeriesData< QwtPointPolar >* QwtPolarCurve::data() const
+{
+    return m_series;
+}
+
+/*!
+    \param i index
+    \return point at position i
+ */
+inline QwtPointPolar QwtPolarCurve::sample( int i ) const
+{
+    return m_series->sample( i );
+}
+
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarCurve::LegendAttributes )
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_fitter.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_fitter.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_fitter.cpp	(revision 11158)
@@ -0,0 +1,115 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_fitter.h"
+#include <qpolygon.h>
+#include <qpainterpath.h>
+
+class QwtPolarFitter::PrivateData
+{
+  public:
+    PrivateData()
+        : stepCount( 5 )
+    {
+    }
+
+    int stepCount;
+};
+
+/*!
+   Constructor
+
+   \param stepCount Number of points, that will be inserted between 2 points
+   \sa setStepCount()
+ */
+QwtPolarFitter::QwtPolarFitter( int stepCount )
+    : QwtCurveFitter( QwtPolarFitter::Polygon )
+{
+    m_data = new PrivateData;
+    m_data->stepCount = stepCount;
+}
+
+//! Destructor
+QwtPolarFitter::~QwtPolarFitter()
+{
+    delete m_data;
+}
+
+/*!
+   Assign the number of points, that will be inserted between 2 points
+   The default value is 5.
+
+   \param stepCount Number of steps
+
+   \sa stepCount()
+ */
+void QwtPolarFitter::setStepCount( int stepCount )
+{
+    m_data->stepCount = qMax( stepCount, 0 );
+}
+
+/*!
+   \return Number of points, that will be inserted between 2 points
+   \sa setStepCount()
+ */
+int QwtPolarFitter::stepCount() const
+{
+    return m_data->stepCount;
+}
+
+/*!
+   Insert stepCount() number of additional points between 2 elements
+   of points.
+
+   \param points Array of points
+   \return Array of points including the additional points
+ */
+QPolygonF QwtPolarFitter::fitCurve( const QPolygonF& points ) const
+{
+    if ( m_data->stepCount <= 0 || points.size() <= 1 )
+        return points;
+
+    QPolygonF fittedPoints;
+
+    int numPoints = points.size() + ( points.size() - 1 ) * m_data->stepCount;
+
+    fittedPoints.resize( numPoints );
+
+    int index = 0;
+    fittedPoints[index++] = points[0];
+    for ( int i = 1; i < points.size(); i++ )
+    {
+        const QPointF& p1 = points[i - 1];
+        const QPointF& p2 = points[i];
+
+        const double dx = ( p2.x() - p1.x() ) / m_data->stepCount;
+        const double dy = ( p2.y() - p1.y() ) / m_data->stepCount;
+        for ( int j = 1; j <= m_data->stepCount; j++ )
+        {
+            const double x = p1.x() + j * dx;
+            const double y = p1.y() + j * dy;
+
+            fittedPoints[index++] = QPointF( x, y );
+        }
+    }
+    fittedPoints.resize( index );
+
+    return fittedPoints;
+}
+
+/*!
+   \param points Series of data points
+   \return Curve path
+   \sa fitCurve()
+ */
+QPainterPath QwtPolarFitter::fitCurvePath( const QPolygonF& points ) const
+{
+    QPainterPath path;
+    path.addPolygon( fitCurve( points ) );
+    return path;
+}
Index: /trunk/BNC/qwt/qwt_polar_fitter.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_fitter.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_fitter.h	(revision 11158)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_FITTER_H
+#define QWT_POLAR_FITTER_H
+
+#include "qwt_global.h"
+#include "qwt_curve_fitter.h"
+
+/*!
+   \brief A simple curve fitter for polar points
+
+   QwtPolarFitter adds equidistant points between 2 curve points,
+   so that the connection gets rounded according to the nature of
+   a polar plot.
+
+   \sa QwtPolarCurve::setCurveFitter()
+ */
+class QWT_EXPORT QwtPolarFitter : public QwtCurveFitter
+{
+  public:
+    QwtPolarFitter( int stepCount = 5 );
+    virtual ~QwtPolarFitter();
+
+    void setStepCount( int size );
+    int stepCount() const;
+
+    virtual QPolygonF fitCurve( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QPainterPath fitCurvePath( const QPolygonF& ) const QWT_OVERRIDE;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_grid.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_grid.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_grid.cpp	(revision 11158)
@@ -0,0 +1,1148 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_grid.h"
+#include "qwt_painter.h"
+#include "qwt_text.h"
+#include "qwt_clipper.h"
+#include "qwt_scale_map.h"
+#include "qwt_scale_engine.h"
+#include "qwt_scale_div.h"
+#include "qwt_scale_draw.h"
+#include "qwt_round_scale_draw.h"
+
+#include <qpainter.h>
+#include <qpen.h>
+#include <float.h>
+
+static inline bool isClose( double value1, double value2 )
+{
+    return qAbs( value1 - value2 ) < DBL_EPSILON;
+}
+
+namespace
+{
+    class AxisData
+    {
+      public:
+        AxisData()
+            : isVisible( false )
+            , scaleDraw( NULL )
+        {
+        }
+
+        ~AxisData()
+        {
+            delete scaleDraw;
+        }
+
+        bool isVisible;
+        mutable QwtAbstractScaleDraw* scaleDraw;
+        QPen pen;
+        QFont font;
+    };
+
+    class GridData
+    {
+      public:
+        GridData()
+            : isVisible( true )
+            , isMinorVisible( false )
+        {
+        }
+
+        bool isVisible;
+        bool isMinorVisible;
+        QwtScaleDiv scaleDiv;
+
+        QPen majorPen;
+        QPen minorPen;
+    };
+}
+
+class QwtPolarGrid::PrivateData
+{
+  public:
+    GridData gridData[QwtPolar::ScaleCount];
+    AxisData axisData[QwtPolar::AxesCount];
+    QwtPolarGrid::DisplayFlags displayFlags;
+    QwtPolarGrid::GridAttributes attributes;
+};
+
+/*!
+   \brief Constructor
+
+   Enables major and disables minor grid lines.
+   The azimuth and right radial axis are visible. all other axes
+   are hidden. Autoscaling is enabled.
+ */
+QwtPolarGrid::QwtPolarGrid()
+    : QwtPolarItem( QwtText( "Grid" ) )
+{
+    m_data = new PrivateData;
+
+    for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ )
+    {
+        AxisData& axis = m_data->axisData[axisId];
+        switch( axisId )
+        {
+            case QwtPolar::AxisAzimuth:
+            {
+                axis.scaleDraw = new QwtRoundScaleDraw;
+                axis.scaleDraw->setTickLength( QwtScaleDiv::MinorTick, 2 );
+                axis.scaleDraw->setTickLength( QwtScaleDiv::MediumTick, 2 );
+                axis.scaleDraw->setTickLength( QwtScaleDiv::MajorTick, 4 );
+                axis.isVisible = true;
+                break;
+            }
+            case QwtPolar::AxisLeft:
+            {
+                QwtScaleDraw* scaleDraw = new QwtScaleDraw;
+                scaleDraw->setAlignment( QwtScaleDraw::BottomScale );
+
+                axis.scaleDraw = scaleDraw;
+                axis.isVisible = false;
+                break;
+            }
+            case QwtPolar::AxisRight:
+            {
+                QwtScaleDraw* scaleDraw = new QwtScaleDraw;
+                scaleDraw->setAlignment( QwtScaleDraw::BottomScale );
+
+                axis.scaleDraw = scaleDraw;
+                axis.isVisible = true;
+                break;
+            }
+            case QwtPolar::AxisTop:
+            {
+                QwtScaleDraw* scaleDraw = new QwtScaleDraw;
+                scaleDraw->setAlignment( QwtScaleDraw::LeftScale );
+
+                axis.scaleDraw = scaleDraw;
+                axis.isVisible = false;
+                break;
+            }
+            case QwtPolar::AxisBottom:
+            {
+                QwtScaleDraw* scaleDraw = new QwtScaleDraw;
+                scaleDraw->setAlignment( QwtScaleDraw::LeftScale );
+
+                axis.scaleDraw = scaleDraw;
+                axis.isVisible = true;
+                break;
+            }
+            default:;
+        }
+    }
+
+    m_data->attributes = AutoScaling;
+
+    m_data->displayFlags = DisplayFlags();
+    m_data->displayFlags |= SmartOriginLabel;
+    m_data->displayFlags |= HideMaxRadiusLabel;
+    m_data->displayFlags |= ClipAxisBackground;
+    m_data->displayFlags |= SmartScaleDraw;
+    m_data->displayFlags |= ClipGridLines;
+
+    setZ( 10.0 );
+    setRenderHint( RenderAntialiased, true );
+}
+
+//! Destructor
+QwtPolarGrid::~QwtPolarGrid()
+{
+    delete m_data;
+}
+
+//! \return QwtPlotItem::Rtti_PolarGrid
+int QwtPolarGrid::rtti() const
+{
+    return QwtPolarItem::Rtti_PolarGrid;
+}
+
+/*!
+   Change the display flags
+
+   \param flag See DisplayFlag
+   \param on true/false
+ */
+void QwtPolarGrid::setDisplayFlag( DisplayFlag flag, bool on )
+{
+    if ( ( ( m_data->displayFlags & flag ) != 0 ) != on )
+    {
+        if ( on )
+            m_data->displayFlags |= flag;
+        else
+            m_data->displayFlags &= ~flag;
+
+        itemChanged();
+    }
+}
+
+/*!
+   \return true, if flag is enabled
+   \param flag See DisplayFlag
+ */
+bool QwtPolarGrid::testDisplayFlag( DisplayFlag flag ) const
+{
+    return ( m_data->displayFlags & flag );
+}
+
+/*!
+   \brief Specify an attribute for the grid
+
+   \param attribute Grid attribute
+   \param on On/Off
+
+   /sa GridAttribute, testGridAttribute(), updateScaleDiv(),
+      QwtPolarPlot::zoom(), QwtPolarPlot::scaleDiv()
+ */
+void QwtPolarGrid::setGridAttribute( GridAttribute attribute, bool on )
+{
+    if ( bool( m_data->attributes & attribute ) == on )
+        return;
+
+    if ( on )
+        m_data->attributes |= attribute;
+    else
+        m_data->attributes &= ~attribute;
+
+    itemChanged();
+}
+
+/*!
+    \return true, if attribute is enabled
+    \sa GridAttribute, setGridAttribute()
+ */
+bool QwtPolarGrid::testGridAttribute( GridAttribute attribute ) const
+{
+    return m_data->attributes & attribute;
+}
+
+/*!
+   Assign a pen for painting an axis
+
+   \param axisId Axis id (QwtPolar::Axis)
+   \param pen Pen
+
+   \sa axisPen()
+ */
+void QwtPolarGrid::setAxisPen( int axisId, const QPen& pen )
+{
+    if ( axisId < 0 || axisId >= QwtPolar::AxesCount )
+        return;
+
+    AxisData& axisData = m_data->axisData[axisId];
+    if ( axisData.pen != pen )
+    {
+        axisData.pen = pen;
+        itemChanged();
+    }
+}
+
+/*!
+   Show/Hide grid lines for a scale
+
+   \param scaleId Scale id ( QwtPolar::Scale )
+   \param show true/false
+ */
+void QwtPolarGrid::showGrid( int scaleId, bool show )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return;
+
+    GridData& grid = m_data->gridData[scaleId];
+    if ( grid.isVisible != show )
+    {
+        grid.isVisible = show;
+        itemChanged();
+    }
+}
+
+/*!
+   \return true if grid lines are enabled
+   \param scaleId Scale id ( QwtPolar::Scale )
+   \sa QwtPolar::Scale, showGrid()
+ */
+bool QwtPolarGrid::isGridVisible( int scaleId ) const
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return false;
+
+    return m_data->gridData[scaleId].isVisible;
+}
+
+/*!
+   Show/Hide minor grid lines for a scale
+
+   To display minor grid lines. showGrid() needs to be enabled too.
+
+   \param scaleId Scale id ( QwtPolar::Scale )
+   \param show true/false
+
+   \sa showGrid
+ */
+void QwtPolarGrid::showMinorGrid( int scaleId, bool show )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return;
+
+    GridData& grid = m_data->gridData[scaleId];
+    if ( grid.isMinorVisible != show )
+    {
+        grid.isMinorVisible = show;
+        itemChanged();
+    }
+}
+
+/*!
+   \return true if minor grid lines are enabled
+   \param scaleId Scale id ( QwtPolar::Scale )
+   \sa showMinorGrid()
+ */
+bool QwtPolarGrid::isMinorGridVisible( int scaleId ) const
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return false;
+
+    return m_data->gridData[scaleId].isMinorVisible;
+}
+
+/*!
+   Show/Hide an axis
+
+   \param axisId Axis id (QwtPolar::Axis)
+   \param show true/false
+
+   \sa isAxisVisible()
+ */
+void QwtPolarGrid::showAxis( int axisId, bool show )
+{
+    if ( axisId < 0 || axisId >= QwtPolar::AxesCount )
+        return;
+
+    AxisData& axisData = m_data->axisData[axisId];
+    if ( axisData.isVisible != show )
+    {
+        axisData.isVisible = show;
+        itemChanged();
+    }
+}
+
+/*!
+   \return true if the axis is visible
+   \param axisId Axis id (QwtPolar::Axis)
+
+   \sa showAxis()
+ */
+bool QwtPolarGrid::isAxisVisible( int axisId ) const
+{
+    if ( axisId < 0 || axisId >= QwtPolar::AxesCount )
+        return false;
+
+    return m_data->axisData[axisId].isVisible;
+}
+
+/*!
+   Assign a pen for all axes and grid lines
+
+   \param pen Pen
+   \sa setMajorGridPen(), setMinorGridPen(), setAxisPen()
+ */
+void QwtPolarGrid::setPen( const QPen& pen )
+{
+    bool isChanged = false;
+
+    for ( int scaleId = 0; scaleId < QwtPolar::ScaleCount; scaleId++ )
+    {
+        GridData& grid = m_data->gridData[scaleId];
+        if ( grid.majorPen != pen || grid.minorPen != pen )
+        {
+            grid.majorPen = pen;
+            grid.minorPen = pen;
+            isChanged = true;
+        }
+    }
+    for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ )
+    {
+        AxisData& axis = m_data->axisData[axisId];
+        if ( axis.pen != pen )
+        {
+            axis.pen = pen;
+            isChanged = true;
+        }
+    }
+    if ( isChanged )
+        itemChanged();
+}
+
+/*!
+   Assign a font for all scale tick labels
+
+   \param font Font
+   \sa setAxisFont()
+ */
+void QwtPolarGrid::setFont( const QFont& font )
+{
+    bool isChanged = false;
+    for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ )
+    {
+        AxisData& axis = m_data->axisData[axisId];
+        if ( axis.font != font )
+        {
+            axis.font = font;
+            isChanged = true;
+        }
+    }
+    if ( isChanged )
+        itemChanged();
+}
+
+/*!
+   Assign a pen for the major grid lines
+
+   \param pen Pen
+   \sa setPen(), setMinorGridPen(), majorGridPen
+ */
+void QwtPolarGrid::setMajorGridPen( const QPen& pen )
+{
+    bool isChanged = false;
+
+    for ( int scaleId = 0; scaleId < QwtPolar::ScaleCount; scaleId++ )
+    {
+        GridData& grid = m_data->gridData[scaleId];
+        if ( grid.majorPen != pen )
+        {
+            grid.majorPen = pen;
+            isChanged = true;
+        }
+    }
+    if ( isChanged )
+        itemChanged();
+}
+
+/*!
+   Assign a pen for the major grid lines of a specific scale
+
+   \param scaleId Scale id ( QwtPolar::Scale )
+   \param pen Pen
+   \sa setPen(), setMinorGridPen(), majorGridPen
+ */
+void QwtPolarGrid::setMajorGridPen( int scaleId, const QPen& pen )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return;
+
+    GridData& grid = m_data->gridData[scaleId];
+    if ( grid.majorPen != pen )
+    {
+        grid.majorPen = pen;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Pen for painting the major grid lines of a specific scale
+   \param scaleId Scale id ( QwtPolar::Scale )
+   \sa setMajorGridPen(), minorGridPen()
+ */
+QPen QwtPolarGrid::majorGridPen( int scaleId ) const
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return QPen();
+
+    const GridData& grid = m_data->gridData[scaleId];
+    return grid.majorPen;
+}
+
+/*!
+   Assign a pen for the minor grid lines
+
+   \param pen Pen
+   \sa setPen(), setMajorGridPen(), minorGridPen()
+ */
+void QwtPolarGrid::setMinorGridPen( const QPen& pen )
+{
+    bool isChanged = false;
+
+    for ( int scaleId = 0; scaleId < QwtPolar::ScaleCount; scaleId++ )
+    {
+        GridData& grid = m_data->gridData[scaleId];
+        if ( grid.minorPen != pen )
+        {
+            grid.minorPen = pen;
+            isChanged = true;
+        }
+    }
+    if ( isChanged )
+        itemChanged();
+}
+
+/*!
+   Assign a pen for the minor grid lines of a specific scale
+
+   \param scaleId Scale id ( QwtPolar::Scale )
+   \param pen Pen
+   \sa setPen(), setMajorGridPen(), minorGridPen
+ */
+void QwtPolarGrid::setMinorGridPen( int scaleId, const QPen& pen )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return;
+
+    GridData& grid = m_data->gridData[scaleId];
+    if ( grid.minorPen != pen )
+    {
+        grid.minorPen = pen;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Pen for painting the minor grid lines of a specific scale
+   \param scaleId Scale id ( QwtPolar::Scale )
+ */
+QPen QwtPolarGrid::minorGridPen( int scaleId ) const
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return QPen();
+
+    const GridData& grid = m_data->gridData[scaleId];
+    return grid.minorPen;
+}
+
+/*!
+   \return Pen for painting a specific axis
+
+   \param axisId Axis id (QwtPolar::Axis)
+   \sa setAxisPen()
+ */
+QPen QwtPolarGrid::axisPen( int axisId ) const
+{
+    if ( axisId < 0 || axisId >= QwtPolar::AxesCount )
+        return QPen();
+
+    return m_data->axisData[axisId].pen;
+}
+
+/*!
+   Assign a font for the tick labels of a specific axis
+
+   \param axisId Axis id (QwtPolar::Axis)
+   \param font new Font
+ */
+void QwtPolarGrid::setAxisFont( int axisId, const QFont& font )
+{
+    if ( axisId < 0 || axisId >= QwtPolar::AxesCount )
+        return;
+
+    AxisData& axisData = m_data->axisData[axisId];
+    if ( axisData.font != font )
+    {
+        axisData.font = font;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Font for the tick labels of a specific axis
+   \param axisId Axis id (QwtPolar::Axis)
+ */
+QFont QwtPolarGrid::axisFont( int axisId ) const
+{
+    if ( axisId < 0 || axisId >= QwtPolar::AxesCount )
+        return QFont();
+
+    return m_data->axisData[axisId].font;
+}
+
+/*!
+   Draw the grid and axes
+
+   \param painter Painter
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param radius Radius of the complete plot area in painter coordinates
+   \param canvasRect Contents rect of the canvas in painter coordinates
+ */
+void QwtPolarGrid::draw( QPainter* painter,
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, double radius,
+    const QRectF& canvasRect ) const
+{
+    updateScaleDraws( azimuthMap, radialMap, pole, radius );
+
+    painter->save();
+
+    if ( testDisplayFlag( ClipAxisBackground ) )
+    {
+        QRegion clipRegion( canvasRect.toRect() );
+        for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ )
+        {
+            const AxisData& axis = m_data->axisData[axisId];
+            if ( axisId != QwtPolar::AxisAzimuth && axis.isVisible )
+            {
+                QwtScaleDraw* scaleDraw = static_cast< QwtScaleDraw* >( axis.scaleDraw );
+                if ( scaleDraw->hasComponent( QwtScaleDraw::Labels ) )
+                {
+                    const QList< double >& ticks =
+                        scaleDraw->scaleDiv().ticks( QwtScaleDiv::MajorTick );
+                    for ( int i = 0; i < int( ticks.size() ); i++ )
+                    {
+                        if ( !scaleDraw->scaleDiv().contains( ticks[i] ) )
+                            continue;
+
+                        QRect labelRect =
+                            scaleDraw->boundingLabelRect( axis.font, ticks[i] );
+
+                        const int margin = 2;
+                        labelRect.adjust( -margin, -margin, margin, margin );
+
+                        if ( labelRect.isValid() )
+                            clipRegion -= QRegion( labelRect );
+                    }
+                }
+            }
+        }
+        painter->setClipRegion( clipRegion );
+    }
+
+    //  draw radial grid
+
+    const GridData& radialGrid = m_data->gridData[QwtPolar::Radius];
+    if ( radialGrid.isVisible && radialGrid.isMinorVisible )
+    {
+        painter->setPen( radialGrid.minorPen );
+
+        drawCircles( painter, canvasRect, pole, radialMap,
+            radialGrid.scaleDiv.ticks( QwtScaleDiv::MinorTick ) );
+        drawCircles( painter, canvasRect, pole, radialMap,
+            radialGrid.scaleDiv.ticks( QwtScaleDiv::MediumTick ) );
+    }
+    if ( radialGrid.isVisible )
+    {
+        painter->setPen( radialGrid.majorPen );
+
+        drawCircles( painter, canvasRect, pole, radialMap,
+            radialGrid.scaleDiv.ticks( QwtScaleDiv::MajorTick ) );
+    }
+
+    // draw azimuth grid
+
+    const GridData& azimuthGrid =
+        m_data->gridData[QwtPolar::Azimuth];
+
+    if ( azimuthGrid.isVisible && azimuthGrid.isMinorVisible )
+    {
+        painter->setPen( azimuthGrid.minorPen );
+
+        drawRays( painter, canvasRect, pole, radius, azimuthMap,
+            azimuthGrid.scaleDiv.ticks( QwtScaleDiv::MinorTick ) );
+        drawRays( painter, canvasRect, pole, radius, azimuthMap,
+            azimuthGrid.scaleDiv.ticks( QwtScaleDiv::MediumTick ) );
+    }
+    if ( azimuthGrid.isVisible )
+    {
+        painter->setPen( azimuthGrid.majorPen );
+
+        drawRays( painter, canvasRect, pole, radius, azimuthMap,
+            azimuthGrid.scaleDiv.ticks( QwtScaleDiv::MajorTick ) );
+    }
+    painter->restore();
+
+    for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ )
+    {
+        const AxisData& axis = m_data->axisData[axisId];
+        if ( axis.isVisible )
+        {
+            painter->save();
+            drawAxis( painter, axisId );
+            painter->restore();
+        }
+    }
+}
+
+/*!
+   Draw lines from the pole
+
+   \param painter Painter
+   \param canvasRect Contents rect of the canvas in painter coordinates
+   \param pole Position of the pole in painter coordinates
+   \param radius Length of the lines in painter coordinates
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param values Azimuth values, indicating the direction of the lines
+ */
+void QwtPolarGrid::drawRays(
+    QPainter* painter, const QRectF& canvasRect,
+    const QPointF& pole, double radius,
+    const QwtScaleMap& azimuthMap, const QList< double >& values ) const
+{
+    for ( int i = 0; i < int( values.size() ); i++ )
+    {
+        double azimuth = azimuthMap.transform( values[i] );
+        azimuth = ::fmod( azimuth, 2 * M_PI );
+
+        bool skipLine = false;
+        if ( testDisplayFlag( SmartScaleDraw ) )
+        {
+            const QwtAbstractScaleDraw::ScaleComponent bone =
+                QwtAbstractScaleDraw::Backbone;
+            if ( isClose( azimuth, 0.0 ) )
+            {
+                const AxisData& axis = m_data->axisData[QwtPolar::AxisRight];
+                if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
+                    skipLine = true;
+            }
+            else if ( isClose( azimuth, M_PI / 2 ) )
+            {
+                const AxisData& axis = m_data->axisData[QwtPolar::AxisTop];
+                if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
+                    skipLine = true;
+            }
+            else if ( isClose( azimuth, M_PI ) )
+            {
+                const AxisData& axis = m_data->axisData[QwtPolar::AxisLeft];
+                if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
+                    skipLine = true;
+            }
+            else if ( isClose( azimuth, 3 * M_PI / 2.0 ) )
+            {
+                const AxisData& axis = m_data->axisData[QwtPolar::AxisBottom];
+                if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
+                    skipLine = true;
+            }
+        }
+        if ( !skipLine )
+        {
+            const QPointF pos = qwtPolar2Pos( pole, radius, azimuth );
+
+            /*
+                Qt4 is horrible slow, when painting primitives,
+                with coordinates far outside the visible area.
+             */
+
+            QPolygonF polygon( 2 );
+            polygon[0] = pole.toPoint();
+            polygon[1] = pos.toPoint();
+
+            if ( testDisplayFlag( ClipGridLines ) )
+                QwtClipper::clipPolygonF( canvasRect, polygon );
+
+            QwtPainter::drawPolyline( painter, polygon );
+        }
+    }
+}
+
+/*!
+   Draw circles
+
+   \param painter Painter
+   \param canvasRect Contents rect of the canvas in painter coordinates
+   \param pole Position of the pole in painter coordinates
+   \param radialMap Maps radius values into painter coordinates.
+   \param values Radial values, indicating the distances from the pole
+ */
+void QwtPolarGrid::drawCircles(
+    QPainter* painter, const QRectF& canvasRect,
+    const QPointF& pole, const QwtScaleMap& radialMap,
+    const QList< double >& values ) const
+{
+    for ( int i = 0; i < int( values.size() ); i++ )
+    {
+        const double val = values[i];
+
+        const GridData& gridData =
+            m_data->gridData[QwtPolar::Radius];
+
+        bool skipLine = false;
+        if ( testDisplayFlag( SmartScaleDraw ) )
+        {
+            const AxisData& axis = m_data->axisData[QwtPolar::AxisAzimuth];
+            if ( axis.isVisible &&
+                axis.scaleDraw->hasComponent( QwtAbstractScaleDraw::Backbone ) )
+            {
+                if ( isClose( val, gridData.scaleDiv.upperBound() ) )
+                    skipLine = true;
+            }
+        }
+
+        if ( isClose( val, gridData.scaleDiv.lowerBound() ) )
+            skipLine = true;
+
+        if ( !skipLine )
+        {
+            const double radius = radialMap.transform( val );
+
+            QRectF outerRect( 0, 0, 2 * radius, 2 * radius );
+            outerRect.moveCenter( pole );
+
+            if ( testDisplayFlag( ClipGridLines ) )
+            {
+                /*
+                    Qt4 is horrible slow, when painting primitives,
+                    with coordinates far outside the visible area.
+                    We need to clip.
+                 */
+
+                const QVector< QwtInterval > angles =
+                    QwtClipper::clipCircle( canvasRect, pole, radius );
+
+                for ( int j = 0; j < angles.size(); j++ )
+                {
+                    const QwtInterval intv = angles[j];
+
+                    if ( intv.minValue() == 0 && intv.maxValue() == 2 * M_PI )
+                    {
+                        QwtPainter::drawEllipse( painter, outerRect );
+                    }
+                    else
+                    {
+                        const double from = qwtDegrees( intv.minValue() );
+                        const double to = qwtDegrees( intv.maxValue() );
+
+                        double span = to - from;
+                        if ( span < 0.0 )
+                            span += 360.0;
+
+                        painter->drawArc( outerRect,
+                            qRound( from * 16 ), qRound( span * 16 ) );
+                    }
+                }
+            }
+            else
+            {
+                QwtPainter::drawEllipse( painter, outerRect );
+            }
+        }
+    }
+}
+
+/*!
+   Paint an axis
+
+   \param painter Painter
+   \param axisId Axis id (QwtPolar::Axis)
+ */
+void QwtPolarGrid::drawAxis( QPainter* painter, int axisId ) const
+{
+    if ( axisId < 0 || axisId >= QwtPolar::AxesCount )
+        return;
+
+    AxisData& axis = m_data->axisData[axisId];
+
+    painter->setPen( axis.pen );
+    painter->setFont( axis.font );
+
+    QPalette pal;
+    pal.setColor( QPalette::WindowText, axis.pen.color() );
+    pal.setColor( QPalette::Text, axis.pen.color() );
+
+    axis.scaleDraw->draw( painter, pal );
+}
+
+/*!
+   Update the axis scale draw geometries
+
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param radius Radius of the complete plot area in painter coordinates
+
+   \sa updateScaleDiv()
+ */
+void QwtPolarGrid::updateScaleDraws(
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, double radius ) const
+{
+    const QPoint p = pole.toPoint();
+
+    const QwtInterval interval =
+        m_data->gridData[QwtPolar::ScaleRadius].scaleDiv.interval();
+
+    const int min = radialMap.transform( interval.minValue() );
+    const int max = radialMap.transform( interval.maxValue() );
+    const int l = max - min;
+
+    for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ )
+    {
+        AxisData& axis = m_data->axisData[axisId];
+
+        if ( axisId == QwtPolar::AxisAzimuth )
+        {
+            QwtRoundScaleDraw* scaleDraw =
+                static_cast< QwtRoundScaleDraw* >( axis.scaleDraw );
+
+            scaleDraw->setRadius( qRound( radius ) );
+            scaleDraw->moveCenter( p );
+
+            double from = ::fmod( 90.0 - qwtDegrees( azimuthMap.p1() ), 360.0 );
+            if ( from < 0.0 )
+                from += 360.0;
+
+            scaleDraw->setAngleRange( from, from - 360.0 );
+
+            const QwtTransform* transform = azimuthMap.transformation();
+            if ( transform )
+                scaleDraw->setTransformation( transform->copy() );
+            else
+                scaleDraw->setTransformation( NULL );
+        }
+        else
+        {
+            QwtScaleDraw* scaleDraw =
+                static_cast< QwtScaleDraw* >( axis.scaleDraw );
+
+            switch( axisId )
+            {
+                case QwtPolar::AxisLeft:
+                {
+                    scaleDraw->move( p.x() - min, p.y() );
+                    scaleDraw->setLength( -l );
+                    break;
+                }
+                case QwtPolar::AxisRight:
+                {
+                    scaleDraw->move( p.x() + min, p.y() );
+                    scaleDraw->setLength( l );
+                    break;
+                }
+                case QwtPolar::AxisTop:
+                {
+                    scaleDraw->move( p.x(), p.y() - max );
+                    scaleDraw->setLength( l );
+                    break;
+                }
+                case QwtPolar::AxisBottom:
+                {
+                    scaleDraw->move( p.x(), p.y() + max );
+                    scaleDraw->setLength( -l );
+                    break;
+                }
+            }
+            const QwtTransform* transform = radialMap.transformation();
+            if ( transform )
+                scaleDraw->setTransformation( transform->copy() );
+            else
+                scaleDraw->setTransformation( NULL );
+        }
+    }
+}
+
+/*!
+   \brief Update the item to changes of the axes scale division
+
+   If AutoScaling is enabled the radial scale is calculated
+   from the interval, otherwise the scales are adopted to
+   the plot scales.
+
+   \param azimuthScaleDiv Scale division of the azimuth-scale
+   \param radialScaleDiv Scale division of the radius-axis
+   \param interval The interval of the radius-axis, that is
+                   visible on the canvas
+
+   \sa QwtPolarPlot::setGridAttributes()
+ */
+
+void QwtPolarGrid::updateScaleDiv( const QwtScaleDiv& azimuthScaleDiv,
+    const QwtScaleDiv& radialScaleDiv, const QwtInterval& interval )
+{
+    GridData& radialGrid = m_data->gridData[QwtPolar::Radius];
+
+    const QwtPolarPlot* plt = plot();
+    if ( plt && testGridAttribute( AutoScaling ) )
+    {
+        const QwtScaleEngine* se = plt->scaleEngine( QwtPolar::Radius );
+        radialGrid.scaleDiv = se->divideScale(
+            interval.minValue(), interval.maxValue(),
+            plt->scaleMaxMajor( QwtPolar::Radius ),
+            plt->scaleMaxMinor( QwtPolar::Radius ), 0 );
+    }
+    else
+    {
+        if ( radialGrid.scaleDiv != radialScaleDiv )
+            radialGrid.scaleDiv = radialScaleDiv;
+    }
+
+    GridData& azimuthGrid = m_data->gridData[QwtPolar::Azimuth];
+    if ( azimuthGrid.scaleDiv != azimuthScaleDiv )
+    {
+        azimuthGrid.scaleDiv = azimuthScaleDiv;
+    }
+
+    bool hasOrigin = false;
+    for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ )
+    {
+        AxisData& axis = m_data->axisData[axisId];
+        if ( axis.isVisible && axis.scaleDraw )
+        {
+            if ( axisId == QwtPolar::AxisAzimuth )
+            {
+                axis.scaleDraw->setScaleDiv( azimuthGrid.scaleDiv );
+                if ( testDisplayFlag( SmartScaleDraw ) )
+                {
+                    axis.scaleDraw->enableComponent(
+                        QwtAbstractScaleDraw::Ticks, !azimuthGrid.isVisible );
+                }
+            }
+            else
+            {
+                QwtScaleDiv sd = radialGrid.scaleDiv;
+
+                QList< double > ticks = sd.ticks( QwtScaleDiv::MajorTick );
+
+                if ( testDisplayFlag( SmartOriginLabel ) )
+                {
+                    bool skipOrigin = hasOrigin;
+                    if ( !skipOrigin )
+                    {
+                        if ( axisId == QwtPolar::AxisLeft
+                            || axisId == QwtPolar::AxisRight )
+                        {
+                            if ( m_data->axisData[QwtPolar::AxisBottom].isVisible )
+                                skipOrigin = true;
+                        }
+                        else
+                        {
+                            if ( m_data->axisData[QwtPolar::AxisLeft].isVisible )
+                                skipOrigin = true;
+                        }
+                    }
+                    if ( ticks.size() > 0 && ticks.first() == sd.lowerBound() )
+                    {
+                        if ( skipOrigin )
+                            ticks.removeFirst();
+                        else
+                            hasOrigin = true;
+                    }
+                }
+
+                if ( testDisplayFlag( HideMaxRadiusLabel ) )
+                {
+                    if ( ticks.size() > 0 && ticks.last() == sd.upperBound() )
+                        ticks.removeLast();
+                }
+
+                sd.setTicks( QwtScaleDiv::MajorTick, ticks );
+                axis.scaleDraw->setScaleDiv( sd );
+
+                if ( testDisplayFlag( SmartScaleDraw ) )
+                {
+                    axis.scaleDraw->enableComponent(
+                        QwtAbstractScaleDraw::Ticks, !radialGrid.isVisible );
+                }
+
+            }
+        }
+    }
+}
+
+/*!
+   \return Number of pixels, that are necessary to paint the azimuth scale
+   \sa QwtRoundScaleDraw::extent()
+ */
+int QwtPolarGrid::marginHint() const
+{
+    const AxisData& axis = m_data->axisData[QwtPolar::AxisAzimuth];
+    if ( axis.isVisible )
+    {
+        const int extent = axis.scaleDraw->extent( axis.font );
+        return extent;
+    }
+
+    return 0;
+}
+
+/*!
+   Returns the scale draw of a specified axis
+
+   \param axisId axis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom)
+   \return specified scaleDraw for axis, or NULL if axis is invalid.
+   \sa azimuthScaleDraw()
+ */
+const QwtScaleDraw* QwtPolarGrid::scaleDraw( int axisId ) const
+{
+    if ( axisId >= QwtPolar::AxisLeft && axisId <= QwtPolar::AxisBottom )
+        return static_cast< QwtScaleDraw* >( m_data->axisData[axisId].scaleDraw );
+
+    return NULL;
+}
+
+/*!
+   Returns the scale draw of a specified axis
+
+   \param axisId axis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom)
+   \return specified scaleDraw for axis, or NULL if axis is invalid.
+   \sa setScaleDraw(), azimuthScaleDraw()
+ */
+QwtScaleDraw* QwtPolarGrid::scaleDraw( int axisId )
+{
+    if ( axisId >= QwtPolar::AxisLeft && axisId <= QwtPolar::AxisBottom )
+        return static_cast< QwtScaleDraw* >( m_data->axisData[axisId].scaleDraw );
+
+    return NULL;
+}
+
+/*!
+   \brief Set a scale draw
+
+   \param axisId axis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom)
+   \param scaleDraw object responsible for drawing scales.
+
+   \sa scaleDraw(), setAzimuthScaleDraw()
+ */
+void QwtPolarGrid::setScaleDraw( int axisId, QwtScaleDraw* scaleDraw )
+{
+    if ( axisId < QwtPolar::AxisLeft || axisId > QwtPolar::AxisBottom )
+        return;
+
+    AxisData& axisData = m_data->axisData[axisId];
+    if ( axisData.scaleDraw != scaleDraw )
+    {
+        delete axisData.scaleDraw;
+        axisData.scaleDraw = scaleDraw;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Scale draw for the azimuth scale
+   \sa setAzimuthScaleDraw(), scaleDraw()
+ */
+const QwtRoundScaleDraw* QwtPolarGrid::azimuthScaleDraw() const
+{
+    return static_cast< QwtRoundScaleDraw* >(
+        m_data->axisData[QwtPolar::AxisAzimuth].scaleDraw );
+}
+
+/*!
+   \return Scale draw for the azimuth scale
+   \sa setAzimuthScaleDraw(), scaleDraw()
+ */
+QwtRoundScaleDraw* QwtPolarGrid::azimuthScaleDraw()
+{
+    return static_cast< QwtRoundScaleDraw* >(
+        m_data->axisData[QwtPolar::AxisAzimuth].scaleDraw );
+}
+
+/*!
+   \brief Set a scale draw for the azimuth scale
+
+   \param scaleDraw object responsible for drawing scales.
+   \sa azimuthScaleDraw(), setScaleDraw()
+ */
+void QwtPolarGrid::setAzimuthScaleDraw( QwtRoundScaleDraw* scaleDraw )
+{
+    AxisData& axisData = m_data->axisData[QwtPolar::AxisAzimuth];
+    if ( axisData.scaleDraw != scaleDraw )
+    {
+        delete axisData.scaleDraw;
+        axisData.scaleDraw = scaleDraw;
+        itemChanged();
+    }
+}
Index: /trunk/BNC/qwt/qwt_polar_grid.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_grid.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_grid.h	(revision 11158)
@@ -0,0 +1,183 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_GRID_H
+#define QWT_POLAR_GRID_H
+
+#include "qwt_global.h"
+#include "qwt_polar.h"
+#include "qwt_polar_item.h"
+#include "qwt_polar_plot.h"
+
+class QPainter;
+class QPen;
+class QwtScaleMap;
+class QwtScaleDiv;
+class QwtRoundScaleDraw;
+class QwtScaleDraw;
+
+/*!
+   \brief An item which draws scales and grid lines on a polar plot.
+
+   The QwtPolarGrid class can be used to draw a coordinate grid.
+   A coordinate grid consists of major and minor gridlines.
+   The locations of the gridlines are determined by the azimuth and radial
+   scale divisions.
+
+   QwtPolarGrid is also responsible for drawing the axis representing the
+   scales. It is possible to display 4 radial and one azimuth axis.
+
+   Whenever the scale divisions of the plot widget changes the grid
+   is synchronized by updateScaleDiv().
+
+   \sa QwtPolarPlot, QwtPolar::Axis
+ */
+
+class QWT_EXPORT QwtPolarGrid : public QwtPolarItem
+{
+  public:
+    /*!
+       Mysterious flags trying to avoid conflicts, when painting the
+       scales and grid lines.
+
+       The default setting enables all flags.
+
+       \sa setDisplayFlag(), testDisplayFlag()
+     */
+    enum DisplayFlag
+    {
+        /*!
+           Try to avoid situations, where the label of the origin is
+           painted over another axis.
+         */
+        SmartOriginLabel = 1,
+
+        /*!
+           Often the outermost tick of the radial scale is close to the
+           canvas border. With HideMaxRadiusLabel enabled it is not painted.
+         */
+        HideMaxRadiusLabel = 2,
+
+        /*!
+           The tick labels of the radial scales might be hard to read, when
+           they are painted on top of the radial grid lines ( or on top
+           of a curve/spectrogram ). When ClipAxisBackground the bounding rect
+           of each label is added to the clip region.
+         */
+        ClipAxisBackground = 4,
+
+        /*!
+           Don't paint the backbone of the radial axes, when they are very close
+           to a line of the azimuth grid.
+         */
+        SmartScaleDraw = 8,
+
+        /*!
+           All grid lines are clipped against the plot area before being painted.
+           When the plot is zoomed in this will have an significant impact
+           on the performance of the painting code.
+         */
+        ClipGridLines = 16
+    };
+
+    Q_DECLARE_FLAGS( DisplayFlags, DisplayFlag )
+
+    /*!
+       \brief Grid attributes
+       \sa setGridAttributes(), testGridAttributes()
+     */
+    enum GridAttribute
+    {
+        /*!
+           When AutoScaling is enabled, the radial axes will be adjusted
+           to the interval, that is currently visible on the canvas plot.
+         */
+        AutoScaling = 0x01
+    };
+
+    Q_DECLARE_FLAGS( GridAttributes, GridAttribute )
+
+    explicit QwtPolarGrid();
+    virtual ~QwtPolarGrid();
+
+    virtual int rtti() const QWT_OVERRIDE;
+
+    void setDisplayFlag( DisplayFlag, bool on = true );
+    bool testDisplayFlag( DisplayFlag ) const;
+
+    void setGridAttribute( GridAttribute, bool on = true );
+    bool testGridAttribute( GridAttribute ) const;
+
+    void showGrid( int scaleId, bool show = true );
+    bool isGridVisible( int scaleId ) const;
+
+    void showMinorGrid( int scaleId, bool show = true );
+    bool isMinorGridVisible( int scaleId ) const;
+
+    void showAxis( int axisId, bool show = true );
+    bool isAxisVisible( int axisId ) const;
+
+    void setPen( const QPen& p );
+    void setFont( const QFont& );
+
+    void setMajorGridPen( const QPen& p );
+    void setMajorGridPen( int scaleId, const QPen& p );
+    QPen majorGridPen( int scaleId ) const;
+
+    void setMinorGridPen( const QPen& p );
+    void setMinorGridPen( int scaleId, const QPen& p );
+    QPen minorGridPen( int scaleId ) const;
+
+    void setAxisPen( int axisId, const QPen& p );
+    QPen axisPen( int axisId ) const;
+
+    void setAxisFont( int axisId, const QFont& p );
+    QFont axisFont( int axisId ) const;
+
+    void setScaleDraw( int axisId, QwtScaleDraw* );
+    const QwtScaleDraw* scaleDraw( int axisId ) const;
+    QwtScaleDraw* scaleDraw( int axisId );
+
+    void setAzimuthScaleDraw( QwtRoundScaleDraw* );
+    const QwtRoundScaleDraw* azimuthScaleDraw() const;
+    QwtRoundScaleDraw* azimuthScaleDraw();
+
+    virtual void draw( QPainter* p,
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, double radius,
+        const QRectF& rect ) const QWT_OVERRIDE;
+
+    virtual void updateScaleDiv( const QwtScaleDiv& azimuthMap,
+        const QwtScaleDiv& radialMap, const QwtInterval& ) QWT_OVERRIDE;
+
+    virtual int marginHint() const QWT_OVERRIDE;
+
+  protected:
+    void drawRays( QPainter*, const QRectF&,
+        const QPointF& pole, double radius,
+        const QwtScaleMap& azimuthMap, const QList< double >& ) const;
+    void drawCircles( QPainter*, const QRectF&,
+        const QPointF& pole, const QwtScaleMap& radialMap,
+        const QList< double >& ) const;
+
+    void drawAxis( QPainter*, int axisId ) const;
+
+  private:
+    void updateScaleDraws(
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, const double radius ) const;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarGrid::DisplayFlags )
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarGrid::GridAttributes )
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_item.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_item.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_item.cpp	(revision 11158)
@@ -0,0 +1,481 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_plot.h"
+#include "qwt_polar_item.h"
+#include "qwt_legend.h"
+#include "qwt_scale_div.h"
+
+#include <qpainter.h>
+
+class QwtPolarItem::PrivateData
+{
+  public:
+    PrivateData()
+        : plot( NULL )
+        , isVisible( true )
+        , renderThreadCount( 1 )
+        , z( 0.0 )
+        , legendIconSize( 8, 8 )
+    {
+    }
+
+    mutable QwtPolarPlot* plot;
+
+    bool isVisible;
+    QwtPolarItem::ItemAttributes attributes;
+    QwtPolarItem::RenderHints renderHints;
+    uint renderThreadCount;
+
+    double z;
+
+    QwtText title;
+    QSize legendIconSize;
+};
+
+/*!
+   Constructor
+
+   \param title Item title, f.e used on a legend
+
+   \sa setTitle()
+ */
+QwtPolarItem::QwtPolarItem( const QwtText& title )
+{
+    m_data = new PrivateData;
+    m_data->title = title;
+}
+
+//! Destroy the QwtPolarItem
+QwtPolarItem::~QwtPolarItem()
+{
+    attach( NULL );
+    delete m_data;
+}
+
+/*!
+   \brief Attach the item to a plot.
+
+   This method will attach a QwtPolarItem to the QwtPolarPlot argument.
+   It will first detach the QwtPolarItem from any plot from a previous
+   call to attach (if necessary).
+   If a NULL argument is passed, it will detach from any QwtPolarPlot it
+   was attached to.
+
+   \param plot Plot widget
+
+   \sa QwtPolarItem::detach()
+ */
+void QwtPolarItem::attach( QwtPolarPlot* plot )
+{
+    if ( plot == m_data->plot )
+        return;
+
+    if ( m_data->plot )
+        m_data->plot->attachItem( this, false );
+
+    m_data->plot = plot;
+
+    if ( m_data->plot )
+        m_data->plot->attachItem( this, true );
+}
+
+/*!
+   \brief This method detaches a QwtPolarItem from the QwtPolarPlot it
+          has been associated with.
+
+   detach() is equivalent to calling attach( NULL )
+   \sa attach()
+ */
+void QwtPolarItem::detach()
+{
+    attach( NULL );
+}
+
+/*!
+   Return rtti for the specific class represented. QwtPolarItem is simply
+   a virtual interface class, and base classes will implement this method
+   with specific rtti values so a user can differentiate them.
+
+   The rtti value is useful for environments, where the
+   runtime type information is disabled and it is not possible
+   to do a dynamic_cast<...>.
+
+   \return rtti value
+   \sa RttiValues
+ */
+int QwtPolarItem::rtti() const
+{
+    return Rtti_PolarItem;
+}
+
+//! \return Attached plot
+QwtPolarPlot* QwtPolarItem::plot() const
+{
+    return m_data->plot;
+}
+
+/*!
+   Plot items are painted in increasing z-order.
+
+   \return Z value
+   \sa setZ(), QwtPolarItemDict::itemList()
+ */
+double QwtPolarItem::z() const
+{
+    return m_data->z;
+}
+
+/*!
+   \brief Set the z value
+
+   Plot items are painted in increasing z-order.
+
+   \param z Z-value
+   \sa z(), QwtPolarItemDict::itemList()
+ */
+void QwtPolarItem::setZ( double z )
+{
+    if ( m_data->z != z )
+    {
+        if ( m_data->plot )
+            m_data->plot->attachItem( this, false );
+
+        m_data->z = z;
+
+        if ( m_data->plot )
+            m_data->plot->attachItem( this, true );
+
+        itemChanged();
+    }
+}
+
+/*!
+   Set a new title
+
+   \param title Title
+   \sa title()
+ */
+void QwtPolarItem::setTitle( const QString& title )
+{
+    setTitle( QwtText( title ) );
+}
+
+/*!
+   Set a new title
+
+   \param title Title
+   \sa title()
+ */
+void QwtPolarItem::setTitle( const QwtText& title )
+{
+    if ( m_data->title != title )
+    {
+        m_data->title = title;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Title of the item
+   \sa setTitle()
+ */
+const QwtText& QwtPolarItem::title() const
+{
+    return m_data->title;
+}
+
+/*!
+   Toggle an item attribute
+
+   \param attribute Attribute type
+   \param on true/false
+
+   \sa testItemAttribute(), ItemAttribute
+ */
+void QwtPolarItem::setItemAttribute( ItemAttribute attribute, bool on )
+{
+    if ( bool( m_data->attributes & attribute ) != on )
+    {
+        if ( on )
+            m_data->attributes |= attribute;
+        else
+            m_data->attributes &= ~attribute;
+
+        itemChanged();
+    }
+}
+
+/*!
+   Test an item attribute
+
+   \param attribute Attribute type
+   \return true/false
+   \sa setItemAttribute(), ItemAttribute
+ */
+bool QwtPolarItem::testItemAttribute( ItemAttribute attribute ) const
+{
+    return m_data->attributes & attribute;
+}
+
+/*!
+   Toggle an render hint
+
+   \param hint Render hint
+   \param on true/false
+
+   \sa testRenderHint(), RenderHint
+ */
+void QwtPolarItem::setRenderHint( RenderHint hint, bool on )
+{
+    if ( ( ( m_data->renderHints & hint ) != 0 ) != on )
+    {
+        if ( on )
+            m_data->renderHints |= hint;
+        else
+            m_data->renderHints &= ~hint;
+
+        itemChanged();
+    }
+}
+
+/*!
+   Test a render hint
+
+   \param hint Render hint
+   \return true/false
+   \sa setRenderHint(), RenderHint
+ */
+bool QwtPolarItem::testRenderHint( RenderHint hint ) const
+{
+    return ( m_data->renderHints & hint );
+}
+
+/*!
+   On multi core systems rendering of certain plot item
+   ( f.e QwtPolarSpectrogram ) can be done in parallel in
+   several threads.
+
+   The default setting is set to 1.
+
+   \param numThreads Number of threads to be used for rendering.
+                     If numThreads is set to 0, the system specific
+                     ideal thread count is used.
+
+   The default thread count is 1 ( = no additional threads )
+ */
+void QwtPolarItem::setRenderThreadCount( uint numThreads )
+{
+    m_data->renderThreadCount = numThreads;
+}
+
+/*!
+   \return Number of threads to be used for rendering.
+           If numThreads() is set to 0, the system specific
+           ideal thread count is used.
+ */
+uint QwtPolarItem::renderThreadCount() const
+{
+    return m_data->renderThreadCount;
+}
+
+/*!
+   Set the size of the legend icon
+
+   The default setting is 8x8 pixels
+
+   \param size Size
+   \sa legendIconSize(), legendIcon()
+ */
+void QwtPolarItem::setLegendIconSize( const QSize& size )
+{
+    if ( m_data->legendIconSize != size )
+    {
+        m_data->legendIconSize = size;
+        legendChanged();
+    }
+}
+
+/*!
+   \return Legend icon size
+   \sa setLegendIconSize(), legendIcon()
+ */
+QSize QwtPolarItem::legendIconSize() const
+{
+    return m_data->legendIconSize;
+}
+
+//! Show the item
+void QwtPolarItem::show()
+{
+    setVisible( true );
+}
+
+//! Hide the item
+void QwtPolarItem::hide()
+{
+    setVisible( false );
+}
+
+/*!
+    Show/Hide the item
+
+    \param on Show if true, otherwise hide
+    \sa isVisible(), show(), hide()
+ */
+void QwtPolarItem::setVisible( bool on )
+{
+    if ( on != m_data->isVisible )
+    {
+        m_data->isVisible = on;
+        itemChanged();
+    }
+}
+
+/*!
+    \return true if visible
+    \sa setVisible(), show(), hide()
+ */
+bool QwtPolarItem::isVisible() const
+{
+    return m_data->isVisible;
+}
+
+/*!
+   Update the legend and call QwtPolarPlot::autoRefresh for the
+   parent plot.
+
+   \sa updateLegend()
+ */
+void QwtPolarItem::itemChanged()
+{
+    if ( m_data->plot )
+        m_data->plot->autoRefresh();
+}
+
+/*!
+   Update the legend of the parent plot.
+   \sa QwtPolarPlot::updateLegend(), itemChanged()
+ */
+void QwtPolarItem::legendChanged()
+{
+    if ( testItemAttribute( QwtPolarItem::Legend ) && m_data->plot )
+        m_data->plot->updateLegend( this );
+}
+
+/*!
+   Interval, that is necessary to display the item
+
+   This interval can be useful for operations like clipping or autoscaling
+   For items ( like the grid ), where a bounding interval makes no
+   sense an invalid interval is returned.
+
+   \param scaleId Scale id ( QwtPolar::Scale )
+   \return Bounding interval of the plot item for a specific scale
+ */
+QwtInterval QwtPolarItem::boundingInterval( int scaleId ) const
+{
+    Q_UNUSED( scaleId );
+
+    return QwtInterval(); // invalid
+}
+
+/*!
+   \brief Update the item to changes of the axes scale division
+
+   Update the item, when the axes of plot have changed.
+   The default implementation does nothing, but items that depend
+   on the scale division (like QwtPolarGrid()) have to reimplement
+   updateScaleDiv()
+
+   \param azimuthScaleDiv Scale division of the azimuth-scale
+   \param radialScaleDiv Scale division of the radius-axis
+   \param interval The interval of the radius-axis, that is
+                   visible on the canvas
+
+   \sa QwtPolarPlot::updateAxes()
+ */
+void QwtPolarItem::updateScaleDiv( const QwtScaleDiv& azimuthScaleDiv,
+    const QwtScaleDiv& radialScaleDiv, const QwtInterval& interval )
+{
+    Q_UNUSED( azimuthScaleDiv );
+    Q_UNUSED( radialScaleDiv );
+    Q_UNUSED( interval );
+}
+
+/*!
+   \brief Return all information, that is needed to represent
+          the item on the legend
+
+   Most items are represented by one entry on the legend
+   showing an icon and a text.
+
+   QwtLegendData is basically a list of QVariants that makes it
+   possible to overload and reimplement legendData() to
+   return almost any type of information, that is understood
+   by the receiver that acts as the legend.
+
+   The default implementation returns one entry with
+   the title() of the item and the legendIcon().
+
+   \sa title(), legendIcon(), QwtLegend
+ */
+QList< QwtLegendData > QwtPolarItem::legendData() const
+{
+    QwtLegendData data;
+
+    QwtText label = title();
+    label.setRenderFlags( label.renderFlags() & Qt::AlignLeft );
+
+    data.setValue( QwtLegendData::TitleRole,
+        QVariant::fromValue( label ) );
+
+    const QwtGraphic graphic = legendIcon( 0, legendIconSize() );
+    if ( !graphic.isNull() )
+    {
+        data.setValue( QwtLegendData::IconRole,
+            QVariant::fromValue( graphic ) );
+    }
+
+    QList< QwtLegendData > list;
+    list += data;
+
+    return list;
+}
+
+/*!
+   \return Icon representing the item on the legend
+
+   The default implementation returns an invalid icon
+
+   \param index Index of the legend entry
+                ( usually there is only one )
+   \param size Icon size
+
+   \sa setLegendIconSize(), legendData()
+ */
+QwtGraphic QwtPolarItem::legendIcon(
+    int index, const QSizeF& size ) const
+{
+    Q_UNUSED( index )
+    Q_UNUSED( size )
+
+    return QwtGraphic();
+}
+
+/*!
+   Some items like to display something (f.e. the azimuth axis) outside
+   of the area of the interval of the radial scale.
+   The default implementation returns 0 pixels
+
+   \return Hint for the margin
+ */
+int QwtPolarItem::marginHint() const
+{
+    return 0;
+}
Index: /trunk/BNC/qwt/qwt_polar_item.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_item.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_item.h	(revision 11158)
@@ -0,0 +1,174 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_ITEM_H
+#define QWT_POLAR_ITEM_H
+
+#include "qwt_global.h"
+#include "qwt_text.h"
+#include "qwt_legend_data.h"
+#include "qwt_graphic.h"
+#include "qwt_interval.h"
+
+class QString;
+class QRect;
+class QPointF;
+class QPainter;
+class QwtPolarPlot;
+class QwtScaleMap;
+class QwtScaleDiv;
+
+/*!
+   \brief Base class for items on a polar plot
+
+   A QwtPolarItem is "something that can be painted on the canvas".
+   It is connected to the QwtPolar framework by a couple of virtual
+   methods, that are individually implemented in derived item classes.
+
+   QwtPolar offers an implementation of the most common types of items,
+   but deriving from QwtPolarItem makes it easy to implement additional
+   types of items.
+ */
+class QWT_EXPORT QwtPolarItem
+{
+  public:
+    /*!
+        \brief Runtime type information
+
+        RttiValues is used to cast plot items, without
+        having to enable runtime type information of the compiler.
+     */
+    enum RttiValues
+    {
+        //! Unspecific value, that can be used, when it doesn't matter
+        Rtti_PolarItem = 0,
+
+        //! For QwtPolarGrid
+        Rtti_PolarGrid,
+
+        //! For QwtPolarMarker
+        Rtti_PolarMarker,
+
+        //! For QwtPolarCurve
+        Rtti_PolarCurve,
+
+        //! For QwtPolarSpectrogram
+        Rtti_PolarSpectrogram,
+
+        /*!
+           Values >= Rtti_PolarUserItem are reserved for plot items
+           not implemented in the QwtPolar library.
+         */
+        Rtti_PolarUserItem = 1000
+    };
+
+    /*!
+       \brief Plot Item Attributes
+       \sa setItemAttribute(), testItemAttribute()
+     */
+    enum ItemAttribute
+    {
+        //! The item is represented on the legend.
+        Legend    = 0x01,
+
+        /*!
+           The boundingRect() of the item is included in the
+           autoscaling calculation.
+         */
+        AutoScale = 0x02
+    };
+
+    Q_DECLARE_FLAGS( ItemAttributes, ItemAttribute )
+
+    /*!
+       \brief Render hints
+       \sa setRenderHint(), testRenderHint()
+     */
+    enum RenderHint
+    {
+        //! Enable antialiasing
+        RenderAntialiased = 0x01
+    };
+
+    Q_DECLARE_FLAGS( RenderHints, RenderHint )
+
+    explicit QwtPolarItem( const QwtText& title = QwtText() );
+    virtual ~QwtPolarItem();
+
+    void attach( QwtPolarPlot* plot );
+    void detach();
+
+    QwtPolarPlot* plot() const;
+
+    void setTitle( const QString& title );
+    void setTitle( const QwtText& title );
+    const QwtText& title() const;
+
+    virtual int rtti() const;
+
+    void setItemAttribute( ItemAttribute, bool on = true );
+    bool testItemAttribute( ItemAttribute ) const;
+
+    void setRenderHint( RenderHint, bool on = true );
+    bool testRenderHint( RenderHint ) const;
+
+    void setRenderThreadCount( uint numThreads );
+    uint renderThreadCount() const;
+
+    double z() const;
+    void setZ( double z );
+
+    void show();
+    void hide();
+    virtual void setVisible( bool );
+    bool isVisible () const;
+
+    virtual void itemChanged();
+    virtual void legendChanged();
+
+    /*!
+       \brief Draw the item
+
+       \param painter Painter
+       \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+       \param radialMap Maps radius values into painter coordinates.
+       \param pole Position of the pole in painter coordinates
+       \param radius Radius of the complete plot area in painter coordinates
+       \param canvasRect Contents rect of the canvas in painter coordinates
+     */
+    virtual void draw( QPainter* painter,
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, double radius,
+        const QRectF& canvasRect ) const = 0;
+
+    virtual QwtInterval boundingInterval( int scaleId ) const;
+
+    virtual void updateScaleDiv( const QwtScaleDiv&,
+        const QwtScaleDiv&, const QwtInterval& );
+
+    virtual int marginHint() const;
+
+    void setLegendIconSize( const QSize& );
+    QSize legendIconSize() const;
+
+    virtual QList< QwtLegendData > legendData() const;
+    virtual QwtGraphic legendIcon( int index, const QSizeF& ) const;
+
+  private:
+    Q_DISABLE_COPY( QwtPolarItem )
+
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarItem::ItemAttributes )
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarItem::RenderHints )
+
+Q_DECLARE_METATYPE( QwtPolarItem* )
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_itemdict.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_itemdict.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_itemdict.cpp	(revision 11158)
@@ -0,0 +1,171 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_itemdict.h"
+
+class QwtPolarItemDict::PrivateData
+{
+  public:
+    class ItemList : public QList< QwtPolarItem* >
+    {
+      public:
+        void insertItem( QwtPolarItem* item )
+        {
+            if ( item == NULL )
+                return;
+
+            // Unfortunately there is no inSort operation
+            // for lists in Qt4. The implementation below
+            // is slow, but there shouldn't be many plot items.
+
+            QList< QwtPolarItem* >::Iterator it;
+            for ( it = begin(); it != end(); ++it )
+            {
+                if ( *it == item )
+                    return;
+
+                if ( ( *it )->z() > item->z() )
+                {
+                    insert( it, item );
+                    return;
+                }
+            }
+            append( item );
+        }
+
+        void removeItem( QwtPolarItem* item )
+        {
+            if ( item == NULL )
+                return;
+
+            int i = 0;
+
+            QList< QwtPolarItem* >::Iterator it;
+            for ( it = begin(); it != end(); ++it )
+            {
+                if ( item == *it )
+                {
+                    removeAt( i );
+                    return;
+                }
+                i++;
+            }
+        }
+    };
+
+    ItemList itemList;
+    bool autoDelete;
+};
+
+/*!
+   Constructor
+
+   Auto deletion is enabled.
+   \sa setAutoDelete, attachItem
+ */
+QwtPolarItemDict::QwtPolarItemDict()
+{
+    m_data = new QwtPolarItemDict::PrivateData;
+    m_data->autoDelete = true;
+}
+
+/*!
+   Destructor
+
+   If autoDelete is on, all attached items will be deleted
+   \sa setAutoDelete, autoDelete, attachItem
+ */
+QwtPolarItemDict::~QwtPolarItemDict()
+{
+    detachItems( QwtPolarItem::Rtti_PolarItem, m_data->autoDelete );
+    delete m_data;
+}
+
+/*!
+   En/Disable Auto deletion
+
+   If Auto deletion is on all attached plot items will be deleted
+   in the destructor of QwtPolarItemDict. The default value is on.
+
+   \sa autoDelete, attachItem
+ */
+void QwtPolarItemDict::setAutoDelete( bool autoDelete )
+{
+    m_data->autoDelete = autoDelete;
+}
+
+/*!
+   \return true if auto deletion is enabled
+   \sa setAutoDelete, attachItem
+ */
+bool QwtPolarItemDict::autoDelete() const
+{
+    return m_data->autoDelete;
+}
+
+/*!
+   Insert a plot item
+
+   \param item PlotItem
+   \sa removeItem()
+ */
+void QwtPolarItemDict::insertItem( QwtPolarItem* item )
+{
+    m_data->itemList.insertItem( item );
+}
+
+/*!
+   Remove a plot item
+
+   \param item PlotItem
+   \sa insertItem()
+ */
+void QwtPolarItemDict::removeItem( QwtPolarItem* item )
+{
+    m_data->itemList.removeItem( item );
+}
+
+/*!
+   Detach items from the dictionary
+
+   \param rtti In case of QwtPolarItem::Rtti_PlotItem detach all items
+               otherwise only those items of the type rtti.
+   \param autoDelete If true, delete all detached items
+ */
+void QwtPolarItemDict::detachItems( int rtti, bool autoDelete )
+{
+    PrivateData::ItemList list = m_data->itemList;
+    QwtPolarItemIterator it = list.constBegin();
+    while ( it != list.constEnd() )
+    {
+        QwtPolarItem* item = *it;
+
+        ++it; // increment before removing item from the list
+
+        if ( rtti == QwtPolarItem::Rtti_PolarItem || item->rtti() == rtti )
+        {
+            item->attach( NULL );
+            if ( autoDelete )
+                delete item;
+        }
+    }
+}
+
+/*!
+   \brief A QwtPolarItemList of all attached plot items.
+
+   \return List of all attached plot items.
+   \note Use caution when iterating these lists, as removing/detaching
+        an item will invalidate the iterator.
+        Instead you can place pointers to objects to be
+        removed in a removal list, and traverse that list later.
+ */
+const QwtPolarItemList& QwtPolarItemDict::itemList() const
+{
+    return m_data->itemList;
+}
Index: /trunk/BNC/qwt/qwt_polar_itemdict.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_itemdict.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_itemdict.h	(revision 11158)
@@ -0,0 +1,51 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_ITEMDICT_H
+#define QWT_POLAR_ITEMDICT_H
+
+#include "qwt_global.h"
+#include "qwt_polar_item.h"
+#include <qlist.h>
+
+typedef QList< QwtPolarItem* >::ConstIterator QwtPolarItemIterator;
+typedef QList< QwtPolarItem* > QwtPolarItemList;
+
+/*!
+   \brief A dictionary for polar plot items
+
+   QwtPolarItemDict organizes polar plot items in increasing z-order.
+   If autoDelete() is enabled, all attached items will be deleted
+   in the destructor of the dictionary.
+
+   \sa QwtPolarItem::attach(), QwtPolarItem::detach(), QwtPolarItem::z()
+ */
+class QWT_EXPORT QwtPolarItemDict
+{
+  public:
+    explicit QwtPolarItemDict();
+    ~QwtPolarItemDict();
+
+    void setAutoDelete( bool );
+    bool autoDelete() const;
+
+    const QwtPolarItemList& itemList() const;
+
+    void detachItems( int rtti = QwtPolarItem::Rtti_PolarItem,
+        bool autoDelete = true );
+
+  protected:
+    void insertItem( QwtPolarItem* );
+    void removeItem( QwtPolarItem* );
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_layout.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_layout.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_layout.cpp	(revision 11158)
@@ -0,0 +1,443 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_layout.h"
+#include "qwt_polar_plot.h"
+#include "qwt_polar_canvas.h"
+#include "qwt_text.h"
+#include "qwt_text_label.h"
+#include "qwt_legend.h"
+
+class QwtPolarLayout::LayoutData
+{
+  public:
+    void init( const QwtPolarPlot*, const QRectF& rect );
+
+    struct t_legendData
+    {
+        int frameWidth;
+        int hScrollExtent;
+        int vScrollExtent;
+        QSizeF hint;
+    } legend;
+
+    struct t_titleData
+    {
+        QwtText text;
+        int frameWidth;
+    } title;
+
+    struct t_canvasData
+    {
+        int frameWidth;
+    } canvas;
+};
+
+void QwtPolarLayout::LayoutData::init(
+    const QwtPolarPlot* plot, const QRectF& rect )
+{
+    // legend
+
+    if ( plot->plotLayout()->legendPosition() != QwtPolarPlot::ExternalLegend
+        && plot->legend() )
+    {
+        legend.frameWidth = plot->legend()->frameWidth();
+        legend.hScrollExtent =
+            plot->legend()->scrollExtent( Qt::Horizontal );
+        legend.vScrollExtent =
+            plot->legend()->scrollExtent( Qt::Vertical );
+
+        const QSizeF hint = plot->legend()->sizeHint();
+
+        double w = qMin( hint.width(), rect.width() );
+        double h = plot->legend()->heightForWidth( w );
+        if ( h == 0.0 )
+            h = hint.height();
+
+        if ( h > rect.height() )
+            w += legend.hScrollExtent;
+
+        legend.hint = QSizeF( w, h );
+    }
+
+    // title
+
+    title.frameWidth = 0;
+    title.text = QwtText();
+
+    if ( plot->titleLabel() )
+    {
+        const QwtTextLabel* label = plot->titleLabel();
+        title.text = label->text();
+        if ( !( title.text.testPaintAttribute( QwtText::PaintUsingTextFont ) ) )
+            title.text.setFont( label->font() );
+
+        title.frameWidth = plot->titleLabel()->frameWidth();
+    }
+
+    // canvas
+
+    canvas.frameWidth = plot->canvas()->frameWidth();
+}
+
+class QwtPolarLayout::PrivateData
+{
+  public:
+    PrivateData()
+        : margin( 0 )
+        , spacing( 0 )
+    {
+    }
+
+    QRectF titleRect;
+    QRectF legendRect;
+    QRectF canvasRect;
+
+    QwtPolarLayout::LayoutData layoutData;
+
+    QwtPolarPlot::LegendPosition legendPos;
+    double legendRatio;
+
+    unsigned int margin;
+    unsigned int spacing;
+};
+
+/*!
+   \brief Constructor
+ */
+
+QwtPolarLayout::QwtPolarLayout()
+{
+    m_data = new PrivateData;
+
+    setLegendPosition( QwtPolarPlot::BottomLegend );
+    invalidate();
+}
+
+//! Destructor
+QwtPolarLayout::~QwtPolarLayout()
+{
+    delete m_data;
+}
+
+/*!
+   \brief Specify the position of the legend
+   \param pos The legend's position.
+   \param ratio Ratio between legend and the bounding rect
+               of title, canvas and axes. The legend will be shrunk
+               if it would need more space than the given ratio.
+               The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0
+               it will be reset to the default ratio.
+               The default vertical/horizontal ratio is 0.33/0.5.
+
+   \sa QwtPolarPlot::setLegendPosition()
+ */
+
+void QwtPolarLayout::setLegendPosition(
+    QwtPolarPlot::LegendPosition pos, double ratio )
+{
+    if ( ratio > 1.0 )
+        ratio = 1.0;
+
+    switch( pos )
+    {
+        case QwtPolarPlot::TopLegend:
+        case QwtPolarPlot::BottomLegend:
+        {
+            if ( ratio <= 0.0 )
+                ratio = 0.33;
+            m_data->legendRatio = ratio;
+            m_data->legendPos = pos;
+            break;
+        }
+        case QwtPolarPlot::LeftLegend:
+        case QwtPolarPlot::RightLegend:
+        {
+            if ( ratio <= 0.0 )
+                ratio = 0.5;
+            m_data->legendRatio = ratio;
+            m_data->legendPos = pos;
+            break;
+        }
+        case QwtPolarPlot::ExternalLegend:
+        {
+            m_data->legendRatio = ratio; // meaningless
+            m_data->legendPos = pos;
+            break;
+        }
+        default:
+            break;
+    }
+}
+
+/*!
+   \brief Specify the position of the legend
+   \param pos The legend's position. Valid values are
+      \c QwtPolarPlot::LeftLegend, \c QwtPolarPlot::RightLegend,
+      \c QwtPolarPlot::TopLegend, \c QwtPolarPlot::BottomLegend.
+
+   \sa QwtPolarPlot::setLegendPosition()
+ */
+void QwtPolarLayout::setLegendPosition( QwtPolarPlot::LegendPosition pos )
+{
+    setLegendPosition( pos, 0.0 );
+}
+
+/*!
+   \return Position of the legend
+   \sa setLegendPosition(), QwtPolarPlot::setLegendPosition(),
+      QwtPolarPlot::legendPosition()
+ */
+QwtPolarPlot::LegendPosition QwtPolarLayout::legendPosition() const
+{
+    return m_data->legendPos;
+}
+
+/*!
+   Specify the relative size of the legend in the plot
+   \param ratio Ratio between legend and the bounding rect
+               of title, canvas and axes. The legend will be shrunk
+               if it would need more space than the given ratio.
+               The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0
+               it will be reset to the default ratio.
+               The default vertical/horizontal ratio is 0.33/0.5.
+ */
+void QwtPolarLayout::setLegendRatio( double ratio )
+{
+    setLegendPosition( legendPosition(), ratio );
+}
+
+/*!
+   \return The relative size of the legend in the plot.
+   \sa setLegendPosition()
+ */
+double QwtPolarLayout::legendRatio() const
+{
+    return m_data->legendRatio;
+}
+
+/*!
+   \return Geometry for the title
+   \sa activate(), invalidate()
+ */
+
+const QRectF& QwtPolarLayout::titleRect() const
+{
+    return m_data->titleRect;
+}
+
+/*!
+   \return Geometry for the legend
+   \sa activate(), invalidate()
+ */
+
+const QRectF& QwtPolarLayout::legendRect() const
+{
+    return m_data->legendRect;
+}
+
+/*!
+   \return Geometry for the canvas
+   \sa activate(), invalidate()
+ */
+const QRectF& QwtPolarLayout::canvasRect() const
+{
+    return m_data->canvasRect;
+}
+
+/*!
+   Invalidate the geometry of all components.
+   \sa activate()
+ */
+void QwtPolarLayout::invalidate()
+{
+    m_data->titleRect = m_data->legendRect = m_data->canvasRect = QRect();
+}
+
+/*!
+   Find the geometry for the legend
+   \param options Options how to layout the legend
+   \param rect Rectangle where to place the legend
+   \return Geometry for the legend
+ */
+
+QRectF QwtPolarLayout::layoutLegend( Options options, QRectF& rect ) const
+{
+    const QSizeF hint( m_data->layoutData.legend.hint );
+
+    int dim;
+    if ( m_data->legendPos == QwtPolarPlot::LeftLegend
+        || m_data->legendPos == QwtPolarPlot::RightLegend )
+    {
+        // We don't allow vertical legends to take more than
+        // half of the available space.
+
+        dim = qMin( double( hint.width() ), rect.width() * m_data->legendRatio );
+
+        if ( !( options & IgnoreScrollbars ) )
+        {
+            if ( hint.height() > rect.height() )
+            {
+                // The legend will need additional
+                // space for the vertical scrollbar.
+
+                dim += m_data->layoutData.legend.hScrollExtent;
+            }
+        }
+    }
+    else
+    {
+        dim = qMin( double( hint.height() ), rect.height() * m_data->legendRatio );
+        dim = qMax( dim, m_data->layoutData.legend.vScrollExtent );
+    }
+
+    QRectF legendRect = rect;
+    switch( m_data->legendPos )
+    {
+        case QwtPolarPlot::LeftLegend:
+        {
+            legendRect.setWidth( dim );
+            rect.setLeft( legendRect.right() );
+            break;
+        }
+        case QwtPolarPlot::RightLegend:
+        {
+            legendRect.setX( rect.right() - dim + 1 );
+            legendRect.setWidth( dim );
+            rect.setRight( legendRect.left() );
+            break;
+        }
+        case QwtPolarPlot::TopLegend:
+        {
+            legendRect.setHeight( dim );
+            rect.setTop( legendRect.bottom() );
+            break;
+        }
+        case QwtPolarPlot::BottomLegend:
+        {
+            legendRect.setY( rect.bottom() - dim + 1 );
+            legendRect.setHeight( dim );
+            rect.setBottom( legendRect.top() );
+            break;
+        }
+        case QwtPolarPlot::ExternalLegend:
+            break;
+    }
+
+    return legendRect;
+}
+
+/*!
+   \brief Recalculate the geometry of all components.
+
+   \param plot Plot to be layout
+   \param boundingRect Rect where to place the components
+   \param options Options
+
+   \sa invalidate(), titleRect(), legendRect(), canvasRect()
+ */
+void QwtPolarLayout::activate( const QwtPolarPlot* plot,
+    const QRectF& boundingRect, Options options )
+{
+    invalidate();
+
+    QRectF rect( boundingRect ); // undistributed rest of the plot rect
+    rect.adjust( m_data->margin, m_data->margin,
+        -m_data->margin, -m_data->margin );
+
+    // We extract all layout relevant data from the widgets
+    // and save them to m_data->layoutData.
+
+    m_data->layoutData.init( plot, rect );
+    if ( !( options & IgnoreLegend )
+        && m_data->legendPos != QwtPolarPlot::ExternalLegend
+        && plot->legend() && !plot->legend()->isEmpty() )
+    {
+        m_data->legendRect = layoutLegend( options, rect );
+        if ( m_data->layoutData.legend.frameWidth &&
+            !( options & IgnoreFrames ) )
+        {
+            // In case of a frame we have to insert a spacing.
+            // Otherwise the leading of the font separates
+            // legend and scale/canvas
+
+            switch( m_data->legendPos )
+            {
+                case QwtPolarPlot::LeftLegend:
+                    rect.setLeft( rect.left() + m_data->spacing );
+                    break;
+
+                case QwtPolarPlot::RightLegend:
+                    rect.setRight( rect.right() - m_data->spacing );
+                    break;
+
+                case QwtPolarPlot::TopLegend:
+                    rect.setTop( rect.top() + m_data->spacing );
+                    break;
+
+                case QwtPolarPlot::BottomLegend:
+                    rect.setBottom( rect.bottom() - m_data->spacing );
+                    break;
+
+                case QwtPolarPlot::ExternalLegend:
+                    break; // suppress compiler warning
+            }
+        }
+    }
+
+    if ( !( options & IgnoreTitle ) &&
+        !m_data->layoutData.title.text.isEmpty() )
+    {
+        int h = m_data->layoutData.title.text.heightForWidth( rect.width() );
+        if ( !( options & IgnoreFrames ) )
+            h += 2 * m_data->layoutData.title.frameWidth;
+
+        m_data->titleRect = QRectF( rect.x(), rect.y(), rect.width(), h );
+
+        // subtract title
+        rect.setTop( rect.top() + h + m_data->spacing );
+    }
+
+    if ( plot->zoomPos().radius() > 0.0 || plot->zoomFactor() < 1.0 )
+    {
+        // In zoomed state we have no idea about the geometry that
+        // is best for the plot. So we use the complete rectangle
+        // accepting, that there might a lot of space wasted
+        // around the plot.
+
+        m_data->canvasRect = rect;
+    }
+    else
+    {
+        // In full state we know, that we want
+        // to display something circular.
+
+        const int dim = qMin( rect.width(), rect.height() );
+
+        m_data->canvasRect.setX( rect.center().x() - dim / 2 );
+        m_data->canvasRect.setY( rect.y() );
+        m_data->canvasRect.setSize( QSize( dim, dim ) );
+    }
+
+    if ( !m_data->legendRect.isEmpty() )
+    {
+        if ( m_data->legendPos == QwtPolarPlot::LeftLegend
+            || m_data->legendPos == QwtPolarPlot::RightLegend )
+        {
+            // We prefer to align the legend to the canvas - not to
+            // the complete plot - if possible.
+
+            if ( m_data->layoutData.legend.hint.height()
+                < m_data->canvasRect.height() )
+            {
+                m_data->legendRect.setY( m_data->canvasRect.y() );
+                m_data->legendRect.setHeight( m_data->canvasRect.height() );
+            }
+        }
+    }
+}
Index: /trunk/BNC/qwt/qwt_polar_layout.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_layout.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_layout.h	(revision 11158)
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_LAYOUT_H
+#define QWT_POLAR_LAYOUT_H
+
+#include "qwt_global.h"
+#include "qwt_polar_plot.h"
+
+/*!
+   \brief Layout class for QwtPolarPlot.
+
+   Organizes the geometry for the different QwtPolarPlot components.
+   It is used by the QwtPolar widget to organize its internal widgets
+   or by QwtPolarRnderer to render its content to a QPaintDevice like
+   a QPrinter, QPixmap/QImage or QSvgRenderer.
+ */
+class QWT_EXPORT QwtPolarLayout
+{
+  public:
+
+    //! \brief Options to configure the plot layout engine
+    enum Option
+    {
+        //! Ignore the dimension of the scrollbars.
+        IgnoreScrollbars = 0x01,
+
+        //! Ignore all frames.
+        IgnoreFrames     = 0x02,
+
+        //! Ignore the title.
+        IgnoreTitle      = 0x04,
+
+        //! Ignore the legend.
+        IgnoreLegend     = 0x08
+    };
+
+    Q_DECLARE_FLAGS( Options, Option )
+
+    explicit QwtPolarLayout();
+    virtual ~QwtPolarLayout();
+
+    void setLegendPosition( QwtPolarPlot::LegendPosition pos, double ratio );
+    void setLegendPosition( QwtPolarPlot::LegendPosition pos );
+    QwtPolarPlot::LegendPosition legendPosition() const;
+
+    void setLegendRatio( double ratio );
+    double legendRatio() const;
+
+    virtual void activate( const QwtPolarPlot*,
+        const QRectF& rect, Options options = Options() );
+
+    virtual void invalidate();
+
+    const QRectF& titleRect() const;
+    const QRectF& legendRect() const;
+    const QRectF& canvasRect() const;
+
+    class LayoutData;
+
+  protected:
+    QRectF layoutLegend( Options options, QRectF& ) const;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarLayout::Options )
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_magnifier.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_magnifier.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_magnifier.cpp	(revision 11158)
@@ -0,0 +1,170 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_magnifier.h"
+#include "qwt_polar_plot.h"
+#include "qwt_polar_canvas.h"
+#include "qwt_scale_div.h"
+#include "qwt_point_polar.h"
+
+#include <qevent.h>
+
+class QwtPolarMagnifier::PrivateData
+{
+  public:
+    PrivateData()
+        : unzoomKey( Qt::Key_Home )
+        , unzoomKeyModifiers( Qt::NoModifier )
+    {
+    }
+
+    int unzoomKey;
+    int unzoomKeyModifiers;
+};
+
+/*!
+   Constructor
+   \param canvas Plot canvas to be magnified
+ */
+QwtPolarMagnifier::QwtPolarMagnifier( QwtPolarCanvas* canvas )
+    : QwtMagnifier( canvas )
+{
+    m_data = new PrivateData();
+}
+
+//! Destructor
+QwtPolarMagnifier::~QwtPolarMagnifier()
+{
+    delete m_data;
+}
+
+/*!
+   Assign key and modifiers, that are used for unzooming
+   The default combination is Qt::Key_Home + Qt::NoModifier.
+
+   \param key Key code
+   \param modifiers Modifiers
+   \sa getUnzoomKey(), QwtPolarPlot::unzoom()
+ */
+void QwtPolarMagnifier::setUnzoomKey( int key, int modifiers )
+{
+    m_data->unzoomKey = key;
+    m_data->unzoomKeyModifiers = modifiers;
+}
+
+/*!
+   Return key, and modifiers that are used for unzooming
+
+   \param key Key code
+   \param modifiers Modifiers
+   \sa setUnzoomKey(), QwtPolarPlot::unzoom()
+ */
+void QwtPolarMagnifier::getUnzoomKey( int& key, int& modifiers ) const
+{
+    key = m_data->unzoomKey;
+    modifiers = m_data->unzoomKeyModifiers;
+}
+
+//! \return Observed plot canvas
+QwtPolarCanvas* QwtPolarMagnifier::canvas()
+{
+    return qobject_cast< QwtPolarCanvas* >( parent() );
+}
+
+//! \return Observed plot canvas
+const QwtPolarCanvas* QwtPolarMagnifier::canvas() const
+{
+    return qobject_cast< QwtPolarCanvas* >( parent() );
+}
+
+//! \return Observed plot
+QwtPolarPlot* QwtPolarMagnifier::plot()
+{
+    QwtPolarCanvas* c = canvas();
+    if ( c )
+        return c->plot();
+
+    return NULL;
+}
+
+//! \return observed plot
+const QwtPolarPlot* QwtPolarMagnifier::plot() const
+{
+    const QwtPolarCanvas* c = canvas();
+    if ( c )
+        return c->plot();
+
+    return NULL;
+}
+
+/*!
+   Handle a key press event for the observed widget.
+
+   \param event Key event
+ */
+void QwtPolarMagnifier::widgetKeyPressEvent( QKeyEvent* event )
+{
+    const int key = event->key();
+    const int state = event->modifiers();
+
+    if ( key == m_data->unzoomKey &&
+        state == m_data->unzoomKeyModifiers )
+    {
+        unzoom();
+        return;
+    }
+
+    QwtMagnifier::widgetKeyPressEvent( event );
+}
+
+/*!
+   Zoom in/out the zoomed area
+   \param factor A value < 1.0 zooms in, a value > 1.0 zooms out.
+ */
+void QwtPolarMagnifier::rescale( double factor )
+{
+    factor = qAbs( factor );
+    if ( factor == 1.0 || factor == 0.0 )
+        return;
+
+    QwtPolarPlot* plt = plot();
+    if ( plt == NULL )
+        return;
+
+    QwtPointPolar zoomPos;
+    double newZoomFactor = plt->zoomFactor() * factor;
+
+    if ( newZoomFactor >= 1.0 )
+        newZoomFactor = 1.0;
+    else
+        zoomPos = plt->zoomPos();
+
+    const bool autoReplot = plt->autoReplot();
+    plt->setAutoReplot( false );
+
+    plt->zoom( zoomPos, newZoomFactor );
+
+    plt->setAutoReplot( autoReplot );
+    plt->replot();
+}
+
+//! Unzoom the plot widget
+void QwtPolarMagnifier::unzoom()
+{
+    QwtPolarPlot* plt = plot();
+
+    const bool autoReplot = plt->autoReplot();
+    plt->setAutoReplot( false );
+
+    plt->unzoom();
+
+    plt->setAutoReplot( autoReplot );
+    plt->replot();
+}
+
+#include "moc_qwt_polar_magnifier.cpp"
Index: /trunk/BNC/qwt/qwt_polar_magnifier.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_magnifier.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_magnifier.h	(revision 11158)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_MAGNIFIER_H
+#define QWT_POLAR_MAGNIFIER_H
+
+#include "qwt_global.h"
+#include "qwt_magnifier.h"
+
+class QwtPolarPlot;
+class QwtPolarCanvas;
+
+/*!
+   \brief QwtPolarMagnifier provides zooming, by magnifying in steps.
+
+   Using QwtPlotMagnifier a plot can be zoomed in/out in steps using
+   keys, the mouse wheel or moving a mouse button in vertical direction.
+
+   Together with QwtPolarPanner it is possible to implement
+   an individual navigation of the plot canvas.
+
+   \sa QwtPolarPanner, QwtPolarPlot, QwtPolarCanvas
+ */
+
+class QWT_EXPORT QwtPolarMagnifier : public QwtMagnifier
+{
+    Q_OBJECT
+
+  public:
+    explicit QwtPolarMagnifier( QwtPolarCanvas* );
+    virtual ~QwtPolarMagnifier();
+
+    void setUnzoomKey( int key, int modifiers );
+    void getUnzoomKey( int& key, int& modifiers ) const;
+
+    QwtPolarPlot* plot();
+    const QwtPolarPlot* plot() const;
+
+    QwtPolarCanvas* canvas();
+    const QwtPolarCanvas* canvas() const;
+
+  public Q_SLOTS:
+    virtual void rescale( double factor ) QWT_OVERRIDE;
+    void unzoom();
+
+  protected:
+    virtual void widgetKeyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_marker.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_marker.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_marker.cpp	(revision 11158)
@@ -0,0 +1,234 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_marker.h"
+#include "qwt_polar.h"
+#include "qwt_scale_map.h"
+#include "qwt_symbol.h"
+#include "qwt_text.h"
+
+#include <qpainter.h>
+
+static const int LabelDist = 2;
+
+class QwtPolarMarker::PrivateData
+{
+  public:
+    PrivateData()
+        : align( Qt::AlignCenter )
+    {
+        symbol = new QwtSymbol();
+    }
+
+    ~PrivateData()
+    {
+        delete symbol;
+    }
+
+    QwtText label;
+    Qt::Alignment align;
+    QPen pen;
+    const QwtSymbol* symbol;
+
+    QwtPointPolar pos;
+};
+
+//! Sets alignment to Qt::AlignCenter, and style to NoLine
+QwtPolarMarker::QwtPolarMarker()
+    : QwtPolarItem( QwtText( "Marker" ) )
+{
+    m_data = new PrivateData;
+
+    setItemAttribute( QwtPolarItem::AutoScale );
+    setZ( 30.0 );
+}
+
+//! Destructor
+QwtPolarMarker::~QwtPolarMarker()
+{
+    delete m_data;
+}
+
+//! \return QwtPolarItem::Rtti_PlotMarker
+int QwtPolarMarker::rtti() const
+{
+    return QwtPolarItem::Rtti_PolarMarker;
+}
+
+//! \return Position of the marker
+QwtPointPolar QwtPolarMarker::position() const
+{
+    return m_data->pos;
+}
+
+//! Change the position of the marker
+void QwtPolarMarker::setPosition( const QwtPointPolar& pos )
+{
+    if ( m_data->pos != pos )
+    {
+        m_data->pos = pos;
+        itemChanged();
+    }
+}
+
+/*!
+   Draw the marker
+
+   \param painter Painter
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param radius Radius of the complete plot area in painter coordinates
+   \param canvasRect Contents rect of the canvas in painter coordinates
+ */
+void QwtPolarMarker::draw( QPainter* painter,
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, double radius,
+    const QRectF& canvasRect ) const
+{
+    Q_UNUSED( radius );
+    Q_UNUSED( canvasRect );
+
+    const double r = radialMap.transform( m_data->pos.radius() );
+    const double a = azimuthMap.transform( m_data->pos.azimuth() );
+
+    const QPointF pos = qwtPolar2Pos( pole, r, a );
+
+
+    // draw symbol
+    QSize sSym( 0, 0 );
+    if ( m_data->symbol->style() != QwtSymbol::NoSymbol )
+    {
+        sSym = m_data->symbol->size();
+        m_data->symbol->drawSymbol( painter, pos );
+    }
+
+    // draw label
+    if ( !m_data->label.isEmpty() )
+    {
+        int xlw = qMax( int( m_data->pen.width() ), 1 );
+        int ylw = xlw;
+
+        int xlw1 = qMax( ( xlw + 1 ) / 2, ( sSym.width() + 1 ) / 2 ) + LabelDist;
+        xlw = qMax( xlw / 2, ( sSym.width() + 1 ) / 2 ) + LabelDist;
+        int ylw1 = qMax( ( ylw + 1 ) / 2, ( sSym.height() + 1 ) / 2 ) + LabelDist;
+        ylw = qMax( ylw / 2, ( sSym.height() + 1 ) / 2 ) + LabelDist;
+
+        QRect tr( QPoint( 0, 0 ), m_data->label.textSize( painter->font() ).toSize() );
+        tr.moveCenter( QPoint( 0, 0 ) );
+
+        int dx = pos.x();
+        int dy = pos.y();
+
+        if ( m_data->align & Qt::AlignTop )
+            dy += tr.y() - ylw1;
+        else if ( m_data->align & Qt::AlignBottom )
+            dy -= tr.y() - ylw1;
+
+        if ( m_data->align & Qt::AlignLeft )
+            dx += tr.x() - xlw1;
+        else if ( m_data->align & Qt::AlignRight )
+            dx -= tr.x() - xlw1;
+
+        tr.translate( dx, dy );
+        m_data->label.draw( painter, tr );
+    }
+}
+
+/*!
+   \brief Assign a symbol
+   \param symbol New symbol
+   \sa symbol()
+ */
+void QwtPolarMarker::setSymbol( const QwtSymbol* symbol )
+{
+    if ( m_data->symbol != symbol )
+    {
+        delete m_data->symbol;
+        m_data->symbol = symbol;
+        itemChanged();
+    }
+}
+
+/*!
+   \return the symbol
+   \sa setSymbol(), QwtSymbol
+ */
+const QwtSymbol* QwtPolarMarker::symbol() const
+{
+    return m_data->symbol;
+}
+
+/*!
+   \brief Set the label
+   \param label label text
+   \sa label()
+ */
+void QwtPolarMarker::setLabel( const QwtText& label )
+{
+    if ( label != m_data->label )
+    {
+        m_data->label = label;
+        itemChanged();
+    }
+}
+
+/*!
+   \return the label
+   \sa setLabel()
+ */
+QwtText QwtPolarMarker::label() const
+{
+    return m_data->label;
+}
+
+/*!
+   \brief Set the alignment of the label
+
+   The alignment determines where the label is drawn relative to
+   the marker's position.
+
+   \param align Alignment. A combination of AlignTop, AlignBottom,
+    AlignLeft, AlignRight, AlignCenter, AlgnHCenter,
+    AlignVCenter.
+   \sa labelAlignment()
+ */
+void QwtPolarMarker::setLabelAlignment( Qt::Alignment align )
+{
+    if ( align == m_data->align )
+        return;
+
+    m_data->align = align;
+    itemChanged();
+}
+
+/*!
+   \return the label alignment
+   \sa setLabelAlignment()
+ */
+Qt::Alignment QwtPolarMarker::labelAlignment() const
+{
+    return m_data->align;
+}
+
+/*!
+   Interval, that is necessary to display the item
+   This interval can be useful for operations like clipping or autoscaling
+
+   \param scaleId Scale index
+   \return bounding interval ( == position )
+
+   \sa position()
+ */
+QwtInterval QwtPolarMarker::boundingInterval( int scaleId ) const
+{
+    const double v = ( scaleId == QwtPolar::ScaleRadius )
+        ? m_data->pos.radius() : m_data->pos.azimuth();
+
+    return QwtInterval( v, v );
+}
Index: /trunk/BNC/qwt/qwt_polar_marker.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_marker.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_marker.h	(revision 11158)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_MARKER_H
+#define QWT_POLAR_MARKER_H
+
+#include "qwt_global.h"
+#include "qwt_polar_item.h"
+#include "qwt_point_polar.h"
+
+class QRect;
+class QwtText;
+class QwtSymbol;
+
+/*!
+   \brief A class for drawing markers
+
+   A marker can be a a symbol, a label or a combination of them, which can
+   be drawn around a center point inside a bounding rectangle.
+
+   The setSymbol() member assigns a symbol to the marker.
+   The symbol is drawn at the specified point.
+
+   With setLabel(), a label can be assigned to the marker.
+   The setLabelAlignment() member specifies where the label is
+   drawn. All the Align*-constants in Qt::AlignmentFlags (see Qt documentation)
+   are valid. The alignment refers to the center point of
+   the marker, which means, for example, that the label would be painted
+   left above the center point if the alignment was set to AlignLeft|AlignTop.
+ */
+class QWT_EXPORT QwtPolarMarker : public QwtPolarItem
+{
+  public:
+    explicit QwtPolarMarker();
+    virtual ~QwtPolarMarker();
+
+    virtual int rtti() const QWT_OVERRIDE;
+
+    void setPosition( const QwtPointPolar& );
+    QwtPointPolar position() const;
+
+    void setSymbol( const QwtSymbol* s );
+    const QwtSymbol* symbol() const;
+
+    void setLabel( const QwtText& );
+    QwtText label() const;
+
+    void setLabelAlignment( Qt::Alignment );
+    Qt::Alignment labelAlignment() const;
+
+    virtual void draw( QPainter* painter,
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, double radius,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
+
+    virtual QwtInterval boundingInterval( int scaleId ) const QWT_OVERRIDE;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_panner.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_panner.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_panner.cpp	(revision 11158)
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_panner.h"
+#include "qwt_polar_plot.h"
+#include "qwt_polar_canvas.h"
+#include "qwt_scale_div.h"
+#include "qwt_point_polar.h"
+
+//! Create a plot panner for a polar plot canvas
+QwtPolarPanner::QwtPolarPanner( QwtPolarCanvas* canvas )
+    : QwtPanner( canvas )
+{
+    connect( this, SIGNAL(panned(int,int)),
+        SLOT(movePlot(int,int)) );
+}
+
+//! Destructor
+QwtPolarPanner::~QwtPolarPanner()
+{
+}
+
+//! \return observed plot canvas
+QwtPolarCanvas* QwtPolarPanner::canvas()
+{
+    return qobject_cast< QwtPolarCanvas* >( parent() );
+}
+
+//! \return observed plot canvas
+const QwtPolarCanvas* QwtPolarPanner::canvas() const
+{
+    return qobject_cast< const QwtPolarCanvas* >( parent() );
+}
+
+//! \return observed plot
+QwtPolarPlot* QwtPolarPanner::plot()
+{
+    QwtPolarCanvas* c = canvas();
+    if ( c )
+        return c->plot();
+
+    return NULL;
+}
+
+//! \return observed plot
+const QwtPolarPlot* QwtPolarPanner::plot() const
+{
+    const QwtPolarCanvas* c = canvas();
+    if ( c )
+        return c->plot();
+
+    return NULL;
+}
+
+/*!
+   Adjust the zoomed area according to dx/dy
+
+   \param dx Pixel offset in x direction
+   \param dy Pixel offset in y direction
+
+   \sa QwtPanner::panned(), QwtPolarPlot::zoom()
+ */
+void QwtPolarPanner::movePlot( int dx, int dy )
+{
+    QwtPolarPlot* plot = QwtPolarPanner::plot();
+    if ( plot == NULL || ( dx == 0 && dy == 0 ) )
+        return;
+
+    const QwtScaleMap map = plot->scaleMap( QwtPolar::Radius );
+
+    QwtPointPolar pos = plot->zoomPos();
+    if ( map.s1() <= map.s2() )
+    {
+        pos.setRadius(
+            map.transform( map.s1() + pos.radius() ) - map.p1() );
+        pos.setPoint( pos.toPoint() - QPointF( dx, -dy ) );
+        pos.setRadius(
+            map.invTransform( map.p1() + pos.radius() ) - map.s1() );
+    }
+    else
+    {
+        pos.setRadius(
+            map.transform( map.s1() - pos.radius() ) - map.p1() );
+        pos.setPoint( pos.toPoint() - QPointF( dx, -dy ) );
+        pos.setRadius(
+            map.s1() - map.invTransform( map.p1() + pos.radius() ) );
+    }
+
+    const bool doAutoReplot = plot->autoReplot();
+    plot->setAutoReplot( false );
+
+    plot->zoom( pos, plot->zoomFactor() );
+
+    plot->setAutoReplot( doAutoReplot );
+    plot->replot();
+}
+
+/*!
+   Block panning when the plot zoom factor is >= 1.0.
+
+   \param event Mouse event
+ */
+void QwtPolarPanner::widgetMousePressEvent( QMouseEvent* event )
+{
+    const QwtPolarPlot* plot = QwtPolarPanner::plot();
+    if ( plot )
+    {
+        if ( plot->zoomFactor() < 1.0 )
+            QwtPanner::widgetMousePressEvent( event );
+    }
+}
+
+#include "moc_qwt_polar_panner.cpp"
Index: /trunk/BNC/qwt/qwt_polar_panner.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_panner.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_panner.h	(revision 11158)
@@ -0,0 +1,51 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_PANNER_H
+#define QWT_POLAR_PANNER_H
+
+#include "qwt_global.h"
+#include "qwt_panner.h"
+
+class QwtPolarPlot;
+class QwtPolarCanvas;
+
+/*!
+   \brief QwtPolarPanner provides panning of a polar plot canvas
+
+   QwtPolarPanner is a panner for a QwtPolarCanvas, that
+   adjusts the visible area after dropping
+   the canvas on its new position.
+
+   Together with QwtPolarMagnifier individual ways
+   of navigating on a QwtPolarPlot widget can be implemented easily.
+
+   \sa QwtPolarMagnifier
+ */
+class QWT_EXPORT QwtPolarPanner : public QwtPanner
+{
+    Q_OBJECT
+
+  public:
+    explicit QwtPolarPanner( QwtPolarCanvas* );
+    virtual ~QwtPolarPanner();
+
+    QwtPolarPlot* plot();
+    const QwtPolarPlot* plot() const;
+
+    QwtPolarCanvas* canvas();
+    const QwtPolarCanvas* canvas() const;
+
+  public Q_SLOTS:
+    virtual void movePlot( int dx, int dy );
+
+  protected:
+    virtual void widgetMousePressEvent( QMouseEvent* ) QWT_OVERRIDE;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_picker.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_picker.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_picker.cpp	(revision 11158)
@@ -0,0 +1,242 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_picker.h"
+#include "qwt_polar_plot.h"
+#include "qwt_polar_canvas.h"
+#include "qwt_scale_map.h"
+#include "qwt_picker_machine.h"
+#include "qwt_point_polar.h"
+
+class QwtPolarPicker::PrivateData
+{
+};
+
+/*!
+   \brief Create a polar plot picker
+   \param canvas Plot canvas to observe, also the parent object
+ */
+
+QwtPolarPicker::QwtPolarPicker( QwtPolarCanvas* canvas )
+    : QwtPicker( canvas )
+    , m_data( NULL )
+{
+}
+
+/*!
+   Create a plot picker
+
+   \param rubberBand Rubberband style
+   \param trackerMode Tracker mode
+   \param canvas Plot canvas to observe, also the parent object
+
+   \sa QwtPicker, QwtPicker::setSelectionFlags(), QwtPicker::setRubberBand(),
+      QwtPicker::setTrackerMode
+
+   \sa QwtPolarPlot::autoReplot(), QwtPolarPlot::replot(), scaleRect()
+ */
+QwtPolarPicker::QwtPolarPicker(
+        RubberBand rubberBand, DisplayMode trackerMode, QwtPolarCanvas* canvas )
+    : QwtPicker( rubberBand, trackerMode, canvas )
+    , m_data( NULL )
+{
+}
+
+//! Destructor
+QwtPolarPicker::~QwtPolarPicker()
+{
+}
+
+//! \return Observed plot canvas
+QwtPolarCanvas* QwtPolarPicker::canvas()
+{
+    return qobject_cast< QwtPolarCanvas* >( parentWidget() );
+}
+
+//! \return Observed plot canvas
+const QwtPolarCanvas* QwtPolarPicker::canvas() const
+{
+    return qobject_cast< const QwtPolarCanvas* >( parentWidget() );
+}
+
+//! \return Plot widget, containing the observed plot canvas
+QwtPolarPlot* QwtPolarPicker::plot()
+{
+    QwtPolarCanvas* w = canvas();
+    if ( w )
+        return w->plot();
+
+    return NULL;
+}
+
+//! \return Plot widget, containing the observed plot canvas
+const QwtPolarPlot* QwtPolarPicker::plot() const
+{
+    const QwtPolarCanvas* w = canvas();
+    if ( w )
+        return w->plot();
+
+    return NULL;
+}
+
+/*!
+   Translate a pixel position into a position string
+
+   \param pos Position in pixel coordinates
+   \return Position string
+ */
+QwtText QwtPolarPicker::trackerText( const QPoint& pos ) const
+{
+    const QwtPointPolar polarPoint = invTransform( pos );
+    return trackerTextPolar( polarPoint );
+}
+
+/*!
+   \brief Translate a position into a position string
+
+   In case of HLineRubberBand the label is the value of the
+   y position, in case of VLineRubberBand the value of the x position.
+   Otherwise the label contains x and y position separated by a ',' .
+
+   The format for the double to string conversion is "%.4f".
+
+   \param pos Position
+   \return Position string
+ */
+QwtText QwtPolarPicker::trackerTextPolar( const QwtPointPolar& pos ) const
+{
+    const QString text = QString::number( pos.radius(), 'f', 4 )
+        + ", " + QString::number( pos.azimuth(), 'f', 4 );
+
+    return QwtText( text );
+}
+
+/*!
+   Append a point to the selection and update rubberband and tracker.
+
+   \param pos Additional point
+   \sa isActive, begin(), end(), move(), appended()
+
+   \note The appended(const QPoint &), appended(const QDoublePoint &)
+        signals are emitted.
+ */
+void QwtPolarPicker::append( const QPoint& pos )
+{
+    QwtPicker::append( pos );
+    Q_EMIT appended( invTransform( pos ) );
+}
+
+/*!
+   Move the last point of the selection
+
+   \param pos New position
+   \sa isActive, begin(), end(), append()
+
+   \note The moved(const QPoint &), moved(const QDoublePoint &)
+        signals are emitted.
+ */
+void QwtPolarPicker::move( const QPoint& pos )
+{
+    QwtPicker::move( pos );
+    Q_EMIT moved( invTransform( pos ) );
+}
+
+/*!
+   Close a selection setting the state to inactive.
+
+   \param ok If true, complete the selection and emit selected signals
+            otherwise discard the selection.
+   \return true if the selection is accepted, false otherwise
+ */
+
+bool QwtPolarPicker::end( bool ok )
+{
+    ok = QwtPicker::end( ok );
+    if ( !ok )
+        return false;
+
+    QwtPolarPlot* plot = QwtPolarPicker::plot();
+    if ( !plot )
+        return false;
+
+    const QPolygon points = selection();
+    if ( points.count() == 0 )
+        return false;
+
+    QwtPickerMachine::SelectionType selectionType =
+        QwtPickerMachine::NoSelection;
+
+    if ( stateMachine() )
+        selectionType = stateMachine()->selectionType();
+
+    switch ( selectionType )
+    {
+        case QwtPickerMachine::PointSelection:
+        {
+            const QwtPointPolar pos = invTransform( points[0] );
+            Q_EMIT selected( pos );
+            break;
+        }
+        case QwtPickerMachine::RectSelection:
+        case QwtPickerMachine::PolygonSelection:
+        {
+            QVector< QwtPointPolar > polarPoints( points.count() );
+            for ( int i = 0; i < points.count(); i++ )
+                polarPoints[i] = invTransform( points[i] );
+
+            Q_EMIT selected( polarPoints );
+        }
+        default:
+            break;
+    }
+
+    return true;
+}
+
+/*!
+    Translate a point from widget into plot coordinates
+
+    \param pos Point in widget coordinates of the plot canvas
+    \return Point in plot coordinates
+    \sa transform(), canvas()
+ */
+QwtPointPolar QwtPolarPicker::invTransform( const QPoint& pos ) const
+{
+    QwtPointPolar polarPos;
+    if ( canvas() == NULL )
+        return QwtPointPolar();
+
+    return canvas()->invTransform( pos );
+}
+
+/*!
+    \return Bounding rectangle of the region, where picking is
+            supported.
+ */
+QRect QwtPolarPicker::pickRect() const
+{
+    const QRect cr = canvas()->contentsRect();
+    const QRect pr = plot()->plotRect( cr ).toRect();
+
+    return cr & pr;
+}
+
+QPainterPath QwtPolarPicker::pickArea() const
+{
+    const QRect cr = canvas()->contentsRect();
+
+    QPainterPath crPath;
+    crPath.addRect( cr );
+
+    QPainterPath prPath;
+    prPath.addEllipse( plot()->plotRect( cr ) );
+
+    return crPath.intersected( prPath );
+}
+
+#include "moc_qwt_polar_picker.cpp"
Index: /trunk/BNC/qwt/qwt_polar_picker.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_picker.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_picker.h	(revision 11158)
@@ -0,0 +1,98 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_PICKER_H
+#define QWT_POLAR_PICKER_H
+
+#include "qwt_global.h"
+#include "qwt_picker.h"
+
+#include <qvector.h>
+#include <qpainterpath.h>
+
+class QwtPolarPlot;
+class QwtPolarCanvas;
+class QwtPointPolar;
+
+/*!
+   \brief QwtPolarPicker provides selections on a plot canvas
+
+   QwtPolarPicker is a QwtPicker tailored for selections on
+   a polar plot canvas.
+ */
+class QWT_EXPORT QwtPolarPicker : public QwtPicker
+{
+    Q_OBJECT
+
+  public:
+    explicit QwtPolarPicker( QwtPolarCanvas* );
+    virtual ~QwtPolarPicker();
+
+    explicit QwtPolarPicker(
+        RubberBand rubberBand, DisplayMode trackerMode,
+        QwtPolarCanvas* );
+
+    QwtPolarPlot* plot();
+    const QwtPolarPlot* plot() const;
+
+    QwtPolarCanvas* canvas();
+    const QwtPolarCanvas* canvas() const;
+
+    virtual QRect pickRect() const;
+
+  Q_SIGNALS:
+
+    /*!
+       A signal emitted in case of selectionFlags() & PointSelection.
+       \param pos Selected point
+     */
+    void selected( const QwtPointPolar& pos );
+
+    /*!
+       A signal emitting the selected points,
+       at the end of a selection.
+
+       \param points Selected points
+     */
+    void selected( const QVector< QwtPointPolar >& points );
+
+    /*!
+       A signal emitted when a point has been appended to the selection
+
+       \param pos Position of the appended point.
+       \sa append(). moved()
+     */
+    void appended( const QwtPointPolar& pos );
+
+    /*!
+       A signal emitted whenever the last appended point of the
+       selection has been moved.
+
+       \param pos Position of the moved last point of the selection.
+       \sa move(), appended()
+     */
+    void moved( const QwtPointPolar& pos );
+
+  protected:
+    QwtPointPolar invTransform( const QPoint& ) const;
+
+    virtual QwtText trackerText( const QPoint& ) const QWT_OVERRIDE;
+    virtual QwtText trackerTextPolar( const QwtPointPolar& ) const;
+
+    virtual void move( const QPoint& ) QWT_OVERRIDE;
+    virtual void append( const QPoint& ) QWT_OVERRIDE;
+    virtual bool end( bool ok = true ) QWT_OVERRIDE;
+
+  private:
+    virtual QPainterPath pickArea() const QWT_OVERRIDE;
+
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_plot.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_plot.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_plot.cpp	(revision 11158)
@@ -0,0 +1,1365 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_plot.h"
+#include "qwt_polar_canvas.h"
+#include "qwt_polar_layout.h"
+#include "qwt_painter.h"
+#include "qwt_scale_engine.h"
+#include "qwt_scale_div.h"
+#include "qwt_text_label.h"
+#include "qwt_round_scale_draw.h"
+#include "qwt_legend.h"
+#include "qwt_dyngrid_layout.h"
+
+#include <qpointer.h>
+#include <qpaintengine.h>
+#include <qpainter.h>
+#include <qevent.h>
+
+static inline double qwtDistance(
+    const QPointF& p1, const QPointF& p2 )
+{
+    double dx = p2.x() - p1.x();
+    double dy = p2.y() - p1.y();
+    return qSqrt( dx * dx + dy * dy );
+}
+
+namespace
+{
+    class ScaleData
+    {
+      public:
+        ScaleData()
+            : isValid( false )
+            , scaleEngine( NULL )
+        {
+        }
+
+        ~ScaleData()
+        {
+            delete scaleEngine;
+        }
+
+        bool doAutoScale;
+
+        double minValue;
+        double maxValue;
+        double stepSize;
+
+        int maxMajor;
+        int maxMinor;
+
+        bool isValid;
+
+        QwtScaleDiv scaleDiv;
+        QwtScaleEngine* scaleEngine;
+    };
+}
+
+class QwtPolarPlot::PrivateData
+{
+  public:
+    QBrush canvasBrush;
+
+    bool autoReplot;
+
+    QwtPointPolar zoomPos;
+    double zoomFactor;
+
+    ScaleData scaleData[QwtPolar::ScaleCount];
+    QPointer< QwtTextLabel > titleLabel;
+    QPointer< QwtPolarCanvas > canvas;
+    QPointer< QwtAbstractLegend > legend;
+    double azimuthOrigin;
+
+    QwtPolarLayout* layout;
+};
+
+/*!
+   Constructor
+   \param parent Parent widget
+ */
+QwtPolarPlot::QwtPolarPlot( QWidget* parent )
+    : QFrame( parent )
+{
+    initPlot( QwtText() );
+}
+
+/*!
+   Constructor
+   \param title Title text
+   \param parent Parent widget
+ */
+QwtPolarPlot::QwtPolarPlot( const QwtText& title, QWidget* parent )
+    : QFrame( parent )
+{
+    initPlot( title );
+}
+
+//! Destructor
+QwtPolarPlot::~QwtPolarPlot()
+{
+    detachItems( QwtPolarItem::Rtti_PolarItem, autoDelete() );
+
+    delete m_data->layout;
+    delete m_data;
+}
+
+/*!
+   Change the plot's title
+   \param title New title
+ */
+void QwtPolarPlot::setTitle( const QString& title )
+{
+    if ( title != m_data->titleLabel->text().text() )
+    {
+        m_data->titleLabel->setText( title );
+        if ( !title.isEmpty() )
+            m_data->titleLabel->show();
+        else
+            m_data->titleLabel->hide();
+    }
+}
+
+/*!
+   Change the plot's title
+   \param title New title
+ */
+void QwtPolarPlot::setTitle( const QwtText& title )
+{
+    if ( title != m_data->titleLabel->text() )
+    {
+        m_data->titleLabel->setText( title );
+        if ( !title.isEmpty() )
+            m_data->titleLabel->show();
+        else
+            m_data->titleLabel->hide();
+    }
+}
+
+//! \return the plot's title
+QwtText QwtPolarPlot::title() const
+{
+    return m_data->titleLabel->text();
+}
+
+//! \return the plot's title
+QwtTextLabel* QwtPolarPlot::titleLabel()
+{
+    return m_data->titleLabel;
+}
+
+//! \return the plot's title label.
+const QwtTextLabel* QwtPolarPlot::titleLabel() const
+{
+    return m_data->titleLabel;
+}
+
+/*!
+   \brief Insert a legend
+
+   If the position legend is \c QwtPolarPlot::LeftLegend or \c QwtPolarPlot::RightLegend
+   the legend will be organized in one column from top to down.
+   Otherwise the legend items will be placed in a table
+   with a best fit number of columns from left to right.
+
+   If pos != QwtPolarPlot::ExternalLegend the plot widget will become
+   parent of the legend. It will be deleted when the plot is deleted,
+   or another legend is set with insertLegend().
+
+   \param legend Legend
+   \param pos The legend's position. For top/left position the number
+             of columns will be limited to 1, otherwise it will be set to
+             unlimited.
+
+   \param ratio Ratio between legend and the bounding rect
+               of title, canvas and axes. The legend will be shrunk
+               if it would need more space than the given ratio.
+               The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0
+               it will be reset to the default ratio.
+               The default vertical/horizontal ratio is 0.33/0.5.
+
+   \sa legend(), QwtPolarLayout::legendPosition(),
+      QwtPolarLayout::setLegendPosition()
+ */
+void QwtPolarPlot::insertLegend( QwtAbstractLegend* legend,
+    QwtPolarPlot::LegendPosition pos, double ratio )
+{
+    m_data->layout->setLegendPosition( pos, ratio );
+
+    if ( legend != m_data->legend )
+    {
+        if ( m_data->legend && m_data->legend->parent() == this )
+            delete m_data->legend;
+
+        m_data->legend = legend;
+
+        if ( m_data->legend )
+        {
+            connect( this,
+                SIGNAL(legendDataChanged(
+                    const QVariant&,const QList<QwtLegendData>&)),
+                m_data->legend,
+                SLOT(updateLegend(
+                    const QVariant&,const QList<QwtLegendData>&))
+                );
+
+            if ( m_data->legend->parent() != this )
+                m_data->legend->setParent( this );
+
+            updateLegend();
+
+            QwtLegend* lgd = qobject_cast< QwtLegend* >( legend );
+            if ( lgd )
+            {
+                switch ( m_data->layout->legendPosition() )
+                {
+                    case LeftLegend:
+                    case RightLegend:
+                    {
+                        if ( lgd->maxColumns() == 0     )
+                            lgd->setMaxColumns( 1 ); // 1 column: align vertical
+                        break;
+                    }
+                    case TopLegend:
+                    case BottomLegend:
+                    {
+                        lgd->setMaxColumns( 0 ); // unlimited
+                        break;
+                    }
+                    default:
+                        break;
+                }
+            }
+
+        }
+    }
+
+    updateLayout();
+}
+
+/*!
+   Emit legendDataChanged() for all plot item
+
+   \sa QwtPlotItem::legendData(), legendDataChanged()
+ */
+void QwtPolarPlot::updateLegend()
+{
+    const QwtPolarItemList& itmList = itemList();
+    for ( QwtPolarItemIterator it = itmList.begin();
+        it != itmList.end(); ++it )
+    {
+        updateLegend( *it );
+    }
+}
+
+/*!
+   Emit legendDataChanged() for a plot item
+
+   \param plotItem Plot item
+   \sa QwtPlotItem::legendData(), legendDataChanged()
+ */
+void QwtPolarPlot::updateLegend( const QwtPolarItem* plotItem )
+{
+    if ( plotItem == NULL )
+        return;
+
+    QList< QwtLegendData > legendData;
+
+    if ( plotItem->testItemAttribute( QwtPolarItem::Legend ) )
+        legendData = plotItem->legendData();
+
+    const QVariant itemInfo = itemToInfo( const_cast< QwtPolarItem* >( plotItem ) );
+    Q_EMIT legendDataChanged( itemInfo, legendData );
+}
+
+/*!
+   \return the plot's legend
+   \sa insertLegend()
+ */
+QwtAbstractLegend* QwtPolarPlot::legend()
+{
+    return m_data->legend;
+}
+
+/*!
+   \return the plot's legend
+   \sa insertLegend()
+ */
+const QwtAbstractLegend* QwtPolarPlot::legend() const
+{
+    return m_data->legend;
+}
+
+/*!
+   \brief Set the background of the plot area
+
+   The plot area is the circle around the pole. It's radius
+   is defined by the radial scale.
+
+   \param brush Background Brush
+   \sa plotBackground(), plotArea()
+ */
+void QwtPolarPlot::setPlotBackground( const QBrush& brush )
+{
+    if ( brush != m_data->canvasBrush )
+    {
+        m_data->canvasBrush = brush;
+        autoRefresh();
+    }
+}
+
+/*!
+   \return plot background brush
+   \sa plotBackground(), plotArea()
+ */
+const QBrush& QwtPolarPlot::plotBackground() const
+{
+    return m_data->canvasBrush;
+}
+
+/*!
+   \brief Set or reset the autoReplot option
+
+   If the autoReplot option is set, the plot will be
+   updated implicitly by manipulating member functions.
+   Since this may be time-consuming, it is recommended
+   to leave this option switched off and call replot()
+   explicitly if necessary.
+
+   The autoReplot option is set to false by default, which
+   means that the user has to call replot() in order to make
+   changes visible.
+   \param enable \c true or \c false. Defaults to \c true.
+   \sa replot()
+ */
+void QwtPolarPlot::setAutoReplot( bool enable )
+{
+    m_data->autoReplot = enable;
+}
+
+//! \return true if the autoReplot option is set.
+bool QwtPolarPlot::autoReplot() const
+{
+    return m_data->autoReplot;
+}
+
+/*!
+   \brief Enable autoscaling
+
+   This member function is used to switch back to autoscaling mode
+   after a fixed scale has been set. Autoscaling calculates a useful
+   scale division from the bounding interval of all plot items with
+   the QwtPolarItem::AutoScale attribute.
+
+   Autoscaling is only supported for the radial scale and enabled as default.
+
+   \param scaleId Scale index
+
+   \sa hasAutoScale(), setScale(), setScaleDiv(),
+      QwtPolarItem::boundingInterval()
+ */
+void QwtPolarPlot::setAutoScale( int scaleId )
+{
+    if ( scaleId != QwtPolar::ScaleRadius )
+        return;
+
+    ScaleData& scaleData = m_data->scaleData[scaleId];
+    if ( !scaleData.doAutoScale )
+    {
+        scaleData.doAutoScale = true;
+        autoRefresh();
+    }
+}
+
+/*!
+   \return \c true if autoscaling is enabled
+   \param scaleId Scale index
+   \sa setAutoScale()
+ */
+bool QwtPolarPlot::hasAutoScale( int scaleId ) const
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return false;
+
+    return m_data->scaleData[scaleId].doAutoScale;
+}
+
+/*!
+   Set the maximum number of major scale intervals for a specified scale
+
+   \param scaleId Scale index
+   \param maxMinor maximum number of minor steps
+   \sa scaleMaxMajor()
+ */
+void QwtPolarPlot::setScaleMaxMinor( int scaleId, int maxMinor )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return;
+
+    maxMinor = qBound( 0, maxMinor, 100 );
+
+    ScaleData& scaleData = m_data->scaleData[scaleId];
+
+    if ( maxMinor != scaleData.maxMinor )
+    {
+        scaleData.maxMinor = maxMinor;
+        scaleData.isValid = false;
+        autoRefresh();
+    }
+}
+
+/*!
+   \return the maximum number of minor ticks for a specified axis
+   \param scaleId Scale index
+   \sa setScaleMaxMinor()
+ */
+int QwtPolarPlot::scaleMaxMinor( int scaleId ) const
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return 0;
+
+    return m_data->scaleData[scaleId].maxMinor;
+}
+
+/*!
+   Set the maximum number of major scale intervals for a specified scale
+
+   \param scaleId Scale index
+   \param maxMajor maximum number of major steps
+   \sa scaleMaxMajor()
+ */
+void QwtPolarPlot::setScaleMaxMajor( int scaleId, int maxMajor )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return;
+
+    maxMajor = qBound( 1, maxMajor, 10000 );
+
+    ScaleData& scaleData = m_data->scaleData[scaleId];
+    if ( maxMajor != scaleData.maxMinor )
+    {
+        scaleData.maxMajor = maxMajor;
+        scaleData.isValid = false;
+        autoRefresh();
+    }
+}
+
+/*!
+   \return the maximum number of major ticks for a specified axis
+   \param scaleId Scale index
+
+   \sa setScaleMaxMajor()
+ */
+int QwtPolarPlot::scaleMaxMajor( int scaleId ) const
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return 0;
+
+    return m_data->scaleData[scaleId].maxMajor;
+}
+
+/*!
+   Change the scale engine for an axis
+
+   \param scaleId Scale index
+   \param scaleEngine Scale engine
+
+   \sa axisScaleEngine()
+ */
+void QwtPolarPlot::setScaleEngine( int scaleId, QwtScaleEngine* scaleEngine )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return;
+
+    ScaleData& scaleData = m_data->scaleData[scaleId];
+    if ( scaleEngine == NULL || scaleEngine == scaleData.scaleEngine )
+        return;
+
+    delete scaleData.scaleEngine;
+    scaleData.scaleEngine = scaleEngine;
+
+    scaleData.isValid = false;
+
+    autoRefresh();
+}
+
+/*!
+   \return Scale engine for a specific scale
+
+   \param scaleId Scale index
+   \sa setScaleEngine()
+ */
+QwtScaleEngine* QwtPolarPlot::scaleEngine( int scaleId )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return NULL;
+
+    return m_data->scaleData[scaleId].scaleEngine;
+}
+
+/*!
+   \return Scale engine for a specific scale
+
+   \param scaleId Scale index
+   \sa setScaleEngine()
+ */
+const QwtScaleEngine* QwtPolarPlot::scaleEngine( int scaleId ) const
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return NULL;
+
+    return m_data->scaleData[scaleId].scaleEngine;
+}
+
+/*!
+   \brief Disable autoscaling and specify a fixed scale for a selected scale.
+   \param scaleId Scale index
+   \param min
+   \param max minimum and maximum of the scale
+   \param stepSize Major step size. If <code>step == 0</code>, the step size is
+            calculated automatically using the maxMajor setting.
+   \sa setScaleMaxMajor(), setAutoScale()
+ */
+void QwtPolarPlot::setScale( int scaleId,
+    double min, double max, double stepSize )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return;
+
+    ScaleData& scaleData = m_data->scaleData[scaleId];
+
+    scaleData.isValid = false;
+
+    scaleData.minValue = min;
+    scaleData.maxValue = max;
+    scaleData.stepSize = stepSize;
+    scaleData.doAutoScale = false;
+
+    autoRefresh();
+}
+
+/*!
+   \brief Disable autoscaling and specify a fixed scale for a selected scale.
+   \param scaleId Scale index
+   \param scaleDiv Scale division
+   \sa setScale(), setAutoScale()
+ */
+void QwtPolarPlot::setScaleDiv( int scaleId, const QwtScaleDiv& scaleDiv )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return;
+
+    ScaleData& scaleData = m_data->scaleData[scaleId];
+
+    scaleData.scaleDiv = scaleDiv;
+    scaleData.isValid = true;
+    scaleData.doAutoScale = false;
+
+    autoRefresh();
+}
+
+/*!
+   \brief Return the scale division of a specified scale
+
+   scaleDiv(scaleId)->lBound(), scaleDiv(scaleId)->hBound()
+   are the current limits of the scale.
+
+   \param scaleId Scale index
+   \return Scale division
+
+   \sa QwtScaleDiv, setScaleDiv(), setScale()
+ */
+const QwtScaleDiv* QwtPolarPlot::scaleDiv( int scaleId ) const
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return NULL;
+
+    return &m_data->scaleData[scaleId].scaleDiv;
+}
+
+/*!
+   \brief Return the scale division of a specified scale
+
+   scaleDiv(scaleId)->lBound(), scaleDiv(scaleId)->hBound()
+   are the current limits of the scale.
+
+   \param scaleId Scale index
+   \return Scale division
+
+   \sa QwtScaleDiv, setScaleDiv(), setScale()
+ */
+QwtScaleDiv* QwtPolarPlot::scaleDiv( int scaleId )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return NULL;
+
+    return &m_data->scaleData[scaleId].scaleDiv;
+}
+
+/*!
+   \brief Change the origin of the azimuth scale
+
+   The azimuth origin is the angle where the azimuth scale
+   shows the value 0.0.  The default origin is 0.0.
+
+   \param origin New origin
+   \sa azimuthOrigin()
+ */
+void QwtPolarPlot::setAzimuthOrigin( double origin )
+{
+    origin = ::fmod( origin, 2 * M_PI );
+    if ( origin != m_data->azimuthOrigin )
+    {
+        m_data->azimuthOrigin = origin;
+        autoRefresh();
+    }
+}
+
+/*!
+   The azimuth origin is the angle where the azimuth scale
+   shows the value 0.0.
+
+   \return Origin of the azimuth scale
+   \sa setAzimuthOrigin()
+ */
+double QwtPolarPlot::azimuthOrigin() const
+{
+    return m_data->azimuthOrigin;
+}
+
+/*!
+   \brief Translate and in/decrease the zoom factor
+
+   In zoom mode the zoom position is in the center of the
+   canvas. The radius of the circle depends on the size of the plot canvas,
+   that is divided by the zoom factor. Thus a factor < 1.0 zoom in.
+
+   Setting an invalid zoom position disables zooming.
+
+   \param zoomPos Center of the translation
+   \param zoomFactor Zoom factor
+
+   \sa unzoom(), zoomPos(), zoomFactor()
+ */
+void QwtPolarPlot::zoom( const QwtPointPolar& zoomPos, double zoomFactor )
+{
+    zoomFactor = qAbs( zoomFactor );
+    if ( zoomPos != m_data->zoomPos ||
+        zoomFactor != m_data->zoomFactor )
+    {
+        m_data->zoomPos = zoomPos;
+        m_data->zoomFactor = zoomFactor;
+        updateLayout();
+        autoRefresh();
+    }
+}
+
+/*!
+   Unzoom the plot
+   \sa zoom()
+ */
+void QwtPolarPlot::unzoom()
+{
+    if ( m_data->zoomFactor != 1.0 || m_data->zoomPos.isValid() )
+    {
+        m_data->zoomFactor = 1.0;
+        m_data->zoomPos = QwtPointPolar();
+        autoRefresh();
+    }
+}
+
+/*!
+   \return Zoom position
+   \sa zoom(), zoomFactor()
+ */
+QwtPointPolar QwtPolarPlot::zoomPos() const
+{
+    return m_data->zoomPos;
+}
+
+/*!
+   \return Zoom factor
+   \sa zoom(), zoomPos()
+ */
+double QwtPolarPlot::zoomFactor() const
+{
+    return m_data->zoomFactor;
+}
+
+/*!
+   Build a scale map
+
+   The azimuth map translates between the scale values and angles from
+   [0.0, 2 * PI[. The radial map translates scale values into the distance
+   from the pole. The radial map is calculated from the current geometry
+   of the canvas.
+
+   \param scaleId Scale index
+   \return Map for the scale on the canvas. With this map pixel coordinates can
+          translated to plot coordinates and vice versa.
+
+   \sa QwtScaleMap, transform(), invTransform()
+ */
+QwtScaleMap QwtPolarPlot::scaleMap( int scaleId ) const
+{
+    const QRectF pr = plotRect();
+    return scaleMap( scaleId, pr.width() / 2.0 );
+}
+
+/*!
+   Build a scale map
+
+   The azimuth map translates between the scale values and angles from
+   [0.0, 2 * PI[. The radial map translates scale values into the distance
+   from the pole.
+
+   \param scaleId Scale index
+   \param radius Radius of the plot are in pixels
+   \return Map for the scale on the canvas. With this map pixel coordinates can
+          translated to plot coordinates and vice versa.
+
+   \sa QwtScaleMap, transform(), invTransform()
+ */
+QwtScaleMap QwtPolarPlot::scaleMap( int scaleId, const double radius ) const
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return QwtScaleMap();
+
+    QwtScaleMap map;
+    map.setTransformation( scaleEngine( scaleId )->transformation() );
+
+    const QwtScaleDiv* sd = scaleDiv( scaleId );
+    map.setScaleInterval( sd->lowerBound(), sd->upperBound() );
+
+    if ( scaleId == QwtPolar::Azimuth )
+    {
+        map.setPaintInterval( m_data->azimuthOrigin,
+            m_data->azimuthOrigin + 2 * M_PI );
+    }
+    else
+    {
+        map.setPaintInterval( 0.0, radius );
+    }
+
+    return map;
+}
+
+/*!
+    \brief Qt event handler
+
+    Handles QEvent::LayoutRequest and QEvent::PolishRequest
+
+    \param e Qt Event
+    \return True, when the event was processed
+ */
+bool QwtPolarPlot::event( QEvent* e )
+{
+    bool ok = QWidget::event( e );
+    switch( e->type() )
+    {
+        case QEvent::LayoutRequest:
+        {
+            updateLayout();
+            break;
+        }
+        case QEvent::PolishRequest:
+        {
+            updateLayout();
+            replot();
+            break;
+        }
+        default:;
+    }
+    return ok;
+}
+
+//! Resize and update internal layout
+void QwtPolarPlot::resizeEvent( QResizeEvent* e )
+{
+    QFrame::resizeEvent( e );
+    updateLayout();
+}
+
+void QwtPolarPlot::initPlot( const QwtText& title )
+{
+    m_data = new PrivateData;
+    m_data->layout = new QwtPolarLayout;
+
+    QwtText text( title );
+    text.setRenderFlags( Qt::AlignCenter | Qt::TextWordWrap );
+
+    m_data->titleLabel = new QwtTextLabel( text, this );
+    m_data->titleLabel->setFont( QFont( fontInfo().family(), 14, QFont::Bold ) );
+    if ( !text.isEmpty() )
+        m_data->titleLabel->show();
+    else
+        m_data->titleLabel->hide();
+
+    m_data->canvas = new QwtPolarCanvas( this );
+
+    m_data->autoReplot = false;
+    m_data->canvasBrush = QBrush( Qt::white );
+
+    for ( int scaleId = 0; scaleId < QwtPolar::ScaleCount; scaleId++ )
+    {
+        ScaleData& scaleData = m_data->scaleData[scaleId];
+
+        if ( scaleId == QwtPolar::Azimuth )
+        {
+            scaleData.minValue = 0.0;
+            scaleData.maxValue = 360.0;
+            scaleData.stepSize = 30.0;
+        }
+        else
+        {
+            scaleData.minValue = 0.0;
+            scaleData.maxValue = 1000.0;
+            scaleData.stepSize = 0.0;
+        }
+
+        scaleData.doAutoScale = true;
+
+        scaleData.maxMinor = 5;
+        scaleData.maxMajor = 8;
+
+        scaleData.isValid = false;
+
+        scaleData.scaleEngine = new QwtLinearScaleEngine;
+    }
+    m_data->zoomFactor = 1.0;
+    m_data->azimuthOrigin = 0.0;
+
+    setSizePolicy( QSizePolicy::MinimumExpanding,
+        QSizePolicy::MinimumExpanding );
+
+    for ( int scaleId = 0; scaleId < QwtPolar::ScaleCount; scaleId++ )
+        updateScale( scaleId );
+}
+
+//! Replots the plot if QwtPlot::autoReplot() is \c true.
+void QwtPolarPlot::autoRefresh()
+{
+    if ( m_data->autoReplot )
+        replot();
+}
+
+//! Rebuild the layout
+void QwtPolarPlot::updateLayout()
+{
+    m_data->layout->activate( this, contentsRect() );
+
+    // resize and show the visible widgets
+    if ( m_data->titleLabel )
+    {
+        if ( !m_data->titleLabel->text().isEmpty() )
+        {
+            m_data->titleLabel->setGeometry( m_data->layout->titleRect().toRect() );
+            if ( !m_data->titleLabel->isVisible() )
+                m_data->titleLabel->show();
+        }
+        else
+            m_data->titleLabel->hide();
+    }
+
+    if ( m_data->legend )
+    {
+        if ( m_data->legend->isEmpty() )
+        {
+            m_data->legend->hide();
+        }
+        else
+        {
+            const QRectF legendRect = m_data->layout->legendRect();
+            m_data->legend->setGeometry( legendRect.toRect() );
+            m_data->legend->show();
+        }
+    }
+
+    m_data->canvas->setGeometry( m_data->layout->canvasRect().toRect() );
+    Q_EMIT layoutChanged();
+}
+
+/*!
+   \brief Redraw the plot
+
+   If the autoReplot option is not set (which is the default)
+   or if any curves are attached to raw data, the plot has to
+   be refreshed explicitly in order to make changes visible.
+
+   \sa setAutoReplot()
+   \warning Calls canvas()->repaint, take care of infinite recursions
+ */
+void QwtPolarPlot::replot()
+{
+    bool doAutoReplot = autoReplot();
+    setAutoReplot( false );
+
+    for ( int scaleId = 0; scaleId < QwtPolar::ScaleCount; scaleId++ )
+        updateScale( scaleId );
+
+    m_data->canvas->invalidateBackingStore();
+    m_data->canvas->repaint();
+
+    setAutoReplot( doAutoReplot );
+}
+
+//!  \return the plot's canvas
+QwtPolarCanvas* QwtPolarPlot::canvas()
+{
+    return m_data->canvas;
+}
+
+//!  \return the plot's canvas
+const QwtPolarCanvas* QwtPolarPlot::canvas() const
+{
+    return m_data->canvas;
+}
+
+/*!
+   Redraw the canvas.
+   \param painter Painter used for drawing
+   \param canvasRect Contents rect of the canvas
+ */
+void QwtPolarPlot::drawCanvas( QPainter* painter,
+    const QRectF& canvasRect ) const
+{
+    const QRectF cr = canvasRect;
+    const QRectF pr = plotRect( cr );
+
+    const double radius = pr.width() / 2.0;
+
+    if ( m_data->canvasBrush.style() != Qt::NoBrush )
+    {
+        painter->save();
+        painter->setPen( Qt::NoPen );
+        painter->setBrush( m_data->canvasBrush );
+
+        if ( qwtDistance( pr.center(), cr.topLeft() ) < radius &&
+            qwtDistance( pr.center(), cr.topRight() ) < radius &&
+            qwtDistance( pr.center(), cr.bottomRight() ) < radius &&
+            qwtDistance( pr.center(), cr.bottomLeft() ) < radius )
+        {
+            QwtPainter::drawRect( painter, cr );
+        }
+        else
+        {
+            painter->setRenderHint( QPainter::Antialiasing, true );
+            QwtPainter::drawEllipse( painter, pr );
+        }
+        painter->restore();
+    }
+
+    drawItems( painter,
+        scaleMap( QwtPolar::Azimuth, radius ),
+        scaleMap( QwtPolar::Radius, radius ),
+        pr.center(), radius, canvasRect );
+}
+
+/*!
+   Redraw the canvas items.
+
+   \param painter Painter used for drawing
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param radius Radius of the complete plot area in painter coordinates
+   \param canvasRect Contents rect of the canvas in painter coordinates
+ */
+void QwtPolarPlot::drawItems( QPainter* painter,
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, double radius,
+    const QRectF& canvasRect ) const
+{
+    const QRectF pr = plotRect( canvasRect );
+
+    const QwtPolarItemList& itmList = itemList();
+    for ( QwtPolarItemIterator it = itmList.begin();
+        it != itmList.end(); ++it )
+    {
+        QwtPolarItem* item = *it;
+        if ( item && item->isVisible() )
+        {
+            painter->save();
+
+            // Unfortunately circular clipping slows down
+            // painting a lot. So we better try to avoid it.
+
+            bool doClipping = false;
+            if ( item->rtti() != QwtPolarItem::Rtti_PolarGrid )
+            {
+                const QwtInterval intv =
+                    item->boundingInterval( QwtPolar::Radius );
+
+                if ( !intv.isValid() )
+                    doClipping = true;
+                else
+                {
+                    if ( radialMap.s1() < radialMap.s2() )
+                        doClipping = intv.maxValue() > radialMap.s2();
+                    else
+                        doClipping = intv.minValue() < radialMap.s2();
+                }
+            }
+
+            if ( doClipping )
+            {
+                const int margin = item->marginHint();
+
+                const QRectF clipRect = pr.adjusted(
+                    -margin, -margin, margin, margin );
+                if ( !clipRect.contains( canvasRect ) )
+                {
+                    QRegion clipRegion( clipRect.toRect(), QRegion::Ellipse );
+                    painter->setClipRegion( clipRegion, Qt::IntersectClip );
+                }
+            }
+
+            painter->setRenderHint( QPainter::Antialiasing,
+                item->testRenderHint( QwtPolarItem::RenderAntialiased ) );
+
+            item->draw( painter, azimuthMap, radialMap,
+                pole, radius, canvasRect );
+
+            painter->restore();
+        }
+    }
+}
+
+/*!
+   Rebuild the scale
+   \param scaleId Scale index
+ */
+
+void QwtPolarPlot::updateScale( int scaleId )
+{
+    if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
+        return;
+
+    ScaleData& d = m_data->scaleData[scaleId];
+
+    double minValue = d.minValue;
+    double maxValue = d.maxValue;
+    double stepSize = d.stepSize;
+
+    if ( scaleId == QwtPolar::ScaleRadius && d.doAutoScale )
+    {
+        QwtInterval interval;
+
+        const QwtPolarItemList& itmList = itemList();
+        for ( QwtPolarItemIterator it = itmList.begin();
+            it != itmList.end(); ++it )
+        {
+            const QwtPolarItem* item = *it;
+            if ( item->testItemAttribute( QwtPolarItem::AutoScale ) )
+                interval |= item->boundingInterval( scaleId );
+        }
+
+        minValue = interval.minValue();
+        maxValue = interval.maxValue();
+
+        d.scaleEngine->autoScale( d.maxMajor,
+            minValue, maxValue, stepSize );
+        d.isValid = false;
+    }
+
+    if ( !d.isValid )
+    {
+        d.scaleDiv = d.scaleEngine->divideScale(
+            minValue, maxValue, d.maxMajor, d.maxMinor, stepSize );
+        d.isValid = true;
+    }
+
+    const QwtInterval interval = visibleInterval();
+
+    const QwtPolarItemList& itmList = itemList();
+    for ( QwtPolarItemIterator it = itmList.begin();
+        it != itmList.end(); ++it )
+    {
+        QwtPolarItem* item = *it;
+        item->updateScaleDiv( *scaleDiv( QwtPolar::Azimuth ),
+            *scaleDiv( QwtPolar::Radius ), interval );
+    }
+}
+
+/*!
+   \return Maximum of all item margin hints.
+   \sa QwtPolarItem::marginHint()
+ */
+int QwtPolarPlot::plotMarginHint() const
+{
+    int margin = 0;
+    const QwtPolarItemList& itmList = itemList();
+    for ( QwtPolarItemIterator it = itmList.begin();
+        it != itmList.end(); ++it )
+    {
+        QwtPolarItem* item = *it;
+        if ( item && item->isVisible() )
+        {
+            const int hint = item->marginHint();
+            if ( hint > margin )
+                margin = hint;
+        }
+    }
+    return margin;
+}
+
+/*!
+   The plot area depends on the size of the canvas
+   and the zoom parameters.
+
+   \return Bounding rect of the plot area
+
+ */
+QRectF QwtPolarPlot::plotRect() const
+{
+    return plotRect( canvas()->contentsRect() );
+}
+
+/*!
+   \brief Calculate the bounding rect of the plot area
+
+   The plot area depends on the zoom parameters.
+
+   \param canvasRect Rectangle of the canvas
+   \return Rectangle for displaying 100% of the plot
+ */
+QRectF QwtPolarPlot::plotRect( const QRectF& canvasRect ) const
+{
+    const QwtScaleDiv* sd = scaleDiv( QwtPolar::Radius );
+    const QwtScaleEngine* se = scaleEngine( QwtPolar::Radius );
+
+    const int margin = plotMarginHint();
+    const QRectF cr = canvasRect;
+    const int radius = qMin( cr.width(), cr.height() ) / 2 - margin;
+
+    QwtScaleMap map;
+    map.setTransformation( se->transformation() );
+    map.setPaintInterval( 0.0, radius / m_data->zoomFactor );
+    map.setScaleInterval( sd->lowerBound(), sd->upperBound() );
+
+    double v = map.s1();
+    if ( map.s1() <= map.s2() )
+        v += m_data->zoomPos.radius();
+    else
+        v -= m_data->zoomPos.radius();
+    v = map.transform( v );
+
+    const QPointF off =
+        QwtPointPolar( m_data->zoomPos.azimuth(), v ).toPoint();
+
+    QPointF center( cr.center().x(), cr.top() + margin + radius );
+    center -= QPointF( off.x(), -off.y() );
+
+    QRectF rect( 0, 0, 2 * map.p2(), 2 * map.p2() );
+    rect.moveCenter( center );
+
+    return rect;
+}
+
+/*!
+   \return Bounding interval of the radial scale that is
+           visible on the canvas.
+ */
+QwtInterval QwtPolarPlot::visibleInterval() const
+{
+    const QwtScaleDiv* sd = scaleDiv( QwtPolar::Radius );
+
+    const QRectF cRect = canvas()->contentsRect();
+    const QRectF pRect = plotRect( cRect );
+    if ( cRect.contains( pRect ) || !cRect.intersects( pRect ) )
+    {
+        return QwtInterval( sd->lowerBound(), sd->upperBound() );
+    }
+
+    const QPointF pole = pRect.center();
+    const QRectF scaleRect = pRect & cRect;
+
+    const QwtScaleMap map = scaleMap( QwtPolar::Radius );
+
+    double dmin = 0.0;
+    double dmax = 0.0;
+    if ( scaleRect.contains( pole ) )
+    {
+        dmin = 0.0;
+
+        QPointF corners[4];
+        corners[0] = scaleRect.bottomRight();
+        corners[1] = scaleRect.topRight();
+        corners[2] = scaleRect.topLeft();
+        corners[3] = scaleRect.bottomLeft();
+
+        dmax = 0.0;
+        for ( int i = 0; i < 4; i++ )
+        {
+            const double dist = qwtDistance( pole, corners[i] );
+            if ( dist > dmax )
+                dmax = dist;
+        }
+    }
+    else
+    {
+        if ( pole.x() < scaleRect.left() )
+        {
+            if ( pole.y() < scaleRect.top() )
+            {
+                dmin = qwtDistance( pole, scaleRect.topLeft() );
+                dmax = qwtDistance( pole, scaleRect.bottomRight() );
+            }
+            else if ( pole.y() > scaleRect.bottom() )
+            {
+                dmin = qwtDistance( pole, scaleRect.bottomLeft() );
+                dmax = qwtDistance( pole, scaleRect.topRight() );
+            }
+            else
+            {
+                dmin = scaleRect.left() - pole.x();
+                dmax = qMax( qwtDistance( pole, scaleRect.bottomRight() ),
+                    qwtDistance( pole, scaleRect.topRight() ) );
+            }
+        }
+        else if ( pole.x() > scaleRect.right() )
+        {
+            if ( pole.y() < scaleRect.top() )
+            {
+                dmin = qwtDistance( pole, scaleRect.topRight() );
+                dmax = qwtDistance( pole, scaleRect.bottomLeft() );
+            }
+            else if ( pole.y() > scaleRect.bottom() )
+            {
+                dmin = qwtDistance( pole, scaleRect.bottomRight() );
+                dmax = qwtDistance( pole, scaleRect.topLeft() );
+            }
+            else
+            {
+                dmin = pole.x() - scaleRect.right();
+                dmax = qMax( qwtDistance( pole, scaleRect.bottomLeft() ),
+                    qwtDistance( pole, scaleRect.topLeft() ) );
+            }
+        }
+        else if ( pole.y() < scaleRect.top() )
+        {
+            dmin = scaleRect.top() - pole.y();
+            dmax = qMax( qwtDistance( pole, scaleRect.bottomLeft() ),
+                qwtDistance( pole, scaleRect.bottomRight() ) );
+        }
+        else if ( pole.y() > scaleRect.bottom() )
+        {
+            dmin = pole.y() - scaleRect.bottom();
+            dmax = qMax( qwtDistance( pole, scaleRect.topLeft() ),
+                qwtDistance( pole, scaleRect.topRight() ) );
+        }
+    }
+
+    const double radius = pRect.width() / 2.0;
+    if ( dmax > radius )
+        dmax = radius;
+
+    QwtInterval interval;
+    interval.setMinValue( map.invTransform( dmin ) );
+    interval.setMaxValue( map.invTransform( dmax ) );
+
+    return interval;
+}
+
+/*!
+   \return Layout, responsible for the geometry of the plot components
+ */
+QwtPolarLayout* QwtPolarPlot::plotLayout()
+{
+    return m_data->layout;
+}
+
+/*!
+   \return Layout, responsible for the geometry of the plot components
+ */
+const QwtPolarLayout* QwtPolarPlot::plotLayout() const
+{
+    return m_data->layout;
+}
+
+/*!
+   \brief Attach/Detach a plot item
+
+   \param plotItem Plot item
+   \param on When true attach the item, otherwise detach it
+ */
+void QwtPolarPlot::attachItem( QwtPolarItem* plotItem, bool on )
+{
+    if ( on )
+        insertItem( plotItem );
+    else
+        removeItem( plotItem );
+
+    Q_EMIT itemAttached( plotItem, on );
+
+    if ( plotItem->testItemAttribute( QwtPolarItem::Legend ) )
+    {
+        // the item wants to be represented on the legend
+
+        if ( on )
+        {
+            updateLegend( plotItem );
+        }
+        else
+        {
+            const QVariant itemInfo = itemToInfo( plotItem );
+            Q_EMIT legendDataChanged( itemInfo, QList< QwtLegendData >() );
+        }
+    }
+
+    if ( autoReplot() )
+        update();
+}
+
+/*!
+   \brief Build an information, that can be used to identify
+         a plot item on the legend.
+
+   The default implementation simply wraps the plot item
+   into a QVariant object. When overloading itemToInfo()
+   usually infoToItem() needs to reimplemeted too.
+
+   \code
+    QVariant itemInfo;
+    qVariantSetValue( itemInfo, plotItem );
+   \endcode
+
+   \param plotItem Plot item
+   \sa infoToItem()
+ */
+QVariant QwtPolarPlot::itemToInfo( QwtPolarItem* plotItem ) const
+{
+    return QVariant::fromValue( plotItem );
+}
+
+/*!
+   \brief Identify the plot item according to an item info object,
+         that has bee generated from itemToInfo().
+
+   The default implementation simply tries to unwrap a QwtPlotItem
+   pointer:
+
+   \code
+    if ( itemInfo.canConvert<QwtPlotItem *>() )
+        return qvariant_cast<QwtPlotItem *>( itemInfo );
+   \endcode
+   \param itemInfo Plot item
+   \return A plot item, when successful, otherwise a NULL pointer.
+   \sa itemToInfo()
+ */
+QwtPolarItem* QwtPolarPlot::infoToItem( const QVariant& itemInfo ) const
+{
+    if ( itemInfo.canConvert< QwtPolarItem* >() )
+        return qvariant_cast< QwtPolarItem* >( itemInfo );
+
+    return NULL;
+}
+
+#include "moc_qwt_polar_plot.cpp"
Index: /trunk/BNC/qwt/qwt_polar_plot.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_plot.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_plot.h	(revision 11158)
@@ -0,0 +1,219 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_PLOT_H
+#define QWT_POLAR_PLOT_H
+
+#include "qwt_global.h"
+#include "qwt_polar.h"
+#include "qwt_polar_itemdict.h"
+#include "qwt_interval.h"
+#include "qwt_scale_map.h"
+#include "qwt_point_polar.h"
+#include <qframe.h>
+
+class QwtRoundScaleDraw;
+class QwtScaleEngine;
+class QwtScaleDiv;
+class QwtTextLabel;
+class QwtPolarCanvas;
+class QwtPolarLayout;
+class QwtAbstractLegend;
+
+/*!
+   \brief A plotting widget, displaying a polar coordinate system
+
+   An unlimited number of plot items can be displayed on
+   its canvas. Plot items might be curves (QwtPolarCurve), markers
+   (QwtPolarMarker), the grid (QwtPolarGrid), or anything else derived
+   from QwtPolarItem.
+
+   The coordinate system is defined by a radial and a azimuth scale.
+   The scales at the axes can be explicitly set (QwtScaleDiv), or
+   are calculated from the plot items, using algorithms (QwtScaleEngine) which
+   can be configured separately for each axis. Autoscaling is supported
+   for the radial scale.
+
+   In opposite to QwtPlot the scales might be different from the
+   view, that is displayed on the canvas. The view can be changed by
+   zooming - f.e. by using QwtPolarPanner or QwtPolarMaginfier.
+ */
+class QWT_EXPORT QwtPolarPlot : public QFrame, public QwtPolarItemDict
+{
+    Q_OBJECT
+
+    Q_PROPERTY( QBrush plotBackground READ plotBackground WRITE setPlotBackground )
+    Q_PROPERTY( double azimuthOrigin READ azimuthOrigin WRITE setAzimuthOrigin )
+
+
+  public:
+    /*!
+        Position of the legend, relative to the canvas.
+        \sa insertLegend()
+     */
+    enum LegendPosition
+    {
+        //! The legend will be left from the canvas.
+        LeftLegend,
+
+        //! The legend will be right from the canvas.
+        RightLegend,
+
+        //! The legend will be below the canvas.
+        BottomLegend,
+
+        //! The legend will be between canvas and title.
+        TopLegend,
+
+        /*!
+           External means that only the content of the legend
+           will be handled by QwtPlot, but not its geometry.
+           This might be interesting if an application wants to
+           have a legend in an external window ( or on the canvas ).
+
+           \note The legend is not painted by QwtPolarRenderer
+         */
+        ExternalLegend
+    };
+
+    explicit QwtPolarPlot( QWidget* parent = NULL );
+    QwtPolarPlot( const QwtText& title, QWidget* parent = NULL );
+
+    virtual ~QwtPolarPlot();
+
+    void setTitle( const QString& );
+    void setTitle( const QwtText& );
+
+    QwtText title() const;
+
+    QwtTextLabel* titleLabel();
+    const QwtTextLabel* titleLabel() const;
+
+    void setAutoReplot( bool tf = true );
+    bool autoReplot() const;
+
+    void setAutoScale( int scaleId );
+    bool hasAutoScale( int scaleId ) const;
+
+    void setScaleMaxMinor( int scaleId, int maxMinor );
+    int scaleMaxMinor( int scaleId ) const;
+
+    int scaleMaxMajor( int scaleId ) const;
+    void setScaleMaxMajor( int scaleId, int maxMajor );
+
+    QwtScaleEngine* scaleEngine( int scaleId );
+    const QwtScaleEngine* scaleEngine( int scaleId ) const;
+    void setScaleEngine( int scaleId, QwtScaleEngine* );
+
+    void setScale( int scaleId, double min, double max, double step = 0 );
+
+    void setScaleDiv( int scaleId, const QwtScaleDiv& );
+    const QwtScaleDiv* scaleDiv( int scaleId ) const;
+    QwtScaleDiv* scaleDiv( int scaleId );
+
+    QwtScaleMap scaleMap( int scaleId, double radius ) const;
+    QwtScaleMap scaleMap( int scaleId ) const;
+
+    void updateScale( int scaleId );
+
+    double azimuthOrigin() const;
+
+    void zoom( const QwtPointPolar&, double factor );
+    void unzoom();
+
+    QwtPointPolar zoomPos() const;
+    double zoomFactor() const;
+
+    // Canvas
+
+    QwtPolarCanvas* canvas();
+    const QwtPolarCanvas* canvas() const;
+
+    void setPlotBackground ( const QBrush& c );
+    const QBrush& plotBackground() const;
+
+    virtual void drawCanvas( QPainter*, const QRectF& ) const;
+
+    // Legend
+
+    void insertLegend( QwtAbstractLegend*,
+        LegendPosition = RightLegend, double ratio = -1.0 );
+
+    QwtAbstractLegend* legend();
+    const QwtAbstractLegend* legend() const;
+
+    void updateLegend();
+    void updateLegend( const QwtPolarItem* );
+
+    // Layout
+    QwtPolarLayout* plotLayout();
+    const QwtPolarLayout* plotLayout() const;
+
+    QwtInterval visibleInterval() const;
+    QRectF plotRect() const;
+    QRectF plotRect( const QRectF& ) const;
+
+    int plotMarginHint() const;
+
+    virtual QVariant itemToInfo( QwtPolarItem* ) const;
+    virtual QwtPolarItem* infoToItem( const QVariant& ) const;
+
+  Q_SIGNALS:
+    /*!
+       A signal indicating, that an item has been attached/detached
+
+       \param plotItem Plot item
+       \param on Attached/Detached
+     */
+    void itemAttached( QwtPolarItem* plotItem, bool on );
+
+    /*!
+       A signal with the attributes how to update
+       the legend entries for a plot item.
+
+       \param itemInfo Info about a plot, build from itemToInfo()
+       \param data Attributes of the entries ( usually <= 1 ) for the plot item.
+
+       \sa itemToInfo(), infoToItem(), QwtAbstractLegend::updateLegend()
+     */
+    void legendDataChanged( const QVariant& itemInfo,
+        const QList< QwtLegendData >& data );
+
+    /*!
+       A signal that is emitted, whenever the layout of the plot
+       has been recalculated.
+     */
+    void layoutChanged();
+
+  public Q_SLOTS:
+    virtual void replot();
+    void autoRefresh();
+    void setAzimuthOrigin( double );
+
+  protected:
+    virtual bool event( QEvent* ) QWT_OVERRIDE;
+    virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
+
+    virtual void updateLayout();
+
+    virtual void drawItems( QPainter* painter,
+        const QwtScaleMap& radialMap, const QwtScaleMap& azimuthMap,
+        const QPointF& pole, double radius,
+        const QRectF& canvasRect ) const;
+
+  private:
+    friend class QwtPolarItem;
+    void attachItem( QwtPolarItem*, bool );
+
+    void initPlot( const QwtText& );
+
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_renderer.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_renderer.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_renderer.cpp	(revision 11158)
@@ -0,0 +1,483 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_renderer.h"
+#include "qwt_polar_plot.h"
+#include "qwt_polar_layout.h"
+#include "qwt_legend.h"
+#include "qwt_dyngrid_layout.h"
+#include "qwt_text_label.h"
+#include "qwt_text.h"
+
+#include <qpainter.h>
+#include <qprinter.h>
+#include <qprintdialog.h>
+#include <qfiledialog.h>
+#include <qimagewriter.h>
+#include <qfileinfo.h>
+#include <qmath.h>
+
+#ifndef QWT_NO_SVG
+#ifdef QT_SVG_LIB
+#define QWT_FORMAT_SVG 1
+#endif
+#endif
+
+#ifndef QT_NO_PRINTER
+#define QWT_FORMAT_PDF 1
+#endif
+
+#ifndef QT_NO_PDF
+
+// QPdfWriter::setResolution() has been introduced with
+// Qt 5.3. Guess it is o.k. to stay with QPrinter for older
+// versions.
+
+#if QT_VERSION >= 0x050300
+
+#ifndef QWT_FORMAT_PDF
+#define QWT_FORMAT_PDF 1
+#endif
+
+#define QWT_PDF_WRITER 1
+
+#endif
+#endif
+
+#ifndef QT_NO_PRINTER
+// postscript support has been dropped in Qt5
+#if QT_VERSION < 0x050000
+#define QWT_FORMAT_POSTSCRIPT 1
+#endif
+#endif
+
+#if QWT_FORMAT_SVG
+#include <qsvggenerator.h>
+#endif
+
+#if QWT_PDF_WRITER
+#include <qpdfwriter.h>
+#endif
+
+static inline double qwtDistance(
+    const QPointF& p1, const QPointF& p2 )
+{
+    double dx = p2.x() - p1.x();
+    double dy = p2.y() - p1.y();
+    return qSqrt( dx * dx + dy * dy );
+}
+
+class QwtPolarRenderer::PrivateData
+{
+  public:
+    PrivateData()
+        : plot( NULL )
+    {
+    }
+
+    QwtPolarPlot* plot;
+};
+
+/*!
+   Constructor
+   \param parent Parent object
+ */
+QwtPolarRenderer::QwtPolarRenderer( QObject* parent )
+    : QObject( parent )
+{
+    m_data = new PrivateData;
+}
+
+//! Destructor
+QwtPolarRenderer::~QwtPolarRenderer()
+{
+    delete m_data;
+}
+
+/*!
+   Render a polar plot to a file
+
+   The format of the document will be autodetected from the
+   suffix of the filename.
+
+   \param plot Plot widget
+   \param fileName Path of the file, where the document will be stored
+   \param sizeMM Size for the document in millimeters.
+   \param resolution Resolution in dots per Inch (dpi)
+ */
+void QwtPolarRenderer::renderDocument( QwtPolarPlot* plot,
+    const QString& fileName, const QSizeF& sizeMM, int resolution )
+{
+    renderDocument( plot, fileName,
+        QFileInfo( fileName ).suffix(), sizeMM, resolution );
+}
+
+/*!
+   Render a plot to a file
+
+   Supported formats are:
+
+   - pdf\n
+   - ps\n
+   - svg\n
+   - all image formats supported by Qt, see QImageWriter::supportedImageFormats()
+
+   \param plot Plot widget
+   \param fileName Path of the file, where the document will be stored
+   \param format Format for the document
+   \param sizeMM Size for the document in millimeters.
+   \param resolution Resolution in dots per Inch (dpi)
+
+   \sa renderTo(), render(), QwtPainter::setRoundingAlignment()
+ */
+void QwtPolarRenderer::renderDocument( QwtPolarPlot* plot,
+    const QString& fileName, const QString& format,
+    const QSizeF& sizeMM, int resolution )
+{
+    if ( plot == NULL || sizeMM.isEmpty() || resolution <= 0 )
+        return;
+
+    QString title = plot->title().text();
+    if ( title.isEmpty() )
+        title = "Plot Document";
+
+    const double mmToInch = 1.0 / 25.4;
+    const QSizeF size = sizeMM * mmToInch * resolution;
+
+    const QRectF documentRect( 0.0, 0.0, size.width(), size.height() );
+
+    const QString fmt = format.toLower();
+    if ( format == "pdf" )
+    {
+#if QWT_FORMAT_PDF
+#if QWT_PDF_WRITER
+        QPdfWriter pdfWriter( fileName );
+        pdfWriter.setPageSize( QPageSize( sizeMM, QPageSize::Millimeter ) );
+        pdfWriter.setTitle( title );
+        pdfWriter.setPageMargins( QMarginsF() );
+        pdfWriter.setResolution( resolution );
+
+        QPainter painter( &pdfWriter );
+        render( plot, &painter, documentRect );
+
+#else
+        QPrinter printer;
+        printer.setOutputFormat( QPrinter::PdfFormat );
+        printer.setColorMode( QPrinter::Color );
+        printer.setFullPage( true );
+        printer.setPaperSize( sizeMM, QPrinter::Millimeter );
+        printer.setDocName( title );
+        printer.setOutputFileName( fileName );
+        printer.setResolution( resolution );
+
+        QPainter painter( &printer );
+        render( plot, &painter, documentRect );
+#endif
+#endif
+    }
+    else if ( format == "ps" )
+    {
+#if QWT_FORMAT_POSTSCRIPT
+        QPrinter printer;
+        printer.setColorMode( QPrinter::Color );
+        printer.setFullPage( true );
+        printer.setPaperSize( sizeMM, QPrinter::Millimeter );
+        printer.setDocName( title );
+        printer.setOutputFileName( fileName );
+        printer.setOutputFormat( QPrinter::PostScriptFormat );
+        printer.setResolution( resolution );
+
+        QPainter painter( &printer );
+        render( plot, &painter, documentRect );
+#endif
+    }
+    else if ( format == "svg" )
+    {
+#ifdef QWT_FORMAT_SVG
+        QSvgGenerator generator;
+        generator.setTitle( title );
+        generator.setFileName( fileName );
+        generator.setResolution( resolution );
+        generator.setViewBox( documentRect );
+
+        QPainter painter( &generator );
+        render( plot, &painter, documentRect );
+#endif
+    }
+    else
+    {
+        if ( QImageWriter::supportedImageFormats().indexOf(
+            format.toLatin1() ) >= 0 )
+        {
+            const QRect imageRect = documentRect.toRect();
+            const int dotsPerMeter = qRound( resolution * mmToInch * 1000.0 );
+
+            QImage image( imageRect.size(), QImage::Format_ARGB32 );
+            image.setDotsPerMeterX( dotsPerMeter );
+            image.setDotsPerMeterY( dotsPerMeter );
+            image.fill( QColor( Qt::white ).rgb() );
+
+            QPainter painter( &image );
+            render( plot, &painter, imageRect );
+            painter.end();
+
+            image.save( fileName, format.toLatin1() );
+        }
+    }
+}
+
+/*!
+   \brief Render the plot to a \c QPaintDevice
+
+   This function renders the contents of a QwtPolarPlot instance to
+   \c QPaintDevice object. The target rectangle is derived from
+   its device metrics.
+
+   \param plot Plot to be rendered
+   \param paintDevice device to paint on, f.e a QImage
+
+   \sa renderDocument(), render(), QwtPainter::setRoundingAlignment()
+ */
+
+void QwtPolarRenderer::renderTo(
+    QwtPolarPlot* plot, QPaintDevice& paintDevice ) const
+{
+    int w = paintDevice.width();
+    int h = paintDevice.height();
+
+    QPainter p( &paintDevice );
+    render( plot, &p, QRectF( 0, 0, w, h ) );
+}
+
+
+/*!
+   \brief Render the plot to a QPrinter
+
+   This function renders the contents of a QwtPolarPlot instance to
+   \c QPaintDevice object. The size is derived from the printer
+   metrics.
+
+   \param plot Plot to be rendered
+   \param printer Printer to paint on
+
+   \sa renderDocument(), render(), QwtPainter::setRoundingAlignment()
+ */
+
+#ifndef QT_NO_PRINTER
+
+void QwtPolarRenderer::renderTo(
+    QwtPolarPlot* plot, QPrinter& printer ) const
+{
+    int w = printer.width();
+    int h = printer.height();
+
+    QRectF rect( 0, 0, w, h );
+    double aspect = rect.width() / rect.height();
+    if ( ( aspect < 1.0 ) )
+        rect.setHeight( aspect * rect.width() );
+
+    QPainter p( &printer );
+    render( plot, &p, rect );
+}
+
+#endif
+
+#ifdef QWT_FORMAT_SVG
+
+/*!
+   \brief Render the plot to a QSvgGenerator
+
+   If the generator has a view box, the plot will be rendered into it.
+   If it has no viewBox but a valid size the target coordinates
+   will be (0, 0, generator.width(), generator.height()). Otherwise
+   the target rectangle will be QRectF(0, 0, 800, 600);
+
+   \param plot Plot to be rendered
+   \param generator SVG generator
+ */
+void QwtPolarRenderer::renderTo(
+    QwtPolarPlot* plot, QSvgGenerator& generator ) const
+{
+    QRectF rect = generator.viewBoxF();
+    if ( rect.isEmpty() )
+        rect.setRect( 0, 0, generator.width(), generator.height() );
+
+    if ( rect.isEmpty() )
+        rect.setRect( 0, 0, 800, 600 ); // something
+
+    QPainter p( &generator );
+    render( plot, &p, rect );
+}
+
+#endif
+
+/*!
+   \brief Render the plot to a given rectangle ( f.e QPrinter, QSvgRenderer )
+
+   \param plot Plot widget to be rendered
+   \param painter Painter
+   \param plotRect Bounding rectangle for the plot
+ */
+void QwtPolarRenderer::render( QwtPolarPlot* plot,
+    QPainter* painter, const QRectF& plotRect ) const
+{
+    if ( plot == NULL || painter == NULL || !painter->isActive() ||
+        !plotRect.isValid() || plot->size().isNull() )
+    {
+        return;
+    }
+
+    m_data->plot = plot;
+
+    /*
+       The layout engine uses the same methods as they are used
+       by the Qt layout system. Therefore we need to calculate the
+       layout in screen coordinates and paint with a scaled painter.
+     */
+    QTransform transform;
+    transform.scale(
+        double( painter->device()->logicalDpiX() ) / plot->logicalDpiX(),
+        double( painter->device()->logicalDpiY() ) / plot->logicalDpiY() );
+
+    const QRectF layoutRect = transform.inverted().mapRect( plotRect );
+
+    QwtPolarLayout* layout = plot->plotLayout();
+
+    // All paint operations need to be scaled according to
+    // the paint device metrics.
+
+    QwtPolarLayout::Options layoutOptions =
+        QwtPolarLayout::IgnoreScrollbars | QwtPolarLayout::IgnoreFrames;
+
+    layout->activate( plot, layoutRect, layoutOptions );
+
+    painter->save();
+    painter->setWorldTransform( transform, true );
+
+    painter->save();
+    renderTitle( painter, layout->titleRect() );
+    painter->restore();
+
+    painter->save();
+    renderLegend( plot, painter, layout->legendRect() );
+    painter->restore();
+
+    const QRectF canvasRect = layout->canvasRect();
+
+    painter->save();
+    painter->setClipRect( canvasRect );
+    plot->drawCanvas( painter, canvasRect );
+    painter->restore();
+
+    painter->restore();
+
+    layout->invalidate();
+
+    m_data->plot = NULL;
+}
+
+/*!
+   Render the title into a given rectangle.
+
+   \param painter Painter
+   \param rect Bounding rectangle
+ */
+
+void QwtPolarRenderer::renderTitle( QPainter* painter, const QRectF& rect ) const
+{
+    QwtTextLabel* title = m_data->plot->titleLabel();
+
+    painter->setFont( title->font() );
+
+    const QColor color = title->palette().color(
+        QPalette::Active, QPalette::Text );
+
+    painter->setPen( color );
+    title->text().draw( painter, rect );
+}
+
+/*!
+   Render the legend into a given rectangle.
+
+   \param plot Plot widget
+   \param painter Painter
+   \param rect Bounding rectangle
+ */
+void QwtPolarRenderer::renderLegend( const QwtPolarPlot* plot,
+    QPainter* painter, const QRectF& rect ) const
+{
+    if ( plot->legend() )
+        plot->legend()->renderLegend( painter, rect, true );
+}
+
+/*!
+   \brief Execute a file dialog and render the plot to the selected file
+
+   The document will be rendered in 85 dpi for a size 30x30 cm
+
+   \param plot Plot widget
+   \param documentName Default document name
+   \param sizeMM Size for the document in millimeters.
+   \param resolution Resolution in dots per Inch (dpi)
+
+   \sa renderDocument()
+ */
+bool QwtPolarRenderer::exportTo( QwtPolarPlot* plot,
+    const QString& documentName, const QSizeF& sizeMM, int resolution )
+{
+    if ( plot == NULL )
+        return false;
+
+    QString fileName = documentName;
+
+    // What about translation
+
+#ifndef QT_NO_FILEDIALOG
+    const QList< QByteArray > imageFormats =
+        QImageWriter::supportedImageFormats();
+
+    QStringList filter;
+#ifndef QT_NO_PRINTER
+    filter += QString( "PDF " ) + tr( "Documents" ) + " (*.pdf)";
+#endif
+#ifndef QWT_NO_SVG
+    filter += QString( "SVG " ) + tr( "Documents" ) + " (*.svg)";
+#endif
+#ifndef QT_NO_PRINTER
+    filter += QString( "Postscript " ) + tr( "Documents" ) + " (*.ps)";
+#endif
+
+    if ( imageFormats.size() > 0 )
+    {
+        QString imageFilter( tr( "Images" ) );
+        imageFilter += " (";
+        for ( int i = 0; i < imageFormats.size(); i++ )
+        {
+            if ( i > 0 )
+                imageFilter += " ";
+            imageFilter += "*.";
+            imageFilter += imageFormats[i];
+        }
+        imageFilter += ")";
+
+        filter += imageFilter;
+    }
+
+    fileName = QFileDialog::getSaveFileName(
+        NULL, tr( "Export File Name" ), fileName,
+        filter.join( ";;" ), NULL, QFileDialog::DontConfirmOverwrite );
+#endif
+    if ( fileName.isEmpty() )
+        return false;
+
+    renderDocument( plot, fileName, sizeMM, resolution );
+
+    return true;
+}
+
+#include "moc_qwt_polar_renderer.cpp"
Index: /trunk/BNC/qwt/qwt_polar_renderer.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_renderer.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_renderer.h	(revision 11158)
@@ -0,0 +1,78 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_RENDERER_H
+#define QWT_POLAR_RENDERER_H
+
+#include "qwt_global.h"
+#include <qobject.h>
+#include <qsize.h>
+
+class QwtPolarPlot;
+class QRectF;
+class QPainter;
+class QPaintDevice;
+
+#ifndef QT_NO_PRINTER
+class QPrinter;
+#endif
+
+#ifndef QWT_NO_SVG
+#ifdef QT_SVG_LIB
+class QSvgGenerator;
+#endif
+#endif
+
+/*!
+   \brief Renderer for exporting a polar plot to a document, a printer
+         or anything else, that is supported by QPainter/QPaintDevice
+ */
+class QWT_EXPORT QwtPolarRenderer : public QObject
+{
+    Q_OBJECT
+
+  public:
+    explicit QwtPolarRenderer( QObject* parent = NULL );
+    virtual ~QwtPolarRenderer();
+
+    void renderDocument( QwtPolarPlot*, const QString& format,
+        const QSizeF& sizeMM, int resolution = 85 );
+
+    void renderDocument( QwtPolarPlot*,
+        const QString& title, const QString& format,
+        const QSizeF& sizeMM, int resolution = 85 );
+
+#ifndef QWT_NO_SVG
+#ifdef QT_SVG_LIB
+    void renderTo( QwtPolarPlot*, QSvgGenerator& ) const;
+#endif
+#endif
+
+#ifndef QT_NO_PRINTER
+    void renderTo( QwtPolarPlot*, QPrinter& ) const;
+#endif
+
+    void renderTo( QwtPolarPlot*, QPaintDevice& ) const;
+
+    virtual void render( QwtPolarPlot*,
+        QPainter*, const QRectF& rect ) const;
+
+    bool exportTo( QwtPolarPlot*, const QString& documentName,
+        const QSizeF& sizeMM = QSizeF( 200, 200 ), int resolution = 85 );
+
+    virtual void renderTitle( QPainter*, const QRectF& ) const;
+
+    virtual void renderLegend(
+        const QwtPolarPlot*, QPainter*, const QRectF& ) const;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_polar_spectrogram.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_polar_spectrogram.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_spectrogram.cpp	(revision 11158)
@@ -0,0 +1,446 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_polar_spectrogram.h"
+#include "qwt_polar.h"
+#include "qwt_polar_plot.h"
+#include "qwt_color_map.h"
+#include "qwt_scale_map.h"
+#include "qwt_raster_data.h"
+#include "qwt_math.h"
+#include "qwt_clipper.h"
+
+#include <qpainter.h>
+#include <qpainterpath.h>
+#include <qthread.h>
+#include <qfuture.h>
+#include <qtconcurrentrun.h>
+#include <qnumeric.h>
+
+class QwtPolarSpectrogram::TileInfo
+{
+  public:
+    QPoint imagePos;
+    QRect rect;
+    QImage* image;
+};
+
+class QwtPolarSpectrogram::PrivateData
+{
+  public:
+    PrivateData()
+        : data( NULL )
+    {
+        colorMap = new QwtLinearColorMap();
+    }
+
+    ~PrivateData()
+    {
+        delete data;
+        delete colorMap;
+    }
+
+    QwtRasterData* data;
+    QwtColorMap* colorMap;
+
+    QwtPolarSpectrogram::PaintAttributes paintAttributes;
+};
+
+//!  Constructor
+QwtPolarSpectrogram::QwtPolarSpectrogram()
+    : QwtPolarItem( QwtText( "Spectrogram" ) )
+{
+    m_data = new PrivateData;
+
+    setItemAttribute( QwtPolarItem::AutoScale );
+    setItemAttribute( QwtPolarItem::Legend, false );
+
+    setZ( 20.0 );
+}
+
+//! Destructor
+QwtPolarSpectrogram::~QwtPolarSpectrogram()
+{
+    delete m_data;
+}
+
+//! \return QwtPolarItem::Rtti_PolarSpectrogram
+int QwtPolarSpectrogram::rtti() const
+{
+    return QwtPolarItem::Rtti_PolarSpectrogram;
+}
+
+/*!
+   Set the data to be displayed
+
+   \param data Spectrogram Data
+   \sa data()
+
+   \warning QwtRasterData::initRaster() is called each time before the
+           image is rendered, but without any useful parameters.
+           Also QwtRasterData::rasterHint() is not used.
+ */
+void QwtPolarSpectrogram::setData( QwtRasterData* data )
+{
+    if ( data != m_data->data )
+    {
+        delete m_data->data;
+        m_data->data = data;
+
+        itemChanged();
+    }
+}
+
+/*!
+   \return Spectrogram data
+   \sa setData()
+ */
+const QwtRasterData* QwtPolarSpectrogram::data() const
+{
+    return m_data->data;
+}
+
+/*!
+   Change the color map
+
+   Often it is useful to display the mapping between intensities and
+   colors as an additional plot axis, showing a color bar.
+
+   \param colorMap Color Map
+
+   \sa colorMap(), QwtScaleWidget::setColorBarEnabled(),
+      QwtScaleWidget::setColorMap()
+ */
+void QwtPolarSpectrogram::setColorMap( QwtColorMap* colorMap )
+{
+    if ( m_data->colorMap != colorMap )
+    {
+        delete m_data->colorMap;
+        m_data->colorMap = colorMap;
+    }
+
+    itemChanged();
+}
+
+/*!
+   \return Color Map used for mapping the intensity values to colors
+   \sa setColorMap()
+ */
+const QwtColorMap* QwtPolarSpectrogram::colorMap() const
+{
+    return m_data->colorMap;
+}
+
+/*!
+   Specify an attribute how to draw the curve
+
+   \param attribute Paint attribute
+   \param on On/Off
+   \sa testPaintAttribute()
+ */
+void QwtPolarSpectrogram::setPaintAttribute( PaintAttribute attribute, bool on )
+{
+    if ( on )
+        m_data->paintAttributes |= attribute;
+    else
+        m_data->paintAttributes &= ~attribute;
+}
+
+/*!
+    \param attribute Paint attribute
+    \return True, when attribute has been set
+    \sa setPaintAttribute()
+ */
+bool QwtPolarSpectrogram::testPaintAttribute( PaintAttribute attribute ) const
+{
+    return ( m_data->paintAttributes & attribute );
+}
+
+/*!
+   Draw the spectrogram
+
+   \param painter Painter
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param radius Radius of the complete plot area in painter coordinates
+   \param canvasRect Contents rect of the canvas in painter coordinates
+ */
+void QwtPolarSpectrogram::draw( QPainter* painter,
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, double,
+    const QRectF& canvasRect ) const
+{
+    const QRectF plotRect = plot()->plotRect( canvasRect.toRect() );
+    QRect imageRect = canvasRect.toRect();
+
+    painter->save();
+
+    painter->setClipRect( canvasRect );
+
+    QPainterPath clipPathCanvas;
+    clipPathCanvas.addEllipse( plotRect );
+    painter->setClipPath( clipPathCanvas, Qt::IntersectClip );
+
+    imageRect &= plotRect.toAlignedRect(); // outer rect
+
+    const QwtInterval radialInterval = boundingInterval( QwtPolar::ScaleRadius );
+    if ( radialInterval.isValid() )
+    {
+        const double radius = radialMap.transform( radialInterval.maxValue() ) -
+            radialMap.transform( radialInterval.minValue() );
+
+        QRectF clipRect( 0, 0, 2 * radius, 2 * radius );
+        clipRect.moveCenter( pole );
+
+        imageRect &= clipRect.toRect(); // inner rect, we don't have points outside
+
+        QPainterPath clipPathRadial;
+        clipPathRadial.addEllipse( clipRect );
+        painter->setClipPath( clipPathRadial, Qt::IntersectClip );
+    }
+
+    const QImage image = renderImage( azimuthMap, radialMap, pole, imageRect );
+    painter->drawImage( imageRect, image );
+
+    painter->restore();
+}
+
+/*!
+   \brief Render an image from the data and color map.
+
+   The area is translated into a rect of the paint device.
+   For each pixel of this rect the intensity is mapped
+   into a color.
+
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param rect Target rectangle of the image in painter coordinates
+
+   \return A QImage::Format_Indexed8 or QImage::Format_ARGB32 depending
+           on the color map.
+
+   \sa QwtRasterData::intensity(), QwtColorMap::rgb(),
+       QwtColorMap::colorIndex()
+ */
+QImage QwtPolarSpectrogram::renderImage(
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, const QRect& rect ) const
+{
+    if ( m_data->data == NULL || m_data->colorMap == NULL )
+        return QImage();
+
+    QImage image( rect.size(), m_data->colorMap->format() == QwtColorMap::RGB
+                  ? QImage::Format_ARGB32 : QImage::Format_Indexed8 );
+
+    const QwtInterval intensityRange = m_data->data->interval( Qt::ZAxis );
+    if ( !intensityRange.isValid() )
+        return image;
+
+    if ( m_data->colorMap->format() == QwtColorMap::Indexed )
+        image.setColorTable( m_data->colorMap->colorTable256() );
+
+    /*
+       For the moment we only announce the composition of the image by
+       calling initRaster(), but we don't pass any useful parameters.
+       ( How to map rect into something, that is useful to initialize a matrix
+       of values in polar coordinates ? )
+     */
+    m_data->data->initRaster( QRectF(), QSize() );
+
+
+#if !defined( QT_NO_QFUTURE )
+    uint numThreads = renderThreadCount();
+
+    if ( numThreads <= 0 )
+        numThreads = QThread::idealThreadCount();
+
+    if ( numThreads <= 0 )
+        numThreads = 1;
+
+    const int numRows = rect.height() / numThreads;
+
+
+    QVector< TileInfo > tileInfos;
+    for ( uint i = 0; i < numThreads; i++ )
+    {
+        QRect tile( rect.x(), rect.y() + i * numRows, rect.width(), numRows );
+        if ( i == numThreads - 1 )
+            tile.setHeight( rect.height() - i * numRows );
+
+        TileInfo tileInfo;
+        tileInfo.imagePos = rect.topLeft();
+        tileInfo.rect = tile;
+        tileInfo.image = &image;
+
+        tileInfos += tileInfo;
+    }
+
+    QVector< QFuture< void > > futures;
+    for ( int i = 0; i < tileInfos.size(); i++ )
+    {
+        if ( i == tileInfos.size() - 1 )
+        {
+            renderTileInfo( azimuthMap, radialMap, pole, &tileInfos[i] );
+        }
+        else
+        {
+            futures += QtConcurrent::run(
+#if QT_VERSION >= 0x060000
+                &QwtPolarSpectrogram::renderTileInfo, this,
+#else
+                this, &QwtPolarSpectrogram::renderTileInfo,
+#endif
+                azimuthMap, radialMap, pole, &tileInfos[i] );
+        }
+    }
+
+    for ( int i = 0; i < futures.size(); i++ )
+        futures[i].waitForFinished();
+
+#else
+    renderTile( azimuthMap, radialMap, pole, rect.topLeft(), rect, &image );
+#endif
+
+    m_data->data->discardRaster();
+
+    return image;
+}
+
+void QwtPolarSpectrogram::renderTileInfo(
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, TileInfo* tileInfo ) const
+{
+    renderTile( azimuthMap, radialMap, pole,
+        tileInfo->imagePos, tileInfo->rect, tileInfo->image );
+}
+
+/*!
+   \brief Render a sub-rectangle of an image
+
+   renderTile() is called by renderImage() to render different parts
+   of the image by concurrent threads.
+
+   \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
+   \param radialMap Maps radius values into painter coordinates.
+   \param pole Position of the pole in painter coordinates
+   \param imagePos Top/left position of the image in painter coordinates
+   \param tile Sub-rectangle of the tile in painter coordinates
+   \param image Image to be rendered
+
+   \sa setRenderThreadCount()
+   \note renderTile needs to be reentrant
+ */
+void QwtPolarSpectrogram::renderTile(
+    const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+    const QPointF& pole, const QPoint& imagePos,
+    const QRect& tile, QImage* image ) const
+{
+    const QwtInterval intensityRange = m_data->data->interval( Qt::ZAxis );
+    if ( !intensityRange.isValid() )
+        return;
+
+    const bool doFastAtan = testPaintAttribute( ApproximatedAtan );
+
+    const int y0 = imagePos.y();
+    const int y1 = tile.top();
+    const int y2 = tile.bottom();
+
+    const int x0 = imagePos.x();
+    const int x1 = tile.left();
+    const int x2 = tile.right();
+
+    if ( m_data->colorMap->format() == QwtColorMap::RGB )
+    {
+        for ( int y = y1; y <= y2; y++ )
+        {
+            const double dy = pole.y() - y;
+            const double dy2 = qwtSqr( dy );
+
+            QRgb* line = reinterpret_cast< QRgb* >( image->scanLine( y - y0 ) );
+            line += x1 - x0;
+
+            for ( int x = x1; x <= x2; x++ )
+            {
+                const double dx = x - pole.x();
+
+                double a = doFastAtan ? qwtFastAtan2( dy, dx ) : qAtan2( dy, dx );
+
+                if ( a < 0.0 )
+                    a += 2 * M_PI;
+
+                if ( a < azimuthMap.p1() )
+                    a += 2 * M_PI;
+
+                const double r = qSqrt( qwtSqr( dx ) + dy2 );
+
+                const double azimuth = azimuthMap.invTransform( a );
+                const double radius = radialMap.invTransform( r );
+
+                const double value = m_data->data->value( azimuth, radius );
+                if ( qIsNaN( value ) )
+                {
+                    *line++ = 0u;
+                }
+                else
+                {
+                    *line++ = m_data->colorMap->rgb( intensityRange, value );
+                }
+            }
+        }
+    }
+    else if ( m_data->colorMap->format() == QwtColorMap::Indexed )
+    {
+        for ( int y = y1; y <= y2; y++ )
+        {
+            const double dy = pole.y() - y;
+            const double dy2 = qwtSqr( dy );
+
+            unsigned char* line = image->scanLine( y - y0 );
+            line += x1 - x0;
+            for ( int x = x1; x <= x2; x++ )
+            {
+                const double dx = x - pole.x();
+
+                double a = doFastAtan ? qwtFastAtan2( dy, dx ) : qAtan2( dy, dx );
+                if ( a < 0.0 )
+                    a += 2 * M_PI;
+                if ( a < azimuthMap.p1() )
+                    a += 2 * M_PI;
+
+                const double r = qSqrt( qwtSqr( dx ) + dy2 );
+
+                const double azimuth = azimuthMap.invTransform( a );
+                const double radius = radialMap.invTransform( r );
+
+                const double value = m_data->data->value( azimuth, radius );
+
+                const uint index = m_data->colorMap->colorIndex( 256, intensityRange, value );
+                *line++ = static_cast< unsigned char >( index );
+            }
+        }
+    }
+}
+
+/*!
+   Interval, that is necessary to display the item
+   This interval can be useful for operations like clipping or autoscaling
+
+   \param scaleId Scale index
+   \return bounding interval ( == position )
+
+   \sa position()
+ */
+QwtInterval QwtPolarSpectrogram::boundingInterval( int scaleId ) const
+{
+    if ( scaleId == QwtPolar::ScaleRadius )
+        return m_data->data->interval( Qt::YAxis );
+
+    return QwtPolarItem::boundingInterval( scaleId );
+}
Index: /trunk/BNC/qwt/qwt_polar_spectrogram.h
===================================================================
--- /trunk/BNC/qwt/qwt_polar_spectrogram.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_polar_spectrogram.h	(revision 11158)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * QwtPolar Widget Library
+ * Copyright (C) 2008   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_POLAR_SPECTROGRAM_H
+#define QWT_POLAR_SPECTROGRAM_H
+
+#include "qwt_global.h"
+#include "qwt_polar_item.h"
+#include <qimage.h>
+
+class QwtRasterData;
+class QwtColorMap;
+
+/*!
+   \brief An item, which displays a spectrogram
+
+   A spectrogram displays 3-dimensional data, where the 3rd dimension
+   ( the intensity ) is displayed using colors. The colors are calculated
+   from the values using a color map.
+
+   \sa QwtRasterData, QwtColorMap
+ */
+class QWT_EXPORT QwtPolarSpectrogram : public QwtPolarItem
+{
+  public:
+    /*!
+        Attributes to modify the drawing algorithm.
+        The default setting disables ApproximatedAtan
+
+        \sa setPaintAttribute(), testPaintAttribute()
+     */
+    enum PaintAttribute
+    {
+        /*!
+           Use qwtFastAtan2 instead of atan2 for translating
+           widget into polar coordinates.
+         */
+
+        ApproximatedAtan = 0x01
+    };
+
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
+
+    explicit QwtPolarSpectrogram();
+    virtual ~QwtPolarSpectrogram();
+
+    void setData( QwtRasterData* data );
+    const QwtRasterData* data() const;
+
+    void setColorMap( QwtColorMap* );
+    const QwtColorMap* colorMap() const;
+
+    void setPaintAttribute( PaintAttribute, bool on = true );
+    bool testPaintAttribute( PaintAttribute ) const;
+
+    virtual int rtti() const QWT_OVERRIDE;
+
+    virtual void draw( QPainter* painter,
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, double radius,
+        const QRectF& canvasRect ) const QWT_OVERRIDE;
+
+    virtual QwtInterval boundingInterval( int scaleId ) const QWT_OVERRIDE;
+
+  protected:
+    virtual QImage renderImage(
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, const QRect& rect ) const;
+
+    virtual void renderTile(
+        const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
+        const QPointF& pole, const QPoint& imagePos,
+        const QRect& tile, QImage* image ) const;
+
+  private:
+    class TileInfo;
+    void renderTileInfo( const QwtScaleMap&, const QwtScaleMap&,
+        const QPointF& pole, TileInfo* ) const;
+
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarSpectrogram::PaintAttributes )
+
+#endif
Index: /trunk/BNC/qwt/qwt_raster_data.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_raster_data.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_raster_data.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,11 +10,17 @@
 #include "qwt_raster_data.h"
 #include "qwt_point_3d.h"
+#include "qwt_interval.h"
+
+#include <qrect.h>
+#include <qpolygon.h>
 #include <qnumeric.h>
+#include <qlist.h>
+#include <qmap.h>
 
 class QwtRasterData::ContourPlane
 {
-public:
-    inline ContourPlane( double z ):
-        d_z( z )
+  public:
+    explicit inline ContourPlane( double z ):
+        m_z( z )
     {
     }
@@ -23,12 +29,12 @@
         QPointF line[2], bool ignoreOnPlane ) const;
 
-    inline double z() const { return d_z; }
-
-private:
+    inline double z() const { return m_z; }
+
+  private:
     inline int compare( double z ) const;
     inline QPointF intersection(
-        const QwtPoint3D& p1, const QwtPoint3D &p2 ) const;
-
-    double d_z;
+        const QwtPoint3D& p1, const QwtPoint3D& p2 ) const;
+
+    double m_z;
 };
 
@@ -65,5 +71,5 @@
     };
 
-    const int edgeType = tab[eq1+1][eq2+1][eq3+1];
+    const int edgeType = tab[eq1 + 1][eq2 + 1][eq3 + 1];
     switch ( edgeType )
     {
@@ -135,8 +141,8 @@
 inline int QwtRasterData::ContourPlane::compare( double z ) const
 {
-    if ( z > d_z )
+    if ( z > m_z )
         return 1;
 
-    if ( z < d_z )
+    if ( z < m_z )
         return -1;
 
@@ -145,8 +151,8 @@
 
 inline QPointF QwtRasterData::ContourPlane::intersection(
-    const QwtPoint3D& p1, const QwtPoint3D &p2 ) const
-{
-    const double h1 = p1.z() - d_z;
-    const double h2 = p2.z() - d_z;
+    const QwtPoint3D& p1, const QwtPoint3D& p2 ) const
+{
+    const double h1 = p1.z() - m_z;
+    const double h2 = p2.z() - m_z;
 
     const double x = ( h2 * p1.x() - h1 * p2.x() ) / ( h2 - h1 );
@@ -156,7 +162,14 @@
 }
 
+class QwtRasterData::PrivateData
+{
+  public:
+    QwtRasterData::Attributes attributes;
+};
+
 //! Constructor
 QwtRasterData::QwtRasterData()
 {
+    m_data = new PrivateData();
 }
 
@@ -164,35 +177,47 @@
 QwtRasterData::~QwtRasterData()
 {
-}
-
-/*!
-   Set the bounding interval for the x, y or z coordinates.
-
-   \param axis Axis
-   \param interval Bounding interval
-
-   \sa interval()
-*/
-void QwtRasterData::setInterval( Qt::Axis axis, const QwtInterval &interval )
-{
-    d_intervals[axis] = interval;
-}
-
-/*!
-  \brief Initialize a raster
-
-  Before the composition of an image QwtPlotSpectrogram calls initRaster(),
-  announcing the area and its resolution that will be requested.
-
-  The default implementation does nothing, but for data sets that
-  are stored in files, it might be good idea to reimplement initRaster(),
-  where the data is resampled and loaded into memory.
-
-  \param area Area of the raster
-  \param raster Number of horizontal and vertical pixels
-
-  \sa initRaster(), value()
-*/
-void QwtRasterData::initRaster( const QRectF &area, const QSize &raster )
+    delete m_data;
+}
+
+/*!
+   Specify an attribute of the data
+
+   \param attribute Attribute
+   \param on On/Off
+   /sa Attribute, testAttribute()
+ */
+void QwtRasterData::setAttribute( Attribute attribute, bool on )
+{
+    if ( on )
+        m_data->attributes |= attribute;
+    else
+        m_data->attributes &= ~attribute;
+}
+
+/*!
+    \return True, when attribute is enabled
+    \sa Attribute, setAttribute()
+ */
+bool QwtRasterData::testAttribute( Attribute attribute ) const
+{
+    return m_data->attributes & attribute;
+}
+
+/*!
+   \brief Initialize a raster
+
+   Before the composition of an image QwtPlotSpectrogram calls initRaster(),
+   announcing the area and its resolution that will be requested.
+
+   The default implementation does nothing, but for data sets that
+   are stored in files, it might be good idea to reimplement initRaster(),
+   where the data is resampled and loaded into memory.
+
+   \param area Area of the raster
+   \param raster Number of horizontal and vertical pixels
+
+   \sa initRaster(), value()
+ */
+void QwtRasterData::initRaster( const QRectF& area, const QSize& raster )
 {
     Q_UNUSED( area );
@@ -201,13 +226,13 @@
 
 /*!
-  \brief Discard a raster
-
-  After the composition of an image QwtPlotSpectrogram calls discardRaster().
-
-  The default implementation does nothing, but if data has been loaded
-  in initRaster(), it could deleted now.
-
-  \sa initRaster(), value()
-*/
+   \brief Discard a raster
+
+   After the composition of an image QwtPlotSpectrogram calls discardRaster().
+
+   The default implementation does nothing, but if data has been loaded
+   in initRaster(), it could deleted now.
+
+   \sa initRaster(), value()
+ */
 void QwtRasterData::discardRaster()
 {
@@ -239,6 +264,6 @@
 
    \return Bounding rectangle of a pixel
-*/
-QRectF QwtRasterData::pixelHint( const QRectF &area ) const
+ */
+QRectF QwtRasterData::pixelHint( const QRectF& area ) const
 {
     Q_UNUSED( area );
@@ -258,8 +283,8 @@
    An adaption of CONREC, a simple contouring algorithm.
    http://local.wasp.uwa.edu.au/~pbourke/papers/conrec/
-*/
+ */
 QwtRasterData::ContourLines QwtRasterData::contourLines(
-    const QRectF &rect, const QSize &raster,
-    const QList<double> &levels, ConrecFlags flags ) const
+    const QRectF& rect, const QSize& raster,
+    const QList< double >& levels, ConrecFlags flags ) const
 {
     ContourLines contourLines;
@@ -279,11 +304,6 @@
         ignoreOutOfRange = flags & IgnoreOutOfRange;
 
-    QwtRasterData *that = const_cast<QwtRasterData *>( this );
+    QwtRasterData* that = const_cast< QwtRasterData* >( this );
     that->initRaster( rect, raster );
-
-#if __GNUC__ >= 9
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-copy"
-#endif
 
     for ( int y = 0; y < raster.height() - 1; y++ )
@@ -313,5 +333,5 @@
                 xy[TopRight].setZ(
                     value( xy[TopRight].x(), xy[TopRight].y() )
-                );
+                    );
 
                 xy[BottomRight].setX( pos.x() );
@@ -319,5 +339,5 @@
                 xy[BottomRight].setZ(
                     value( xy[BottomRight].x(), xy[BottomRight].y() )
-                );
+                    );
             }
 
@@ -332,8 +352,8 @@
             xy[TopRight].setZ(
                 value( xy[TopRight].x(), xy[TopRight].y() )
-            );
+                );
             xy[BottomRight].setZ(
                 value( xy[BottomRight].x(), xy[BottomRight].y() )
-            );
+                );
 
             double zMin = xy[TopLeft].z();
@@ -380,5 +400,5 @@
                 if ( level < zMin || level > zMax )
                     continue;
-                QPolygonF &lines = contourLines[level];
+                QPolygonF& lines = contourLines[level];
                 const ContourPlane plane( level );
 
@@ -404,8 +424,4 @@
     }
 
-#if __GNUC__ >= 9
-#pragma GCC diagnostic pop
-#endif
-
     that->discardRaster();
 
Index: /trunk/BNC/qwt/qwt_raster_data.h
===================================================================
--- /trunk/BNC/qwt/qwt_raster_data.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_raster_data.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,30 +9,68 @@
 
 #ifndef QWT_RASTER_DATA_H
-#define QWT_RASTER_DATA_H 1
+#define QWT_RASTER_DATA_H
 
 #include "qwt_global.h"
-#include "qwt_interval.h"
-#include <qmap.h>
-#include <qlist.h>
-#include <qpolygon.h>
+#include <qnamespace.h>
 
-class QwtScaleMap;
+class QwtInterval;
+class QPolygonF;
+class QRectF;
+class QSize;
+template< typename T > class QList;
+template< class Key, class T > class QMap;
 
 /*!
-  \brief QwtRasterData defines an interface to any type of raster data.
+   \brief QwtRasterData defines an interface to any type of raster data.
 
-  QwtRasterData is an abstract interface, that is used by
-  QwtPlotRasterItem to find the values at the pixels of its raster.
+   QwtRasterData is an abstract interface, that is used by
+   QwtPlotRasterItem to find the values at the pixels of its raster.
 
-  Often a raster item is used to display values from a matrix. Then the
-  derived raster data class needs to implement some sort of resampling,
-  that maps the raster of the matrix into the requested raster of
-  the raster item ( depending on resolution and scales of the canvas ).
-*/
+   Gaps inside the bounding rectangle of the data can be indicated by NaN
+   values ( when WithoutGaps is disabled ).
+
+   Often a raster item is used to display values from a matrix. Then the
+   derived raster data class needs to implement some sort of resampling,
+   that maps the raster of the matrix into the requested raster of
+   the raster item ( depending on resolution and scales of the canvas ).
+
+   QwtMatrixRasterData implements raster data, that returns values from
+   a given 2D matrix.
+
+   \sa QwtMatrixRasterData
+ */
 class QWT_EXPORT QwtRasterData
 {
-public:
+  public:
     //! Contour lines
-    typedef QMap<double, QPolygonF> ContourLines;
+    typedef QMap< double, QPolygonF > ContourLines;
+
+    /*!
+       \brief Raster data attributes
+
+       Additional information that is used to improve processing
+       of the data.
+     */
+    enum Attribute
+    {
+        /*!
+           The bounding rectangle of the data is spanned by
+           the interval(Qt::XAxis) and interval(Qt::YAxis).
+
+           WithoutGaps indicates, that the data has no gaps
+           ( unknown values ) in this area and the result of
+           value() does not need to be checked for NaN values.
+
+           Enabling this flag will have an positive effect on
+           the performance of rendering a QwtPlotSpectrogram.
+
+           The default setting is false.
+
+           \note NaN values indicate an undefined value
+         */
+        WithoutGaps = 0x01
+    };
+
+    Q_DECLARE_FLAGS( Attributes, Attribute )
 
     //! Flags to modify the contour algorithm
@@ -46,16 +84,21 @@
     };
 
-    //! Flags to modify the contour algorithm
-    typedef QFlags<ConrecFlag> ConrecFlags;
+    Q_DECLARE_FLAGS( ConrecFlags, ConrecFlag )
 
     QwtRasterData();
     virtual ~QwtRasterData();
 
-    virtual void setInterval( Qt::Axis, const QwtInterval & );
-    const QwtInterval &interval(Qt::Axis) const;
+    void setAttribute( Attribute, bool on = true );
+    bool testAttribute( Attribute ) const;
 
-    virtual QRectF pixelHint( const QRectF & ) const;
+    /*!
+       \return Bounding interval for an axis
+       \sa setInterval
+     */
+    virtual QwtInterval interval( Qt::Axis ) const = 0;
 
-    virtual void initRaster( const QRectF &, const QSize& raster );
+    virtual QRectF pixelHint( const QRectF& ) const;
+
+    virtual void initRaster( const QRectF&, const QSize& raster );
     virtual void discardRaster();
 
@@ -64,9 +107,9 @@
        \param x X value in plot coordinates
        \param y Y value in plot coordinates
-    */
+     */
     virtual double value( double x, double y ) const = 0;
 
-    virtual ContourLines contourLines( const QRectF &rect,
-        const QSize &raster, const QList<double> &levels,
+    virtual ContourLines contourLines( const QRectF& rect,
+        const QSize& raster, const QList< double >& levels,
         ConrecFlags ) const;
 
@@ -74,22 +117,13 @@
     class ContourPlane;
 
-private:
-    // Disabled copy constructor and operator=
-    QwtRasterData( const QwtRasterData & );
-    QwtRasterData &operator=( const QwtRasterData & );
+  private:
+    Q_DISABLE_COPY(QwtRasterData)
 
-    QwtInterval d_intervals[3];
+    class PrivateData;
+    PrivateData* m_data;
 };
 
-/*!
-   \return Bounding interval for a axis
-   \sa setInterval
-*/
-inline const QwtInterval &QwtRasterData::interval( Qt::Axis axis) const
-{
-    return d_intervals[axis];
-}
-
 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtRasterData::ConrecFlags )
+Q_DECLARE_OPERATORS_FOR_FLAGS( QwtRasterData::Attributes )
 
 #endif
Index: /trunk/BNC/qwt/qwt_round_scale_draw.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_round_scale_draw.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_round_scale_draw.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,18 +12,17 @@
 #include "qwt_scale_div.h"
 #include "qwt_scale_map.h"
+#include "qwt_text.h"
 #include "qwt_math.h"
-#include <qpen.h>
+
 #include <qpainter.h>
-#include <qfontmetrics.h>
-#include <qmath.h>
 
 class QwtRoundScaleDraw::PrivateData
 {
-public:
-    PrivateData():
-        center( 50.0, 50.0 ),
-        radius( 50.0 ),
-        startAngle( -135.0 ),
-        endAngle( 135.0 )
+  public:
+    PrivateData()
+        : center( 50.0, 50.0 )
+        , radius( 50.0 )
+        , startAngle( -135.0 )
+        , endAngle( 135.0 )
     {
     }
@@ -37,16 +36,16 @@
 
 /*!
-  \brief Constructor
-
-  The range of the scale is initialized to [0, 100],
-  The center is set to (50, 50) with a radius of 50.
-  The angle range is set to [-135, 135].
-*/
+   \brief Constructor
+
+   The range of the scale is initialized to [0, 100],
+   The center is set to (50, 50) with a radius of 50.
+   The angle range is set to [-135, 135].
+ */
 QwtRoundScaleDraw::QwtRoundScaleDraw()
 {
-    d_data = new QwtRoundScaleDraw::PrivateData;
+    m_data = new QwtRoundScaleDraw::PrivateData;
 
     setRadius( 50 );
-    scaleMap().setPaintInterval( d_data->startAngle, d_data->endAngle );
+    scaleMap().setPaintInterval( m_data->startAngle, m_data->endAngle );
 }
 
@@ -54,31 +53,31 @@
 QwtRoundScaleDraw::~QwtRoundScaleDraw()
 {
-    delete d_data;
-}
-
-/*!
-  Change of radius the scale
-
-  Radius is the radius of the backbone without ticks and labels.
-
-  \param radius New Radius
-  \sa moveCenter()
-*/
+    delete m_data;
+}
+
+/*!
+   Change of radius the scale
+
+   Radius is the radius of the backbone without ticks and labels.
+
+   \param radius New Radius
+   \sa moveCenter()
+ */
 void QwtRoundScaleDraw::setRadius( double radius )
 {
-    d_data->radius = radius;
-}
-
-/*!
-  Get the radius
-
-  Radius is the radius of the backbone without ticks and labels.
-
-  \return Radius of the scale
-  \sa setRadius(), extent()
-*/
+    m_data->radius = radius;
+}
+
+/*!
+   Get the radius
+
+   Radius is the radius of the backbone without ticks and labels.
+
+   \return Radius of the scale
+   \sa setRadius(), extent()
+ */
 double QwtRoundScaleDraw::radius() const
 {
-    return d_data->radius;
+    return m_data->radius;
 }
 
@@ -88,8 +87,8 @@
    \param center New center
    \sa setRadius()
-*/
-void QwtRoundScaleDraw::moveCenter( const QPointF &center )
-{
-    d_data->center = center;
+ */
+void QwtRoundScaleDraw::moveCenter( const QPointF& center )
+{
+    m_data->center = center;
 }
 
@@ -97,24 +96,24 @@
 QPointF QwtRoundScaleDraw::center() const
 {
-    return d_data->center;
-}
-
-/*!
-  \brief Adjust the baseline circle segment for round scales.
-
-  The baseline will be drawn from min(angle1,angle2) to max(angle1, angle2).
-  The default setting is [ -135, 135 ].
-  An angle of 0 degrees corresponds to the 12 o'clock position,
-  and positive angles count in a clockwise direction.
-  \param angle1
-  \param angle2 boundaries of the angle interval in degrees.
-  \warning <ul>
-  <li>The angle range is limited to [-360, 360] degrees. Angles exceeding
+    return m_data->center;
+}
+
+/*!
+   \brief Adjust the baseline circle segment for round scales.
+
+   The baseline will be drawn from min(angle1,angle2) to max(angle1, angle2).
+   The default setting is [ -135, 135 ].
+   An angle of 0 degrees corresponds to the 12 o'clock position,
+   and positive angles count in a clockwise direction.
+   \param angle1
+   \param angle2 boundaries of the angle interval in degrees.
+   \warning <ul>
+   <li>The angle range is limited to [-360, 360] degrees. Angles exceeding
       this range will be clipped.
-  <li>For angles more or equal than 360 degrees above or below min(angle1, angle2),
+   <li>For angles more or equal than 360 degrees above or below min(angle1, angle2),
       scale marks will not be drawn.
-  <li>If you need a counterclockwise scale, use QwtScaleDiv::setInterval()
-  </ul>
-*/
+   <li>If you need a counterclockwise scale, use QwtScaleDiv::setInterval()
+   </ul>
+ */
 void QwtRoundScaleDraw::setAngleRange( double angle1, double angle2 )
 {
@@ -124,14 +123,14 @@
 #endif
 
-    d_data->startAngle = angle1;
-    d_data->endAngle = angle2;
-
-    if ( d_data->startAngle == d_data->endAngle )
-    {
-        d_data->startAngle -= 1;
-        d_data->endAngle += 1;
-    }
-
-    scaleMap().setPaintInterval( d_data->startAngle, d_data->endAngle );
+    m_data->startAngle = angle1;
+    m_data->endAngle = angle2;
+
+    if ( m_data->startAngle == m_data->endAngle )
+    {
+        m_data->startAngle -= 1;
+        m_data->endAngle += 1;
+    }
+
+    scaleMap().setPaintInterval( m_data->startAngle, m_data->endAngle );
 }
 
@@ -143,10 +142,10 @@
 
    \sa drawTick(), drawBackbone()
-*/
-void QwtRoundScaleDraw::drawLabel( QPainter *painter, double value ) const
+ */
+void QwtRoundScaleDraw::drawLabel( QPainter* painter, double value ) const
 {
     const double tval = scaleMap().transform( value );
-    if ( ( tval >= d_data->startAngle + 360.0 )
-        || ( tval <= d_data->startAngle - 360.0 ) )
+    if ( ( tval >= m_data->startAngle + 360.0 )
+        || ( tval <= m_data->startAngle - 360.0 ) )
     {
         return;
@@ -157,5 +156,5 @@
         return;
 
-    double radius = d_data->radius;
+    double radius = m_data->radius;
     if ( hasComponent( QwtAbstractScaleDraw::Ticks ) ||
         hasComponent( QwtAbstractScaleDraw::Backbone ) )
@@ -170,8 +169,8 @@
     const double arc = qwtRadians( tval );
 
-    const double x = d_data->center.x() +
-        ( radius + sz.width() / 2.0 ) * qSin( arc );
-    const double y = d_data->center.y() -
-        ( radius + sz.height() / 2.0 ) * qCos( arc );
+    const double x = m_data->center.x() +
+        ( radius + sz.width() / 2.0 ) * std::sin( arc );
+    const double y = m_data->center.y() -
+        ( radius + sz.height() / 2.0 ) * std::cos( arc );
 
     const QRectF r( x - sz.width() / 2, y - sz.height() / 2,
@@ -188,6 +187,6 @@
 
    \sa drawBackbone(), drawLabel()
-*/
-void QwtRoundScaleDraw::drawTick( QPainter *painter, double value, double len ) const
+ */
+void QwtRoundScaleDraw::drawTick( QPainter* painter, double value, double len ) const
 {
     if ( len <= 0 )
@@ -196,15 +195,15 @@
     const double tval = scaleMap().transform( value );
 
-    const double cx = d_data->center.x();
-    const double cy = d_data->center.y();
-    const double radius = d_data->radius;
-
-    if ( ( tval < d_data->startAngle + 360.0 )
-        && ( tval > d_data->startAngle - 360.0 ) )
+    const double cx = m_data->center.x();
+    const double cy = m_data->center.y();
+    const double radius = m_data->radius;
+
+    if ( ( tval < m_data->startAngle + 360.0 )
+        && ( tval > m_data->startAngle - 360.0 ) )
     {
         const double arc = qwtRadians( tval );
 
-        const double sinArc = qSin( arc );
-        const double cosArc = qCos( arc );
+        const double sinArc = std::sin( arc );
+        const double cosArc = std::cos( arc );
 
         const double x1 = cx + radius * sinArc;
@@ -222,16 +221,16 @@
 
    \sa drawTick(), drawLabel()
-*/
-void QwtRoundScaleDraw::drawBackbone( QPainter *painter ) const
+ */
+void QwtRoundScaleDraw::drawBackbone( QPainter* painter ) const
 {
     const double deg1 = scaleMap().p1();
     const double deg2 = scaleMap().p2();
 
-    const int a1 = qRound( qMin( deg1, deg2 ) - 90 );
-    const int a2 = qRound( qMax( deg1, deg2 ) - 90 );
-
-    const double radius = d_data->radius;
-    const double x = d_data->center.x() - radius;
-    const double y = d_data->center.y() - radius;
+    const int a1 = qRound( qwtMinF( deg1, deg2 ) - 90 );
+    const int a2 = qRound( qwtMaxF( deg1, deg2 ) - 90 );
+
+    const double radius = m_data->radius;
+    const double x = m_data->center.x() - radius;
+    const double y = m_data->center.y() - radius;
 
     painter->drawArc( QRectF( x, y, 2 * radius, 2 * radius ),
@@ -253,6 +252,6 @@
             calculates only an upper limit, that might be a
             few pixels too large
-*/
-double QwtRoundScaleDraw::extent( const QFont &font ) const
+ */
+double QwtRoundScaleDraw::extent( const QFont& font ) const
 {
     double d = 0.0;
@@ -260,6 +259,6 @@
     if ( hasComponent( QwtAbstractScaleDraw::Labels ) )
     {
-        const QwtScaleDiv &sd = scaleDiv();
-        const QList<double> &ticks = sd.ticks( QwtScaleDiv::MajorTick );
+        const QwtScaleDiv& sd = scaleDiv();
+        const QList< double >& ticks = sd.ticks( QwtScaleDiv::MajorTick );
         for ( int i = 0; i < ticks.count(); i++ )
         {
@@ -269,6 +268,6 @@
 
             const double tval = scaleMap().transform( value );
-            if ( ( tval < d_data->startAngle + 360 )
-                && ( tval > d_data->startAngle - 360 ) )
+            if ( ( tval < m_data->startAngle + 360 )
+                && ( tval > m_data->startAngle - 360 ) )
             {
                 const QwtText label = tickLabel( font, value );
@@ -281,8 +280,8 @@
                 const double off = qMax( sz.width(), sz.height() );
 
-                double x = off * qSin( arc );
-                double y = off * qCos( arc );
-
-                const double dist = qSqrt( x * x + y * y );
+                double x = off * std::sin( arc );
+                double y = off * std::cos( arc );
+
+                const double dist = std::sqrt( x * x + y * y );
                 if ( dist > d )
                     d = dist;
@@ -298,16 +297,15 @@
     if ( hasComponent( QwtAbstractScaleDraw::Backbone ) )
     {
-        const double pw = qMax( 1, penWidth() );  // pen width can be zero
-        d += pw;
+        d += qwtMaxF( penWidthF(), 1.0 );
     }
 
     if ( hasComponent( QwtAbstractScaleDraw::Labels ) &&
         ( hasComponent( QwtAbstractScaleDraw::Ticks ) ||
-            hasComponent( QwtAbstractScaleDraw::Backbone ) ) )
+        hasComponent( QwtAbstractScaleDraw::Backbone ) ) )
     {
         d += spacing();
     }
 
-    d = qMax( d, minimumExtent() );
+    d = qwtMaxF( d, minimumExtent() );
 
     return d;
Index: /trunk/BNC/qwt/qwt_round_scale_draw.h
===================================================================
--- /trunk/BNC/qwt/qwt_round_scale_draw.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_round_scale_draw.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,22 +13,23 @@
 #include "qwt_global.h"
 #include "qwt_abstract_scale_draw.h"
+
 #include <qpoint.h>
 
 /*!
-  \brief A class for drawing round scales
+   \brief A class for drawing round scales
 
-  QwtRoundScaleDraw can be used to draw round scales.
-  The circle segment can be adjusted by setAngleRange().
-  The geometry of the scale can be specified with
-  moveCenter() and setRadius().
+   QwtRoundScaleDraw can be used to draw round scales.
+   The circle segment can be adjusted by setAngleRange().
+   The geometry of the scale can be specified with
+   moveCenter() and setRadius().
 
-  After a scale division has been specified as a QwtScaleDiv object
-  using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s),
-  the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
-*/
+   After a scale division has been specified as a QwtScaleDiv object
+   using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s),
+   the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
+ */
 
-class QWT_EXPORT QwtRoundScaleDraw: public QwtAbstractScaleDraw
+class QWT_EXPORT QwtRoundScaleDraw : public QwtAbstractScaleDraw
 {
-public:
+  public:
     QwtRoundScaleDraw();
     virtual ~QwtRoundScaleDraw();
@@ -38,22 +39,24 @@
 
     void moveCenter( double x, double y );
-    void moveCenter( const QPointF & );
+    void moveCenter( const QPointF& );
     QPointF center() const;
 
     void setAngleRange( double angle1, double angle2 );
 
-    virtual double extent( const QFont & ) const;
+    virtual double extent( const QFont& ) const QWT_OVERRIDE;
 
-protected:
-    virtual void drawTick( QPainter *, double value, double len ) const;
-    virtual void drawBackbone( QPainter * ) const;
-    virtual void drawLabel( QPainter *, double val ) const;
+  protected:
+    virtual void drawTick( QPainter*,
+        double value, double len ) const QWT_OVERRIDE;
 
-private:
-    QwtRoundScaleDraw( const QwtRoundScaleDraw & );
-    QwtRoundScaleDraw &operator=( const QwtRoundScaleDraw &other );
+    virtual void drawBackbone(
+        QPainter* ) const QWT_OVERRIDE;
 
+    virtual void drawLabel(
+        QPainter*, double value ) const QWT_OVERRIDE;
+
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_samples.h
===================================================================
--- /trunk/BNC/qwt/qwt_samples.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_samples.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,8 +9,9 @@
 
 #ifndef QWT_SAMPLES_H
-#define QWT_SAMPLES_H 1
+#define QWT_SAMPLES_H
 
 #include "qwt_global.h"
 #include "qwt_interval.h"
+
 #include <qvector.h>
 #include <qrect.h>
@@ -19,11 +20,11 @@
 class QWT_EXPORT QwtIntervalSample
 {
-public:
+  public:
     QwtIntervalSample();
-    QwtIntervalSample( double, const QwtInterval & );
+    QwtIntervalSample( double, const QwtInterval& );
     QwtIntervalSample( double value, double min, double max );
 
-    bool operator==( const QwtIntervalSample & ) const;
-    bool operator!=( const QwtIntervalSample & ) const;
+    bool operator==( const QwtIntervalSample& ) const;
+    bool operator!=( const QwtIntervalSample& ) const;
 
     //! Value
@@ -35,31 +36,28 @@
 
 /*!
-  Constructor
-  The value is set to 0.0, the interval is invalid
-*/
-inline QwtIntervalSample::QwtIntervalSample():
-    value( 0.0 )
+   Constructor
+   The value is set to 0.0, the interval is invalid
+ */
+inline QwtIntervalSample::QwtIntervalSample()
+    : value( 0.0 )
 {
 }
 
 //! Constructor
-inline QwtIntervalSample::QwtIntervalSample(
-        double v, const QwtInterval &intv ):
-    value( v ),
-    interval( intv )
+inline QwtIntervalSample::QwtIntervalSample( double v, const QwtInterval& intv )
+    : value( v )
+    , interval( intv )
 {
 }
 
 //! Constructor
-inline QwtIntervalSample::QwtIntervalSample(
-        double v, double min, double max ):
-    value( v ),
-    interval( min, max )
+inline QwtIntervalSample::QwtIntervalSample( double v, double min, double max )
+    : value( v )
+    , interval( min, max )
 {
 }
 
 //! Compare operator
-inline bool QwtIntervalSample::operator==(
-    const QwtIntervalSample &other ) const
+inline bool QwtIntervalSample::operator==( const QwtIntervalSample& other ) const
 {
     return value == other.value && interval == other.interval;
@@ -67,6 +65,5 @@
 
 //! Compare operator
-inline bool QwtIntervalSample::operator!=(
-    const QwtIntervalSample &other ) const
+inline bool QwtIntervalSample::operator!=( const QwtIntervalSample& other ) const
 {
     return !( *this == other );
@@ -76,10 +73,10 @@
 class QWT_EXPORT QwtSetSample
 {
-public:
+  public:
     QwtSetSample();
-    QwtSetSample( double, const QVector<double> & = QVector<double>() );
-
-    bool operator==( const QwtSetSample &other ) const;
-    bool operator!=( const QwtSetSample &other ) const;
+    explicit QwtSetSample( double, const QVector< double >& = QVector< double >( ) );
+
+    bool operator==( const QwtSetSample& other ) const;
+    bool operator!=( const QwtSetSample& other ) const;
 
     double added() const;
@@ -89,30 +86,30 @@
 
     //! Vector of values associated to value
-    QVector<double> set;
+    QVector< double > set;
 };
 
 /*!
-  Constructor
-  The value is set to 0.0
-*/
-inline QwtSetSample::QwtSetSample():
-    value( 0.0 )
-{
-}
-
-/*!
-  Constructor
-
-  \param v Value
-  \param s Set of values
-*/
-inline QwtSetSample::QwtSetSample( double v, const QVector< double > &s ):
-    value( v ),
-    set( s )
+   Constructor
+   The value is set to 0.0
+ */
+inline QwtSetSample::QwtSetSample()
+    : value( 0.0 )
+{
+}
+
+/*!
+   Constructor
+
+   \param v Value
+   \param s Set of values
+ */
+inline QwtSetSample::QwtSetSample( double v, const QVector< double >& s )
+    : value( v )
+    , set( s )
 {
 }
 
 //! Compare operator
-inline bool QwtSetSample::operator==( const QwtSetSample &other ) const
+inline bool QwtSetSample::operator==( const QwtSetSample& other ) const
 {
     return value == other.value && set == other.set;
@@ -120,5 +117,5 @@
 
 //! Compare operator
-inline bool QwtSetSample::operator!=( const QwtSetSample &other ) const
+inline bool QwtSetSample::operator!=( const QwtSetSample& other ) const
 {
     return !( *this == other );
@@ -143,8 +140,8 @@
 
    \sa QwtTradingChartData
-*/
+ */
 class QWT_EXPORT QwtOHLCSample
 {
-public:
+  public:
     QwtOHLCSample( double time = 0.0,
         double open = 0.0, double high = 0.0,
@@ -156,7 +153,7 @@
 
     /*!
-      Time of the sample, usually a number representing
-      a specific interval - like a day.
-    */
+       Time of the sample, usually a number representing
+       a specific interval - like a day.
+     */
     double time;
 
@@ -174,42 +171,41 @@
 };
 
-
-/*!
-  Constructor
-
-  \param t Time value
-  \param o Open value
-  \param h High value
-  \param l Low value
-  \param c Close value
-*/
-inline QwtOHLCSample::QwtOHLCSample( double t,
-        double o, double h, double l, double c ):
-    time( t ),
-    open( o ),
-    high( h ),
-    low( l ),
-    close( c )
-{
-}
-
-/*!
-  \brief Check if a sample is valid
-
-  A sample is valid, when all of the following checks are true:
-
-  - low <= high
-  - low <= open <= high
-  - low <= close <= high
-
-  \return True, when the sample is valid
+/*!
+   Constructor
+
+   \param t Time value
+   \param o Open value
+   \param h High value
+   \param l Low value
+   \param c Close value
+ */
+inline QwtOHLCSample::QwtOHLCSample(
+        double t, double o, double h, double l, double c )
+    : time( t )
+    , open( o )
+    , high( h )
+    , low( l )
+    , close( c )
+{
+}
+
+/*!
+   \brief Check if a sample is valid
+
+   A sample is valid, when all of the following checks are true:
+
+   - low <= high
+   - low <= open <= high
+   - low <= close <= high
+
+   \return True, when the sample is valid
  */
 inline bool QwtOHLCSample::isValid() const
 {
     return ( low <= high )
-        && ( open >= low )
-        && ( open <= high )
-        && ( close >= low )
-        && ( close <= high );
+           && ( open >= low )
+           && ( open <= high )
+           && ( close >= low )
+           && ( close <= high );
 }
 
@@ -237,3 +233,82 @@
 }
 
+/*!
+   \brief Sample used in vector fields
+
+   A vector field sample is a position and a vector - usually
+   representing some direction and magnitude - attached to this position.
+
+   \sa QwtVectorFieldData
+ */
+class QWT_EXPORT QwtVectorFieldSample
+{
+  public:
+    QwtVectorFieldSample( double x = 0.0, double y = 0.0,
+        double vx = 0.0, double vy = 0.0 );
+
+    QwtVectorFieldSample( const QPointF& pos,
+        double vx = 0.0, double vy = 0.0 );
+
+    QPointF pos() const;
+
+    bool isNull() const;
+
+    //! x coordinate of the position
+    double x;
+
+    //! y coordinate of the position
+    double y;
+
+    //! x coordinate of the vector
+    double vx;
+
+    //! y coordinate of the vector
+    double vy;
+};
+
+/*!
+   \brief Constructor
+
+   \param posX x coordinate of the position
+   \param posY y coordinate of the position
+   \param vectorX x coordinate of the vector
+   \param vectorY y coordinate of the vector
+ */
+inline QwtVectorFieldSample::QwtVectorFieldSample(
+        double posX, double posY, double vectorX, double vectorY )
+    : x( posX )
+    , y( posY )
+    , vx( vectorX )
+    , vy( vectorY )
+{
+}
+
+/*!
+   \brief Constructor
+
+   \param pos Position
+   \param vectorX x coordinate of the vector
+   \param vectorY y coordinate of the vector
+ */
+inline QwtVectorFieldSample::QwtVectorFieldSample(
+        const QPointF& pos, double vectorX, double vectorY )
+    : x( pos.x() )
+    , y( pos.y() )
+    , vx( vectorX )
+    , vy( vectorY )
+{
+}
+
+//! \return x/y coordinates as QPointF
+inline QPointF QwtVectorFieldSample::pos() const
+{
+    return QPointF( x, y );
+}
+
+//! \return true, if vx and vy are 0
+inline bool QwtVectorFieldSample::isNull() const
+{
+    return ( vx == 0.0 ) && ( vy == 0.0 );
+}
+
 #endif
Index: /trunk/BNC/qwt/qwt_sampling_thread.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_sampling_thread.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_sampling_thread.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,23 +9,19 @@
 
 #include "qwt_sampling_thread.h"
-#include "qwt_system_clock.h"
+#include <qelapsedtimer.h>
 
 class QwtSamplingThread::PrivateData
 {
-public:
-    QwtSystemClock clock;
-
-    double interval;
-    bool isStopped;
+  public:
+    QElapsedTimer timer;
+    double msecsInterval;
 };
 
-
 //! Constructor
-QwtSamplingThread::QwtSamplingThread( QObject *parent ):
-    QThread( parent )
+QwtSamplingThread::QwtSamplingThread( QObject* parent )
+    : QThread( parent )
 {
-    d_data = new PrivateData;
-    d_data->interval = 1000; // 1 second
-    d_data->isStopped = true;
+    m_data = new PrivateData;
+    m_data->msecsInterval = 1e3; // 1 second
 }
 
@@ -33,5 +29,5 @@
 QwtSamplingThread::~QwtSamplingThread()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -40,13 +36,13 @@
    The default interval is 1000.0 ( = 1s )
 
-   \param interval Interval
+   \param msecs Interval
    \sa interval()
-*/
-void QwtSamplingThread::setInterval( double interval )
+ */
+void QwtSamplingThread::setInterval( double msecs )
 {
-    if ( interval < 0.0 )
-        interval = 0.0;
+    if ( msecs < 0.0 )
+        msecs = 0.0;
 
-    d_data->interval = interval;
+    m_data->msecsInterval = msecs;
 }
 
@@ -54,8 +50,8 @@
    \return Interval (in ms), between 2 calls of sample()
    \sa setInterval()
-*/
+ */
 double QwtSamplingThread::interval() const
 {
-    return d_data->interval;
+    return m_data->msecsInterval;
 }
 
@@ -63,11 +59,11 @@
    \return Time (in ms) since the thread was started
    \sa QThread::start(), run()
-*/
+ */
 double QwtSamplingThread::elapsed() const
 {
-    if ( d_data->isStopped )
-        return 0.0;
+    if ( m_data->timer.isValid() )
+        return m_data->timer.nsecsElapsed() / 1e6;
 
-    return d_data->clock.elapsed();
+    return 0.0;
 }
 
@@ -75,8 +71,8 @@
    Terminate the collecting thread
    \sa QThread::start(), run()
-*/
+ */
 void QwtSamplingThread::stop()
 {
-    d_data->isStopped = true;
+    m_data->timer.invalidate();
 }
 
@@ -84,23 +80,31 @@
    Loop collecting samples started from QThread::start()
    \sa stop()
-*/
+ */
 void QwtSamplingThread::run()
 {
-    d_data->clock.start();
-    d_data->isStopped = false;
+    m_data->timer.start();
 
-    while ( !d_data->isStopped )
+    /*
+        We should have all values in nsecs/qint64, but
+        this would break existing code. TODO ...
+        Anyway - for QThread::usleep we even need microseconds( usecs )
+     */
+    while ( m_data->timer.isValid() )
     {
-        const double elapsed = d_data->clock.elapsed();
-        sample( elapsed / 1000.0 );
+        const qint64 timestamp = m_data->timer.nsecsElapsed();
+        sample( timestamp / 1e9 ); // seconds
 
-        if ( d_data->interval > 0.0 )
+        if ( m_data->msecsInterval > 0.0 )
         {
-            const double msecs =
-                d_data->interval - ( d_data->clock.elapsed() - elapsed );
+            const double interval = m_data->msecsInterval * 1e3;
+            const double elapsed = ( m_data->timer.nsecsElapsed() - timestamp ) / 1e3;
 
-            if ( msecs > 0.0 )
-                usleep( qRound( 1000.0 * msecs ) );
+            const double usecs = interval - elapsed;
+
+            if ( usecs > 0.0 )
+                QThread::usleep( qRound( usecs ) );
         }
     }
 }
+
+#include "moc_qwt_sampling_thread.cpp"
Index: /trunk/BNC/qwt/qwt_sampling_thread.h
===================================================================
--- /trunk/BNC/qwt/qwt_sampling_thread.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_sampling_thread.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -8,6 +8,6 @@
  *****************************************************************************/
 
-#ifndef _QWT_SAMPLING_THREAD_H_
-#define _QWT_SAMPLING_THREAD_H_
+#ifndef QWT_SAMPLING_THREAD_H
+#define QWT_SAMPLING_THREAD_H
 
 #include "qwt_global.h"
@@ -15,20 +15,20 @@
 
 /*!
-  \brief A thread collecting samples at regular intervals.
+   \brief A thread collecting samples at regular intervals.
 
-  Continuous signals are converted into a discrete signal by
-  collecting samples at regular intervals. A discrete signal
-  can be displayed by a QwtPlotSeriesItem on a QwtPlot widget.
+   Continuous signals are converted into a discrete signal by
+   collecting samples at regular intervals. A discrete signal
+   can be displayed by a QwtPlotSeriesItem on a QwtPlot widget.
 
-  QwtSamplingThread starts a thread calling periodically sample(),
-  to collect and store ( or emit ) a single sample.
+   QwtSamplingThread starts a thread calling periodically sample(),
+   to collect and store ( or emit ) a single sample.
 
-  \sa QwtPlotCurve, QwtPlotSeriesItem
-*/
-class QWT_EXPORT QwtSamplingThread: public QThread
+   \sa QwtPlotCurve, QwtPlotSeriesItem
+ */
+class QWT_EXPORT QwtSamplingThread : public QThread
 {
     Q_OBJECT
 
-public:
+  public:
     virtual ~QwtSamplingThread();
 
@@ -36,23 +36,26 @@
     double elapsed() const;
 
-public Q_SLOTS:
+  public Q_SLOTS:
     void setInterval( double interval );
     void stop();
 
-protected:
-    explicit QwtSamplingThread( QObject *parent = NULL );
+  protected:
+    explicit QwtSamplingThread( QObject* parent = NULL );
 
-    virtual void run();
+    virtual void run() QWT_OVERRIDE;
 
     /*!
        Collect a sample
 
-       \param elapsed Time since the thread was started in milliseconds
+       \param elapsed Time since the thread was started in seconds
+       \note Due to a bug in previous version elapsed was passed as
+             seconds instead of miliseconds. To avoid breaking existing
+             code we stay with seconds for now.
      */
     virtual void sample( double elapsed ) = 0;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_scale_div.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_scale_div.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_scale_div.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,89 +9,88 @@
 
 #include "qwt_scale_div.h"
-#include "qwt_math.h"
-#include <qalgorithms.h>
-
-/*!
-  Construct a division without ticks
-
-  \param lowerBound First boundary
-  \param upperBound Second boundary
-
-  \note lowerBound might be greater than upperBound for inverted scales
- */
-QwtScaleDiv::QwtScaleDiv( double lowerBound, double upperBound ):
-    d_lowerBound( lowerBound ),
-    d_upperBound( upperBound )
-{
-}
-
-/*!
-  Construct a scale division
-
-  \param interval Interval
-  \param ticks List of major, medium and minor ticks
-*/
-QwtScaleDiv::QwtScaleDiv( const QwtInterval &interval,
-        QList<double> ticks[NTickTypes] ):
-    d_lowerBound( interval.minValue() ),
-    d_upperBound( interval.maxValue() )
+#include "qwt_interval.h"
+
+/*!
+   Construct a division without ticks
+
+   \param lowerBound First boundary
+   \param upperBound Second boundary
+
+   \note lowerBound might be greater than upperBound for inverted scales
+ */
+QwtScaleDiv::QwtScaleDiv( double lowerBound, double upperBound )
+    : m_lowerBound( lowerBound )
+    , m_upperBound( upperBound )
+{
+}
+
+/*!
+   Construct a scale division
+
+   \param interval Interval
+   \param ticks List of major, medium and minor ticks
+ */
+QwtScaleDiv::QwtScaleDiv( const QwtInterval& interval,
+        QList< double > ticks[NTickTypes] )
+    : m_lowerBound( interval.minValue() )
+    , m_upperBound( interval.maxValue() )
 {
     for ( int i = 0; i < NTickTypes; i++ )
-        d_ticks[i] = ticks[i];
-}
-
-/*!
-  Construct a scale division
-
-  \param lowerBound First boundary
-  \param upperBound Second boundary
-  \param ticks List of major, medium and minor ticks
-
-  \note lowerBound might be greater than upperBound for inverted scales
-*/
+        m_ticks[i] = ticks[i];
+}
+
+/*!
+   Construct a scale division
+
+   \param lowerBound First boundary
+   \param upperBound Second boundary
+   \param ticks List of major, medium and minor ticks
+
+   \note lowerBound might be greater than upperBound for inverted scales
+ */
 QwtScaleDiv::QwtScaleDiv( double lowerBound, double upperBound,
-        QList<double> ticks[NTickTypes] ):
-    d_lowerBound( lowerBound ),
-    d_upperBound( upperBound )
+        QList< double > ticks[NTickTypes] )
+    : m_lowerBound( lowerBound )
+    , m_upperBound( upperBound )
 {
     for ( int i = 0; i < NTickTypes; i++ )
-        d_ticks[i] = ticks[i];
-}
-
-/*!
-  Construct a scale division
-
-  \param lowerBound First boundary
-  \param upperBound Second boundary
-  \param minorTicks List of minor ticks
-  \param mediumTicks List medium ticks
-  \param majorTicks List of major ticks
-
-  \note lowerBound might be greater than upperBound for inverted scales
-*/
+        m_ticks[i] = ticks[i];
+}
+
+/*!
+   Construct a scale division
+
+   \param lowerBound First boundary
+   \param upperBound Second boundary
+   \param minorTicks List of minor ticks
+   \param mediumTicks List medium ticks
+   \param majorTicks List of major ticks
+
+   \note lowerBound might be greater than upperBound for inverted scales
+ */
 QwtScaleDiv::QwtScaleDiv( double lowerBound, double upperBound,
-        const QList<double> &minorTicks,
-        const QList<double> &mediumTicks,
-        const QList<double> &majorTicks ):
-    d_lowerBound( lowerBound ),
-    d_upperBound( upperBound )
-{
-    d_ticks[ MinorTick ] = minorTicks;
-    d_ticks[ MediumTick ] = mediumTicks;
-    d_ticks[ MajorTick ] = majorTicks;
-}
-
-/*!
-  Change the interval
-
-  \param lowerBound First boundary
-  \param upperBound Second boundary
-
-  \note lowerBound might be greater than upperBound for inverted scales
-*/
+        const QList< double >& minorTicks,
+        const QList< double >& mediumTicks,
+        const QList< double >& majorTicks )
+    : m_lowerBound( lowerBound )
+    , m_upperBound( upperBound )
+{
+    m_ticks[ MinorTick ] = minorTicks;
+    m_ticks[ MediumTick ] = mediumTicks;
+    m_ticks[ MajorTick ] = majorTicks;
+}
+
+/*!
+   Change the interval
+
+   \param lowerBound First boundary
+   \param upperBound Second boundary
+
+   \note lowerBound might be greater than upperBound for inverted scales
+ */
 void QwtScaleDiv::setInterval( double lowerBound, double upperBound )
 {
-    d_lowerBound = lowerBound;
-    d_upperBound = upperBound;
+    m_lowerBound = lowerBound;
+    m_upperBound = upperBound;
 }
 
@@ -100,75 +99,75 @@
 
    \param interval Interval
-*/
-void QwtScaleDiv::setInterval( const QwtInterval &interval )
-{
-    d_lowerBound = interval.minValue();
-    d_upperBound = interval.maxValue();
-}
-
-/*!
-  \return lowerBound -> upperBound
-*/
+ */
+void QwtScaleDiv::setInterval( const QwtInterval& interval )
+{
+    m_lowerBound = interval.minValue();
+    m_upperBound = interval.maxValue();
+}
+
+/*!
+   \return lowerBound -> upperBound
+ */
 QwtInterval QwtScaleDiv::interval() const
 {
-    return QwtInterval( d_lowerBound, d_upperBound );
-}
-
-/*!
-  Set the first boundary
-
-  \param lowerBound First boundary
-  \sa lowerBiound(), setUpperBound()
+    return QwtInterval( m_lowerBound, m_upperBound );
+}
+
+/*!
+   Set the first boundary
+
+   \param lowerBound First boundary
+   \sa lowerBound(), setUpperBound()
  */
 void QwtScaleDiv::setLowerBound( double lowerBound  )
 {
-    d_lowerBound = lowerBound;
-}
-
-/*!
-  \return First boundary
-  \sa upperBound()
-*/
+    m_lowerBound = lowerBound;
+}
+
+/*!
+   \return First boundary
+   \sa upperBound()
+ */
 double QwtScaleDiv::lowerBound() const
 {
-    return d_lowerBound;
-}
-
-/*!
-  Set the second boundary
-
-  \param upperBound Second boundary
-  \sa upperBound(), setLowerBound()
+    return m_lowerBound;
+}
+
+/*!
+   Set the second boundary
+
+   \param upperBound Second boundary
+   \sa upperBound(), setLowerBound()
  */
 void QwtScaleDiv::setUpperBound( double upperBound  )
 {
-    d_upperBound = upperBound;
-}
-
-/*!
-  \return upper bound
-  \sa lowerBound()
-*/
+    m_upperBound = upperBound;
+}
+
+/*!
+   \return upper bound
+   \sa lowerBound()
+ */
 double QwtScaleDiv::upperBound() const
 {
-    return d_upperBound;
-}
-
-/*!
-  \return upperBound() - lowerBound()
-*/
+    return m_upperBound;
+}
+
+/*!
+   \return upperBound() - lowerBound()
+ */
 double QwtScaleDiv::range() const
 {
-    return d_upperBound - d_lowerBound;
-}
-
-/*!
-  \brief Equality operator
-  \return true if this instance is equal to other
-*/
-bool QwtScaleDiv::operator==( const QwtScaleDiv &other ) const
-{
-    if ( d_lowerBound != other.d_lowerBound ||
-        d_upperBound != other.d_upperBound )
+    return m_upperBound - m_lowerBound;
+}
+
+/*!
+   \brief Equality operator
+   \return true if this instance is equal to other
+ */
+bool QwtScaleDiv::operator==( const QwtScaleDiv& other ) const
+{
+    if ( m_lowerBound != other.m_lowerBound ||
+        m_upperBound != other.m_upperBound )
     {
         return false;
@@ -177,5 +176,5 @@
     for ( int i = 0; i < NTickTypes; i++ )
     {
-        if ( d_ticks[i] != other.d_ticks[i] )
+        if ( m_ticks[i] != other.m_ticks[i] )
             return false;
     }
@@ -185,8 +184,8 @@
 
 /*!
-  \brief Inequality
-  \return true if this instance is not equal to other
-*/
-bool QwtScaleDiv::operator!=( const QwtScaleDiv &other ) const
+   \brief Inequality
+   \return true if this instance is not equal to other
+ */
+bool QwtScaleDiv::operator!=( const QwtScaleDiv& other ) const
 {
     return ( !( *this == other ) );
@@ -196,5 +195,5 @@
 bool QwtScaleDiv::isEmpty() const
 {
-    return ( d_lowerBound == d_upperBound );
+    return ( m_lowerBound == m_upperBound );
 }
 
@@ -202,17 +201,17 @@
 bool QwtScaleDiv::isIncreasing() const
 {
-    return d_lowerBound <= d_upperBound;
-}
-
-/*!
-  Return if a value is between lowerBound() and upperBound()
-
-  \param value Value
-  \return true/false
-*/
+    return m_lowerBound <= m_upperBound;
+}
+
+/*!
+   Return if a value is between lowerBound() and upperBound()
+
+   \param value Value
+   \return true/false
+ */
 bool QwtScaleDiv::contains( double value ) const
 {
-    const double min = qMin( d_lowerBound, d_upperBound );
-    const double max = qMax( d_lowerBound, d_upperBound );
+    const double min = qMin( m_lowerBound, m_upperBound );
+    const double max = qMax( m_lowerBound, m_upperBound );
 
     return value >= min && value <= max;
@@ -225,9 +224,9 @@
 void QwtScaleDiv::invert()
 {
-    qSwap( d_lowerBound, d_upperBound );
+    qSwap( m_lowerBound, m_upperBound );
 
     for ( int i = 0; i < NTickTypes; i++ )
     {
-        QList<double>& ticks = d_ticks[i];
+        QList< double >& ticks = m_ticks[i];
 
         const int size = ticks.count();
@@ -240,6 +239,6 @@
 
 /*!
-  \return A scale division with inverted boundaries and ticks
-  \sa invert()
+   \return A scale division with inverted boundaries and ticks
+   \sa invert()
  */
 QwtScaleDiv QwtScaleDiv::inverted() const
@@ -261,5 +260,5 @@
 
    \note lowerBound might be greater than upperBound for inverted scales
-*/
+ */
 QwtScaleDiv QwtScaleDiv::bounded(
     double lowerBound, double upperBound ) const
@@ -273,7 +272,7 @@
     for ( int tickType = 0; tickType < QwtScaleDiv::NTickTypes; tickType++ )
     {
-        const QList<double> &ticks = d_ticks[ tickType ];
-
-        QList<double> boundedTicks;
+        const QList< double >& ticks = m_ticks[ tickType ];
+
+        QList< double > boundedTicks;
         for ( int i = 0; i < ticks.size(); i++ )
         {
@@ -293,11 +292,11 @@
     Assign ticks
 
-   \param type MinorTick, MediumTick or MajorTick
+   \param tickType MinorTick, MediumTick or MajorTick
    \param ticks Values of the tick positions
-*/
-void QwtScaleDiv::setTicks( int type, const QList<double> &ticks )
-{
-    if ( type >= 0 && type < NTickTypes )
-        d_ticks[type] = ticks;
+ */
+void QwtScaleDiv::setTicks( int tickType, const QList< double >& ticks )
+{
+    if ( tickType >= 0 && tickType < NTickTypes )
+        m_ticks[tickType] = ticks;
 }
 
@@ -305,18 +304,20 @@
    Return a list of ticks
 
-   \param type MinorTick, MediumTick or MajorTick
+   \param tickType MinorTick, MediumTick or MajorTick
    \return Tick list
-*/
-QList<double> QwtScaleDiv::ticks( int type ) const
-{
-    if ( type >= 0 && type < NTickTypes )
-        return d_ticks[type];
-
-    return QList<double>();
+ */
+QList< double > QwtScaleDiv::ticks( int tickType ) const
+{
+    if ( tickType >= 0 && tickType < NTickTypes )
+        return m_ticks[tickType];
+
+    return QList< double >();
 }
 
 #ifndef QT_NO_DEBUG_STREAM
 
-QDebug operator<<( QDebug debug, const QwtScaleDiv &scaleDiv )
+#include <qdebug.h>
+
+QDebug operator<<( QDebug debug, const QwtScaleDiv& scaleDiv )
 {
     debug << scaleDiv.lowerBound() << "<->" << scaleDiv.upperBound();
Index: /trunk/BNC/qwt/qwt_scale_div.h
===================================================================
--- /trunk/BNC/qwt/qwt_scale_div.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_scale_div.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,29 +12,26 @@
 
 #include "qwt_global.h"
-#include "qwt_interval.h"
 #include <qlist.h>
 
-#ifndef QT_NO_DEBUG_STREAM
-#include <qdebug.h>
-#endif
+class QwtInterval;
 
 /*!
-  \brief A class representing a scale division
+   \brief A class representing a scale division
 
-  A Qwt scale is defined by its boundaries and 3 list
-  for the positions of the major, medium and minor ticks.
+   A Qwt scale is defined by its boundaries and 3 list
+   for the positions of the major, medium and minor ticks.
 
-  The upperBound() might be smaller than the lowerBound()
-  to indicate inverted scales.
+   The upperBound() might be smaller than the lowerBound()
+   to indicate inverted scales.
 
-  Scale divisions can be calculated from a QwtScaleEngine.
+   Scale divisions can be calculated from a QwtScaleEngine.
 
-  \sa QwtScaleEngine::divideScale(), QwtPlot::setAxisScaleDiv(),
+   \sa QwtScaleEngine::divideScale(), QwtPlot::setAxisScaleDiv(),
       QwtAbstractSlider::setScaleDiv()
-*/
+ */
 
 class QWT_EXPORT QwtScaleDiv
 {
-public:
+  public:
     //! Scale tick types
     enum TickType
@@ -59,18 +56,18 @@
         double upperBound = 0.0 );
 
-    explicit QwtScaleDiv( const QwtInterval &, QList<double>[NTickTypes] );
+    explicit QwtScaleDiv( const QwtInterval&, QList< double >[NTickTypes] );
 
     explicit QwtScaleDiv( double lowerBound, double upperBound,
-        QList<double>[NTickTypes] );
+        QList< double >[NTickTypes] );
 
     explicit QwtScaleDiv( double lowerBound, double upperBound,
-        const QList<double> &minorTicks, const QList<double> &mediumTicks,
-        const QList<double> &majorTicks );
+        const QList< double >& minorTicks, const QList< double >& mediumTicks,
+        const QList< double >& majorTicks );
 
-    bool operator==( const QwtScaleDiv & ) const;
-    bool operator!=( const QwtScaleDiv & ) const;
+    bool operator==( const QwtScaleDiv& ) const;
+    bool operator!=( const QwtScaleDiv& ) const;
 
     void setInterval( double lowerBound, double upperBound );
-    void setInterval( const QwtInterval & );
+    void setInterval( const QwtInterval& );
     QwtInterval interval() const;
 
@@ -85,6 +82,6 @@
     bool contains( double value ) const;
 
-    void setTicks( int tickType, const QList<double> & );
-    QList<double> ticks( int tickType ) const;
+    void setTicks( int tickType, const QList< double >& );
+    QList< double > ticks( int tickType ) const;
 
     bool isEmpty() const;
@@ -96,8 +93,8 @@
     QwtScaleDiv bounded( double lowerBound, double upperBound ) const;
 
-private:
-    double d_lowerBound;
-    double d_upperBound;
-    QList<double> d_ticks[NTickTypes];
+  private:
+    double m_lowerBound;
+    double m_upperBound;
+    QList< double > m_ticks[NTickTypes];
 };
 
@@ -105,5 +102,5 @@
 
 #ifndef QT_NO_DEBUG_STREAM
-QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleDiv & );
+QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleDiv& );
 #endif
 
Index: /trunk/BNC/qwt/qwt_scale_draw.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_scale_draw.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_scale_draw.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,21 +13,262 @@
 #include "qwt_math.h"
 #include "qwt_painter.h"
-#include <qpen.h>
+#include "qwt_text.h"
+
 #include <qpainter.h>
+#include <qpaintengine.h>
 #include <qmath.h>
 
-#if QT_VERSION < 0x040601
-#define qFastSin(x) qSin(x)
-#define qFastCos(x) qCos(x)
+static inline double qwtEffectivePenWidth( const QwtAbstractScaleDraw* scaleDraw )
+{
+    return qwtMaxF( scaleDraw->penWidthF(), 1.0 );
+}
+
+namespace QwtScaleRendererReal
+{
+    inline qreal penWidth( const QPainter* painter, const QwtScaleDraw* scaleDraw )
+    {
+        qreal width = scaleDraw->penWidthF();
+#if 1
+        if ( width <= 0.0 )
+            width = 1.0;
 #endif
 
+        if ( painter->pen().isCosmetic() )
+        {
+            const QTransform& transform = painter->transform();
+
+            switch ( scaleDraw->alignment() )
+            {
+                case QwtScaleDraw::LeftScale:
+                case QwtScaleDraw::RightScale:
+                {
+                    width /= transform.m11();
+                    break;
+                }
+                case QwtScaleDraw::TopScale:
+                case QwtScaleDraw::BottomScale:
+                {
+                    width /= transform.m22();
+                    break;
+                }
+            }
+        }
+
+        return width;
+    }
+
+    inline void drawBackbone( QPainter* painter, const QwtScaleDraw* scaleDraw )
+    {
+        const qreal pw2 = 0.5 * penWidth( painter, scaleDraw );
+
+        const QPointF pos = scaleDraw->pos();
+        const qreal length = scaleDraw->length();
+
+        switch ( scaleDraw->alignment() )
+        {
+            case QwtScaleDraw::LeftScale:
+            {
+                const qreal x = pos.x() + 1.0 - pw2;
+                QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
+
+                break;
+            }
+            case QwtScaleDraw::RightScale:
+            {
+                const qreal x = pos.x() - 1.0 + pw2;
+                QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
+
+                break;
+            }
+            case QwtScaleDraw::TopScale:
+            {
+                const qreal y = pos.y() + 1.0 - pw2;
+                QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
+
+                break;
+            }
+            case QwtScaleDraw::BottomScale:
+            {
+                const qreal y = pos.y() - 1.0 + pw2;
+                QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
+
+                break;
+            }
+        }
+    }
+
+    inline void drawTick( QPainter* painter,
+        const QwtScaleDraw* scaleDraw, qreal tickPos, qreal tickLength )
+    {
+        const QPointF pos = scaleDraw->pos();
+
+        qreal pw = 0.0;
+
+        if ( scaleDraw->hasComponent( QwtScaleDraw::Backbone ) )
+            pw = penWidth( painter, scaleDraw );
+
+        const qreal length = tickLength + pw;
+
+        /*
+            Those correction offsets have been found by try and error.
+            They need to be understood and replaced by a calculation,
+            that makes sense. TODO ...
+         */
+        const qreal off1 = 1.0;
+        const qreal off2 = ( scaleDraw->penWidthF() <= 0.0 ) ? 0.5 : 0.0;
+
+        switch ( scaleDraw->alignment() )
+        {
+            case QwtScaleDraw::LeftScale:
+            {
+                const qreal x = pos.x() + off1 - off2;
+                QwtPainter::drawLine( painter, x, tickPos, x - length, tickPos );
+
+                break;
+            }
+            case QwtScaleDraw::RightScale:
+            {
+                const qreal x = pos.x() - off1 + off2;
+                QwtPainter::drawLine( painter, x, tickPos, x + length, tickPos );
+                break;
+            }
+            case QwtScaleDraw::TopScale:
+            {
+                const qreal y = pos.y() + off1 - 2 * off2;
+                QwtPainter::drawLine( painter, tickPos, y, tickPos, y - length );
+
+                break;
+            }
+            case QwtScaleDraw::BottomScale:
+            {
+                const qreal y = pos.y() - off1 + off2;
+                QwtPainter::drawLine( painter, tickPos, y, tickPos, y + length );
+
+                break;
+            }
+        }
+    }
+}
+
+namespace QwtScaleRendererInt
+{
+    inline void drawBackbone( QPainter* painter, const QwtScaleDraw* scaleDraw )
+    {
+        const int pw = qMax( qRound( scaleDraw->penWidthF() ), 1 );
+
+        const qreal length = scaleDraw->length();
+        const QPointF pos = scaleDraw->pos();
+
+        switch ( scaleDraw->alignment() )
+        {
+            case QwtScaleDraw::LeftScale:
+            {
+                const qreal x = qRound( pos.x() - ( pw - 1 ) / 2 );
+                QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
+
+                break;
+            }
+            case QwtScaleDraw::RightScale:
+            {
+                const qreal x = qRound( pos.x() + pw / 2 );
+                QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
+
+                break;
+            }
+            case QwtScaleDraw::TopScale:
+            {
+                const qreal y = qRound( pos.y() - ( pw - 1 ) / 2 );
+                QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
+
+                break;
+            }
+            case QwtScaleDraw::BottomScale:
+            {
+                const qreal y = qRound( pos.y() + pw / 2 );
+                QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
+
+                break;
+            }
+        }
+    }
+
+    inline void drawTick( QPainter* painter,
+        const QwtScaleDraw* scaleDraw, qreal tickPos, qreal tickLength )
+    {
+        const QPointF pos = scaleDraw->pos();
+        tickPos = qRound( tickPos );
+
+        int pw = 0;
+        if ( scaleDraw->hasComponent( QwtScaleDraw::Backbone ) )
+            pw = qMax( qRound( scaleDraw->penWidthF() ), 1 );
+
+        int len = qMax( qRound( tickLength ), 1 );
+
+        // the width of ticks at the borders might extent the backbone
+        len += pw;
+
+        if ( painter->pen().capStyle() == Qt::FlatCap )
+            len++; // the end point is not rendered
+
+        qreal off = 0.0;
+
+        if ( painter->paintEngine()->type() == QPaintEngine::X11 )
+        {
+            if ( pw == 1 )
+            {
+                // In opposite to raster, X11 paints the end point
+                off = 1.0;
+            }
+        }
+
+        switch ( scaleDraw->alignment() )
+        {
+            case QwtScaleDraw::LeftScale:
+            {
+                const qreal x1 = qRound( pos.x() ) + 1;
+                const qreal x2 = x1 - len + 1;
+
+                QwtPainter::drawLine( painter, x2, tickPos, x1 - off, tickPos );
+
+                break;
+            }
+            case QwtScaleDraw::RightScale:
+            {
+                const qreal x1 = qRound( pos.x() );
+                const qreal x2 = x1 + len - 1;
+
+                QwtPainter::drawLine( painter, x1, tickPos, x2 - off, tickPos );
+
+                break;
+            }
+            case QwtScaleDraw::BottomScale:
+            {
+                const qreal y1 = qRound( pos.y() );
+                const qreal y2 = y1 + len - 1;
+
+                QwtPainter::drawLine( painter, tickPos, y1, tickPos, y2 - off );
+
+                break;
+            }
+            case QwtScaleDraw::TopScale:
+            {
+                const qreal y1 = qRound( pos.y() );
+                const qreal y2 = y1 - len + 1;
+
+                QwtPainter::drawLine( painter, tickPos, y2 + 1, tickPos, y1 + 1 - off );
+
+                break;
+            }
+        }
+    }
+}
+
 class QwtScaleDraw::PrivateData
 {
-public:
-    PrivateData():
-        len( 0 ),
-        alignment( QwtScaleDraw::BottomScale ),
-        labelAlignment( 0 ),
-        labelRotation( 0.0 )
+  public:
+    PrivateData()
+        : len( 0 )
+        , alignment( QwtScaleDraw::BottomScale )
+        , labelRotation( 0.0 )
     {
     }
@@ -43,13 +284,13 @@
 
 /*!
-  \brief Constructor
-
-  The range of the scale is initialized to [0, 100],
-  The position is at (0, 0) with a length of 100.
-  The orientation is QwtAbstractScaleDraw::Bottom.
-*/
+   \brief Constructor
+
+   The range of the scale is initialized to [0, 100],
+   The position is at (0, 0) with a length of 100.
+   The orientation is QwtAbstractScaleDraw::Bottom.
+ */
 QwtScaleDraw::QwtScaleDraw()
 {
-    d_data = new QwtScaleDraw::PrivateData;
+    m_data = new QwtScaleDraw::PrivateData;
     setLength( 100 );
 }
@@ -58,5 +299,5 @@
 QwtScaleDraw::~QwtScaleDraw()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -65,8 +306,8 @@
    \sa setAlignment()
    \return Alignment of the scale
-*/
+ */
 QwtScaleDraw::Alignment QwtScaleDraw::alignment() const
 {
-    return d_data->alignment;
+    return m_data->alignment;
 }
 
@@ -78,23 +319,23 @@
    The default alignment is QwtScaleDraw::BottomScale
    \sa alignment()
-*/
+ */
 void QwtScaleDraw::setAlignment( Alignment align )
 {
-    d_data->alignment = align;
-}
-
-/*!
-  Return the orientation
-
-  TopScale, BottomScale are horizontal (Qt::Horizontal) scales,
-  LeftScale, RightScale are vertical (Qt::Vertical) scales.
-
-  \return Orientation of the scale
-
-  \sa alignment()
-*/
+    m_data->alignment = align;
+}
+
+/*!
+   Return the orientation
+
+   TopScale, BottomScale are horizontal (Qt::Horizontal) scales,
+   LeftScale, RightScale are vertical (Qt::Vertical) scales.
+
+   \return Orientation of the scale
+
+   \sa alignment()
+ */
 Qt::Orientation QwtScaleDraw::orientation() const
 {
-    switch ( d_data->alignment )
+    switch ( m_data->alignment )
     {
         case TopScale:
@@ -109,15 +350,15 @@
 
 /*!
-  \brief Determine the minimum border distance
-
-  This member function returns the minimum space
-  needed to draw the mark labels at the scale's endpoints.
-
-  \param font Font
-  \param start Start border distance
-  \param end End border distance
-*/
+   \brief Determine the minimum border distance
+
+   This member function returns the minimum space
+   needed to draw the mark labels at the scale's endpoints.
+
+   \param font Font
+   \param start Start border distance
+   \param end End border distance
+ */
 void QwtScaleDraw::getBorderDistHint(
-    const QFont &font, int &start, int &end ) const
+    const QFont& font, int& start, int& end ) const
 {
     start = 0;
@@ -127,5 +368,5 @@
         return;
 
-    const QList<double> &ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
+    const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
     if ( ticks.count() == 0 )
         return;
@@ -179,24 +420,24 @@
         e = 0.0;
 
-    start = qCeil( s );
-    end = qCeil( e );
-}
-
-/*!
-  Determine the minimum distance between two labels, that is necessary
-  that the texts don't overlap.
-
-  \param font Font
-  \return The maximum width of a label
-
-  \sa getBorderDistHint()
-*/
-
-int QwtScaleDraw::minLabelDist( const QFont &font ) const
+    start = qwtCeil( s );
+    end = qwtCeil( e );
+}
+
+/*!
+   Determine the minimum distance between two labels, that is necessary
+   that the texts don't overlap.
+
+   \param font Font
+   \return The maximum width of a label
+
+   \sa getBorderDistHint()
+ */
+
+int QwtScaleDraw::minLabelDist( const QFont& font ) const
 {
     if ( !hasComponent( QwtAbstractScaleDraw::Labels ) )
         return 0;
 
-    const QList<double> &ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
+    const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
     if ( ticks.isEmpty() )
         return 0;
@@ -279,6 +520,6 @@
 
    \sa minLength()
-*/
-double QwtScaleDraw::extent( const QFont &font ) const
+ */
+double QwtScaleDraw::extent( const QFont& font ) const
 {
     double d = 0;
@@ -302,9 +543,8 @@
     if ( hasComponent( QwtAbstractScaleDraw::Backbone ) )
     {
-        const double pw = qMax( 1, penWidth() );  // pen width can be zero
-        d += pw;
-    }
-
-    d = qMax( d, minimumExtent() );
+        d += qwtEffectivePenWidth( this );
+    }
+
+    d = qwtMaxF( d, minimumExtent() );
     return d;
 }
@@ -317,11 +557,11 @@
 
    \sa extent()
-*/
-int QwtScaleDraw::minLength( const QFont &font ) const
+ */
+int QwtScaleDraw::minLength( const QFont& font ) const
 {
     int startDist, endDist;
     getBorderDistHint( font, startDist, endDist );
 
-    const QwtScaleDiv &sd = scaleDiv();
+    const QwtScaleDiv& sd = scaleDiv();
 
     const uint minorCount =
@@ -338,5 +578,5 @@
     if ( hasComponent( QwtAbstractScaleDraw::Ticks ) )
     {
-        const double pw = qMax( 1, penWidth() );  // penwidth can be zero
+        const double pw = qwtEffectivePenWidth( this );
         lengthForTicks = qCeil( ( majorCount + minorCount ) * ( pw + 1.0 ) );
     }
@@ -353,5 +593,5 @@
    \param value Value
    \return Position, where to paint a label
-*/
+ */
 QPointF QwtScaleDraw::labelPosition( double value ) const
 {
@@ -359,5 +599,5 @@
     double dist = spacing();
     if ( hasComponent( QwtAbstractScaleDraw::Backbone ) )
-        dist += qMax( 1, penWidth() );
+        dist += qwtEffectivePenWidth( this );
 
     if ( hasComponent( QwtAbstractScaleDraw::Ticks ) )
@@ -371,5 +611,5 @@
         case RightScale:
         {
-            px = d_data->pos.x() + dist;
+            px = m_data->pos.x() + dist;
             py = tval;
             break;
@@ -377,5 +617,5 @@
         case LeftScale:
         {
-            px = d_data->pos.x() - dist;
+            px = m_data->pos.x() - dist;
             py = tval;
             break;
@@ -384,5 +624,5 @@
         {
             px = tval;
-            py = d_data->pos.y() + dist;
+            py = m_data->pos.y() + dist;
             break;
         }
@@ -390,5 +630,5 @@
         {
             px = tval;
-            py = d_data->pos.y() - dist;
+            py = m_data->pos.y() - dist;
             break;
         }
@@ -406,81 +646,16 @@
 
    \sa drawBackbone(), drawLabel()
-*/
-void QwtScaleDraw::drawTick( QPainter *painter, double value, double len ) const
+ */
+void QwtScaleDraw::drawTick( QPainter* painter, double value, double len ) const
 {
     if ( len <= 0 )
         return;
 
-    const bool roundingAlignment = QwtPainter::roundingAlignment( painter );
-
-    QPointF pos = d_data->pos;
-
-    double tval = scaleMap().transform( value );
-    if ( roundingAlignment )
-        tval = qRound( tval );
-
-    const int pw = penWidth();
-    int a = 0;
-    if ( pw > 1 && roundingAlignment )
-        a = 1;
-
-    switch ( alignment() )
-    {
-        case LeftScale:
-        {
-            double x1 = pos.x() + a;
-            double x2 = pos.x() + a - pw - len;
-            if ( roundingAlignment )
-            {
-                x1 = qRound( x1 );
-                x2 = qRound( x2 );
-            }
-
-            QwtPainter::drawLine( painter, x1, tval, x2, tval );
-            break;
-        }
-
-        case RightScale:
-        {
-            double x1 = pos.x();
-            double x2 = pos.x() + pw + len;
-            if ( roundingAlignment )
-            {
-                x1 = qRound( x1 );
-                x2 = qRound( x2 );
-            }
-
-            QwtPainter::drawLine( painter, x1, tval, x2, tval );
-            break;
-        }
-
-        case BottomScale:
-        {
-            double y1 = pos.y();
-            double y2 = pos.y() + pw + len;
-            if ( roundingAlignment )
-            {
-                y1 = qRound( y1 );
-                y2 = qRound( y2 );
-            }
-
-            QwtPainter::drawLine( painter, tval, y1, tval, y2 );
-            break;
-        }
-
-        case TopScale:
-        {
-            double y1 = pos.y() + a;
-            double y2 = pos.y() - pw - len + a;
-            if ( roundingAlignment )
-            {
-                y1 = qRound( y1 );
-                y2 = qRound( y2 );
-            }
-
-            QwtPainter::drawLine( painter, tval, y1, tval, y2 );
-            break;
-        }
-    }
+    const double tval = scaleMap().transform( value );
+
+    if ( QwtPainter::roundingAlignment( painter ) )
+        QwtScaleRendererInt::drawTick( painter, this, tval, len );
+    else
+        QwtScaleRendererReal::drawTick( painter, this, tval, len );
 }
 
@@ -490,105 +665,47 @@
 
    \sa drawTick(), drawLabel()
-*/
-void QwtScaleDraw::drawBackbone( QPainter *painter ) const
-{
-    const bool doAlign = QwtPainter::roundingAlignment( painter );
-
-    const QPointF &pos = d_data->pos;
-    const double len = d_data->len;
-    const int pw = qMax( penWidth(), 1 );
-
-    // pos indicates a border not the center of the backbone line
-    // so we need to shift its position depending on the pen width
-    // and the alignment of the scale
-
-    double off;
-    if ( doAlign )
-    {
-        if ( alignment() == LeftScale || alignment() == TopScale )
-            off = ( pw - 1 ) / 2;
-        else
-            off = pw / 2;
-    }
+ */
+void QwtScaleDraw::drawBackbone( QPainter* painter ) const
+{
+    if ( QwtPainter::roundingAlignment( painter ) )
+        QwtScaleRendererInt::drawBackbone( painter, this );
     else
-    {
-        off = 0.5 * penWidth();
-    }
-
-    switch ( alignment() )
-    {
-        case LeftScale:
-        {
-            double x = pos.x() - off;
-            if ( doAlign )
-                x = qRound( x );
-
-            QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + len );
-            break;
-        }
-        case RightScale:
-        {
-            double x = pos.x() + off;
-            if ( doAlign )
-                x = qRound( x );
-
-            QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + len );
-            break;
-        }
-        case TopScale:
-        {
-            double y = pos.y() - off;
-            if ( doAlign )
-                y = qRound( y );
-
-            QwtPainter::drawLine( painter, pos.x(), y, pos.x() + len, y );
-            break;
-        }
-        case BottomScale:
-        {
-            double y = pos.y() + off;
-            if ( doAlign )
-                y = qRound( y );
-
-            QwtPainter::drawLine( painter, pos.x(), y, pos.x() + len, y );
-            break;
-        }
-    }
-}
-
-/*!
-  \brief Move the position of the scale
-
-  The meaning of the parameter pos depends on the alignment:
-  <dl>
-  <dt>QwtScaleDraw::LeftScale
-  <dd>The origin is the topmost point of the
+        QwtScaleRendererReal::drawBackbone( painter, this );
+}
+
+/*!
+   \brief Move the position of the scale
+
+   The meaning of the parameter pos depends on the alignment:
+   <dl>
+   <dt>QwtScaleDraw::LeftScale
+   <dd>The origin is the topmost point of the
       backbone. The backbone is a vertical line.
       Scale marks and labels are drawn
       at the left of the backbone.
-  <dt>QwtScaleDraw::RightScale
-  <dd>The origin is the topmost point of the
+   <dt>QwtScaleDraw::RightScale
+   <dd>The origin is the topmost point of the
       backbone. The backbone is a vertical line.
       Scale marks and labels are drawn
       at the right of the backbone.
-  <dt>QwtScaleDraw::TopScale
-  <dd>The origin is the leftmost point of the
+   <dt>QwtScaleDraw::TopScale
+   <dd>The origin is the leftmost point of the
       backbone. The backbone is a horizontal line.
       Scale marks and labels are drawn
       above the backbone.
-  <dt>QwtScaleDraw::BottomScale
-  <dd>The origin is the leftmost point of the
+   <dt>QwtScaleDraw::BottomScale
+   <dd>The origin is the leftmost point of the
       backbone. The backbone is a horizontal line
       Scale marks and labels are drawn
       below the backbone.
-  </dl>
-
-  \param pos Origin of the scale
-
-  \sa pos(), setLength()
-*/
-void QwtScaleDraw::move( const QPointF &pos )
-{
-    d_data->pos = pos;
+   </dl>
+
+   \param pos Origin of the scale
+
+   \sa pos(), setLength()
+ */
+void QwtScaleDraw::move( const QPointF& pos )
+{
+    m_data->pos = pos;
     updateMap();
 }
@@ -597,34 +714,30 @@
    \return Origin of the scale
    \sa move(), length()
-*/
+ */
 QPointF QwtScaleDraw::pos() const
 {
-    return d_data->pos;
-}
-
-/*!
-  Set the length of the backbone.
-
-  The length doesn't include the space needed for
-  overlapping labels.
-
-  \param length Length of the backbone
-
-  \sa move(), minLabelDist()
-*/
+    return m_data->pos;
+}
+
+/*!
+   Set the length of the backbone.
+
+   The length doesn't include the space needed for
+   overlapping labels.
+
+   \param length Length of the backbone
+
+   \sa move(), minLabelDist()
+ */
 void QwtScaleDraw::setLength( double length )
 {
-#if 1
     if ( length >= 0 && length < 10 )
         length = 10;
 
-    // why should we accept negative lengths ???
+    // f.e the left/bottom scales of a polar plot
     if ( length < 0 && length > -10 )
         length = -10;
-#else
-    length = qMax( length, 10 );
-#endif
-
-    d_data->len = length;
+
+    m_data->len = length;
     updateMap();
 }
@@ -633,8 +746,8 @@
    \return the length of the backbone
    \sa setLength(), pos()
-*/
+ */
 double QwtScaleDraw::length() const
 {
-    return d_data->len;
+    return m_data->len;
 }
 
@@ -646,6 +759,6 @@
 
    \sa drawTick(), drawBackbone(), boundingLabelRect()
-*/
-void QwtScaleDraw::drawLabel( QPainter *painter, double value ) const
+ */
+void QwtScaleDraw::drawLabel( QPainter* painter, double value ) const
 {
     QwtText lbl = tickLabel( painter->font(), value );
@@ -668,16 +781,16 @@
 
 /*!
-  \brief Find the bounding rectangle for the label.
-
-  The coordinates of the rectangle are absolute ( calculated from pos() ).
-  in direction of the tick.
-
-  \param font Font used for painting
-  \param value Value
-
-  \return Bounding rectangle
-  \sa labelRect()
-*/
-QRect QwtScaleDraw::boundingLabelRect( const QFont &font, double value ) const
+   \brief Find the bounding rectangle for the label.
+
+   The coordinates of the rectangle are absolute ( calculated from pos() ).
+   in direction of the tick.
+
+   \param font Font used for painting
+   \param value Value
+
+   \return Bounding rectangle
+   \sa labelRect()
+ */
+QRect QwtScaleDraw::boundingLabelRect( const QFont& font, double value ) const
 {
     QwtText lbl = tickLabel( font, value );
@@ -701,7 +814,7 @@
    \return Transformation matrix
    \sa setLabelAlignment(), setLabelRotation()
-*/
+ */
 QTransform QwtScaleDraw::labelTransformation(
-    const QPointF &pos, const QSizeF &size ) const
+    const QPointF& pos, const QSizeF& size ) const
 {
     QTransform transform;
@@ -763,14 +876,14 @@
 
 /*!
-  Find the bounding rectangle for the label. The coordinates of
-  the rectangle are relative to spacing + tick length from the backbone
-  in direction of the tick.
-
-  \param font Font used for painting
-  \param value Value
+   Find the bounding rectangle for the label. The coordinates of
+   the rectangle are relative to spacing + tick length from the backbone
+   in direction of the tick.
+
+   \param font Font used for painting
+   \param value Value
 
    \return Bounding rectangle that is needed to draw a label
-*/
-QRectF QwtScaleDraw::labelRect( const QFont &font, double value ) const
+ */
+QRectF QwtScaleDraw::labelRect( const QFont& font, double value ) const
 {
     QwtText lbl = tickLabel( font, value );
@@ -796,6 +909,6 @@
 
    \return Size that is needed to draw a label
-*/
-QSizeF QwtScaleDraw::labelSize( const QFont &font, double value ) const
+ */
+QSizeF QwtScaleDraw::labelSize( const QFont& font, double value ) const
 {
     return labelRect( font, value ).size();
@@ -803,38 +916,38 @@
 
 /*!
-  Rotate all labels.
-
-  When changing the rotation, it might be necessary to
-  adjust the label flags too. Finding a useful combination is
-  often the result of try and error.
-
-  \param rotation Angle in degrees. When changing the label rotation,
+   Rotate all labels.
+
+   When changing the rotation, it might be necessary to
+   adjust the label flags too. Finding a useful combination is
+   often the result of try and error.
+
+   \param rotation Angle in degrees. When changing the label rotation,
                   the label flags often needs to be adjusted too.
 
-  \sa setLabelAlignment(), labelRotation(), labelAlignment().
-
-*/
+   \sa setLabelAlignment(), labelRotation(), labelAlignment().
+
+ */
 void QwtScaleDraw::setLabelRotation( double rotation )
 {
-    d_data->labelRotation = rotation;
-}
-
-/*!
-  \return the label rotation
-  \sa setLabelRotation(), labelAlignment()
-*/
+    m_data->labelRotation = rotation;
+}
+
+/*!
+   \return the label rotation
+   \sa setLabelRotation(), labelAlignment()
+ */
 double QwtScaleDraw::labelRotation() const
 {
-    return d_data->labelRotation;
-}
-
-/*!
-  \brief Change the label flags
-
-  Labels are aligned to the point tick length + spacing away from the backbone.
-
-  The alignment is relative to the orientation of the label text.
-  In case of an flags of 0 the label will be aligned
-  depending on the orientation of the scale:
+    return m_data->labelRotation;
+}
+
+/*!
+   \brief Change the label flags
+
+   Labels are aligned to the point tick length + spacing away from the backbone.
+
+   The alignment is relative to the orientation of the label text.
+   In case of an flags of 0 the label will be aligned
+   depending on the orientation of the scale:
 
       QwtScaleDraw::TopScale: Qt::AlignHCenter | Qt::AlignTop\n
@@ -843,38 +956,38 @@
       QwtScaleDraw::RightScale: Qt::AlignRight | Qt::AlignVCenter\n
 
-  Changing the alignment is often necessary for rotated labels.
-
-  \param alignment Or'd Qt::AlignmentFlags see <qnamespace.h>
-
-  \sa setLabelRotation(), labelRotation(), labelAlignment()
-  \warning The various alignments might be confusing.
+   Changing the alignment is often necessary for rotated labels.
+
+   \param alignment Or'd Qt::AlignmentFlags see <qnamespace.h>
+
+   \sa setLabelRotation(), labelRotation(), labelAlignment()
+   \warning The various alignments might be confusing.
            The alignment of the label is not the alignment
            of the scale and is not the alignment of the flags
            ( QwtText::flags() ) returned from QwtAbstractScaleDraw::label().
-*/
+ */
 
 void QwtScaleDraw::setLabelAlignment( Qt::Alignment alignment )
 {
-    d_data->labelAlignment = alignment;
-}
-
-/*!
-  \return the label flags
-  \sa setLabelAlignment(), labelRotation()
-*/
+    m_data->labelAlignment = alignment;
+}
+
+/*!
+   \return the label flags
+   \sa setLabelAlignment(), labelRotation()
+ */
 Qt::Alignment QwtScaleDraw::labelAlignment() const
 {
-    return d_data->labelAlignment;
-}
-
-/*!
-  \param font Font
-  \return the maximum width of a label
-*/
-int QwtScaleDraw::maxLabelWidth( const QFont &font ) const
+    return m_data->labelAlignment;
+}
+
+/*!
+   \param font Font
+   \return the maximum width of a label
+ */
+int QwtScaleDraw::maxLabelWidth( const QFont& font ) const
 {
     double maxWidth = 0.0;
 
-    const QList<double> &ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
+    const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
     for ( int i = 0; i < ticks.count(); i++ )
     {
@@ -892,12 +1005,12 @@
 
 /*!
-  \param font Font
-  \return the maximum height of a label
-*/
-int QwtScaleDraw::maxLabelHeight( const QFont &font ) const
+   \param font Font
+   \return the maximum height of a label
+ */
+int QwtScaleDraw::maxLabelHeight( const QFont& font ) const
 {
     double maxHeight = 0.0;
 
-    const QList<double> &ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
+    const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
     for ( int i = 0; i < ticks.count(); i++ )
     {
@@ -916,8 +1029,8 @@
 void QwtScaleDraw::updateMap()
 {
-    const QPointF pos = d_data->pos;
-    double len = d_data->len;
-
-    QwtScaleMap &sm = scaleMap();
+    const QPointF pos = m_data->pos;
+    double len = m_data->len;
+
+    QwtScaleMap& sm = scaleMap();
     if ( orientation() == Qt::Vertical )
         sm.setPaintInterval( pos.y() + len, pos.y() );
Index: /trunk/BNC/qwt/qwt_scale_draw.h
===================================================================
--- /trunk/BNC/qwt/qwt_scale_draw.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_scale_draw.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,23 +13,27 @@
 #include "qwt_global.h"
 #include "qwt_abstract_scale_draw.h"
+
 #include <qpoint.h>
-#include <qrect.h>
-#include <qtransform.h>
+
+class QTransform;
+class QSizeF;
+class QRectF;
+class QRect;
 
 /*!
-  \brief A class for drawing scales
+   \brief A class for drawing scales
 
-  QwtScaleDraw can be used to draw linear or logarithmic scales.
-  A scale has a position, an alignment and a length, which can be specified .
-  The labels can be rotated and aligned
-  to the ticks using setLabelRotation() and setLabelAlignment().
+   QwtScaleDraw can be used to draw linear or logarithmic scales.
+   A scale has a position, an alignment and a length, which can be specified .
+   The labels can be rotated and aligned
+   to the ticks using setLabelRotation() and setLabelAlignment().
 
-  After a scale division has been specified as a QwtScaleDiv object
-  using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s),
-  the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
-*/
-class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw
+   After a scale division has been specified as a QwtScaleDiv object
+   using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s),
+   the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
+ */
+class QWT_EXPORT QwtScaleDraw : public QwtAbstractScaleDraw
 {
-public:
+  public:
     /*!
         Alignment of the scale draw
@@ -54,12 +58,12 @@
     virtual ~QwtScaleDraw();
 
-    void getBorderDistHint( const QFont &, int &start, int &end ) const;
-    int minLabelDist( const QFont & ) const;
+    void getBorderDistHint( const QFont&, int& start, int& end ) const;
+    int minLabelDist( const QFont& ) const;
 
-    int minLength( const QFont & ) const;
-    virtual double extent( const QFont & ) const;
+    int minLength( const QFont& ) const;
+    virtual double extent( const QFont& ) const QWT_OVERRIDE;
 
     void move( double x, double y );
-    void move( const QPointF & );
+    void move( const QPointF& );
     void setLength( double length );
 
@@ -78,29 +82,28 @@
     double labelRotation() const;
 
-    int maxLabelHeight( const QFont & ) const;
-    int maxLabelWidth( const QFont & ) const;
+    int maxLabelHeight( const QFont& ) const;
+    int maxLabelWidth( const QFont& ) const;
 
     QPointF labelPosition( double value ) const;
 
-    QRectF labelRect( const QFont &, double value ) const;
-    QSizeF labelSize( const QFont &, double value ) const;
+    QRectF labelRect( const QFont&, double value ) const;
+    QSizeF labelSize( const QFont&, double value ) const;
 
-    QRect boundingLabelRect( const QFont &, double value ) const;
+    QRect boundingLabelRect( const QFont&, double value ) const;
 
-protected:
-    QTransform labelTransformation( const QPointF &, const QSizeF & ) const;
+  protected:
+    QTransform labelTransformation( const QPointF&, const QSizeF& ) const;
 
-    virtual void drawTick( QPainter *, double value, double len ) const;
-    virtual void drawBackbone( QPainter * ) const;
-    virtual void drawLabel( QPainter *, double value ) const;
+    virtual void drawTick( QPainter*,
+        double value, double len ) const QWT_OVERRIDE;
 
-private:
-    QwtScaleDraw( const QwtScaleDraw & );
-    QwtScaleDraw &operator=( const QwtScaleDraw &other );
+    virtual void drawBackbone( QPainter* ) const QWT_OVERRIDE;
+    virtual void drawLabel( QPainter*, double value ) const QWT_OVERRIDE;
 
+  private:
     void updateMap();
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
@@ -112,5 +115,5 @@
 
    \sa move(const QPointF &)
-*/
+ */
 inline void QwtScaleDraw::move( double x, double y )
 {
Index: /trunk/BNC/qwt/qwt_scale_engine.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_scale_engine.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_scale_engine.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,39 +10,26 @@
 #include "qwt_scale_engine.h"
 #include "qwt_math.h"
-#include "qwt_scale_map.h"
-#include <qalgorithms.h>
-#include <qmath.h>
-#include <float.h>
+#include "qwt_interval.h"
+#include "qwt_transform.h"
+
+#include <qdebug.h>
+
 #include <limits>
 
-#if QT_VERSION < 0x040601
-#define qFabs(x) ::fabs(x)
-#define qExp(x) ::exp(x)
-#endif
-
 static inline double qwtLog( double base, double value )
 {
-    return log( value ) / log( base );
-}
-
-static inline QwtInterval qwtLogInterval( double base, const QwtInterval &interval )
+    return std::log( value ) / std::log( base );
+}
+
+static inline QwtInterval qwtLogInterval( double base, const QwtInterval& interval )
 {
     return QwtInterval( qwtLog( base, interval.minValue() ),
-            qwtLog( base, interval.maxValue() ) );
-}
-
-static inline QwtInterval qwtPowInterval( double base, const QwtInterval &interval )
-{
-    return QwtInterval( qPow( base, interval.minValue() ),
-            qPow( base, interval.maxValue() ) );
-}
-
-static inline long double qwtIntervalWidthL( const QwtInterval &interval )
-{
-    if ( !interval.isValid() )
-        return 0.0;
-
-    return static_cast<long double>( interval.maxValue() )
-        - static_cast<long double>( interval.minValue() );
+        qwtLog( base, interval.maxValue() ) );
+}
+
+static inline QwtInterval qwtPowInterval( double base, const QwtInterval& interval )
+{
+    return QwtInterval( std::pow( base, interval.minValue() ),
+        std::pow( base, interval.maxValue() ) );
 }
 
@@ -58,8 +45,8 @@
     {
         // # ticks per interval
-        const int numTicks = qCeil( qAbs( intervalSize / minStep ) ) - 1;
+        const int numTicks = qwtCeil( qAbs( intervalSize / minStep ) ) - 1;
 
         // Do the minor steps fit into the interval?
-        if ( qwtFuzzyCompare( ( numTicks +  1 ) * qAbs( minStep ),
+        if ( qwtFuzzyCompare( ( numTicks + 1 ) * qAbs( minStep ),
             qAbs( intervalSize ), intervalSize ) > 0 )
         {
@@ -85,6 +72,6 @@
             const double stepSize = intervalSize / numSteps;
 
-            const double p = ::floor( ::log( stepSize ) / ::log( base ) );
-            const double fraction = qPow( base, p );
+            const double p = std::floor( std::log( stepSize ) / std::log( base ) );
+            const double fraction = std::pow( base, p );
 
             for ( uint n = base; n > 1; n /= 2 )
@@ -110,13 +97,13 @@
 
 /*!
-  Ceil a value, relative to an interval
-
-  \param value Value to be ceiled
-  \param intervalSize Interval size
-
-  \return Rounded value
-
-  \sa floorEps()
-*/
+   Ceil a value, relative to an interval
+
+   \param value Value to be ceiled
+   \param intervalSize Interval size
+
+   \return Rounded value
+
+   \sa floorEps()
+ */
 double QwtScaleArithmetic::ceilEps( double value,
     double intervalSize )
@@ -125,16 +112,16 @@
 
     value = ( value - eps ) / intervalSize;
-    return ::ceil( value ) * intervalSize;
-}
-
-/*!
-  Floor a value, relative to an interval
-
-  \param value Value to be floored
-  \param intervalSize Interval size
-
-  \return Rounded value
-  \sa floorEps()
-*/
+    return std::ceil( value ) * intervalSize;
+}
+
+/*!
+   Floor a value, relative to an interval
+
+   \param value Value to be floored
+   \param intervalSize Interval size
+
+   \return Rounded value
+   \sa floorEps()
+ */
 double QwtScaleArithmetic::floorEps( double value, double intervalSize )
 {
@@ -142,16 +129,16 @@
 
     value = ( value + eps ) / intervalSize;
-    return ::floor( value ) * intervalSize;
-}
-
-/*!
-  \brief Divide an interval into steps
-
-  \f$stepSize = (intervalSize - intervalSize * 10e^{-6}) / numSteps\f$
-
-  \param intervalSize Interval size
-  \param numSteps Number of steps
-  \return Step size
-*/
+    return std::floor( value ) * intervalSize;
+}
+
+/*!
+   \brief Divide an interval into steps
+
+   \f$stepSize = (intervalSize - intervalSize * 10e^{-6}) / numSteps\f$
+
+   \param intervalSize Interval size
+   \param numSteps Number of steps
+   \return Step size
+ */
 double QwtScaleArithmetic::divideEps( double intervalSize, double numSteps )
 {
@@ -163,11 +150,11 @@
 
 /*!
-  Calculate a step size for a given interval
-
-  \param intervalSize Interval size
-  \param numSteps Number of steps
-  \param base Base for the division ( usually 10 )
-
-  \return Calculated step size
+   Calculate a step size for a given interval
+
+   \param intervalSize Interval size
+   \param numSteps Number of steps
+   \param base Base for the division ( usually 10 )
+
+   \return Calculated step size
  */
 double QwtScaleArithmetic::divideInterval(
@@ -181,8 +168,8 @@
         return 0.0;
 
-    const double lx = qwtLog( base, qFabs( v ) );
-    const double p = ::floor( lx );
-
-    const double fraction = qPow( base, lx - p );
+    const double lx = qwtLog( base, std::fabs( v ) );
+    const double p = std::floor( lx );
+
+    const double fraction = std::pow( base, lx - p );
 
     uint n = base;
@@ -190,5 +177,5 @@
         n /= 2;
 
-    double stepSize = n * qPow( base, p );
+    double stepSize = n * std::pow( base, p );
     if ( v < 0 )
         stepSize = -stepSize;
@@ -199,5 +186,5 @@
 class QwtScaleEngine::PrivateData
 {
-public:
+  public:
     PrivateData():
         attributes( QwtScaleEngine::NoAttribute ),
@@ -228,12 +215,12 @@
 
 /*!
-  Constructor
-
-  \param base Base of the scale engine
-  \sa setBase()
+   Constructor
+
+   \param base Base of the scale engine
+   \sa setBase()
  */
 QwtScaleEngine::QwtScaleEngine( uint base )
 {
-    d_data = new PrivateData;
+    m_data = new PrivateData;
     setBase( base );
 }
@@ -243,5 +230,5 @@
 QwtScaleEngine::~QwtScaleEngine ()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -259,10 +246,10 @@
 
  */
-void QwtScaleEngine::setTransformation( QwtTransform *transform )
-{
-    if ( transform != d_data->transform )
-    {
-        delete d_data->transform;
-        d_data->transform = transform;
+void QwtScaleEngine::setTransformation( QwtTransform* transform )
+{
+    if ( transform != m_data->transform )
+    {
+        delete m_data->transform;
+        m_data->transform = transform;
     }
 }
@@ -273,12 +260,12 @@
    NULL is returned, indicating no transformation.
 
-   \return A clone of the transfomation
+   \return A clone of the transformation
    \sa setTransformation()
  */
-QwtTransform *QwtScaleEngine::transformation() const
-{
-    QwtTransform *transform = NULL;
-    if ( d_data->transform )
-        transform = d_data->transform->copy();
+QwtTransform* QwtScaleEngine::transformation() const
+{
+    QwtTransform* transform = NULL;
+    if ( m_data->transform )
+        transform = m_data->transform->copy();
 
     return transform;
@@ -290,8 +277,8 @@
 
     \sa setMargins()
-*/
+ */
 double QwtScaleEngine::lowerMargin() const
 {
-    return d_data->lowerMargin;
+    return m_data->lowerMargin;
 }
 
@@ -301,57 +288,57 @@
 
     \sa setMargins()
-*/
+ */
 double QwtScaleEngine::upperMargin() const
 {
-    return d_data->upperMargin;
-}
-
-/*!
-  \brief Specify margins at the scale's endpoints
-  \param lower minimum distance between the scale's lower boundary and the
+    return m_data->upperMargin;
+}
+
+/*!
+   \brief Specify margins at the scale's endpoints
+   \param lower minimum distance between the scale's lower boundary and the
              smallest enclosed value
-  \param upper minimum distance between the scale's upper boundary and the
+   \param upper minimum distance between the scale's upper boundary and the
              greatest enclosed value
 
-  Margins can be used to leave a minimum amount of space between
-  the enclosed intervals and the boundaries of the scale.
-
-  \warning
-  \li QwtLogScaleEngine measures the margins in decades.
-
-  \sa upperMargin(), lowerMargin()
-*/
+   Margins can be used to leave a minimum amount of space between
+   the enclosed intervals and the boundaries of the scale.
+
+   \warning
+   \li QwtLogScaleEngine measures the margins in decades.
+
+   \sa upperMargin(), lowerMargin()
+ */
 
 void QwtScaleEngine::setMargins( double lower, double upper )
 {
-    d_data->lowerMargin = qMax( lower, 0.0 );
-    d_data->upperMargin = qMax( upper, 0.0 );
-}
-
-/*!
-  Calculate a step size for an interval size
-
-  \param intervalSize Interval size
-  \param numSteps Number of steps
-
-  \return Step size
-*/
+    m_data->lowerMargin = qwtMaxF( lower, 0.0 );
+    m_data->upperMargin = qwtMaxF( upper, 0.0 );
+}
+
+/*!
+   Calculate a step size for an interval size
+
+   \param intervalSize Interval size
+   \param numSteps Number of steps
+
+   \return Step size
+ */
 double QwtScaleEngine::divideInterval(
     double intervalSize, int numSteps ) const
 {
     return QwtScaleArithmetic::divideInterval(
-        intervalSize, numSteps, d_data->base );
-}
-
-/*!
-  Check if an interval "contains" a value
-
-  \param interval Interval
-  \param value Value
-
-  \return True, when the value is inside the interval
-*/
+        intervalSize, numSteps, m_data->base );
+}
+
+/*!
+   Check if an interval "contains" a value
+
+   \param interval Interval
+   \param value Value
+
+   \return True, when the value is inside the interval
+ */
 bool QwtScaleEngine::contains(
-    const QwtInterval &interval, double value ) const
+    const QwtInterval& interval, double value ) const
 {
     if ( !interval.isValid() )
@@ -368,16 +355,16 @@
 
 /*!
-  Remove ticks from a list, that are not inside an interval
-
-  \param ticks Tick list
-  \param interval Interval
-
-  \return Stripped tick list
-*/
-QList<double> QwtScaleEngine::strip( const QList<double>& ticks,
-    const QwtInterval &interval ) const
+   Remove ticks from a list, that are not inside an interval
+
+   \param ticks Tick list
+   \param interval Interval
+
+   \return Stripped tick list
+ */
+QList< double > QwtScaleEngine::strip( const QList< double >& ticks,
+    const QwtInterval& interval ) const
 {
     if ( !interval.isValid() || ticks.count() == 0 )
-        return QList<double>();
+        return QList< double >();
 
     if ( contains( interval, ticks.first() )
@@ -387,5 +374,5 @@
     }
 
-    QList<double> strippedTicks;
+    QList< double > strippedTicks;
     for ( int i = 0; i < ticks.count(); i++ )
     {
@@ -397,22 +384,23 @@
 
 /*!
-  \brief Build an interval around a value
-
-  In case of v == 0.0 the interval is [-0.5, 0.5],
-  otherwide it is [0.5 * v, 1.5 * v]
-
-  \param value Initial value
-  \return Calculated interval
-*/
+   \brief Build an interval around a value
+
+   In case of v == 0.0 the interval is [-0.5, 0.5],
+   otherwise it is [0.5 * v, 1.5 * v]
+
+   \param value Initial value
+   \return Calculated interval
+ */
 
 QwtInterval QwtScaleEngine::buildInterval( double value ) const
 {
     const double delta = ( value == 0.0 ) ? 0.5 : qAbs( 0.5 * value );
-
-    if ( DBL_MAX - delta < value )
-        return QwtInterval( DBL_MAX - delta, DBL_MAX );
-
-    if ( -DBL_MAX + delta > value )
-        return QwtInterval( -DBL_MAX, -DBL_MAX + delta );
+    const double max = std::numeric_limits< double >::max();
+
+    if ( max - delta < value )
+        return QwtInterval( max - delta, max );
+
+    if ( -max + delta > value )
+        return QwtInterval( -max, -max + delta );
 
     return QwtInterval( value - delta, value + delta );
@@ -420,104 +408,104 @@
 
 /*!
-  Change a scale attribute
-
-  \param attribute Attribute to change
-  \param on On/Off
-
-  \sa Attribute, testAttribute()
-*/
+   Change a scale attribute
+
+   \param attribute Attribute to change
+   \param on On/Off
+
+   \sa Attribute, testAttribute()
+ */
 void QwtScaleEngine::setAttribute( Attribute attribute, bool on )
 {
     if ( on )
-        d_data->attributes |= attribute;
+        m_data->attributes |= attribute;
     else
-        d_data->attributes &= ~attribute;
-}
-
-/*!
-  \return True, if attribute is enabled.
-
-  \param attribute Attribute to be tested
-  \sa Attribute, setAttribute()
-*/
+        m_data->attributes &= ~attribute;
+}
+
+/*!
+   \return True, if attribute is enabled.
+
+   \param attribute Attribute to be tested
+   \sa Attribute, setAttribute()
+ */
 bool QwtScaleEngine::testAttribute( Attribute attribute ) const
 {
-    return ( d_data->attributes & attribute );
-}
-
-/*!
-  Change the scale attribute
-
-  \param attributes Set scale attributes
-  \sa Attribute, attributes()
-*/
+    return ( m_data->attributes & attribute );
+}
+
+/*!
+   Change the scale attribute
+
+   \param attributes Set scale attributes
+   \sa Attribute, attributes()
+ */
 void QwtScaleEngine::setAttributes( Attributes attributes )
 {
-    d_data->attributes = attributes;
-}
-
-/*!
-  \return Scale attributes
-  \sa Attribute, setAttributes(), testAttribute()
-*/
+    m_data->attributes = attributes;
+}
+
+/*!
+   \return Scale attributes
+   \sa Attribute, setAttributes(), testAttribute()
+ */
 QwtScaleEngine::Attributes QwtScaleEngine::attributes() const
 {
-    return d_data->attributes;
-}
-
-/*!
-  \brief Specify a reference point
-  \param reference New reference value
-
-  The reference point is needed if options IncludeReference or
-  Symmetric are active. Its default value is 0.0.
-
-  \sa Attribute
-*/
+    return m_data->attributes;
+}
+
+/*!
+   \brief Specify a reference point
+   \param reference New reference value
+
+   The reference point is needed if options IncludeReference or
+   Symmetric are active. Its default value is 0.0.
+
+   \sa Attribute
+ */
 void QwtScaleEngine::setReference( double reference )
 {
-    d_data->referenceValue = reference;
-}
-
-/*!
-  \return the reference value
-  \sa setReference(), setAttribute()
-*/
+    m_data->referenceValue = reference;
+}
+
+/*!
+   \return the reference value
+   \sa setReference(), setAttribute()
+ */
 double QwtScaleEngine::reference() const
 {
-    return d_data->referenceValue;
-}
-
-/*!
-  Set the base of the scale engine
-
-  While a base of 10 is what 99.9% of all applications need
-  certain scales might need a different base: f.e 2
-
-  The default setting is 10
-
-  \param base Base of the engine
-
-  \sa base()
+    return m_data->referenceValue;
+}
+
+/*!
+   Set the base of the scale engine
+
+   While a base of 10 is what 99.9% of all applications need
+   certain scales might need a different base: f.e 2
+
+   The default setting is 10
+
+   \param base Base of the engine
+
+   \sa base()
  */
 void QwtScaleEngine::setBase( uint base )
 {
-    d_data->base = qMax( base, 2U );
-}
-
-/*!
-  \return base Base of the scale engine
-  \sa setBase()
+    m_data->base = qMax( base, 2U );
+}
+
+/*!
+   \return base Base of the scale engine
+   \sa setBase()
  */
 uint QwtScaleEngine::base() const
 {
-    return d_data->base;
-}
-
-/*!
-  Constructor
-
-  \param base Base of the scale engine
-  \sa setBase()
+    return m_data->base;
+}
+
+/*!
+   Constructor
+
+   \param base Base of the scale engine
+   \sa setBase()
  */
 QwtLinearScaleEngine::QwtLinearScaleEngine( uint base ):
@@ -532,15 +520,15 @@
 
 /*!
-  Align and divide an interval
-
-  \param maxNumSteps Max. number of steps
-  \param x1 First limit of the interval (In/Out)
-  \param x2 Second limit of the interval (In/Out)
-  \param stepSize Step size (Out)
-
-  \sa setAttribute()
-*/
+   Align and divide an interval
+
+   \param maxNumSteps Max. number of steps
+   \param x1 First limit of the interval (In/Out)
+   \param x2 Second limit of the interval (In/Out)
+   \param stepSize Step size (Out)
+
+   \sa setAttribute()
+ */
 void QwtLinearScaleEngine::autoScale( int maxNumSteps,
-    double &x1, double &x2, double &stepSize ) const
+    double& x1, double& x2, double& stepSize ) const
 {
     QwtInterval interval( x1, x2 );
@@ -586,5 +574,5 @@
 
    \return Calculated scale division
-*/
+ */
 QwtScaleDiv QwtLinearScaleEngine::divideScale( double x1, double x2,
     int maxMajorSteps, int maxMinorSteps, double stepSize ) const
@@ -592,5 +580,5 @@
     QwtInterval interval = QwtInterval( x1, x2 ).normalized();
 
-    if ( qwtIntervalWidthL( interval ) > std::numeric_limits<double>::max() )
+    if ( interval.widthL() > std::numeric_limits< double >::max() )
     {
         qWarning() << "QwtLinearScaleEngine::divideScale: overflow";
@@ -615,5 +603,5 @@
     if ( stepSize != 0.0 )
     {
-        QList<double> ticks[QwtScaleDiv::NTickTypes];
+        QList< double > ticks[QwtScaleDiv::NTickTypes];
         buildTicks( interval, stepSize, maxMinorSteps, ticks );
 
@@ -636,8 +624,8 @@
 
    \sa buildMajorTicks(), buildMinorTicks
-*/
+ */
 void QwtLinearScaleEngine::buildTicks(
     const QwtInterval& interval, double stepSize, int maxMinorSteps,
-    QList<double> ticks[QwtScaleDiv::NTickTypes] ) const
+    QList< double > ticks[QwtScaleDiv::NTickTypes] ) const
 {
     const QwtInterval boundingInterval = align( interval, stepSize );
@@ -656,6 +644,5 @@
         ticks[i] = strip( ticks[i], interval );
 
-        // ticks very close to 0.0 are
-        // explicitely set to 0.0
+        // ticks very close to 0.0 are explicitly set to 0.0
 
         for ( int j = 0; j < ticks[i].count(); j++ )
@@ -674,7 +661,7 @@
 
    \return Calculated ticks
-*/
-QList<double> QwtLinearScaleEngine::buildMajorTicks(
-    const QwtInterval &interval, double stepSize ) const
+ */
+QList< double > QwtLinearScaleEngine::buildMajorTicks(
+    const QwtInterval& interval, double stepSize ) const
 {
     int numTicks = qRound( interval.width() / stepSize ) + 1;
@@ -682,5 +669,6 @@
         numTicks = 10000;
 
-    QList<double> ticks;
+    QList< double > ticks;
+    ticks.reserve( numTicks );
 
     ticks += interval.minValue();
@@ -701,10 +689,10 @@
    \param mediumTicks Array to be filled with the calculated medium ticks
 
-*/
+ */
 void QwtLinearScaleEngine::buildMinorTicks(
-    const QList<double>& majorTicks,
+    const QList< double >& majorTicks,
     int maxMinorSteps, double stepSize,
-    QList<double> &minorTicks,
-    QList<double> &mediumTicks ) const
+    QList< double >& minorTicks,
+    QList< double >& mediumTicks ) const
 {
     double minStep = qwtStepSize( stepSize, maxMinorSteps, base() );
@@ -713,5 +701,5 @@
 
     // # ticks per interval
-    const int numTicks = qCeil( qAbs( stepSize / minStep ) ) - 1;
+    const int numTicks = qwtCeil( qAbs( stepSize / minStep ) ) - 1;
 
     int medIndex = -1;
@@ -741,16 +729,16 @@
 
 /*!
-  \brief Align an interval to a step size
-
-  The limits of an interval are aligned that both are integer
-  multiples of the step size.
-
-  \param interval Interval
-  \param stepSize Step size
-
-  \return Aligned interval
-*/
+   \brief Align an interval to a step size
+
+   The limits of an interval are aligned that both are integer
+   multiples of the step size.
+
+   \param interval Interval
+   \param stepSize Step size
+
+   \return Aligned interval
+ */
 QwtInterval QwtLinearScaleEngine::align(
-    const QwtInterval &interval, double stepSize ) const
+    const QwtInterval& interval, double stepSize ) const
 {
     double x1 = interval.minValue();
@@ -761,5 +749,7 @@
 
     const double eps = 0.000000000001; // since Qt 4.8: qFuzzyIsNull
-    if ( -DBL_MAX + stepSize <= x1 )
+    const double max = std::numeric_limits< double >::max();
+
+    if ( -max + stepSize <= x1 )
     {
         const double x = QwtScaleArithmetic::floorEps( x1, stepSize );
@@ -768,5 +758,5 @@
     }
 
-    if ( DBL_MAX - stepSize >= x2 )
+    if ( max - stepSize >= x2 )
     {
         const double x = QwtScaleArithmetic::ceilEps( x2, stepSize );
@@ -779,8 +769,8 @@
 
 /*!
-  Constructor
-
-  \param base Base of the scale engine
-  \sa setBase()
+   Constructor
+
+   \param base Base of the scale engine
+   \sa setBase()
  */
 QwtLogScaleEngine::QwtLogScaleEngine( uint base ):
@@ -804,7 +794,7 @@
 
    \sa QwtScaleEngine::setAttribute()
-*/
+ */
 void QwtLogScaleEngine::autoScale( int maxNumSteps,
-    double &x1, double &x2, double &stepSize ) const
+    double& x1, double& x2, double& stepSize ) const
 {
     if ( x1 > x2 )
@@ -813,6 +803,6 @@
     const double logBase = base();
 
-    QwtInterval interval( x1 / qPow( logBase, lowerMargin() ),
-        x2 * qPow( logBase, upperMargin() ) );
+    QwtInterval interval( x1 / std::pow( logBase, lowerMargin() ),
+        x2 * std::pow( logBase, upperMargin() ) );
 
     if ( interval.maxValue() / interval.minValue() < logBase )
@@ -828,21 +818,10 @@
 
         QwtInterval linearInterval = QwtInterval( x1, x2 ).normalized();
-        linearInterval = linearInterval.limited( LOG_MIN, LOG_MAX );
+        linearInterval = linearInterval.limited(
+            QwtLogTransform::LogMin, QwtLogTransform::LogMax );
 
         if ( linearInterval.maxValue() / linearInterval.minValue() < logBase )
         {
-            // the aligned scale is still less than one step
-
-#if 1
-            // this code doesn't make any sense, but for compatibility
-            // reasons we keep it until 6.2. But it will be ignored
-            // in divideScale
-
-            if ( stepSize < 0.0 )
-                stepSize = -qwtLog( logBase, qAbs( stepSize ) );
-            else
-                stepSize = qwtLog( logBase, stepSize );
-#endif
-
+            stepSize = 0.0;
             return;
         }
@@ -850,10 +829,10 @@
 
     double logRef = 1.0;
-    if ( reference() > LOG_MIN / 2 )
-        logRef = qMin( reference(), LOG_MAX / 2 );
+    if ( reference() > QwtLogTransform::LogMin / 2 )
+        logRef = qwtMinF( reference(), QwtLogTransform::LogMax / 2 );
 
     if ( testAttribute( QwtScaleEngine::Symmetric ) )
     {
-        const double delta = qMax( interval.maxValue() / logRef,
+        const double delta = qwtMaxF( interval.maxValue() / logRef,
             logRef / interval.minValue() );
         interval.setInterval( logRef / delta, logRef * delta );
@@ -863,5 +842,5 @@
         interval = interval.extend( logRef );
 
-    interval = interval.limited( LOG_MIN, LOG_MAX );
+    interval = interval.limited( QwtLogTransform::LogMin, QwtLogTransform::LogMax );
 
     if ( interval.width() == 0.0 )
@@ -897,10 +876,10 @@
 
    \return Calculated scale division
-*/
+ */
 QwtScaleDiv QwtLogScaleEngine::divideScale( double x1, double x2,
     int maxMajorSteps, int maxMinorSteps, double stepSize ) const
 {
     QwtInterval interval = QwtInterval( x1, x2 ).normalized();
-    interval = interval.limited( LOG_MIN, LOG_MAX );
+    interval = interval.limited( QwtLogTransform::LogMin, QwtLogTransform::LogMax );
 
     if ( interval.width() <= 0 )
@@ -937,5 +916,5 @@
     if ( stepSize != 0.0 )
     {
-        QList<double> ticks[QwtScaleDiv::NTickTypes];
+        QList< double > ticks[QwtScaleDiv::NTickTypes];
         buildTicks( interval, stepSize, maxMinorSteps, ticks );
 
@@ -958,8 +937,8 @@
 
    \sa buildMajorTicks(), buildMinorTicks
-*/
+ */
 void QwtLogScaleEngine::buildTicks(
     const QwtInterval& interval, double stepSize, int maxMinorSteps,
-    QList<double> ticks[QwtScaleDiv::NTickTypes] ) const
+    QList< double > ticks[QwtScaleDiv::NTickTypes] ) const
 {
     const QwtInterval boundingInterval = align( interval, stepSize );
@@ -985,7 +964,7 @@
 
    \return Calculated ticks
-*/
-QList<double> QwtLogScaleEngine::buildMajorTicks(
-    const QwtInterval &interval, double stepSize ) const
+ */
+QList< double > QwtLogScaleEngine::buildMajorTicks(
+    const QwtInterval& interval, double stepSize ) const
 {
     double width = qwtLogInterval( base(), interval ).width();
@@ -995,14 +974,15 @@
         numTicks = 10000;
 
-    const double lxmin = ::log( interval.minValue() );
-    const double lxmax = ::log( interval.maxValue() );
+    const double lxmin = std::log( interval.minValue() );
+    const double lxmax = std::log( interval.maxValue() );
     const double lstep = ( lxmax - lxmin ) / double( numTicks - 1 );
 
-    QList<double> ticks;
+    QList< double > ticks;
+    ticks.reserve( numTicks );
 
     ticks += interval.minValue();
 
     for ( int i = 1; i < numTicks - 1; i++ )
-        ticks += qExp( lxmin + double( i ) * lstep );
+        ticks += std::exp( lxmin + double( i ) * lstep );
 
     ticks += interval.maxValue();
@@ -1019,10 +999,10 @@
    \param minorTicks Array to be filled with the calculated minor ticks
    \param mediumTicks Array to be filled with the calculated medium ticks
-*/
+ */
 void QwtLogScaleEngine::buildMinorTicks(
-    const QList<double> &majorTicks,
+    const QList< double >& majorTicks,
     int maxMinorSteps, double stepSize,
-    QList<double> &minorTicks,
-    QList<double> &mediumTicks ) const
+    QList< double >& minorTicks,
+    QList< double >& mediumTicks ) const
 {
     const double logBase = base();
@@ -1081,5 +1061,5 @@
 
         // Do the minor steps fit into the interval?
-        if ( qwtFuzzyCompare( ( numTicks +  1 ) * minStep,
+        if ( qwtFuzzyCompare( ( numTicks + 1 ) * minStep,
             stepSize, stepSize ) > 0 )
         {
@@ -1095,5 +1075,5 @@
 
         // substep factor = base^substeps
-        const qreal minFactor = qMax( qPow( logBase, minStep ), qreal( logBase ) );
+        const qreal minFactor = qwtMaxF( std::pow( logBase, minStep ), logBase );
 
         for ( int i = 0; i < majorTicks.count(); i++ )
@@ -1114,16 +1094,16 @@
 
 /*!
-  \brief Align an interval to a step size
-
-  The limits of an interval are aligned that both are integer
-  multiples of the step size.
-
-  \param interval Interval
-  \param stepSize Step size
-
-  \return Aligned interval
-*/
+   \brief Align an interval to a step size
+
+   The limits of an interval are aligned that both are integer
+   multiples of the step size.
+
+   \param interval Interval
+   \param stepSize Step size
+
+   \return Aligned interval
+ */
 QwtInterval QwtLogScaleEngine::align(
-    const QwtInterval &interval, double stepSize ) const
+    const QwtInterval& interval, double stepSize ) const
 {
     const QwtInterval intv = qwtLogInterval( base(), interval );
Index: /trunk/BNC/qwt/qwt_scale_engine.h
===================================================================
--- /trunk/BNC/qwt/qwt_scale_engine.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_scale_engine.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,14 +13,14 @@
 #include "qwt_global.h"
 #include "qwt_scale_div.h"
-#include "qwt_interval.h"
-
+
+class QwtInterval;
 class QwtTransform;
 
 /*!
-  \brief Arithmetic including a tolerance
-*/
+   \brief Arithmetic including a tolerance
+ */
 class QWT_EXPORT QwtScaleArithmetic
 {
-public:
+  public:
     static double ceilEps( double value, double intervalSize );
     static double floorEps( double value, double intervalSize );
@@ -33,17 +33,17 @@
 
 /*!
-  \brief Base class for scale engines.
-
-  A scale engine tries to find "reasonable" ranges and step sizes
-  for scales.
-
-  The layout of the scale can be varied with setAttribute().
-
-  Qwt offers implementations for logarithmic and linear scales.
-*/
+   \brief Base class for scale engines.
+
+   A scale engine tries to find "reasonable" ranges and step sizes
+   for scales.
+
+   The layout of the scale can be varied with setAttribute().
+
+   Qwt offers implementations for logarithmic and linear scales.
+ */
 
 class QWT_EXPORT QwtScaleEngine
 {
-public:
+  public:
     /*!
        Layout attributes
@@ -76,6 +76,5 @@
     };
 
-    //! Layout attributes
-    typedef QFlags<Attribute> Attributes;
+    Q_DECLARE_FLAGS( Attributes, Attribute )
 
     explicit QwtScaleEngine( uint base = 10 );
@@ -99,36 +98,36 @@
 
     /*!
-      Align and divide an interval
-
-      \param maxNumSteps Max. number of steps
-      \param x1 First limit of the interval (In/Out)
-      \param x2 Second limit of the interval (In/Out)
-      \param stepSize Step size (Return value)
-    */
+       Align and divide an interval
+
+       \param maxNumSteps Max. number of steps
+       \param x1 First limit of the interval (In/Out)
+       \param x2 Second limit of the interval (In/Out)
+       \param stepSize Step size (Return value)
+     */
     virtual void autoScale( int maxNumSteps,
-        double &x1, double &x2, double &stepSize ) const = 0;
+        double& x1, double& x2, double& stepSize ) const = 0;
 
     /*!
-      \brief Calculate a scale division
-
-      \param x1 First interval limit
-      \param x2 Second interval limit
-      \param maxMajorSteps Maximum for the number of major steps
-      \param maxMinorSteps Maximum number of minor steps
-      \param stepSize Step size. If stepSize == 0.0, the scaleEngine
+       \brief Calculate a scale division
+
+       \param x1 First interval limit
+       \param x2 Second interval limit
+       \param maxMajorSteps Maximum for the number of major steps
+       \param maxMinorSteps Maximum number of minor steps
+       \param stepSize Step size. If stepSize == 0.0, the scaleEngine
                    calculates one.
 
-      \return Calculated scale division
-    */
+       \return Calculated scale division
+     */
     virtual QwtScaleDiv divideScale( double x1, double x2,
         int maxMajorSteps, int maxMinorSteps,
         double stepSize = 0.0 ) const = 0;
 
-    void setTransformation( QwtTransform * );
-    QwtTransform *transformation() const;
-
-protected:
-    bool contains( const QwtInterval &, double value ) const;
-    QList<double> strip( const QList<double>&, const QwtInterval & ) const;
+    void setTransformation( QwtTransform* );
+    QwtTransform* transformation() const;
+
+  protected:
+    bool contains( const QwtInterval&, double value ) const;
+    QList< double > strip( const QList< double >&, const QwtInterval& ) const;
 
     double divideInterval( double intervalSize, int numSteps ) const;
@@ -136,82 +135,84 @@
     QwtInterval buildInterval( double value ) const;
 
-private:
+  private:
+    Q_DISABLE_COPY(QwtScaleEngine)
+
     class PrivateData;
-    PrivateData *d_data;
-};
-
-/*!
-  \brief A scale engine for linear scales
-
-  The step size will fit into the pattern
-  \f$\left\{ 1,2,5\right\} \cdot 10^{n}\f$, where n is an integer.
-*/
-
-class QWT_EXPORT QwtLinearScaleEngine: public QwtScaleEngine
-{
-public:
-    QwtLinearScaleEngine( uint base = 10 );
+    PrivateData* m_data;
+};
+
+/*!
+   \brief A scale engine for linear scales
+
+   The step size will fit into the pattern
+   \f$\left\{ 1,2,5\right\} \cdot 10^{n}\f$, where n is an integer.
+ */
+
+class QWT_EXPORT QwtLinearScaleEngine : public QwtScaleEngine
+{
+  public:
+    explicit QwtLinearScaleEngine( uint base = 10 );
     virtual ~QwtLinearScaleEngine();
 
     virtual void autoScale( int maxNumSteps,
-        double &x1, double &x2, double &stepSize ) const;
+        double& x1, double& x2, double& stepSize ) const QWT_OVERRIDE;
 
     virtual QwtScaleDiv divideScale( double x1, double x2,
         int maxMajorSteps, int maxMinorSteps,
-        double stepSize = 0.0 ) const;
-
-
-protected:
+        double stepSize = 0.0 ) const QWT_OVERRIDE;
+
+
+  protected:
     QwtInterval align( const QwtInterval&, double stepSize ) const;
 
     void buildTicks(
-        const QwtInterval &, double stepSize, int maxMinorSteps,
-        QList<double> ticks[QwtScaleDiv::NTickTypes] ) const;
-
-    QList<double> buildMajorTicks(
-        const QwtInterval &interval, double stepSize ) const;
-
-    void buildMinorTicks( const QList<double>& majorTicks,
+        const QwtInterval&, double stepSize, int maxMinorSteps,
+        QList< double > ticks[QwtScaleDiv::NTickTypes] ) const;
+
+    QList< double > buildMajorTicks(
+        const QwtInterval& interval, double stepSize ) const;
+
+    void buildMinorTicks( const QList< double >& majorTicks,
         int maxMinorSteps, double stepSize,
-        QList<double> &minorTicks, QList<double> &mediumTicks ) const;
-};
-
-/*!
-  \brief A scale engine for logarithmic scales
-
-  The step size is measured in *decades*
-  and the major step size will be adjusted to fit the pattern
-  \f$\left\{ 1,2,3,5\right\} \cdot 10^{n}\f$, where n is a natural number
-  including zero.
-
-  \warning the step size as well as the margins are measured in *decades*.
-*/
-
-class QWT_EXPORT QwtLogScaleEngine: public QwtScaleEngine
-{
-public:
-    QwtLogScaleEngine( uint base = 10 );
+        QList< double >& minorTicks, QList< double >& mediumTicks ) const;
+};
+
+/*!
+   \brief A scale engine for logarithmic scales
+
+   The step size is measured in *decades*
+   and the major step size will be adjusted to fit the pattern
+   \f$\left\{ 1,2,3,5\right\} \cdot 10^{n}\f$, where n is a natural number
+   including zero.
+
+   \warning the step size as well as the margins are measured in *decades*.
+ */
+
+class QWT_EXPORT QwtLogScaleEngine : public QwtScaleEngine
+{
+  public:
+    explicit QwtLogScaleEngine( uint base = 10 );
     virtual ~QwtLogScaleEngine();
 
     virtual void autoScale( int maxNumSteps,
-        double &x1, double &x2, double &stepSize ) const;
+        double& x1, double& x2, double& stepSize ) const QWT_OVERRIDE;
 
     virtual QwtScaleDiv divideScale( double x1, double x2,
         int maxMajorSteps, int maxMinorSteps,
-        double stepSize = 0.0 ) const;
-
-protected:
+        double stepSize = 0.0 ) const QWT_OVERRIDE;
+
+  protected:
     QwtInterval align( const QwtInterval&, double stepSize ) const;
 
     void buildTicks(
-        const QwtInterval &, double stepSize, int maxMinorSteps,
-        QList<double> ticks[QwtScaleDiv::NTickTypes] ) const;
-
-    QList<double> buildMajorTicks(
-        const QwtInterval &interval, double stepSize ) const;
-
-    void buildMinorTicks( const QList<double>& majorTicks,
+        const QwtInterval&, double stepSize, int maxMinorSteps,
+        QList< double > ticks[QwtScaleDiv::NTickTypes] ) const;
+
+    QList< double > buildMajorTicks(
+        const QwtInterval& interval, double stepSize ) const;
+
+    void buildMinorTicks( const QList< double >& majorTicks,
         int maxMinorSteps, double stepSize,
-        QList<double> &minorTicks, QList<double> &mediumTicks ) const;
+        QList< double >& minorTicks, QList< double >& mediumTicks ) const;
 };
 
Index: /trunk/BNC/qwt/qwt_scale_map.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_scale_map.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_scale_map.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,60 +10,61 @@
 #include "qwt_scale_map.h"
 #include "qwt_math.h"
+
 #include <qrect.h>
 #include <qdebug.h>
 
 /*!
-  \brief Constructor
-
-  The scale and paint device intervals are both set to [0,1].
-*/
-QwtScaleMap::QwtScaleMap():
-    d_s1( 0.0 ),
-    d_s2( 1.0 ),
-    d_p1( 0.0 ),
-    d_p2( 1.0 ),
-    d_cnv( 1.0 ),
-    d_ts1( 0.0 ),
-    d_transform( NULL )
+   \brief Constructor
+
+   The scale and paint device intervals are both set to [0,1].
+ */
+QwtScaleMap::QwtScaleMap()
+    : m_s1( 0.0 )
+    , m_s2( 1.0 )
+    , m_p1( 0.0 )
+    , m_p2( 1.0 )
+    , m_cnv( 1.0 )
+    , m_ts1( 0.0 )
+    , m_transform( NULL )
 {
 }
 
 //! Copy constructor
-QwtScaleMap::QwtScaleMap( const QwtScaleMap& other ):
-    d_s1( other.d_s1 ),
-    d_s2( other.d_s2 ),
-    d_p1( other.d_p1 ),
-    d_p2( other.d_p2 ),
-    d_cnv( other.d_cnv ),
-    d_ts1( other.d_ts1 ),
-    d_transform( NULL )
-{
-    if ( other.d_transform )
-        d_transform = other.d_transform->copy();
-}
-
-/*!
-  Destructor
-*/
+QwtScaleMap::QwtScaleMap( const QwtScaleMap& other )
+    : m_s1( other.m_s1 )
+    , m_s2( other.m_s2 )
+    , m_p1( other.m_p1 )
+    , m_p2( other.m_p2 )
+    , m_cnv( other.m_cnv )
+    , m_ts1( other.m_ts1 )
+    , m_transform( NULL )
+{
+    if ( other.m_transform )
+        m_transform = other.m_transform->copy();
+}
+
+/*!
+   Destructor
+ */
 QwtScaleMap::~QwtScaleMap()
 {
-    delete d_transform;
+    delete m_transform;
 }
 
 //! Assignment operator
-QwtScaleMap &QwtScaleMap::operator=( const QwtScaleMap & other )
-{
-    d_s1 = other.d_s1;
-    d_s2 = other.d_s2;
-    d_p1 = other.d_p1;
-    d_p2 = other.d_p2;
-    d_cnv = other.d_cnv;
-    d_ts1 = other.d_ts1;
-
-    delete d_transform;
-    d_transform = NULL;
-
-    if ( other.d_transform )
-        d_transform = other.d_transform->copy();
+QwtScaleMap& QwtScaleMap::operator=( const QwtScaleMap& other )
+{
+    m_s1 = other.m_s1;
+    m_s2 = other.m_s2;
+    m_p1 = other.m_p1;
+    m_p2 = other.m_p2;
+    m_cnv = other.m_cnv;
+    m_ts1 = other.m_ts1;
+
+    delete m_transform;
+    m_transform = NULL;
+
+    if ( other.m_transform )
+        m_transform = other.m_transform->copy();
 
     return *this;
@@ -72,38 +73,38 @@
 /*!
    Initialize the map with a transformation
-*/
-void QwtScaleMap::setTransformation( QwtTransform *transform )
-{
-    if ( transform != d_transform )
+ */
+void QwtScaleMap::setTransformation( QwtTransform* transform )
+{
+    if ( transform != m_transform )
     {
-        delete d_transform;
-        d_transform = transform;
+        delete m_transform;
+        m_transform = transform;
     }
 
-    setScaleInterval( d_s1, d_s2 );
+    setScaleInterval( m_s1, m_s2 );
 }
 
 //! Get the transformation
-const QwtTransform *QwtScaleMap::transformation() const
-{
-    return d_transform;
-}
-
-/*!
-  \brief Specify the borders of the scale interval
-  \param s1 first border
-  \param s2 second border
-  \warning scales might be aligned to
+const QwtTransform* QwtScaleMap::transformation() const
+{
+    return m_transform;
+}
+
+/*!
+   \brief Specify the borders of the scale interval
+   \param s1 first border
+   \param s2 second border
+   \warning scales might be aligned to
            transformation depending boundaries
-*/
+ */
 void QwtScaleMap::setScaleInterval( double s1, double s2 )
 {
-    d_s1 = s1;
-    d_s2 = s2;
-
-    if ( d_transform )
+    m_s1 = s1;
+    m_s2 = s2;
+
+    if ( m_transform )
     {
-        d_s1 = d_transform->bounded( d_s1 );
-        d_s2 = d_transform->bounded( d_s2 );
+        m_s1 = m_transform->bounded( m_s1 );
+        m_s2 = m_transform->bounded( m_s2 );
     }
 
@@ -112,12 +113,12 @@
 
 /*!
-  \brief Specify the borders of the paint device interval
-  \param p1 first border
-  \param p2 second border
-*/
+   \brief Specify the borders of the paint device interval
+   \param p1 first border
+   \param p2 second border
+ */
 void QwtScaleMap::setPaintInterval( double p1, double p2 )
 {
-    d_p1 = p1;
-    d_p2 = p2;
+    m_p1 = p1;
+    m_p2 = p2;
 
     updateFactor();
@@ -126,16 +127,16 @@
 void QwtScaleMap::updateFactor()
 {
-    d_ts1 = d_s1;
-    double ts2 = d_s2;
-
-    if ( d_transform )
+    m_ts1 = m_s1;
+    double ts2 = m_s2;
+
+    if ( m_transform )
     {
-        d_ts1 = d_transform->transform( d_ts1 );
-        ts2 = d_transform->transform( ts2 );
+        m_ts1 = m_transform->transform( m_ts1 );
+        ts2 = m_transform->transform( ts2 );
     }
 
-    d_cnv = 1.0;
-    if ( d_ts1 != ts2 )
-        d_cnv = ( d_p2 - d_p1 ) / ( ts2 - d_ts1 );
+    m_cnv = 1.0;
+    if ( m_ts1 != ts2 )
+        m_cnv = ( m_p2 - m_p1 ) / ( ts2 - m_ts1 );
 }
 
@@ -149,7 +150,7 @@
 
    \sa invTransform()
-*/
-QRectF QwtScaleMap::transform( const QwtScaleMap &xMap,
-    const QwtScaleMap &yMap, const QRectF &rect )
+ */
+QRectF QwtScaleMap::transform( const QwtScaleMap& xMap,
+    const QwtScaleMap& yMap, const QRectF& rect )
 {
     double x1 = xMap.transform( rect.left() );
@@ -183,12 +184,12 @@
    \return Position in scale coordinates
    \sa transform()
-*/
-QPointF QwtScaleMap::invTransform( const QwtScaleMap &xMap,
-    const QwtScaleMap &yMap, const QPointF &pos )
+ */
+QPointF QwtScaleMap::invTransform( const QwtScaleMap& xMap,
+    const QwtScaleMap& yMap, const QPointF& pos )
 {
     return QPointF(
         xMap.invTransform( pos.x() ),
         yMap.invTransform( pos.y() )
-    );
+        );
 }
 
@@ -202,12 +203,12 @@
 
    \sa invTransform()
-*/
-QPointF QwtScaleMap::transform( const QwtScaleMap &xMap,
-    const QwtScaleMap &yMap, const QPointF &pos )
+ */
+QPointF QwtScaleMap::transform( const QwtScaleMap& xMap,
+    const QwtScaleMap& yMap, const QPointF& pos )
 {
     return QPointF(
         xMap.transform( pos.x() ),
         yMap.transform( pos.y() )
-    );
+        );
 }
 
@@ -220,7 +221,7 @@
    \return Rectangle in scale coordinates
    \sa transform()
-*/
-QRectF QwtScaleMap::invTransform( const QwtScaleMap &xMap,
-    const QwtScaleMap &yMap, const QRectF &rect )
+ */
+QRectF QwtScaleMap::invTransform( const QwtScaleMap& xMap,
+    const QwtScaleMap& yMap, const QRectF& rect )
 {
     const double x1 = xMap.invTransform( rect.left() );
@@ -235,11 +236,11 @@
 #ifndef QT_NO_DEBUG_STREAM
 
-QDebug operator<<( QDebug debug, const QwtScaleMap &map )
+QDebug operator<<( QDebug debug, const QwtScaleMap& map )
 {
     debug.nospace() << "QwtScaleMap("
-        << map.transformation()
-        << ", s:" << map.s1() << "->" << map.s2()
-        << ", p:" << map.p1() << "->" << map.p2()
-        << ")";
+                    << map.transformation()
+                    << ", s:" << map.s1() << "->" << map.s2()
+                    << ", p:" << map.p1() << "->" << map.p2()
+                    << ")";
 
     return debug.space();
Index: /trunk/BNC/qwt/qwt_scale_map.h
===================================================================
--- /trunk/BNC/qwt/qwt_scale_map.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_scale_map.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,10 +13,6 @@
 #include "qwt_global.h"
 #include "qwt_transform.h"
-#include <qrect.h>
 
-#ifndef QT_NO_DEBUG_STREAM
-#include <qdebug.h>
-#endif
-
+class QPointF;
 class QRectF;
 
@@ -27,8 +23,8 @@
    of a scale into the linear coordinate system of a paint device
    and vice versa.
-*/
+ */
 class QWT_EXPORT QwtScaleMap
 {
-public:
+  public:
     QwtScaleMap();
     QwtScaleMap( const QwtScaleMap& );
@@ -36,8 +32,8 @@
     ~QwtScaleMap();
 
-    QwtScaleMap &operator=( const QwtScaleMap & );
+    QwtScaleMap& operator=( const QwtScaleMap& );
 
-    void setTransformation( QwtTransform * );
-    const QwtTransform *transformation() const;
+    void setTransformation( QwtTransform* );
+    const QwtTransform* transformation() const;
 
     void setPaintInterval( double p1, double p2 );
@@ -56,107 +52,109 @@
     double sDist() const;
 
-    static QRectF transform( const QwtScaleMap &,
-        const QwtScaleMap &, const QRectF & );
-    static QRectF invTransform( const QwtScaleMap &,
-        const QwtScaleMap &, const QRectF & );
+    static QRectF transform( const QwtScaleMap&,
+        const QwtScaleMap&, const QRectF& );
 
-    static QPointF transform( const QwtScaleMap &,
-        const QwtScaleMap &, const QPointF & );
-    static QPointF invTransform( const QwtScaleMap &,
-        const QwtScaleMap &, const QPointF & );
+    static QRectF invTransform( const QwtScaleMap&,
+        const QwtScaleMap&, const QRectF& );
+
+    static QPointF transform( const QwtScaleMap&,
+        const QwtScaleMap&, const QPointF& );
+
+    static QPointF invTransform( const QwtScaleMap&,
+        const QwtScaleMap&, const QPointF& );
 
     bool isInverting() const;
 
-private:
+  private:
     void updateFactor();
 
-    double d_s1, d_s2;     // scale interval boundaries
-    double d_p1, d_p2;     // paint device interval boundaries
+    double m_s1, m_s2;     // scale interval boundaries
+    double m_p1, m_p2;     // paint device interval boundaries
 
-    double d_cnv;       // conversion factor
-    double d_ts1;
+    double m_cnv;       // conversion factor
+    double m_ts1;
 
-    QwtTransform *d_transform;
+    QwtTransform* m_transform;
 };
 
 /*!
     \return First border of the scale interval
-*/
+ */
 inline double QwtScaleMap::s1() const
 {
-    return d_s1;
+    return m_s1;
 }
 
 /*!
     \return Second border of the scale interval
-*/
+ */
 inline double QwtScaleMap::s2() const
 {
-    return d_s2;
+    return m_s2;
 }
 
 /*!
     \return First border of the paint interval
-*/
+ */
 inline double QwtScaleMap::p1() const
 {
-    return d_p1;
+    return m_p1;
 }
 
 /*!
     \return Second border of the paint interval
-*/
+ */
 inline double QwtScaleMap::p2() const
 {
-    return d_p2;
+    return m_p2;
 }
 
 /*!
     \return qwtAbs(p2() - p1())
-*/
+ */
 inline double QwtScaleMap::pDist() const
 {
-    return qAbs( d_p2 - d_p1 );
+    return qAbs( m_p2 - m_p1 );
 }
 
 /*!
     \return qwtAbs(s2() - s1())
-*/
+ */
 inline double QwtScaleMap::sDist() const
 {
-    return qAbs( d_s2 - d_s1 );
+    return qAbs( m_s2 - m_s1 );
 }
 
 /*!
-  Transform a point related to the scale interval into an point
-  related to the interval of the paint device
+   Transform a point related to the scale interval into an point
+   related to the interval of the paint device
 
-  \param s Value relative to the coordinates of the scale
-  \return Transformed value
+   \param s Value relative to the coordinates of the scale
+   \return Transformed value
 
-  \sa invTransform()
-*/
+   \sa invTransform()
+ */
 inline double QwtScaleMap::transform( double s ) const
 {
-    if ( d_transform )
-        s = d_transform->transform( s );
+    if ( m_transform )
+        s = m_transform->transform( s );
 
-    return d_p1 + ( s - d_ts1 ) * d_cnv;
+    return m_p1 + ( s - m_ts1 ) * m_cnv;
 }
 
 /*!
-  Transform an paint device value into a value in the
-  interval of the scale.
+   Transform an paint device value into a value in the
+   interval of the scale.
 
-  \param p Value relative to the coordinates of the paint device
-  \return Transformed value
+   \param p Value relative to the coordinates of the paint device
+   \return Transformed value
 
-  \sa transform()
-*/
+   \sa transform()
+ */
 inline double QwtScaleMap::invTransform( double p ) const
 {
-    double s = d_ts1 + ( p - d_p1 ) / d_cnv;
-    if ( d_transform )
-        s = d_transform->invTransform( s );
+    double s = m_ts1 + ( p - m_p1 ) / m_cnv;
+    if ( m_transform )
+        s = m_transform->invTransform( s );
 
     return s;
@@ -166,9 +164,9 @@
 inline bool QwtScaleMap::isInverting() const
 {
-    return ( ( d_p1 < d_p2 ) != ( d_s1 < d_s2 ) );
+    return ( ( m_p1 < m_p2 ) != ( m_s1 < m_s2 ) );
 }
 
 #ifndef QT_NO_DEBUG_STREAM
-QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleMap & );
+QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleMap& );
 #endif
 
Index: /trunk/BNC/qwt/qwt_scale_widget.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_scale_widget.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_scale_widget.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -15,17 +15,19 @@
 #include "qwt_scale_div.h"
 #include "qwt_text.h"
+#include "qwt_interval.h"
 #include "qwt_scale_engine.h"
+
 #include <qpainter.h>
 #include <qevent.h>
-#include <qmath.h>
 #include <qstyle.h>
 #include <qstyleoption.h>
 #include <qapplication.h>
+#include <qmargins.h>
 
 class QwtScaleWidget::PrivateData
 {
-public:
-    PrivateData():
-        scaleDraw( NULL )
+  public:
+    PrivateData()
+        : scaleDraw( NULL )
     {
         colorBar.colorMap = NULL;
@@ -38,5 +40,5 @@
     }
 
-    QwtScaleDraw *scaleDraw;
+    QwtScaleDraw* scaleDraw;
 
     int borderDist[2];
@@ -56,14 +58,14 @@
         int width;
         QwtInterval interval;
-        QwtColorMap *colorMap;
+        QwtColorMap* colorMap;
     } colorBar;
 };
 
 /*!
-  \brief Create a scale with the position QwtScaleWidget::Left
-  \param parent Parent widget
-*/
-QwtScaleWidget::QwtScaleWidget( QWidget *parent ):
-    QWidget( parent )
+   \brief Create a scale with the position QwtScaleWidget::Left
+   \param parent Parent widget
+ */
+QwtScaleWidget::QwtScaleWidget( QWidget* parent )
+    : QWidget( parent )
 {
     initScale( QwtScaleDraw::LeftScale );
@@ -71,11 +73,10 @@
 
 /*!
-  \brief Constructor
-  \param align Alignment.
-  \param parent Parent widget
-*/
-QwtScaleWidget::QwtScaleWidget(
-        QwtScaleDraw::Alignment align, QWidget *parent ):
-    QWidget( parent )
+   \brief Constructor
+   \param align Alignment.
+   \param parent Parent widget
+ */
+QwtScaleWidget::QwtScaleWidget( QwtScaleDraw::Alignment align, QWidget* parent )
+    : QWidget( parent )
 {
     initScale( align );
@@ -85,5 +86,5 @@
 QwtScaleWidget::~QwtScaleWidget()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -91,37 +92,36 @@
 void QwtScaleWidget::initScale( QwtScaleDraw::Alignment align )
 {
-    d_data = new PrivateData;
-
-    d_data->layoutFlags = 0;
+    m_data = new PrivateData;
+
     if ( align == QwtScaleDraw::RightScale )
-        d_data->layoutFlags |= TitleInverted;
-
-    d_data->borderDist[0] = 0;
-    d_data->borderDist[1] = 0;
-    d_data->minBorderDist[0] = 0;
-    d_data->minBorderDist[1] = 0;
-    d_data->margin = 4;
-    d_data->titleOffset = 0;
-    d_data->spacing = 2;
-
-    d_data->scaleDraw = new QwtScaleDraw;
-    d_data->scaleDraw->setAlignment( align );
-    d_data->scaleDraw->setLength( 10 );
-
-    d_data->scaleDraw->setScaleDiv(
+        m_data->layoutFlags |= TitleInverted;
+
+    m_data->borderDist[0] = 0;
+    m_data->borderDist[1] = 0;
+    m_data->minBorderDist[0] = 0;
+    m_data->minBorderDist[1] = 0;
+    m_data->margin = 4;
+    m_data->titleOffset = 0;
+    m_data->spacing = 2;
+
+    m_data->scaleDraw = new QwtScaleDraw;
+    m_data->scaleDraw->setAlignment( align );
+    m_data->scaleDraw->setLength( 10 );
+
+    m_data->scaleDraw->setScaleDiv(
         QwtLinearScaleEngine().divideScale( 0.0, 100.0, 10, 5 ) );
 
-    d_data->colorBar.colorMap = new QwtLinearColorMap();
-    d_data->colorBar.isEnabled = false;
-    d_data->colorBar.width = 10;
+    m_data->colorBar.colorMap = new QwtLinearColorMap();
+    m_data->colorBar.isEnabled = false;
+    m_data->colorBar.width = 10;
 
     const int flags = Qt::AlignHCenter
         | Qt::TextExpandTabs | Qt::TextWordWrap;
-    d_data->title.setRenderFlags( flags );
-    d_data->title.setFont( font() );
+    m_data->title.setRenderFlags( flags );
+    m_data->title.setFont( font() );
 
     QSizePolicy policy( QSizePolicy::MinimumExpanding,
         QSizePolicy::Fixed );
-    if ( d_data->scaleDraw->orientation() == Qt::Vertical )
+    if ( m_data->scaleDraw->orientation() == Qt::Vertical )
         policy.transpose();
 
@@ -138,13 +138,13 @@
 
    \sa testLayoutFlag(), LayoutFlag
-*/
+ */
 void QwtScaleWidget::setLayoutFlag( LayoutFlag flag, bool on )
 {
-    if ( ( ( d_data->layoutFlags & flag ) != 0 ) != on )
+    if ( ( ( m_data->layoutFlags & flag ) != 0 ) != on )
     {
         if ( on )
-            d_data->layoutFlags |= flag;
+            m_data->layoutFlags |= flag;
         else
-            d_data->layoutFlags &= ~flag;
+            m_data->layoutFlags &= ~flag;
 
         update();
@@ -158,21 +158,21 @@
    \return true/false
    \sa setLayoutFlag(), LayoutFlag
-*/
+ */
 bool QwtScaleWidget::testLayoutFlag( LayoutFlag flag ) const
 {
-    return ( d_data->layoutFlags & flag );
-}
-
-/*!
-  Give title new text contents
-
-  \param title New title
-  \sa title(), setTitle(const QwtText &);
-*/
-void QwtScaleWidget::setTitle( const QString &title )
-{
-    if ( d_data->title.text() != title )
-    {
-        d_data->title.setText( title );
+    return ( m_data->layoutFlags & flag );
+}
+
+/*!
+   Give title new text contents
+
+   \param title New title
+   \sa title(), setTitle(const QwtText &);
+ */
+void QwtScaleWidget::setTitle( const QString& title )
+{
+    if ( m_data->title.text() != title )
+    {
+        m_data->title.setText( title );
         layoutScale();
     }
@@ -180,13 +180,13 @@
 
 /*!
-  Give title new text contents
-
-  \param title New title
-  \sa title()
-  \warning The title flags are interpreted in
+   Give title new text contents
+
+   \param title New title
+   \sa title()
+   \warning The title flags are interpreted in
                direction of the label, AlignTop, AlignBottom can't be set
                as the title will always be aligned to the scale.
-*/
-void QwtScaleWidget::setTitle( const QwtText &title )
+ */
+void QwtScaleWidget::setTitle( const QwtText& title )
 {
     QwtText t = title;
@@ -194,7 +194,7 @@
     t.setRenderFlags( flags );
 
-    if ( t != d_data->title )
-    {
-        d_data->title = t;
+    if ( t != m_data->title )
+    {
+        m_data->title = t;
         layoutScale();
     }
@@ -202,19 +202,20 @@
 
 /*!
-  Change the alignment
-
-  \param alignment New alignment
-  \sa alignment()
-*/
+   Change the alignment
+
+   \param alignment New alignment
+   \sa alignment()
+ */
 void QwtScaleWidget::setAlignment( QwtScaleDraw::Alignment alignment )
 {
-    if ( d_data->scaleDraw )
-        d_data->scaleDraw->setAlignment( alignment );
+    if ( m_data->scaleDraw == NULL )
+        return;
+
+    m_data->scaleDraw->setAlignment( alignment );
 
     if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
     {
-        QSizePolicy policy( QSizePolicy::MinimumExpanding,
-            QSizePolicy::Fixed );
-        if ( d_data->scaleDraw->orientation() == Qt::Vertical )
+        QSizePolicy policy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
+        if ( m_data->scaleDraw->orientation() == Qt::Vertical )
             policy.transpose();
 
@@ -231,5 +232,5 @@
     \return position
     \sa setPosition()
-*/
+ */
 QwtScaleDraw::Alignment QwtScaleWidget::alignment() const
 {
@@ -241,17 +242,17 @@
 
 /*!
-  Specify distances of the scale's endpoints from the
-  widget's borders. The actual borders will never be less
-  than minimum border distance.
-  \param dist1 Left or top Distance
-  \param dist2 Right or bottom distance
-  \sa borderDist()
-*/
+   Specify distances of the scale's endpoints from the
+   widget's borders. The actual borders will never be less
+   than minimum border distance.
+   \param dist1 Left or top Distance
+   \param dist2 Right or bottom distance
+   \sa borderDist()
+ */
 void QwtScaleWidget::setBorderDist( int dist1, int dist2 )
 {
-    if ( dist1 != d_data->borderDist[0] || dist2 != d_data->borderDist[1] )
-    {
-        d_data->borderDist[0] = dist1;
-        d_data->borderDist[1] = dist2;
+    if ( dist1 != m_data->borderDist[0] || dist2 != m_data->borderDist[1] )
+    {
+        m_data->borderDist[0] = dist1;
+        m_data->borderDist[1] = dist2;
         layoutScale();
     }
@@ -259,14 +260,14 @@
 
 /*!
-  \brief Specify the margin to the colorBar/base line.
-  \param margin Margin
-  \sa margin()
-*/
+   \brief Specify the margin to the colorBar/base line.
+   \param margin Margin
+   \sa margin()
+ */
 void QwtScaleWidget::setMargin( int margin )
 {
     margin = qMax( 0, margin );
-    if ( margin != d_data->margin )
-    {
-        d_data->margin = margin;
+    if ( margin != m_data->margin )
+    {
+        m_data->margin = margin;
         layoutScale();
     }
@@ -274,14 +275,14 @@
 
 /*!
-  \brief Specify the distance between color bar, scale and title
-  \param spacing Spacing
-  \sa spacing()
-*/
+   \brief Specify the distance between color bar, scale and title
+   \param spacing Spacing
+   \sa spacing()
+ */
 void QwtScaleWidget::setSpacing( int spacing )
 {
     spacing = qMax( 0, spacing );
-    if ( spacing != d_data->spacing )
-    {
-        d_data->spacing = spacing;
+    if ( spacing != m_data->spacing )
+    {
+        m_data->spacing = spacing;
         layoutScale();
     }
@@ -289,44 +290,44 @@
 
 /*!
-  \brief Change the alignment for the labels.
-
-  \sa QwtScaleDraw::setLabelAlignment(), setLabelRotation()
-*/
+   \brief Change the alignment for the labels.
+
+   \sa QwtScaleDraw::setLabelAlignment(), setLabelRotation()
+ */
 void QwtScaleWidget::setLabelAlignment( Qt::Alignment alignment )
 {
-    d_data->scaleDraw->setLabelAlignment( alignment );
+    m_data->scaleDraw->setLabelAlignment( alignment );
     layoutScale();
 }
 
 /*!
-  \brief Change the rotation for the labels.
-  See QwtScaleDraw::setLabelRotation().
-
-  \param rotation Rotation
-  \sa QwtScaleDraw::setLabelRotation(), setLabelFlags()
-*/
+   \brief Change the rotation for the labels.
+   See QwtScaleDraw::setLabelRotation().
+
+   \param rotation Rotation
+   \sa QwtScaleDraw::setLabelRotation(), setLabelFlags()
+ */
 void QwtScaleWidget::setLabelRotation( double rotation )
 {
-    d_data->scaleDraw->setLabelRotation( rotation );
+    m_data->scaleDraw->setLabelRotation( rotation );
     layoutScale();
 }
 
 /*!
-  Set a scale draw
-
-  scaleDraw has to be created with new and will be deleted in
-  ~QwtScaleWidget() or the next call of setScaleDraw().
-  scaleDraw will be initialized with the attributes of
-  the previous scaleDraw object.
-
-  \param scaleDraw ScaleDraw object
-  \sa scaleDraw()
-*/
-void QwtScaleWidget::setScaleDraw( QwtScaleDraw *scaleDraw )
-{
-    if ( ( scaleDraw == NULL ) || ( scaleDraw == d_data->scaleDraw ) )
+   Set a scale draw
+
+   scaleDraw has to be created with new and will be deleted in
+   ~QwtScaleWidget() or the next call of setScaleDraw().
+   scaleDraw will be initialized with the attributes of
+   the previous scaleDraw object.
+
+   \param scaleDraw ScaleDraw object
+   \sa scaleDraw()
+ */
+void QwtScaleWidget::setScaleDraw( QwtScaleDraw* scaleDraw )
+{
+    if ( ( scaleDraw == NULL ) || ( scaleDraw == m_data->scaleDraw ) )
         return;
 
-    const QwtScaleDraw* sd = d_data->scaleDraw;
+    const QwtScaleDraw* sd = m_data->scaleDraw;
     if ( sd )
     {
@@ -334,5 +335,5 @@
         scaleDraw->setScaleDiv( sd->scaleDiv() );
 
-        QwtTransform *transform = NULL;
+        QwtTransform* transform = NULL;
         if ( sd->scaleMap().transformation() )
             transform = sd->scaleMap().transformation()->copy();
@@ -341,6 +342,6 @@
     }
 
-    delete d_data->scaleDraw;
-    d_data->scaleDraw = scaleDraw;
+    delete m_data->scaleDraw;
+    m_data->scaleDraw = scaleDraw;
 
     layoutScale();
@@ -350,8 +351,8 @@
     \return scaleDraw of this scale
     \sa setScaleDraw(), QwtScaleDraw::setScaleDraw()
-*/
-const QwtScaleDraw *QwtScaleWidget::scaleDraw() const
-{
-    return d_data->scaleDraw;
+ */
+const QwtScaleDraw* QwtScaleWidget::scaleDraw() const
+{
+    return m_data->scaleDraw;
 }
 
@@ -359,8 +360,8 @@
     \return scaleDraw of this scale
     \sa QwtScaleDraw::setScaleDraw()
-*/
-QwtScaleDraw *QwtScaleWidget::scaleDraw()
-{
-    return d_data->scaleDraw;
+ */
+QwtScaleDraw* QwtScaleWidget::scaleDraw()
+{
+    return m_data->scaleDraw;
 }
 
@@ -368,8 +369,8 @@
     \return title
     \sa setTitle()
-*/
+ */
 QwtText QwtScaleWidget::title() const
 {
-    return d_data->title;
+    return m_data->title;
 }
 
@@ -377,8 +378,8 @@
     \return start border distance
     \sa setBorderDist()
-*/
+ */
 int QwtScaleWidget::startBorderDist() const
 {
-    return d_data->borderDist[0];
+    return m_data->borderDist[0];
 }
 
@@ -386,8 +387,8 @@
     \return end border distance
     \sa setBorderDist()
-*/
+ */
 int QwtScaleWidget::endBorderDist() const
 {
-    return d_data->borderDist[1];
+    return m_data->borderDist[1];
 }
 
@@ -395,8 +396,8 @@
     \return margin
     \sa setMargin()
-*/
+ */
 int QwtScaleWidget::margin() const
 {
-    return d_data->margin;
+    return m_data->margin;
 }
 
@@ -404,14 +405,14 @@
     \return distance between scale and title
     \sa setMargin()
-*/
+ */
 int QwtScaleWidget::spacing() const
 {
-    return d_data->spacing;
-}
-
-/*!
-  \brief paintEvent
-*/
-void QwtScaleWidget::paintEvent( QPaintEvent *event )
+    return m_data->spacing;
+}
+
+/*!
+   \brief paintEvent
+ */
+void QwtScaleWidget::paintEvent( QPaintEvent* event )
 {
     QPainter painter( this );
@@ -419,5 +420,5 @@
 
     QStyleOption opt;
-    opt.init(this);
+    opt.initFrom(this);
     style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
 
@@ -426,12 +427,12 @@
 
 /*!
-  \brief draw the scale
-*/
-void QwtScaleWidget::draw( QPainter *painter ) const
-{
-    d_data->scaleDraw->draw( painter, palette() );
-
-    if ( d_data->colorBar.isEnabled && d_data->colorBar.width > 0 &&
-        d_data->colorBar.interval.isValid() )
+   \brief draw the scale
+ */
+void QwtScaleWidget::draw( QPainter* painter ) const
+{
+    m_data->scaleDraw->draw( painter, palette() );
+
+    if ( m_data->colorBar.isEnabled && m_data->colorBar.width > 0 &&
+        m_data->colorBar.interval.isValid() )
     {
         drawColorBar( painter, colorBarRect( contentsRect() ) );
@@ -439,47 +440,47 @@
 
     QRect r = contentsRect();
-    if ( d_data->scaleDraw->orientation() == Qt::Horizontal )
-    {
-        r.setLeft( r.left() + d_data->borderDist[0] );
-        r.setWidth( r.width() - d_data->borderDist[1] );
+    if ( m_data->scaleDraw->orientation() == Qt::Horizontal )
+    {
+        r.setLeft( r.left() + m_data->borderDist[0] );
+        r.setWidth( r.width() - m_data->borderDist[1] );
     }
     else
     {
-        r.setTop( r.top() + d_data->borderDist[0] );
-        r.setHeight( r.height() - d_data->borderDist[1] );
-    }
-
-    if ( !d_data->title.isEmpty() )
-        drawTitle( painter, d_data->scaleDraw->alignment(), r );
-}
-
-/*!
-  Calculate the the rectangle for the color bar
-
-  \param rect Bounding rectangle for all components of the scale
-  \return Rectangle for the color bar
-*/
+        r.setTop( r.top() + m_data->borderDist[0] );
+        r.setHeight( r.height() - m_data->borderDist[1] );
+    }
+
+    if ( !m_data->title.isEmpty() )
+        drawTitle( painter, m_data->scaleDraw->alignment(), r );
+}
+
+/*!
+   Calculate the the rectangle for the color bar
+
+   \param rect Bounding rectangle for all components of the scale
+   \return Rectangle for the color bar
+ */
 QRectF QwtScaleWidget::colorBarRect( const QRectF& rect ) const
 {
     QRectF cr = rect;
 
-    if ( d_data->scaleDraw->orientation() == Qt::Horizontal )
-    {
-        cr.setLeft( cr.left() + d_data->borderDist[0] );
-        cr.setWidth( cr.width() - d_data->borderDist[1] + 1 );
+    if ( m_data->scaleDraw->orientation() == Qt::Horizontal )
+    {
+        cr.setLeft( cr.left() + m_data->borderDist[0] );
+        cr.setWidth( cr.width() - m_data->borderDist[1] + 1 );
     }
     else
     {
-        cr.setTop( cr.top() + d_data->borderDist[0] );
-        cr.setHeight( cr.height() - d_data->borderDist[1] + 1 );
-    }
-
-    switch ( d_data->scaleDraw->alignment() )
+        cr.setTop( cr.top() + m_data->borderDist[0] );
+        cr.setHeight( cr.height() - m_data->borderDist[1] + 1 );
+    }
+
+    switch ( m_data->scaleDraw->alignment() )
     {
         case QwtScaleDraw::LeftScale:
         {
-            cr.setLeft( cr.right() - d_data->margin
-                - d_data->colorBar.width );
-            cr.setWidth( d_data->colorBar.width );
+            cr.setLeft( cr.right() - m_data->margin
+                - m_data->colorBar.width );
+            cr.setWidth( m_data->colorBar.width );
             break;
         }
@@ -487,6 +488,6 @@
         case QwtScaleDraw::RightScale:
         {
-            cr.setLeft( cr.left() + d_data->margin );
-            cr.setWidth( d_data->colorBar.width );
+            cr.setLeft( cr.left() + m_data->margin );
+            cr.setWidth( m_data->colorBar.width );
             break;
         }
@@ -494,6 +495,6 @@
         case QwtScaleDraw::BottomScale:
         {
-            cr.setTop( cr.top() + d_data->margin );
-            cr.setHeight( d_data->colorBar.width );
+            cr.setTop( cr.top() + m_data->margin );
+            cr.setHeight( m_data->colorBar.width );
             break;
         }
@@ -501,7 +502,7 @@
         case QwtScaleDraw::TopScale:
         {
-            cr.setTop( cr.bottom() - d_data->margin
-                - d_data->colorBar.width );
-            cr.setHeight( d_data->colorBar.width );
+            cr.setTop( cr.bottom() - m_data->margin
+                - m_data->colorBar.width );
+            cr.setHeight( m_data->colorBar.width );
             break;
         }
@@ -512,8 +513,24 @@
 
 /*!
-  Event handler for resize events
-  \param event Resize event
-*/
-void QwtScaleWidget::resizeEvent( QResizeEvent *event )
+   Change Event handler
+   \param event Change event
+
+   Invalidates internal caches if necessary
+ */
+void QwtScaleWidget::changeEvent( QEvent* event )
+{
+    if ( event->type() == QEvent::LocaleChange )
+    {
+        m_data->scaleDraw->invalidateCache();
+    }
+
+    QWidget::changeEvent( event );
+}
+
+/*!
+   Event handler for resize events
+   \param event Resize event
+ */
+void QwtScaleWidget::resizeEvent( QResizeEvent* event )
 {
     Q_UNUSED( event );
@@ -522,10 +539,10 @@
 
 /*!
-  Recalculate the scale's geometry and layout based on
-  the current geometry and fonts.
-
-  \param update_geometry Notify the layout system and call update
+   Recalculate the scale's geometry and layout based on
+   the current geometry and fonts.
+
+   \param update_geometry Notify the layout system and call update
                          to redraw the scale
-*/
+ */
 
 void QwtScaleWidget::layoutScale( bool update_geometry )
@@ -533,25 +550,25 @@
     int bd0, bd1;
     getBorderDistHint( bd0, bd1 );
-    if ( d_data->borderDist[0] > bd0 )
-        bd0 = d_data->borderDist[0];
-    if ( d_data->borderDist[1] > bd1 )
-        bd1 = d_data->borderDist[1];
+    if ( m_data->borderDist[0] > bd0 )
+        bd0 = m_data->borderDist[0];
+    if ( m_data->borderDist[1] > bd1 )
+        bd1 = m_data->borderDist[1];
 
     int colorBarWidth = 0;
-    if ( d_data->colorBar.isEnabled && d_data->colorBar.interval.isValid() )
-        colorBarWidth = d_data->colorBar.width + d_data->spacing;
+    if ( m_data->colorBar.isEnabled && m_data->colorBar.interval.isValid() )
+        colorBarWidth = m_data->colorBar.width + m_data->spacing;
 
     const QRectF r = contentsRect();
     double x, y, length;
 
-    if ( d_data->scaleDraw->orientation() == Qt::Vertical )
+    if ( m_data->scaleDraw->orientation() == Qt::Vertical )
     {
         y = r.top() + bd0;
         length = r.height() - ( bd0 + bd1 );
 
-        if ( d_data->scaleDraw->alignment() == QwtScaleDraw::LeftScale )
-            x = r.right() - 1.0 - d_data->margin - colorBarWidth;
+        if ( m_data->scaleDraw->alignment() == QwtScaleDraw::LeftScale )
+            x = r.right() - 1.0 - m_data->margin - colorBarWidth;
         else
-            x = r.left() + d_data->margin + colorBarWidth;
+            x = r.left() + m_data->margin + colorBarWidth;
     }
     else
@@ -560,17 +577,17 @@
         length = r.width() - ( bd0 + bd1 );
 
-        if ( d_data->scaleDraw->alignment() == QwtScaleDraw::BottomScale )
-            y = r.top() + d_data->margin + colorBarWidth;
+        if ( m_data->scaleDraw->alignment() == QwtScaleDraw::BottomScale )
+            y = r.top() + m_data->margin + colorBarWidth;
         else
-            y = r.bottom() - 1.0 - d_data->margin - colorBarWidth;
-    }
-
-    d_data->scaleDraw->move( x, y );
-    d_data->scaleDraw->setLength( length );
-
-    const int extent = qCeil( d_data->scaleDraw->extent( font() ) );
-
-    d_data->titleOffset =
-        d_data->margin + d_data->spacing + colorBarWidth + extent;
+            y = r.bottom() - 1.0 - m_data->margin - colorBarWidth;
+    }
+
+    m_data->scaleDraw->move( x, y );
+    m_data->scaleDraw->setLength( length );
+
+    const int extent = qwtCeil( m_data->scaleDraw->extent( font() ) );
+
+    m_data->titleOffset =
+        m_data->margin + m_data->spacing + colorBarWidth + extent;
 
     if ( update_geometry )
@@ -599,37 +616,37 @@
 
 /*!
-  Draw the color bar of the scale widget
-
-  \param painter Painter
-  \param rect Bounding rectangle for the color bar
-
-  \sa setColorBarEnabled()
-*/
-void QwtScaleWidget::drawColorBar( QPainter *painter, const QRectF& rect ) const
-{
-    if ( !d_data->colorBar.interval.isValid() )
+   Draw the color bar of the scale widget
+
+   \param painter Painter
+   \param rect Bounding rectangle for the color bar
+
+   \sa setColorBarEnabled()
+ */
+void QwtScaleWidget::drawColorBar( QPainter* painter, const QRectF& rect ) const
+{
+    if ( !m_data->colorBar.interval.isValid() )
         return;
 
-    const QwtScaleDraw* sd = d_data->scaleDraw;
-
-    QwtPainter::drawColorBar( painter, *d_data->colorBar.colorMap,
-        d_data->colorBar.interval.normalized(), sd->scaleMap(),
+    const QwtScaleDraw* sd = m_data->scaleDraw;
+
+    QwtPainter::drawColorBar( painter, *m_data->colorBar.colorMap,
+        m_data->colorBar.interval.normalized(), sd->scaleMap(),
         sd->orientation(), rect );
 }
 
 /*!
-  Rotate and paint a title according to its position into a given rectangle.
-
-  \param painter Painter
-  \param align Alignment
-  \param rect Bounding rectangle
-*/
-
-void QwtScaleWidget::drawTitle( QPainter *painter,
-    QwtScaleDraw::Alignment align, const QRectF &rect ) const
+   Rotate and paint a title according to its position into a given rectangle.
+
+   \param painter Painter
+   \param align Alignment
+   \param rect Bounding rectangle
+ */
+
+void QwtScaleWidget::drawTitle( QPainter* painter,
+    QwtScaleDraw::Alignment align, const QRectF& rect ) const
 {
     QRectF r = rect;
     double angle;
-    int flags = d_data->title.renderFlags() &
+    int flags = m_data->title.renderFlags() &
         ~( Qt::AlignTop | Qt::AlignBottom | Qt::AlignVCenter );
 
@@ -640,5 +657,5 @@
             flags |= Qt::AlignTop;
             r.setRect( r.left(), r.bottom(),
-                r.height(), r.width() - d_data->titleOffset );
+                r.height(), r.width() - m_data->titleOffset );
             break;
 
@@ -646,6 +663,6 @@
             angle = -90.0;
             flags |= Qt::AlignTop;
-            r.setRect( r.left() + d_data->titleOffset, r.bottom(),
-                r.height(), r.width() - d_data->titleOffset );
+            r.setRect( r.left() + m_data->titleOffset, r.bottom(),
+                r.height(), r.width() - m_data->titleOffset );
             break;
 
@@ -653,5 +670,5 @@
             angle = 0.0;
             flags |= Qt::AlignBottom;
-            r.setTop( r.top() + d_data->titleOffset );
+            r.setTop( r.top() + m_data->titleOffset );
             break;
 
@@ -660,9 +677,9 @@
             angle = 0.0;
             flags |= Qt::AlignTop;
-            r.setBottom( r.bottom() - d_data->titleOffset );
+            r.setBottom( r.bottom() - m_data->titleOffset );
             break;
     }
 
-    if ( d_data->layoutFlags & TitleInverted )
+    if ( m_data->layoutFlags & TitleInverted )
     {
         if ( align == QwtScaleDraw::LeftScale
@@ -683,5 +700,5 @@
         painter->rotate( angle );
 
-    QwtText title = d_data->title;
+    QwtText title = m_data->title;
     title.setRenderFlags( flags );
     title.draw( painter, QRectF( 0.0, 0.0, r.width(), r.height() ) );
@@ -691,10 +708,10 @@
 
 /*!
-  \brief Notify a change of the scale
-
-  This virtual function can be overloaded by derived
-  classes. The default implementation updates the geometry
-  and repaints the widget.
-*/
+   \brief Notify a change of the scale
+
+   This virtual function can be overloaded by derived
+   classes. The default implementation updates the geometry
+   and repaints the widget.
+ */
 
 void QwtScaleWidget::scaleChange()
@@ -704,6 +721,6 @@
 
 /*!
-  \return a size hint
-*/
+   \return a size hint
+ */
 QSize QwtScaleWidget::sizeHint() const
 {
@@ -712,9 +729,9 @@
 
 /*!
-  \return a minimum size hint
-*/
+   \return a minimum size hint
+ */
 QSize QwtScaleWidget::minimumSizeHint() const
 {
-    const Qt::Orientation o = d_data->scaleDraw->orientation();
+    const Qt::Orientation o = m_data->scaleDraw->orientation();
 
     // Border Distance cannot be less than the scale borderDistHint
@@ -723,7 +740,7 @@
     int mbd1, mbd2;
     getBorderDistHint( mbd1, mbd2 );
-    length += qMax( 0, d_data->borderDist[0] - mbd1 );
-    length += qMax( 0, d_data->borderDist[1] - mbd2 );
-    length += d_data->scaleDraw->minLength( font() );
+    length += qMax( 0, m_data->borderDist[0] - mbd1 );
+    length += qMax( 0, m_data->borderDist[1] - mbd2 );
+    length += m_data->scaleDraw->minLength( font() );
 
     int dim = dimForLength( length, font() );
@@ -739,40 +756,39 @@
         size.transpose();
 
-    int left, right, top, bottom;
-    getContentsMargins( &left, &top, &right, &bottom );
-    return size + QSize( left + right, top + bottom );
-}
-
-/*!
-  \brief Find the height of the title for a given width.
-  \param width Width
-  \return height Height
+    const QMargins m = contentsMargins();
+    return size + QSize( m.left() + m.right(), m.top() + m.bottom() );
+}
+
+/*!
+   \brief Find the height of the title for a given width.
+   \param width Width
+   \return height Height
  */
 
 int QwtScaleWidget::titleHeightForWidth( int width ) const
 {
-    return qCeil( d_data->title.heightForWidth( width, font() ) );
-}
-
-/*!
-  \brief Find the minimum dimension for a given length.
+    return qwtCeil( m_data->title.heightForWidth( width, font() ) );
+}
+
+/*!
+   \brief Find the minimum dimension for a given length.
          dim is the height, length the width seen in
          direction of the title.
-  \param length width for horizontal, height for vertical scales
-  \param scaleFont Font of the scale
-  \return height for horizontal, width for vertical scales
-*/
-
-int QwtScaleWidget::dimForLength( int length, const QFont &scaleFont ) const
-{
-    const int extent = qCeil( d_data->scaleDraw->extent( scaleFont ) );
-
-    int dim = d_data->margin + extent + 1;
-
-    if ( !d_data->title.isEmpty() )
-        dim += titleHeightForWidth( length ) + d_data->spacing;
-
-    if ( d_data->colorBar.isEnabled && d_data->colorBar.interval.isValid() )
-        dim += d_data->colorBar.width + d_data->spacing;
+   \param length width for horizontal, height for vertical scales
+   \param scaleFont Font of the scale
+   \return height for horizontal, width for vertical scales
+ */
+
+int QwtScaleWidget::dimForLength( int length, const QFont& scaleFont ) const
+{
+    const int extent = qwtCeil( m_data->scaleDraw->extent( scaleFont ) );
+
+    int dim = m_data->margin + extent + 1;
+
+    if ( !m_data->title.isEmpty() )
+        dim += titleHeightForWidth( length ) + m_data->spacing;
+
+    if ( m_data->colorBar.isEnabled && m_data->colorBar.interval.isValid() )
+        dim += m_data->colorBar.width + m_data->spacing;
 
     return dim;
@@ -780,76 +796,76 @@
 
 /*!
-  \brief Calculate a hint for the border distances.
-
-  This member function calculates the distance
-  of the scale's endpoints from the widget borders which
-  is required for the mark labels to fit into the widget.
-  The maximum of this distance an the minimum border distance
-  is returned.
-
-  \param start Return parameter for the border width at
+   \brief Calculate a hint for the border distances.
+
+   This member function calculates the distance
+   of the scale's endpoints from the widget borders which
+   is required for the mark labels to fit into the widget.
+   The maximum of this distance an the minimum border distance
+   is returned.
+
+   \param start Return parameter for the border width at
                the beginning of the scale
-  \param end Return parameter for the border width at the
+   \param end Return parameter for the border width at the
              end of the scale
 
-  \warning
-  <ul> <li>The minimum border distance depends on the font.</ul>
-  \sa setMinBorderDist(), getMinBorderDist(), setBorderDist()
-*/
-void QwtScaleWidget::getBorderDistHint( int &start, int &end ) const
-{
-    d_data->scaleDraw->getBorderDistHint( font(), start, end );
-
-    if ( start < d_data->minBorderDist[0] )
-        start = d_data->minBorderDist[0];
-
-    if ( end < d_data->minBorderDist[1] )
-        end = d_data->minBorderDist[1];
-}
-
-/*!
-  Set a minimum value for the distances of the scale's endpoints from
-  the widget borders. This is useful to avoid that the scales
-  are "jumping", when the tick labels or their positions change
-  often.
-
-  \param start Minimum for the start border
-  \param end Minimum for the end border
-  \sa getMinBorderDist(), getBorderDistHint()
-*/
+   \warning
+   <ul> <li>The minimum border distance depends on the font.</ul>
+   \sa setMinBorderDist(), getMinBorderDist(), setBorderDist()
+ */
+void QwtScaleWidget::getBorderDistHint( int& start, int& end ) const
+{
+    m_data->scaleDraw->getBorderDistHint( font(), start, end );
+
+    if ( start < m_data->minBorderDist[0] )
+        start = m_data->minBorderDist[0];
+
+    if ( end < m_data->minBorderDist[1] )
+        end = m_data->minBorderDist[1];
+}
+
+/*!
+   Set a minimum value for the distances of the scale's endpoints from
+   the widget borders. This is useful to avoid that the scales
+   are "jumping", when the tick labels or their positions change
+   often.
+
+   \param start Minimum for the start border
+   \param end Minimum for the end border
+   \sa getMinBorderDist(), getBorderDistHint()
+ */
 void QwtScaleWidget::setMinBorderDist( int start, int end )
 {
-    d_data->minBorderDist[0] = start;
-    d_data->minBorderDist[1] = end;
-}
-
-/*!
-  Get the minimum value for the distances of the scale's endpoints from
-  the widget borders.
-
-  \param start Return parameter for the border width at
+    m_data->minBorderDist[0] = start;
+    m_data->minBorderDist[1] = end;
+}
+
+/*!
+   Get the minimum value for the distances of the scale's endpoints from
+   the widget borders.
+
+   \param start Return parameter for the border width at
                the beginning of the scale
-  \param end Return parameter for the border width at the
+   \param end Return parameter for the border width at the
              end of the scale
 
-  \sa setMinBorderDist(), getBorderDistHint()
-*/
-void QwtScaleWidget::getMinBorderDist( int &start, int &end ) const
-{
-    start = d_data->minBorderDist[0];
-    end = d_data->minBorderDist[1];
-}
-
-/*!
-  \brief Assign a scale division
-
-  The scale division determines where to set the tick marks.
-
-  \param scaleDiv Scale Division
-  \sa For more information about scale divisions, see QwtScaleDiv.
-*/
-void QwtScaleWidget::setScaleDiv( const QwtScaleDiv &scaleDiv )
-{
-    QwtScaleDraw *sd = d_data->scaleDraw;
+   \sa setMinBorderDist(), getBorderDistHint()
+ */
+void QwtScaleWidget::getMinBorderDist( int& start, int& end ) const
+{
+    start = m_data->minBorderDist[0];
+    end = m_data->minBorderDist[1];
+}
+
+/*!
+   \brief Assign a scale division
+
+   The scale division determines where to set the tick marks.
+
+   \param scaleDiv Scale Division
+   \sa For more information about scale divisions, see QwtScaleDiv.
+ */
+void QwtScaleWidget::setScaleDiv( const QwtScaleDiv& scaleDiv )
+{
+    QwtScaleDraw* sd = m_data->scaleDraw;
     if ( sd->scaleDiv() != scaleDiv )
     {
@@ -862,24 +878,24 @@
 
 /*!
-  Set the transformation
-
-  \param transformation Transformation
-  \sa QwtAbstractScaleDraw::scaleDraw(), QwtScaleMap
- */
-void QwtScaleWidget::setTransformation( QwtTransform *transformation )
-{
-    d_data->scaleDraw->setTransformation( transformation );
+   Set the transformation
+
+   \param transformation Transformation
+   \sa QwtAbstractScaleDraw::scaleDraw(), QwtScaleMap
+ */
+void QwtScaleWidget::setTransformation( QwtTransform* transformation )
+{
+    m_data->scaleDraw->setTransformation( transformation );
     layoutScale();
 }
 
 /*!
-  En/disable a color bar associated to the scale
-  \sa isColorBarEnabled(), setColorBarWidth()
-*/
+   En/disable a color bar associated to the scale
+   \sa isColorBarEnabled(), setColorBarWidth()
+ */
 void QwtScaleWidget::setColorBarEnabled( bool on )
 {
-    if ( on != d_data->colorBar.isEnabled )
-    {
-        d_data->colorBar.isEnabled = on;
+    if ( on != m_data->colorBar.isEnabled )
+    {
+        m_data->colorBar.isEnabled = on;
         layoutScale();
     }
@@ -887,23 +903,23 @@
 
 /*!
-  \return true, when the color bar is enabled
-  \sa setColorBarEnabled(), setColorBarWidth()
-*/
+   \return true, when the color bar is enabled
+   \sa setColorBarEnabled(), setColorBarWidth()
+ */
 bool QwtScaleWidget::isColorBarEnabled() const
 {
-    return d_data->colorBar.isEnabled;
-}
-
-/*!
-  Set the width of the color bar
-
-  \param width Width
-  \sa colorBarWidth(), setColorBarEnabled()
-*/
+    return m_data->colorBar.isEnabled;
+}
+
+/*!
+   Set the width of the color bar
+
+   \param width Width
+   \sa colorBarWidth(), setColorBarEnabled()
+ */
 void QwtScaleWidget::setColorBarWidth( int width )
 {
-    if ( width != d_data->colorBar.width )
-    {
-        d_data->colorBar.width = width;
+    if ( width != m_data->colorBar.width )
+    {
+        m_data->colorBar.width = width;
         if ( isColorBarEnabled() )
             layoutScale();
@@ -912,39 +928,39 @@
 
 /*!
-  \return Width of the color bar
-  \sa setColorBarEnabled(), setColorBarEnabled()
-*/
+   \return Width of the color bar
+   \sa setColorBarEnabled(), setColorBarEnabled()
+ */
 int QwtScaleWidget::colorBarWidth() const
 {
-    return d_data->colorBar.width;
-}
-
-/*!
-  \return Value interval for the color bar
-  \sa setColorMap(), colorMap()
-*/
+    return m_data->colorBar.width;
+}
+
+/*!
+   \return Value interval for the color bar
+   \sa setColorMap(), colorMap()
+ */
 QwtInterval QwtScaleWidget::colorBarInterval() const
 {
-    return d_data->colorBar.interval;
-}
-
-/*!
-  Set the color map and value interval, that are used for displaying
-  the color bar.
-
-  \param interval Value interval
-  \param colorMap Color map
-
-  \sa colorMap(), colorBarInterval()
-*/
+    return m_data->colorBar.interval;
+}
+
+/*!
+   Set the color map and value interval, that are used for displaying
+   the color bar.
+
+   \param interval Value interval
+   \param colorMap Color map
+
+   \sa colorMap(), colorBarInterval()
+ */
 void QwtScaleWidget::setColorMap(
-    const QwtInterval &interval, QwtColorMap *colorMap )
-{
-    d_data->colorBar.interval = interval;
-
-    if ( colorMap != d_data->colorBar.colorMap )
-    {
-        delete d_data->colorBar.colorMap;
-        d_data->colorBar.colorMap = colorMap;
+    const QwtInterval& interval, QwtColorMap* colorMap )
+{
+    m_data->colorBar.interval = interval;
+
+    if ( colorMap != m_data->colorBar.colorMap )
+    {
+        delete m_data->colorBar.colorMap;
+        m_data->colorBar.colorMap = colorMap;
     }
 
@@ -954,9 +970,11 @@
 
 /*!
-  \return Color map
-  \sa setColorMap(), colorBarInterval()
-*/
-const QwtColorMap *QwtScaleWidget::colorMap() const
-{
-    return d_data->colorBar.colorMap;
-}
+   \return Color map
+   \sa setColorMap(), colorBarInterval()
+ */
+const QwtColorMap* QwtScaleWidget::colorMap() const
+{
+    return m_data->colorBar.colorMap;
+}
+
+#include "moc_qwt_scale_widget.cpp"
Index: /trunk/BNC/qwt/qwt_scale_widget.h
===================================================================
--- /trunk/BNC/qwt/qwt_scale_widget.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_scale_widget.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -14,4 +14,5 @@
 #include "qwt_text.h"
 #include "qwt_scale_draw.h"
+
 #include <qwidget.h>
 #include <qfont.h>
@@ -25,9 +26,9 @@
 
 /*!
-  \brief A Widget which contains a scale
+   \brief A Widget which contains a scale
 
-  This Widget can be used to decorate composite widgets with
-  a scale.
-*/
+   This Widget can be used to decorate composite widgets with
+   a scale.
+ */
 
 class QWT_EXPORT QwtScaleWidget : public QWidget
@@ -35,29 +36,28 @@
     Q_OBJECT
 
-public:
+  public:
     //! Layout flags of the title
     enum LayoutFlag
     {
         /*!
-          The title of vertical scales is painted from top to bottom.
-          Otherwise it is painted from bottom to top.
+           The title of vertical scales is painted from top to bottom.
+           Otherwise it is painted from bottom to top.
          */
         TitleInverted = 1
     };
 
-    //! Layout flags of the title
-    typedef QFlags<LayoutFlag> LayoutFlags;
+    Q_DECLARE_FLAGS( LayoutFlags, LayoutFlag )
 
-    explicit QwtScaleWidget( QWidget *parent = NULL );
-    explicit QwtScaleWidget( QwtScaleDraw::Alignment, QWidget *parent = NULL );
+    explicit QwtScaleWidget( QWidget* parent = NULL );
+    explicit QwtScaleWidget( QwtScaleDraw::Alignment, QWidget* parent = NULL );
     virtual ~QwtScaleWidget();
 
-Q_SIGNALS:
+  Q_SIGNALS:
     //! Signal emitted, whenever the scale division changes
     void scaleDivChanged();
 
-public:
-    void setTitle( const QString &title );
-    void setTitle( const QwtText &title );
+  public:
+    void setTitle( const QString& title );
+    void setTitle( const QwtText& title );
     QwtText title() const;
 
@@ -69,7 +69,7 @@
     int endBorderDist() const;
 
-    void getBorderDistHint( int &start, int &end ) const;
+    void getBorderDistHint( int& start, int& end ) const;
 
-    void getMinBorderDist( int &start, int &end ) const;
+    void getMinBorderDist( int& start, int& end ) const;
     void setMinBorderDist( int start, int end );
 
@@ -80,10 +80,10 @@
     int spacing() const;
 
-    void setScaleDiv( const QwtScaleDiv & );
-    void setTransformation( QwtTransform * );
+    void setScaleDiv( const QwtScaleDiv& );
+    void setTransformation( QwtTransform* );
 
-    void setScaleDraw( QwtScaleDraw * );
-    const QwtScaleDraw *scaleDraw() const;
-    QwtScaleDraw *scaleDraw();
+    void setScaleDraw( QwtScaleDraw* );
+    const QwtScaleDraw* scaleDraw() const;
+    QwtScaleDraw* scaleDraw();
 
     void setLabelAlignment( Qt::Alignment );
@@ -96,18 +96,18 @@
     int colorBarWidth() const;
 
-    void setColorMap( const QwtInterval &, QwtColorMap * );
+    void setColorMap( const QwtInterval&, QwtColorMap* );
 
     QwtInterval colorBarInterval() const;
-    const QwtColorMap *colorMap() const;
+    const QwtColorMap* colorMap() const;
 
-    virtual QSize sizeHint() const;
-    virtual QSize minimumSizeHint() const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
+    virtual QSize minimumSizeHint() const QWT_OVERRIDE;
 
     int titleHeightForWidth( int width ) const;
-    int dimForLength( int length, const QFont &scaleFont ) const;
+    int dimForLength( int length, const QFont& scaleFont ) const;
 
-    void drawColorBar( QPainter *painter, const QRectF & ) const;
-    void drawTitle( QPainter *painter, QwtScaleDraw::Alignment,
-        const QRectF &rect ) const;
+    void drawColorBar( QPainter*, const QRectF& ) const;
+    void drawTitle( QPainter*, QwtScaleDraw::Alignment,
+        const QRectF& rect ) const;
 
     void setAlignment( QwtScaleDraw::Alignment );
@@ -116,18 +116,19 @@
     QRectF colorBarRect( const QRectF& ) const;
 
-protected:
-    virtual void paintEvent( QPaintEvent * );
-    virtual void resizeEvent( QResizeEvent * );
+  protected:
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
+    virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
+    virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
 
-    void draw( QPainter * ) const;
+    void draw( QPainter* ) const;
 
     void scaleChange();
     void layoutScale( bool update_geometry = true );
 
-private:
+  private:
     void initScale( QwtScaleDraw::Alignment );
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_series_data.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_series_data.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_series_data.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,22 +9,22 @@
 
 #include "qwt_series_data.h"
-#include "qwt_math.h"
-
-static inline QRectF qwtBoundingRect( const QPointF &sample )
+#include "qwt_point_polar.h"
+
+static inline QRectF qwtBoundingRect( const QPointF& sample )
 {
     return QRectF( sample.x(), sample.y(), 0.0, 0.0 );
 }
 
-static inline QRectF qwtBoundingRect( const QwtPoint3D &sample )
+static inline QRectF qwtBoundingRect( const QwtPoint3D& sample )
 {
     return QRectF( sample.x(), sample.y(), 0.0, 0.0 );
 }
 
-static inline QRectF qwtBoundingRect( const QwtPointPolar &sample )
+static inline QRectF qwtBoundingRect( const QwtPointPolar& sample )
 {
     return QRectF( sample.azimuth(), sample.radius(), 0.0, 0.0 );
 }
 
-static inline QRectF qwtBoundingRect( const QwtIntervalSample &sample )
+static inline QRectF qwtBoundingRect( const QwtIntervalSample& sample )
 {
     return QRectF( sample.interval.minValue(), sample.value,
@@ -32,5 +32,5 @@
 }
 
-static inline QRectF qwtBoundingRect( const QwtSetSample &sample )
+static inline QRectF qwtBoundingRect( const QwtSetSample& sample )
 {
     if ( sample.set.empty() )
@@ -52,5 +52,5 @@
 }
 
-static inline QRectF qwtBoundingRect( const QwtOHLCSample &sample )
+static inline QRectF qwtBoundingRect( const QwtOHLCSample& sample )
 {
     const QwtInterval interval = sample.boundingInterval();
@@ -58,19 +58,30 @@
 }
 
-/*!
-  \brief Calculate the bounding rectangle of a series subset
-
-  Slow implementation, that iterates over the series.
-
-  \param series Series
-  \param from Index of the first sample, <= 0 means from the beginning
-  \param to Index of the last sample, < 0 means to the end
-
-  \return Bounding rectangle
-*/
-
-template <class T>
-QRectF qwtBoundingRectT(
-    const QwtSeriesData<T>& series, int from, int to )
+static inline QRectF qwtBoundingRect( const QwtVectorFieldSample& sample )
+{
+    /*
+        When displaying a sample as an arrow its length will be
+        proportional to the magnitude - but not the same.
+        As the factor between length and magnitude is not known
+        we can't include vx/vy into the bounding rectangle.
+     */
+
+    return QRectF( sample.x, sample.y, 0, 0 );
+}
+
+/*!
+   \brief Calculate the bounding rectangle of a series subset
+
+   Slow implementation, that iterates over the series.
+
+   \param series Series
+   \param from Index of the first sample, <= 0 means from the beginning
+   \param to Index of the last sample, < 0 means to the end
+
+   \return Bounding rectangle
+ */
+
+template< class T >
+QRectF qwtBoundingRectT( const QwtSeriesData< T >& series, int from, int to )
 {
     QRectF boundingRect( 1.0, 1.0, -2.0, -2.0 ); // invalid;
@@ -113,235 +124,121 @@
 
 /*!
-  \brief Calculate the bounding rectangle of a series subset
-
-  Slow implementation, that iterates over the series.
-
-  \param series Series
-  \param from Index of the first sample, <= 0 means from the beginning
-  \param to Index of the last sample, < 0 means to the end
-
-  \return Bounding rectangle
-*/
-QRectF qwtBoundingRect(
-    const QwtSeriesData<QPointF> &series, int from, int to )
-{
-    return qwtBoundingRectT<QPointF>( series, from, to );
-}
-
-/*!
-  \brief Calculate the bounding rectangle of a series subset
-
-  Slow implementation, that iterates over the series.
-
-  \param series Series
-  \param from Index of the first sample, <= 0 means from the beginning
-  \param to Index of the last sample, < 0 means to the end
-
-  \return Bounding rectangle
-*/
-QRectF qwtBoundingRect(
-    const QwtSeriesData<QwtPoint3D> &series, int from, int to )
-{
-    return qwtBoundingRectT<QwtPoint3D>( series, from, to );
-}
-
-/*!
-  \brief Calculate the bounding rectangle of a series subset
-
-  The horizontal coordinates represent the azimuth, the
-  vertical coordinates the radius.
-
-  Slow implementation, that iterates over the series.
-
-  \param series Series
-  \param from Index of the first sample, <= 0 means from the beginning
-  \param to Index of the last sample, < 0 means to the end
-
-  \return Bounding rectangle
-*/
-QRectF qwtBoundingRect(
-    const QwtSeriesData<QwtPointPolar> &series, int from, int to )
-{
-    return qwtBoundingRectT<QwtPointPolar>( series, from, to );
-}
-
-/*!
-  \brief Calculate the bounding rectangle of a series subset
-
-  Slow implementation, that iterates over the series.
-
-  \param series Series
-  \param from Index of the first sample, <= 0 means from the beginning
-  \param to Index of the last sample, < 0 means to the end
-
-  \return Bounding rectangle
-*/
-QRectF qwtBoundingRect(
-    const QwtSeriesData<QwtIntervalSample>& series, int from, int to )
-{
-    return qwtBoundingRectT<QwtIntervalSample>( series, from, to );
-}
-
-/*!
-  \brief Calculate the bounding rectangle of a series subset
-
-  Slow implementation, that iterates over the series.
-
-  \param series Series
-  \param from Index of the first sample, <= 0 means from the beginning
-  \param to Index of the last sample, < 0 means to the end
-
-  \return Bounding rectangle
-*/
-QRectF qwtBoundingRect(
-    const QwtSeriesData<QwtOHLCSample>& series, int from, int to )
-{
-    return qwtBoundingRectT<QwtOHLCSample>( series, from, to );
-}
-
-/*!
-  \brief Calculate the bounding rectangle of a series subset
-
-  Slow implementation, that iterates over the series.
-
-  \param series Series
-  \param from Index of the first sample, <= 0 means from the beginning
-  \param to Index of the last sample, < 0 means to the end
-
-  \return Bounding rectangle
-*/
-QRectF qwtBoundingRect(
-    const QwtSeriesData<QwtSetSample>& series, int from, int to )
-{
-    return qwtBoundingRectT<QwtSetSample>( series, from, to );
-}
-
-/*!
-   Constructor
-   \param samples Samples
-*/
-QwtPointSeriesData::QwtPointSeriesData(
-        const QVector<QPointF> &samples ):
-    QwtArraySeriesData<QPointF>( samples )
-{
-}
-
-/*!
-  \brief Calculate the bounding rectangle
-
-  The bounding rectangle is calculated once by iterating over all
-  points and is stored for all following requests.
-
-  \return Bounding rectangle
-*/
-QRectF QwtPointSeriesData::boundingRect() const
-{
-    if ( d_boundingRect.width() < 0.0 )
-        d_boundingRect = qwtBoundingRect( *this );
-
-    return d_boundingRect;
-}
-
-/*!
-   Constructor
-   \param samples Samples
-*/
-QwtPoint3DSeriesData::QwtPoint3DSeriesData(
-        const QVector<QwtPoint3D> &samples ):
-    QwtArraySeriesData<QwtPoint3D>( samples )
-{
-}
-
-/*!
-  \brief Calculate the bounding rectangle
-
-  The bounding rectangle is calculated once by iterating over all
-  points and is stored for all following requests.
-
-  \return Bounding rectangle
-*/
-QRectF QwtPoint3DSeriesData::boundingRect() const
-{
-    if ( d_boundingRect.width() < 0.0 )
-        d_boundingRect = qwtBoundingRect( *this );
-
-    return d_boundingRect;
-}
-
-/*!
-   Constructor
-   \param samples Samples
-*/
-QwtIntervalSeriesData::QwtIntervalSeriesData(
-        const QVector<QwtIntervalSample> &samples ):
-    QwtArraySeriesData<QwtIntervalSample>( samples )
-{
-}
-
-/*!
-  \brief Calculate the bounding rectangle
-
-  The bounding rectangle is calculated once by iterating over all
-  points and is stored for all following requests.
-
-  \return Bounding rectangle
-*/
-QRectF QwtIntervalSeriesData::boundingRect() const
-{
-    if ( d_boundingRect.width() < 0.0 )
-        d_boundingRect = qwtBoundingRect( *this );
-
-    return d_boundingRect;
-}
-
-/*!
-   Constructor
-   \param samples Samples
-*/
-QwtSetSeriesData::QwtSetSeriesData(
-        const QVector<QwtSetSample> &samples ):
-    QwtArraySeriesData<QwtSetSample>( samples )
-{
-}
-
-/*!
-  \brief Calculate the bounding rectangle
-
-  The bounding rectangle is calculated once by iterating over all
-  points and is stored for all following requests.
-
-  \return Bounding rectangle
-*/
-QRectF QwtSetSeriesData::boundingRect() const
-{
-    if ( d_boundingRect.width() < 0.0 )
-        d_boundingRect = qwtBoundingRect( *this );
-
-    return d_boundingRect;
-}
-
-/*!
-   Constructor
-   \param samples Samples
-*/
-QwtTradingChartData::QwtTradingChartData(
-        const QVector<QwtOHLCSample> &samples ):
-    QwtArraySeriesData<QwtOHLCSample>( samples )
-{
-}
-
-/*!
-  \brief Calculate the bounding rectangle
-
-  The bounding rectangle is calculated once by iterating over all
-  points and is stored for all following requests.
-
-  \return Bounding rectangle
-*/
-QRectF QwtTradingChartData::boundingRect() const
-{
-    if ( d_boundingRect.width() < 0.0 )
-        d_boundingRect = qwtBoundingRect( *this );
-
-    return d_boundingRect;
-}
+   \brief Calculate the bounding rectangle of a series subset
+
+   Slow implementation, that iterates over the series.
+
+   \param series Series
+   \param from Index of the first sample, <= 0 means from the beginning
+   \param to Index of the last sample, < 0 means to the end
+
+   \return Bounding rectangle
+ */
+QRectF qwtBoundingRect( const QwtSeriesData< QPointF >& series, int from, int to )
+{
+    return qwtBoundingRectT< QPointF >( series, from, to );
+}
+
+/*!
+   \brief Calculate the bounding rectangle of a series subset
+
+   Slow implementation, that iterates over the series.
+
+   \param series Series
+   \param from Index of the first sample, <= 0 means from the beginning
+   \param to Index of the last sample, < 0 means to the end
+
+   \return Bounding rectangle
+ */
+QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtPoint3D >& series, int from, int to )
+{
+    return qwtBoundingRectT< QwtPoint3D >( series, from, to );
+}
+
+/*!
+   \brief Calculate the bounding rectangle of a series subset
+
+   The horizontal coordinates represent the azimuth, the
+   vertical coordinates the radius.
+
+   Slow implementation, that iterates over the series.
+
+   \param series Series
+   \param from Index of the first sample, <= 0 means from the beginning
+   \param to Index of the last sample, < 0 means to the end
+
+   \return Bounding rectangle
+ */
+QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtPointPolar >& series, int from, int to )
+{
+    return qwtBoundingRectT< QwtPointPolar >( series, from, to );
+}
+
+/*!
+   \brief Calculate the bounding rectangle of a series subset
+
+   Slow implementation, that iterates over the series.
+
+   \param series Series
+   \param from Index of the first sample, <= 0 means from the beginning
+   \param to Index of the last sample, < 0 means to the end
+
+   \return Bounding rectangle
+ */
+QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtIntervalSample >& series, int from, int to )
+{
+    return qwtBoundingRectT< QwtIntervalSample >( series, from, to );
+}
+
+/*!
+   \brief Calculate the bounding rectangle of a series subset
+
+   Slow implementation, that iterates over the series.
+
+   \param series Series
+   \param from Index of the first sample, <= 0 means from the beginning
+   \param to Index of the last sample, < 0 means to the end
+
+   \return Bounding rectangle
+ */
+QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtOHLCSample >& series, int from, int to )
+{
+    return qwtBoundingRectT< QwtOHLCSample >( series, from, to );
+}
+
+/*!
+   \brief Calculate the bounding rectangle of a series subset
+
+   Slow implementation, that iterates over the series.
+
+   \param series Series
+   \param from Index of the first sample, <= 0 means from the beginning
+   \param to Index of the last sample, < 0 means to the end
+
+   \return Bounding rectangle
+ */
+QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtSetSample >& series, int from, int to )
+{
+    return qwtBoundingRectT< QwtSetSample >( series, from, to );
+}
+
+/*!
+   \brief Calculate the bounding rectangle of a series subset
+
+   Slow implementation, that iterates over the series.
+
+   \param series Series
+   \param from Index of the first sample, <= 0 means from the beginning
+   \param to Index of the last sample, < 0 means to the end
+
+   \return Bounding rectangle
+ */
+QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtVectorFieldSample >& series, int from, int to )
+{
+    return qwtBoundingRectT< QwtVectorFieldSample >( series, from, to );
+}
Index: /trunk/BNC/qwt/qwt_series_data.h
===================================================================
--- /trunk/BNC/qwt/qwt_series_data.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_series_data.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,12 +9,14 @@
 
 #ifndef QWT_SERIES_DATA_H
-#define QWT_SERIES_DATA_H 1
+#define QWT_SERIES_DATA_H
 
 #include "qwt_global.h"
 #include "qwt_samples.h"
 #include "qwt_point_3d.h"
-#include "qwt_point_polar.h"
+
 #include <qvector.h>
 #include <qrect.h>
+
+class QwtPointPolar;
 
 /*!
@@ -41,11 +43,11 @@
      but often it is possible to implement a more efficient algorithm
      depending on the characteristics of the series.
-     The member d_boundingRect is intended for caching the calculated rectangle.
-
-*/
-template <typename T>
+     The member cachedBoundingRect is intended for caching the calculated rectangle.
+
+ */
+template< typename T >
 class QwtSeriesData
 {
-public:
+  public:
     //! Constructor
     QwtSeriesData();
@@ -60,23 +62,9 @@
 
     /*!
-      Return a sample
-      \param i Index
-      \return Sample at position i
+       Return a sample
+       \param i Index
+       \return Sample at position i
      */
     virtual T sample( size_t i ) const = 0;
-
-    /*!
-       Calculate the bounding rect of all samples
-
-       The bounding rect is necessary for autoscaling and can be used
-       for a couple of painting optimizations.
-
-       qwtBoundingRect(...) offers slow implementations iterating
-       over the samples. For large sets it is recommended to implement
-       something faster f.e. by caching the bounding rectangle.
-
-       \return Bounding rectangle
-     */
-    virtual QRectF boundingRect() const = 0;
 
 #else
@@ -84,6 +72,37 @@
     virtual size_t size() const { return 0; }
     virtual T sample( size_t i ) const { return T(); }
-    virtual QRectF boundingRect() const { return d_boundingRect; }
 #endif
+
+    /*!
+        Returns the first sample in the list.
+        \warning This function assumes that the list isn't empty.
+     */
+    inline T firstSample() const { return sample( 0 ); }
+
+    /*!
+        Returns the first sample in the list.
+        \warning This function assumes that the list isn't empty.
+     */
+    inline T lastSample() const { return sample( size() - 1 ); }
+
+    /*!
+       Calculate the bounding rect of all samples
+
+       The bounding rect is necessary for autoscaling and can be used
+       for a couple of painting optimizations.
+
+       qwtBoundingRect(...) offers slow implementations iterating
+       over the samples. For large sets it is recommended to implement
+       something faster.
+
+       \return Bounding rectangle
+     */
+     virtual QRectF boundingRect() const
+     {
+        if ( cachedBoundingRect.width() < 0.0 )
+            cachedBoundingRect = qwtBoundingRect( *this );
+
+        return cachedBoundingRect;
+     }
 
     /*!
@@ -97,41 +116,41 @@
 
        \param rect Rectangle of interest
-    */
-    virtual void setRectOfInterest( const QRectF &rect );
-
-protected:
+     */
+    virtual void setRectOfInterest( const QRectF& rect );
+
+  protected:
     //! Can be used to cache a calculated bounding rectangle
-    mutable QRectF d_boundingRect;
-
-private:
-    QwtSeriesData<T> &operator=( const QwtSeriesData<T> & );
+    mutable QRectF cachedBoundingRect;
+
+  private:
+    QwtSeriesData< T >& operator=( const QwtSeriesData< T >& );
 };
 
-template <typename T>
-QwtSeriesData<T>::QwtSeriesData():
-    d_boundingRect( 0.0, 0.0, -1.0, -1.0 )
-{
-}
-
-template <typename T>
-QwtSeriesData<T>::~QwtSeriesData()
-{
-}
-
-template <typename T>
-void QwtSeriesData<T>::setRectOfInterest( const QRectF & )
+template< typename T >
+QwtSeriesData< T >::QwtSeriesData()
+    : cachedBoundingRect( 0.0, 0.0, -1.0, -1.0 )
+{
+}
+
+template< typename T >
+QwtSeriesData< T >::~QwtSeriesData()
+{
+}
+
+template< typename T >
+void QwtSeriesData< T >::setRectOfInterest( const QRectF& )
 {
 }
 
 /*!
-  \brief Template class for data, that is organized as QVector
-
-  QVector uses implicit data sharing and can be
-  passed around as argument efficiently.
-*/
-template <typename T>
-class QwtArraySeriesData: public QwtSeriesData<T>
-{
-public:
+   \brief Template class for data, that is organized as QVector
+
+   QVector uses implicit data sharing and can be
+   passed around as argument efficiently.
+ */
+template< typename T >
+class QwtArraySeriesData : public QwtSeriesData< T >
+{
+  public:
     //! Constructor
     QwtArraySeriesData();
@@ -140,136 +159,106 @@
        Constructor
        \param samples Array of samples
-    */
-    QwtArraySeriesData( const QVector<T> &samples );
-
-    /*!
-      Assign an array of samples
-      \param samples Array of samples
-    */
-    void setSamples( const QVector<T> &samples );
+     */
+    explicit QwtArraySeriesData( const QVector< T >& samples );
+
+    /*!
+       Assign an array of samples
+       \param samples Array of samples
+     */
+    void setSamples( const QVector< T >& samples );
 
     //! \return Array of samples
-    const QVector<T> samples() const;
+    const QVector< T > samples() const;
 
     //! \return Number of samples
-    virtual size_t size() const;
-
-    /*!
-      \return Sample at a specific position
-
-      \param index Index
-      \return Sample at position index
-    */
-    virtual T sample( size_t index ) const;
-
-protected:
+    virtual size_t size() const QWT_OVERRIDE;
+
+    /*!
+       \return Sample at a specific position
+
+       \param index Index
+       \return Sample at position index
+     */
+    virtual T sample( size_t index ) const QWT_OVERRIDE;
+
+  protected:
     //! Vector of samples
-    QVector<T> d_samples;
+    QVector< T > m_samples;
 };
 
-template <typename T>
-QwtArraySeriesData<T>::QwtArraySeriesData()
-{
-}
-
-template <typename T>
-QwtArraySeriesData<T>::QwtArraySeriesData( const QVector<T> &samples ):
-    d_samples( samples )
-{
-}
-
-template <typename T>
-void QwtArraySeriesData<T>::setSamples( const QVector<T> &samples )
-{
-    QwtSeriesData<T>::d_boundingRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
-    d_samples = samples;
-}
-
-template <typename T>
-const QVector<T> QwtArraySeriesData<T>::samples() const
-{
-    return d_samples;
-}
-
-template <typename T>
-size_t QwtArraySeriesData<T>::size() const
-{
-    return d_samples.size();
-}
-
-template <typename T>
-T QwtArraySeriesData<T>::sample( size_t i ) const
-{
-    return d_samples[ static_cast<int>( i ) ];
+template< typename T >
+QwtArraySeriesData< T >::QwtArraySeriesData()
+{
+}
+
+template< typename T >
+QwtArraySeriesData< T >::QwtArraySeriesData( const QVector< T >& samples )
+    : m_samples( samples )
+{
+}
+
+template< typename T >
+void QwtArraySeriesData< T >::setSamples( const QVector< T >& samples )
+{
+    QwtSeriesData< T >::cachedBoundingRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
+    m_samples = samples;
+}
+
+template< typename T >
+const QVector< T > QwtArraySeriesData< T >::samples() const
+{
+    return m_samples;
+}
+
+template< typename T >
+size_t QwtArraySeriesData< T >::size() const
+{
+    return m_samples.size();
+}
+
+template< typename T >
+T QwtArraySeriesData< T >::sample( size_t i ) const
+{
+    return m_samples[ static_cast< int >( i ) ];
 }
 
 //! Interface for iterating over an array of points
-class QWT_EXPORT QwtPointSeriesData: public QwtArraySeriesData<QPointF>
-{
-public:
-    QwtPointSeriesData(
-        const QVector<QPointF> & = QVector<QPointF>() );
-
-    virtual QRectF boundingRect() const;
-};
+typedef QwtArraySeriesData< QPointF > QwtPointSeriesData;
 
 //! Interface for iterating over an array of 3D points
-class QWT_EXPORT QwtPoint3DSeriesData: public QwtArraySeriesData<QwtPoint3D>
-{
-public:
-    QwtPoint3DSeriesData(
-        const QVector<QwtPoint3D> & = QVector<QwtPoint3D>() );
-    virtual QRectF boundingRect() const;
-};
+typedef QwtArraySeriesData< QwtPoint3D > QwtPoint3DSeriesData;
 
 //! Interface for iterating over an array of intervals
-class QWT_EXPORT QwtIntervalSeriesData: public QwtArraySeriesData<QwtIntervalSample>
-{
-public:
-    QwtIntervalSeriesData(
-        const QVector<QwtIntervalSample> & = QVector<QwtIntervalSample>() );
-
-    virtual QRectF boundingRect() const;
-};
+typedef QwtArraySeriesData< QwtIntervalSample > QwtIntervalSeriesData;
 
 //! Interface for iterating over an array of samples
-class QWT_EXPORT QwtSetSeriesData: public QwtArraySeriesData<QwtSetSample>
-{
-public:
-    QwtSetSeriesData(
-        const QVector<QwtSetSample> & = QVector<QwtSetSample>() );
-
-    virtual QRectF boundingRect() const;
-};
-
-/*!
-    Interface for iterating over an array of OHLC samples
-*/
-class QWT_EXPORT QwtTradingChartData: public QwtArraySeriesData<QwtOHLCSample>
-{
-public:
-    QwtTradingChartData(
-        const QVector<QwtOHLCSample> & = QVector<QwtOHLCSample>() );
-
-    virtual QRectF boundingRect() const;
-};
-
-QWT_EXPORT QRectF qwtBoundingRect(
-    const QwtSeriesData<QPointF> &, int from = 0, int to = -1 );
-
-QWT_EXPORT QRectF qwtBoundingRect(
-    const QwtSeriesData<QwtPoint3D> &, int from = 0, int to = -1 );
-
-QWT_EXPORT QRectF qwtBoundingRect(
-    const QwtSeriesData<QwtPointPolar> &, int from = 0, int to = -1 );
-
-QWT_EXPORT QRectF qwtBoundingRect(
-    const QwtSeriesData<QwtIntervalSample> &, int from = 0, int to = -1 );
-
-QWT_EXPORT QRectF qwtBoundingRect(
-    const QwtSeriesData<QwtSetSample> &, int from = 0, int to = -1 );
-
-QWT_EXPORT QRectF qwtBoundingRect(
-    const QwtSeriesData<QwtOHLCSample> &, int from = 0, int to = -1 );
+typedef QwtArraySeriesData< QwtSetSample > QwtSetSeriesData;
+
+//! Interface for iterating over an array of vector field samples
+typedef QwtArraySeriesData< QwtVectorFieldSample > QwtVectorFieldData;
+
+//!  Interface for iterating over an array of OHLC samples
+typedef QwtArraySeriesData< QwtOHLCSample > QwtTradingChartData;
+
+QWT_EXPORT QRectF qwtBoundingRect(
+    const QwtSeriesData< QPointF >&, int from = 0, int to = -1 );
+
+QWT_EXPORT QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtPoint3D >&, int from = 0, int to = -1 );
+
+QWT_EXPORT QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtPointPolar >&, int from = 0, int to = -1 );
+
+QWT_EXPORT QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtIntervalSample >&, int from = 0, int to = -1 );
+
+QWT_EXPORT QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtSetSample >&, int from = 0, int to = -1 );
+
+QWT_EXPORT QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtOHLCSample >&, int from = 0, int to = -1 );
+
+QWT_EXPORT QRectF qwtBoundingRect(
+    const QwtSeriesData< QwtVectorFieldSample >&, int from = 0, int to = -1 );
 
 /*!
@@ -281,10 +270,10 @@
     value the return value will be -1.
 
-  \par Example
+   \par Example
     The following example shows finds a point of curve from an x
     coordinate
     \code
-      #include <qwt_series_data.h>
-      #include <qwt_plot_curve.h>
+ #include <qwt_series_data.h>
+ #include <qwt_plot_curve.h>
 
       struct compareX
@@ -299,5 +288,5 @@
       {
           int index = qwtUpperSampleIndex<QPointF>(
-              *curve->data(), x, compareX() );
+ * curve->data(), x, compareX() );
 
           if ( index == -1 &&
@@ -319,20 +308,20 @@
 
     \endcode
-  \endpar
-
-  \param series Series of samples
-  \param value Value
-  \param lessThan Compare operation
-
-  \note The samples must be sorted according to the order specified
+   \endpar
+
+   \param series Series of samples
+   \param value Value
+   \param lessThan Compare operation
+
+   \note The samples must be sorted according to the order specified
         by the lessThan object
  */
-template <typename T, typename LessThan>
-inline int qwtUpperSampleIndex( const QwtSeriesData<T> &series,
+template< typename T, typename LessThan >
+inline int qwtUpperSampleIndex( const QwtSeriesData< T >& series,
     double value, LessThan lessThan  )
 {
     const int indexMax = series.size() - 1;
 
-    if ( indexMax < 0 || !lessThan( value, series.sample( indexMax ) )  )
+    if ( indexMax < 0 || !lessThan( value, series.sample( indexMax ) ) )
         return -1;
 
Index: /trunk/BNC/qwt/qwt_series_store.h
===================================================================
--- /trunk/BNC/qwt/qwt_series_store.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_series_store.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -15,17 +15,18 @@
 
 /*!
-  \brief Bridge between QwtSeriesStore and QwtPlotSeriesItem
-
-  QwtAbstractSeriesStore is an abstract interface only
-  to make it possible to isolate the template based methods ( QwtSeriesStore )
-  from the regular methods ( QwtPlotSeriesItem ) to make it possible
-  to derive from QwtPlotSeriesItem without any hassle with templates.
-*/
+   \brief Bridge between QwtSeriesStore and QwtPlotSeriesItem
+
+   QwtAbstractSeriesStore is an abstract interface only
+   to make it possible to isolate the template based methods ( QwtSeriesStore )
+   from the regular methods ( QwtPlotSeriesItem ) to make it possible
+   to derive from QwtPlotSeriesItem without any hassle with templates.
+ */
 class QwtAbstractSeriesStore
 {
-protected:
+  public:
     //! Destructor
     virtual ~QwtAbstractSeriesStore() {}
 
+  protected:
 #ifndef QWT_PYTHON_WRAPPER
     //! dataChanged() indicates, that the series has been changed.
@@ -33,8 +34,8 @@
 
     /*!
-      Set a the "rectangle of interest" for the stored series
-      \sa QwtSeriesData<T>::setRectOfInterest()
-     */
-    virtual void setRectOfInterest( const QRectF & ) = 0;
+       Set a the "rectangle of interest" for the stored series
+       \sa QwtSeriesData<T>::setRectOfInterest()
+     */
+    virtual void setRectOfInterest( const QRectF& ) = 0;
 
     //! \return Bounding rectangle of the stored series
@@ -46,6 +47,6 @@
     // Needed for generating the python bindings, but not for using them !
     virtual void dataChanged() {}
-    virtual void setRectOfInterest( const QRectF & ) {}
-    virtual QRectF dataRect() const { return  QRectF( 0.0, 0.0, -1.0, -1.0 ); }
+    virtual void setRectOfInterest( const QRectF& ) {}
+    virtual QRectF dataRect() const { return QRectF( 0.0, 0.0, -1.0, -1.0 ); }
     virtual size_t dataSize() const { return 0; }
 #endif
@@ -53,152 +54,152 @@
 
 /*!
-  \brief Class storing a QwtSeriesData object
-
-  QwtSeriesStore and QwtPlotSeriesItem are intended as base classes for all
-  plot items iterating over a series of samples. Both classes share
-  a virtual base class ( QwtAbstractSeriesStore ) to bridge between them.
-
-  QwtSeriesStore offers the template based part for the plot item API, so
-  that QwtPlotSeriesItem can be derived without any hassle with templates.
+   \brief Class storing a QwtSeriesData object
+
+   QwtSeriesStore and QwtPlotSeriesItem are intended as base classes for all
+   plot items iterating over a series of samples. Both classes share
+   a virtual base class ( QwtAbstractSeriesStore ) to bridge between them.
+
+   QwtSeriesStore offers the template based part for the plot item API, so
+   that QwtPlotSeriesItem can be derived without any hassle with templates.
  */
-template <typename T>
-class QwtSeriesStore: public virtual QwtAbstractSeriesStore
-{
-public:
-    /*!
-      \brief Constructor
-      The store contains no series
-    */
-    explicit QwtSeriesStore<T>();
+template< typename T >
+class QwtSeriesStore : public virtual QwtAbstractSeriesStore
+{
+  public:
+    /*!
+       \brief Constructor
+       The store contains no series
+     */
+    explicit QwtSeriesStore();
 
     //! Destructor
-    ~QwtSeriesStore<T>();
-
-    /*!
-      Assign a series of samples
-
-      \param series Data
-      \warning The item takes ownership of the data object, deleting
+    ~QwtSeriesStore();
+
+    /*!
+       Assign a series of samples
+
+       \param series Data
+       \warning The item takes ownership of the data object, deleting
                it when its not used anymore.
-    */
-    void setData( QwtSeriesData<T> *series );
+     */
+    void setData( QwtSeriesData< T >* series );
 
     //! \return the the series data
-    QwtSeriesData<T> *data();
+    QwtSeriesData< T >* data();
 
     //! \return the the series data
-    const QwtSeriesData<T> *data() const;
+    const QwtSeriesData< T >* data() const;
 
     /*!
         \param index Index
         \return Sample at position index
-    */
+     */
     T sample( int index ) const;
 
     /*!
-      \return Number of samples of the series
-      \sa setData(), QwtSeriesData<T>::size()
-    */
-    virtual size_t dataSize() const;
-
-    /*!
-      \return Bounding rectangle of the series
+       \return Number of samples of the series
+       \sa setData(), QwtSeriesData<T>::size()
+     */
+    virtual size_t dataSize() const QWT_OVERRIDE;
+
+    /*!
+       \return Bounding rectangle of the series
               or an invalid rectangle, when no series is stored
 
-      \sa QwtSeriesData<T>::boundingRect()
-    */
-    virtual QRectF dataRect() const;
-
-    /*!
-      Set a the "rect of interest" for the series
-
-      \param rect Rectangle of interest
-      \sa QwtSeriesData<T>::setRectOfInterest()
-    */
-    virtual void setRectOfInterest( const QRectF &rect );
-
-    /*!
-      Replace a series without deleting the previous one
-
-      \param series New series
-      \return Previously assigned series
-     */
-    QwtSeriesData<T> *swapData( QwtSeriesData<T> *series );
-
-private:
-    QwtSeriesData<T> *d_series;
+       \sa QwtSeriesData<T>::boundingRect()
+     */
+    virtual QRectF dataRect() const QWT_OVERRIDE;
+
+    /*!
+       Set a the "rect of interest" for the series
+
+       \param rect Rectangle of interest
+       \sa QwtSeriesData<T>::setRectOfInterest()
+     */
+    virtual void setRectOfInterest( const QRectF& rect ) QWT_OVERRIDE;
+
+    /*!
+       Replace a series without deleting the previous one
+
+       \param series New series
+       \return Previously assigned series
+     */
+    QwtSeriesData< T >* swapData( QwtSeriesData< T >* series );
+
+  private:
+    QwtSeriesData< T >* m_series;
 };
 
-template <typename T>
-QwtSeriesStore<T>::QwtSeriesStore():
-    d_series( NULL )
-{
-}
-
-template <typename T>
-QwtSeriesStore<T>::~QwtSeriesStore()
-{
-    delete d_series;
-}
-
-template <typename T>
-inline QwtSeriesData<T> *QwtSeriesStore<T>::data()
-{
-    return d_series;
-}
-
-template <typename T>
-inline const QwtSeriesData<T> *QwtSeriesStore<T>::data() const
-{
-    return d_series;
-}
-
-template <typename T>
-inline T QwtSeriesStore<T>::sample( int index ) const
-{
-    return d_series ? d_series->sample( index ) : T();
-}
-
-template <typename T>
-void QwtSeriesStore<T>::setData( QwtSeriesData<T> *series )
-{
-    if ( d_series != series )
+template< typename T >
+QwtSeriesStore< T >::QwtSeriesStore()
+    : m_series( NULL )
+{
+}
+
+template< typename T >
+QwtSeriesStore< T >::~QwtSeriesStore()
+{
+    delete m_series;
+}
+
+template< typename T >
+inline QwtSeriesData< T >* QwtSeriesStore< T >::data()
+{
+    return m_series;
+}
+
+template< typename T >
+inline const QwtSeriesData< T >* QwtSeriesStore< T >::data() const
+{
+    return m_series;
+}
+
+template< typename T >
+inline T QwtSeriesStore< T >::sample( int index ) const
+{
+    return m_series ? m_series->sample( index ) : T();
+}
+
+template< typename T >
+void QwtSeriesStore< T >::setData( QwtSeriesData< T >* series )
+{
+    if ( m_series != series )
     {
-        delete d_series;
-        d_series = series;
+        delete m_series;
+        m_series = series;
         dataChanged();
     }
 }
 
-template <typename T>
-size_t QwtSeriesStore<T>::dataSize() const
-{
-    if ( d_series == NULL )
+template< typename T >
+size_t QwtSeriesStore< T >::dataSize() const
+{
+    if ( m_series == NULL )
         return 0;
 
-    return d_series->size();
-}
-
-template <typename T>
-QRectF QwtSeriesStore<T>::dataRect() const
-{
-    if ( d_series == NULL )
+    return m_series->size();
+}
+
+template< typename T >
+QRectF QwtSeriesStore< T >::dataRect() const
+{
+    if ( m_series == NULL )
         return QRectF( 1.0, 1.0, -2.0, -2.0 ); // invalid
 
-    return d_series->boundingRect();
-}
-
-template <typename T>
-void QwtSeriesStore<T>::setRectOfInterest( const QRectF &rect )
-{
-    if ( d_series )
-        d_series->setRectOfInterest( rect );
-}
-
-template <typename T>
-QwtSeriesData<T>* QwtSeriesStore<T>::swapData( QwtSeriesData<T> *series )
-{
-    QwtSeriesData<T> * swappedSeries = d_series;
-    d_series = series;
+    return m_series->boundingRect();
+}
+
+template< typename T >
+void QwtSeriesStore< T >::setRectOfInterest( const QRectF& rect )
+{
+    if ( m_series )
+        m_series->setRectOfInterest( rect );
+}
+
+template< typename T >
+QwtSeriesData< T >* QwtSeriesStore< T >::swapData( QwtSeriesData< T >* series )
+{
+    QwtSeriesData< T >* swappedSeries = m_series;
+    m_series = series;
 
     return swappedSeries;
Index: /trunk/BNC/qwt/qwt_slider.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_slider.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_slider.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,14 +12,15 @@
 #include "qwt_scale_draw.h"
 #include "qwt_scale_map.h"
+#include "qwt_math.h"
+#include "qwt.h"
+
 #include <qevent.h>
 #include <qdrawutil.h>
 #include <qpainter.h>
-#include <qalgorithms.h>
-#include <qmath.h>
 #include <qstyle.h>
 #include <qstyleoption.h>
-#include <qapplication.h>
-
-static QSize qwtHandleSize( const QSize &size,
+#include <qmargins.h>
+
+static QSize qwtHandleSize( const QSize& size,
     Qt::Orientation orientation, bool hasTrough )
 {
@@ -69,16 +70,16 @@
 class QwtSlider::PrivateData
 {
-public:
-    PrivateData():
-        repeatTimerId( 0 ),
-        updateInterval( 150 ),
-        stepsIncrement( 0 ),
-        pendingValueChange( false ),
-        borderWidth( 2 ),
-        spacing( 4 ),
-        scalePosition( QwtSlider::TrailingScale ),
-        hasTrough( true ),
-        hasGroove( false ),
-        mouseOffset( 0 )
+  public:
+    PrivateData()
+        : repeatTimerId( 0 )
+        , updateInterval( 150 )
+        , stepsIncrement( 0 )
+        , pendingValueChange( false )
+        , borderWidth( 2 )
+        , spacing( 4 )
+        , scalePosition( QwtSlider::TrailingScale )
+        , hasTrough( true )
+        , hasGroove( false )
+        , mouseOffset( 0 )
     {
     }
@@ -107,15 +108,15 @@
 };
 /*!
-  Construct vertical slider in QwtSlider::Trough style
-  with a scale to the left.
-
-  The scale is initialized to [0.0, 100.0] and the value set to 0.0.
-
-  \param parent Parent widget
-
-  \sa setOrientation(), setScalePosition(), setBackgroundStyle()
-*/
-QwtSlider::QwtSlider( QWidget *parent ):
-    QwtAbstractSlider( parent )
+   Construct vertical slider in QwtSlider::Trough style
+   with a scale to the left.
+
+   The scale is initialized to [0.0, 100.0] and the value set to 0.0.
+
+   \param parent Parent widget
+
+   \sa setOrientation(), setScalePosition(), setBackgroundStyle()
+ */
+QwtSlider::QwtSlider( QWidget* parent )
+    : QwtAbstractSlider( parent )
 {
     initSlider( Qt::Vertical );
@@ -123,16 +124,16 @@
 
 /*!
-  Construct a slider in QwtSlider::Trough style
-
-  When orientation is Qt::Vertical the scale will be aligned to
-  the left - otherwise at the the top of the slider.
-
-  The scale is initialized to [0.0, 100.0] and the value set to 0.0.
-
-  \param parent Parent widget
-  \param orientation Orientation of the slider.
-*/
-QwtSlider::QwtSlider( Qt::Orientation orientation, QWidget *parent ):
-    QwtAbstractSlider( parent )
+   Construct a slider in QwtSlider::Trough style
+
+   When orientation is Qt::Vertical the scale will be aligned to
+   the left - otherwise at the the top of the slider.
+
+   The scale is initialized to [0.0, 100.0] and the value set to 0.0.
+
+   \param parent Parent widget
+   \param orientation Orientation of the slider.
+ */
+QwtSlider::QwtSlider( Qt::Orientation orientation, QWidget* parent )
+    : QwtAbstractSlider( parent )
 {
     initSlider( orientation );
@@ -142,5 +143,5 @@
 QwtSlider::~QwtSlider()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -154,10 +155,10 @@
     setAttribute( Qt::WA_WState_OwnSizePolicy, false );
 
-    d_data = new QwtSlider::PrivateData;
-
-    d_data->orientation = orientation;
+    m_data = new QwtSlider::PrivateData;
+
+    m_data->orientation = orientation;
 
     scaleDraw()->setAlignment(
-        qwtScaleDrawAlignment( orientation, d_data->scalePosition ) );
+        qwtScaleDrawAlignment( orientation, m_data->scalePosition ) );
     scaleDraw()->setLength( 100 );
 
@@ -167,18 +168,18 @@
 
 /*!
-  \brief Set the orientation.
-  \param orientation Allowed values are Qt::Horizontal and Qt::Vertical.
-
-  \sa orientation(), scalePosition()
-*/
+   \brief Set the orientation.
+   \param orientation Allowed values are Qt::Horizontal and Qt::Vertical.
+
+   \sa orientation(), scalePosition()
+ */
 void QwtSlider::setOrientation( Qt::Orientation orientation )
 {
-    if ( orientation == d_data->orientation )
+    if ( orientation == m_data->orientation )
         return;
 
-    d_data->orientation = orientation;
+    m_data->orientation = orientation;
 
     scaleDraw()->setAlignment(
-        qwtScaleDrawAlignment( orientation, d_data->scalePosition ) );
+        qwtScaleDrawAlignment( orientation, m_data->scalePosition ) );
 
     if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
@@ -196,26 +197,26 @@
 
 /*!
-  \return Orientation
-  \sa setOrientation()
-*/
+   \return Orientation
+   \sa setOrientation()
+ */
 Qt::Orientation QwtSlider::orientation() const
 {
-    return d_data->orientation;
-}
-
-/*!
-  \brief Change the position of the scale
-  \param scalePosition Position of the scale.
-
-  \sa ScalePosition, scalePosition()
-*/
+    return m_data->orientation;
+}
+
+/*!
+   \brief Change the position of the scale
+   \param scalePosition Position of the scale.
+
+   \sa ScalePosition, scalePosition()
+ */
 void QwtSlider::setScalePosition( ScalePosition scalePosition )
 {
-    if ( d_data->scalePosition == scalePosition )
+    if ( m_data->scalePosition == scalePosition )
         return;
 
-    d_data->scalePosition = scalePosition;
+    m_data->scalePosition = scalePosition;
     scaleDraw()->setAlignment(
-        qwtScaleDrawAlignment( d_data->orientation, scalePosition ) );
+        qwtScaleDrawAlignment( m_data->orientation, scalePosition ) );
 
     if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -224,21 +225,21 @@
 
 /*!
-  \return Position of the scale
-  \sa setScalePosition()
+   \return Position of the scale
+   \sa setScalePosition()
  */
 QwtSlider::ScalePosition QwtSlider::scalePosition() const
 {
-    return d_data->scalePosition;
-}
-
-/*!
-  \brief Change the slider's border width
-
-  The border width is used for drawing the slider handle and the
-  trough.
-
-  \param width Border width
-  \sa borderWidth()
-*/
+    return m_data->scalePosition;
+}
+
+/*!
+   \brief Change the slider's border width
+
+   The border width is used for drawing the slider handle and the
+   trough.
+
+   \param width Border width
+   \sa borderWidth()
+ */
 void QwtSlider::setBorderWidth( int width )
 {
@@ -246,7 +247,7 @@
         width = 0;
 
-    if ( width != d_data->borderWidth )
-    {
-        d_data->borderWidth = width;
+    if ( width != m_data->borderWidth )
+    {
+        m_data->borderWidth = width;
 
         if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -256,23 +257,23 @@
 
 /*!
-  \return the border width.
-  \sa setBorderWidth()
-*/
+   \return the border width.
+   \sa setBorderWidth()
+ */
 int QwtSlider::borderWidth() const
 {
-    return d_data->borderWidth;
-}
-
-/*!
-  \brief Change the spacing between trough and scale
-
-  A spacing of 0 means, that the backbone of the scale is covered
-  by the trough.
-
-  The default setting is 4 pixels.
-
-  \param spacing Number of pixels
-  \sa spacing();
-*/
+    return m_data->borderWidth;
+}
+
+/*!
+   \brief Change the spacing between trough and scale
+
+   A spacing of 0 means, that the backbone of the scale is covered
+   by the trough.
+
+   The default setting is 4 pixels.
+
+   \param spacing Number of pixels
+   \sa spacing();
+ */
 void QwtSlider::setSpacing( int spacing )
 {
@@ -280,7 +281,7 @@
         spacing = 0;
 
-    if ( spacing != d_data->spacing  )
-    {
-        d_data->spacing = spacing;
+    if ( spacing != m_data->spacing  )
+    {
+        m_data->spacing = spacing;
 
         if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -290,27 +291,27 @@
 
 /*!
-  \return Number of pixels between slider and scale
-  \sa setSpacing()
-*/
+   \return Number of pixels between slider and scale
+   \sa setSpacing()
+ */
 int QwtSlider::spacing() const
 {
-    return d_data->spacing;
-}
-
-/*!
-  \brief Set the slider's handle size
-
-  When the size is empty the slider handle will be painted with a
-  default size depending on its orientation() and backgroundStyle().
-
-  \param size New size
-
-  \sa handleSize()
-*/
-void QwtSlider::setHandleSize( const QSize &size )
-{
-    if ( size != d_data->handleSize )
-    {
-        d_data->handleSize = size;
+    return m_data->spacing;
+}
+
+/*!
+   \brief Set the slider's handle size
+
+   When the size is empty the slider handle will be painted with a
+   default size depending on its orientation() and backgroundStyle().
+
+   \param size New size
+
+   \sa handleSize()
+ */
+void QwtSlider::setHandleSize( const QSize& size )
+{
+    if ( size != m_data->handleSize )
+    {
+        m_data->handleSize = size;
 
         if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -320,28 +321,28 @@
 
 /*!
-  \return Size of the handle.
-  \sa setHandleSize()
-*/
+   \return Size of the handle.
+   \sa setHandleSize()
+ */
 QSize QwtSlider::handleSize() const
 {
-    return d_data->handleSize;
-}
-
-/*!
-  \brief Set a scale draw
-
-  For changing the labels of the scales, it
-  is necessary to derive from QwtScaleDraw and
-  overload QwtScaleDraw::label().
-
-  \param scaleDraw ScaleDraw object, that has to be created with
+    return m_data->handleSize;
+}
+
+/*!
+   \brief Set a scale draw
+
+   For changing the labels of the scales, it
+   is necessary to derive from QwtScaleDraw and
+   overload QwtScaleDraw::label().
+
+   \param scaleDraw ScaleDraw object, that has to be created with
                    new and will be deleted in ~QwtSlider() or the next
                    call of setScaleDraw().
 
-  \sa scaleDraw()
-*/
-void QwtSlider::setScaleDraw( QwtScaleDraw *scaleDraw )
-{
-    const QwtScaleDraw *previousScaleDraw = this->scaleDraw();
+   \sa scaleDraw()
+ */
+void QwtSlider::setScaleDraw( QwtScaleDraw* scaleDraw )
+{
+    const QwtScaleDraw* previousScaleDraw = this->scaleDraw();
     if ( scaleDraw == NULL || scaleDraw == previousScaleDraw )
         return;
@@ -357,19 +358,19 @@
 
 /*!
-  \return the scale draw of the slider
-  \sa setScaleDraw()
-*/
-const QwtScaleDraw *QwtSlider::scaleDraw() const
-{
-    return static_cast<const QwtScaleDraw *>( abstractScaleDraw() );
-}
-
-/*!
-  \return the scale draw of the slider
-  \sa setScaleDraw()
-*/
-QwtScaleDraw *QwtSlider::scaleDraw()
-{
-    return static_cast<QwtScaleDraw *>( abstractScaleDraw() );
+   \return the scale draw of the slider
+   \sa setScaleDraw()
+ */
+const QwtScaleDraw* QwtSlider::scaleDraw() const
+{
+    return static_cast< const QwtScaleDraw* >( abstractScaleDraw() );
+}
+
+/*!
+   \return the scale draw of the slider
+   \sa setScaleDraw()
+ */
+QwtScaleDraw* QwtSlider::scaleDraw()
+{
+    return static_cast< QwtScaleDraw* >( abstractScaleDraw() );
 }
 
@@ -384,24 +385,24 @@
 
 /*!
-  \brief Specify the update interval for automatic scrolling
-
-  The minimal accepted value is 50 ms.
-
-  \param interval Update interval in milliseconds
-
-  \sa setUpdateInterval()
-*/
+   \brief Specify the update interval for automatic scrolling
+
+   The minimal accepted value is 50 ms.
+
+   \param interval Update interval in milliseconds
+
+   \sa setUpdateInterval()
+ */
 void QwtSlider::setUpdateInterval( int interval )
 {
-    d_data->updateInterval = qMax( interval, 50 );
-}
-
-/*!
-  \return Update interval in milliseconds for automatic scrolling
-  \sa setUpdateInterval()
+    m_data->updateInterval = qMax( interval, 50 );
+}
+
+/*!
+   \return Update interval in milliseconds for automatic scrolling
+   \sa setUpdateInterval()
  */
 int QwtSlider::updateInterval() const
 {
-    return d_data->updateInterval;
+    return m_data->updateInterval;
 }
 
@@ -411,13 +412,13 @@
    \param painter Painter
    \param sliderRect Bounding rectangle of the slider
-*/
+ */
 void QwtSlider::drawSlider(
-    QPainter *painter, const QRect &sliderRect ) const
+    QPainter* painter, const QRect& sliderRect ) const
 {
     QRect innerRect( sliderRect );
 
-    if ( d_data->hasTrough )
-    {
-        const int bw = d_data->borderWidth;
+    if ( m_data->hasTrough )
+    {
+        const int bw = m_data->borderWidth;
         innerRect = sliderRect.adjusted( bw, bw, -bw, -bw );
 
@@ -426,9 +427,9 @@
     }
 
-    const QSize handleSize = qwtHandleSize( d_data->handleSize,
-        d_data->orientation, d_data->hasTrough );
-
-    if ( d_data->hasGroove )
-    {
+    if ( m_data->hasGroove )
+    {
+        const QSize handleSize = qwtHandleSize( m_data->handleSize,
+            m_data->orientation, m_data->hasTrough );
+
         const int slotExtent = 4;
         const int slotMargin = 4;
@@ -456,5 +457,5 @@
 
         QBrush brush = palette().brush( QPalette::Dark );
-        qDrawShadePanel( painter, slotRect, palette(), true, 1 , &brush );
+        qDrawShadePanel( painter, slotRect, palette(), true, 1, &brush );
     }
 
@@ -464,14 +465,14 @@
 
 /*!
-  Draw the thumb at a position
-
-  \param painter Painter
-  \param handleRect Bounding rectangle of the handle
-  \param pos Position of the handle marker in widget coordinates
-*/
-void QwtSlider::drawHandle( QPainter *painter,
-    const QRect &handleRect, int pos ) const
-{
-    const int bw = d_data->borderWidth;
+   Draw the thumb at a position
+
+   \param painter Painter
+   \param handleRect Bounding rectangle of the handle
+   \param pos Position of the handle marker in widget coordinates
+ */
+void QwtSlider::drawHandle( QPainter* painter,
+    const QRect& handleRect, int pos ) const
+{
+    const int bw = m_data->borderWidth;
 
     qDrawShadePanel( painter,
@@ -493,12 +494,12 @@
 
 /*!
-  \brief Determine what to do when the user presses a mouse button.
-
-  \param pos Mouse position
-
-  \retval True, when handleRect() contains pos
-  \sa scrolledTo()
-*/
-bool QwtSlider::isScrollPosition( const QPoint &pos ) const
+   \brief Determine what to do when the user presses a mouse button.
+
+   \param pos Mouse position
+
+   \retval True, when handleRect() contains pos
+   \sa scrolledTo()
+ */
+bool QwtSlider::isScrollPosition( const QPoint& pos ) const
 {
     if ( handleRect().contains( pos ) )
@@ -507,5 +508,5 @@
             ? pos.x() : pos.y();
 
-        d_data->mouseOffset = v - transform( value() );
+        m_data->mouseOffset = v - transform( value() );
         return true;
     }
@@ -515,18 +516,18 @@
 
 /*!
-  \brief Determine the value for a new position of the
+   \brief Determine the value for a new position of the
          slider handle.
 
-  \param pos Mouse position
-
-  \return Value for the mouse position
-  \sa isScrollPosition()
-*/
-double QwtSlider::scrolledTo( const QPoint &pos ) const
+   \param pos Mouse position
+
+   \return Value for the mouse position
+   \sa isScrollPosition()
+ */
+double QwtSlider::scrolledTo( const QPoint& pos ) const
 {
     int p = ( orientation() == Qt::Horizontal )
         ? pos.x() : pos.y();
 
-    p -= d_data->mouseOffset;
+    p -= m_data->mouseOffset;
 
     int min = transform( lowerBound() );
@@ -543,6 +544,6 @@
    Mouse press event handler
    \param event Mouse event
-*/
-void QwtSlider::mousePressEvent( QMouseEvent *event )
+ */
+void QwtSlider::mousePressEvent( QMouseEvent* event )
 {
     if ( isReadOnly() )
@@ -554,5 +555,5 @@
     const QPoint pos = event->pos();
 
-    if ( isValid() && d_data->sliderRect.contains( pos ) )
+    if ( isValid() && m_data->sliderRect.contains( pos ) )
     {
         if ( !handleRect().contains( pos ) )
@@ -560,22 +561,22 @@
             const int markerPos = transform( value() );
 
-            d_data->stepsIncrement = pageSteps();
-
-            if ( d_data->orientation == Qt::Horizontal )
+            m_data->stepsIncrement = pageSteps();
+
+            if ( m_data->orientation == Qt::Horizontal )
             {
                 if ( pos.x() < markerPos )
-                    d_data->stepsIncrement = -d_data->stepsIncrement;
+                    m_data->stepsIncrement = -m_data->stepsIncrement;
             }
             else
             {
                 if ( pos.y() < markerPos )
-                    d_data->stepsIncrement = -d_data->stepsIncrement;
+                    m_data->stepsIncrement = -m_data->stepsIncrement;
             }
 
             if ( isInverted() )
-                d_data->stepsIncrement = -d_data->stepsIncrement;
+                m_data->stepsIncrement = -m_data->stepsIncrement;
 
             const double v = value();
-            incrementValue( d_data->stepsIncrement );
+            incrementValue( m_data->stepsIncrement );
 
             if ( v != value() )
@@ -584,11 +585,11 @@
                     Q_EMIT valueChanged( value() );
                 else
-                    d_data->pendingValueChange = true;
+                    m_data->pendingValueChange = true;
 
                 Q_EMIT sliderMoved( value() );
             }
 
-            d_data->timerTick = false;
-            d_data->repeatTimerId = startTimer( qMax( 250, 2 * updateInterval() ) );
+            m_data->timerTick = false;
+            m_data->repeatTimerId = startTimer( qMax( 250, 2 * updateInterval() ) );
 
             return;
@@ -602,18 +603,18 @@
    Mouse release event handler
    \param event Mouse event
-*/
-void QwtSlider::mouseReleaseEvent( QMouseEvent *event )
-{
-    if ( d_data->repeatTimerId > 0 )
-    {
-        killTimer( d_data->repeatTimerId );
-        d_data->repeatTimerId = 0;
-        d_data->timerTick = false;
-        d_data->stepsIncrement = 0;
-    }
-
-    if ( d_data->pendingValueChange )
-    {
-        d_data->pendingValueChange = false;
+ */
+void QwtSlider::mouseReleaseEvent( QMouseEvent* event )
+{
+    if ( m_data->repeatTimerId > 0 )
+    {
+        killTimer( m_data->repeatTimerId );
+        m_data->repeatTimerId = 0;
+        m_data->timerTick = false;
+        m_data->stepsIncrement = 0;
+    }
+
+    if ( m_data->pendingValueChange )
+    {
+        m_data->pendingValueChange = false;
         Q_EMIT valueChanged( value() );
     }
@@ -629,8 +630,8 @@
 
    \param event Mouse event
-*/
-void QwtSlider::timerEvent( QTimerEvent *event )
-{
-    if ( event->timerId() != d_data->repeatTimerId )
+ */
+void QwtSlider::timerEvent( QTimerEvent* event )
+{
+    if ( event->timerId() != m_data->repeatTimerId )
     {
         QwtAbstractSlider::timerEvent( event );
@@ -640,11 +641,11 @@
     if ( !isValid() )
     {
-        killTimer( d_data->repeatTimerId );
-        d_data->repeatTimerId = 0;
+        killTimer( m_data->repeatTimerId );
+        m_data->repeatTimerId = 0;
         return;
     }
 
     const double v = value();
-    incrementValue( d_data->stepsIncrement );
+    incrementValue( m_data->stepsIncrement );
 
     if ( v != value() )
@@ -653,16 +654,16 @@
             Q_EMIT valueChanged( value() );
         else
-            d_data->pendingValueChange = true;
+            m_data->pendingValueChange = true;
 
         Q_EMIT sliderMoved( value() );
     }
 
-    if ( !d_data->timerTick )
+    if ( !m_data->timerTick )
     {
         // restart the timer with a shorter interval
-        killTimer( d_data->repeatTimerId );
-        d_data->repeatTimerId = startTimer( updateInterval() );
-
-        d_data->timerTick = true;
+        killTimer( m_data->repeatTimerId );
+        m_data->repeatTimerId = startTimer( updateInterval() );
+
+        m_data->timerTick = true;
     }
 }
@@ -671,6 +672,6 @@
    Qt paint event handler
    \param event Paint event
-*/
-void QwtSlider::paintEvent( QPaintEvent *event )
+ */
+void QwtSlider::paintEvent( QPaintEvent* event )
 {
     QPainter painter( this );
@@ -678,17 +679,17 @@
 
     QStyleOption opt;
-    opt.init(this);
+    opt.initFrom(this);
     style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
 
-    if ( d_data->scalePosition != QwtSlider::NoScale )
-    {
-        if ( !d_data->sliderRect.contains( event->rect() ) )
+    if ( m_data->scalePosition != QwtSlider::NoScale )
+    {
+        if ( !m_data->sliderRect.contains( event->rect() ) )
             scaleDraw()->draw( &painter, palette() );
     }
 
-    drawSlider( &painter, d_data->sliderRect );
+    drawSlider( &painter, m_data->sliderRect );
 
     if ( hasFocus() )
-        QwtPainter::drawFocusRect( &painter, this, d_data->sliderRect );
+        QwtPainter::drawFocusRect( &painter, this, m_data->sliderRect );
 }
 
@@ -696,10 +697,23 @@
    Qt resize event handler
    \param event Resize event
-*/
-void QwtSlider::resizeEvent( QResizeEvent *event )
-{
-    Q_UNUSED( event );
-
+ */
+void QwtSlider::resizeEvent( QResizeEvent* event )
+{
     layoutSlider( false );
+    QwtAbstractSlider::resizeEvent( event );
+}
+
+/*!
+   Qt event handler
+   \param event Event
+
+   \return true, if event was recognized and processed
+ */
+bool QwtSlider::event( QEvent* event )
+{
+    if ( event->type() == QEvent::PolishRequest )
+        layoutSlider( false );
+
+    return QwtAbstractSlider::event( event );
 }
 
@@ -707,6 +721,6 @@
    Handles QEvent::StyleChange and QEvent::FontChange events
    \param event Change event
-*/
-void QwtSlider::changeEvent( QEvent *event )
+ */
+void QwtSlider::changeEvent( QEvent* event )
 {
     if ( event->type() == QEvent::StyleChange ||
@@ -721,18 +735,18 @@
 
 /*!
-  Recalculate the slider's geometry and layout based on
-  the current geometry and fonts.
-
-  \param update_geometry  notify the layout system and call update
+   Recalculate the slider's geometry and layout based on
+   the current geometry and fonts.
+
+   \param update_geometry  notify the layout system and call update
          to redraw the scale
-*/
+ */
 void QwtSlider::layoutSlider( bool update_geometry )
 {
     int bw = 0;
-    if ( d_data->hasTrough )
-        bw = d_data->borderWidth;
-
-    const QSize handleSize = qwtHandleSize( d_data->handleSize,
-        d_data->orientation, d_data->hasTrough );
+    if ( m_data->hasTrough )
+        bw = m_data->borderWidth;
+
+    const QSize handleSize = qwtHandleSize( m_data->handleSize,
+        m_data->orientation, m_data->hasTrough );
 
     QRect sliderRect = contentsRect();
@@ -752,5 +766,5 @@
 
     int scaleMargin = 0;
-    if ( d_data->scalePosition != QwtSlider::NoScale )
+    if ( m_data->scalePosition != QwtSlider::NoScale )
     {
         int d1, d2;
@@ -762,5 +776,5 @@
     int scaleX, scaleY, scaleLength;
 
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         const int handleMargin = handleSize.width() / 2 - 1;
@@ -791,17 +805,17 @@
     // now align slider and scale according to the ScalePosition
 
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         const int h = handleSize.height() + 2 * bw;
 
-        if ( d_data->scalePosition == QwtSlider::TrailingScale )
+        if ( m_data->scalePosition == QwtSlider::TrailingScale )
         {
             sliderRect.setTop( sliderRect.bottom() + 1 - h );
-            scaleY = sliderRect.top() - d_data->spacing;
+            scaleY = sliderRect.top() - m_data->spacing;
         }
         else
         {
             sliderRect.setHeight( h );
-            scaleY = sliderRect.bottom() + 1 + d_data->spacing;
+            scaleY = sliderRect.bottom() + 1 + m_data->spacing;
         }
     }
@@ -810,17 +824,17 @@
         const int w = handleSize.width() + 2 * bw;
 
-        if ( d_data->scalePosition == QwtSlider::LeadingScale )
+        if ( m_data->scalePosition == QwtSlider::LeadingScale )
         {
             sliderRect.setWidth( w );
-            scaleX = sliderRect.right() + 1 + d_data->spacing;
+            scaleX = sliderRect.right() + 1 + m_data->spacing;
         }
         else
         {
             sliderRect.setLeft( sliderRect.right() + 1 - w );
-            scaleX = sliderRect.left() - d_data->spacing;
+            scaleX = sliderRect.left() - m_data->spacing;
         }
     }
 
-    d_data->sliderRect = sliderRect;
+    m_data->sliderRect = sliderRect;
 
     scaleDraw()->move( scaleX, scaleY );
@@ -829,5 +843,5 @@
     if ( update_geometry )
     {
-        d_data->sizeHintCache = QSize(); // invalidate
+        m_data->sizeHintCache = QSize(); // invalidate
         updateGeometry();
         update();
@@ -836,17 +850,17 @@
 
 /*!
-  En/Disable the trough
-
-  The slider can be cutomized by showing a trough for the
-  handle.
-
-  \param on When true, the groove is visible
-  \sa hasTrough(), setGroove()
+   En/Disable the trough
+
+   The slider can be customized by showing a trough for the
+   handle.
+
+   \param on When true, the groove is visible
+   \sa hasTrough(), setGroove()
  */
 void QwtSlider::setTrough( bool on )
 {
-    if ( d_data->hasTrough != on )
-    {
-        d_data->hasTrough = on;
+    if ( m_data->hasTrough != on )
+    {
+        m_data->hasTrough = on;
 
         if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -856,26 +870,26 @@
 
 /*!
-  \return True, when the trough is visisble
-  \sa setTrough(), hasGroove()
+   \return True, when the trough is visible
+   \sa setTrough(), hasGroove()
  */
 bool QwtSlider::hasTrough() const
 {
-    return d_data->hasTrough;
-}
-
-/*!
-  En/Disable the groove
-
-  The slider can be cutomized by showing a groove for the
-  handle.
-
-  \param on When true, the groove is visible
-  \sa hasGroove(), setThrough()
+    return m_data->hasTrough;
+}
+
+/*!
+   En/Disable the groove
+
+   The slider can be customized by showing a groove for the
+   handle.
+
+   \param on When true, the groove is visible
+   \sa hasGroove(), setThrough()
  */
 void QwtSlider::setGroove( bool on )
 {
-    if ( d_data->hasGroove != on )
-    {
-        d_data->hasGroove = on;
+    if ( m_data->hasGroove != on )
+    {
+        m_data->hasGroove = on;
 
         if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -885,41 +899,41 @@
 
 /*!
-  \return True, when the groove is visisble
-  \sa setGroove(), hasTrough()
+   \return True, when the groove is visible
+   \sa setGroove(), hasTrough()
  */
 bool QwtSlider::hasGroove() const
 {
-    return d_data->hasGroove;
-}
-
-/*!
-  \return minimumSizeHint()
-*/
+    return m_data->hasGroove;
+}
+
+/*!
+   \return minimumSizeHint()
+ */
 QSize QwtSlider::sizeHint() const
 {
     const QSize hint = minimumSizeHint();
-    return hint.expandedTo( QApplication::globalStrut() );
-}
-
-/*!
-  \return Minimum size hint
-  \sa sizeHint()
-*/
+    return qwtExpandedToGlobalStrut( hint );
+}
+
+/*!
+   \return Minimum size hint
+   \sa sizeHint()
+ */
 QSize QwtSlider::minimumSizeHint() const
 {
-    if ( !d_data->sizeHintCache.isEmpty() )
-        return d_data->sizeHintCache;
-
-    const QSize handleSize = qwtHandleSize( d_data->handleSize,
-        d_data->orientation, d_data->hasTrough );
+    if ( !m_data->sizeHintCache.isEmpty() )
+        return m_data->sizeHintCache;
+
+    const QSize handleSize = qwtHandleSize( m_data->handleSize,
+        m_data->orientation, m_data->hasTrough );
 
     int bw = 0;
-    if ( d_data->hasTrough )
-        bw = d_data->borderWidth;
+    if ( m_data->hasTrough )
+        bw = m_data->borderWidth;
 
     int sliderLength = 0;
     int scaleExtent = 0;
 
-    if ( d_data->scalePosition != QwtSlider::NoScale )
+    if ( m_data->scalePosition != QwtSlider::NoScale )
     {
         int d1, d2;
@@ -929,5 +943,5 @@
 
         int handleBorderDist;
-        if ( d_data->orientation == Qt::Horizontal )
+        if ( m_data->orientation == Qt::Horizontal )
             handleBorderDist = handleSize.width();
         else
@@ -941,6 +955,6 @@
         }
 
-        scaleExtent += d_data->spacing;
-        scaleExtent += qCeil( scaleDraw()->extent( font() ) );
+        scaleExtent += m_data->spacing;
+        scaleExtent += qwtCeil( scaleDraw()->extent( font() ) );
     }
 
@@ -950,5 +964,5 @@
     int h = 0;
 
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         w = sliderLength;
@@ -962,12 +976,11 @@
 
     // finally add margins
-    int left, right, top, bottom;
-    getContentsMargins( &left, &top, &right, &bottom );
-
-    w += left + right;
-    h += top + bottom;
-
-    d_data->sizeHintCache = QSize( w, h );
-    return d_data->sizeHintCache;
+    const QMargins m = contentsMargins();
+
+    w += m.left() + m.right();
+    h += m.top() + m.bottom();
+
+    m_data->sizeHintCache = QSize( w, h );
+    return m_data->sizeHintCache;
 }
 
@@ -982,6 +995,6 @@
     const int markerPos = transform( value() );
 
-    QPoint center = d_data->sliderRect.center();
-    if ( d_data->orientation == Qt::Horizontal )
+    QPoint center = m_data->sliderRect.center();
+    if ( m_data->orientation == Qt::Horizontal )
         center.setX( markerPos );
     else
@@ -989,6 +1002,6 @@
 
     QRect rect;
-    rect.setSize( qwtHandleSize( d_data->handleSize,
-        d_data->orientation, d_data->hasTrough ) );
+    rect.setSize( qwtHandleSize( m_data->handleSize,
+        m_data->orientation, m_data->hasTrough ) );
     rect.moveCenter( center );
 
@@ -997,8 +1010,10 @@
 
 /*!
- \return Bounding rectangle of the slider - without the scale
+   \return Bounding rectangle of the slider - without the scale
  */
 QRect QwtSlider::sliderRect() const
 {
-    return d_data->sliderRect;
-}
+    return m_data->sliderRect;
+}
+
+#include "moc_qwt_slider.cpp"
Index: /trunk/BNC/qwt/qwt_slider.h
===================================================================
--- /trunk/BNC/qwt/qwt_slider.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_slider.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -17,16 +17,16 @@
 
 /*!
-  \brief The Slider Widget
+   \brief The Slider Widget
 
-  QwtSlider is a slider widget which operates on an interval
-  of type double. Its position is related to a scale showing
-  the current value.
+   QwtSlider is a slider widget which operates on an interval
+   of type double. Its position is related to a scale showing
+   the current value.
 
-  The slider can be customized by having a through, a groove - or both.
+   The slider can be customized by having a through, a groove - or both.
 
-  \image html sliders.png
-*/
+   \image html sliders.png
+ */
 
-class QWT_EXPORT QwtSlider: public QwtAbstractSlider
+class QWT_EXPORT QwtSlider : public QwtAbstractSlider
 {
     Q_OBJECT
@@ -35,5 +35,5 @@
 
     Q_PROPERTY( Qt::Orientation orientation
-                READ orientation WRITE setOrientation )
+        READ orientation WRITE setOrientation )
     Q_PROPERTY( ScalePosition scalePosition READ scalePosition
         WRITE setScalePosition )
@@ -46,9 +46,9 @@
     Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
 
-public:
+  public:
 
     /*!
-      Position of the scale
-      \sa QwtSlider(), setScalePosition(), setOrientation()
+       Position of the scale
+       \sa QwtSlider(), setScalePosition(), setOrientation()
      */
     enum ScalePosition
@@ -64,6 +64,6 @@
     };
 
-    explicit QwtSlider( QWidget *parent = NULL );
-    explicit QwtSlider( Qt::Orientation, QWidget *parent = NULL );
+    explicit QwtSlider( QWidget* parent = NULL );
+    explicit QwtSlider( Qt::Orientation, QWidget* parent = NULL );
 
     virtual ~QwtSlider();
@@ -81,5 +81,5 @@
     bool hasGroove() const;
 
-    void setHandleSize( const QSize & );
+    void setHandleSize( const QSize& );
     QSize handleSize() const;
 
@@ -90,34 +90,36 @@
     int spacing() const;
 
-    virtual QSize sizeHint() const;
-    virtual QSize minimumSizeHint() const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
+    virtual QSize minimumSizeHint() const QWT_OVERRIDE;
 
-    void setScaleDraw( QwtScaleDraw * );
-    const QwtScaleDraw *scaleDraw() const;
+    void setScaleDraw( QwtScaleDraw* );
+    const QwtScaleDraw* scaleDraw() const;
 
     void setUpdateInterval( int );
     int updateInterval() const;
 
-protected:
-    virtual double scrolledTo( const QPoint & ) const;
-    virtual bool isScrollPosition( const QPoint & ) const;
+  protected:
+    virtual double scrolledTo( const QPoint& ) const QWT_OVERRIDE;
+    virtual bool isScrollPosition( const QPoint& ) const QWT_OVERRIDE;
 
-    virtual void drawSlider ( QPainter *, const QRect & ) const;
-    virtual void drawHandle( QPainter *, const QRect &, int pos ) const;
+    virtual void drawSlider ( QPainter*, const QRect& ) const;
+    virtual void drawHandle( QPainter*, const QRect&, int pos ) const;
 
-    virtual void mousePressEvent( QMouseEvent * );
-    virtual void mouseReleaseEvent( QMouseEvent * );
-    virtual void resizeEvent( QResizeEvent * );
-    virtual void paintEvent ( QPaintEvent * );
-    virtual void changeEvent( QEvent * );
-    virtual void timerEvent( QTimerEvent * );
+    virtual void mousePressEvent( QMouseEvent* ) QWT_OVERRIDE;
+    virtual void mouseReleaseEvent( QMouseEvent* ) QWT_OVERRIDE;
+    virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
+    virtual void paintEvent ( QPaintEvent* ) QWT_OVERRIDE;
+    virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
+    virtual void timerEvent( QTimerEvent* ) QWT_OVERRIDE;
 
-    virtual void scaleChange();
+    virtual bool event( QEvent* ) QWT_OVERRIDE;
+
+    virtual void scaleChange() QWT_OVERRIDE;
 
     QRect sliderRect() const;
     QRect handleRect() const;
 
-private:
-    QwtScaleDraw *scaleDraw();
+  private:
+    QwtScaleDraw* scaleDraw();
 
     void layoutSlider( bool );
@@ -125,5 +127,5 @@
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_spline.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_spline.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_spline.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,80 +9,536 @@
 
 #include "qwt_spline.h"
-#include "qwt_math.h"
+#include "qwt_spline_parametrization.h"
+#include "qwt_spline_polynomial.h"
+#include "qwt_bezier.h"
+
+#include <qpainterpath.h>
+
+namespace QwtSplineC1P
+{
+    struct param
+    {
+        param( const QwtSplineParametrization* p ):
+            parameter( p )
+        {
+        }
+
+        inline double operator()( const QPointF& p1, const QPointF& p2 ) const
+        {
+            return parameter->valueIncrement( p1, p2 );
+        }
+
+        const QwtSplineParametrization* parameter;
+    };
+
+    struct paramY
+    {
+        inline double operator()( const QPointF& p1, const QPointF& p2 ) const
+        {
+            return QwtSplineParametrization::valueIncrementY( p1, p2 );
+        }
+    };
+
+    struct paramUniform
+    {
+        inline double operator()( const QPointF& p1, const QPointF& p2 ) const
+        {
+            return QwtSplineParametrization::valueIncrementUniform( p1, p2 );
+        }
+    };
+
+    struct paramCentripetal
+    {
+        inline double operator()( const QPointF& p1, const QPointF& p2 ) const
+        {
+            return QwtSplineParametrization::valueIncrementCentripetal( p1, p2 );
+        }
+    };
+
+    struct paramChordal
+    {
+        inline double operator()( const QPointF& p1, const QPointF& p2 ) const
+        {
+            return QwtSplineParametrization::valueIncrementChordal( p1, p2 );
+        }
+    };
+
+    struct paramManhattan
+    {
+        inline double operator()( const QPointF& p1, const QPointF& p2 ) const
+        {
+            return QwtSplineParametrization::valueIncrementManhattan( p1, p2 );
+        }
+    };
+
+    class PathStore
+    {
+      public:
+        inline void init( int size )
+        {
+            Q_UNUSED(size);
+        }
+
+        inline void start( double x1, double y1 )
+        {
+            path.moveTo( x1, y1 );
+        }
+
+        inline void addCubic( double cx1, double cy1,
+            double cx2, double cy2, double x2, double y2 )
+        {
+            path.cubicTo( cx1, cy1, cx2, cy2, x2, y2 );
+        }
+
+        inline void end()
+        {
+            path.closeSubpath();
+        }
+
+        QPainterPath path;
+    };
+
+    class ControlPointsStore
+    {
+      public:
+        inline ControlPointsStore():
+            m_cp( NULL )
+        {
+        }
+
+        inline void init( int size )
+        {
+            controlPoints.resize( size );
+            m_cp = controlPoints.data();
+        }
+
+        inline void start( double x1, double y1 )
+        {
+            Q_UNUSED( x1 );
+            Q_UNUSED( y1 );
+        }
+
+        inline void addCubic( double cx1, double cy1,
+            double cx2, double cy2, double x2, double y2 )
+        {
+            Q_UNUSED( x2 );
+            Q_UNUSED( y2 );
+
+            QLineF& l = *m_cp++;
+            l.setLine( cx1, cy1, cx2, cy2 );
+        }
+
+        inline void end()
+        {
+        }
+
+        QVector< QLineF > controlPoints;
+
+      private:
+        QLineF* m_cp;
+    };
+
+    double slopeBoundary( int boundaryCondition, double boundaryValue,
+        const QPointF& p1, const QPointF& p2, double slope1 )
+    {
+        const double dx = p2.x() - p1.x();
+        const double dy = p2.y() - p1.y();
+
+        double m = 0.0;
+
+        switch( boundaryCondition )
+        {
+            case QwtSpline::Clamped1:
+            {
+                m = boundaryValue;
+                break;
+            }
+            case QwtSpline::Clamped2:
+            {
+                const double c2 = 0.5 * boundaryValue;
+                const double c1 = slope1;
+
+                m = 0.5 * ( 3.0 * dy / dx - c1 - c2 * dx );
+                break;
+            }
+            case QwtSpline::Clamped3:
+            {
+                const double c3 = boundaryValue / 6.0;
+                m = c3 * dx * dx + 2 * dy / dx - slope1;
+                break;
+            }
+            case QwtSpline::LinearRunout:
+            {
+                const double s = dy / dx;
+                const double r = qBound( 0.0, boundaryValue, 1.0 );
+
+                m = s - r * ( s - slope1 );
+                break;
+            }
+            default:
+            {
+                m = dy / dx; // something
+            }
+        }
+
+        return m;
+    }
+}
+
+template< class SplineStore >
+static inline SplineStore qwtSplineC1PathParamX(
+    const QwtSplineC1* spline, const QPolygonF& points )
+{
+    const int n = points.size();
+
+    const QVector< double > m = spline->slopes( points );
+    if ( m.size() != n )
+        return SplineStore();
+
+    const QPointF* pd = points.constData();
+    const double* md = m.constData();
+
+    SplineStore store;
+    store.init( m.size() - 1 );
+    store.start( pd[0].x(), pd[0].y() );
+
+    for ( int i = 0; i < n - 1; i++ )
+    {
+        const double dx3 = ( pd[i + 1].x() - pd[i].x() ) / 3.0;
+
+        store.addCubic( pd[i].x() + dx3, pd[i].y() + md[i] * dx3,
+            pd[i + 1].x() - dx3, pd[i + 1].y() - md[i + 1] * dx3,
+            pd[i + 1].x(), pd[i + 1].y() );
+    }
+
+    return store;
+}
+
+template< class SplineStore >
+static inline SplineStore qwtSplineC1PathParamY(
+    const QwtSplineC1* spline, const QPolygonF& points )
+{
+    const int n = points.size();
+
+    QPolygonF pointsFlipped( n );
+    for ( int i = 0; i < n; i++ )
+    {
+        pointsFlipped[i].setX( points[i].y() );
+        pointsFlipped[i].setY( points[i].x() );
+    }
+
+    const QVector< double > m = spline->slopes( pointsFlipped );
+    if ( m.size() != n )
+        return SplineStore();
+
+    const QPointF* pd = pointsFlipped.constData();
+    const double* md = m.constData();
+
+    SplineStore store;
+    store.init( m.size() - 1 );
+    store.start( pd[0].y(), pd[0].x() );
+
+    QVector< QLineF > lines( n );
+    for ( int i = 0; i < n - 1; i++ )
+    {
+        const double dx3 = ( pd[i + 1].x() - pd[i].x() ) / 3.0;
+
+        store.addCubic( pd[i].y() + md[i] * dx3, pd[i].x() + dx3,
+            pd[i + 1].y() - md[i + 1] * dx3, pd[i + 1].x() - dx3,
+            pd[i + 1].y(), pd[i + 1].x() );
+    }
+
+    return store;
+}
+
+template< class SplineStore, class Param >
+static inline SplineStore qwtSplineC1PathParametric(
+    const QwtSplineC1* spline, const QPolygonF& points, Param param )
+{
+    const bool isClosing = ( spline->boundaryType() == QwtSpline::ClosedPolygon );
+    const int n = points.size();
+
+    QPolygonF pointsX, pointsY;
+    pointsX.resize( isClosing ? n + 1 : n );
+    pointsY.resize( isClosing ? n + 1 : n );
+
+    QPointF* px = pointsX.data();
+    QPointF* py = pointsY.data();
+    const QPointF* p = points.constData();
+
+    double t = 0.0;
+
+    px[0].rx() = py[0].rx() = t;
+    px[0].ry() = p[0].x();
+    py[0].ry() = p[0].y();
+
+    int numParamPoints = 1;
+    for ( int i = 1; i < n; i++ )
+    {
+        const double td = param( points[i - 1], points[i] );
+        if ( td > 0.0 )
+        {
+            t += td;
+
+            px[numParamPoints].rx() = py[numParamPoints].rx() = t;
+
+            px[numParamPoints].ry() = p[i].x();
+            py[numParamPoints].ry() = p[i].y();
+
+            numParamPoints++;
+        }
+    }
+
+    if ( isClosing )
+    {
+        const double td = param( points[n - 1], points[0] );
+
+        if ( td > 0.0 )
+        {
+            t += td;
+
+            px[numParamPoints].rx() = py[numParamPoints].rx() = t;
+
+            px[numParamPoints].ry() = p[0].x();
+            py[numParamPoints].ry() = p[0].y();
+
+            numParamPoints++;
+        }
+    }
+
+    if ( pointsX.size() != numParamPoints )
+    {
+        pointsX.resize( numParamPoints );
+        pointsY.resize( numParamPoints );
+    }
+
+    const QVector< double > slopesX = spline->slopes( pointsX );
+    const QVector< double > slopesY = spline->slopes( pointsY );
+
+    const double* mx = slopesX.constData();
+    const double* my = slopesY.constData();
+
+    // we don't need it anymore
+    pointsX.clear();
+    pointsY.clear();
+
+    SplineStore store;
+    store.init( isClosing ? n : n - 1 );
+    store.start( points[0].x(), points[0].y() );
+
+    int j = 0;
+
+    for ( int i = 0; i < n - 1; i++ )
+    {
+        const QPointF& p1 = p[i];
+        const QPointF& p2 = p[i + 1];
+
+        const double td = param( p1, p2 );
+
+        if ( td != 0.0 )
+        {
+            const double t3 = td / 3.0;
+
+            const double cx1 = p1.x() + mx[j] * t3;
+            const double cy1 = p1.y() + my[j] * t3;
+
+            const double cx2 = p2.x() - mx[j + 1] * t3;
+            const double cy2 = p2.y() - my[j + 1] * t3;
+
+            store.addCubic( cx1, cy1, cx2, cy2, p2.x(), p2.y() );
+
+            j++;
+        }
+        else
+        {
+            // setting control points to the ends
+            store.addCubic( p1.x(), p1.y(), p2.x(), p2.y(), p2.x(), p2.y() );
+        }
+    }
+
+    if ( isClosing )
+    {
+        const QPointF& p1 = p[n - 1];
+        const QPointF& p2 = p[0];
+
+        const double td = param( p1, p2 );
+
+        if ( td != 0.0 )
+        {
+            const double t3 = td / 3.0;
+
+            const double cx1 = p1.x() + mx[j] * t3;
+            const double cy1 = p1.y() + my[j] * t3;
+
+            const double cx2 = p2.x() - mx[0] * t3;
+            const double cy2 = p2.y() - my[0] * t3;
+
+            store.addCubic( cx1, cy1, cx2, cy2, p2.x(), p2.y() );
+        }
+        else
+        {
+            store.addCubic( p1.x(), p1.y(), p2.x(), p2.y(), p2.x(), p2.y() );
+        }
+
+        store.end();
+    }
+
+    return store;
+}
+
+template< QwtSplinePolynomial toPolynomial( const QPointF&, double, const QPointF&, double ) >
+static QPolygonF qwtPolygonParametric( double distance,
+    const QPolygonF& points, const QVector< double >& values, bool withNodes )
+{
+    QPolygonF fittedPoints;
+
+    const QPointF* p = points.constData();
+    const double* v = values.constData();
+
+    fittedPoints += p[0];
+    double t = distance;
+
+    const int n = points.size();
+
+    for ( int i = 0; i < n - 1; i++ )
+    {
+        const QPointF& p1 = p[i];
+        const QPointF& p2 = p[i + 1];
+
+        const QwtSplinePolynomial polynomial = toPolynomial( p1, v[i], p2, v[i + 1] );
+
+        const double l = p2.x() - p1.x();
+
+        while ( t < l )
+        {
+            fittedPoints += QPointF( p1.x() + t, p1.y() + polynomial.valueAt( t ) );
+            t += distance;
+        }
+
+        if ( withNodes )
+        {
+            if ( qFuzzyCompare( fittedPoints.last().x(), p2.x() ) )
+                fittedPoints.last() = p2;
+            else
+                fittedPoints += p2;
+        }
+        else
+        {
+            t -= l;
+        }
+    }
+
+    return fittedPoints;
+}
 
 class QwtSpline::PrivateData
 {
-public:
-    PrivateData():
-        splineType( QwtSpline::Natural )
-    {
-    }
-
-    QwtSpline::SplineType splineType;
-
-    // coefficient vectors
-    QVector<double> a;
-    QVector<double> b;
-    QVector<double> c;
-
-    // control points
-    QPolygonF points;
+  public:
+    PrivateData()
+        : boundaryType( QwtSpline::ConditionalBoundaries )
+    {
+        parametrization = new QwtSplineParametrization(
+            QwtSplineParametrization::ParameterChordal );
+
+        // parabolic runout at both ends
+
+        boundaryConditions[0].type = QwtSpline::Clamped3;
+        boundaryConditions[0].value = 0.0;
+
+        boundaryConditions[1].type = QwtSpline::Clamped3;
+        boundaryConditions[1].value = 0.0;
+    }
+
+    ~PrivateData()
+    {
+        delete parametrization;
+    }
+
+    QwtSplineParametrization* parametrization;
+    QwtSpline::BoundaryType boundaryType;
+
+    struct
+    {
+        int type;
+        double value;
+
+    } boundaryConditions[2];
 };
 
-static int lookup( double x, const QPolygonF &values )
-{
-#if 0
-//qLowerBound/qHigherBound ???
-#endif
-    int i1;
-    const int size = values.size();
-
-    if ( x <= values[0].x() )
-        i1 = 0;
-    else if ( x >= values[size - 2].x() )
-        i1 = size - 2;
-    else
-    {
-        i1 = 0;
-        int i2 = size - 2;
-        int i3 = 0;
-
-        while ( i2 - i1 > 1 )
-        {
-            i3 = i1 + ( ( i2 - i1 ) >> 1 );
-
-            if ( values[i3].x() > x )
-                i2 = i3;
-            else
-                i1 = i3;
-        }
-    }
-    return i1;
-}
-
-//! Constructor
+/*!
+   \fn QPainterPath QwtSpline::painterPath( const QPolygonF &points ) const
+
+   Approximates a polygon piecewise with cubic Bezier curves
+   and returns them as QPainterPath.
+
+   \param points Control points
+   \return Painter path, that can be rendered by QPainter
+
+   \sa polygon(), QwtBezier
+ */
+
+/*!
+   \brief Interpolate a curve by a polygon
+
+   Interpolates a polygon piecewise with Bezier curves
+   interpolating them in a 2nd pass by polygons.
+
+   The interpolation is based on "Piecewise Linear Approximation of Bézier Curves"
+   by Roger Willcocks ( http://www.rops.org )
+
+   \param points Control points
+   \param tolerance Maximum for the accepted error of the approximation
+
+   \return polygon approximating the interpolating polynomials
+
+   \sa bezierControlLines(), QwtBezier
+ */
+QPolygonF QwtSpline::polygon( const QPolygonF& points, double tolerance ) const
+{
+    if ( tolerance <= 0.0 )
+        return QPolygonF();
+
+    const QPainterPath path = painterPath( points );
+    const int n = path.elementCount();
+    if ( n == 0 )
+        return QPolygonF();
+
+    const QPainterPath::Element el = path.elementAt( 0 );
+    if ( el.type != QPainterPath::MoveToElement )
+        return QPolygonF();
+
+    QPointF p1( el.x, el.y );
+
+    QPolygonF polygon;
+    QwtBezier bezier( tolerance );
+
+    for ( int i = 1; i < n; i += 3 )
+    {
+        const QPainterPath::Element el1 = path.elementAt( i );
+        const QPainterPath::Element el2 = path.elementAt( i + 1 );
+        const QPainterPath::Element el3 = path.elementAt( i + 2 );
+
+        const QPointF cp1( el1.x, el1.y );
+        const QPointF cp2( el2.x, el2.y );
+        const QPointF p2( el3.x, el3.y );
+
+        bezier.appendToPolygon( p1, cp1, cp2, p2, polygon );
+
+        p1 = p2;
+    }
+
+    return polygon;
+}
+
+/*!
+   \brief Constructor
+
+   The default setting is a non closing spline with chordal parametrization
+
+   \sa setParametrization(), setBoundaryType()
+ */
 QwtSpline::QwtSpline()
 {
-    d_data = new PrivateData;
-}
-
-/*!
-   Copy constructor
-   \param other Spline used for initialization
-*/
-QwtSpline::QwtSpline( const QwtSpline& other )
-{
-    d_data = new PrivateData( *other.d_data );
-}
-
-/*!
-   Assignment operator
-   \param other Spline used for initialization
-   \return *this
-*/
-QwtSpline &QwtSpline::operator=( const QwtSpline & other )
-{
-    *d_data = *other.d_data;
-    return *this;
+    m_data = new PrivateData;
 }
 
@@ -90,295 +546,856 @@
 QwtSpline::~QwtSpline()
 {
-    delete d_data;
-}
-
-/*!
-   Select the algorithm used for calculating the spline
-
-   \param splineType Spline type
-   \sa splineType()
-*/
-void QwtSpline::setSplineType( SplineType splineType )
-{
-    d_data->splineType = splineType;
-}
-
-/*!
-   \return the spline type
-   \sa setSplineType()
-*/
-QwtSpline::SplineType QwtSpline::splineType() const
-{
-    return d_data->splineType;
-}
-
-/*!
-  \brief Calculate the spline coefficients
-
-  Depending on the value of \a periodic, this function
-  will determine the coefficients for a natural or a periodic
-  spline and store them internally.
-
-  \param points Points
-  \return true if successful
-  \warning The sequence of x (but not y) values has to be strictly monotone
-           increasing, which means <code>points[i].x() < points[i+1].x()</code>.
-       If this is not the case, the function will return false
-*/
-bool QwtSpline::setPoints( const QPolygonF& points )
-{
-    const int size = points.size();
-    if ( size <= 2 )
-    {
-        reset();
-        return false;
-    }
-
-    d_data->points = points;
-
-    d_data->a.resize( size - 1 );
-    d_data->b.resize( size - 1 );
-    d_data->c.resize( size - 1 );
-
-    bool ok;
-    if ( d_data->splineType == Periodic )
-        ok = buildPeriodicSpline( points );
-    else
-        ok = buildNaturalSpline( points );
-
-    if ( !ok )
-        reset();
-
-    return ok;
-}
-
-/*!
-   \return Points, that have been by setPoints()
-*/
-QPolygonF QwtSpline::points() const
-{
-    return d_data->points;
-}
-
-//! \return A coefficients
-const QVector<double> &QwtSpline::coefficientsA() const
-{
-    return d_data->a;
-}
-
-//! \return B coefficients
-const QVector<double> &QwtSpline::coefficientsB() const
-{
-    return d_data->b;
-}
-
-//! \return C coefficients
-const QVector<double> &QwtSpline::coefficientsC() const
-{
-    return d_data->c;
-}
-
-
-//! Free allocated memory and set size to 0
-void QwtSpline::reset()
-{
-    d_data->a.resize( 0 );
-    d_data->b.resize( 0 );
-    d_data->c.resize( 0 );
-    d_data->points.resize( 0 );
-}
-
-//! True if valid
-bool QwtSpline::isValid() const
-{
-    return d_data->a.size() > 0;
-}
-
-/*!
-  Calculate the interpolated function value corresponding
-  to a given argument x.
-
-  \param x Coordinate
-  \return Interpolated coordinate
-*/
-double QwtSpline::value( double x ) const
-{
-    if ( d_data->a.size() == 0 )
+    delete m_data;
+}
+
+/*!
+   The locality of an spline interpolation identifies how many adjacent
+   polynomials are affected, when changing the position of one point.
+
+   A locality of 'n' means, that changing the coordinates of a point
+   has an effect on 'n' leading and 'n' following polynomials.
+   Those polynomials can be calculated from a local subpolygon.
+
+   A value of 0 means, that the interpolation is not local and any modification
+   of the polygon requires to recalculate all polynomials ( f.e cubic splines ).
+
+   \return Order of locality
+ */
+uint QwtSpline::locality() const
+{
+    return 0;
+}
+
+/*!
+   Define the parametrization for a parametric spline approximation
+   The default setting is a chordal parametrization.
+
+   \param type Type of parametrization, usually one of QwtSplineParametrization::Type
+   \sa parametrization()
+ */
+void QwtSpline::setParametrization( int type )
+{
+    if ( m_data->parametrization->type() != type )
+    {
+        delete m_data->parametrization;
+        m_data->parametrization = new QwtSplineParametrization( type );
+    }
+}
+
+/*!
+   Define the parametrization for a parametric spline approximation
+   The default setting is a chordal parametrization.
+
+   \param parametrization Parametrization
+   \sa parametrization()
+ */
+void QwtSpline::setParametrization( QwtSplineParametrization* parametrization )
+{
+    if ( ( parametrization != NULL ) && ( m_data->parametrization != parametrization ) )
+    {
+        delete m_data->parametrization;
+        m_data->parametrization = parametrization;
+    }
+}
+
+/*!
+   \return parametrization
+   \sa setParametrization()
+ */
+const QwtSplineParametrization* QwtSpline::parametrization() const
+{
+    return m_data->parametrization;
+}
+
+/*!
+   Define the boundary type for the endpoints of the approximating
+   spline.
+
+   \param boundaryType Boundary type
+   \sa boundaryType()
+ */
+void QwtSpline::setBoundaryType( BoundaryType boundaryType )
+{
+    m_data->boundaryType = boundaryType;
+}
+
+/*!
+   \return Boundary type
+   \sa setBoundaryType()
+ */
+QwtSpline::BoundaryType QwtSpline::boundaryType() const
+{
+    return m_data->boundaryType;
+}
+
+/*!
+   \brief Define the condition for an endpoint of the spline
+
+   \param position At the beginning or the end of the spline
+   \param condition Condition
+
+   \sa BoundaryCondition, QwtSplineC2::BoundaryCondition, boundaryCondition()
+ */
+void QwtSpline::setBoundaryCondition( BoundaryPosition position, int condition )
+{
+    if ( ( position == QwtSpline::AtBeginning ) || ( position == QwtSpline::AtEnd ) )
+        m_data->boundaryConditions[position].type = condition;
+}
+
+/*!
+   \return Condition for an endpoint of the spline
+   \param position At the beginning or the end of the spline
+
+   \sa setBoundaryCondition(), boundaryValue(), setBoundaryConditions()
+ */
+int QwtSpline::boundaryCondition( BoundaryPosition position ) const
+{
+    if ( ( position == QwtSpline::AtBeginning ) || ( position == QwtSpline::AtEnd ) )
+        return m_data->boundaryConditions[position].type;
+
+    return m_data->boundaryConditions[0].type; // should never happen
+}
+
+/*!
+   \brief Define the boundary value
+
+   The boundary value is an parameter used in combination with
+   the boundary condition. Its meaning depends on the condition.
+
+   \param position At the beginning or the end of the spline
+   \param value Value used for the condition at the end point
+
+   \sa boundaryValue(), setBoundaryCondition()
+ */
+void QwtSpline::setBoundaryValue( BoundaryPosition position, double value )
+{
+    if ( ( position == QwtSpline::AtBeginning ) || ( position == QwtSpline::AtEnd ) )
+        m_data->boundaryConditions[position].value = value;
+}
+
+/*!
+   \return Boundary value
+   \param position At the beginning or the end of the spline
+
+   \sa setBoundaryValue(), boundaryCondition()
+ */
+double QwtSpline::boundaryValue( BoundaryPosition position ) const
+{
+    if ( ( position == QwtSpline::AtBeginning ) || ( position == QwtSpline::AtEnd ) )
+        return m_data->boundaryConditions[position].value;
+
+    return m_data->boundaryConditions[0].value; // should never happen
+}
+
+/*!
+   \brief Define the condition at the endpoints of a spline
+
+   \param condition Condition
+   \param valueBegin Used for the condition at the beginning of te spline
+   \param valueEnd Used for the condition at the end of te spline
+
+   \sa BoundaryCondition, QwtSplineC2::BoundaryCondition,
+      testBoundaryCondition(), setBoundaryValue()
+ */
+void QwtSpline::setBoundaryConditions(
+    int condition, double valueBegin, double valueEnd )
+{
+    setBoundaryCondition( QwtSpline::AtBeginning, condition );
+    setBoundaryValue( QwtSpline::AtBeginning, valueBegin );
+
+    setBoundaryCondition( QwtSpline::AtEnd, condition );
+    setBoundaryValue( QwtSpline::AtEnd, valueEnd );
+}
+
+//! \brief Constructor
+QwtSplineInterpolating::QwtSplineInterpolating()
+{
+}
+
+//! Destructor
+QwtSplineInterpolating::~QwtSplineInterpolating()
+{
+}
+
+/*! \fn QVector<QLineF> QwtSplineInterpolating::bezierControlLines( const QPolygonF &points ) const
+
+   \brief Interpolate a curve with Bezier curves
+
+   Interpolates a polygon piecewise with cubic Bezier curves
+   and returns the 2 control points of each curve as QLineF.
+
+   \param points Control points
+   \return Control points of the interpolating Bezier curves
+ */
+
+/*!
+   \brief Interpolate a curve with Bezier curves
+
+   Interpolates a polygon piecewise with cubic Bezier curves
+   and returns them as QPainterPath.
+
+   The implementation calculates the Bezier control lines first
+   and converts them into painter path elements in an additional loop.
+
+   \param points Control points
+   \return Painter path, that can be rendered by QPainter
+
+   \note Derived spline classes might overload painterPath() to avoid
+        the extra loops for converting results into a QPainterPath
+
+   \sa bezierControlLines()
+ */
+QPainterPath QwtSplineInterpolating::painterPath( const QPolygonF& points ) const
+{
+    const int n = points.size();
+
+    QPainterPath path;
+    if ( n == 0 )
+        return path;
+
+    if ( n == 1 )
+    {
+        path.moveTo( points[0] );
+        return path;
+    }
+
+    if ( n == 2 )
+    {
+        path.addPolygon( points );
+        return path;
+    }
+
+    const QVector< QLineF > controlLines = bezierControlLines( points );
+    if ( controlLines.size() < n - 1 )
+        return path;
+
+    const QPointF* p = points.constData();
+    const QLineF* l = controlLines.constData();
+
+    path.moveTo( p[0] );
+    for ( int i = 0; i < n - 1; i++ )
+        path.cubicTo( l[i].p1(), l[i].p2(), p[i + 1] );
+
+    if ( ( boundaryType() == QwtSpline::ClosedPolygon )
+        && ( controlLines.size() >= n ) )
+    {
+        path.cubicTo( l[n - 1].p1(), l[n - 1].p2(), p[0] );
+        path.closeSubpath();
+    }
+
+    return path;
+}
+
+/*!
+   \brief Interpolate a curve by a polygon
+
+   Interpolates a polygon piecewise with Bezier curves
+   approximating them by polygons.
+
+   The approximation is based on "Piecewise Linear Approximation of Bézier Curves"
+   by Roger Willcocks ( http://www.rops.org )
+
+   \param points Control points
+   \param tolerance Maximum for the accepted error of the approximation
+
+   \return polygon approximating the interpolating polynomials
+
+   \sa bezierControlLines(), QwtSplineBezier::toPolygon()
+ */
+QPolygonF QwtSplineInterpolating::polygon(
+    const QPolygonF& points, double tolerance ) const
+{
+    if ( tolerance <= 0.0 )
+        return QPolygonF();
+
+    const QVector< QLineF > controlLines = bezierControlLines( points );
+    if ( controlLines.isEmpty() )
+        return QPolygonF();
+
+    const bool isClosed = boundaryType() == QwtSpline::ClosedPolygon;
+
+    QwtBezier bezier( tolerance );
+
+    const QPointF* p = points.constData();
+    const QLineF* cl = controlLines.constData();
+
+    const int n = controlLines.size();
+
+    QPolygonF polygon;
+
+    for ( int i = 0; i < n - 1; i++ )
+    {
+        const QLineF& l = cl[i];
+        bezier.appendToPolygon( p[i], l.p1(), l.p2(), p[i + 1], polygon );
+    }
+
+    const QPointF& pn = isClosed ? p[0] : p[n];
+    const QLineF& l = cl[n - 1];
+
+    bezier.appendToPolygon( p[n - 1], l.p1(), l.p2(), pn, polygon );
+
+    return polygon;
+}
+
+/*!
+   \brief Find an interpolated polygon with "equidistant" points
+
+   When withNodes is disabled all points of the resulting polygon
+   will be equidistant according to the parametrization.
+
+   When withNodes is enabled the resulting polygon will also include
+   the control points and the interpolated points are always aligned to
+   the control point before ( points[i] + i * distance ).
+
+   The implementation calculates bezier curves first and calculates
+   the interpolated points in a second run.
+
+   \param points Control nodes of the spline
+   \param distance Distance between 2 points according
+                  to the parametrization
+   \param withNodes When true, also add the control
+                   nodes ( even if not being equidistant )
+
+   \return Interpolating polygon
+
+   \sa bezierControlLines()
+ */
+QPolygonF QwtSplineInterpolating::equidistantPolygon( const QPolygonF& points,
+    double distance, bool withNodes ) const
+{
+    if ( distance <= 0.0 )
+        return QPolygonF();
+
+    const int n = points.size();
+    if ( n <= 1 )
+        return points;
+
+    if ( n == 2 )
+    {
+        // TODO
+        return points;
+    }
+
+    QPolygonF path;
+
+    const QVector< QLineF > controlLines = bezierControlLines( points );
+
+    if ( controlLines.size() < n - 1 )
+        return path;
+
+    path += points.first();
+    double t = distance;
+
+    const QPointF* p = points.constData();
+    const QLineF* cl = controlLines.constData();
+
+    const QwtSplineParametrization* param = parametrization();
+
+    for ( int i = 0; i < n - 1; i++ )
+    {
+        const double l = param->valueIncrement( p[i], p[i + 1] );
+
+        while ( t < l )
+        {
+            path += QwtBezier::pointAt( p[i], cl[i].p1(),
+                cl[i].p2(), p[i + 1], t / l );
+
+            t += distance;
+        }
+
+        if ( withNodes )
+        {
+            if ( qFuzzyCompare( path.last().x(), p[i + 1].x() ) )
+                path.last() = p[i + 1];
+            else
+                path += p[i + 1];
+
+            t = distance;
+        }
+        else
+        {
+            t -= l;
+        }
+    }
+
+    if ( ( boundaryType() == QwtSpline::ClosedPolygon )
+        && ( controlLines.size() >= n ) )
+    {
+        const double l = param->valueIncrement( p[n - 1], p[0] );
+
+        while ( t < l )
+        {
+            path += QwtBezier::pointAt( p[n - 1], cl[n - 1].p1(),
+                cl[n - 1].p2(), p[0], t / l );
+
+            t += distance;
+        }
+
+        if ( qFuzzyCompare( path.last().x(), p[0].x() ) )
+            path.last() = p[0];
+        else
+            path += p[0];
+    }
+
+    return path;
+}
+
+//! Constructor
+QwtSplineG1::QwtSplineG1()
+{
+}
+
+//! Destructor
+QwtSplineG1::~QwtSplineG1()
+{
+}
+
+/*!
+   \brief Constructor
+
+   The default setting is a non closing spline with no parametrization
+   ( QwtSplineParametrization::ParameterX ).
+
+   \sa QwtSpline::setParametrization(),
+      QwtSpline::setBoundaryType()
+ */
+QwtSplineC1::QwtSplineC1()
+{
+    setParametrization( QwtSplineParametrization::ParameterX );
+}
+
+//! Destructor
+QwtSplineC1::~QwtSplineC1()
+{
+}
+
+/*!
+   \param points Control points
+   \param slopeNext Value of the first derivative at the second point
+
+   \return value of the first derivative at the first point
+   \sa slopeAtEnd(), QwtSpline::boundaryCondition(), QwtSpline::boundaryValue()
+ */
+double QwtSplineC1::slopeAtBeginning( const QPolygonF& points, double slopeNext ) const
+{
+    if ( points.size() < 2 )
         return 0.0;
 
-    const int i = lookup( x, d_data->points );
-
-    const double delta = x - d_data->points[i].x();
-    return( ( ( ( d_data->a[i] * delta ) + d_data->b[i] )
-        * delta + d_data->c[i] ) * delta + d_data->points[i].y() );
-}
-
-/*!
-  \brief Determines the coefficients for a natural spline
-  \return true if successful
-*/
-bool QwtSpline::buildNaturalSpline( const QPolygonF &points )
-{
-    int i;
-
-    const QPointF *p = points.data();
-    const int size = points.size();
-
-    double *a = d_data->a.data();
-    double *b = d_data->b.data();
-    double *c = d_data->c.data();
-
-    //  set up tridiagonal equation system; use coefficient
-    //  vectors as temporary buffers
-    QVector<double> h( size - 1 );
-    for ( i = 0; i < size - 1; i++ )
-    {
-        h[i] = p[i+1].x() - p[i].x();
-        if ( h[i] <= 0 )
-            return false;
-    }
-
-    QVector<double> d( size - 1 );
-    double dy1 = ( p[1].y() - p[0].y() ) / h[0];
-    for ( i = 1; i < size - 1; i++ )
-    {
-        b[i] = c[i] = h[i];
-        a[i] = 2.0 * ( h[i-1] + h[i] );
-
-        const double dy2 = ( p[i+1].y() - p[i].y() ) / h[i];
-        d[i] = 6.0 * ( dy1 - dy2 );
-        dy1 = dy2;
-    }
-
-    //
-    // solve it
-    //
-
-    // L-U Factorization
-    for ( i = 1; i < size - 2; i++ )
-    {
-        c[i] /= a[i];
-        a[i+1] -= b[i] * c[i];
-    }
-
-    // forward elimination
-    QVector<double> s( size );
-    s[1] = d[1];
-    for ( i = 2; i < size - 1; i++ )
-        s[i] = d[i] - c[i-1] * s[i-1];
-
-    // backward elimination
-    s[size - 2] = - s[size - 2] / a[size - 2];
-    for ( i = size - 3; i > 0; i-- )
-        s[i] = - ( s[i] + b[i] * s[i+1] ) / a[i];
-    s[size - 1] = s[0] = 0.0;
-
-    //
-    // Finally, determine the spline coefficients
-    //
-    for ( i = 0; i < size - 1; i++ )
-    {
-        a[i] = ( s[i+1] - s[i] ) / ( 6.0 * h[i] );
-        b[i] = 0.5 * s[i];
-        c[i] = ( p[i+1].y() - p[i].y() ) / h[i]
-            - ( s[i+1] + 2.0 * s[i] ) * h[i] / 6.0;
-    }
-
-    return true;
-}
-
-/*!
-  \brief Determines the coefficients for a periodic spline
-  \return true if successful
-*/
-bool QwtSpline::buildPeriodicSpline( const QPolygonF &points )
-{
-    int i;
-
-    const QPointF *p = points.data();
-    const int size = points.size();
-
-    double *a = d_data->a.data();
-    double *b = d_data->b.data();
-    double *c = d_data->c.data();
-
-    QVector<double> d( size - 1 );
-    QVector<double> h( size - 1 );
-    QVector<double> s( size );
-
-    //
-    //  setup equation system; use coefficient
-    //  vectors as temporary buffers
-    //
-    for ( i = 0; i < size - 1; i++ )
-    {
-        h[i] = p[i+1].x() - p[i].x();
-        if ( h[i] <= 0.0 )
-            return false;
-    }
-
-    const int imax = size - 2;
-    double htmp = h[imax];
-    double dy1 = ( p[0].y() - p[imax].y() ) / htmp;
-    for ( i = 0; i <= imax; i++ )
-    {
-        b[i] = c[i] = h[i];
-        a[i] = 2.0 * ( htmp + h[i] );
-        const double dy2 = ( p[i+1].y() - p[i].y() ) / h[i];
-        d[i] = 6.0 * ( dy1 - dy2 );
-        dy1 = dy2;
-        htmp = h[i];
-    }
-
-    //
-    // solve it
-    //
-
-    // L-U Factorization
-    a[0] = qSqrt( a[0] );
-    c[0] = h[imax] / a[0];
-    double sum = 0;
-
-    for ( i = 0; i < imax - 1; i++ )
-    {
-        b[i] /= a[i];
-        if ( i > 0 )
-            c[i] = - c[i-1] * b[i-1] / a[i];
-        a[i+1] = qSqrt( a[i+1] - qwtSqr( b[i] ) );
-        sum += qwtSqr( c[i] );
-    }
-    b[imax-1] = ( b[imax-1] - c[imax-2] * b[imax-2] ) / a[imax-1];
-    a[imax] = qSqrt( a[imax] - qwtSqr( b[imax-1] ) - sum );
-
-
-    // forward elimination
-    s[0] = d[0] / a[0];
-    sum = 0;
-    for ( i = 1; i < imax; i++ )
-    {
-        s[i] = ( d[i] - b[i-1] * s[i-1] ) / a[i];
-        sum += c[i-1] * s[i-1];
-    }
-    s[imax] = ( d[imax] - b[imax-1] * s[imax-1] - sum ) / a[imax];
-
-
-    // backward elimination
-    s[imax] = - s[imax] / a[imax];
-    s[imax-1] = -( s[imax-1] + b[imax-1] * s[imax] ) / a[imax-1];
-    for ( i = imax - 2; i >= 0; i-- )
-        s[i] = - ( s[i] + b[i] * s[i+1] + c[i] * s[imax] ) / a[i];
-
-    //
-    // Finally, determine the spline coefficients
-    //
-    s[size-1] = s[0];
-    for ( i = 0; i < size - 1; i++ )
-    {
-        a[i] = ( s[i+1] - s[i] ) / ( 6.0 * h[i] );
-        b[i] = 0.5 * s[i];
-        c[i] = ( p[i+1].y() - p[i].y() )
-            / h[i] - ( s[i+1] + 2.0 * s[i] ) * h[i] / 6.0;
-    }
-
-    return true;
-}
+    return QwtSplineC1P::slopeBoundary(
+        boundaryCondition( QwtSpline::AtBeginning ),
+        boundaryValue( QwtSpline::AtBeginning ),
+        points[0], points[1], slopeNext );
+}
+
+/*!
+   \param points Control points
+   \param slopeBefore Value of the first derivative at the point before the last one
+
+   \return value of the first derivative at the last point
+   \sa slopeAtBeginning(), QwtSpline::boundaryCondition(), QwtSpline::boundaryValue()
+ */
+double QwtSplineC1::slopeAtEnd( const QPolygonF& points, double slopeBefore ) const
+{
+    const int n = points.size();
+
+    const QPointF p1( points[n - 1].x(), -points[n - 1].y() );
+    const QPointF p2( points[n - 2].x(), -points[n - 2].y() );
+
+    const int condition = boundaryCondition( QwtSpline::AtEnd );
+
+    double value = boundaryValue( QwtSpline::AtEnd );
+    if ( condition != QwtSpline::LinearRunout )
+    {
+        // beside LinearRunout the boundaryValue is a slope or curvature
+        // and needs to be inverted too
+        value = -value;
+    }
+
+    const double slope = QwtSplineC1P::slopeBoundary( condition, value, p1, p2, -slopeBefore );
+    return -slope;
+}
+
+/*! \fn QVector<double> QwtSplineC1::slopes( const QPolygonF &points ) const
+
+   \brief Find the first derivative at the control points
+
+   \param points Control nodes of the spline
+   \return Vector with the values of the 2nd derivate at the control points
+
+   \note The x coordinates need to be increasing or decreasing
+ */
+
+/*!
+   \brief Calculate an interpolated painter path
+
+   Interpolates a polygon piecewise into cubic Bezier curves
+   and returns them as QPainterPath.
+
+   The implementation calculates the slopes at the control points
+   and converts them into painter path elements in an additional loop.
+
+   \param points Control points
+   \return QPainterPath Painter path, that can be rendered by QPainter
+
+   \note Derived spline classes might overload painterPath() to avoid
+        the extra loops for converting results into a QPainterPath
+ */
+QPainterPath QwtSplineC1::painterPath( const QPolygonF& points ) const
+{
+    const int n = points.size();
+    if ( n <= 2 )
+        return QwtSplineInterpolating::painterPath( points );
+
+    using namespace QwtSplineC1P;
+
+    PathStore store;
+    switch( parametrization()->type() )
+    {
+        case QwtSplineParametrization::ParameterX:
+        {
+            store = qwtSplineC1PathParamX< PathStore >( this, points );
+            break;
+        }
+        case QwtSplineParametrization::ParameterY:
+        {
+            store = qwtSplineC1PathParamY< PathStore >( this, points );
+            break;
+        }
+        case QwtSplineParametrization::ParameterUniform:
+        {
+            store = qwtSplineC1PathParametric< PathStore >(
+                this, points, paramUniform() );
+            break;
+        }
+        case QwtSplineParametrization::ParameterCentripetal:
+        {
+            store = qwtSplineC1PathParametric< PathStore >(
+                this, points, paramCentripetal() );
+            break;
+        }
+        case QwtSplineParametrization::ParameterChordal:
+        {
+            store = qwtSplineC1PathParametric< PathStore >(
+                this, points, paramChordal() );
+            break;
+        }
+        default:
+        {
+            store = qwtSplineC1PathParametric< PathStore >(
+                this, points, param( parametrization() ) );
+        }
+    }
+
+    return store.path;
+}
+
+/*!
+   \brief Interpolate a curve with Bezier curves
+
+   Interpolates a polygon piecewise with cubic Bezier curves
+   and returns the 2 control points of each curve as QLineF.
+
+   \param points Control points
+   \return Control points of the interpolating Bezier curves
+ */
+QVector< QLineF > QwtSplineC1::bezierControlLines( const QPolygonF& points ) const
+{
+    using namespace QwtSplineC1P;
+
+    const int n = points.size();
+    if ( n <= 2 )
+        return QVector< QLineF >();
+
+    ControlPointsStore store;
+    switch( parametrization()->type() )
+    {
+        case QwtSplineParametrization::ParameterX:
+        {
+            store = qwtSplineC1PathParamX< ControlPointsStore >( this, points );
+            break;
+        }
+        case QwtSplineParametrization::ParameterY:
+        {
+            store = qwtSplineC1PathParamY< ControlPointsStore >( this, points );
+            break;
+        }
+        case QwtSplineParametrization::ParameterUniform:
+        {
+            store = qwtSplineC1PathParametric< ControlPointsStore >(
+                this, points, paramUniform() );
+            break;
+        }
+        case QwtSplineParametrization::ParameterCentripetal:
+        {
+            store = qwtSplineC1PathParametric< ControlPointsStore >(
+                this, points, paramCentripetal() );
+            break;
+        }
+        case QwtSplineParametrization::ParameterChordal:
+        {
+            store = qwtSplineC1PathParametric< ControlPointsStore >(
+                this, points, paramChordal() );
+            break;
+        }
+        default:
+        {
+            store = qwtSplineC1PathParametric< ControlPointsStore >(
+                this, points, param( parametrization() ) );
+        }
+    }
+
+    return store.controlPoints;
+}
+
+/*!
+   \brief Find an interpolated polygon with "equidistant" points
+
+   The implementation is optimzed for non parametric curves
+   ( QwtSplineParametrization::ParameterX ) and falls back to
+   QwtSpline::equidistantPolygon() otherwise.
+
+   \param points Control nodes of the spline
+   \param distance Distance between 2 points according
+                  to the parametrization
+   \param withNodes When true, also add the control
+                   nodes ( even if not being equidistant )
+
+   \return Interpolating polygon
+
+   \sa QwtSpline::equidistantPolygon()
+ */
+QPolygonF QwtSplineC1::equidistantPolygon( const QPolygonF& points,
+    double distance, bool withNodes ) const
+{
+    if ( parametrization()->type() == QwtSplineParametrization::ParameterX )
+    {
+        if ( points.size() > 2 )
+        {
+            const QVector< double > m = slopes( points );
+            if ( m.size() != points.size() )
+                return QPolygonF();
+
+            return qwtPolygonParametric< QwtSplinePolynomial::fromSlopes >(
+                distance, points, m, withNodes );
+        }
+    }
+
+    return QwtSplineInterpolating::equidistantPolygon( points, distance, withNodes );
+}
+
+/*!
+   \brief Calculate the interpolating polynomials for a non parametric spline
+
+   C1 spline interpolations are based on finding values for the first
+   derivates at the control points. The interpolating polynomials can
+   be calculated from the the first derivates using QwtSplinePolynomial::fromSlopes().
+
+   The default implementation is a two pass calculation. In derived classes it
+   might be overloaded by a one pass implementation.
+
+   \param points Control points
+   \return Interpolating polynomials
+
+   \note The x coordinates need to be increasing or decreasing
+ */
+QVector< QwtSplinePolynomial > QwtSplineC1::polynomials(
+    const QPolygonF& points ) const
+{
+    QVector< QwtSplinePolynomial > polynomials;
+
+    const QVector< double > m = slopes( points );
+    if ( m.size() < 2 )
+        return polynomials;
+
+    polynomials.reserve( m.size() - 1 );
+    for ( int i = 1; i < m.size(); i++ )
+    {
+        polynomials += QwtSplinePolynomial::fromSlopes(
+            points[i - 1], m[i - 1], points[i], m[i] );
+    }
+
+    return polynomials;
+}
+
+/*!
+   \brief Constructor
+
+   The default setting is a non closing spline with no parametrization
+   ( QwtSplineParametrization::ParameterX ).
+
+   \sa QwtSpline::setParametrization(), QwtSpline::setBoundaryType()
+ */
+QwtSplineC2::QwtSplineC2()
+{
+}
+
+//! Destructor
+QwtSplineC2::~QwtSplineC2()
+{
+}
+
+/*!
+   \brief Interpolate a curve with Bezier curves
+
+   Interpolates a polygon piecewise with cubic Bezier curves
+   and returns them as QPainterPath.
+
+   \param points Control points
+   \return Painter path, that can be rendered by QPainter
+
+   \note The implementation simply calls QwtSplineC1::painterPath(), but is
+        intended to be replaced by a one pass calculation some day.
+ */
+QPainterPath QwtSplineC2::painterPath( const QPolygonF& points ) const
+{
+    // could be implemented from curvatures without the extra
+    // loop for calculating the slopes vector. TODO ...
+
+    return QwtSplineC1::painterPath( points );
+}
+
+/*!
+   \brief Interpolate a curve with Bezier curves
+
+   Interpolates a polygon piecewise with cubic Bezier curves
+   and returns the 2 control points of each curve as QLineF.
+
+   \param points Control points
+   \return Control points of the interpolating Bezier curves
+
+   \note The implementation simply calls QwtSplineC1::bezierControlLines(),
+        but is intended to be replaced by a more efficient implementation
+        that builds the polynomials by the curvatures some day.
+ */
+QVector< QLineF > QwtSplineC2::bezierControlLines( const QPolygonF& points ) const
+{
+    // could be implemented from curvatures without the extra
+    // loop for calculating the slopes vector. TODO ...
+
+    return QwtSplineC1::bezierControlLines( points );
+}
+
+/*!
+   \brief Find an interpolated polygon with "equidistant" points
+
+   The implementation is optimzed for non parametric curves
+   ( QwtSplineParametrization::ParameterX ) and falls back to
+   QwtSpline::equidistantPolygon() otherwise.
+
+   \param points Control nodes of the spline
+   \param distance Distance between 2 points according
+                  to the parametrization
+   \param withNodes When true, also add the control
+                   nodes ( even if not being equidistant )
+
+   \return Interpolating polygon
+
+   \sa QwtSpline::equidistantPolygon()
+ */
+QPolygonF QwtSplineC2::equidistantPolygon( const QPolygonF& points,
+    double distance, bool withNodes ) const
+{
+    if ( parametrization()->type() == QwtSplineParametrization::ParameterX )
+    {
+        if ( points.size() > 2 )
+        {
+            const QVector< double > cv = curvatures( points );
+            if ( cv.size() != points.size() )
+                return QPolygonF();
+
+            return qwtPolygonParametric< QwtSplinePolynomial::fromCurvatures >(
+                distance, points, cv, withNodes );
+        }
+    }
+
+    return QwtSplineInterpolating::equidistantPolygon( points, distance, withNodes );
+}
+
+/*! \fn QVector<double> QwtSplineC2::curvatures( const QPolygonF &points ) const
+
+   \brief Find the second derivative at the control points
+
+   \param points Control nodes of the spline
+   \return Vector with the values of the 2nd derivate at the control points
+
+   \sa slopes()
+   \note The x coordinates need to be increasing or decreasing
+ */
+
+/*!
+   \brief Find the first derivative at the control points
+
+   An implementation calculating the 2nd derivatives and then building
+   the slopes in a 2nd loop. QwtSplineCubic overloads it with a more
+   performant implementation doing it in one loop.
+
+   \param points Control nodes of the spline
+   \return Vector with the values of the 1nd derivate at the control points
+
+   \sa curvatures()
+
+   \note The x coordinates need to be increasing or decreasing
+ */
+QVector< double > QwtSplineC2::slopes( const QPolygonF& points ) const
+{
+    const QVector< double > curvatures = this->curvatures( points );
+    if ( curvatures.size() < 2 )
+        return QVector< double >();
+
+    QVector< double > slopes( curvatures.size() );
+
+    const double* cv = curvatures.constData();
+    double* m = slopes.data();
+
+    const int n = points.size();
+    const QPointF* p = points.constData();
+
+    QwtSplinePolynomial polynomial;
+
+    for ( int i = 0; i < n - 1; i++ )
+    {
+        polynomial = QwtSplinePolynomial::fromCurvatures( p[i], cv[i], p[i + 1], cv[i + 1] );
+        m[i] = polynomial.c1;
+    }
+
+    m[n - 1] = polynomial.slopeAt( p[n - 1].x() - p[n - 2].x() );
+
+    return slopes;
+}
+
+/*!
+   \brief Calculate the interpolating polynomials for a non parametric spline
+
+   C2 spline interpolations are based on finding values for the second
+   derivates of f at the control points. The interpolating polynomials can
+   be calculated from the the second derivates using QwtSplinePolynomial::fromCurvatures.
+
+   The default implementation is a 2 pass calculation. In derived classes it
+   might be overloaded by a one pass implementation.
+
+   \param points Control points
+   \return Interpolating polynomials
+
+   \note The x coordinates need to be increasing or decreasing
+ */
+QVector< QwtSplinePolynomial > QwtSplineC2::polynomials( const QPolygonF& points ) const
+{
+    QVector< QwtSplinePolynomial > polynomials;
+
+    const QVector< double > curvatures = this->curvatures( points );
+    if ( curvatures.size() < 2 )
+        return polynomials;
+
+    const QPointF* p = points.constData();
+    const double* cv = curvatures.constData();
+    const int n = curvatures.size();
+    polynomials.reserve( n - 1 );
+
+    for ( int i = 1; i < n; i++ )
+    {
+        polynomials += QwtSplinePolynomial::fromCurvatures(
+            p[i - 1], cv[i - 1], p[i], cv[i] );
+    }
+
+    return polynomials;
+}
Index: /trunk/BNC/qwt/qwt_spline.h
===================================================================
--- /trunk/BNC/qwt/qwt_spline.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_spline.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,89 +12,298 @@
 
 #include "qwt_global.h"
-#include <qpolygon.h>
-#include <qvector.h>
-
-/*!
-  \brief A class for spline interpolation
-
-  The QwtSpline class is used for cubical spline interpolation.
-  Two types of splines, natural and periodic, are supported.
-
-  \par Usage:
-  <ol>
-  <li>First call setPoints() to determine the spline coefficients
-      for a tabulated function y(x).
-  <li>After the coefficients have been set up, the interpolated
-      function value for an argument x can be determined by calling
-      QwtSpline::value().
-  </ol>
-
-  \par Example:
-  \code
-#include <qwt_spline.h>
-
-QPolygonF interpolate(const QPolygonF& points, int numValues)
-{
-    QwtSpline spline;
-    if ( !spline.setPoints(points) )
-        return points;
-
-    QPolygonF interpolatedPoints(numValues);
-
-    const double delta =
-        (points[numPoints - 1].x() - points[0].x()) / (points.size() - 1);
-    for(i = 0; i < points.size(); i++)  / interpolate
+#include "qwt_spline.h"
+
+class QwtSplineParametrization;
+class QwtSplinePolynomial;
+class QPainterPath;
+class QLineF;
+class QPolygonF;
+
+#if QT_VERSION < 0x060000
+template< typename T > class QVector;
+#endif
+
+/*!
+   \brief Base class for all splines
+
+   A spline is a curve represented by a sequence of polynomials. Spline approximation
+   is the process of finding polynomials for a given set of points.
+   When the algorithm preserves the initial points it is called interpolating.
+
+   Splines can be classified according to conditions of the polynomials that
+   are met at the start/endpoints of the pieces:
+
+   - Geometric Continuity
+
+    - G0: polynomials are joined
+    - G1: first derivatives are proportional at the join point
+          The curve tangents thus have the same direction, but not necessarily the
+          same magnitude. i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c).
+    - G2: first and second derivatives are proportional at join point
+
+   - Parametric Continuity
+
+    - C0: curves are joined
+    - C1: first derivatives equal
+    - C2: first and second derivatives are equal
+
+   Geometric continuity requires the geometry to be continuous, while parametric
+   continuity requires that the underlying parameterization be continuous as well.
+   Parametric continuity of order n implies geometric continuity of order n,
+   but not vice-versa.
+
+   QwtSpline is the base class for spline approximations of any continuity.
+ */
+class QWT_EXPORT QwtSpline
+{
+  public:
+    /*!
+       Boundary type specifying the spline at its endpoints
+
+       \sa setBoundaryType(), boundaryType()
+     */
+    enum BoundaryType
     {
-        const double x = points[0].x() + i * delta;
-        interpolatedPoints[i].setX(x);
-        interpolatedPoints[i].setY(spline.value(x));
-    }
-    return interpolatedPoints;
-}
-  \endcode
-*/
-
-class QWT_EXPORT QwtSpline
-{
-public:
-    //! Spline type
-    enum SplineType
+        /*!
+           The polynomials at the start/endpoint depend on specific conditions
+
+           \sa QwtSpline::BoundaryCondition
+         */
+        ConditionalBoundaries,
+
+        /*!
+           The polynomials at the start/endpoint are found by using
+           imaginary additional points. Additional points at the end
+           are found by translating points from the beginning or v.v.
+         */
+        PeriodicPolygon,
+
+        /*!
+           ClosedPolygon is similar to PeriodicPolygon beside, that
+           the interpolation includes the connection between the last
+           and the first control point.
+
+           \note Only works for parametrizations, where the parameter increment
+                for the the final closing line is positive.
+                This excludes QwtSplineParametrization::ParameterX and
+                QwtSplineParametrization::ParameterY
+         */
+
+        ClosedPolygon
+    };
+
+    /*!
+       position of a boundary condition
+       \sa boundaryCondition(), boundaryValue()
+     */
+    enum BoundaryPosition
     {
-        //! A natural spline
-        Natural,
-
-        //! A periodic spline
-        Periodic
+        //! the condition is at the beginning of the polynomial
+        AtBeginning,
+
+        //! the condition is at the end of the polynomial
+        AtEnd
     };
 
+    /*!
+       \brief Boundary condition
+
+       A spline algorithm calculates polynomials by looking
+       a couple of points back/ahead ( locality() ). At the ends
+       additional rules are necessary to compensate the missing
+       points.
+
+       \sa boundaryCondition(), boundaryValue()
+       \sa QwtSplineC2::BoundaryConditionC2
+     */
+    enum BoundaryCondition
+    {
+        /*!
+           The first derivative at the end point is given
+           \sa boundaryValue()
+         */
+        Clamped1,
+
+        /*!
+           The second derivative at the end point is given
+
+           \sa boundaryValue()
+           \note a condition having a second derivative of 0
+                is also called "natural".
+         */
+        Clamped2,
+
+        /*!
+           The third derivative at the end point is given
+
+           \sa boundaryValue()
+           \note a condition having a third derivative of 0
+                is also called "parabolic runout".
+         */
+        Clamped3,
+
+        /*!
+           The first derivate at the endpoint is related to the first derivative
+           at its neighbour by the boundary value. F,e when the boundary
+           value at the end is 1.0 then the slope at the last 2 points is
+           the same.
+
+           \sa boundaryValue().
+         */
+        LinearRunout
+    };
+
     QwtSpline();
-    QwtSpline( const QwtSpline & );
-
-    ~QwtSpline();
-
-    QwtSpline &operator=( const QwtSpline & );
-
-    void setSplineType( SplineType );
-    SplineType splineType() const;
-
-    bool setPoints( const QPolygonF& points );
-    QPolygonF points() const;
-
-    void reset();
-
-    bool isValid() const;
-    double value( double x ) const;
-
-    const QVector<double> &coefficientsA() const;
-    const QVector<double> &coefficientsB() const;
-    const QVector<double> &coefficientsC() const;
-
-protected:
-    bool buildNaturalSpline( const QPolygonF & );
-    bool buildPeriodicSpline( const QPolygonF & );
-
-private:
+    virtual ~QwtSpline();
+
+    void setParametrization( int type );
+    void setParametrization( QwtSplineParametrization* );
+    const QwtSplineParametrization* parametrization() const;
+
+    void setBoundaryType( BoundaryType );
+    BoundaryType boundaryType() const;
+
+    void setBoundaryValue( BoundaryPosition, double value );
+    double boundaryValue( BoundaryPosition ) const;
+
+    void setBoundaryCondition( BoundaryPosition, int condition );
+    int boundaryCondition( BoundaryPosition ) const;
+
+    void setBoundaryConditions( int condition,
+        double valueBegin = 0.0, double valueEnd = 0.0 );
+
+    virtual QPolygonF polygon( const QPolygonF&, double tolerance ) const;
+    virtual QPainterPath painterPath( const QPolygonF& ) const = 0;
+
+    virtual uint locality() const;
+
+  private:
+    Q_DISABLE_COPY(QwtSpline)
+
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
+};
+
+/*!
+   \brief Base class for a spline interpolation
+
+   Spline interpolation is the process of interpolating a set of points
+   piecewise with polynomials. The initial set of points is preserved.
+ */
+class QWT_EXPORT QwtSplineInterpolating : public QwtSpline
+{
+  public:
+    QwtSplineInterpolating();
+    virtual ~QwtSplineInterpolating();
+
+    virtual QPolygonF equidistantPolygon( const QPolygonF&,
+        double distance, bool withNodes ) const;
+
+    virtual QPolygonF polygon(
+        const QPolygonF&, double tolerance ) const QWT_OVERRIDE;
+
+    virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const = 0;
+
+  private:
+    Q_DISABLE_COPY(QwtSplineInterpolating)
+};
+
+/*!
+   \brief Base class for spline interpolations providing a
+         first order geometric continuity ( G1 ) between adjoining curves
+ */
+class QWT_EXPORT QwtSplineG1 : public QwtSplineInterpolating
+{
+  public:
+    QwtSplineG1();
+    virtual ~QwtSplineG1();
+};
+
+/*!
+   \brief Base class for spline interpolations providing a
+         first order parametric continuity ( C1 ) between adjoining curves
+
+   All interpolations with C1 continuity are based on rules for finding
+   the 1. derivate at some control points.
+
+   In case of non parametric splines those points are the curve points, while
+   for parametric splines the calculation is done twice using a parameter value t.
+
+   \sa QwtSplineParametrization
+ */
+class QWT_EXPORT QwtSplineC1 : public QwtSplineG1
+{
+  public:
+    QwtSplineC1();
+    virtual ~QwtSplineC1();
+
+    virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const QWT_OVERRIDE;
+
+    virtual QPolygonF equidistantPolygon( const QPolygonF&,
+        double distance, bool withNodes ) const QWT_OVERRIDE;
+
+    // these methods are the non parametric part
+    virtual QVector< QwtSplinePolynomial > polynomials( const QPolygonF& ) const;
+    virtual QVector< double > slopes( const QPolygonF& ) const = 0;
+
+    virtual double slopeAtBeginning( const QPolygonF&, double slopeNext ) const;
+    virtual double slopeAtEnd( const QPolygonF&, double slopeBefore ) const;
+};
+
+/*!
+   \brief Base class for spline interpolations providing a
+         second order parametric continuity ( C2 ) between adjoining curves
+
+   All interpolations with C2 continuity are based on rules for finding
+   the 2. derivate at some control points.
+
+   In case of non parametric splines those points are the curve points, while
+   for parametric splines the calculation is done twice using a parameter value t.
+
+   \sa QwtSplineParametrization
+ */
+class QWT_EXPORT QwtSplineC2 : public QwtSplineC1
+{
+  public:
+    /*!
+       Boundary condition that requires C2 continuity
+
+       \sa QwtSpline::boundaryCondition, QwtSpline::BoundaryCondition
+     */
+    enum BoundaryConditionC2
+    {
+        /*!
+           The second derivate at the endpoint is related to the second derivatives
+           at the 2 neighbours: cv[0] := 2.0 * cv[1] - cv[2].
+
+           \note boundaryValue() is ignored
+         */
+        CubicRunout = LinearRunout + 1,
+
+        /*!
+           The 3rd derivate at the endpoint matches the 3rd derivate at its neighbours.
+           Or in other words: the first/last curve segment extents the polynomial of its
+           neighboured polynomial
+
+           \note boundaryValue() is ignored
+         */
+        NotAKnot
+    };
+
+    QwtSplineC2();
+    virtual ~QwtSplineC2();
+
+    virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const QWT_OVERRIDE;
+
+    virtual QPolygonF equidistantPolygon( const QPolygonF&,
+        double distance, bool withNodes ) const QWT_OVERRIDE;
+
+    // calculating the parametric equations
+    virtual QVector< QwtSplinePolynomial > polynomials( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QVector< double > slopes( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QVector< double > curvatures( const QPolygonF& ) const = 0;
 };
 
Index: /trunk/BNC/qwt/qwt_spline_basis.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_spline_basis.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_basis.cpp	(revision 11158)
@@ -0,0 +1,270 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_spline_basis.h"
+#include "qwt_spline_parametrization.h"
+#include <qpainterpath.h>
+
+#if 0
+static QPolygonF qwtBasisUniformKnots( const QPolygonF& points )
+{
+    const int n = points.size();
+
+    if ( n < 3 )
+        return points;
+
+    QVector< double > u( n - 2 );
+    QVector< double > kx( n - 2 );
+    QVector< double > ky( n - 2 );
+
+    u[n - 3] = 4.0;
+    kx[n - 3] = 6.0 * points[n - 2].x() - points[n - 1].x();
+    ky[n - 3] = 6.0 * points[n - 2].y() - points[n - 1].y();
+
+    for ( int i = n - 4; i >= 0; i-- )
+    {
+        u[i] = 4.0 - 1.0 / u[i + 1];
+        kx[i] = 6.0 * points[i + 1].x() - kx[i + 1] / u[i + 1];
+        ky[i] = 6.0 * points[i + 1].y() - ky[i + 1] / u[i + 1];
+    }
+
+    QVector< QPointF > knots( n );
+
+    knots[0] = points[0];
+
+    for ( int i = 1; i < n - 1; i++ )
+    {
+        knots[i].rx() = ( kx[i - 1] - knots[i - 1].x() ) / u[i - 1];
+        knots[i].ry() = ( ky[i - 1] - knots[i - 1].y() ) / u[i - 1];
+    }
+
+    knots[n - 1] = points[n - 1];
+
+    return knots;
+}
+#endif
+
+#if 0
+static inline void qwtSplineBezierControlPoints( const QwtSplineParametrization* param,
+    const QPointF& p1, const QPointF& p2, const QPointF& p3, const QPointF& p4,
+    QPointF& cp1, QPointF& cp2 )
+{
+    const double t1 = param->valueIncrement( p1, p2 );
+    const double t2 = param->valueIncrement( p2, p3 );
+    const double t3 = param->valueIncrement( p3, p4 );
+
+    const double t123 = t1 + t2 + t3;
+
+    cp1 = ( t2 + t3 ) / t123 * p2 + t1 / t123 * p3;
+    cp2 = ( t3 * p2 + ( t1 + t2 ) * p3 ) / t123;
+}
+#endif
+
+static QPainterPath qwtSplineBasisPathUniform( const QPolygonF& points,
+    QwtSpline::BoundaryType boundaryType )
+{
+    const int n = points.size();
+    const QPointF* pd = points.constData();
+
+    QPainterPath path;
+
+    QPointF cp1 = ( 2.0 * pd[0] + pd[1] ) / 3.0;;
+
+    if ( boundaryType == QwtSpline::ConditionalBoundaries )
+    {
+        path.moveTo( pd[0] );
+    }
+    else
+    {
+        const QPointF cpN = ( pd[n - 1] + 2.0 * pd[0] ) / 3.0;
+        path.moveTo( 0.5 * ( cpN + cp1 ) );
+    }
+
+    for ( int i = 1; i < n - 1; i++ )
+    {
+        const QPointF cp2 = ( pd[i - 1] + 2.0 * pd[i] ) / 3.0;
+        const QPointF cp3 = ( 2.0 * pd[i] + pd[i + 1] ) / 3.0;
+
+        path.cubicTo( cp1, cp2, 0.5 * ( cp2 + cp3 ) );
+
+        cp1 = cp3;
+    }
+
+    if ( boundaryType == QwtSpline::ConditionalBoundaries )
+    {
+        const QPointF cp2 = ( pd[n - 2] + 2.0 * pd[n - 1] ) / 3.0;
+        path.cubicTo( cp1, cp2, pd[n - 1] );
+    }
+    else
+    {
+        const QPointF cp2 = ( pd[n - 2] + 2.0 * pd[n - 1] ) / 3.0;
+        const QPointF cp3 = ( 2.0 * pd[n - 1] + pd[0] ) / 3.0;
+
+        path.cubicTo( cp1, cp2, 0.5 * ( cp2 + cp3 ) );
+
+        if ( boundaryType == QwtSpline::ClosedPolygon )
+        {
+            const QPointF cp4 = ( pd[n - 1] + 2.0 * pd[0] ) / 3.0;
+            const QPointF cp5 = ( 2.0 * pd[0] + pd[1] ) / 3.0;
+
+            path.cubicTo( cp3, cp4, 0.5 * ( cp4 + cp5 ) );
+        }
+    }
+
+    return path;
+}
+
+static QPainterPath qwtSplineBasisPath( const QPolygonF& points,
+    const QwtSplineParametrization* param,
+    QwtSpline::BoundaryType boundaryType )
+{
+    const int n = points.size();
+    const QPointF* pd = points.constData();
+
+    QPointF p0;
+
+    double t1 = param->valueIncrement( pd[0], pd[1] );
+    double t2 = param->valueIncrement( pd[1], pd[2] );
+
+    double t0;
+    if ( boundaryType == QwtSpline::ConditionalBoundaries )
+        t0 = t1;
+    else
+        t0 = param->valueIncrement( pd[n - 1], pd[0] );
+
+    double t012 = t0 + t1 + t2;
+    QPointF cp1 = ( ( t1 + t2 ) * pd[0] + t0 * pd[1] ) / t012;
+
+    if ( boundaryType == QwtSpline::ConditionalBoundaries )
+    {
+        p0 = pd[0];
+    }
+    else
+    {
+        const double tN = param->valueIncrement( pd[n - 2], pd[n - 1] );
+        const QPointF cpN = ( t1 * pd[n - 1] + ( tN + t0 ) * pd[0] ) / ( tN + t0 + t1 );
+
+        p0 = ( t1 * cpN + t0 * cp1 ) / ( t0 + t1 );
+    }
+
+    QPainterPath path;
+    path.moveTo( p0 );
+
+    for ( int i = 1; i < n - 2; i++ )
+    {
+        const double t3 = param->valueIncrement( pd[i + 1], pd[i + 2] );
+        const double t123 = t1 + t2 + t3;
+
+        const QPointF cp2 = ( t2 * pd[i - 1] + ( t0 + t1 ) * pd[i] ) / t012;
+        const QPointF cp3 = ( ( t2 + t3 ) * pd[i] + t1 * pd[i + 1] ) / t123;
+
+        const QPointF p2 = ( t2 * cp2 + t1 * cp3 ) / ( t1 + t2 );
+
+        path.cubicTo( cp1, cp2, p2 );
+
+        cp1 = cp3;
+
+        t0 = t1;
+        t1 = t2;
+        t2 = t3;
+        t012 = t123;
+    }
+
+    {
+        double t3;
+        if ( boundaryType == QwtSpline::ConditionalBoundaries )
+            t3 = t2;
+        else
+            t3 = param->valueIncrement( pd[n - 1], pd[0] );
+
+        const double t123 = t1 + t2 + t3;
+
+        const QPointF cp2 = ( t2 * pd[n - 3] + ( t0 + t1 ) * pd[n - 2] ) / t012;
+        const QPointF cp3 = ( ( t2 + t3 ) * pd[n - 2] + t1 * pd[n - 1] ) / t123;
+
+        const QPointF p2 = ( t2 * cp2 + t1 * cp3 ) / ( t1 + t2 );
+
+        path.cubicTo( cp1, cp2, p2 );
+
+        cp1 = cp3;
+
+        t0 = t1;
+        t1 = t2;
+        t2 = t3;
+        t012 = t123;
+    }
+
+    const QPointF cp2 = ( t2 * pd[n - 2] + ( t0 + t1 ) * pd[n - 1] ) / t012;
+
+    if ( boundaryType == QwtSpline::ConditionalBoundaries )
+    {
+        path.cubicTo( cp1, cp2, pd[n - 1] );
+    }
+    else
+    {
+        const double t3 = param->valueIncrement( pd[0], pd[1] );
+        const double t123 = t1 + t2 + t3;
+
+        const QPointF cp3 = ( t2 + t3 ) / t123 * pd[n - 1] + t1 / t123 * pd[0];
+        const QPointF cp4 = ( t3 * pd[n - 1] + ( t1 + t2 ) * pd[0] ) / t123;
+
+        const QPointF pN = ( t2 * cp2 + t1 * cp3 ) / ( t1 + t2 );
+
+        path.cubicTo( cp1, cp2, pN );
+        path.cubicTo( cp3, cp4, p0 );
+    }
+
+    return path;
+}
+
+//! Constructor
+QwtSplineBasis::QwtSplineBasis()
+{
+}
+
+//! Destructor
+QwtSplineBasis::~QwtSplineBasis()
+{
+}
+
+//! The locality is always 2
+uint QwtSplineBasis::locality() const
+{
+    return 2;
+}
+
+/*!
+   Approximates a polygon piecewise with cubic Bezier curves
+   and returns them as QPainterPath.
+
+   \param points Control points
+   \return Painter path, that can be rendered by QPainter
+ */
+QPainterPath QwtSplineBasis::painterPath( const QPolygonF& points ) const
+{
+    if ( points.size() < 4 )
+        return QPainterPath();
+
+    QPainterPath path;
+
+    switch( parametrization()->type() )
+    {
+        case QwtSplineParametrization::ParameterUniform:
+        {
+            path = qwtSplineBasisPathUniform( points, boundaryType() );
+            break;
+        }
+        default:
+        {
+            path = qwtSplineBasisPath( points, parametrization(), boundaryType() );
+        }
+    }
+
+    return path;
+}
Index: /trunk/BNC/qwt/qwt_spline_basis.h
===================================================================
--- /trunk/BNC/qwt/qwt_spline_basis.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_basis.h	(revision 11158)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_SPLINE_BASIS_H
+#define QWT_SPLINE_BASIS_H
+
+#include "qwt_global.h"
+#include "qwt_spline.h"
+
+/*!
+   \brief An approximation using a basis spline
+
+   QwtSplineBasis approximates a set of points by a polynomials with C2 continuity
+   ( = first and second derivatives are equal ) at the end points.
+
+   The end points of the spline do not match the original points.
+ */
+class QWT_EXPORT QwtSplineBasis : public QwtSpline
+{
+  public:
+    QwtSplineBasis();
+    virtual ~QwtSplineBasis();
+
+    virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual uint locality() const QWT_OVERRIDE;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_spline_cubic.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_spline_cubic.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_cubic.cpp	(revision 11158)
@@ -0,0 +1,1171 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_spline_cubic.h"
+#include "qwt_spline_polynomial.h"
+
+#include <qpolygon.h>
+#include <qpainterpath.h>
+
+#define SLOPES_INCREMENTAL 0
+#define KAHAN 0
+
+namespace QwtSplineCubicP
+{
+    class KahanSum
+    {
+      public:
+        inline KahanSum( double value = 0.0 ):
+            m_sum( value ),
+            m_carry( 0.0 )
+        {
+        }
+
+        inline void reset()
+        {
+            m_sum = m_carry = 0.0;
+        }
+
+        inline double value() const
+        {
+            return m_sum;
+        }
+
+        inline void add( double value )
+        {
+            const double y = value - m_carry;
+            const double t = m_sum + y;
+
+            m_carry = ( t - m_sum ) - y;
+            m_sum = t;
+        }
+
+        static inline double sum3( double d1, double d2, double d3 )
+        {
+            KahanSum sum( d1 );
+            sum.add( d2 );
+            sum.add( d3 );
+
+            return sum.value();
+        }
+
+        static inline double sum4( double d1, double d2, double d3, double d4 )
+        {
+            KahanSum sum( d1 );
+            sum.add( d2 );
+            sum.add( d3 );
+            sum.add( d4 );
+
+            return sum.value();
+        }
+
+
+      private:
+        double m_sum;
+        double m_carry; // The carry from the previous operation
+    };
+
+    class CurvatureStore
+    {
+      public:
+        inline void setup( int size )
+        {
+            m_curvatures.resize( size );
+            m_cv = m_curvatures.data();
+        }
+
+        inline void storeFirst( double,
+            const QPointF&, const QPointF&, double b1, double )
+        {
+            m_cv[0] = 2.0 * b1;
+        }
+
+        inline void storeNext( int index, double,
+            const QPointF&, const QPointF&, double, double b2 )
+        {
+            m_cv[index] = 2.0 * b2;
+        }
+
+        inline void storeLast( double,
+            const QPointF&, const QPointF&, double, double b2 )
+        {
+            m_cv[m_curvatures.size() - 1] = 2.0 * b2;
+        }
+
+        inline void storePrevious( int index, double,
+            const QPointF&, const QPointF&, double b1, double )
+        {
+            m_cv[index] = 2.0 * b1;
+        }
+
+        inline void closeR()
+        {
+            m_cv[0] = m_cv[m_curvatures.size() - 1];
+        }
+
+        QVector< double > curvatures() const { return m_curvatures; }
+
+      private:
+        QVector< double > m_curvatures;
+        double* m_cv;
+    };
+
+    class SlopeStore
+    {
+      public:
+        inline void setup( int size )
+        {
+            m_slopes.resize( size );
+            m_m = m_slopes.data();
+        }
+
+        inline void storeFirst( double h,
+            const QPointF& p1, const QPointF& p2, double b1, double b2 )
+        {
+            const double s = ( p2.y() - p1.y() ) / h;
+            m_m[0] = s - h * ( 2.0 * b1 + b2 ) / 3.0;
+#if KAHAN
+            m_sum.add( m_m[0] );
+#endif
+        }
+
+        inline void storeNext( int index, double h,
+            const QPointF& p1, const QPointF& p2, double b1, double b2 )
+        {
+#if SLOPES_INCREMENTAL
+            Q_UNUSED( p1 )
+            Q_UNUSED( p2 )
+#if KAHAN
+            m_sum.add( ( b1 + b2 ) * h );
+            m_m[index] = m_sum.value();
+#else
+            m_m[index] = m_m[index - 1] + ( b1 + b2 ) * h;
+#endif
+#else
+            const double s = ( p2.y() - p1.y() ) / h;
+            m_m[index] = s + h * ( b1 + 2.0 * b2 ) / 3.0;
+#endif
+        }
+
+        inline void storeLast( double h,
+            const QPointF& p1, const QPointF& p2, double b1, double b2 )
+        {
+            const double s = ( p2.y() - p1.y() ) / h;
+            m_m[m_slopes.size() - 1] = s + h * ( b1 + 2.0 * b2 ) / 3.0;
+#if KAHAN
+            m_sum.add( m_m[m_slopes.size() - 1] );
+#endif
+        }
+
+        inline void storePrevious( int index, double h,
+            const QPointF& p1, const QPointF& p2, double b1, double b2 )
+        {
+#if SLOPES_INCREMENTAL
+            Q_UNUSED( p1 )
+            Q_UNUSED( p2 )
+#if KAHAN
+            m_sum.add( -( b1 + b2 ) * h );
+            m_m[index] = m_sum.value();
+#else
+            m_m[index] = m_m[index + 1] - ( b1 + b2 ) * h;
+#endif
+
+#else
+            const double s = ( p2.y() - p1.y() ) / h;
+            m_m[index] = s - h * ( 2.0 * b1 + b2 ) / 3.0;
+#endif
+        }
+
+        inline void closeR()
+        {
+            m_m[0] = m_m[m_slopes.size() - 1];
+        }
+
+        QVector< double > slopes() const { return m_slopes; }
+
+      private:
+        QVector< double > m_slopes;
+        double* m_m;
+#if SLOPES_INCREMENTAL
+        KahanSum m_sum;
+#endif
+    };
+}
+
+namespace QwtSplineCubicP
+{
+    class Equation2
+    {
+      public:
+        inline Equation2()
+        {
+        }
+
+        inline Equation2( double p0, double q0, double r0 ):
+            p( p0 ),
+            q( q0 ),
+            r( r0 )
+        {
+        }
+
+        inline void setup( double p0, double q0, double r0 )
+        {
+            p = p0;
+            q = q0;
+            r = r0;
+        }
+
+        inline Equation2 normalized() const
+        {
+            Equation2 c;
+            c.p = 1.0;
+            c.q = q / p;
+            c.r = r / p;
+
+            return c;
+        }
+
+        inline double resolved1( double x2 ) const
+        {
+            return ( r - q * x2 ) / p;
+        }
+
+        inline double resolved2( double x1 ) const
+        {
+            return ( r - p * x1 ) / q;
+        }
+
+        inline double resolved1( const Equation2& eq ) const
+        {
+            // find x1
+            double k = q / eq.q;
+            return ( r - k * eq.r ) / ( p - k * eq.p );
+        }
+
+        inline double resolved2( const Equation2& eq ) const
+        {
+            // find x2
+            const double k = p / eq.p;
+            return ( r - k * eq.r ) / ( q - k * eq.q );
+        }
+
+        // p * x1 + q * x2 = r
+        double p, q, r;
+    };
+
+    class Equation3
+    {
+      public:
+        inline Equation3()
+        {
+        }
+
+        inline Equation3( const QPointF& p1, const QPointF& p2, const QPointF& p3 )
+        {
+            const double h1 = p2.x() - p1.x();
+            const double s1 = ( p2.y() - p1.y() ) / h1;
+
+            const double h2 = p3.x() - p2.x();
+            const double s2 = ( p3.y() - p2.y() ) / h2;
+
+            p = h1;
+            q = 2 * ( h1 + h2 );
+            u = h2;
+            r = 3 * ( s2 - s1 );
+        }
+
+        inline Equation3( double cp, double cq, double du, double dr ):
+            p( cp ),
+            q( cq ),
+            u( du ),
+            r( dr )
+        {
+        }
+
+        inline bool operator==( const Equation3& c ) const
+        {
+            return ( p == c.p ) && ( q == c.q ) &&
+                   ( u == c.u ) && ( r == c.r );
+        }
+
+        inline void setup( double cp, double cq, double du, double dr )
+        {
+            p = cp;
+            q = cq;
+            u = du;
+            r = dr;
+        }
+
+        inline Equation3 normalized() const
+        {
+            Equation3 c;
+            c.p = 1.0;
+            c.q = q / p;
+            c.u = u / p;
+            c.r = r / p;
+
+            return c;
+        }
+
+        inline Equation2 substituted1( const Equation3& eq ) const
+        {
+            // eliminate x1
+            const double k = p / eq.p;
+            return Equation2( q - k * eq.q, u - k * eq.u, r - k * eq.r );
+        }
+
+        inline Equation2 substituted2( const Equation3& eq ) const
+        {
+            // eliminate x2
+
+            const double k = q / eq.q;
+            return Equation2( p - k * eq.p, u - k * eq.u, r - k * eq.r );
+        }
+
+        inline Equation2 substituted3( const Equation3& eq ) const
+        {
+            // eliminate x3
+
+            const double k = u / eq.u;
+            return Equation2( p - k * eq.p, q - k * eq.q, r - k * eq.r );
+        }
+
+        inline Equation2 substituted1( const Equation2& eq ) const
+        {
+            // eliminate x1
+            const double k = p / eq.p;
+            return Equation2( q - k * eq.q, u, r - k * eq.r );
+        }
+
+        inline Equation2 substituted3( const Equation2& eq ) const
+        {
+            // eliminate x3
+
+            const double k = u / eq.q;
+            return Equation2( p, q - k * eq.p, r - k * eq.r );
+        }
+
+
+        inline double resolved1( double x2, double x3 ) const
+        {
+            return ( r - q * x2 - u * x3 ) / p;
+        }
+
+        inline double resolved2( double x1, double x3 ) const
+        {
+            return ( r - u * x3 - p * x1 ) / q;
+        }
+
+        inline double resolved3( double x1, double x2 ) const
+        {
+            return ( r - p * x1 - q * x2 ) / u;
+        }
+
+        // p * x1 + q * x2 + u * x3 = r
+        double p, q, u, r;
+    };
+}
+
+#if 0
+static QDebug operator<<( QDebug debug, const QwtSplineCubicP::Equation2& eq )
+{
+    debug.nospace() << "EQ2(" << eq.p << ", " << eq.q << ", " << eq.r << ")";
+    return debug.space();
+}
+
+static QDebug operator<<( QDebug debug, const QwtSplineCubicP::Equation3& eq )
+{
+    debug.nospace() << "EQ3(" << eq.p << ", "
+                    << eq.q << ", " << eq.u << ", " << eq.r << ")";
+    return debug.space();
+}
+#endif
+
+namespace QwtSplineCubicP
+{
+    template< class T >
+    class EquationSystem
+    {
+      public:
+        void setStartCondition( double p, double q, double u, double r )
+        {
+            m_conditionsEQ[0].setup( p, q, u, r );
+        }
+
+        void setEndCondition( double p, double q, double u, double r )
+        {
+            m_conditionsEQ[1].setup( p, q, u, r );
+        }
+
+        const T& store() const
+        {
+            return m_store;
+        }
+
+        void resolve( const QPolygonF& p )
+        {
+            const int n = p.size();
+            if ( n < 3 )
+                return;
+
+            if ( m_conditionsEQ[0].p == 0.0 ||
+                ( m_conditionsEQ[0].q == 0.0 && m_conditionsEQ[0].u != 0.0 ) )
+            {
+                return;
+            }
+
+            if ( m_conditionsEQ[1].u == 0.0 ||
+                ( m_conditionsEQ[1].q == 0.0 && m_conditionsEQ[1].p != 0.0 ) )
+            {
+                return;
+            }
+
+            const double h0 = p[1].x() - p[0].x();
+            const double h1 = p[2].x() - p[1].x();
+            const double hn = p[n - 1].x() - p[n - 2].x();
+
+            m_store.setup( n );
+
+
+            if ( n == 3 )
+            {
+                // For certain conditions the first/last point does not
+                // necessarily meet the spline equation and we would
+                // have many solutions. In this case we resolve using
+                // the spline equation - as for all other conditions.
+
+                const Equation3 eqSpline0( p[0], p[1], p[2] ); // ???
+                const Equation2 eq0 = m_conditionsEQ[0].substituted1( eqSpline0 );
+
+                // The equation system can be solved without substitution
+                // from the start/end conditions and eqSpline0 ( = eqSplineN ).
+
+                double b1;
+
+                if ( m_conditionsEQ[0].normalized() == m_conditionsEQ[1].normalized() )
+                {
+                    // When we have 3 points only and start/end conditions
+                    // for 3 points mean the same condition the system
+                    // is under-determined and has many solutions.
+                    // We chose b1 = 0.0
+
+                    b1 = 0.0;
+                }
+                else
+                {
+                    const Equation2 eq = m_conditionsEQ[1].substituted1( eqSpline0 );
+                    b1 = eq0.resolved1( eq );
+                }
+
+                const double b2 = eq0.resolved2( b1 );
+                const double b0 = eqSpline0.resolved1( b1, b2 );
+
+                m_store.storeFirst( h0, p[0], p[1], b0, b1 );
+                m_store.storeNext( 1, h0, p[0], p[1], b0, b1 );
+                m_store.storeNext( 2, h1, p[1], p[2], b1, b2 );
+
+                return;
+            }
+
+            const Equation3 eqSplineN( p[n - 3], p[n - 2], p[n - 1] );
+            const Equation2 eqN = m_conditionsEQ[1].substituted3( eqSplineN );
+
+            Equation2 eq = eqN;
+            if ( n > 4 )
+            {
+                const Equation3 eqSplineR( p[n - 4], p[n - 3], p[n - 2] );
+                eq = eqSplineR.substituted3( eq );
+                eq = substituteSpline( p, eq );
+            }
+
+            const Equation3 eqSpline0( p[0], p[1], p[2] );
+
+            double b0, b1;
+            if ( m_conditionsEQ[0].u == 0.0 )
+            {
+                eq = eqSpline0.substituted3( eq );
+
+                const Equation3& eq0 = m_conditionsEQ[0];
+                b0 = Equation2( eq0.p, eq0.q, eq0.r ).resolved1( eq );
+                b1 = eq.resolved2( b0 );
+            }
+            else
+            {
+                const Equation2 eqX = m_conditionsEQ[0].substituted3( eq );
+                const Equation2 eqY = eqSpline0.substituted3( eq );
+
+                b0 = eqY.resolved1( eqX );
+                b1 = eqY.resolved2( b0 );
+            }
+
+            m_store.storeFirst( h0, p[0], p[1], b0, b1 );
+            m_store.storeNext( 1, h0, p[0], p[1], b0, b1 );
+
+            const double bn2 = resolveSpline( p, b1 );
+
+            const double bn1 = eqN.resolved2( bn2 );
+            const double bn0 = m_conditionsEQ[1].resolved3( bn2, bn1 );
+
+            const double hx = p[n - 2].x() - p[n - 3].x();
+            m_store.storeNext( n - 2, hx, p[n - 3], p[n - 2], bn2, bn1 );
+            m_store.storeNext( n - 1, hn, p[n - 2], p[n - 1], bn1, bn0 );
+        }
+
+      private:
+        Equation2 substituteSpline( const QPolygonF& points, const Equation2& eq )
+        {
+            const int n = points.size();
+
+            m_eq.resize( n - 2 );
+            m_eq[n - 3] = eq;
+
+            // eq[i].resolved2( b[i-1] ) => b[i]
+
+            double slope2 = ( points[n - 3].y() - points[n - 4].y() ) / eq.p;
+
+            for ( int i = n - 4; i > 1; i-- )
+            {
+                const Equation2& eq2 = m_eq[i + 1];
+                Equation2& eq1 = m_eq[i];
+
+                eq1.p = points[i].x() - points[i - 1].x();
+                const double slope1 = ( points[i].y() - points[i - 1].y() ) / eq1.p;
+
+                const double v = eq2.p / eq2.q;
+
+                eq1.q = 2.0 * ( eq1.p + eq2.p ) - v * eq2.p;
+                eq1.r = 3.0 * ( slope2 - slope1 ) - v * eq2.r;
+
+                slope2 = slope1;
+            }
+
+            return m_eq[2];
+        }
+
+        double resolveSpline( const QPolygonF& points, double b1 )
+        {
+            const int n = points.size();
+            const QPointF* p = points.constData();
+
+            for ( int i = 2; i < n - 2; i++ )
+            {
+                // eq[i].resolved2( b[i-1] ) => b[i]
+                const double b2 = m_eq[i].resolved2( b1 );
+                m_store.storeNext( i, m_eq[i].p, p[i - 1], p[i], b1, b2 );
+
+                b1 = b2;
+            }
+
+            return b1;
+        }
+
+      private:
+        Equation3 m_conditionsEQ[2];
+        QVector< Equation2 > m_eq;
+        T m_store;
+    };
+
+    template< class T >
+    class EquationSystem2
+    {
+      public:
+        const T& store() const
+        {
+            return m_store;
+        }
+
+        void resolve( const QPolygonF& p )
+        {
+            const int n = p.size();
+
+            if ( p[n - 1].y() != p[0].y() )
+            {
+                // TODO ???
+            }
+
+            const double h0 = p[1].x() - p[0].x();
+            const double s0 = ( p[1].y() - p[0].y() ) / h0;
+
+            if ( n == 3 )
+            {
+                const double h1 = p[2].x() - p[1].x();
+                const double s1 = ( p[2].y() - p[1].y() ) / h1;
+
+                const double b = 3.0 * ( s0 - s1 ) / ( h0 + h1 );
+
+                m_store.setup( 3 );
+                m_store.storeLast( h1, p[1], p[2], -b, b );
+                m_store.storePrevious( 1, h1, p[1], p[2], -b, b );
+                m_store.closeR();
+
+                return;
+            }
+
+            const double hn = p[n - 1].x() - p[n - 2].x();
+
+            Equation2 eqn, eqX;
+            substitute( p, eqn, eqX );
+
+            const double b0 = eqn.resolved2( eqX );
+            const double bn = eqn.resolved1( b0 );
+
+            m_store.setup( n );
+            m_store.storeLast( hn, p[n - 2], p[n - 1], bn, b0 );
+            m_store.storePrevious( n - 2, hn, p[n - 2], p[n - 1], bn, b0 );
+
+            resolveSpline( p, b0, bn );
+
+            m_store.closeR();
+        }
+
+      private:
+
+        void substitute( const QPolygonF& points, Equation2& eqn, Equation2& eqX )
+        {
+            const int n = points.size();
+
+            const double hn = points[n - 1].x() - points[n - 2].x();
+
+            const Equation3 eqSpline0( points[0], points[1], points[2] );
+            const Equation3 eqSplineN(
+                QPointF( points[0].x() - hn, points[n - 2].y() ), points[0], points[1] );
+
+            m_eq.resize( n - 1 );
+
+            double dq = 0;
+            double dr = 0;
+
+            m_eq[1] = eqSpline0;
+
+            double slope1 = ( points[2].y() - points[1].y() ) / m_eq[1].u;
+
+            // a) p1 * b[0] + q1 * b[1] + u1 * b[2] = r1
+            // b) p2 * b[n-2] + q2 * b[0] + u2 * b[1] = r2
+            // c) pi * b[i-1] + qi * b[i] + ui * b[i+1] = ri
+            //
+            // Using c) we can substitute b[i] ( starting from 2 ) by b[i+1]
+            // until we reach n-1. As we know, that b[0] == b[n-1] we found
+            // an equation where only 2 coefficients ( for b[n-2], b[0] ) are left unknown.
+            // Each step we have an equation that depends on b[0], b[i] and b[i+1]
+            // that can also be used to substitute b[i] in b). Ding so we end up with another
+            // equation depending on b[n-2], b[0] only.
+            // Finally 2 equations with 2 coefficients can be solved.
+
+            for ( int i = 2; i < n - 1; i++ )
+            {
+                const Equation3& eq1 = m_eq[i - 1];
+                Equation3& eq2 = m_eq[i];
+
+                dq += eq1.p * eq1.p / eq1.q;
+                dr += eq1.p * eq1.r / eq1.q;
+
+                eq2.u = points[i + 1].x() - points[i].x();
+                const double slope2 = ( points[i + 1].y() - points[i].y() ) / eq2.u;
+
+                const double k = eq1.u / eq1.q;
+
+                eq2.p = -eq1.p * k;
+                eq2.q = 2.0 * ( eq1.u + eq2.u ) - eq1.u * k;
+                eq2.r = 3.0 * ( slope2 - slope1 ) - eq1.r * k;
+
+                slope1 = slope2;
+            }
+
+
+            // b[0] * m_p[n-2] + b[n-2] * m_q[n-2] + b[n-1] * pN = m_r[n-2]
+            eqn.setup( m_eq[n - 2].q, m_eq[n - 2].p + eqSplineN.p, m_eq[n - 2].r );
+
+            // b[n-2] * pN + b[0] * ( qN - dq ) + b[n-2] * m_p[n-2] = rN - dr
+            eqX.setup( m_eq[n - 2].p + eqSplineN.p, eqSplineN.q - dq, eqSplineN.r - dr );
+        }
+
+        void resolveSpline( const QPolygonF& points, double b0, double bi )
+        {
+            const int n = points.size();
+
+            for ( int i = n - 3; i >= 1; i-- )
+            {
+                const Equation3& eq = m_eq[i];
+
+                const double b = eq.resolved2( b0, bi );
+                m_store.storePrevious( i, eq.u, points[i], points[i + 1], b, bi );
+
+                bi = b;
+            }
+        }
+
+        void resolveSpline2( const QPolygonF& points,
+            double b0, double bi, QVector< double >& m )
+        {
+            const int n = points.size();
+
+            bi = m_eq[0].resolved3( b0, bi );
+
+            for ( int i = 1; i < n - 2; i++ )
+            {
+                const Equation3& eq = m_eq[i];
+
+                const double b = eq.resolved3( b0, bi );
+                m[i + 1] = m[i] + ( b + bi ) * m_eq[i].u;
+
+                bi = b;
+            }
+        }
+
+        void resolveSpline3( const QPolygonF& points,
+            double b0, double b1, QVector< double >& m )
+        {
+            const int n = points.size();
+
+            double h0 = ( points[1].x() - points[0].x() );
+            double s0 = ( points[1].y() - points[0].y() ) / h0;
+
+            m[1] = m[0] + ( b0 + b1 ) * h0;
+
+            for ( int i = 1; i < n - 1; i++ )
+            {
+                const double h1 = ( points[i + 1].x() - points[i].x() );
+                const double s1 = ( points[i + 1].y() - points[i].y() ) / h1;
+
+                const double r = 3.0 * ( s1 - s0 );
+
+                const double b2 = ( r - h0 * b0 - 2.0 * ( h0 + h1 ) * b1 ) / h1;
+                m[i + 1] = m[i] + ( b1 + b2 ) * h1;
+
+                h0 = h1;
+                s0 = s1;
+                b0 = b1;
+                b1 = b2;
+            }
+        }
+
+        void resolveSpline4( const QPolygonF& points,
+            double b2, double b1, QVector< double >& m )
+        {
+            const int n = points.size();
+
+            double h2 = ( points[n - 1].x() - points[n - 2].x() );
+            double s2 = ( points[n - 1].y() - points[n - 2].y() ) / h2;
+
+            for ( int i = n - 2; i > 1; i-- )
+            {
+                const double h1 = ( points[i].x() - points[i - 1].x() );
+                const double s1 = ( points[i].y() - points[i - 1].y() ) / h1;
+
+                const double r = 3.0 * ( s2 - s1 );
+                const double k = 2.0 * ( h1 + h2 );
+
+                const double b0 = ( r - h2 * b2 - k * b1 ) / h1;
+
+                m[i - 1] = m[i] - ( b0 + b1 ) * h1;
+
+                h2 = h1;
+                s2 = s1;
+                b2 = b1;
+                b1 = b0;
+            }
+        }
+
+      public:
+        QVector< Equation3 > m_eq;
+        T m_store;
+    };
+}
+
+static void qwtSetupEndEquations(
+    int conditionBegin, double valueBegin, int conditionEnd, double valueEnd,
+    const QPolygonF& points, QwtSplineCubicP::Equation3 eq[2] )
+{
+    const int n = points.size();
+
+    const double h0 = points[1].x() - points[0].x();
+    const double s0 = ( points[1].y() - points[0].y() ) / h0;
+
+    const double hn = ( points[n - 1].x() - points[n - 2].x() );
+    const double sn = ( points[n - 1].y() - points[n - 2].y() ) / hn;
+
+    switch( conditionBegin )
+    {
+        case QwtSpline::Clamped1:
+        {
+            // first derivative at end points given
+
+            // 3 * a1 * h + b1 = b2
+            // a1 * h * h + b1 * h + c1 = s
+
+            // c1 = slopeBegin
+            // => b1 * ( 2 * h / 3.0 ) + b2 * ( h / 3.0 ) = s - slopeBegin
+
+            // c2 = slopeEnd
+            // => b1 * ( 1.0 / 3.0 ) + b2 * ( 2.0 / 3.0 ) = ( slopeEnd - s ) / h;
+
+            eq[0].setup( 2 * h0 / 3.0, h0 / 3.0, 0.0, s0 - valueBegin );
+            break;
+        }
+        case QwtSpline::Clamped2:
+        {
+            // second derivative at end points given
+
+            // b0 = 0.5 * cvStart
+            // => b0 * 1.0 + b1 * 0.0 = 0.5 * cvStart
+
+            // b1 = 0.5 * cvEnd
+            // => b0 * 0.0 + b1 * 1.0 = 0.5 * cvEnd
+
+            eq[0].setup( 1.0, 0.0, 0.0, 0.5 * valueBegin );
+            break;
+        }
+        case QwtSpline::Clamped3:
+        {
+            // third derivative at end point given
+
+            // 3 * a * h0 + b[0] = b[1]
+
+            // a = marg_0 / 6.0
+            // => b[0] * 1.0 + b[1] * ( -1.0 ) = -0.5 * v0 * h0
+
+            // a = marg_n / 6.0
+            // => b[n-2] * 1.0 + b[n-1] * ( -1.0 ) = -0.5 * v1 * h5
+
+            eq[0].setup( 1.0, -1.0, 0.0, -0.5 * valueBegin * h0 );
+
+            break;
+        }
+        case QwtSpline::LinearRunout:
+        {
+            const double r0 = qBound( 0.0, valueBegin, 1.0 );
+            if ( r0 == 0.0 )
+            {
+                // clamping s0
+                eq[0].setup( 2 * h0 / 3.0, h0 / 3.0, 0.0, 0.0 );
+            }
+            else
+            {
+                eq[0].setup( 1.0 + 2.0 / r0, 2.0 + 1.0 / r0, 0.0, 0.0 );
+            }
+            break;
+        }
+        case QwtSplineC2::NotAKnot:
+        case QwtSplineC2::CubicRunout:
+        {
+            // building one cubic curve from 3 points
+
+            double v0;
+
+            if ( conditionBegin == QwtSplineC2::CubicRunout )
+            {
+                // first/last point are the endpoints of the curve
+
+                // b0 = 2 * b1 - b2
+                // => 1.0 * b0 - 2 * b1 + 1.0 * b2 = 0.0
+
+                v0 = 1.0;
+            }
+            else
+            {
+                // first/last points are on the curve,
+                // the imaginary endpoints have the same distance as h0/hn
+
+                v0 = h0 / ( points[2].x() - points[1].x() );
+            }
+
+            eq[0].setup( 1.0, -( 1.0 + v0 ), v0, 0.0 );
+            break;
+        }
+        default:
+        {
+            // a natural spline, where the
+            // second derivative at end points set to 0.0
+            eq[0].setup( 1.0, 0.0, 0.0, 0.0 );
+            break;
+        }
+    }
+
+    switch( conditionEnd )
+    {
+        case QwtSpline::Clamped1:
+        {
+            // first derivative at end points given
+            eq[1].setup( 0.0, 1.0 / 3.0 * hn, 2.0 / 3.0 * hn, valueEnd - sn );
+            break;
+        }
+        case QwtSpline::Clamped2:
+        {
+            // second derivative at end points given
+            eq[1].setup( 0.0, 0.0, 1.0, 0.5 * valueEnd );
+            break;
+        }
+        case QwtSpline::Clamped3:
+        {
+            // third derivative at end point given
+            eq[1].setup( 0.0, 1.0, -1.0, -0.5 * valueEnd * hn );
+            break;
+        }
+        case QwtSpline::LinearRunout:
+        {
+            const double rn = qBound( 0.0, valueEnd, 1.0 );
+            if ( rn == 0.0 )
+            {
+                // clamping sn
+                eq[1].setup( 0.0, 1.0 / 3.0 * hn, 2.0 / 3.0 * hn, 0.0 );
+            }
+            else
+            {
+                eq[1].setup( 0.0, 2.0 + 1.0 / rn, 1.0 + 2.0 / rn, 0.0 );
+            }
+
+            break;
+        }
+        case QwtSplineC2::NotAKnot:
+        case QwtSplineC2::CubicRunout:
+        {
+            // building one cubic curve from 3 points
+
+            double vn;
+
+            if ( conditionEnd == QwtSplineC2::CubicRunout )
+            {
+                // last point is the endpoints of the curve
+                vn = 1.0;
+            }
+            else
+            {
+                // last points on the curve,
+                // the imaginary endpoints have the same distance as hn
+
+                vn = hn / ( points[n - 2].x() - points[n - 3].x() );
+            }
+
+            eq[1].setup( vn, -( 1.0 + vn ), 1.0, 0.0 );
+            break;
+        }
+        default:
+        {
+            // a natural spline, where the
+            // second derivative at end points set to 0.0
+            eq[1].setup( 0.0, 0.0, 1.0, 0.0 );
+            break;
+        }
+    }
+}
+
+class QwtSplineCubic::PrivateData
+{
+};
+
+/*!
+   \brief Constructor
+   The default setting is a non closing natural spline with no parametrization.
+ */
+QwtSplineCubic::QwtSplineCubic()
+    : m_data( NULL )
+{
+    // a natural spline
+
+    setBoundaryCondition( QwtSpline::AtBeginning, QwtSpline::Clamped2 );
+    setBoundaryValue( QwtSpline::AtBeginning, 0.0 );
+
+    setBoundaryCondition( QwtSpline::AtEnd, QwtSpline::Clamped2 );
+    setBoundaryValue( QwtSpline::AtEnd, 0.0 );
+}
+
+//! Destructor
+QwtSplineCubic::~QwtSplineCubic()
+{
+}
+
+/*!
+   A cubic spline is non local, where changing one point has em effect on all
+   polynomials.
+
+   \return 0
+ */
+uint QwtSplineCubic::locality() const
+{
+    return 0;
+}
+
+/*!
+   \brief Find the first derivative at the control points
+
+   In opposite to the implementation QwtSplineC2::slopes the first derivates
+   are calculated directly, without calculating the second derivates first.
+
+   \param points Control nodes of the spline
+   \return Vector with the values of the 2nd derivate at the control points
+
+   \sa curvatures(), QwtSplinePolynomial::fromCurvatures()
+   \note The x coordinates need to be increasing or decreasing
+ */
+QVector< double > QwtSplineCubic::slopes( const QPolygonF& points ) const
+{
+    using namespace QwtSplineCubicP;
+
+    if ( points.size() <= 2 )
+        return QVector< double >();
+
+    if ( ( boundaryType() == QwtSpline::PeriodicPolygon )
+        || ( boundaryType() == QwtSpline::ClosedPolygon ) )
+    {
+        EquationSystem2< SlopeStore > eqs;
+        eqs.resolve( points );
+
+        return eqs.store().slopes();
+    }
+
+    if ( points.size() == 3 )
+    {
+        if ( boundaryCondition( QwtSpline::AtBeginning ) == QwtSplineCubic::NotAKnot
+            || boundaryCondition( QwtSpline::AtEnd ) == QwtSplineCubic::NotAKnot )
+        {
+#if 0
+            const double h0 = points[1].x() - points[0].x();
+            const double h1 = points[2].x() - points[1].x();
+
+            const double s0 = ( points[1].y() - points[0].y() ) / h0;
+            const double s1 = ( points[2].y() - points[1].y() ) / h1;
+
+            /*
+               the system is under-determined and we only
+               compute a quadratic spline.
+             */
+
+            const double b = ( s1 - s0 ) / ( h0 + h1 );
+
+            QVector< double > m( 3 );
+            m[0] = s0 - h0 * b;
+            m[1] = s1 - h1 * b;
+            m[2] = s1 + h1 * b;
+
+            return m;
+#else
+            return QVector< double >();
+#endif
+        }
+    }
+
+    Equation3 eq[2];
+    qwtSetupEndEquations(
+        boundaryCondition( QwtSpline::AtBeginning ),
+        boundaryValue( QwtSpline::AtBeginning ),
+        boundaryCondition( QwtSpline::AtEnd ),
+        boundaryValue( QwtSpline::AtEnd ),
+        points, eq );
+
+    EquationSystem< SlopeStore > eqs;
+    eqs.setStartCondition( eq[0].p, eq[0].q, eq[0].u, eq[0].r );
+    eqs.setEndCondition( eq[1].p, eq[1].q, eq[1].u, eq[1].r );
+    eqs.resolve( points );
+
+    return eqs.store().slopes();
+}
+
+/*!
+   \brief Find the second derivative at the control points
+
+   \param points Control nodes of the spline
+   \return Vector with the values of the 2nd derivate at the control points
+
+   \sa slopes()
+   \note The x coordinates need to be increasing or decreasing
+ */
+QVector< double > QwtSplineCubic::curvatures( const QPolygonF& points ) const
+{
+    using namespace QwtSplineCubicP;
+
+    if ( points.size() <= 2 )
+        return QVector< double >();
+
+    if ( ( boundaryType() == QwtSpline::PeriodicPolygon )
+        || ( boundaryType() == QwtSpline::ClosedPolygon ) )
+    {
+        EquationSystem2< CurvatureStore > eqs;
+        eqs.resolve( points );
+
+        return eqs.store().curvatures();
+    }
+
+    if ( points.size() == 3 )
+    {
+        if ( boundaryCondition( QwtSpline::AtBeginning ) == QwtSplineC2::NotAKnot
+            || boundaryCondition( QwtSpline::AtEnd ) == QwtSplineC2::NotAKnot )
+        {
+            return QVector< double >();
+        }
+    }
+
+    Equation3 eq[2];
+    qwtSetupEndEquations(
+        boundaryCondition( QwtSpline::AtBeginning ),
+        boundaryValue( QwtSpline::AtBeginning ),
+        boundaryCondition( QwtSpline::AtEnd ),
+        boundaryValue( QwtSpline::AtEnd ),
+        points, eq );
+
+    EquationSystem< CurvatureStore > eqs;
+    eqs.setStartCondition( eq[0].p, eq[0].q, eq[0].u, eq[0].r );
+    eqs.setEndCondition( eq[1].p, eq[1].q, eq[1].u, eq[1].r );
+    eqs.resolve( points );
+
+    return eqs.store().curvatures();
+}
+
+/*!
+   \brief Interpolate a curve with Bezier curves
+
+   Interpolates a polygon piecewise with cubic Bezier curves
+   and returns them as QPainterPath.
+
+   \param points Control points
+   \return Painter path, that can be rendered by QPainter
+
+   \note The implementation simply calls QwtSplineC1::painterPath()
+ */
+QPainterPath QwtSplineCubic::painterPath( const QPolygonF& points ) const
+{
+    // as QwtSplineCubic can calculate slopes directly we can
+    // use the implementation of QwtSplineC1 without any performance loss.
+
+    return QwtSplineC1::painterPath( points );
+}
+
+/*!
+   \brief Interpolate a curve with Bezier curves
+
+   Interpolates a polygon piecewise with cubic Bezier curves
+   and returns the 2 control points of each curve as QLineF.
+
+   \param points Control points
+   \return Control points of the interpolating Bezier curves
+
+   \note The implementation simply calls QwtSplineC1::bezierControlLines()
+ */
+QVector< QLineF > QwtSplineCubic::bezierControlLines( const QPolygonF& points ) const
+{
+    // as QwtSplineCubic can calculate slopes directly we can
+    // use the implementation of QwtSplineC1 without any performance loss.
+
+    return QwtSplineC1::bezierControlLines( points );
+}
+
+/*!
+   \brief Calculate the interpolating polynomials for a non parametric spline
+
+   \param points Control points
+   \return Interpolating polynomials
+
+   \note The x coordinates need to be increasing or decreasing
+   \note The implementation simply calls QwtSplineC2::polynomials(), but is
+        intended to be replaced by a one pass calculation some day.
+ */
+QVector< QwtSplinePolynomial > QwtSplineCubic::polynomials( const QPolygonF& points ) const
+{
+    return QwtSplineC2::polynomials( points );
+}
+
Index: /trunk/BNC/qwt/qwt_spline_cubic.h
===================================================================
--- /trunk/BNC/qwt/qwt_spline_cubic.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_cubic.h	(revision 11158)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_SPLINE_CUBIC_H
+#define QWT_SPLINE_CUBIC_H
+
+#include "qwt_global.h"
+#include "qwt_spline.h"
+
+/*!
+   \brief A cubic spline
+
+   A cubic spline is a spline with C2 continuity at all control points.
+   It is a non local spline, what means that all polynomials are changing
+   when one control point has changed.
+
+   The implementation is based on the fact, that the continuity condition
+   means an equation with 3 unknowns for 3 adjacent points. The equation
+   system can be resolved by defining start/end conditions, that allow
+   substituting of one of the unknowns for the start/end equations.
+
+   Resolving the equation system is a 2 pass algorithm, requiring more CPU costs
+   than all other implemented type of splines.
+
+   \todo The implementation is not numerical stable
+ */
+class QWT_EXPORT QwtSplineCubic : public QwtSplineC2
+{
+  public:
+    QwtSplineCubic();
+    virtual ~QwtSplineCubic();
+
+    virtual uint locality() const QWT_OVERRIDE;
+
+    virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QVector< QLineF > bezierControlLines( const QPolygonF& points ) const QWT_OVERRIDE;
+
+    // calculating the parametric equations
+    virtual QVector< QwtSplinePolynomial > polynomials( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QVector< double > slopes( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QVector< double > curvatures( const QPolygonF& ) const QWT_OVERRIDE;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_spline_curve_fitter.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_spline_curve_fitter.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_curve_fitter.cpp	(revision 11158)
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_spline_curve_fitter.h"
+#include "qwt_spline_local.h"
+#include "qwt_spline_parametrization.h"
+
+#include <qpolygon.h>
+#include <qpainterpath.h>
+
+//! Constructor
+QwtSplineCurveFitter::QwtSplineCurveFitter()
+    : QwtCurveFitter( QwtCurveFitter::Path )
+{
+    m_spline = new QwtSplineLocal( QwtSplineLocal::Cardinal );
+    m_spline->setParametrization( QwtSplineParametrization::ParameterUniform );
+}
+
+//! Destructor
+QwtSplineCurveFitter::~QwtSplineCurveFitter()
+{
+    delete m_spline;
+}
+
+/*!
+   Assign a spline
+
+   The spline needs to be allocated by new and will be deleted
+   in the destructor of the fitter.
+
+   \param spline Spline
+   \sa spline()
+ */
+void QwtSplineCurveFitter::setSpline( QwtSpline* spline )
+{
+    if ( m_spline == spline )
+        return;
+
+    delete m_spline;
+    m_spline = spline;
+}
+
+/*!
+   \return Spline
+   \sa setSpline()
+ */
+const QwtSpline* QwtSplineCurveFitter::spline() const
+{
+    return m_spline;
+}
+
+/*!
+   \return Spline
+   \sa setSpline()
+ */
+QwtSpline* QwtSplineCurveFitter::spline()
+{
+    return m_spline;
+}
+
+/*!
+   Find a curve which has the best fit to a series of data points
+
+   \param points Series of data points
+   \return Fitted Curve
+
+   \sa fitCurvePath()
+ */
+QPolygonF QwtSplineCurveFitter::fitCurve( const QPolygonF& points ) const
+{
+    const QPainterPath path = fitCurvePath( points );
+
+    const QList< QPolygonF > subPaths = path.toSubpathPolygons();
+    if ( subPaths.size() == 1 )
+        return subPaths.first();
+
+    return QPolygonF();
+}
+
+/*!
+   Find a curve path which has the best fit to a series of data points
+
+   \param points Series of data points
+   \return Fitted Curve
+
+   \sa fitCurve()
+ */
+QPainterPath QwtSplineCurveFitter::fitCurvePath( const QPolygonF& points ) const
+{
+    QPainterPath path;
+
+    if ( m_spline )
+        path = m_spline->painterPath( points );
+
+    return path;
+}
Index: /trunk/BNC/qwt/qwt_spline_curve_fitter.h
===================================================================
--- /trunk/BNC/qwt/qwt_spline_curve_fitter.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_curve_fitter.h	(revision 11158)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_SPLINE_CURVE_FITTER_H
+#define QWT_SPLINE_CURVE_FITTER_H
+
+#include "qwt_curve_fitter.h"
+
+class QwtSpline;
+
+/*!
+   \brief A curve fitter using a spline interpolation
+
+   The default setting for the spline is a cardinal spline with
+   uniform parametrization.
+
+   \sa QwtSpline, QwtSplineLocal
+ */
+class QWT_EXPORT QwtSplineCurveFitter : public QwtCurveFitter
+{
+  public:
+    QwtSplineCurveFitter();
+    virtual ~QwtSplineCurveFitter();
+
+    void setSpline( QwtSpline* );
+
+    const QwtSpline* spline() const;
+    QwtSpline* spline();
+
+    virtual QPolygonF fitCurve( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QPainterPath fitCurvePath( const QPolygonF& ) const QWT_OVERRIDE;
+
+  private:
+    QwtSpline* m_spline;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_spline_local.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_spline_local.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_local.cpp	(revision 11158)
@@ -0,0 +1,571 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_spline_local.h"
+#include "qwt_spline_parametrization.h"
+#include "qwt_spline_polynomial.h"
+
+#include <qpainterpath.h>
+
+static inline bool qwtIsStrictlyMonotonic( double dy1, double dy2 )
+{
+    if ( dy1 == 0.0 || dy2 == 0.0 )
+        return false;
+
+    return ( dy1 > 0.0 ) == ( dy2 > 0.0 );
+}
+
+static inline double qwtSlopeLine( const QPointF& p1, const QPointF& p2 )
+{
+    // ???
+    const double dx = p2.x() - p1.x();
+    return dx ? ( p2.y() - p1.y() ) / dx : 0.0;
+}
+
+static inline double qwtSlopeCardinal(
+    double dx1, double dy1, double s1, double dx2, double dy2, double s2 )
+{
+    Q_UNUSED(s1)
+    Q_UNUSED(s2)
+
+    return ( dy1 + dy2 ) / ( dx1 + dx2 );
+}
+
+static inline double qwtSlopeParabolicBlending(
+    double dx1, double dy1, double s1, double dx2, double dy2, double s2 )
+{
+    Q_UNUSED( dy1 )
+    Q_UNUSED( dy2 )
+
+    return ( dx2 * s1 + dx1 * s2 ) / ( dx1 + dx2 );
+}
+
+static inline double qwtSlopePChip(
+    double dx1, double dy1, double s1, double dx2, double dy2, double s2 )
+{
+    if ( qwtIsStrictlyMonotonic( dy1, dy2 ) )
+    {
+#if 0
+        // weighting the slopes by the dx1/dx2
+        const double w1 = ( 3 * dx1 + 3 * dx2 ) / ( 2 * dx1 + 4 * dx2 );
+        const double w2 = ( 3 * dx1 + 3 * dx2 ) / ( 4 * dx1 + 2 * dx2 );
+
+        s1 *= w1;
+        s2 *= w2;
+
+        // harmonic mean ( see https://en.wikipedia.org/wiki/Pythagorean_means )
+        return 2.0 / ( 1.0 / s1 + 1.0 / s2 );
+#endif
+        // the same as above - but faster
+
+        const double s12 = ( dy1 + dy2 ) / ( dx1 + dx2 );
+        return 3.0 * ( s1 * s2 ) / ( s1 + s2 + s12 );
+    }
+
+    return 0.0;
+}
+
+namespace QwtSplineLocalP
+{
+    class PathStore
+    {
+      public:
+        inline void init( const QVector< QPointF >& )
+        {
+        }
+
+        inline void start( const QPointF& p0, double )
+        {
+            path.moveTo( p0 );
+        }
+
+        inline void addCubic( const QPointF& p1, double m1,
+            const QPointF& p2, double m2 )
+        {
+            const double dx3 = ( p2.x() - p1.x() ) / 3.0;
+
+            path.cubicTo( p1.x() + dx3, p1.y() + m1 * dx3,
+                p2.x() - dx3, p2.y() - m2 * dx3,
+                p2.x(), p2.y() );
+        }
+
+        QPainterPath path;
+    };
+
+    class ControlPointsStore
+    {
+      public:
+        inline void init( const QVector< QPointF >& points )
+        {
+            if ( points.size() > 0 )
+                controlPoints.resize( points.size() - 1 );
+            m_cp = controlPoints.data();
+        }
+
+        inline void start( const QPointF&, double )
+        {
+        }
+
+        inline void addCubic( const QPointF& p1, double m1,
+            const QPointF& p2, double m2 )
+        {
+            const double dx3 = ( p2.x() - p1.x() ) / 3.0;
+
+            QLineF& l = *m_cp++;
+            l.setLine( p1.x() + dx3, p1.y() + m1 * dx3,
+                p2.x() - dx3, p2.y() - m2 * dx3 );
+        }
+
+        QVector< QLineF > controlPoints;
+
+      private:
+        QLineF* m_cp;
+    };
+
+    class SlopeStore
+    {
+      public:
+        void init( const QVector< QPointF >& points )
+        {
+            slopes.resize( points.size() );
+            m_m = slopes.data();
+        }
+
+        inline void start( const QPointF&, double m0 )
+        {
+            *m_m++ = m0;
+        }
+
+        inline void addCubic( const QPointF&, double,
+            const QPointF&, double m2 )
+        {
+            *m_m++ = m2;
+        }
+
+        QVector< double > slopes;
+
+      private:
+        double* m_m;
+    };
+
+    struct slopeCardinal
+    {
+        static inline double value( double dx1, double dy1, double s1,
+            double dx2, double dy2, double s2 )
+        {
+            return qwtSlopeCardinal( dx1, dy1, s1, dx2, dy2, s2 );
+        }
+    };
+
+    struct slopeParabolicBlending
+    {
+        static inline double value( double dx1, double dy1, double s1,
+            double dx2, double dy2, double s2 )
+        {
+            return qwtSlopeParabolicBlending( dx1, dy1, s1, dx2, dy2, s2 );
+        }
+    };
+
+    struct slopePChip
+    {
+        static inline double value( double dx1, double dy1, double s1,
+            double dx2, double dy2, double s2 )
+        {
+            return qwtSlopePChip( dx1, dy1, s1, dx2, dy2, s2 );
+        }
+    };
+}
+
+template< class Slope >
+static inline double qwtSlopeP3(
+    const QPointF& p1, const QPointF& p2, const QPointF& p3 )
+{
+    const double dx1 = p2.x() - p1.x();
+    const double dy1 = p2.y() - p1.y();
+    const double dx2 = p3.x() - p2.x();
+    const double dy2 = p3.y() - p2.y();
+
+    return Slope::value( dx1, dy1, dy1 / dx1, dx2, dy2, dy2 / dx2 );
+}
+
+static inline double qwtSlopeAkima( double s1, double s2, double s3, double s4 )
+{
+    if ( ( s1 == s2 ) && ( s3 == s4 ) )
+    {
+        return 0.5 * ( s2 + s3 );
+    }
+
+    const double ds12 = qAbs( s2 - s1 );
+    const double ds34 = qAbs( s4 - s3 );
+
+    return ( s2 * ds34 + s3 * ds12 ) / ( ds12 + ds34 );
+}
+
+static inline double qwtSlopeAkima( const QPointF& p1, const QPointF& p2,
+    const QPointF& p3, const QPointF& p4, const QPointF& p5 )
+{
+    const double s1 = qwtSlopeLine( p1, p2 );
+    const double s2 = qwtSlopeLine( p2, p3 );
+    const double s3 = qwtSlopeLine( p3, p4 );
+    const double s4 = qwtSlopeLine( p4, p5 );
+
+    return qwtSlopeAkima( s1, s2, s3, s4 );
+}
+
+template< class Slope >
+static void qwtSplineBoundariesL1(
+    const QwtSplineLocal* spline, const QVector< QPointF >& points,
+    double& slopeBegin, double& slopeEnd )
+{
+    const int n = points.size();
+    const QPointF* p = points.constData();
+
+    if ( ( spline->boundaryType() == QwtSpline::PeriodicPolygon )
+        || ( spline->boundaryType() == QwtSpline::ClosedPolygon ) )
+    {
+        const QPointF pn = p[0] - ( p[n - 1] - p[n - 2] );
+        slopeBegin = slopeEnd = qwtSlopeP3< Slope >( pn, p[0], p[1] );
+    }
+    else
+    {
+        const double m2 = qwtSlopeP3< Slope >( p[0], p[1], p[2] );
+        slopeBegin = spline->slopeAtBeginning( points, m2 );
+
+        const double mn2 = qwtSlopeP3< Slope >( p[n - 3], p[n - 2], p[n - 1] );
+        slopeEnd = spline->slopeAtEnd( points, mn2 );
+    }
+}
+
+template< class SplineStore, class Slope >
+static inline SplineStore qwtSplineL1(
+    const QwtSplineLocal* spline, const QVector< QPointF >& points )
+{
+    const int size = points.size();
+    const QPointF* p = points.constData();
+
+    double slopeBegin, slopeEnd;
+    qwtSplineBoundariesL1< Slope >( spline, points, slopeBegin, slopeEnd );
+
+    double m1 = slopeBegin;
+
+    SplineStore store;
+    store.init( points );
+    store.start( p[0], m1 );
+
+    double dx1 = p[1].x() - p[0].x();
+    double dy1 = p[1].y() - p[0].y();
+    double s1 = dy1 / dx1;
+
+    for ( int i = 1; i < size - 1; i++ )
+    {
+        const double dx2 = p[i + 1].x() - p[i].x();
+        const double dy2 = p[i + 1].y() - p[i].y();
+
+        // cardinal spline doesn't need the line slopes, but
+        // the compiler will eliminate pointless calculations
+        const double s2 = dy2 / dx2;
+
+        const double m2 = Slope::value( dx1, dy1, s1, dx2, dy2, s2 );
+
+        store.addCubic( p[i - 1], m1, p[i], m2 );
+
+        dx1 = dx2;
+        dy1 = dy2;
+        s1 = s2;
+        m1 = m2;
+    }
+
+    store.addCubic( p[size - 2], m1, p[size - 1], slopeEnd );
+
+    return store;
+}
+
+static inline void qwtSplineAkimaBoundaries(
+    const QwtSplineLocal* spline, const QVector< QPointF >& points,
+    double& slopeBegin, double& slopeEnd )
+{
+    const int n = points.size();
+    const QPointF* p = points.constData();
+
+    if ( ( spline->boundaryType() == QwtSpline::PeriodicPolygon )
+        || ( spline->boundaryType() == QwtSpline::ClosedPolygon ) )
+    {
+        const QPointF p2 = p[0] - ( p[n - 1] - p[n - 2] );
+        const QPointF p1 = p2 - ( p[n - 2] - p[n - 3] );
+
+        slopeBegin = slopeEnd = qwtSlopeAkima( p1, p2, p[0], p[1], p[2] );
+
+        return;
+    }
+
+    if ( spline->boundaryCondition( QwtSpline::AtBeginning ) == QwtSpline::Clamped1
+        && spline->boundaryCondition( QwtSpline::AtEnd ) == QwtSpline::Clamped1 )
+    {
+        slopeBegin = spline->boundaryValue( QwtSpline::AtBeginning);
+        slopeEnd = spline->boundaryValue( QwtSpline::AtEnd );
+
+        return;
+    }
+
+    if ( n == 3 )
+    {
+        const double s1 = qwtSlopeLine( p[0], p[1] );
+        const double s2 = qwtSlopeLine( p[1], p[2] );
+        const double m = qwtSlopeAkima( 0.5 * s1, s1, s2, 0.5 * s2 );
+
+        slopeBegin = spline->slopeAtBeginning( points, m );
+        slopeEnd = spline->slopeAtEnd( points, m );
+    }
+    else
+    {
+        double s[3];
+
+        s[0] = qwtSlopeLine( p[0], p[1] );
+        s[1] = qwtSlopeLine( p[1], p[2] );
+        s[2] = qwtSlopeLine( p[2], p[3] );
+
+        const double m2 = qwtSlopeAkima( 0.5 * s[0], s[0], s[1], s[2] );
+
+        slopeBegin = spline->slopeAtBeginning( points, m2 );
+
+        s[0] = qwtSlopeLine( p[n - 4], p[n - 3] );
+        s[1] = qwtSlopeLine( p[n - 3], p[n - 2] );
+        s[2] = qwtSlopeLine( p[n - 2], p[n - 1] );
+
+        const double mn2 = qwtSlopeAkima( s[0], s[1], s[2], 0.5 * s[2] );
+
+        slopeEnd = spline->slopeAtEnd( points, mn2 );
+    }
+}
+
+template< class SplineStore >
+static inline SplineStore qwtSplineAkima(
+    const QwtSplineLocal* spline, const QVector< QPointF >& points )
+{
+    const int size = points.size();
+    const QPointF* p = points.constData();
+
+    double slopeBegin, slopeEnd;
+    qwtSplineAkimaBoundaries( spline, points, slopeBegin, slopeEnd );
+
+    double m1 = slopeBegin;
+
+    SplineStore store;
+    store.init( points );
+    store.start( p[0], m1 );
+
+    double s2 = qwtSlopeLine( p[0], p[1] );
+    double s3 = qwtSlopeLine( p[1], p[2] );
+    double s1 = 0.5 * s2;
+
+    for ( int i = 0; i < size - 3; i++ )
+    {
+        const double s4 = qwtSlopeLine( p[i + 2],  p[i + 3] );
+
+        const double m2 = qwtSlopeAkima( s1, s2, s3, s4 );
+        store.addCubic( p[i], m1, p[i + 1], m2 );
+
+        s1 = s2;
+        s2 = s3;
+        s3 = s4;
+
+        m1 = m2;
+    }
+
+    const double m2 = qwtSlopeAkima( s1, s2, s3, 0.5 * s3 );
+
+    store.addCubic( p[size - 3], m1, p[size - 2], m2 );
+    store.addCubic( p[size - 2], m2, p[size - 1], slopeEnd );
+
+    return store;
+}
+
+template< class SplineStore >
+static inline SplineStore qwtSplineLocal(
+    const QwtSplineLocal* spline, const QVector< QPointF >& points )
+{
+    SplineStore store;
+
+    const int size = points.size();
+    if ( size <= 1 )
+        return store;
+
+    if ( size == 2 )
+    {
+        const double s0 = qwtSlopeLine( points[0], points[1] );
+        const double m1 = spline->slopeAtBeginning( points, s0 );
+        const double m2 = spline->slopeAtEnd( points, s0 );
+
+        store.init( points );
+        store.start( points[0], m1 );
+        store.addCubic( points[0], m1, points[1], m2 );
+
+        return store;
+    }
+
+    switch( spline->type() )
+    {
+        case QwtSplineLocal::Cardinal:
+        {
+            using namespace QwtSplineLocalP;
+            store = qwtSplineL1< SplineStore, slopeCardinal >( spline, points );
+            break;
+        }
+        case QwtSplineLocal::ParabolicBlending:
+        {
+            using namespace QwtSplineLocalP;
+            store = qwtSplineL1< SplineStore, slopeParabolicBlending >( spline, points );
+            break;
+        }
+        case QwtSplineLocal::PChip:
+        {
+            using namespace QwtSplineLocalP;
+            store = qwtSplineL1< SplineStore, slopePChip >( spline, points );
+            break;
+        }
+        case QwtSplineLocal::Akima:
+        {
+            store = qwtSplineAkima< SplineStore >( spline, points );
+            break;
+        }
+        default:
+            break;
+    }
+
+    return store;
+}
+
+/*!
+   \brief Constructor
+
+   \param type Spline type, specifying the type of interpolation
+   \sa type()
+ */
+QwtSplineLocal::QwtSplineLocal( Type type )
+    : m_type( type )
+{
+    setBoundaryCondition( QwtSpline::AtBeginning, QwtSpline::LinearRunout );
+    setBoundaryValue( QwtSpline::AtBeginning, 0.0 );
+
+    setBoundaryCondition( QwtSpline::AtEnd, QwtSpline::LinearRunout );
+    setBoundaryValue( QwtSpline::AtEnd, 0.0 );
+}
+
+//! Destructor
+QwtSplineLocal::~QwtSplineLocal()
+{
+}
+
+/*!
+   \return Spline type, specifying the type of interpolation
+ */
+QwtSplineLocal::Type QwtSplineLocal::type() const
+{
+    return m_type;
+}
+
+/*!
+   \brief Interpolate a curve with Bezier curves
+
+   Interpolates a polygon piecewise with cubic Bezier curves
+   and returns them as QPainterPath.
+
+   \param points Control points
+   \return Painter path, that can be rendered by QPainter
+ */
+QPainterPath QwtSplineLocal::painterPath( const QPolygonF& points ) const
+{
+    if ( parametrization()->type() == QwtSplineParametrization::ParameterX )
+    {
+        using namespace QwtSplineLocalP;
+        return qwtSplineLocal< PathStore >( this, points).path;
+    }
+
+    return QwtSplineC1::painterPath( points );
+}
+
+/*!
+   \brief Interpolate a curve with Bezier curves
+
+   Interpolates a polygon piecewise with cubic Bezier curves
+   and returns the 2 control points of each curve as QLineF.
+
+   \param points Control points
+   \return Control points of the interpolating Bezier curves
+ */
+QVector< QLineF > QwtSplineLocal::bezierControlLines( const QPolygonF& points ) const
+{
+    if ( parametrization()->type() == QwtSplineParametrization::ParameterX )
+    {
+        using namespace QwtSplineLocalP;
+        return qwtSplineLocal< ControlPointsStore >( this, points ).controlPoints;
+    }
+
+    return QwtSplineC1::bezierControlLines( points );
+}
+
+/*!
+   \brief Find the first derivative at the control points
+
+   \param points Control nodes of the spline
+   \return Vector with the values of the 2nd derivate at the control points
+
+   \note The x coordinates need to be increasing or decreasing
+ */
+QVector< double > QwtSplineLocal::slopes( const QPolygonF& points ) const
+{
+    using namespace QwtSplineLocalP;
+    return qwtSplineLocal< SlopeStore >( this, points ).slopes;
+}
+
+/*!
+   \brief Calculate the interpolating polynomials for a non parametric spline
+
+   \param points Control points
+   \return Interpolating polynomials
+
+   \note The x coordinates need to be increasing or decreasing
+   \note The implementation simply calls QwtSplineC1::polynomials(), but is
+        intended to be replaced by a one pass calculation some day.
+ */
+QVector< QwtSplinePolynomial > QwtSplineLocal::polynomials( const QPolygonF& points ) const
+{
+    // Polynomial store -> TODO
+    return QwtSplineC1::polynomials( points );
+}
+
+/*!
+   The locality of an spline interpolation identifies how many adjacent
+   polynomials are affected, when changing the position of one point.
+
+   The Cardinal, ParabolicBlending and PChip algorithms have a locality of 1,
+   while the Akima interpolation has a locality of 2.
+
+   \return 1 or 2.
+ */
+uint QwtSplineLocal::locality() const
+{
+    switch ( m_type )
+    {
+        case Akima:
+        {
+            // polynomials: 2 left, 2 right
+            return 2;
+        }
+        case Cardinal:
+        case ParabolicBlending:
+        case PChip:
+        {
+            // polynomials: 1 left, 1 right
+            return 1;
+        }
+    }
+
+    return QwtSplineC1::locality();
+}
Index: /trunk/BNC/qwt/qwt_spline_local.h
===================================================================
--- /trunk/BNC/qwt/qwt_spline_local.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_local.h	(revision 11158)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_SPLINE_LOCAL_H
+#define QWT_SPLINE_LOCAL_H
+
+#include "qwt_global.h"
+#include "qwt_spline.h"
+
+/*!
+   \brief A spline with C1 continuity
+
+   QwtSplineLocal offers several standard algorithms for interpolating
+   a curve with polynomials having C1 continuity at the control points.
+   All algorithms are local in a sense, that changing one control point
+   only few polynomials.
+ */
+class QWT_EXPORT QwtSplineLocal : public QwtSplineC1
+{
+  public:
+    /*!
+        \brief Spline interpolation type
+
+        All type of spline interpolations are lightweight algorithms
+        calculating the slopes at a point by looking 1 or 2 points back
+        and ahead.
+     */
+    enum Type
+    {
+        /*!
+           A cardinal spline
+
+           The cardinal spline interpolation is a very cheap calculation with
+           a locality of 1.
+         */
+        Cardinal,
+
+        /*!
+           Parabolic blending is a cheap calculation with a locality of 1. Sometimes
+           it is also called Cubic Bessel interpolation.
+         */
+        ParabolicBlending,
+
+        /*!
+           The algorithm of H.Akima is a calculation with a locality of 2.
+         */
+        Akima,
+
+        /*!
+           Piecewise Cubic Hermite Interpolating Polynomial (PCHIP) is an algorithm
+           that is popular because of being offered by MATLAB.
+
+           It preserves the shape of the data and respects monotonicity. It has a
+           locality of 1.
+         */
+        PChip
+    };
+
+    QwtSplineLocal( Type type );
+    virtual ~QwtSplineLocal();
+
+    Type type() const;
+
+    virtual uint locality() const QWT_OVERRIDE;
+
+    virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const QWT_OVERRIDE;
+
+    // calculating the parametric equations
+    virtual QVector< QwtSplinePolynomial > polynomials( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QVector< double > slopes( const QPolygonF& ) const QWT_OVERRIDE;
+
+  private:
+    const Type m_type;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_spline_parametrization.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_spline_parametrization.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_parametrization.cpp	(revision 11158)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_spline_parametrization.h"
+
+/*!
+   Constructor
+   \param type Parametrization type
+   \sa type()
+ */
+QwtSplineParametrization::QwtSplineParametrization( int type )
+    : m_type( type )
+{
+}
+
+//! Destructor
+QwtSplineParametrization::~QwtSplineParametrization()
+{
+}
+
+/*!
+   \brief Calculate the parameter value increment for 2 points
+
+   \param point1 First point
+   \param point2 Second point
+
+   \return Value increment
+ */
+double QwtSplineParametrization::valueIncrement(
+    const QPointF& point1, const QPointF& point2 ) const
+{
+    switch( m_type )
+    {
+        case QwtSplineParametrization::ParameterX:
+        {
+            return valueIncrementX( point1, point2 );
+        }
+        case QwtSplineParametrization::ParameterY:
+        {
+            return valueIncrementY( point1, point2 );
+        }
+        case QwtSplineParametrization::ParameterCentripetal:
+        {
+            return valueIncrementCentripetal( point1, point2 );
+        }
+        case QwtSplineParametrization::ParameterChordal:
+        {
+            return valueIncrementChordal( point1, point2 );
+        }
+        case QwtSplineParametrization::ParameterManhattan:
+        {
+            return valueIncrementManhattan( point1, point2 );
+        }
+        case QwtSplineParametrization::ParameterUniform:
+        {
+            return valueIncrementUniform( point1, point2 );
+        }
+        default:
+        {
+            return 1;
+        }
+    }
+}
+
+//! \return Parametrization type
+int QwtSplineParametrization::type() const
+{
+    return m_type;
+}
Index: /trunk/BNC/qwt/qwt_spline_parametrization.h
===================================================================
--- /trunk/BNC/qwt/qwt_spline_parametrization.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_parametrization.h	(revision 11158)
@@ -0,0 +1,216 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_SPLINE_PARAMETRIZATION_H
+#define QWT_SPLINE_PARAMETRIZATION_H
+
+#include "qwt_global.h"
+#include "qwt_math.h"
+
+#include <qpoint.h>
+
+/*!
+   \brief Curve parametrization used for a spline interpolation
+
+   Parametrization is the process of finding a parameter value for
+   each curve point - usually related to some physical quantity
+   ( distance, time ... ).
+
+   Often accumulating the curve length is the intended way of parametrization,
+   but as the interpolated curve is not known in advance an approximation
+   needs to be used.
+
+   The values are calculated by cumulating increments, that are provided
+   by QwtSplineParametrization. As the curve parameters need to be
+   montonically increasing, each increment need to be positive.
+
+   - t[0] = 0;
+   - t[i] = t[i-1] + valueIncrement( point[i-1], p[i] );
+
+   QwtSplineParametrization provides the most common used type of
+   parametrizations and offers an interface to inject custom implementations.
+
+   \note The most relevant types of parametrization are trying to provide an
+        approximation of the curve length.
+
+   \sa QwtSpline::setParametrization()
+ */
+class QWT_EXPORT QwtSplineParametrization
+{
+  public:
+    //! Parametrization type
+    enum Type
+    {
+        /*!
+           No parametrization: t[i] = x[i]
+           \sa valueIncrementX()
+         */
+        ParameterX,
+
+        /*!
+           No parametrization: t[i] = y[i]
+           \sa valueIncrementY()
+         */
+        ParameterY,
+
+        /*!
+           Uniform parametrization: t[i] = i;
+
+           A very fast parametrization, with good results, when the geometry
+           of the control points is somehow "equidistant". F.e. when
+           recording the position of a body, that is moving with constant
+           speed every n seconds.
+
+           \sa valueIncrementUniform()
+         */
+        ParameterUniform,
+
+        /*!
+           Parametrization using the chordal length between two control points
+
+           The chordal length is the most commonly used approximation for
+           the curve length.
+
+           \sa valueIncrementChordal()
+         */
+        ParameterChordal,
+
+        /*!
+           Centripetal parametrization
+
+           Based on the square root of the chordal length.
+
+           Its name stems from the physical observations regarding
+           the centripetal force, of a body moving along the curve.
+
+           \sa valueIncrementCentripetal()
+         */
+        ParameterCentripetal,
+
+
+        /*!
+           Parametrization using the manhattan length between two control points
+
+           Approximating the curve length by the manhattan length is faster
+           than the chordal length, but usually gives worse results.
+
+           \sa valueIncrementManhattan()
+         */
+        ParameterManhattan
+    };
+
+    explicit QwtSplineParametrization( int type );
+    virtual ~QwtSplineParametrization();
+
+    int type() const;
+
+    virtual double valueIncrement( const QPointF&, const QPointF& ) const;
+
+    static double valueIncrementX( const QPointF&, const QPointF& );
+    static double valueIncrementY( const QPointF&, const QPointF& );
+    static double valueIncrementUniform( const QPointF&, const QPointF& );
+    static double valueIncrementChordal( const QPointF&, const QPointF& );
+    static double valueIncrementCentripetal( const QPointF&, const QPointF& );
+    static double valueIncrementManhattan( const QPointF&, const QPointF& );
+
+  private:
+    const int m_type;
+};
+
+/*!
+   \brief Calculate the ParameterX value increment for 2 points
+
+   \param point1 First point
+   \param point2 Second point
+
+   \return point2.x() - point1.x();
+ */
+inline double QwtSplineParametrization::valueIncrementX(
+    const QPointF& point1, const QPointF& point2 )
+{
+    return point2.x() - point1.x();
+}
+
+/*!
+   \brief Calculate the ParameterY value increment for 2 points
+
+   \param point1 First point
+   \param point2 Second point
+
+   \return point2.y() - point1.y();
+ */
+inline double QwtSplineParametrization::valueIncrementY(
+    const QPointF& point1, const QPointF& point2 )
+{
+    return point2.y() - point1.y();
+}
+
+/*!
+   \brief Calculate the ParameterUniform value increment
+
+   \param point1 First point
+   \param point2 Second point
+
+   \return 1.0
+ */
+inline double QwtSplineParametrization::valueIncrementUniform(
+    const QPointF& point1, const QPointF& point2 )
+{
+    Q_UNUSED( point1 )
+    Q_UNUSED( point2 )
+
+    return 1.0;
+}
+
+/*!
+   \brief Calculate the ParameterChordal value increment for 2 points
+
+   \param point1 First point
+   \param point2 Second point
+
+   \return qSqrt( dx * dx + dy * dy );
+ */
+inline double QwtSplineParametrization::valueIncrementChordal(
+    const QPointF& point1, const QPointF& point2 )
+{
+    const double dx = point2.x() - point1.x();
+    const double dy = point2.y() - point1.y();
+
+    return std::sqrt( dx * dx + dy * dy );
+}
+
+/*!
+   \brief Calculate the ParameterCentripetal value increment for 2 points
+
+   \param point1 First point
+   \param point2 Second point
+
+   \return The square root of a chordal increment
+ */
+inline double QwtSplineParametrization::valueIncrementCentripetal(
+    const QPointF& point1, const QPointF& point2 )
+{
+    return std::sqrt( valueIncrementChordal( point1, point2 ) );
+}
+
+/*!
+   \brief Calculate the ParameterManhattan value increment for 2 points
+
+   \param point1 First point
+   \param point2 Second point
+
+   \return | point2.x() - point1.x() | + | point2.y() - point1.y() |
+ */
+inline double QwtSplineParametrization::valueIncrementManhattan(
+    const QPointF& point1, const QPointF& point2 )
+{
+    return qAbs( point2.x() - point1.x() ) + qAbs( point2.y() - point1.y() );
+}
+
+#endif
Index: /trunk/BNC/qwt/qwt_spline_pleasing.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_spline_pleasing.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_pleasing.cpp	(revision 11158)
@@ -0,0 +1,351 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_spline_pleasing.h"
+#include "qwt_spline_parametrization.h"
+
+#include <qpainterpath.h>
+
+static inline double qwtChordalLength( const QPointF& point1, const QPointF& point2 )
+{
+    const double dx = point2.x() - point1.x();
+    const double dy = point2.y() - point1.y();
+
+    return std::sqrt( dx * dx + dy * dy );
+}
+
+template< class Param >
+static QPointF qwtVector( Param param,
+    const QPointF& p1, const QPointF& p2 )
+{
+    return ( p2 - p1 ) / param( p1, p2 );
+}
+
+template< class Param >
+static QPointF qwtVectorCardinal( Param param,
+    const QPointF& p1, const QPointF& p2, const QPointF& p3 )
+{
+    const double t1 = param( p1, p2 );
+    const double t2 = param( p2, p3 );
+
+    return t2 * ( p3 - p1 ) / ( t1 + t2 );
+}
+
+namespace QwtSplinePleasingP
+{
+    struct Tension
+    {
+        double t1;
+        double t2;
+    };
+
+    struct param
+    {
+        param( const QwtSplineParametrization* p ):
+            parameter( p )
+        {
+        }
+
+        inline double operator()( const QPointF& p1, const QPointF& p2 ) const
+        {
+            return parameter->valueIncrement( p1, p2 );
+        }
+
+        const QwtSplineParametrization* parameter;
+    };
+
+    struct paramUniform
+    {
+        inline double operator()( const QPointF& p1, const QPointF& p2 ) const
+        {
+            return QwtSplineParametrization::valueIncrementUniform( p1, p2 );
+        }
+    };
+
+    class PathStore
+    {
+      public:
+        inline void init( int )
+        {
+        }
+
+        inline void start( const QPointF& p0 )
+        {
+            path.moveTo( p0 );
+        }
+
+        inline void addCubic( const QPointF& cp1,
+            const QPointF& cp2, const QPointF& p2 )
+        {
+            path.cubicTo( cp1, cp2, p2 );
+        }
+
+        QPainterPath path;
+    };
+
+    class ControlPointsStore
+    {
+      public:
+        inline ControlPointsStore():
+            m_cp( NULL )
+        {
+        }
+
+        inline void init( int size )
+        {
+            controlPoints.resize( size );
+            m_cp = controlPoints.data();
+        }
+
+        inline void start( const QPointF& )
+        {
+        }
+
+        inline void addCubic( const QPointF& cp1,
+            const QPointF& cp2, const QPointF& )
+        {
+            QLineF& l = *m_cp++;
+            l.setPoints( cp1, cp2 );
+        }
+
+        QVector< QLineF > controlPoints;
+
+      private:
+        QLineF* m_cp;
+    };
+}
+
+static inline QwtSplinePleasingP::Tension qwtTensionPleasing(
+    double d13, double d23, double d24,
+    const QPointF& p1, const QPointF& p2,
+    const QPointF& p3, const QPointF& p4 )
+{
+    QwtSplinePleasingP::Tension tension;
+
+    const bool b1 = ( d13 / 3.0 ) < d23;
+    const bool b2 = ( d24 / 3.0 ) < d23;
+
+    if ( b1 )
+    {
+        if ( b2 )
+        {
+            tension.t1 = ( p1 != p2 ) ? ( 1.0 / 3.0 ) : ( 2.0 / 3.0 );
+            tension.t2 = ( p3 != p4 ) ? ( 1.0 / 3.0 ) : ( 2.0 / 3.0 );
+        }
+        else
+        {
+            tension.t1 = tension.t2 = d23 / d24;
+        }
+    }
+    else
+    {
+        if ( b2 )
+        {
+            tension.t1 = tension.t2 = d23 / d13;
+        }
+        else
+        {
+            tension.t1 = d23 / d13;
+            tension.t2 = d23 / d24;
+        }
+    }
+
+    return tension;
+}
+
+template< class SplineStore, class Param >
+static SplineStore qwtSplinePathPleasing( const QPolygonF& points,
+    bool isClosed, Param param )
+{
+    using namespace QwtSplinePleasingP;
+
+    const int size = points.size();
+
+    const QPointF* p = points.constData();
+
+    SplineStore store;
+    store.init( isClosed ? size : size - 1 );
+    store.start( p[0] );
+
+    double d13;
+    QPointF vec1;
+
+    if ( isClosed )
+    {
+        d13 = qwtChordalLength(p[0], p[2]);
+
+        const Tension t0 = qwtTensionPleasing(
+            qwtChordalLength( p[size - 1], p[1]), qwtChordalLength(p[0], p[1]),
+            d13, p[size - 1], p[0], p[1], p[2] );
+
+        const QPointF vec0 = qwtVectorCardinal< Param >( param, p[size - 1], p[0], p[1] );
+        vec1 = qwtVectorCardinal< Param >( param, p[0], p[1], p[2] );
+
+        store.addCubic( p[0] + vec0 * t0.t1, p[1] - vec1 * t0.t2, p[1] );
+    }
+    else
+    {
+        d13 = qwtChordalLength(p[0], p[2]);
+
+        const Tension t0 = qwtTensionPleasing(
+            qwtChordalLength( p[0], p[1]), qwtChordalLength(p[0], p[1]),
+            d13,  p[0], p[0], p[1], p[2] );
+
+        const QPointF vec0 = 0.5 * qwtVector< Param >( param, p[0], p[1] );
+        vec1 = qwtVectorCardinal< Param >( param, p[0], p[1], p[2] );
+
+        store.addCubic( p[0] + vec0 * t0.t1, p[1] - vec1 * t0.t2, p[1] );
+    }
+
+    for ( int i = 1; i < size - 2; i++ )
+    {
+        const double d23 = qwtChordalLength( p[i], p[i + 1] );
+        const double d24 = qwtChordalLength( p[i], p[i + 2] );
+
+        const QPointF vec2 = qwtVectorCardinal< Param >( param, p[i], p[i + 1], p[i + 2] );
+
+        const Tension t = qwtTensionPleasing(
+            d13, d23, d24, p[i - 1], p[i], p[i + 1], p[i + 2] );
+
+        store.addCubic( p[i] + vec1 * t.t1, p[i + 1] - vec2 * t.t2, p[i + 1] );
+
+        d13 = d24;
+        vec1 = vec2;
+    }
+
+    if ( isClosed )
+    {
+        const double d24 = qwtChordalLength( p[size - 2], p[0] );
+
+        const Tension tn = qwtTensionPleasing(
+            d13, qwtChordalLength( p[size - 2], p[size - 1] ), d24,
+            p[size - 3], p[size - 2], p[size - 1], p[0] );
+
+        const QPointF vec2 = qwtVectorCardinal< Param >( param, p[size - 2], p[size - 1], p[0] );
+        store.addCubic( p[size - 2] + vec1 * tn.t1, p[size - 1] - vec2 * tn.t2, p[size - 1] );
+
+        const double d34 = qwtChordalLength( p[size - 1], p[0] );
+        const double d35 = qwtChordalLength( p[size - 1], p[1] );
+
+        const Tension tc = qwtTensionPleasing( d24, d34, d35, p[size - 2], p[size - 1], p[0], p[1] );
+
+        const QPointF vec3 = qwtVectorCardinal< Param >( param, p[size - 1], p[0], p[1] );
+
+        store.addCubic( p[size - 1] + vec2 * tc.t1, p[0] - vec3 * tc.t2, p[0] );
+    }
+    else
+    {
+        const double d24 = qwtChordalLength( p[size - 2], p[size - 1] );
+
+        const Tension tn = qwtTensionPleasing(
+            d13, qwtChordalLength( p[size - 2], p[size - 1] ), d24,
+            p[size - 3], p[size - 2], p[size - 1], p[size - 1] );
+
+        const QPointF vec2 = 0.5 * qwtVector< Param >( param, p[size - 2], p[size - 1] );
+        store.addCubic( p[size - 2] + vec1 * tn.t1, p[size - 1] - vec2 * tn.t2, p[size - 1] );
+    }
+
+    return store;
+}
+
+/*!
+   \brief Constructor
+
+   The default setting is a non closing spline with uniform parametrization.
+   ( QwtSplineParametrization::ParameterUniform ).
+
+   \sa QwtSpline::setParametrization(), QwtSpline::setBoundaryType()
+ */
+QwtSplinePleasing::QwtSplinePleasing()
+{
+    setParametrization( QwtSplineParametrization::ParameterUniform );
+}
+
+//! Destructor
+QwtSplinePleasing::~QwtSplinePleasing()
+{
+}
+
+//! \return 2
+uint QwtSplinePleasing::locality() const
+{
+    return 2;
+}
+
+/*!
+   \brief Interpolate a curve with Bezier curves
+
+   Interpolates a polygon piecewise with cubic Bezier curves
+   and returns them as QPainterPath.
+
+   \param points Control points
+   \return QPainterPath Painter path, that can be rendered by QPainter
+ */
+QPainterPath QwtSplinePleasing::painterPath( const QPolygonF& points ) const
+{
+    const int size = points.size();
+    if ( size <= 2 )
+        return QwtSplineG1::painterPath( points );
+
+    const bool isClosing = ( boundaryType() == QwtSpline::ClosedPolygon );
+
+    using namespace QwtSplinePleasingP;
+
+    PathStore store;
+    if ( parametrization()->type() == QwtSplineParametrization::ParameterUniform )
+    {
+        store = qwtSplinePathPleasing< PathStore >( points,
+            isClosing, paramUniform() );
+    }
+    else
+    {
+        store = qwtSplinePathPleasing< PathStore >( points,
+            isClosing, param( parametrization() ) );
+    }
+
+    if ( isClosing )
+        store.path.closeSubpath();
+
+    return store.path;
+}
+
+/*!
+   \brief Interpolate a curve with Bezier curves
+
+   Interpolates a polygon piecewise with cubic Bezier curves
+   and returns the 2 control points of each curve as QLineF.
+
+   \param points Control points
+   \return Control points of the interpolating Bezier curves
+ */
+QVector< QLineF > QwtSplinePleasing::bezierControlLines(
+    const QPolygonF& points ) const
+{
+    const int size = points.size();
+    if ( size <= 2 )
+        return QVector< QLineF >();
+
+    const bool isClosing = ( boundaryType() == QwtSpline::ClosedPolygon );
+
+    using namespace QwtSplinePleasingP;
+
+    ControlPointsStore store;
+    if ( parametrization()->type() == QwtSplineParametrization::ParameterUniform )
+    {
+        store = qwtSplinePathPleasing< ControlPointsStore >( points,
+            isClosing, paramUniform() );
+    }
+    else
+    {
+        store = qwtSplinePathPleasing< ControlPointsStore >( points,
+            isClosing, param( parametrization() ) );
+    }
+
+    return store.controlPoints;
+}
Index: /trunk/BNC/qwt/qwt_spline_pleasing.h
===================================================================
--- /trunk/BNC/qwt/qwt_spline_pleasing.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_pleasing.h	(revision 11158)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_SPLINE_PLEASING_H
+#define QWT_SPLINE_PLEASING_H
+
+#include "qwt_spline.h"
+
+/*!
+   \brief A spline with G1 continuity
+
+   QwtSplinePleasing is some sort of cardinal spline, with
+   non C1 continuous extra rules for narrow angles. It has a locality of 2.
+
+   \note The algorithm is the one offered by a popular office package.
+ */
+class QWT_EXPORT QwtSplinePleasing : public QwtSplineG1
+{
+  public:
+    QwtSplinePleasing();
+    virtual ~QwtSplinePleasing();
+
+    virtual uint locality() const QWT_OVERRIDE;
+
+    virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const QWT_OVERRIDE;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_spline_polynomial.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_spline_polynomial.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_polynomial.cpp	(revision 11158)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_spline_polynomial.h"
+
+namespace
+{
+    static const struct RegisterQwtSplinePolynomial
+    {
+        inline RegisterQwtSplinePolynomial()
+            { qRegisterMetaType< QwtSplinePolynomial >(); }
+
+    } qwtRegisterQwtSplinePolynomial;
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+
+#include <qdebug.h>
+
+QDebug operator<<( QDebug debug, const QwtSplinePolynomial& polynomial )
+{
+    debug.nospace() << "Polynom(" << polynomial.c3 << ", "
+                    << polynomial.c2 << ", " << polynomial.c1 << ")";
+    return debug.space();
+}
+
+#endif
+
Index: /trunk/BNC/qwt/qwt_spline_polynomial.h
===================================================================
--- /trunk/BNC/qwt/qwt_spline_polynomial.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_spline_polynomial.h	(revision 11158)
@@ -0,0 +1,219 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_SPLINE_POLYNOMIAL_H
+#define QWT_SPLINE_POLYNOMIAL_H
+
+#include "qwt_global.h"
+
+#include <qpoint.h>
+#include <qmetatype.h>
+
+/*!
+   \brief A cubic polynomial without constant term
+
+   QwtSplinePolynomial is a 3rd degree polynomial
+   of the form: y = c3 * x³ + c2 * x² + c1 * x;
+
+   QwtSplinePolynomial is usually used in combination with polygon
+   interpolation, where it is not necessary to store a constant term ( c0 ),
+   as the translation is known from the corresponding polygon points.
+
+   \sa QwtSplineC1
+ */
+class QWT_EXPORT QwtSplinePolynomial
+{
+  public:
+    QwtSplinePolynomial( double c3 = 0.0, double c2 = 0.0, double c1 = 0.0 );
+
+    bool operator==( const QwtSplinePolynomial& ) const;
+    bool operator!=( const QwtSplinePolynomial& ) const;
+
+    double valueAt( double x ) const;
+    double slopeAt( double x ) const;
+    double curvatureAt( double x ) const;
+
+    static QwtSplinePolynomial fromSlopes(
+        const QPointF& p1, double m1,
+        const QPointF& p2, double m2 );
+
+    static QwtSplinePolynomial fromSlopes(
+        double x, double y, double m1, double m2 );
+
+    static QwtSplinePolynomial fromCurvatures(
+        const QPointF& p1, double cv1,
+        const QPointF& p2, double cv2 );
+
+    static QwtSplinePolynomial fromCurvatures(
+        double dx, double dy, double cv1, double cv2 );
+
+  public:
+    //! coefficient of the cubic summand
+    double c3;
+
+    //! coefficient of the quadratic summand
+    double c2;
+
+    //! coefficient of the linear summand
+    double c1;
+};
+
+Q_DECLARE_TYPEINFO( QwtSplinePolynomial, Q_MOVABLE_TYPE );
+Q_DECLARE_METATYPE( QwtSplinePolynomial )
+
+/*!
+   \brief Constructor
+
+   \param a3 Coefficient of the cubic summand
+   \param a2 Coefficient of the quadratic summand
+   \param a1 Coefficient of the linear summand
+ */
+inline QwtSplinePolynomial::QwtSplinePolynomial( double a3, double a2, double a1 )
+    : c3( a3 )
+    , c2( a2 )
+    , c1( a1 )
+{
+}
+
+/*!
+   \param other Other polynomial
+   \return true, when both polynomials have the same coefficients
+ */
+inline bool QwtSplinePolynomial::operator==( const QwtSplinePolynomial& other ) const
+{
+    return ( c3 == other.c3 ) && ( c2 == other.c2 ) && ( c1 == other.c1 );
+}
+
+/*!
+   \param other Other polynomial
+   \return true, when the polynomials have different coefficients
+ */
+inline bool QwtSplinePolynomial::operator!=( const QwtSplinePolynomial& other ) const
+{
+    return ( !( *this == other ) );
+}
+
+/*!
+   Calculate the value of a polynomial for a given x
+
+   \param x Parameter
+   \return Value at x
+ */
+inline double QwtSplinePolynomial::valueAt( double x ) const
+{
+    return ( ( ( c3 * x ) + c2 ) * x + c1 ) * x;
+}
+
+/*!
+   Calculate the value of the first derivate of a polynomial for a given x
+
+   \param x Parameter
+   \return Slope at x
+ */
+inline double QwtSplinePolynomial::slopeAt( double x ) const
+{
+    return ( 3.0 * c3 * x + 2.0 * c2 ) * x + c1;
+}
+
+/*!
+   Calculate the value of the second derivate of a polynomial for a given x
+
+   \param x Parameter
+   \return Curvature at x
+ */
+inline double QwtSplinePolynomial::curvatureAt( double x ) const
+{
+    return 6.0 * c3 * x + 2.0 * c2;
+}
+
+/*!
+   Find the coefficients for the polynomial including 2 points with
+   specific values for the 1st derivates at these points.
+
+   \param p1 First point
+   \param m1 Value of the first derivate at p1
+   \param p2 Second point
+   \param m2 Value of the first derivate at p2
+
+   \return Coefficients of the polynomials
+   \note The missing constant term of the polynomial is p1.y()
+ */
+inline QwtSplinePolynomial QwtSplinePolynomial::fromSlopes(
+    const QPointF& p1, double m1, const QPointF& p2, double m2 )
+{
+    return fromSlopes( p2.x() - p1.x(), p2.y() - p1.y(), m1, m2 );
+}
+
+/*!
+   Find the coefficients for the polynomial from the offset between 2 points
+   and specific values for the 1st derivates at these points.
+
+   \param dx X-offset
+   \param dy Y-offset
+   \param m1 Value of the first derivate at p1
+   \param m2 Value of the first derivate at p2
+
+   \return Coefficients of the polynomials
+ */
+inline QwtSplinePolynomial QwtSplinePolynomial::fromSlopes(
+    double dx, double dy, double m1, double m2 )
+{
+    const double c2 = ( 3.0 * dy / dx - 2 * m1 - m2 ) / dx;
+    const double c3 = ( ( m2 - m1 ) / dx - 2.0 * c2 ) / ( 3.0 * dx );
+
+    return QwtSplinePolynomial( c3, c2, m1 );
+}
+
+/*!
+   Find the coefficients for the polynomial including 2 points with
+   specific values for the 2nd derivates at these points.
+
+   \param p1 First point
+   \param cv1 Value of the second derivate at p1
+   \param p2 Second point
+   \param cv2 Value of the second derivate at p2
+
+   \return Coefficients of the polynomials
+   \note The missing constant term of the polynomial is p1.y()
+ */
+inline QwtSplinePolynomial QwtSplinePolynomial::fromCurvatures(
+    const QPointF& p1, double cv1, const QPointF& p2, double cv2 )
+{
+    return fromCurvatures( p2.x() - p1.x(), p2.y() - p1.y(), cv1, cv2 );
+}
+
+/*!
+   Find the coefficients for the polynomial from the offset between 2 points
+   and specific values for the 2nd derivates at these points.
+
+   \param dx X-offset
+   \param dy Y-offset
+   \param cv1 Value of the second derivate at p1
+   \param cv2 Value of the second derivate at p2
+
+   \return Coefficients of the polynomials
+ */
+inline QwtSplinePolynomial QwtSplinePolynomial::fromCurvatures(
+    double dx, double dy, double cv1, double cv2 )
+{
+    const double c3 = ( cv2 - cv1 ) / ( 6.0 * dx );
+    const double c2 = 0.5 * cv1;
+    const double c1 = dy / dx - ( c3 * dx + c2 ) * dx;
+
+    return QwtSplinePolynomial( c3, c2, c1 );
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+
+class QDebug;
+QWT_EXPORT QDebug operator<<( QDebug, const QwtSplinePolynomial& );
+
+#endif
+
+#endif
Index: /trunk/BNC/qwt/qwt_symbol.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_symbol.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_symbol.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,10 +11,10 @@
 #include "qwt_painter.h"
 #include "qwt_graphic.h"
-#include <qapplication.h>
+#include "qwt_math.h"
+
 #include <qpainter.h>
 #include <qpainterpath.h>
 #include <qpixmap.h>
 #include <qpaintengine.h>
-#include <qmath.h>
 #ifndef QWT_NO_SVG
 #include <qsvgrenderer.h>
@@ -32,6 +32,6 @@
 }
 
-static QwtGraphic qwtPathGraphic( const QPainterPath &path,
-    const QPen &pen, const QBrush& brush )
+static QwtGraphic qwtPathGraphic( const QPainterPath& path,
+    const QPen& pen, const QBrush& brush )
 {
     QwtGraphic graphic;
@@ -48,5 +48,5 @@
 
 static inline QRectF qwtScaledBoundingRect(
-    const QwtGraphic &graphic, const QSizeF size )
+    const QwtGraphic& graphic, const QSizeF size )
 {
     QSizeF scaledSize = size;
@@ -67,6 +67,6 @@
 }
 
-static inline void qwtDrawPixmapSymbols( QPainter *painter,
-    const QPointF *points, int numPoints, const QwtSymbol &symbol )
+static inline void qwtDrawPixmapSymbols( QPainter* painter,
+    const QPointF* points, int numPoints, const QwtSymbol& symbol )
 {
     QSize size = symbol.size();
@@ -102,7 +102,7 @@
 #ifndef QWT_NO_SVG
 
-static inline void qwtDrawSvgSymbols( QPainter *painter,
-    const QPointF *points, int numPoints,
-    QSvgRenderer *renderer, const QwtSymbol &symbol )
+static inline void qwtDrawSvgSymbols( QPainter* painter,
+    const QPointF* points, int numPoints,
+    QSvgRenderer* renderer, const QwtSymbol& symbol )
 {
     if ( renderer == NULL || !renderer->isValid() )
@@ -139,7 +139,7 @@
 #endif
 
-static inline void qwtDrawGraphicSymbols( QPainter *painter,
-    const QPointF *points, int numPoints, const QwtGraphic &graphic,
-    const QwtSymbol &symbol )
+static inline void qwtDrawGraphicSymbols( QPainter* painter,
+    const QPointF* points, int numPoints, const QwtGraphic& graphic,
+    const QwtSymbol& symbol )
 {
     const QRectF pointRect = graphic.controlPointRect();
@@ -178,6 +178,6 @@
 }
 
-static inline void qwtDrawEllipseSymbols( QPainter *painter,
-    const QPointF *points, int numPoints, const QwtSymbol &symbol )
+static inline void qwtDrawEllipseSymbols( QPainter* painter,
+    const QPointF* points, int numPoints, const QwtSymbol& symbol )
 {
     painter->setBrush( symbol.brush() );
@@ -220,6 +220,6 @@
 }
 
-static inline void qwtDrawRectSymbols( QPainter *painter,
-    const QPointF *points, int numPoints, const QwtSymbol &symbol )
+static inline void qwtDrawRectSymbols( QPainter* painter,
+    const QPointF* points, int numPoints, const QwtSymbol& symbol )
 {
     const QSize size = symbol.size();
@@ -265,6 +265,6 @@
 }
 
-static inline void qwtDrawDiamondSymbols( QPainter *painter,
-    const QPointF *points, int numPoints, const QwtSymbol &symbol )
+static inline void qwtDrawDiamondSymbols( QPainter* painter,
+    const QPointF* points, int numPoints, const QwtSymbol& symbol )
 {
     const QSize size = symbol.size();
@@ -300,5 +300,5 @@
         for ( int i = 0; i < numPoints; i++ )
         {
-            const QPointF &pos = points[i];
+            const QPointF& pos = points[i];
 
             const double x1 = pos.x() - 0.5 * size.width();
@@ -319,7 +319,7 @@
 
 static inline void qwtDrawTriangleSymbols(
-    QPainter *painter, QwtTriangle::Type type,
-    const QPointF *points, int numPoints,
-    const QwtSymbol &symbol )
+    QPainter* painter, QwtTriangle::Type type,
+    const QPointF* points, int numPoints,
+    const QwtSymbol& symbol )
 {
     const QSize size = symbol.size();
@@ -338,14 +338,14 @@
     if ( doAlign )
     {
-        sw2 = qFloor( sw2 );
-        sh2 = qFloor( sh2 );
+        sw2 = std::floor( sw2 );
+        sh2 = std::floor( sh2 );
     }
 
     QPolygonF triangle( 3 );
-    QPointF *trianglePoints = triangle.data();
+    QPointF* trianglePoints = triangle.data();
 
     for ( int i = 0; i < numPoints; i++ )
     {
-        const QPointF &pos = points[i];
+        const QPointF& pos = points[i];
 
         double x = pos.x();
@@ -423,6 +423,6 @@
 
 static inline void qwtDrawLineSymbols(
-    QPainter *painter, int orientations,
-    const QPointF *points, int numPoints, const QwtSymbol &symbol )
+    QPainter* painter, int orientations,
+    const QPointF* points, int numPoints, const QwtSymbol& symbol )
 {
     const QSize size = symbol.size();
@@ -442,6 +442,6 @@
     if ( QwtPainter::roundingAlignment( painter ) )
     {
-        const int sw = qFloor( size.width() );
-        const int sh = qFloor( size.height() );
+        const int sw = qwtFloor( size.width() );
+        const int sh = qwtFloor( size.height() );
         const int sw2 = size.width() / 2;
         const int sh2 = size.height() / 2;
@@ -492,6 +492,6 @@
 }
 
-static inline void qwtDrawXCrossSymbols( QPainter *painter,
-    const QPointF *points, int numPoints, const QwtSymbol &symbol )
+static inline void qwtDrawXCrossSymbols( QPainter* painter,
+    const QPointF* points, int numPoints, const QwtSymbol& symbol )
 {
     const QSize size = symbol.size();
@@ -516,5 +516,5 @@
         for ( int i = 0; i < numPoints; i++ )
         {
-            const QPointF &pos = points[i];
+            const QPointF& pos = points[i];
 
             const int x = qRound( pos.x() );
@@ -539,5 +539,5 @@
         for ( int i = 0; i < numPoints; i++ )
         {
-            const QPointF &pos = points[i];
+            const QPointF& pos = points[i];
 
             const double x1 = pos.x() - sw2;
@@ -552,6 +552,6 @@
 }
 
-static inline void qwtDrawStar1Symbols( QPainter *painter,
-    const QPointF *points, int numPoints, const QwtSymbol &symbol )
+static inline void qwtDrawStar1Symbols( QPainter* painter,
+    const QPointF* points, int numPoints, const QwtSymbol& symbol )
 {
     const QSize size = symbol.size();
@@ -575,5 +575,5 @@
             QwtPainter::drawLine( painter,
                 qRound( r.left() + d1 ), qRound( r.bottom() - d1 ),
-                qRound( r .right() - d1), qRound( r.top() + d1 ) );
+                qRound( r.right() - d1), qRound( r.top() + d1 ) );
 
             const QPoint c = r.center();
@@ -596,5 +596,5 @@
 
             const QPointF c = r.center();
-            const double d1  = r.width() / 2.0 * ( 1.0 - sqrt1_2 );
+            const double d1 = r.width() / 2.0 * ( 1.0 - sqrt1_2 );
 
             QwtPainter::drawLine( painter,
@@ -614,6 +614,6 @@
 }
 
-static inline void qwtDrawStar2Symbols( QPainter *painter,
-    const QPointF *points, int numPoints, const QwtSymbol &symbol )
+static inline void qwtDrawStar2Symbols( QPainter* painter,
+    const QPointF* points, int numPoints, const QwtSymbol& symbol )
 {
     QPen pen = symbol.pen();
@@ -631,5 +631,5 @@
 
     QPolygonF star( 12 );
-    QPointF *starPoints = star.data();
+    QPointF* starPoints = star.data();
 
     const bool doAlign = QwtPainter::roundingAlignment( painter );
@@ -705,6 +705,6 @@
 }
 
-static inline void qwtDrawHexagonSymbols( QPainter *painter,
-    const QPointF *points, int numPoints, const QwtSymbol &symbol )
+static inline void qwtDrawHexagonSymbols( QPainter* painter,
+    const QPointF* points, int numPoints, const QwtSymbol& symbol )
 {
     painter->setBrush( symbol.brush() );
@@ -717,5 +717,5 @@
 
     QPolygonF hexaPolygon( 6 );
-    QPointF *hexaPoints = hexaPolygon.data();
+    QPointF* hexaPoints = hexaPolygon.data();
 
     const bool doAlign = QwtPainter::roundingAlignment( painter );
@@ -735,6 +735,6 @@
         if ( doAlign )
         {
-            x1 = qCeil( x1 );
-            y1 = qCeil( y1 );
+            x1 = std::ceil( x1 );
+            y1 = std::ceil( y1 );
         }
 
@@ -770,12 +770,12 @@
 class QwtSymbol::PrivateData
 {
-public:
-    PrivateData( QwtSymbol::Style st, const QBrush &br,
-            const QPen &pn, const QSize &sz ):
-        style( st ),
-        size( sz ),
-        brush( br ),
-        pen( pn ),
-        isPinPointEnabled( false )
+  public:
+    PrivateData( QwtSymbol::Style st, const QBrush& br,
+            const QPen& pn, const QSize& sz )
+        : style( st )
+        , size( sz )
+        , brush( br )
+        , pen( pn )
+        , isPinPointEnabled( false )
     {
         cache.policy = QwtSymbol::AutoCache;
@@ -822,5 +822,5 @@
     struct SVG
     {
-        QSvgRenderer *renderer;
+        QSvgRenderer* renderer;
     } svg;
 #endif
@@ -835,49 +835,49 @@
 
 /*!
-  Default Constructor
-  \param style Symbol Style
-
-  The symbol is constructed with gray interior,
-  black outline with zero width, no size and style 'NoSymbol'.
-*/
+   Default Constructor
+   \param style Symbol Style
+
+   The symbol is constructed with gray interior,
+   black outline with zero width, no size and style 'NoSymbol'.
+ */
 QwtSymbol::QwtSymbol( Style style )
 {
-    d_data = new PrivateData( style, QBrush( Qt::gray ),
+    m_data = new PrivateData( style, QBrush( Qt::gray ),
         QPen( Qt::black, 0 ), QSize() );
 }
 
 /*!
-  \brief Constructor
-  \param style Symbol Style
-  \param brush brush to fill the interior
-  \param pen outline pen
-  \param size size
-
-  \sa setStyle(), setBrush(), setPen(), setSize()
-*/
-QwtSymbol::QwtSymbol( QwtSymbol::Style style, const QBrush &brush,
-    const QPen &pen, const QSize &size )
-{
-    d_data = new PrivateData( style, brush, pen, size );
-}
-
-/*!
-  \brief Constructor
-
-  The symbol gets initialized by a painter path. The style is
-  set to QwtSymbol::Path, the size is set to empty ( the path
-  is displayed unscaled ).
-
-  \param path painter path
-  \param brush brush to fill the interior
-  \param pen outline pen
-
-  \sa setPath(), setBrush(), setPen(), setSize()
-*/
-
-QwtSymbol::QwtSymbol( const QPainterPath &path,
-    const QBrush &brush, const QPen &pen )
-{
-    d_data = new PrivateData( QwtSymbol::Path, brush, pen, QSize() );
+   \brief Constructor
+   \param style Symbol Style
+   \param brush brush to fill the interior
+   \param pen outline pen
+   \param size size
+
+   \sa setStyle(), setBrush(), setPen(), setSize()
+ */
+QwtSymbol::QwtSymbol( QwtSymbol::Style style, const QBrush& brush,
+    const QPen& pen, const QSize& size )
+{
+    m_data = new PrivateData( style, brush, pen, size );
+}
+
+/*!
+   \brief Constructor
+
+   The symbol gets initialized by a painter path. The style is
+   set to QwtSymbol::Path, the size is set to empty ( the path
+   is displayed unscaled ).
+
+   \param path painter path
+   \param brush brush to fill the interior
+   \param pen outline pen
+
+   \sa setPath(), setBrush(), setPen(), setSize()
+ */
+
+QwtSymbol::QwtSymbol( const QPainterPath& path,
+    const QBrush& brush, const QPen& pen )
+{
+    m_data = new PrivateData( QwtSymbol::Path, brush, pen, QSize() );
     setPath( path );
 }
@@ -886,21 +886,21 @@
 QwtSymbol::~QwtSymbol()
 {
-    delete d_data;
-}
-
-/*!
-  Change the cache policy
-
-  The default policy is AutoCache
-
-  \param policy Cache policy
-  \sa CachePolicy, cachePolicy()
-*/
+    delete m_data;
+}
+
+/*!
+   Change the cache policy
+
+   The default policy is AutoCache
+
+   \param policy Cache policy
+   \sa CachePolicy, cachePolicy()
+ */
 void QwtSymbol::setCachePolicy(
     QwtSymbol::CachePolicy policy )
 {
-    if ( d_data->cache.policy != policy )
-    {
-        d_data->cache.policy = policy;
+    if ( m_data->cache.policy != policy )
+    {
+        m_data->cache.policy = policy;
         invalidateCache();
     }
@@ -908,28 +908,28 @@
 
 /*!
-  \return Cache policy
-  \sa CachePolicy, setCachePolicy()
-*/
+   \return Cache policy
+   \sa CachePolicy, setCachePolicy()
+ */
 QwtSymbol::CachePolicy QwtSymbol::cachePolicy() const
 {
-    return d_data->cache.policy;
-}
-
-/*!
-  \brief Set a painter path as symbol
-
-  The symbol is represented by a painter path, where the
-  origin ( 0, 0 ) of the path coordinate system is mapped to
-  the position of the symbol.
-
-  When the symbol has valid size the painter path gets scaled
-  to fit into the size. Otherwise the symbol size depends on
-  the bounding rectangle of the path.
-
-  \par Example
+    return m_data->cache.policy;
+}
+
+/*!
+   \brief Set a painter path as symbol
+
+   The symbol is represented by a painter path, where the
+   origin ( 0, 0 ) of the path coordinate system is mapped to
+   the position of the symbol.
+
+   When the symbol has valid size the painter path gets scaled
+   to fit into the size. Otherwise the symbol size depends on
+   the bounding rectangle of the path.
+
+   \par Example
     The following code defines a symbol drawing an arrow:
 
     \code
-      #include <qwt_symbol.h>
+ #include <qwt_symbol.h>
 
       QwtSymbol *symbol = new QwtSymbol();
@@ -958,16 +958,15 @@
       setSize( 10, 14 );
     \endcode
-  \endpar
-
-  \param path Painter path
-
-  \note The style is implicitely set to QwtSymbol::Path.
-  \sa path(), setSize()
- */
-void QwtSymbol::setPath( const QPainterPath &path )
-{
-    d_data->style = QwtSymbol::Path;
-    d_data->path.path = path;
-    d_data->path.graphic.reset();
+
+   \param path Painter path
+
+   \note The style is implicitly set to QwtSymbol::Path.
+   \sa path(), setSize()
+ */
+void QwtSymbol::setPath( const QPainterPath& path )
+{
+    m_data->style = QwtSymbol::Path;
+    m_data->path.path = path;
+    m_data->path.graphic.reset();
 }
 
@@ -975,58 +974,58 @@
    \return Painter path for displaying the symbol
    \sa setPath()
-*/
-const QPainterPath &QwtSymbol::path() const
-{
-    return d_data->path.path;
-}
-
-/*!
-  Set a pixmap as symbol
-
-  \param pixmap Pixmap
-
-  \sa pixmap(), setGraphic()
-
-  \note the style() is set to QwtSymbol::Pixmap
-  \note brush() and pen() have no effect
- */
-void QwtSymbol::setPixmap( const QPixmap &pixmap )
-{
-    d_data->style = QwtSymbol::Pixmap;
-    d_data->pixmap.pixmap = pixmap;
-}
-
-/*!
-  \return Assigned pixmap
-  \sa setPixmap()
- */
-const QPixmap &QwtSymbol::pixmap() const
-{
-    return d_data->pixmap.pixmap;
-}
-
-/*!
-  Set a graphic as symbol
-
-  \param graphic Graphic
-
-  \sa graphic(), setPixmap()
-
-  \note the style() is set to QwtSymbol::Graphic
-  \note brush() and pen() have no effect
- */
-void QwtSymbol::setGraphic( const QwtGraphic &graphic )
-{
-    d_data->style = QwtSymbol::Graphic;
-    d_data->graphic.graphic = graphic;
-}
-
-/*!
-  \return Assigned graphic
-  \sa setGraphic()
- */
-const QwtGraphic &QwtSymbol::graphic() const
-{
-    return d_data->graphic.graphic;
+ */
+const QPainterPath& QwtSymbol::path() const
+{
+    return m_data->path.path;
+}
+
+/*!
+   Set a pixmap as symbol
+
+   \param pixmap Pixmap
+
+   \sa pixmap(), setGraphic()
+
+   \note the style() is set to QwtSymbol::Pixmap
+   \note brush() and pen() have no effect
+ */
+void QwtSymbol::setPixmap( const QPixmap& pixmap )
+{
+    m_data->style = QwtSymbol::Pixmap;
+    m_data->pixmap.pixmap = pixmap;
+}
+
+/*!
+   \return Assigned pixmap
+   \sa setPixmap()
+ */
+const QPixmap& QwtSymbol::pixmap() const
+{
+    return m_data->pixmap.pixmap;
+}
+
+/*!
+   Set a graphic as symbol
+
+   \param graphic Graphic
+
+   \sa graphic(), setPixmap()
+
+   \note the style() is set to QwtSymbol::Graphic
+   \note brush() and pen() have no effect
+ */
+void QwtSymbol::setGraphic( const QwtGraphic& graphic )
+{
+    m_data->style = QwtSymbol::Graphic;
+    m_data->graphic.graphic = graphic;
+}
+
+/*!
+   \return Assigned graphic
+   \sa setGraphic()
+ */
+const QwtGraphic& QwtSymbol::graphic() const
+{
+    return m_data->graphic.graphic;
 }
 
@@ -1034,20 +1033,20 @@
 
 /*!
-  Set a SVG icon as symbol
-
-  \param svgDocument SVG icon
-
-  \sa setGraphic(), setPixmap()
-
-  \note the style() is set to QwtSymbol::SvgDocument
-  \note brush() and pen() have no effect
- */
-void QwtSymbol::setSvgDocument( const QByteArray &svgDocument )
-{
-    d_data->style = QwtSymbol::SvgDocument;
-    if ( d_data->svg.renderer == NULL )
-        d_data->svg.renderer = new QSvgRenderer();
-
-    d_data->svg.renderer->load( svgDocument );
+   Set a SVG icon as symbol
+
+   \param svgDocument SVG icon
+
+   \sa setGraphic(), setPixmap()
+
+   \note the style() is set to QwtSymbol::SvgDocument
+   \note brush() and pen() have no effect
+ */
+void QwtSymbol::setSvgDocument( const QByteArray& svgDocument )
+{
+    m_data->style = QwtSymbol::SvgDocument;
+    if ( m_data->svg.renderer == NULL )
+        m_data->svg.renderer = new QSvgRenderer();
+
+    m_data->svg.renderer->load( svgDocument );
 }
 
@@ -1055,15 +1054,15 @@
 
 /*!
-  \brief Specify the symbol's size
-
-  If the 'h' parameter is left out or less than 0,
-  and the 'w' parameter is greater than or equal to 0,
-  the symbol size will be set to (w,w).
-
-  \param width Width
-  \param height Height (defaults to -1)
-
-  \sa size()
-*/
+   \brief Specify the symbol's size
+
+   If the 'h' parameter is left out or less than 0,
+   and the 'w' parameter is greater than or equal to 0,
+   the symbol size will be set to (w,w).
+
+   \param width Width
+   \param height Height (defaults to -1)
+
+   \sa size()
+ */
 void QwtSymbol::setSize( int width, int height )
 {
@@ -1079,10 +1078,10 @@
 
    \sa size()
-*/
-void QwtSymbol::setSize( const QSize &size )
-{
-    if ( size.isValid() && size != d_data->size )
-    {
-        d_data->size = size;
+ */
+void QwtSymbol::setSize( const QSize& size )
+{
+    if ( size.isValid() && size != m_data->size )
+    {
+        m_data->size = size;
         invalidateCache();
     }
@@ -1092,53 +1091,53 @@
    \return Size
    \sa setSize()
-*/
+ */
 const QSize& QwtSymbol::size() const
 {
-    return d_data->size;
-}
-
-/*!
-  \brief Assign a brush
-
-  The brush is used to draw the interior of the symbol.
-  \param brush Brush
-
-  \sa brush()
-*/
-void QwtSymbol::setBrush( const QBrush &brush )
-{
-    if ( brush != d_data->brush )
-    {
-        d_data->brush = brush;
+    return m_data->size;
+}
+
+/*!
+   \brief Assign a brush
+
+   The brush is used to draw the interior of the symbol.
+   \param brush Brush
+
+   \sa brush()
+ */
+void QwtSymbol::setBrush( const QBrush& brush )
+{
+    if ( brush != m_data->brush )
+    {
+        m_data->brush = brush;
         invalidateCache();
 
-        if ( d_data->style == QwtSymbol::Path )
-            d_data->path.graphic.reset();
-    }
-}
-
-/*!
-  \return Brush
-  \sa setBrush()
-*/
+        if ( m_data->style == QwtSymbol::Path )
+            m_data->path.graphic.reset();
+    }
+}
+
+/*!
+   \return Brush
+   \sa setBrush()
+ */
 const QBrush& QwtSymbol::brush() const
 {
-    return d_data->brush;
-}
-
-/*!
-  Build and assign a pen
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 )
-  what makes it non cosmetic ( see QPen::isCosmetic() ).
-  This method has been introduced to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtSymbol::setPen( const QColor &color,
+    return m_data->brush;
+}
+
+/*!
+   Build and assign a pen
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 )
+   what makes it non cosmetic ( see QPen::isCosmetic() ).
+   This method has been introduced to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtSymbol::setPen( const QColor& color,
     qreal width, Qt::PenStyle style )
 {
@@ -1147,45 +1146,45 @@
 
 /*!
-  Assign a pen
-
-  The pen is used to draw the symbol's outline.
-
-  \param pen Pen
-  \sa pen(), setBrush()
-*/
-void QwtSymbol::setPen( const QPen &pen )
-{
-    if ( pen != d_data->pen )
-    {
-        d_data->pen = pen;
+   Assign a pen
+
+   The pen is used to draw the symbol's outline.
+
+   \param pen Pen
+   \sa pen(), setBrush()
+ */
+void QwtSymbol::setPen( const QPen& pen )
+{
+    if ( pen != m_data->pen )
+    {
+        m_data->pen = pen;
         invalidateCache();
 
-        if ( d_data->style == QwtSymbol::Path )
-            d_data->path.graphic.reset();
-    }
-}
-
-/*!
-  \return Pen
-  \sa setPen(), brush()
-*/
+        if ( m_data->style == QwtSymbol::Path )
+            m_data->path.graphic.reset();
+    }
+}
+
+/*!
+   \return Pen
+   \sa setPen(), brush()
+ */
 const QPen& QwtSymbol::pen() const
 {
-    return d_data->pen;
-}
-
-/*!
-  \brief Set the color of the symbol
-
-  Change the color of the brush for symbol types with a filled area.
-  For all other symbol types the color will be assigned to the pen.
-
-  \param color Color
-
-  \sa setBrush(), setPen(), brush(), pen()
-*/
-void QwtSymbol::setColor( const QColor &color )
-{
-    switch ( d_data->style )
+    return m_data->pen;
+}
+
+/*!
+   \brief Set the color of the symbol
+
+   Change the color of the brush for symbol types with a filled area.
+   For all other symbol types the color will be assigned to the pen.
+
+   \param color Color
+
+   \sa setBrush(), setPen(), brush(), pen()
+ */
+void QwtSymbol::setColor( const QColor& color )
+{
+    switch ( m_data->style )
     {
         case QwtSymbol::Ellipse:
@@ -1200,7 +1199,7 @@
         case QwtSymbol::Hexagon:
         {
-            if ( d_data->brush.color() != color )
+            if ( m_data->brush.color() != color )
             {
-                d_data->brush.setColor( color );
+                m_data->brush.setColor( color );
                 invalidateCache();
             }
@@ -1213,7 +1212,7 @@
         case QwtSymbol::Star1:
         {
-            if ( d_data->pen.color() != color )
+            if ( m_data->pen.color() != color )
             {
-                d_data->pen.setColor( color );
+                m_data->pen.setColor( color );
                 invalidateCache();
             }
@@ -1222,36 +1221,36 @@
         default:
         {
-            if ( d_data->brush.color() != color ||
-                d_data->pen.color() != color )
+            if ( m_data->brush.color() != color ||
+                m_data->pen.color() != color )
             {
                 invalidateCache();
             }
 
-            d_data->brush.setColor( color );
-            d_data->pen.setColor( color );
-        }
-    }
-}
-
-/*!
-  \brief Set and enable a pin point
-
-  The position of a complex symbol is not always aligned to its center
-  ( f.e an arrow, where the peak points to a position ). The pin point
-  defines the position inside of a Pixmap, Graphic, SvgDocument
-  or PainterPath symbol where the represented point has to
-  be aligned to.
-
-  \param pos Position
-  \param enable En/Disable the pin point alignment
-
-  \sa pinPoint(), setPinPointEnabled()
- */
-void QwtSymbol::setPinPoint( const QPointF &pos, bool enable )
-{
-    if ( d_data->pinPoint != pos )
-    {
-        d_data->pinPoint = pos;
-        if ( d_data->isPinPointEnabled )
+            m_data->brush.setColor( color );
+            m_data->pen.setColor( color );
+        }
+    }
+}
+
+/*!
+   \brief Set and enable a pin point
+
+   The position of a complex symbol is not always aligned to its center
+   ( f.e an arrow, where the peak points to a position ). The pin point
+   defines the position inside of a Pixmap, Graphic, SvgDocument
+   or PainterPath symbol where the represented point has to
+   be aligned to.
+
+   \param pos Position
+   \param enable En/Disable the pin point alignment
+
+   \sa pinPoint(), setPinPointEnabled()
+ */
+void QwtSymbol::setPinPoint( const QPointF& pos, bool enable )
+{
+    if ( m_data->pinPoint != pos )
+    {
+        m_data->pinPoint = pos;
+        if ( m_data->isPinPointEnabled )
         {
             invalidateCache();
@@ -1263,23 +1262,23 @@
 
 /*!
-  \return Pin point
-  \sa setPinPoint(), setPinPointEnabled()
+   \return Pin point
+   \sa setPinPoint(), setPinPointEnabled()
  */
 QPointF QwtSymbol::pinPoint() const
 {
-    return d_data->pinPoint;
-}
-
-/*!
-  En/Disable the pin point alignment
-
-  \param on Enabled, when on is true
-  \sa setPinPoint(), isPinPointEnabled()
+    return m_data->pinPoint;
+}
+
+/*!
+   En/Disable the pin point alignment
+
+   \param on Enabled, when on is true
+   \sa setPinPoint(), isPinPointEnabled()
  */
 void QwtSymbol::setPinPointEnabled( bool on )
 {
-    if ( d_data->isPinPointEnabled != on )
-    {
-        d_data->isPinPointEnabled = on;
+    if ( m_data->isPinPointEnabled != on )
+    {
+        m_data->isPinPointEnabled = on;
         invalidateCache();
     }
@@ -1287,25 +1286,25 @@
 
 /*!
-  \return True, when the pin point translation is enabled
-  \sa setPinPoint(), setPinPointEnabled()
+   \return True, when the pin point translation is enabled
+   \sa setPinPoint(), setPinPointEnabled()
  */
 bool QwtSymbol::isPinPointEnabled() const
 {
-    return d_data->isPinPointEnabled;
-}
-
-/*!
-  Render an array of symbols
-
-  Painting several symbols is more effective than drawing symbols
-  one by one, as a couple of layout calculations and setting of pen/brush
-  can be done once for the complete array.
-
-  \param painter Painter
-  \param points Array of points
-  \param numPoints Number of points
-*/
-void QwtSymbol::drawSymbols( QPainter *painter,
-    const QPointF *points, int numPoints ) const
+    return m_data->isPinPointEnabled;
+}
+
+/*!
+   Render an array of symbols
+
+   Painting several symbols is more effective than drawing symbols
+   one by one, as a couple of layout calculations and setting of pen/brush
+   can be done once for the complete array.
+
+   \param painter Painter
+   \param points Array of points
+   \param numPoints Number of points
+ */
+void QwtSymbol::drawSymbols( QPainter* painter,
+    const QPointF* points, int numPoints ) const
 {
     if ( numPoints <= 0 )
@@ -1320,35 +1319,64 @@
         !painter->transform().isScaling() )
     {
-        if ( d_data->cache.policy == QwtSymbol::Cache )
+        if ( m_data->cache.policy == QwtSymbol::Cache )
         {
             useCache = true;
         }
-        else if ( d_data->cache.policy == QwtSymbol::AutoCache )
-        {
-            if ( painter->paintEngine()->type() == QPaintEngine::Raster )
+        else if ( m_data->cache.policy == QwtSymbol::AutoCache )
+        {
+            switch( painter->paintEngine()->type() )
             {
-                useCache = true;
-            }
-            else
-            {
-                switch( d_data->style )
+                case QPaintEngine::OpenGL:
+                case QPaintEngine::OpenGL2:
                 {
-                    case QwtSymbol::XCross:
-                    case QwtSymbol::HLine:
-                    case QwtSymbol::VLine:
-                    case QwtSymbol::Cross:
-                        break;
-
-                    case QwtSymbol::Pixmap:
+                    // using a FBO as cache ?
+                    useCache = false;
+                    break;
+                }
+                case QPaintEngine::OpenVG:
+                case QPaintEngine::SVG:
+                case QPaintEngine::Pdf:
+                case QPaintEngine::Picture:
+                {
+                    // vector graphics
+                    useCache = false;
+                    break;
+                }
+                case QPaintEngine::X11:
+                {
+                    switch( m_data->style )
                     {
-                        if ( !d_data->size.isEmpty() &&
-                            d_data->size != d_data->pixmap.pixmap.size() )
+                        case QwtSymbol::XCross:
+                        case QwtSymbol::HLine:
+                        case QwtSymbol::VLine:
+                        case QwtSymbol::Cross:
                         {
-                            useCache = true;
+                            // for the very simple shapes using vector graphics is
+                            // usually faster.
+
+                            useCache = false;
+                            break;
                         }
-                        break;
+
+                        case QwtSymbol::Pixmap:
+                        {
+                            if ( m_data->size.isEmpty() ||
+                                m_data->size == m_data->pixmap.pixmap.size() )
+                            {
+                                // no need to have a pixmap cache for a pixmap
+                                // of the same size
+
+                                useCache = false;
+                            }
+                            break;
+                        }
+                        default:
+                            break;
                     }
-                    default:
-                        useCache = true;
+                    break;
+                }
+                default:
+                {
+                    useCache = true;
                 }
             }
@@ -1360,14 +1388,14 @@
         const QRect br = boundingRect();
 
-        if ( d_data->cache.pixmap.isNull() )
-        {
-            d_data->cache.pixmap = QwtPainter::backingStore( NULL, br.size() );
-            d_data->cache.pixmap.fill( Qt::transparent );
-
-            QPainter p( &d_data->cache.pixmap );
+        if ( m_data->cache.pixmap.isNull() )
+        {
+            m_data->cache.pixmap = QwtPainter::backingStore( NULL, br.size() );
+            m_data->cache.pixmap.fill( Qt::transparent );
+
+            QPainter p( &m_data->cache.pixmap );
             p.setRenderHints( painter->renderHints() );
             p.translate( -br.topLeft() );
 
-            const QPointF pos;
+            const QPointF pos( 0.0, 0.0 );
             renderSymbols( &p, &pos, 1 );
         }
@@ -1381,5 +1409,5 @@
             const int top = qRound( points[i].y() ) + dy;
 
-            painter->drawPixmap( left, top, d_data->cache.pixmap );
+            painter->drawPixmap( left, top, m_data->cache.pixmap );
         }
     }
@@ -1393,45 +1421,45 @@
 
 /*!
-  \brief Draw the symbol into a rectangle
-
-  The symbol is painted centered and scaled into the target rectangle.
-  It is always painted uncached and the pin point is ignored.
-
-  This method is primarily intended for drawing a symbol to
-  the legend.
-
-  \param painter Painter
-  \param rect Target rectangle for the symbol
-*/
-void QwtSymbol::drawSymbol( QPainter *painter, const QRectF &rect ) const
-{
-    if ( d_data->style == QwtSymbol::NoSymbol )
+   \brief Draw the symbol into a rectangle
+
+   The symbol is painted centered and scaled into the target rectangle.
+   It is always painted uncached and the pin point is ignored.
+
+   This method is primarily intended for drawing a symbol to
+   the legend.
+
+   \param painter Painter
+   \param rect Target rectangle for the symbol
+ */
+void QwtSymbol::drawSymbol( QPainter* painter, const QRectF& rect ) const
+{
+    if ( m_data->style == QwtSymbol::NoSymbol )
         return;
 
-    if ( d_data->style == QwtSymbol::Graphic )
-    {
-        d_data->graphic.graphic.render(
+    if ( m_data->style == QwtSymbol::Graphic )
+    {
+        m_data->graphic.graphic.render(
             painter, rect, Qt::KeepAspectRatio );
     }
-    else if ( d_data->style == QwtSymbol::Path )
-    {
-        if ( d_data->path.graphic.isNull() )
-        {
-            d_data->path.graphic = qwtPathGraphic(
-                d_data->path.path, d_data->pen, d_data->brush );
-        }
-
-        d_data->path.graphic.render(
+    else if ( m_data->style == QwtSymbol::Path )
+    {
+        if ( m_data->path.graphic.isNull() )
+        {
+            m_data->path.graphic = qwtPathGraphic(
+                m_data->path.path, m_data->pen, m_data->brush );
+        }
+
+        m_data->path.graphic.render(
             painter, rect, Qt::KeepAspectRatio );
         return;
     }
-    else if ( d_data->style == QwtSymbol::SvgDocument )
+    else if ( m_data->style == QwtSymbol::SvgDocument )
     {
 #ifndef QWT_NO_SVG
-        if ( d_data->svg.renderer )
+        if ( m_data->svg.renderer )
         {
             QRectF scaledRect;
 
-            QSizeF sz = d_data->svg.renderer->viewBoxF().size();
+            QSizeF sz = m_data->svg.renderer->viewBoxF().size();
             if ( !sz.isEmpty() )
             {
@@ -1445,5 +1473,5 @@
             }
 
-            d_data->svg.renderer->render(
+            m_data->svg.renderer->render(
                 painter, scaledRect );
         }
@@ -1464,11 +1492,11 @@
         painter->scale( ratio, ratio );
 
-        const bool isPinPointEnabled = d_data->isPinPointEnabled;
-        d_data->isPinPointEnabled = false;
+        const bool isPinPointEnabled = m_data->isPinPointEnabled;
+        m_data->isPinPointEnabled = false;
 
         const QPointF pos;
         renderSymbols( painter, &pos, 1 );
 
-        d_data->isPinPointEnabled = isPinPointEnabled;
+        m_data->isPinPointEnabled = isPinPointEnabled;
 
         painter->restore();
@@ -1477,14 +1505,14 @@
 
 /*!
-  Render the symbol to series of points
-
-  \param painter Qt painter
-  \param points Positions of the symbols
-  \param numPoints Number of points
- */
-void QwtSymbol::renderSymbols( QPainter *painter,
-    const QPointF *points, int numPoints ) const
-{
-    switch ( d_data->style )
+   Render the symbol to series of points
+
+   \param painter Qt painter
+   \param points Positions of the symbols
+   \param numPoints Number of points
+ */
+void QwtSymbol::renderSymbols( QPainter* painter,
+    const QPointF* points, int numPoints ) const
+{
+    switch ( m_data->style )
     {
         case QwtSymbol::Ellipse:
@@ -1568,12 +1596,12 @@
         case QwtSymbol::Path:
         {
-            if ( d_data->path.graphic.isNull() )
+            if ( m_data->path.graphic.isNull() )
             {
-                d_data->path.graphic = qwtPathGraphic( d_data->path.path,
-                    d_data->pen, d_data->brush );
+                m_data->path.graphic = qwtPathGraphic( m_data->path.path,
+                    m_data->pen, m_data->brush );
             }
 
             qwtDrawGraphicSymbols( painter, points, numPoints,
-                d_data->path.graphic, *this );
+                m_data->path.graphic, *this );
             break;
         }
@@ -1586,5 +1614,5 @@
         {
             qwtDrawGraphicSymbols( painter, points, numPoints,
-                d_data->graphic.graphic, *this );
+                m_data->graphic.graphic, *this );
             break;
         }
@@ -1593,5 +1621,5 @@
 #ifndef QWT_NO_SVG
             qwtDrawSvgSymbols( painter, points, numPoints,
-                d_data->svg.renderer, *this );
+                m_data->svg.renderer, *this );
 #endif
             break;
@@ -1602,8 +1630,8 @@
 
 /*!
-  Calculate the bounding rectangle for a symbol
-  at position (0,0).
-
-  \return Bounding rectangle
+   Calculate the bounding rectangle for a symbol
+   at position (0,0).
+
+   \return Bounding rectangle
  */
 QRect QwtSymbol::boundingRect() const
@@ -1613,5 +1641,5 @@
     bool pinPointTranslation = false;
 
-    switch ( d_data->style )
+    switch ( m_data->style )
     {
         case QwtSymbol::Ellipse:
@@ -1620,8 +1648,8 @@
         {
             qreal pw = 0.0;
-            if ( d_data->pen.style() != Qt::NoPen )
-                pw = qMax( d_data->pen.widthF(), qreal( 1.0 ) );
-
-            rect.setSize( d_data->size + QSizeF( pw, pw ) );
+            if ( m_data->pen.style() != Qt::NoPen )
+                pw = QwtPainter::effectivePenWidth( m_data->pen );
+
+            rect.setSize( m_data->size + QSizeF( pw, pw ) );
             rect.moveCenter( QPointF( 0.0, 0.0 ) );
 
@@ -1639,8 +1667,8 @@
         {
             qreal pw = 0.0;
-            if ( d_data->pen.style() != Qt::NoPen )
-                pw = qMax( d_data->pen.widthF(), qreal( 1.0 ) );
-
-            rect.setSize( d_data->size + QSizeF( 2 * pw, 2 * pw ) );
+            if ( m_data->pen.style() != Qt::NoPen )
+                pw = QwtPainter::effectivePenWidth( m_data->pen );
+
+            rect.setSize( m_data->size + QSizeF( 2 * pw, 2 * pw ) );
             rect.moveCenter( QPointF( 0.0, 0.0 ) );
             break;
@@ -1648,12 +1676,12 @@
         case QwtSymbol::Path:
         {
-            if ( d_data->path.graphic.isNull() )
+            if ( m_data->path.graphic.isNull() )
             {
-                d_data->path.graphic = qwtPathGraphic(
-                    d_data->path.path, d_data->pen, d_data->brush );
+                m_data->path.graphic = qwtPathGraphic(
+                    m_data->path.path, m_data->pen, m_data->brush );
             }
 
             rect = qwtScaledBoundingRect(
-                d_data->path.graphic, d_data->size );
+                m_data->path.graphic, m_data->size );
             pinPointTranslation = true;
 
@@ -1662,8 +1690,8 @@
         case QwtSymbol::Pixmap:
         {
-            if ( d_data->size.isEmpty() )
-                rect.setSize( d_data->pixmap.pixmap.size() );
+            if ( m_data->size.isEmpty() )
+                rect.setSize( m_data->pixmap.pixmap.size() );
             else
-                rect.setSize( d_data->size );
+                rect.setSize( m_data->size );
 
             pinPointTranslation = true;
@@ -1674,5 +1702,5 @@
         {
             rect = qwtScaledBoundingRect(
-                d_data->graphic.graphic, d_data->size );
+                m_data->graphic.graphic, m_data->size );
             pinPointTranslation = true;
 
@@ -1682,13 +1710,13 @@
         case QwtSymbol::SvgDocument:
         {
-            if ( d_data->svg.renderer )
-                rect = d_data->svg.renderer->viewBoxF();
-
-            if ( d_data->size.isValid() && !rect.isEmpty() )
+            if ( m_data->svg.renderer )
+                rect = m_data->svg.renderer->viewBoxF();
+
+            if ( m_data->size.isValid() && !rect.isEmpty() )
             {
                 QSizeF sz = rect.size();
 
-                const double sx = d_data->size.width() / sz.width();
-                const double sy = d_data->size.height() / sz.height();
+                const double sx = m_data->size.width() / sz.width();
+                const double sy = m_data->size.height() / sz.height();
 
                 QTransform transform;
@@ -1703,5 +1731,5 @@
         default:
         {
-            rect.setSize( d_data->size );
+            rect.setSize( m_data->size );
             rect.moveCenter( QPointF( 0.0, 0.0 ) );
         }
@@ -1711,6 +1739,6 @@
     {
         QPointF pinPoint( 0.0, 0.0 );
-        if ( d_data->isPinPointEnabled )
-            pinPoint = rect.center() - d_data->pinPoint;
+        if ( m_data->isPinPointEnabled )
+            pinPoint = rect.center() - m_data->pinPoint;
 
         rect.moveCenter( pinPoint );
@@ -1718,10 +1746,10 @@
 
     QRect r;
-    r.setLeft( qFloor( rect.left() ) );
-    r.setTop( qFloor( rect.top() ) );
-    r.setRight( qCeil( rect.right() ) );
-    r.setBottom( qCeil( rect.bottom() ) );
-
-    if ( d_data->style != QwtSymbol::Pixmap )
+    r.setLeft( qwtFloor( rect.left() ) );
+    r.setTop( qwtFloor( rect.top() ) );
+    r.setRight( qwtCeil( rect.right() ) );
+    r.setBottom( qwtCeil( rect.bottom() ) );
+
+    if ( m_data->style != QwtSymbol::Pixmap )
         r.adjust( -1, -1, 1, 1 ); // for antialiasing
 
@@ -1730,31 +1758,31 @@
 
 /*!
-  Invalidate the cached symbol pixmap
-
-  The symbol invalidates its cache, whenever an attribute is changed
-  that has an effect ob how to display a symbol. In case of derived
-  classes with individual styles ( >= QwtSymbol::UserStyle ) it
-  might be necessary to call invalidateCache() for attributes
-  that are relevant for this style.
-
-  \sa CachePolicy, setCachePolicy(), drawSymbols()
+   Invalidate the cached symbol pixmap
+
+   The symbol invalidates its cache, whenever an attribute is changed
+   that has an effect ob how to display a symbol. In case of derived
+   classes with individual styles ( >= QwtSymbol::UserStyle ) it
+   might be necessary to call invalidateCache() for attributes
+   that are relevant for this style.
+
+   \sa CachePolicy, setCachePolicy(), drawSymbols()
  */
 void QwtSymbol::invalidateCache()
 {
-    if ( !d_data->cache.pixmap.isNull() )
-        d_data->cache.pixmap = QPixmap();
-}
-
-/*!
-  Specify the symbol style
-
-  \param style Style
-  \sa style()
-*/
+    if ( !m_data->cache.pixmap.isNull() )
+        m_data->cache.pixmap = QPixmap();
+}
+
+/*!
+   Specify the symbol style
+
+   \param style Style
+   \sa style()
+ */
 void QwtSymbol::setStyle( QwtSymbol::Style style )
 {
-    if ( d_data->style != style )
-    {
-        d_data->style = style;
+    if ( m_data->style != style )
+    {
+        m_data->style = style;
         invalidateCache();
     }
@@ -1762,9 +1790,9 @@
 
 /*!
-  \return Current symbol style
-  \sa setStyle()
-*/
+   \return Current symbol style
+   \sa setStyle()
+ */
 QwtSymbol::Style QwtSymbol::style() const
 {
-    return d_data->style;
-}
+    return m_data->style;
+}
Index: /trunk/BNC/qwt/qwt_symbol.h
===================================================================
--- /trunk/BNC/qwt/qwt_symbol.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_symbol.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,8 +12,10 @@
 
 #include "qwt_global.h"
+
 #include <qpolygon.h>
+#include <qpen.h>
+#include <qbrush.h>
 
 class QPainter;
-class QRect;
 class QSize;
 class QBrush;
@@ -21,5 +23,4 @@
 class QColor;
 class QPointF;
-class QPolygonF;
 class QPainterPath;
 class QPixmap;
@@ -30,8 +31,8 @@
 class QWT_EXPORT QwtSymbol
 {
-public:
+  public:
     /*!
-      Symbol Style
-      \sa setStyle(), style()
+       Symbol Style
+       \sa setStyle(), style()
      */
     enum Style
@@ -86,40 +87,40 @@
 
         /*!
-          The symbol is represented by a painter path, where the
-          origin ( 0, 0 ) of the path coordinate system is mapped to
-          the position of the symbol.
-
-          \sa setPath(), path()
+           The symbol is represented by a painter path, where the
+           origin ( 0, 0 ) of the path coordinate system is mapped to
+           the position of the symbol.
+
+           \sa setPath(), path()
          */
         Path,
 
         /*!
-          The symbol is represented by a pixmap. The pixmap is centered
-          or aligned to its pin point.
-
-          \sa setPinPoint()
+           The symbol is represented by a pixmap. The pixmap is centered
+           or aligned to its pin point.
+
+           \sa setPinPoint()
          */
         Pixmap,
 
         /*!
-          The symbol is represented by a graphic. The graphic is centered
-          or aligned to its pin point.
-
-          \sa setPinPoint()
+           The symbol is represented by a graphic. The graphic is centered
+           or aligned to its pin point.
+
+           \sa setPinPoint()
          */
         Graphic,
 
         /*!
-          The symbol is represented by a SVG graphic. The graphic is centered
-          or aligned to its pin point.
-
-          \sa setPinPoint()
+           The symbol is represented by a SVG graphic. The graphic is centered
+           or aligned to its pin point.
+
+           \sa setPinPoint()
          */
         SvgDocument,
 
         /*!
-         Styles >= QwtSymbol::UserSymbol are reserved for derived
-         classes of QwtSymbol that overload drawSymbols() with
-         additional application specific symbol types.
+           Styles >= QwtSymbol::UserSymbol are reserved for derived
+           classes of QwtSymbol that overload drawSymbols() with
+           additional application specific symbol types.
          */
         UserStyle = 1000
@@ -127,22 +128,22 @@
 
     /*!
-      Depending on the render engine and the complexity of the
-      symbol shape it might be faster to render the symbol
-      to a pixmap and to paint this pixmap.
-
-      F.e. the raster paint engine is a pure software renderer
-      where in cache mode a draw operation usually ends in
-      raster operation with the the backing store, that are usually
-      faster, than the algorithms for rendering polygons.
-      But the opposite can be expected for graphic pipelines
-      that can make use of hardware acceleration.
-
-      The default setting is AutoCache
-
-      \sa setCachePolicy(), cachePolicy()
-
-      \note The policy has no effect, when the symbol is painted
+       Depending on the render engine and the complexity of the
+       symbol shape it might be faster to render the symbol
+       to a pixmap and to paint this pixmap.
+
+       F.e. the raster paint engine is a pure software renderer
+       where in cache mode a draw operation usually ends in
+       raster operation with the the backing store, that are usually
+       faster, than the algorithms for rendering polygons.
+       But the opposite can be expected for graphic pipelines
+       that can make use of hardware acceleration.
+
+       The default setting is AutoCache
+
+       \sa setCachePolicy(), cachePolicy()
+
+       \note The policy has no effect, when the symbol is painted
             to a vector graphics format ( PDF, SVG ).
-      \warning Since Qt 4.8 raster is the default backend on X11
+       \warning Since Qt 4.8 raster is the default backend on X11
      */
 
@@ -164,8 +165,8 @@
     };
 
-public:
-    QwtSymbol( Style = NoSymbol );
-    QwtSymbol( Style, const QBrush &, const QPen &, const QSize & );
-    QwtSymbol( const QPainterPath &, const QBrush &, const QPen & );
+  public:
+    explicit QwtSymbol( Style = NoSymbol );
+    QwtSymbol( Style, const QBrush&, const QPen&, const QSize& );
+    QwtSymbol( const QPainterPath&, const QBrush&, const QPen& );
 
     virtual ~QwtSymbol();
@@ -174,9 +175,9 @@
     CachePolicy cachePolicy() const;
 
-    void setSize( const QSize & );
+    void setSize( const QSize& );
     void setSize( int width, int height = -1 );
-    const QSize &size() const;
-
-    void setPinPoint( const QPointF &pos, bool enable = true );
+    const QSize& size() const;
+
+    void setPinPoint( const QPointF& pos, bool enable = true );
     QPointF pinPoint() const;
 
@@ -184,59 +185,57 @@
     bool isPinPointEnabled() const;
 
-    virtual void setColor( const QColor & );
-
-    void setBrush( const QBrush & );
-    const QBrush &brush() const;
-
-    void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
-    void setPen( const QPen & );
-    const QPen &pen() const;
+    virtual void setColor( const QColor& );
+
+    void setBrush( const QBrush& );
+    const QBrush& brush() const;
+
+    void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
+    void setPen( const QPen& );
+    const QPen& pen() const;
 
     void setStyle( Style );
     Style style() const;
 
-    void setPath( const QPainterPath & );
-    const QPainterPath &path() const;
-
-    void setPixmap( const QPixmap & );
-    const QPixmap &pixmap() const;
-
-    void setGraphic( const QwtGraphic & );
-    const QwtGraphic &graphic() const;
+    void setPath( const QPainterPath& );
+    const QPainterPath& path() const;
+
+    void setPixmap( const QPixmap& );
+    const QPixmap& pixmap() const;
+
+    void setGraphic( const QwtGraphic& );
+    const QwtGraphic& graphic() const;
 
 #ifndef QWT_NO_SVG
-    void setSvgDocument( const QByteArray & );
+    void setSvgDocument( const QByteArray& );
 #endif
 
-    void drawSymbol( QPainter *, const QRectF & ) const;
-    void drawSymbol( QPainter *, const QPointF & ) const;
-    void drawSymbols( QPainter *, const QPolygonF & ) const;
-    void drawSymbols( QPainter *,
-        const QPointF *, int numPoints ) const;
+    void drawSymbol( QPainter*, const QRectF& ) const;
+    void drawSymbol( QPainter*, const QPointF& ) const;
+    void drawSymbols( QPainter*, const QPolygonF& ) const;
+    void drawSymbols( QPainter*,
+        const QPointF*, int numPoints ) const;
 
     virtual QRect boundingRect() const;
     void invalidateCache();
 
-protected:
-    virtual void renderSymbols( QPainter *,
-        const QPointF *, int numPoints ) const;
-
-private:
-    // Disabled copy constructor and operator=
-    QwtSymbol( const QwtSymbol & );
-    QwtSymbol &operator=( const QwtSymbol & );
+  protected:
+    virtual void renderSymbols( QPainter*,
+        const QPointF*, int numPoints ) const;
+
+  private:
+    Q_DISABLE_COPY(QwtSymbol)
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
 /*!
-  \brief Draw the symbol at a specified position
-
-  \param painter Painter
-  \param pos Position of the symbol in screen coordinates
-*/
+   \brief Draw the symbol at a specified position
+
+   \param painter Painter
+   \param pos Position of the symbol in screen coordinates
+ */
 inline void QwtSymbol::drawSymbol(
-    QPainter *painter, const QPointF &pos ) const
+    QPainter* painter, const QPointF& pos ) const
 {
     drawSymbols( painter, &pos, 1 );
@@ -244,12 +243,12 @@
 
 /*!
-  \brief Draw symbols at the specified points
-
-  \param painter Painter
-  \param points Positions of the symbols in screen coordinates
-*/
+   \brief Draw symbols at the specified points
+
+   \param painter Painter
+   \param points Positions of the symbols in screen coordinates
+ */
 
 inline void QwtSymbol::drawSymbols(
-    QPainter *painter, const QPolygonF &points ) const
+    QPainter* painter, const QPolygonF& points ) const
 {
     drawSymbols( painter, points.data(), points.size() );
Index: /trunk/BNC/qwt/qwt_system_clock.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_system_clock.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_system_clock.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,388 +9,32 @@
 
 #include "qwt_system_clock.h"
-
-#if QT_VERSION >= 0x040800
-#define USE_ELAPSED_TIMER 1
-#endif
-
-#if USE_ELAPSED_TIMER
-
 #include <qelapsedtimer.h>
 
-class QwtSystemClock::PrivateData
+//! \return true, if the elapsed timer is valid
+bool QwtSystemClock::isNull() const
 {
-public:
-    QElapsedTimer timer;
-};
-
-QwtSystemClock::QwtSystemClock()
-{
-    d_data = new PrivateData();
+    return m_timer.isValid();
 }
 
-QwtSystemClock::~QwtSystemClock()
+//! Start the elapsed timer
+void QwtSystemClock::start()
 {
-    delete d_data;
+    m_timer.start();
 }
 
-bool QwtSystemClock::isNull() const
-{
-    return d_data->timer.isValid();
-}
-
-void QwtSystemClock::start()
-{
-    d_data->timer.start();
-}
-
+/*!
+    Restart the elapsed timer
+    \return elapsed time in multiples of milliseconds
+ */
 double QwtSystemClock::restart()
 {
-    const qint64 nsecs = d_data->timer.restart();
+    const qint64 nsecs = m_timer.restart();
     return nsecs / 1e6;
 }
 
+//! \return elapsed time in multiples of milliseconds
 double QwtSystemClock::elapsed() const
 {
-    const qint64 nsecs = d_data->timer.nsecsElapsed();
+    const qint64 nsecs = m_timer.nsecsElapsed();
     return nsecs / 1e6;
 }
-
-#else // !USE_ELAPSED_TIMER
-
-#include <qdatetime.h>
-
-#if !defined(Q_OS_WIN)
-#include <unistd.h>
-#endif
-
-#if defined(Q_OS_MAC)
-#include <stdint.h>
-#include <mach/mach_time.h>
-#define QWT_HIGH_RESOLUTION_CLOCK
-#elif defined(_POSIX_TIMERS)
-#include <time.h>
-#define QWT_HIGH_RESOLUTION_CLOCK
-#elif defined(Q_OS_WIN)
-#define QWT_HIGH_RESOLUTION_CLOCK
-#include <qt_windows.h>
-#endif
-
-#if defined(QWT_HIGH_RESOLUTION_CLOCK)
-
-class QwtHighResolutionClock
-{
-public:
-    QwtHighResolutionClock();
-
-    void start();
-    double restart();
-    double elapsed() const;
-
-    bool isNull() const;
-
-    static double precision();
-
-private:
-
-#if defined(Q_OS_MAC)
-    static double msecsTo( uint64_t, uint64_t );
-
-    uint64_t d_timeStamp;
-#elif defined(_POSIX_TIMERS)
-
-    static double msecsTo( const struct timespec &,
-        const struct timespec & );
-
-    static bool isMonotonic();
-
-    struct timespec d_timeStamp;
-    clockid_t d_clockId;
-
-#elif defined(Q_OS_WIN)
-
-    LARGE_INTEGER d_startTicks;
-    LARGE_INTEGER d_ticksPerSecond;
-#endif
-};
-
-#if defined(Q_OS_MAC)
-QwtHighResolutionClock::QwtHighResolutionClock():
-    d_timeStamp( 0 )
-{
-}
-
-double QwtHighResolutionClock::precision()
-{
-    return 1e-6;
-}
-
-void QwtHighResolutionClock::start()
-{
-    d_timeStamp = mach_absolute_time();
-}
-
-double QwtHighResolutionClock::restart()
-{
-    const uint64_t timeStamp = mach_absolute_time();
-    const double elapsed = msecsTo( d_timeStamp, timeStamp );
-    d_timeStamp = timeStamp;
-
-    return elapsed;
-}
-
-double QwtHighResolutionClock::elapsed() const
-{
-    return msecsTo( d_timeStamp, mach_absolute_time() );
-}
-
-bool QwtHighResolutionClock::isNull() const
-{
-    return d_timeStamp == 0;
-}
-
-double QwtHighResolutionClock::msecsTo(
-    uint64_t from, uint64_t to )
-{
-    const uint64_t difference = to - from;
-
-    static double conversion = 0.0;
-    if ( conversion == 0.0 )
-    {
-        mach_timebase_info_data_t info;
-        kern_return_t err = mach_timebase_info( &info );
-
-        // convert the timebase into ms
-        if ( err == 0  )
-            conversion = 1e-6 * ( double ) info.numer / ( double ) info.denom;
-    }
-
-    return conversion * ( double ) difference;
-}
-
-#elif defined(_POSIX_TIMERS)
-
-QwtHighResolutionClock::QwtHighResolutionClock()
-{
-    d_clockId = isMonotonic() ? CLOCK_MONOTONIC : CLOCK_REALTIME;
-    d_timeStamp.tv_sec = d_timeStamp.tv_nsec = 0;
-}
-
-double QwtHighResolutionClock::precision()
-{
-    struct timespec resolution;
-
-    int clockId = isMonotonic() ? CLOCK_MONOTONIC : CLOCK_REALTIME;
-    ::clock_getres( clockId, &resolution );
-
-    return resolution.tv_nsec / 1e3;
-}
-
-inline bool QwtHighResolutionClock::isNull() const
-{
-    return d_timeStamp.tv_sec <= 0 && d_timeStamp.tv_nsec <= 0;
-}
-
-inline void QwtHighResolutionClock::start()
-{
-    ::clock_gettime( d_clockId, &d_timeStamp );
-}
-
-double QwtHighResolutionClock::restart()
-{
-    struct timespec timeStamp;
-    ::clock_gettime( d_clockId, &timeStamp );
-
-    const double elapsed = msecsTo( d_timeStamp, timeStamp );
-
-    d_timeStamp = timeStamp;
-    return elapsed;
-}
-
-inline double QwtHighResolutionClock::elapsed() const
-{
-    struct timespec timeStamp;
-    ::clock_gettime( d_clockId, &timeStamp );
-
-    return msecsTo( d_timeStamp, timeStamp );
-}
-
-inline double QwtHighResolutionClock::msecsTo(
-    const struct timespec &t1, const struct timespec &t2 )
-{
-    return ( t2.tv_sec - t1.tv_sec ) * 1e3
-        + ( t2.tv_nsec - t1.tv_nsec ) * 1e-6;
-}
-
-bool QwtHighResolutionClock::isMonotonic()
-{
-    // code copied from qcore_unix.cpp
-
-#if (_POSIX_MONOTONIC_CLOCK-0 > 0)
-    return true;
-#else
-    static int returnValue = 0;
-
-    if ( returnValue == 0 )
-    {
-#if (_POSIX_MONOTONIC_CLOCK-0 < 0) || !defined(_SC_MONOTONIC_CLOCK)
-        returnValue = -1;
-#elif (_POSIX_MONOTONIC_CLOCK == 0)
-        // detect if the system support monotonic timers
-        const long x = sysconf( _SC_MONOTONIC_CLOCK );
-        returnValue = ( x >= 200112L ) ? 1 : -1;
-#endif
-    }
-
-    return returnValue != -1;
-#endif
-}
-
-#elif defined(Q_OS_WIN)
-
-QwtHighResolutionClock::QwtHighResolutionClock()
-{
-    d_startTicks.QuadPart = 0;
-    QueryPerformanceFrequency( &d_ticksPerSecond );
-}
-
-double QwtHighResolutionClock::precision()
-{
-    LARGE_INTEGER ticks;
-    if ( QueryPerformanceFrequency( &ticks ) && ticks.QuadPart > 0 )
-        return 1e3 / ticks.QuadPart;
-
-    return 0.0;
-}
-
-inline bool QwtHighResolutionClock::isNull() const
-{
-    return d_startTicks.QuadPart <= 0;
-}
-
-inline void QwtHighResolutionClock::start()
-{
-    QueryPerformanceCounter( &d_startTicks );
-}
-
-inline double QwtHighResolutionClock::restart()
-{
-    LARGE_INTEGER ticks;
-    QueryPerformanceCounter( &ticks );
-
-    const double dt = ticks.QuadPart - d_startTicks.QuadPart;
-    d_startTicks = ticks;
-
-    return dt / d_ticksPerSecond.QuadPart * 1e3;
-}
-
-inline double QwtHighResolutionClock::elapsed() const
-{
-    LARGE_INTEGER ticks;
-    QueryPerformanceCounter( &ticks );
-
-    const double dt = ticks.QuadPart - d_startTicks.QuadPart;
-    return dt / d_ticksPerSecond.QuadPart * 1e3;
-}
-
-#endif
-
-#endif // QWT_HIGH_RESOLUTION_CLOCK
-
-class QwtSystemClock::PrivateData
-{
-public:
-#if defined(QWT_HIGH_RESOLUTION_CLOCK)
-    QwtHighResolutionClock *clock;
-#endif
-    QTime time;
-};
-
-//!  Constructs a null clock object.
-QwtSystemClock::QwtSystemClock()
-{
-    d_data = new PrivateData;
-
-#if defined(QWT_HIGH_RESOLUTION_CLOCK)
-    d_data->clock = NULL;
-    if ( QwtHighResolutionClock::precision() > 0.0 )
-        d_data->clock = new QwtHighResolutionClock;
-#endif
-}
-
-//! Destructor
-QwtSystemClock::~QwtSystemClock()
-{
-#if defined(QWT_HIGH_RESOLUTION_CLOCK)
-    delete d_data->clock;
-#endif
-    delete d_data;
-}
-
-/*!
-  \return true if the clock has never been started.
-*/
-bool QwtSystemClock::isNull() const
-{
-#if defined(QWT_HIGH_RESOLUTION_CLOCK)
-    if ( d_data->clock )
-        return d_data->clock->isNull();
-#endif
-
-    return d_data->time.isNull();
-}
-
-/*!
-  Sets the start time to the current time.
-*/
-void QwtSystemClock::start()
-{
-#if defined(QWT_HIGH_RESOLUTION_CLOCK)
-    if ( d_data->clock )
-    {
-        d_data->clock->start();
-        return;
-    }
-#endif
-
-    d_data->time.start();
-}
-
-/*!
-  Set the start time to the current time
-  \return Time, that is elapsed since the previous start time.
-*/
-double QwtSystemClock::restart()
-{
-#if defined(QWT_HIGH_RESOLUTION_CLOCK)
-    if ( d_data->clock )
-        return d_data->clock->restart();
-#endif
-
-    return d_data->time.restart();
-}
-
-/*!
-  \return Number of milliseconds that have elapsed since the last time
-          start() or restart() was called or 0.0 for null clocks.
-*/
-double QwtSystemClock::elapsed() const
-{
-    double elapsed = 0.0;
-
-#if defined(QWT_HIGH_RESOLUTION_CLOCK)
-    if ( d_data->clock )
-    {
-        if ( !d_data->clock->isNull() )
-            elapsed = d_data->clock->elapsed();
-
-        return elapsed;
-    }
-#endif
-
-    if ( !d_data->time.isNull() )
-        elapsed = d_data->time.elapsed();
-
-    return elapsed;
-}
-
-#endif
Index: /trunk/BNC/qwt/qwt_system_clock.h
===================================================================
--- /trunk/BNC/qwt/qwt_system_clock.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_system_clock.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,29 +12,17 @@
 
 #include "qwt_global.h"
+#include <qelapsedtimer.h>
 
 /*!
-  \brief QwtSystemClock provides high resolution clock time functions.
+   \brief QwtSystemClock provides high resolution clock time functions.
 
-  Sometimes the resolution offered by QTime ( millisecond ) is not accurate
-  enough for implementing time measurements ( f.e. sampling ).
-  QwtSystemClock offers a subset of the QTime functionality using higher
-  resolution timers ( if possible ).
+   Precision and time intervals are multiples of milliseconds (ms).
 
-  Precision and time intervals are multiples of milliseconds (ms).
-
-  ( QwtSystemClock is obsolete since Qt 4.8 as QElapsedTimer offers the same
-    precision )
-
-  \note The implementation uses high-resolution performance counter on Windows,
-        mach_absolute_time() on the Mac or POSIX timers on other systems.
-        If none is available it falls back on QTimer.
-*/
+   ( QwtSystemClock is deprecated as QElapsedTimer offers the same precision )
+ */
 
 class QWT_EXPORT QwtSystemClock
 {
-public:
-    QwtSystemClock();
-    virtual ~QwtSystemClock();
-
+  public:
     bool isNull() const;
 
@@ -43,7 +31,6 @@
     double elapsed() const;
 
-private:
-    class PrivateData;
-    PrivateData *d_data;
+  private:
+    QElapsedTimer m_timer;
 };
 
Index: /trunk/BNC/qwt/qwt_text.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_text.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_text.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,4 +11,6 @@
 #include "qwt_painter.h"
 #include "qwt_text_engine.h"
+#include "qwt_math.h"
+
 #include <qmap.h>
 #include <qfont.h>
@@ -17,121 +19,146 @@
 #include <qbrush.h>
 #include <qpainter.h>
-#include <qapplication.h>
-#include <qdesktopwidget.h>
-#include <qmath.h>
-
-class QwtTextEngineDict
-{
-public:
-    static QwtTextEngineDict &dict();
-
-    void setTextEngine( QwtText::TextFormat, QwtTextEngine * );
-
-    const QwtTextEngine *textEngine( QwtText::TextFormat ) const;
-    const QwtTextEngine *textEngine( const QString &,
-        QwtText::TextFormat ) const;
-
-private:
-    QwtTextEngineDict();
-    ~QwtTextEngineDict();
-
-    typedef QMap<int, QwtTextEngine *> EngineMap;
-
-    inline const QwtTextEngine *engine( EngineMap::const_iterator &it ) const
-    {
-        return it.value();
-    }
-
-    EngineMap d_map;
-};
-
-QwtTextEngineDict &QwtTextEngineDict::dict()
-{
-    static QwtTextEngineDict engineDict;
-    return engineDict;
-}
-
-QwtTextEngineDict::QwtTextEngineDict()
-{
-    d_map.insert( QwtText::PlainText, new QwtPlainTextEngine() );
-#ifndef QT_NO_RICHTEXT
-    d_map.insert( QwtText::RichText, new QwtRichTextEngine() );
+
+#if QT_VERSION >= 0x050200
+
+static QwtText qwtStringToText( const QString& text )
+{
+    return QwtText( text );
+}
+
 #endif
-}
-
-QwtTextEngineDict::~QwtTextEngineDict()
-{
-    for ( EngineMap::const_iterator it = d_map.constBegin();
-        it != d_map.constEnd(); ++it )
-    {
-        const QwtTextEngine *textEngine = engine( it );
-        delete textEngine;
-    }
-}
-
-const QwtTextEngine *QwtTextEngineDict::textEngine( const QString& text,
-    QwtText::TextFormat format ) const
-{
-    if ( format == QwtText::AutoText )
-    {
-        for ( EngineMap::const_iterator it = d_map.begin();
-            it != d_map.end(); ++it )
+
+namespace
+{
+    static const struct RegisterQwtText
+    {
+        inline RegisterQwtText()
         {
-            if ( it.key() != QwtText::PlainText )
+            qRegisterMetaType< QwtText >();
+
+#if QT_VERSION >= 0x050200
+            QMetaType::registerConverter< QString, QwtText >( qwtStringToText );
+#endif
+        }
+
+    } qwtRegisterQwtText;
+}
+
+namespace
+{
+    class TextEngineDict
+    {
+      public:
+        static TextEngineDict& dict();
+
+        void setTextEngine( QwtText::TextFormat, QwtTextEngine* );
+
+        const QwtTextEngine* textEngine( QwtText::TextFormat ) const;
+        const QwtTextEngine* textEngine( const QString&,
+            QwtText::TextFormat ) const;
+
+      private:
+        TextEngineDict();
+        ~TextEngineDict();
+
+        typedef QMap< int, QwtTextEngine* > EngineMap;
+
+        inline const QwtTextEngine* engine( EngineMap::const_iterator& it ) const
+        {
+            return it.value();
+        }
+
+        EngineMap m_map;
+    };
+
+    TextEngineDict& TextEngineDict::dict()
+    {
+        static TextEngineDict engineDict;
+        return engineDict;
+    }
+
+    TextEngineDict::TextEngineDict()
+    {
+        m_map.insert( QwtText::PlainText, new QwtPlainTextEngine() );
+    #ifndef QT_NO_RICHTEXT
+        m_map.insert( QwtText::RichText, new QwtRichTextEngine() );
+    #endif
+    }
+
+    TextEngineDict::~TextEngineDict()
+    {
+        for ( EngineMap::const_iterator it = m_map.constBegin();
+            it != m_map.constEnd(); ++it )
+        {
+            const QwtTextEngine* textEngine = engine( it );
+            delete textEngine;
+        }
+    }
+
+    const QwtTextEngine* TextEngineDict::textEngine( const QString& text,
+        QwtText::TextFormat format ) const
+    {
+        if ( format == QwtText::AutoText )
+        {
+            for ( EngineMap::const_iterator it = m_map.begin();
+                it != m_map.end(); ++it )
             {
-                const QwtTextEngine *e = engine( it );
-                if ( e && e->mightRender( text ) )
-                    return e;
+                if ( it.key() != QwtText::PlainText )
+                {
+                    const QwtTextEngine* e = engine( it );
+                    if ( e && e->mightRender( text ) )
+                        return e;
+                }
             }
         }
-    }
-
-    EngineMap::const_iterator it = d_map.find( format );
-    if ( it != d_map.end() )
-    {
-        const QwtTextEngine *e = engine( it );
-        if ( e )
-            return e;
-    }
-
-    it = d_map.find( QwtText::PlainText );
-    return engine( it );
-}
-
-void QwtTextEngineDict::setTextEngine( QwtText::TextFormat format,
-    QwtTextEngine *engine )
-{
-    if ( format == QwtText::AutoText )
-        return;
-
-    if ( format == QwtText::PlainText && engine == NULL )
-        return;
-
-    EngineMap::const_iterator it = d_map.constFind( format );
-    if ( it != d_map.constEnd() )
-    {
-        delete this->engine( it );
-        d_map.remove( format );
-    }
-
-    if ( engine != NULL )
-        d_map.insert( format, engine );
-}
-
-const QwtTextEngine *QwtTextEngineDict::textEngine(
-    QwtText::TextFormat format ) const
-{
-    const QwtTextEngine *e = NULL;
-
-    EngineMap::const_iterator it = d_map.find( format );
-    if ( it != d_map.end() )
-        e = engine( it );
-
-    return e;
+
+        EngineMap::const_iterator it = m_map.find( format );
+        if ( it != m_map.end() )
+        {
+            const QwtTextEngine* e = engine( it );
+            if ( e )
+                return e;
+        }
+
+        it = m_map.find( QwtText::PlainText );
+        return engine( it );
+    }
+
+    void TextEngineDict::setTextEngine( QwtText::TextFormat format,
+        QwtTextEngine* engine )
+    {
+        if ( format == QwtText::AutoText )
+            return;
+
+        if ( format == QwtText::PlainText && engine == NULL )
+            return;
+
+        EngineMap::const_iterator it = m_map.constFind( format );
+        if ( it != m_map.constEnd() )
+        {
+            delete this->engine( it );
+            m_map.remove( format );
+        }
+
+        if ( engine != NULL )
+            m_map.insert( format, engine );
+    }
+
+    const QwtTextEngine* TextEngineDict::textEngine(
+        QwtText::TextFormat format ) const
+    {
+        const QwtTextEngine* e = NULL;
+
+        EngineMap::const_iterator it = m_map.find( format );
+        if ( it != m_map.end() )
+            e = engine( it );
+
+        return e;
+    }
 }
 
 class QwtText::PrivateData
 {
-public:
+  public:
     PrivateData():
         renderFlags( Qt::AlignCenter ),
@@ -139,6 +166,4 @@
         borderPen( Qt::NoPen ),
         backgroundBrush( Qt::NoBrush ),
-        paintAttributes( 0 ),
-        layoutAttributes( 0 ),
         textEngine( NULL )
     {
@@ -156,10 +181,10 @@
     QwtText::LayoutAttributes layoutAttributes;
 
-    const QwtTextEngine *textEngine;
+    const QwtTextEngine* textEngine;
 };
 
 class QwtText::LayoutCache
 {
-public:
+  public:
     void invalidate()
     {
@@ -173,25 +198,36 @@
 /*!
    Constructor
+ */
+QwtText::QwtText()
+{
+    m_data = new PrivateData;
+    m_data->textEngine = textEngine( m_data->text, PlainText );
+
+    m_layoutCache = new LayoutCache;
+}
+
+/*!
+   Constructor
 
    \param text Text content
    \param textFormat Text format
-*/
-QwtText::QwtText( const QString &text, QwtText::TextFormat textFormat )
-{
-    d_data = new PrivateData;
-    d_data->text = text;
-    d_data->textEngine = textEngine( text, textFormat );
-
-    d_layoutCache = new LayoutCache;
+ */
+QwtText::QwtText( const QString& text, QwtText::TextFormat textFormat )
+{
+    m_data = new PrivateData;
+    m_data->text = text;
+    m_data->textEngine = textEngine( text, textFormat );
+
+    m_layoutCache = new LayoutCache;
 }
 
 //! Copy constructor
-QwtText::QwtText( const QwtText &other )
-{
-    d_data = new PrivateData;
-    *d_data = *other.d_data;
-
-    d_layoutCache = new LayoutCache;
-    *d_layoutCache = *other.d_layoutCache;
+QwtText::QwtText( const QwtText& other )
+{
+    m_data = new PrivateData;
+    *m_data = *other.m_data;
+
+    m_layoutCache = new LayoutCache;
+    *m_layoutCache = *other.m_layoutCache;
 }
 
@@ -199,32 +235,32 @@
 QwtText::~QwtText()
 {
-    delete d_data;
-    delete d_layoutCache;
+    delete m_data;
+    delete m_layoutCache;
 }
 
 //! Assignment operator
-QwtText &QwtText::operator=( const QwtText & other )
-{
-    *d_data = *other.d_data;
-    *d_layoutCache = *other.d_layoutCache;
+QwtText& QwtText::operator=( const QwtText& other )
+{
+    *m_data = *other.m_data;
+    *m_layoutCache = *other.m_layoutCache;
     return *this;
 }
 
 //! Relational operator
-bool QwtText::operator==( const QwtText &other ) const
-{
-    return d_data->renderFlags == other.d_data->renderFlags &&
-        d_data->text == other.d_data->text &&
-        d_data->font == other.d_data->font &&
-        d_data->color == other.d_data->color &&
-        d_data->borderRadius == other.d_data->borderRadius &&
-        d_data->borderPen == other.d_data->borderPen &&
-        d_data->backgroundBrush == other.d_data->backgroundBrush &&
-        d_data->paintAttributes == other.d_data->paintAttributes &&
-        d_data->textEngine == other.d_data->textEngine;
+bool QwtText::operator==( const QwtText& other ) const
+{
+    return m_data->renderFlags == other.m_data->renderFlags &&
+           m_data->text == other.m_data->text &&
+           m_data->font == other.m_data->font &&
+           m_data->color == other.m_data->color &&
+           m_data->borderRadius == other.m_data->borderRadius &&
+           m_data->borderPen == other.m_data->borderPen &&
+           m_data->backgroundBrush == other.m_data->backgroundBrush &&
+           m_data->paintAttributes == other.m_data->paintAttributes &&
+           m_data->textEngine == other.m_data->textEngine;
 }
 
 //! Relational operator
-bool QwtText::operator!=( const QwtText &other ) const // invalidate
+bool QwtText::operator!=( const QwtText& other ) const // invalidate
 {
     return !( other == *this );
@@ -238,11 +274,11 @@
 
    \sa text()
-*/
-void QwtText::setText( const QString &text,
+ */
+void QwtText::setText( const QString& text,
     QwtText::TextFormat textFormat )
 {
-    d_data->text = text;
-    d_data->textEngine = textEngine( text, textFormat );
-    d_layoutCache->invalidate();
+    m_data->text = text;
+    m_data->textEngine = textEngine( text, textFormat );
+    m_layoutCache->invalidate();
 }
 
@@ -250,8 +286,8 @@
    \return Text as QString.
    \sa setText()
-*/
+ */
 QString QwtText::text() const
 {
-    return d_data->text;
+    return m_data->text;
 }
 
@@ -265,11 +301,11 @@
    \sa renderFlags(), QwtTextEngine::draw()
    \note Some renderFlags might have no effect, depending on the text format.
-*/
+ */
 void QwtText::setRenderFlags( int renderFlags )
 {
-    if ( renderFlags != d_data->renderFlags )
-    {
-        d_data->renderFlags = renderFlags;
-        d_layoutCache->invalidate();
+    if ( renderFlags != m_data->renderFlags )
+    {
+        m_data->renderFlags = renderFlags;
+        m_layoutCache->invalidate();
     }
 }
@@ -278,8 +314,8 @@
    \return Render flags
    \sa setRenderFlags()
-*/
+ */
 int QwtText::renderFlags() const
 {
-    return d_data->renderFlags;
+    return m_data->renderFlags;
 }
 
@@ -290,8 +326,8 @@
    \note Setting the font might have no effect, when
          the text contains control sequences for setting fonts.
-*/
-void QwtText::setFont( const QFont &font )
-{
-    d_data->font = font;
+ */
+void QwtText::setFont( const QFont& font )
+{
+    m_data->font = font;
     setPaintAttribute( PaintUsingTextFont );
 }
@@ -300,5 +336,5 @@
 QFont QwtText::font() const
 {
-    return d_data->font;
+    return m_data->font;
 }
 
@@ -311,9 +347,9 @@
 
    \sa setFont(), font(), PaintAttributes
-*/
-QFont QwtText::usedFont( const QFont &defaultFont ) const
-{
-    if ( d_data->paintAttributes & PaintUsingTextFont )
-        return d_data->font;
+ */
+QFont QwtText::usedFont( const QFont& defaultFont ) const
+{
+    if ( m_data->paintAttributes & PaintUsingTextFont )
+        return m_data->font;
 
     return defaultFont;
@@ -326,8 +362,8 @@
    \note Setting the color might have no effect, when
          the text contains control sequences for setting colors.
-*/
-void QwtText::setColor( const QColor &color )
-{
-    d_data->color = color;
+ */
+void QwtText::setColor( const QColor& color )
+{
+    m_data->color = color;
     setPaintAttribute( PaintUsingTextColor );
 }
@@ -336,20 +372,20 @@
 QColor QwtText::color() const
 {
-    return d_data->color;
-}
-
-/*!
-  Return the color of the text, if it has one.
-  Otherwise return defaultColor.
-
-  \param defaultColor Default color
-  \return Color used for drawing the text
-
-  \sa setColor(), color(), PaintAttributes
-*/
-QColor QwtText::usedColor( const QColor &defaultColor ) const
-{
-    if ( d_data->paintAttributes & PaintUsingTextColor )
-        return d_data->color;
+    return m_data->color;
+}
+
+/*!
+   Return the color of the text, if it has one.
+   Otherwise return defaultColor.
+
+   \param defaultColor Default color
+   \return Color used for drawing the text
+
+   \sa setColor(), color(), PaintAttributes
+ */
+QColor QwtText::usedColor( const QColor& defaultColor ) const
+{
+    if ( m_data->paintAttributes & PaintUsingTextColor )
+        return m_data->color;
 
     return defaultColor;
@@ -357,21 +393,21 @@
 
 /*!
-  Set the radius for the corners of the border frame
-
-  \param radius Radius of a rounded corner
-  \sa borderRadius(), setBorderPen(), setBackgroundBrush()
-*/
+   Set the radius for the corners of the border frame
+
+   \param radius Radius of a rounded corner
+   \sa borderRadius(), setBorderPen(), setBackgroundBrush()
+ */
 void QwtText::setBorderRadius( double radius )
 {
-    d_data->borderRadius = qMax( 0.0, radius );
-}
-
-/*!
-  \return Radius for the corners of the border frame
-  \sa setBorderRadius(), borderPen(), backgroundBrush()
-*/
+    m_data->borderRadius = qwtMaxF( 0.0, radius );
+}
+
+/*!
+   \return Radius for the corners of the border frame
+   \sa setBorderRadius(), borderPen(), backgroundBrush()
+ */
 double QwtText::borderRadius() const
 {
-    return d_data->borderRadius;
+    return m_data->borderRadius;
 }
 
@@ -381,8 +417,8 @@
    \param pen Background pen
    \sa borderPen(), setBackgroundBrush()
-*/
-void QwtText::setBorderPen( const QPen &pen )
-{
-    d_data->borderPen = pen;
+ */
+void QwtText::setBorderPen( const QPen& pen )
+{
+    m_data->borderPen = pen;
     setPaintAttribute( PaintBackground );
 }
@@ -391,8 +427,8 @@
    \return Background pen
    \sa setBorderPen(), backgroundBrush()
-*/
+ */
 QPen QwtText::borderPen() const
 {
-    return d_data->borderPen;
+    return m_data->borderPen;
 }
 
@@ -402,8 +438,8 @@
    \param brush Background brush
    \sa backgroundBrush(), setBorderPen()
-*/
-void QwtText::setBackgroundBrush( const QBrush &brush )
-{
-    d_data->backgroundBrush = brush;
+ */
+void QwtText::setBackgroundBrush( const QBrush& brush )
+{
+    m_data->backgroundBrush = brush;
     setPaintAttribute( PaintBackground );
 }
@@ -412,8 +448,8 @@
    \return Background brush
    \sa setBackgroundBrush(), borderPen()
-*/
+ */
 QBrush QwtText::backgroundBrush() const
 {
-    return d_data->backgroundBrush;
+    return m_data->backgroundBrush;
 }
 
@@ -427,11 +463,11 @@
          setBorderPen() and setBackgroundBrush()
    \sa testPaintAttribute()
-*/
+ */
 void QwtText::setPaintAttribute( PaintAttribute attribute, bool on )
 {
     if ( on )
-        d_data->paintAttributes |= attribute;
+        m_data->paintAttributes |= attribute;
     else
-        d_data->paintAttributes &= ~attribute;
+        m_data->paintAttributes &= ~attribute;
 }
 
@@ -443,8 +479,8 @@
 
    \sa setPaintAttribute()
-*/
+ */
 bool QwtText::testPaintAttribute( PaintAttribute attribute ) const
 {
-    return d_data->paintAttributes & attribute;
+    return m_data->paintAttributes & attribute;
 }
 
@@ -455,11 +491,11 @@
    \param on On/Off
    \sa testLayoutAttribute()
-*/
+ */
 void QwtText::setLayoutAttribute( LayoutAttribute attribute, bool on )
 {
     if ( on )
-        d_data->layoutAttributes |= attribute;
+        m_data->layoutAttributes |= attribute;
     else
-        d_data->layoutAttributes &= ~attribute;
+        m_data->layoutAttributes &= ~attribute;
 }
 
@@ -471,8 +507,20 @@
 
    \sa setLayoutAttribute()
-*/
+ */
 bool QwtText::testLayoutAttribute( LayoutAttribute attribute ) const
 {
-    return d_data->layoutAttributes | attribute;
+    return m_data->layoutAttributes | attribute;
+}
+
+/*!
+   Find the height for a given width
+
+   \param width Width
+   \return Calculated height
+ */
+
+double QwtText::heightForWidth( double width ) const
+{
+    return heightForWidth( width, QFont() );
 }
 
@@ -484,22 +532,22 @@
 
    \return Calculated height
-*/
-double QwtText::heightForWidth( double width, const QFont &defaultFont ) const
+ */
+double QwtText::heightForWidth( double width, const QFont& defaultFont ) const
 {
     // We want to calculate in screen metrics. So
     // we need a font that uses screen metrics
 
-    const QFont font( usedFont( defaultFont ), QApplication::desktop() );
+    const QFont font = QwtPainter::scaledFont( usedFont( defaultFont ) );
 
     double h = 0;
 
-    if ( d_data->layoutAttributes & MinimumLayout )
+    if ( m_data->layoutAttributes & MinimumLayout )
     {
         double left, right, top, bottom;
-        d_data->textEngine->textMargins( font, d_data->text,
+        m_data->textEngine->textMargins( font, m_data->text,
             left, right, top, bottom );
 
-        h = d_data->textEngine->heightForWidth(
-            font, d_data->renderFlags, d_data->text,
+        h = m_data->textEngine->heightForWidth(
+            font, m_data->renderFlags, m_data->text,
             width + left + right );
 
@@ -508,9 +556,19 @@
     else
     {
-        h = d_data->textEngine->heightForWidth(
-            font, d_data->renderFlags, d_data->text, width );
+        h = m_data->textEngine->heightForWidth(
+            font, m_data->renderFlags, m_data->text, width );
     }
 
     return h;
+}
+
+/*!
+   Returns the size, that is needed to render text
+
+   \return Calculated size
+ */
+QSizeF QwtText::textSize() const
+{
+    return textSize( QFont() );
 }
 
@@ -520,26 +578,26 @@
    \param defaultFont Font of the text
    \return Calculated size
-*/
-QSizeF QwtText::textSize( const QFont &defaultFont ) const
+ */
+QSizeF QwtText::textSize( const QFont& defaultFont ) const
 {
     // We want to calculate in screen metrics. So
     // we need a font that uses screen metrics
 
-    const QFont font( usedFont( defaultFont ), QApplication::desktop() );
-
-    if ( !d_layoutCache->textSize.isValid()
-        || d_layoutCache->font != font )
-    {
-        d_layoutCache->textSize = d_data->textEngine->textSize(
-            font, d_data->renderFlags, d_data->text );
-        d_layoutCache->font = font;
-    }
-
-    QSizeF sz = d_layoutCache->textSize;
-
-    if ( d_data->layoutAttributes & MinimumLayout )
+    const QFont font = QwtPainter::scaledFont( usedFont( defaultFont ) );
+
+    if ( !m_layoutCache->textSize.isValid()
+        || m_layoutCache->font != font )
+    {
+        m_layoutCache->textSize = m_data->textEngine->textSize(
+            font, m_data->renderFlags, m_data->text );
+        m_layoutCache->font = font;
+    }
+
+    QSizeF sz = m_layoutCache->textSize;
+
+    if ( m_data->layoutAttributes & MinimumLayout )
     {
         double left, right, top, bottom;
-        d_data->textEngine->textMargins( font, d_data->text,
+        m_data->textEngine->textMargins( font, m_data->text,
             left, right, top, bottom );
         sz -= QSizeF( left + right, top + bottom );
@@ -554,18 +612,18 @@
    \param painter Painter
    \param rect Rectangle
-*/
-void QwtText::draw( QPainter *painter, const QRectF &rect ) const
-{
-    if ( d_data->paintAttributes & PaintBackground )
-    {
-        if ( d_data->borderPen != Qt::NoPen ||
-            d_data->backgroundBrush != Qt::NoBrush )
+ */
+void QwtText::draw( QPainter* painter, const QRectF& rect ) const
+{
+    if ( m_data->paintAttributes & PaintBackground )
+    {
+        if ( m_data->borderPen != Qt::NoPen ||
+            m_data->backgroundBrush != Qt::NoBrush )
         {
             painter->save();
 
-            painter->setPen( d_data->borderPen );
-            painter->setBrush( d_data->backgroundBrush );
-
-            if ( d_data->borderRadius == 0 )
+            painter->setPen( m_data->borderPen );
+            painter->setBrush( m_data->backgroundBrush );
+
+            if ( m_data->borderRadius == 0 )
             {
                 QwtPainter::drawRect( painter, rect );
@@ -575,5 +633,5 @@
                 painter->setRenderHint( QPainter::Antialiasing, true );
                 painter->drawRoundedRect( rect,
-                    d_data->borderRadius, d_data->borderRadius );
+                    m_data->borderRadius, m_data->borderRadius );
             }
 
@@ -584,26 +642,26 @@
     painter->save();
 
-    if ( d_data->paintAttributes & PaintUsingTextFont )
-    {
-        painter->setFont( d_data->font );
-    }
-
-    if ( d_data->paintAttributes & PaintUsingTextColor )
-    {
-        if ( d_data->color.isValid() )
-            painter->setPen( d_data->color );
+    if ( m_data->paintAttributes & PaintUsingTextFont )
+    {
+        painter->setFont( m_data->font );
+    }
+
+    if ( m_data->paintAttributes & PaintUsingTextColor )
+    {
+        if ( m_data->color.isValid() )
+            painter->setPen( m_data->color );
     }
 
     QRectF expandedRect = rect;
-    if ( d_data->layoutAttributes & MinimumLayout )
+    if ( m_data->layoutAttributes & MinimumLayout )
     {
         // We want to calculate in screen metrics. So
         // we need a font that uses screen metrics
 
-        const QFont font( painter->font(), QApplication::desktop() );
+        const QFont font = QwtPainter::scaledFont( painter->font() );
 
         double left, right, top, bottom;
-        d_data->textEngine->textMargins(
-            font, d_data->text, left, right, top, bottom );
+        m_data->textEngine->textMargins(
+            font, m_data->text, left, right, top, bottom );
 
         expandedRect.setTop( rect.top() - top );
@@ -613,6 +671,6 @@
     }
 
-    d_data->textEngine->draw( painter, expandedRect,
-        d_data->renderFlags, d_data->text );
+    m_data->textEngine->draw( painter, expandedRect,
+        m_data->renderFlags, m_data->text );
 
     painter->restore();
@@ -627,5 +685,5 @@
 
    If no text engine is registered for the format QwtPlainTextEngine
-   is returnd.
+   is returned.
 
    \param text Text, needed in case of AutoText
@@ -633,9 +691,9 @@
 
    \return Corresponding text engine
-*/
-const QwtTextEngine *QwtText::textEngine( const QString &text,
+ */
+const QwtTextEngine* QwtText::textEngine( const QString& text,
     QwtText::TextFormat format )
 {
-    return QwtTextEngineDict::dict().textEngine( text, format );
+    return TextEngineDict::dict().textEngine( text, format );
 }
 
@@ -651,11 +709,10 @@
    \param engine Text engine
 
-   \sa QwtMathMLTextEngine
    \warning Using QwtText::AutoText does nothing.
-*/
+ */
 void QwtText::setTextEngine( QwtText::TextFormat format,
-    QwtTextEngine *engine )
-{
-    QwtTextEngineDict::dict().setTextEngine( format, engine );
+    QwtTextEngine* engine )
+{
+    TextEngineDict::dict().setTextEngine( format, engine );
 }
 
@@ -667,7 +724,20 @@
    \param format Text format
    \return The text engine, or NULL if no engine is available.
-*/
-const QwtTextEngine *QwtText::textEngine( QwtText::TextFormat format )
-{
-    return  QwtTextEngineDict::dict().textEngine( format );
-}
+ */
+const QwtTextEngine* QwtText::textEngine( QwtText::TextFormat format )
+{
+    return TextEngineDict::dict().textEngine( format );
+}
+
+//! \return text().isNull()
+bool QwtText::isNull() const
+{
+    return m_data->text.isNull();
+}
+
+//! \return text().isEmpty()
+bool QwtText::isEmpty() const
+{
+    return m_data->text.isEmpty();
+}
+
Index: /trunk/BNC/qwt/qwt_text.h
===================================================================
--- /trunk/BNC/qwt/qwt_text.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_text.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,12 +12,12 @@
 
 #include "qwt_global.h"
-#include <qstring.h>
-#include <qsize.h>
-#include <qfont.h>
 #include <qmetatype.h>
 
+class QFont;
+class QString;
 class QColor;
 class QPen;
 class QBrush;
+class QSizeF;
 class QRectF;
 class QPainter;
@@ -25,48 +25,48 @@
 
 /*!
-  \brief A class representing a text
-
-  A QwtText is a text including a set of attributes how to render it.
-
-  - Format\n
+   \brief A class representing a text
+
+   A QwtText is a text including a set of attributes how to render it.
+
+   - Format\n
     A text might include control sequences (f.e tags) describing
     how to render it. Each format (f.e MathML, TeX, Qt Rich Text)
     has its own set of control sequences, that can be handles by
     a special QwtTextEngine for this format.
-  - Background\n
+   - Background\n
     A text might have a background, defined by a QPen and QBrush
     to improve its visibility. The corners of the background might
     be rounded.
-  - Font\n
+   - Font\n
     A text might have an individual font.
-  - Color\n
+   - Color\n
     A text might have an individual color.
-  - Render Flags\n
+   - Render Flags\n
     Flags from Qt::AlignmentFlag and Qt::TextFlag used like in
     QPainter::drawText().
 
-  \sa QwtTextEngine, QwtTextLabel
-*/
+   \sa QwtTextEngine, QwtTextLabel
+ */
 
 class QWT_EXPORT QwtText
 {
-public:
+  public:
 
     /*!
-      \brief Text format
-
-      The text format defines the QwtTextEngine, that is used to render
-      the text.
-
-      \sa QwtTextEngine, setTextEngine()
-    */
+       \brief Text format
+
+       The text format defines the QwtTextEngine, that is used to render
+       the text.
+
+       \sa QwtTextEngine, setTextEngine()
+     */
 
     enum TextFormat
     {
         /*!
-          The text format is determined using QwtTextEngine::mightRender() for
-          all available text engines in increasing order > PlainText.
-          If none of the text engines can render the text is rendered
-          like QwtText::PlainText.
+           The text format is determined using QwtTextEngine::mightRender() for
+           all available text engines in increasing order > PlainText.
+           If none of the text engines can render the text is rendered
+           like QwtText::PlainText.
          */
         AutoText = 0,
@@ -79,25 +79,27 @@
 
         /*!
-          Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine
-          to display the text. The Qwt MathML extension offers such an engine
-          based on the MathML renderer of the former Qt solutions package.
-          To enable MathML support the following code needs to be added to the
-          application:
-
-          \code
+           Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine
+           to display the text. In earlier versions of Qwt such an engine
+           was included - since Qwt 6.2 it can be found here:
+           https://github.com/uwerat/qwt-mml-dev
+
+           To enable MathML support the following code needs to be added to the
+           application:
+
+           \code
             QwtText::setTextEngine( QwtText::MathMLText, new QwtMathMLTextEngine() );
-          \endcode
+           \endcode
          */
         MathMLText,
 
         /*!
-          Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine
-          to display the text ( not implemented yet ).
+           Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine
+           to display the text ( not implemented yet ).
          */
         TeXText,
 
         /*!
-          The number of text formats can be extended using setTextEngine.
-          Formats >= QwtText::OtherFormat are not used by Qwt.
+           The number of text formats can be extended using setTextEngine.
+           Formats >= QwtText::OtherFormat are not used by Qwt.
          */
         OtherFormat = 100
@@ -105,9 +107,9 @@
 
     /*!
-      \brief Paint Attributes
-
-      Font and color and background are optional attributes of a QwtText.
-      The paint attributes hold the information, if they are set.
-    */
+       \brief Paint Attributes
+
+       Font and color and background are optional attributes of a QwtText.
+       The paint attributes hold the information, if they are set.
+     */
     enum PaintAttribute
     {
@@ -122,36 +124,35 @@
     };
 
-    //! Paint attributes
-    typedef QFlags<PaintAttribute> PaintAttributes;
+    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
 
     /*!
-      \brief Layout Attributes
-      The layout attributes affects some aspects of the layout of the text.
-    */
+       \brief Layout Attributes
+       The layout attributes affects some aspects of the layout of the text.
+     */
     enum LayoutAttribute
     {
         /*!
-          Layout the text without its margins. This mode is useful if a
-          text needs to be aligned accurately, like the tick labels of a scale.
-          If QwtTextEngine::textMargins is not implemented for the format
-          of the text, MinimumLayout has no effect.
+           Layout the text without its margins. This mode is useful if a
+           text needs to be aligned accurately, like the tick labels of a scale.
+           If QwtTextEngine::textMargins is not implemented for the format
+           of the text, MinimumLayout has no effect.
          */
         MinimumLayout = 0x01
     };
 
-    //! Layout attributes
-    typedef QFlags<LayoutAttribute> LayoutAttributes;
-
-    QwtText( const QString & = QString(),
-             TextFormat textFormat = AutoText );
-    QwtText( const QwtText & );
+    Q_DECLARE_FLAGS( LayoutAttributes, LayoutAttribute )
+
+    QwtText();
+    QwtText( const QString&, TextFormat textFormat = AutoText );
+    QwtText( const QwtText& );
+
     ~QwtText();
 
-    QwtText &operator=( const QwtText & );
-
-    bool operator==( const QwtText & ) const;
-    bool operator!=( const QwtText & ) const;
-
-    void setText( const QString &,
+    QwtText& operator=( const QwtText& );
+
+    bool operator==( const QwtText& ) const;
+    bool operator!=( const QwtText& ) const;
+
+    void setText( const QString&,
         QwtText::TextFormat textFormat = AutoText );
     QString text() const;
@@ -160,24 +161,24 @@
     bool isEmpty() const;
 
-    void setFont( const QFont & );
+    void setFont( const QFont& );
     QFont font() const;
 
-    QFont usedFont( const QFont & ) const;
+    QFont usedFont( const QFont& ) const;
 
     void setRenderFlags( int );
     int renderFlags() const;
 
-    void setColor( const QColor & );
+    void setColor( const QColor& );
     QColor color() const;
 
-    QColor usedColor( const QColor & ) const;
+    QColor usedColor( const QColor& ) const;
 
     void setBorderRadius( double );
     double borderRadius() const;
 
-    void setBorderPen( const QPen & );
+    void setBorderPen( const QPen& );
     QPen borderPen() const;
 
-    void setBackgroundBrush( const QBrush & );
+    void setBackgroundBrush( const QBrush& );
     QBrush backgroundBrush() const;
 
@@ -188,34 +189,25 @@
     bool testLayoutAttribute( LayoutAttribute ) const;
 
-    double heightForWidth( double width, const QFont & = QFont() ) const;
-    QSizeF textSize( const QFont & = QFont() ) const;
-
-    void draw( QPainter *painter, const QRectF &rect ) const;
-
-    static const QwtTextEngine *textEngine(
-        const QString &text, QwtText::TextFormat = AutoText );
-
-    static const QwtTextEngine *textEngine( QwtText::TextFormat );
-    static void setTextEngine( QwtText::TextFormat, QwtTextEngine * );
-
-private:
+    double heightForWidth( double width ) const;
+    double heightForWidth( double width, const QFont& ) const;
+
+    QSizeF textSize() const;
+    QSizeF textSize( const QFont& ) const;
+
+    void draw( QPainter* painter, const QRectF& rect ) const;
+
+    static const QwtTextEngine* textEngine(
+        const QString& text, QwtText::TextFormat = AutoText );
+
+    static const QwtTextEngine* textEngine( QwtText::TextFormat );
+    static void setTextEngine( QwtText::TextFormat, QwtTextEngine* );
+
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 
     class LayoutCache;
-    LayoutCache *d_layoutCache;
+    LayoutCache* m_layoutCache;
 };
-
-//! \return text().isNull()
-inline bool QwtText::isNull() const
-{
-    return text().isNull();
-}
-
-//! \return text().isEmpty()
-inline bool QwtText::isEmpty() const
-{
-    return text().isEmpty();
-}
 
 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::PaintAttributes )
Index: /trunk/BNC/qwt/qwt_text_engine.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_text_engine.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_text_engine.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,6 +9,6 @@
 
 #include "qwt_text_engine.h"
-#include "qwt_math.h"
 #include "qwt_painter.h"
+
 #include <qpainter.h>
 #include <qpixmap.h>
@@ -20,5 +20,5 @@
 #include <qabstracttextdocumentlayout.h>
 
-static QString taggedRichText( const QString &text, int flags )
+static QString taggedRichText( const QString& text, int flags )
 {
     QString richText = text;
@@ -27,16 +27,16 @@
     if ( flags & Qt::AlignJustify )
     {
-        richText.prepend( QString::fromLatin1( "<div align=\"justify\">" ) );
-        richText.append( QString::fromLatin1( "</div>" ) );
+        richText.prepend( QLatin1String( "<div align=\"justify\">" ) );
+        richText.append( QLatin1String ( "</div>" ) );
     }
     else if ( flags & Qt::AlignRight )
     {
-        richText.prepend( QString::fromLatin1( "<div align=\"right\">" ) );
-        richText.append( QString::fromLatin1( "</div>" ) );
+        richText.prepend( QLatin1String ( "<div align=\"right\">" ) );
+        richText.append( QLatin1String ( "</div>" ) );
     }
     else if ( flags & Qt::AlignHCenter )
     {
-        richText.prepend( QString::fromLatin1( "<div align=\"center\">" ) );
-        richText.append( QString::fromLatin1( "</div>" ) );
+        richText.prepend( QLatin1String ( "<div align=\"center\">" ) );
+        richText.append( QLatin1String ( "</div>" ) );
     }
 
@@ -44,59 +44,62 @@
 }
 
-class QwtRichTextDocument: public QTextDocument
-{
-public:
-    QwtRichTextDocument( const QString &text, int flags, const QFont &font )
-    {
-        setUndoRedoEnabled( false );
-        setDefaultFont( font );
-        setHtml( text );
-
-        // make sure we have a document layout
-        ( void )documentLayout();
-
-        QTextOption option = defaultTextOption();
-        if ( flags & Qt::TextWordWrap )
-            option.setWrapMode( QTextOption::WordWrap );
-        else
-            option.setWrapMode( QTextOption::NoWrap );
-
-        option.setAlignment( static_cast<Qt::Alignment>( flags ) );
-        setDefaultTextOption( option );
-
-        QTextFrame *root = rootFrame();
-        QTextFrameFormat fm = root->frameFormat();
-        fm.setBorder( 0 );
-        fm.setMargin( 0 );
-        fm.setPadding( 0 );
-        fm.setBottomMargin( 0 );
-        fm.setLeftMargin( 0 );
-        root->setFrameFormat( fm );
-
-        adjustSize();
-    }
-};
+namespace
+{
+    class QwtRichTextDocument : public QTextDocument
+    {
+      public:
+        QwtRichTextDocument( const QString& text, int flags, const QFont& font )
+        {
+            setUndoRedoEnabled( false );
+            setDefaultFont( font );
+            setHtml( text );
+
+            // make sure we have a document layout
+            ( void )documentLayout();
+
+            QTextOption option = defaultTextOption();
+            if ( flags & Qt::TextWordWrap )
+                option.setWrapMode( QTextOption::WordWrap );
+            else
+                option.setWrapMode( QTextOption::NoWrap );
+
+            option.setAlignment( static_cast< Qt::Alignment >( flags ) );
+            setDefaultTextOption( option );
+
+            QTextFrame* root = rootFrame();
+            QTextFrameFormat fm = root->frameFormat();
+            fm.setBorder( 0 );
+            fm.setMargin( 0 );
+            fm.setPadding( 0 );
+            fm.setBottomMargin( 0 );
+            fm.setLeftMargin( 0 );
+            root->setFrameFormat( fm );
+
+            adjustSize();
+        }
+    };
+}
 
 class QwtPlainTextEngine::PrivateData
 {
-public:
-    int effectiveAscent( const QFont &font ) const
+  public:
+    int effectiveAscent( const QFont& font ) const
     {
         const QString fontKey = font.key();
 
-        QMap<QString, int>::const_iterator it =
-            d_ascentCache.constFind( fontKey );
-
-        if ( it != d_ascentCache.constEnd() )
+        QMap< QString, int >::const_iterator it =
+            m_ascentCache.constFind( fontKey );
+
+        if ( it != m_ascentCache.constEnd() )
             return *it;
 
         const int ascent = findAscent( font );
-        d_ascentCache.insert( fontKey, ascent );
+        m_ascentCache.insert( fontKey, ascent );
 
         return ascent;
     }
 
-private:
-    int findAscent( const QFont &font ) const
+  private:
+    static int findAscent( const QFont& font )
     {
         static const QString dummy( "E" );
@@ -104,5 +107,6 @@
 
         const QFontMetrics fm( font );
-        QPixmap pm( fm.width( dummy ), fm.height() );
+
+        QPixmap pm( QwtPainter::horizontalAdvance( fm, dummy ), fm.height() );
         pm.fill( white );
 
@@ -117,5 +121,5 @@
         for ( row = 0; row < img.height(); row++ )
         {
-            const QRgb *line = reinterpret_cast<const QRgb *>(
+            const QRgb* line = reinterpret_cast< const QRgb* >(
                 img.scanLine( row ) );
 
@@ -131,5 +135,5 @@
     }
 
-    mutable QMap<QString, int> d_ascentCache;
+    mutable QMap< QString, int > m_ascentCache;
 };
 
@@ -147,5 +151,5 @@
 QwtPlainTextEngine::QwtPlainTextEngine()
 {
-    d_data = new PrivateData;
+    m_data = new PrivateData;
 }
 
@@ -153,5 +157,5 @@
 QwtPlainTextEngine::~QwtPlainTextEngine()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -165,7 +169,7 @@
 
    \return Calculated height
-*/
+ */
 double QwtPlainTextEngine::heightForWidth( const QFont& font, int flags,
-        const QString& text, double width ) const
+    const QString& text, double width ) const
 {
     const QFontMetricsF fm( font );
@@ -177,13 +181,13 @@
 
 /*!
-  Returns the size, that is needed to render text
-
-  \param font Font of the text
-  \param flags Bitwise OR of the flags used like in QPainter::drawText
-  \param text Text to be rendered
-
-  \return Calculated size
-*/
-QSizeF QwtPlainTextEngine::textSize( const QFont &font,
+   Returns the size, that is needed to render text
+
+   \param font Font of the text
+   \param flags Bitwise OR of the flags used like in QPainter::drawText
+   \param text Text to be rendered
+
+   \return Calculated size
+ */
+QSizeF QwtPlainTextEngine::textSize( const QFont& font,
     int flags, const QString& text ) const
 {
@@ -196,33 +200,33 @@
 
 /*!
-  Return margins around the texts
-
-  \param font Font of the text
-  \param left Return 0
-  \param right Return 0
-  \param top Return value for the top margin
-  \param bottom Return value for the bottom margin
-*/
-void QwtPlainTextEngine::textMargins( const QFont &font, const QString &,
-    double &left, double &right, double &top, double &bottom ) const
+   Return margins around the texts
+
+   \param font Font of the text
+   \param left Return 0
+   \param right Return 0
+   \param top Return value for the top margin
+   \param bottom Return value for the bottom margin
+ */
+void QwtPlainTextEngine::textMargins( const QFont& font, const QString&,
+    double& left, double& right, double& top, double& bottom ) const
 {
     left = right = top = 0;
 
     const QFontMetricsF fm( font );
-    top = fm.ascent() - d_data->effectiveAscent( font );
+    top = fm.ascent() - m_data->effectiveAscent( font );
     bottom = fm.descent();
 }
 
 /*!
-  \brief Draw the text in a clipping rectangle
-
-  A wrapper for QPainter::drawText.
-
-  \param painter Painter
-  \param rect Clipping rectangle
-  \param flags Bitwise OR of the flags used like in QPainter::drawText
-  \param text Text to be rendered
-*/
-void QwtPlainTextEngine::draw( QPainter *painter, const QRectF &rect,
+   \brief Draw the text in a clipping rectangle
+
+   A wrapper for QPainter::drawText.
+
+   \param painter Painter
+   \param rect Clipping rectangle
+   \param flags Bitwise OR of the flags used like in QPainter::drawText
+   \param text Text to be rendered
+ */
+void QwtPlainTextEngine::draw( QPainter* painter, const QRectF& rect,
     int flags, const QString& text ) const
 {
@@ -231,8 +235,8 @@
 
 /*!
-  Test if a string can be rendered by this text engine.
-  \return Always true. All texts can be rendered by QwtPlainTextEngine
-*/
-bool QwtPlainTextEngine::mightRender( const QString & ) const
+   Test if a string can be rendered by this text engine.
+   \return Always true. All texts can be rendered by QwtPlainTextEngine
+ */
+bool QwtPlainTextEngine::mightRender( const QString& ) const
 {
     return true;
@@ -255,7 +259,7 @@
 
    \return Calculated height
-*/
+ */
 double QwtRichTextEngine::heightForWidth( const QFont& font, int flags,
-        const QString& text, double width ) const
+    const QString& text, double width ) const
 {
     QwtRichTextDocument doc( text, flags, font );
@@ -266,14 +270,14 @@
 
 /*!
-  Returns the size, that is needed to render text
-
-  \param font Font of the text
-  \param flags Bitwise OR of the flags used like in QPainter::drawText()
-  \param text Text to be rendered
-
-  \return Calculated size
-*/
-
-QSizeF QwtRichTextEngine::textSize( const QFont &font,
+   Returns the size, that is needed to render text
+
+   \param font Font of the text
+   \param flags Bitwise OR of the flags used like in QPainter::drawText()
+   \param text Text to be rendered
+
+   \return Calculated size
+ */
+
+QSizeF QwtRichTextEngine::textSize( const QFont& font,
     int flags, const QString& text ) const
 {
@@ -292,12 +296,12 @@
 
 /*!
-  Draw the text in a clipping rectangle
-
-  \param painter Painter
-  \param rect Clipping rectangle
-  \param flags Bitwise OR of the flags like in for QPainter::drawText()
-  \param text Text to be rendered
-*/
-void QwtRichTextEngine::draw( QPainter *painter, const QRectF &rect,
+   Draw the text in a clipping rectangle
+
+   \param painter Painter
+   \param rect Clipping rectangle
+   \param flags Bitwise OR of the flags like in for QPainter::drawText()
+   \param text Text to be rendered
+ */
+void QwtRichTextEngine::draw( QPainter* painter, const QRectF& rect,
     int flags, const QString& text ) const
 {
@@ -313,6 +317,6 @@
 
    \return Tagged text
-*/
-QString QwtRichTextEngine::taggedText( const QString &text, int flags ) const
+ */
+QString QwtRichTextEngine::taggedText( const QString& text, int flags ) const
 {
     return taggedRichText( text, flags );
@@ -320,10 +324,10 @@
 
 /*!
-  Test if a string can be rendered by this text engine
-
-  \param text Text to be tested
-  \return Qt::mightBeRichText(text);
-*/
-bool QwtRichTextEngine::mightRender( const QString &text ) const
+   Test if a string can be rendered by this text engine
+
+   \param text Text to be tested
+   \return Qt::mightBeRichText(text);
+ */
+bool QwtRichTextEngine::mightRender( const QString& text ) const
 {
     return Qt::mightBeRichText( text );
@@ -331,13 +335,13 @@
 
 /*!
-  Return margins around the texts
-
-  \param left Return 0
-  \param right Return 0
-  \param top Return 0
-  \param bottom Return 0
-*/
-void QwtRichTextEngine::textMargins( const QFont &, const QString &,
-    double &left, double &right, double &top, double &bottom ) const
+   Return margins around the texts
+
+   \param left Return 0
+   \param right Return 0
+   \param top Return 0
+   \param bottom Return 0
+ */
+void QwtRichTextEngine::textMargins( const QFont&, const QString&,
+    double& left, double& right, double& top, double& bottom ) const
 {
     left = right = top = bottom = 0;
Index: /trunk/BNC/qwt/qwt_text_engine.h
===================================================================
--- /trunk/BNC/qwt/qwt_text_engine.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_text_engine.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,5 +9,5 @@
 
 #ifndef QWT_TEXT_ENGINE_H
-#define QWT_TEXT_ENGINE_H 1
+#define QWT_TEXT_ENGINE_H
 
 #include "qwt_global.h"
@@ -20,118 +20,118 @@
 
 /*!
-  \brief Abstract base class for rendering text strings
+   \brief Abstract base class for rendering text strings
 
-  A text engine is responsible for rendering texts for a
-  specific text format. They are used by QwtText to render a text.
+   A text engine is responsible for rendering texts for a
+   specific text format. They are used by QwtText to render a text.
 
-  QwtPlainTextEngine and QwtRichTextEngine are part of the Qwt library.
-  The implementation of QwtMathMLTextEngine uses code from the
-  Qt solution package. Because of license implications it is built into
-  a separate library.
-
-  \sa QwtText::setTextEngine()
-*/
+   \sa QwtText::setTextEngine()
+ */
 
 class QWT_EXPORT QwtTextEngine
 {
-public:
+  public:
     virtual ~QwtTextEngine();
 
     /*!
-      Find the height for a given width
+       Find the height for a given width
 
-      \param font Font of the text
-      \param flags Bitwise OR of the flags used like in QPainter::drawText
-      \param text Text to be rendered
-      \param width Width
+       \param font Font of the text
+       \param flags Bitwise OR of the flags used like in QPainter::drawText
+       \param text Text to be rendered
+       \param width Width
 
-      \return Calculated height
+       \return Calculated height
      */
-    virtual double heightForWidth( const QFont &font, int flags,
-        const QString &text, double width ) const = 0;
+    virtual double heightForWidth( const QFont& font, int flags,
+        const QString& text, double width ) const = 0;
 
     /*!
-      Returns the size, that is needed to render text
+       Returns the size, that is needed to render text
 
-      \param font Font of the text
-      \param flags Bitwise OR of the flags like in for QPainter::drawText
-      \param text Text to be rendered
+       \param font Font of the text
+       \param flags Bitwise OR of the flags like in for QPainter::drawText
+       \param text Text to be rendered
 
-      \return Calculated size
+       \return Calculated size
      */
-    virtual QSizeF textSize( const QFont &font, int flags,
-        const QString &text ) const = 0;
+    virtual QSizeF textSize( const QFont& font, int flags,
+        const QString& text ) const = 0;
 
     /*!
-      Test if a string can be rendered by this text engine
+       Test if a string can be rendered by this text engine
 
-      \param text Text to be tested
-      \return true, if it can be rendered
+       \param text Text to be tested
+       \return true, if it can be rendered
      */
-    virtual bool mightRender( const QString &text ) const = 0;
+    virtual bool mightRender( const QString& text ) const = 0;
 
     /*!
-      Return margins around the texts
+       Return margins around the texts
 
-      The textSize might include margins around the
-      text, like QFontMetrics::descent(). In situations
-      where texts need to be aligned in detail, knowing
-      these margins might improve the layout calculations.
+       The textSize might include margins around the
+       text, like QFontMetrics::descent(). In situations
+       where texts need to be aligned in detail, knowing
+       these margins might improve the layout calculations.
 
-      \param font Font of the text
-      \param text Text to be rendered
-      \param left Return value for the left margin
-      \param right Return value for the right margin
-      \param top Return value for the top margin
-      \param bottom Return value for the bottom margin
+       \param font Font of the text
+       \param text Text to be rendered
+       \param left Return value for the left margin
+       \param right Return value for the right margin
+       \param top Return value for the top margin
+       \param bottom Return value for the bottom margin
      */
-    virtual void textMargins( const QFont &font, const QString &text,
-        double &left, double &right, double &top, double &bottom ) const = 0;
+    virtual void textMargins( const QFont& font, const QString& text,
+        double& left, double& right, double& top, double& bottom ) const = 0;
 
     /*!
-      Draw the text in a clipping rectangle
+       Draw the text in a clipping rectangle
 
-      \param painter Painter
-      \param rect Clipping rectangle
-      \param flags Bitwise OR of the flags like in for QPainter::drawText()
-      \param text Text to be rendered
+       \param painter Painter
+       \param rect Clipping rectangle
+       \param flags Bitwise OR of the flags like in for QPainter::drawText()
+       \param text Text to be rendered
      */
-    virtual void draw( QPainter *painter, const QRectF &rect,
-        int flags, const QString &text ) const = 0;
+    virtual void draw( QPainter* painter, const QRectF& rect,
+        int flags, const QString& text ) const = 0;
 
-protected:
+  protected:
     QwtTextEngine();
+
+  private:
+    Q_DISABLE_COPY(QwtTextEngine)
 };
 
 
 /*!
-  \brief A text engine for plain texts
+   \brief A text engine for plain texts
 
-  QwtPlainTextEngine renders texts using the basic Qt classes
-  QPainter and QFontMetrics.
-*/
-class QWT_EXPORT QwtPlainTextEngine: public QwtTextEngine
+   QwtPlainTextEngine renders texts using the basic Qt classes
+   QPainter and QFontMetrics.
+ */
+class QWT_EXPORT QwtPlainTextEngine : public QwtTextEngine
 {
-public:
+  public:
     QwtPlainTextEngine();
     virtual ~QwtPlainTextEngine();
 
-    virtual double heightForWidth( const QFont &font, int flags,
-        const QString &text, double width ) const;
+    virtual double heightForWidth( const QFont& font, int flags,
+        const QString& text, double width ) const QWT_OVERRIDE;
 
-    virtual QSizeF textSize( const QFont &font, int flags,
-        const QString &text ) const;
+    virtual QSizeF textSize( const QFont& font, int flags,
+        const QString& text ) const QWT_OVERRIDE;
 
-    virtual void draw( QPainter *painter, const QRectF &rect,
-        int flags, const QString &text ) const;
+    virtual void draw( QPainter*, const QRectF& rect,
+        int flags, const QString& text ) const QWT_OVERRIDE;
 
-    virtual bool mightRender( const QString & ) const;
+    virtual bool mightRender( const QString& ) const QWT_OVERRIDE;
 
-    virtual void textMargins( const QFont &, const QString &,
-        double &left, double &right, double &top, double &bottom ) const;
+    virtual void textMargins(
+        const QFont&, const QString&,
+        double& left, double& right,
+        double& top, double& bottom ) const QWT_OVERRIDE;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
@@ -140,30 +140,32 @@
 
 /*!
-  \brief A text engine for Qt rich texts
+   \brief A text engine for Qt rich texts
 
-  QwtRichTextEngine renders Qt rich texts using the classes
-  of the Scribe framework of Qt.
-*/
-class QWT_EXPORT QwtRichTextEngine: public QwtTextEngine
+   QwtRichTextEngine renders Qt rich texts using the classes
+   of the Scribe framework of Qt.
+ */
+class QWT_EXPORT QwtRichTextEngine : public QwtTextEngine
 {
-public:
+  public:
     QwtRichTextEngine();
 
-    virtual double heightForWidth( const QFont &font, int flags,
-        const QString &text, double width ) const;
+    virtual double heightForWidth( const QFont& font, int flags,
+        const QString& text, double width ) const QWT_OVERRIDE;
 
-    virtual QSizeF textSize( const QFont &font, int flags,
-        const QString &text ) const;
+    virtual QSizeF textSize( const QFont& font, int flags,
+        const QString& text ) const QWT_OVERRIDE;
 
-    virtual void draw( QPainter *painter, const QRectF &rect,
-        int flags, const QString &text ) const;
+    virtual void draw( QPainter*, const QRectF& rect,
+        int flags, const QString& text ) const QWT_OVERRIDE;
 
-    virtual bool mightRender( const QString & ) const;
+    virtual bool mightRender( const QString& ) const QWT_OVERRIDE;
 
-    virtual void textMargins( const QFont &, const QString &,
-        double &left, double &right, double &top, double &bottom ) const;
+    virtual void textMargins(
+        const QFont&, const QString&,
+        double& left, double& right,
+        double& top, double& bottom ) const QWT_OVERRIDE;
 
-private:
-    QString taggedText( const QString &, int flags ) const;
+  private:
+    QString taggedText( const QString&, int flags ) const;
 };
 
Index: /trunk/BNC/qwt/qwt_text_label.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_text_label.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_text_label.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,14 +11,18 @@
 #include "qwt_text.h"
 #include "qwt_painter.h"
+#include "qwt_math.h"
+
+#include <qstyle.h>
+#include <qstyleoption.h>
 #include <qpainter.h>
 #include <qevent.h>
-#include <qmath.h>
+#include <qmargins.h>
 
 class QwtTextLabel::PrivateData
 {
-public:
-    PrivateData():
-        indent( 4 ),
-        margin( 0 )
+  public:
+    PrivateData()
+        : indent( 4 )
+        , margin( 0 )
     {
     }
@@ -30,9 +34,9 @@
 
 /*!
-  Constructs an empty label.
-  \param parent Parent widget
-*/
-QwtTextLabel::QwtTextLabel( QWidget *parent ):
-    QFrame( parent )
+   Constructs an empty label.
+   \param parent Parent widget
+ */
+QwtTextLabel::QwtTextLabel( QWidget* parent )
+    : QFrame( parent )
 {
     init();
@@ -40,13 +44,13 @@
 
 /*!
-  Constructs a label that displays the text, text
-  \param parent Parent widget
-  \param text Text
-*/
-QwtTextLabel::QwtTextLabel( const QwtText &text, QWidget *parent ):
-    QFrame( parent )
+   Constructs a label that displays the text, text
+   \param parent Parent widget
+   \param text Text
+ */
+QwtTextLabel::QwtTextLabel( const QwtText& text, QWidget* parent )
+    : QFrame( parent )
 {
     init();
-    d_data->text = text;
+    m_data->text = text;
 }
 
@@ -54,10 +58,10 @@
 QwtTextLabel::~QwtTextLabel()
 {
-    delete d_data;
+    delete m_data;
 }
 
 void QwtTextLabel::init()
 {
-    d_data = new PrivateData();
+    m_data = new PrivateData();
     setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
 }
@@ -67,5 +71,5 @@
    \sa plainText()
  */
-void QwtTextLabel::setPlainText( const QString &text )
+void QwtTextLabel::setPlainText( const QString& text )
 {
     setText( QwtText( text ) );
@@ -80,5 +84,5 @@
 QString QwtTextLabel::plainText() const
 {
-    return d_data->text.text();
+    return m_data->text.text();
 }
 
@@ -88,10 +92,10 @@
    \param textFormat Format of text
 
-  \sa QwtText
-*/
-void QwtTextLabel::setText( const QString &text,
+   \sa QwtText
+ */
+void QwtTextLabel::setText( const QString& text,
     QwtText::TextFormat textFormat )
 {
-    d_data->text.setText( text, textFormat );
+    m_data->text.setText( text, textFormat );
 
     update();
@@ -102,8 +106,8 @@
    Change the label's text
    \param text New text
-*/
-void QwtTextLabel::setText( const QwtText &text )
-{
-    d_data->text = text;
+ */
+void QwtTextLabel::setText( const QwtText& text )
+{
+    m_data->text = text;
 
     update();
@@ -112,7 +116,7 @@
 
 //! Return the text
-const QwtText &QwtTextLabel::text() const
-{
-    return d_data->text;
+const QwtText& QwtTextLabel::text() const
+{
+    return m_data->text;
 }
 
@@ -120,5 +124,5 @@
 void QwtTextLabel::clear()
 {
-    d_data->text = QwtText();
+    m_data->text = QwtText();
 
     update();
@@ -129,11 +133,11 @@
 int QwtTextLabel::indent() const
 {
-    return d_data->indent;
-}
-
-/*!
-  Set label's text indent in pixels
-  \param indent Indentation in pixels
-*/
+    return m_data->indent;
+}
+
+/*!
+   Set label's text indent in pixels
+   \param indent Indentation in pixels
+ */
 void QwtTextLabel::setIndent( int indent )
 {
@@ -141,5 +145,5 @@
         indent = 0;
 
-    d_data->indent = indent;
+    m_data->indent = indent;
 
     update();
@@ -150,14 +154,14 @@
 int QwtTextLabel::margin() const
 {
-    return d_data->margin;
-}
-
-/*!
-  Set label's margin in pixels
-  \param margin Margin in pixels
-*/
+    return m_data->margin;
+}
+
+/*!
+   Set label's margin in pixels
+   \param margin Margin in pixels
+ */
 void QwtTextLabel::setMargin( int margin )
 {
-    d_data->margin = margin;
+    m_data->margin = margin;
 
     update();
@@ -174,10 +178,12 @@
 QSize QwtTextLabel::minimumSizeHint() const
 {
-    QSizeF sz = d_data->text.textSize( font() );
-
-    int mw = 2 * ( frameWidth() + d_data->margin );
-    int mh = mw;
-
-    int indent = d_data->indent;
+    QSizeF sz = m_data->text.textSize( font() );
+
+    const QMargins m = contentsMargins();
+
+    int mw = m.left() + m.right() + 2 * m_data->margin;
+    int mh = m.top() + m.bottom() + 2 * m_data->margin;
+
+    int indent = m_data->indent;
     if ( indent <= 0 )
         indent = defaultIndent();
@@ -185,14 +191,14 @@
     if ( indent > 0 )
     {
-        const int align = d_data->text.renderFlags();
+        const int align = m_data->text.renderFlags();
         if ( align & Qt::AlignLeft || align & Qt::AlignRight )
-            mw += d_data->indent;
+            mw += m_data->indent;
         else if ( align & Qt::AlignTop || align & Qt::AlignBottom )
-            mh += d_data->indent;
+            mh += m_data->indent;
     }
 
     sz += QSizeF( mw, mh );
 
-    return QSize( qCeil( sz.width() ), qCeil( sz.height() ) );
+    return QSize( qwtCeil( sz.width() ), qwtCeil( sz.height() ) );
 }
 
@@ -200,22 +206,24 @@
    \param width Width
    \return Preferred height for this widget, given the width.
-*/
+ */
 int QwtTextLabel::heightForWidth( int width ) const
 {
-    const int renderFlags = d_data->text.renderFlags();
-
-    int indent = d_data->indent;
+    const int renderFlags = m_data->text.renderFlags();
+
+    int indent = m_data->indent;
     if ( indent <= 0 )
         indent = defaultIndent();
 
-    width -= 2 * frameWidth();
+    const QMargins m = contentsMargins();
+
+    width -= m.left() + m.right() - 2 * m_data->margin;
     if ( renderFlags & Qt::AlignLeft || renderFlags & Qt::AlignRight )
         width -= indent;
 
-    int height = qCeil( d_data->text.heightForWidth( width, font() ) );
+    int height = qwtCeil( m_data->text.heightForWidth( width, font() ) );
     if ( ( renderFlags & Qt::AlignTop ) || ( renderFlags & Qt::AlignBottom ) )
         height += indent;
 
-    height += 2 * frameWidth();
+    height += m.top() + m.bottom() + 2 * m_data->margin;
 
     return height;
@@ -225,15 +233,18 @@
    Qt paint event
    \param event Paint event
-*/
-void QwtTextLabel::paintEvent( QPaintEvent *event )
+ */
+void QwtTextLabel::paintEvent( QPaintEvent* event )
 {
     QPainter painter( this );
+    painter.setClipRegion( event->region() );
+
+    QStyleOption opt;
+    opt.initFrom(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
 
     if ( !contentsRect().contains( event->rect() ) )
     {
-        painter.save();
         painter.setClipRegion( event->region() & frameRect() );
         drawFrame( &painter );
-        painter.restore();
     }
 
@@ -244,5 +255,5 @@
 
 //! Redraw the text and focus indicator
-void QwtTextLabel::drawContents( QPainter *painter )
+void QwtTextLabel::drawContents( QPainter* painter )
 {
     const QRect r = textRect();
@@ -266,26 +277,26 @@
 
 //! Redraw the text
-void QwtTextLabel::drawText( QPainter *painter, const QRectF &textRect )
-{
-    d_data->text.draw( painter, textRect );
-}
-
-/*!
-  Calculate geometry for the text in widget coordinates
-  \return Geometry for the text
-*/
+void QwtTextLabel::drawText( QPainter* painter, const QRectF& textRect )
+{
+    m_data->text.draw( painter, textRect );
+}
+
+/*!
+   Calculate geometry for the text in widget coordinates
+   \return Geometry for the text
+ */
 QRect QwtTextLabel::textRect() const
 {
     QRect r = contentsRect();
 
-    if ( !r.isEmpty() && d_data->margin > 0 )
-    {
-        r.setRect( r.x() + d_data->margin, r.y() + d_data->margin,
-            r.width() - 2 * d_data->margin, r.height() - 2 * d_data->margin );
+    if ( !r.isEmpty() && m_data->margin > 0 )
+    {
+        const int m = m_data->margin;
+        r.adjust( m, m, -m, -m );
     }
 
     if ( !r.isEmpty() )
     {
-        int indent = d_data->indent;
+        int indent = m_data->indent;
         if ( indent <= 0 )
             indent = defaultIndent();
@@ -293,14 +304,22 @@
         if ( indent > 0 )
         {
-            const int renderFlags = d_data->text.renderFlags();
+            const int renderFlags = m_data->text.renderFlags();
 
             if ( renderFlags & Qt::AlignLeft )
+            {
                 r.setX( r.x() + indent );
+            }
             else if ( renderFlags & Qt::AlignRight )
+            {
                 r.setWidth( r.width() - indent );
+            }
             else if ( renderFlags & Qt::AlignTop )
+            {
                 r.setY( r.y() + indent );
+            }
             else if ( renderFlags & Qt::AlignBottom )
+            {
                 r.setHeight( r.height() - indent );
+            }
         }
     }
@@ -315,10 +334,11 @@
 
     QFont fnt;
-    if ( d_data->text.testPaintAttribute( QwtText::PaintUsingTextFont ) )
-        fnt = d_data->text.font();
+    if ( m_data->text.testPaintAttribute( QwtText::PaintUsingTextFont ) )
+        fnt = m_data->text.font();
     else
         fnt = font();
 
-    return QFontMetrics( fnt ).width( 'x' ) / 2;
-}
-
+    return QwtPainter::horizontalAdvance( QFontMetrics( fnt ), 'x' ) / 2;
+}
+
+#include "moc_qwt_text_label.cpp"
Index: /trunk/BNC/qwt/qwt_text_label.h
===================================================================
--- /trunk/BNC/qwt/qwt_text_label.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_text_label.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,4 +13,5 @@
 #include "qwt_global.h"
 #include "qwt_text.h"
+
 #include <qframe.h>
 
@@ -21,5 +22,5 @@
 /*!
    \brief A Widget which displays a QwtText
-*/
+ */
 
 class QWT_EXPORT QwtTextLabel : public QFrame
@@ -31,21 +32,21 @@
     Q_PROPERTY( QString plainText READ plainText WRITE setPlainText )
 
-public:
-    explicit QwtTextLabel( QWidget *parent = NULL );
-    explicit QwtTextLabel( const QwtText &, QWidget *parent = NULL );
+  public:
+    explicit QwtTextLabel( QWidget* parent = NULL );
+    explicit QwtTextLabel( const QwtText&, QWidget* parent = NULL );
     virtual ~QwtTextLabel();
 
-    void setPlainText( const QString & );
+    void setPlainText( const QString& );
     QString plainText() const;
 
-public Q_SLOTS:
-    void setText( const QString &,
+  public Q_SLOTS:
+    void setText( const QString&,
         QwtText::TextFormat textFormat = QwtText::AutoText );
-    virtual void setText( const QwtText & );
+    virtual void setText( const QwtText& );
 
     void clear();
 
-public:
-    const QwtText &text() const;
+  public:
+    const QwtText& text() const;
 
     int indent() const;
@@ -55,22 +56,22 @@
     void setMargin( int );
 
-    virtual QSize sizeHint() const;
-    virtual QSize minimumSizeHint() const;
-    virtual int heightForWidth( int ) const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
+    virtual QSize minimumSizeHint() const QWT_OVERRIDE;
+    virtual int heightForWidth( int ) const QWT_OVERRIDE;
 
     QRect textRect() const;
 
-    virtual void drawText( QPainter *, const QRectF & );
+    virtual void drawText( QPainter*, const QRectF& );
 
-protected:
-    virtual void paintEvent( QPaintEvent * );
-    virtual void drawContents( QPainter * );
+  protected:
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
+    virtual void drawContents( QPainter* );
 
-private:
+  private:
     void init();
     int defaultIndent() const;
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_thermo.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_thermo.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_thermo.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,8 +9,9 @@
 
 #include "qwt_thermo.h"
-#include "qwt_scale_engine.h"
 #include "qwt_scale_draw.h"
 #include "qwt_scale_map.h"
 #include "qwt_color_map.h"
+#include "qwt_math.h"
+
 #include <qpainter.h>
 #include <qevent.h>
@@ -18,8 +19,11 @@
 #include <qstyle.h>
 #include <qstyleoption.h>
-#include <qmath.h>
-
-static inline void qwtDrawLine( QPainter *painter, int pos,
-    const QColor &color, const QRect &pipeRect, const QRect &liquidRect,
+#include <qmargins.h>
+
+#include <algorithm>
+#include <functional>
+
+static inline void qwtDrawLine( QPainter* painter, int pos,
+    const QColor& color, const QRect& pipeRect, const QRect& liquidRect,
     Qt::Orientation orientation )
 {
@@ -37,7 +41,7 @@
 }
 
-QVector<double> qwtTickList( const QwtScaleDiv &scaleDiv )
-{
-    QVector<double> values;
+static QVector< double > qwtTickList( const QwtScaleDiv& scaleDiv )
+{
+    QVector< double > values;
 
     double lowerLimit = scaleDiv.interval().minValue();
@@ -52,5 +56,5 @@
         tickType < QwtScaleDiv::NTickTypes; tickType++ )
     {
-        const QList<double> ticks = scaleDiv.ticks( tickType );
+        const QList< double > ticks = scaleDiv.ticks( tickType );
 
         for ( int i = 0; i < ticks.count(); i++ )
@@ -69,18 +73,18 @@
 class QwtThermo::PrivateData
 {
-public:
-    PrivateData():
-        orientation( Qt::Vertical ),
-        scalePosition( QwtThermo::TrailingScale ),
-        spacing( 3 ),
-        borderWidth( 2 ),
-        pipeWidth( 10 ),
-        alarmLevel( 0.0 ),
-        alarmEnabled( false ),
-        autoFillPipe( true ),
-        originMode( QwtThermo::OriginMinimum ),
-        origin( 0.0 ),
-        colorMap( NULL ),
-        value( 0.0 )
+  public:
+    PrivateData()
+        : orientation( Qt::Vertical )
+        , scalePosition( QwtThermo::TrailingScale )
+        , spacing( 3 )
+        , borderWidth( 2 )
+        , pipeWidth( 10 )
+        , alarmLevel( 0.0 )
+        , alarmEnabled( false )
+        , autoFillPipe( true )
+        , originMode( QwtThermo::OriginMinimum )
+        , origin( 0.0 )
+        , colorMap( NULL )
+        , value( 0.0 )
     {
         rangeFlags = QwtInterval::IncludeBorders;
@@ -106,5 +110,5 @@
     double origin;
 
-    QwtColorMap *colorMap;
+    QwtColorMap* colorMap;
 
     double value;
@@ -112,14 +116,14 @@
 
 /*!
-  Constructor
-  \param parent Parent widget
-*/
-QwtThermo::QwtThermo( QWidget *parent ):
-    QwtAbstractScale( parent )
-{
-    d_data = new PrivateData;
+   Constructor
+   \param parent Parent widget
+ */
+QwtThermo::QwtThermo( QWidget* parent )
+    : QwtAbstractScale( parent )
+{
+    m_data = new PrivateData;
 
     QSizePolicy policy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
-    if ( d_data->orientation == Qt::Vertical )
+    if ( m_data->orientation == Qt::Vertical )
         policy.transpose();
 
@@ -133,27 +137,27 @@
 QwtThermo::~QwtThermo()
 {
-    delete d_data;
-}
-
-/*!
-  \brief Exclude/Include min/max values
-
-  According to the flags minValue() and maxValue()
-  are included/excluded from the pipe. In case of an
-  excluded value the corresponding tick is painted
-  1 pixel off of the pipeRect().
-
-  F.e. when a minimum
-  of 0.0 has to be displayed as an empty pipe the minValue()
-  needs to be excluded.
-
-  \param flags Range flags
-  \sa rangeFlags()
-*/
+    delete m_data;
+}
+
+/*!
+   \brief Exclude/Include min/max values
+
+   According to the flags minValue() and maxValue()
+   are included/excluded from the pipe. In case of an
+   excluded value the corresponding tick is painted
+   1 pixel off of the pipeRect().
+
+   F.e. when a minimum
+   of 0.0 has to be displayed as an empty pipe the minValue()
+   needs to be excluded.
+
+   \param flags Range flags
+   \sa rangeFlags()
+ */
 void QwtThermo::setRangeFlags( QwtInterval::BorderFlags flags )
 {
-    if ( d_data->rangeFlags != flags )
-    {
-        d_data->rangeFlags = flags;
+    if ( m_data->rangeFlags != flags )
+    {
+        m_data->rangeFlags = flags;
         update();
     }
@@ -161,23 +165,23 @@
 
 /*!
-  \return Range flags
-  \sa setRangeFlags()
-*/
+   \return Range flags
+   \sa setRangeFlags()
+ */
 QwtInterval::BorderFlags QwtThermo::rangeFlags() const
 {
-    return d_data->rangeFlags;
-}
-
-/*!
-  Set the current value.
-
-  \param value New Value
-  \sa value()
-*/
+    return m_data->rangeFlags;
+}
+
+/*!
+   Set the current value.
+
+   \param value New Value
+   \sa value()
+ */
 void QwtThermo::setValue( double value )
 {
-    if ( d_data->value != value )
-    {
-        d_data->value = value;
+    if ( m_data->value != value )
+    {
+        m_data->value = value;
         update();
     }
@@ -187,19 +191,19 @@
 double QwtThermo::value() const
 {
-    return d_data->value;
-}
-
-/*!
-  \brief Set a scale draw
-
-  For changing the labels of the scales, it
-  is necessary to derive from QwtScaleDraw and
-  overload QwtScaleDraw::label().
-
-  \param scaleDraw ScaleDraw object, that has to be created with
+    return m_data->value;
+}
+
+/*!
+   \brief Set a scale draw
+
+   For changing the labels of the scales, it
+   is necessary to derive from QwtScaleDraw and
+   overload QwtScaleDraw::label().
+
+   \param scaleDraw ScaleDraw object, that has to be created with
                    new and will be deleted in ~QwtThermo() or the next
                    call of setScaleDraw().
-*/
-void QwtThermo::setScaleDraw( QwtScaleDraw *scaleDraw )
+ */
+void QwtThermo::setScaleDraw( QwtScaleDraw* scaleDraw )
 {
     setAbstractScaleDraw( scaleDraw );
@@ -210,8 +214,8 @@
    \return the scale draw of the thermo
    \sa setScaleDraw()
-*/
-const QwtScaleDraw *QwtThermo::scaleDraw() const
-{
-    return static_cast<const QwtScaleDraw *>( abstractScaleDraw() );
+ */
+const QwtScaleDraw* QwtThermo::scaleDraw() const
+{
+    return static_cast< const QwtScaleDraw* >( abstractScaleDraw() );
 }
 
@@ -219,15 +223,15 @@
    \return the scale draw of the thermo
    \sa setScaleDraw()
-*/
-QwtScaleDraw *QwtThermo::scaleDraw()
-{
-    return static_cast<QwtScaleDraw *>( abstractScaleDraw() );
-}
-
-/*!
-  Paint event handler
-  \param event Paint event
-*/
-void QwtThermo::paintEvent( QPaintEvent *event )
+ */
+QwtScaleDraw* QwtThermo::scaleDraw()
+{
+    return static_cast< QwtScaleDraw* >( abstractScaleDraw() );
+}
+
+/*!
+   Paint event handler
+   \param event Paint event
+ */
+void QwtThermo::paintEvent( QPaintEvent* event )
 {
     QPainter painter( this );
@@ -235,5 +239,5 @@
 
     QStyleOption opt;
-    opt.init(this);
+    opt.initFrom(this);
     style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
 
@@ -242,9 +246,9 @@
     if ( !tRect.contains( event->rect() ) )
     {
-        if ( d_data->scalePosition != QwtThermo::NoScale )
+        if ( m_data->scalePosition != QwtThermo::NoScale )
             scaleDraw()->draw( &painter, palette() );
     }
 
-    const int bw = d_data->borderWidth;
+    const int bw = m_data->borderWidth;
 
     const QBrush brush = palette().brush( QPalette::Base );
@@ -252,5 +256,5 @@
         tRect.adjusted( -bw, -bw, bw, bw ),
         palette(), true, bw,
-        d_data->autoFillPipe ? &brush : NULL );
+        m_data->autoFillPipe ? &brush : NULL );
 
     drawLiquid( &painter, tRect );
@@ -258,8 +262,8 @@
 
 /*!
-  Resize event handler
-  \param event Resize event
-*/
-void QwtThermo::resizeEvent( QResizeEvent *event )
+   Resize event handler
+   \param event Resize event
+ */
+void QwtThermo::resizeEvent( QResizeEvent* event )
 {
     Q_UNUSED( event );
@@ -268,8 +272,8 @@
 
 /*!
-  Qt change event handler
-  \param event Event
-*/
-void QwtThermo::changeEvent( QEvent *event )
+   Qt change event handler
+   \param event Event
+ */
+void QwtThermo::changeEvent( QEvent* event )
 {
     switch( event->type() )
@@ -287,24 +291,24 @@
 
 /*!
-  Recalculate the QwtThermo geometry and layout based on
-  pipeRect() and the fonts.
-
-  \param update_geometry notify the layout system and call update
+   Recalculate the QwtThermo geometry and layout based on
+   pipeRect() and the fonts.
+
+   \param update_geometry notify the layout system and call update
          to redraw the scale
-*/
+ */
 void QwtThermo::layoutThermo( bool update_geometry )
 {
     const QRect tRect = pipeRect();
-    const int bw = d_data->borderWidth + d_data->spacing;
+    const int bw = m_data->borderWidth + m_data->spacing;
     const bool inverted = ( upperBound() < lowerBound() );
 
     int from, to;
 
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         from = tRect.left();
         to = tRect.right();
 
-        if ( d_data->rangeFlags & QwtInterval::ExcludeMinimum )
+        if ( m_data->rangeFlags & QwtInterval::ExcludeMinimum )
         {
             if ( inverted )
@@ -313,5 +317,5 @@
                 from--;
         }
-        if ( d_data->rangeFlags & QwtInterval::ExcludeMaximum )
+        if ( m_data->rangeFlags & QwtInterval::ExcludeMaximum )
         {
             if ( inverted )
@@ -321,5 +325,5 @@
         }
 
-        if ( d_data->scalePosition == QwtThermo::TrailingScale )
+        if ( m_data->scalePosition == QwtThermo::TrailingScale )
         {
             scaleDraw()->setAlignment( QwtScaleDraw::TopScale );
@@ -339,5 +343,5 @@
         to = tRect.bottom();
 
-        if ( d_data->rangeFlags & QwtInterval::ExcludeMinimum )
+        if ( m_data->rangeFlags & QwtInterval::ExcludeMinimum )
         {
             if ( inverted )
@@ -346,5 +350,5 @@
                 to++;
         }
-        if ( d_data->rangeFlags & QwtInterval::ExcludeMaximum )
+        if ( m_data->rangeFlags & QwtInterval::ExcludeMaximum )
         {
             if ( inverted )
@@ -354,5 +358,5 @@
         }
 
-        if ( d_data->scalePosition == QwtThermo::LeadingScale )
+        if ( m_data->scalePosition == QwtThermo::LeadingScale )
         {
             scaleDraw()->setAlignment( QwtScaleDraw::RightScale );
@@ -376,11 +380,11 @@
 
 /*!
-  \return Bounding rectangle of the pipe ( without borders )
+   \return Bounding rectangle of the pipe ( without borders )
           in widget coordinates
-*/
+ */
 QRect QwtThermo::pipeRect() const
 {
     int mbd = 0;
-    if ( d_data->scalePosition != QwtThermo::NoScale )
+    if ( m_data->scalePosition != QwtThermo::NoScale )
     {
         int d1, d2;
@@ -388,5 +392,5 @@
         mbd = qMax( d1, d2 );
     }
-    const int bw = d_data->borderWidth;
+    const int bw = m_data->borderWidth;
     const int scaleOff = bw + mbd;
 
@@ -394,14 +398,14 @@
 
     QRect pipeRect = cr;
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         pipeRect.adjust( scaleOff, 0, -scaleOff, 0 );
 
-        if ( d_data->scalePosition == QwtThermo::TrailingScale )
-            pipeRect.setTop( cr.top() + cr.height() - bw - d_data->pipeWidth );
+        if ( m_data->scalePosition == QwtThermo::TrailingScale )
+            pipeRect.setTop( cr.top() + cr.height() - bw - m_data->pipeWidth );
         else
             pipeRect.setTop( bw );
 
-        pipeRect.setHeight( d_data->pipeWidth );
+        pipeRect.setHeight( m_data->pipeWidth );
     }
     else // Qt::Vertical
@@ -409,10 +413,10 @@
         pipeRect.adjust( 0, scaleOff, 0, -scaleOff );
 
-        if ( d_data->scalePosition == QwtThermo::LeadingScale )
+        if ( m_data->scalePosition == QwtThermo::LeadingScale )
             pipeRect.setLeft( bw );
         else
-            pipeRect.setLeft( cr.left() + cr.width() - bw - d_data->pipeWidth );
-
-        pipeRect.setWidth( d_data->pipeWidth );
+            pipeRect.setLeft( cr.left() + cr.width() - bw - m_data->pipeWidth );
+
+        pipeRect.setWidth( m_data->pipeWidth );
     }
 
@@ -421,15 +425,15 @@
 
 /*!
-  \brief Set the orientation.
-  \param orientation Allowed values are Qt::Horizontal and Qt::Vertical.
-
-  \sa orientation(), scalePosition()
-*/
+   \brief Set the orientation.
+   \param orientation Allowed values are Qt::Horizontal and Qt::Vertical.
+
+   \sa orientation(), scalePosition()
+ */
 void QwtThermo::setOrientation( Qt::Orientation orientation )
 {
-    if ( orientation == d_data->orientation )
+    if ( orientation == m_data->orientation )
         return;
 
-    d_data->orientation = orientation;
+    m_data->orientation = orientation;
 
     if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
@@ -446,73 +450,73 @@
 
 /*!
-  \return Orientation
-  \sa setOrientation()
-*/
+   \return Orientation
+   \sa setOrientation()
+ */
 Qt::Orientation QwtThermo::orientation() const
 {
-    return d_data->orientation;
-}
-
-/*!
-  \brief Change how the origin is determined.
-  \sa originMode(), serOrigin(), origin()
+    return m_data->orientation;
+}
+
+/*!
+   \brief Change how the origin is determined.
+   \sa originMode(), serOrigin(), origin()
  */
 void QwtThermo::setOriginMode( OriginMode m )
 {
-    if ( m == d_data->originMode )
+    if ( m == m_data->originMode )
         return;
 
-    d_data->originMode = m;
+    m_data->originMode = m;
     update();
 }
 
 /*!
-  \return Mode, how the origin is determined.
-  \sa setOriginMode(), serOrigin(), origin()
+   \return Mode, how the origin is determined.
+   \sa setOriginMode(), serOrigin(), origin()
  */
 QwtThermo::OriginMode QwtThermo::originMode() const
 {
-    return d_data->originMode;
-}
-
-/*!
-  \brief Specifies the custom origin.
-
-  If originMode is set to OriginCustom this property controls where the
-  liquid starts.
-
-  \param origin New origin level
-  \sa setOriginMode(), originMode(), origin()
+    return m_data->originMode;
+}
+
+/*!
+   \brief Specifies the custom origin.
+
+   If originMode is set to OriginCustom this property controls where the
+   liquid starts.
+
+   \param origin New origin level
+   \sa setOriginMode(), originMode(), origin()
  */
 void QwtThermo::setOrigin( double origin )
 {
-    if ( origin == d_data->origin )
+    if ( origin == m_data->origin )
         return;
 
-    d_data->origin = origin;
+    m_data->origin = origin;
     update();
 }
 
 /*!
-  \return Origin of the thermo, when OriginCustom is enabled
-  \sa setOrigin(), setOriginMode(), originMode()
+   \return Origin of the thermo, when OriginCustom is enabled
+   \sa setOrigin(), setOriginMode(), originMode()
  */
 double QwtThermo::origin() const
 {
-    return d_data->origin;
-}
-
-/*!
-  \brief Change the position of the scale
-  \param scalePosition Position of the scale.
-
-  \sa ScalePosition, scalePosition()
-*/
+    return m_data->origin;
+}
+
+/*!
+   \brief Change the position of the scale
+   \param scalePosition Position of the scale.
+
+   \sa ScalePosition, scalePosition()
+ */
 void QwtThermo::setScalePosition( ScalePosition scalePosition )
 {
-    if ( d_data->scalePosition == scalePosition )
+    if ( m_data->scalePosition == scalePosition )
         return;
 
-    d_data->scalePosition = scalePosition;
+    m_data->scalePosition = scalePosition;
 
     if ( testAttribute( Qt::WA_WState_Polished ) )
@@ -523,8 +527,8 @@
    \return Scale position.
    \sa setScalePosition()
-*/
+ */
 QwtThermo::ScalePosition QwtThermo::scalePosition() const
 {
-    return d_data->scalePosition;
+    return m_data->scalePosition;
 }
 
@@ -539,7 +543,7 @@
    \param painter Painter
    \param pipeRect Bounding rectangle of the pipe without borders
-*/
+ */
 void QwtThermo::drawLiquid(
-    QPainter *painter, const QRect &pipeRect ) const
+    QPainter* painter, const QRect& pipeRect ) const
 {
     painter->save();
@@ -551,5 +555,5 @@
     QRect liquidRect = fillRect( pipeRect );
 
-    if ( d_data->colorMap != NULL )
+    if ( m_data->colorMap != NULL )
     {
         const QwtInterval interval = scaleDiv().interval().normalized();
@@ -558,10 +562,10 @@
         // we calculate the colors for the rounded tick values
 
-        QVector<double> values = qwtTickList( scaleDraw()->scaleDiv() );
+        QVector< double > values = qwtTickList( scaleDraw()->scaleDiv() );
 
         if ( scaleMap.isInverting() )
-            qSort( values.begin(), values.end(), qGreater<double>() );
+            std::sort( values.begin(), values.end(), std::greater< double >() );
         else
-            qSort( values.begin(), values.end(), qLess<double>() );
+            std::sort( values.begin(), values.end(), std::less< double >() );
 
         int from;
@@ -570,6 +574,6 @@
             from = qRound( scaleMap.transform( values[0] ) );
             qwtDrawLine( painter, from,
-                d_data->colorMap->color( interval, values[0] ),
-                pipeRect, liquidRect, d_data->orientation );
+                m_data->colorMap->color( interval, values[0] ),
+                pipeRect, liquidRect, m_data->orientation );
         }
 
@@ -583,11 +587,11 @@
 
                 qwtDrawLine( painter, pos,
-                    d_data->colorMap->color( interval, v ),
-                    pipeRect, liquidRect, d_data->orientation );
+                    m_data->colorMap->color( interval, v ),
+                    pipeRect, liquidRect, m_data->orientation );
             }
 
             qwtDrawLine( painter, to,
-                d_data->colorMap->color( interval, values[i] ),
-                pipeRect, liquidRect, d_data->orientation );
+                m_data->colorMap->color( interval, values[i] ),
+                pipeRect, liquidRect, m_data->orientation );
 
             from = to;
@@ -596,5 +600,5 @@
     else
     {
-        if ( !liquidRect.isEmpty() && d_data->alarmEnabled )
+        if ( !liquidRect.isEmpty() && m_data->alarmEnabled )
         {
             const QRect r = alarmRect( liquidRect );
@@ -613,14 +617,14 @@
 
 /*!
-  \brief Change the spacing between pipe and scale
-
-  A spacing of 0 means, that the backbone of the scale is below
-  the pipe.
-
-  The default setting is 3 pixels.
-
-  \param spacing Number of pixels
-  \sa spacing();
-*/
+   \brief Change the spacing between pipe and scale
+
+   A spacing of 0 means, that the backbone of the scale is below
+   the pipe.
+
+   The default setting is 3 pixels.
+
+   \param spacing Number of pixels
+   \sa spacing();
+ */
 void QwtThermo::setSpacing( int spacing )
 {
@@ -628,7 +632,7 @@
         spacing = 0;
 
-    if ( spacing != d_data->spacing  )
-    {
-        d_data->spacing = spacing;
+    if ( spacing != m_data->spacing  )
+    {
+        m_data->spacing = spacing;
         layoutThermo( true );
     }
@@ -636,10 +640,10 @@
 
 /*!
-  \return Number of pixels between pipe and scale
-  \sa setSpacing()
-*/
+   \return Number of pixels between pipe and scale
+   \sa setSpacing()
+ */
 int QwtThermo::spacing() const
 {
-    return d_data->spacing;
+    return m_data->spacing;
 }
 
@@ -648,5 +652,5 @@
    \param width Border width
    \sa borderWidth()
-*/
+ */
 void QwtThermo::setBorderWidth( int width )
 {
@@ -654,7 +658,7 @@
         width = 0;
 
-    if ( width != d_data->borderWidth  )
-    {
-        d_data->borderWidth = width;
+    if ( width != m_data->borderWidth  )
+    {
+        m_data->borderWidth = width;
         layoutThermo( true );
     }
@@ -664,54 +668,54 @@
    \return Border width of the thermometer pipe.
    \sa setBorderWidth()
-*/
+ */
 int QwtThermo::borderWidth() const
 {
-    return d_data->borderWidth;
-}
-
-/*!
-  \brief Assign a color map for the fill color
-
-  \param colorMap Color map
-  \warning The alarm threshold has no effect, when
+    return m_data->borderWidth;
+}
+
+/*!
+   \brief Assign a color map for the fill color
+
+   \param colorMap Color map
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
-void QwtThermo::setColorMap( QwtColorMap *colorMap )
-{
-    if ( colorMap != d_data->colorMap )
-    {
-        delete d_data->colorMap;
-        d_data->colorMap = colorMap;
-    }
-}
-
-/*!
-  \return Color map for the fill color
-  \warning The alarm threshold has no effect, when
+ */
+void QwtThermo::setColorMap( QwtColorMap* colorMap )
+{
+    if ( colorMap != m_data->colorMap )
+    {
+        delete m_data->colorMap;
+        m_data->colorMap = colorMap;
+    }
+}
+
+/*!
+   \return Color map for the fill color
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
-QwtColorMap *QwtThermo::colorMap()
-{
-    return d_data->colorMap;
-}
-
-/*!
-  \return Color map for the fill color
-  \warning The alarm threshold has no effect, when
+ */
+QwtColorMap* QwtThermo::colorMap()
+{
+    return m_data->colorMap;
+}
+
+/*!
+   \return Color map for the fill color
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
-const QwtColorMap *QwtThermo::colorMap() const
-{
-    return d_data->colorMap;
-}
-
-/*!
-  \brief Change the brush of the liquid.
-
-  Changes the QPalette::ButtonText brush of the palette.
-
-  \param brush New brush.
-  \sa fillBrush(), QWidget::setPalette()
-*/
+ */
+const QwtColorMap* QwtThermo::colorMap() const
+{
+    return m_data->colorMap;
+}
+
+/*!
+   \brief Change the brush of the liquid.
+
+   Changes the QPalette::ButtonText brush of the palette.
+
+   \param brush New brush.
+   \sa fillBrush(), QWidget::setPalette()
+ */
 void QwtThermo::setFillBrush( const QBrush& brush )
 {
@@ -722,7 +726,7 @@
 
 /*!
-  \return Liquid ( QPalette::ButtonText ) brush.
-  \sa setFillBrush(), QWidget::palette()
-*/
+   \return Liquid ( QPalette::ButtonText ) brush.
+   \sa setFillBrush(), QWidget::palette()
+ */
 QBrush QwtThermo::fillBrush() const
 {
@@ -731,14 +735,14 @@
 
 /*!
-  \brief Specify the liquid brush above the alarm threshold
-
-  Changes the QPalette::Highlight brush of the palette.
-
-  \param brush New brush.
-  \sa alarmBrush(), QWidget::setPalette()
-
-  \warning The alarm threshold has no effect, when
+   \brief Specify the liquid brush above the alarm threshold
+
+   Changes the QPalette::Highlight brush of the palette.
+
+   \param brush New brush.
+   \sa alarmBrush(), QWidget::setPalette()
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 void QwtThermo::setAlarmBrush( const QBrush& brush )
 {
@@ -749,10 +753,10 @@
 
 /*!
-  \return Liquid brush ( QPalette::Highlight ) above the alarm threshold.
-  \sa setAlarmBrush(), QWidget::palette()
-
-  \warning The alarm threshold has no effect, when
+   \return Liquid brush ( QPalette::Highlight ) above the alarm threshold.
+   \sa setAlarmBrush(), QWidget::palette()
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 QBrush QwtThermo::alarmBrush() const
 {
@@ -761,42 +765,42 @@
 
 /*!
-  Specify the alarm threshold.
-
-  \param level Alarm threshold
-  \sa alarmLevel()
-
-  \warning The alarm threshold has no effect, when
+   Specify the alarm threshold.
+
+   \param level Alarm threshold
+   \sa alarmLevel()
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 void QwtThermo::setAlarmLevel( double level )
 {
-    d_data->alarmLevel = level;
-    d_data->alarmEnabled = 1;
+    m_data->alarmLevel = level;
+    m_data->alarmEnabled = 1;
     update();
 }
 
 /*!
-  \return Alarm threshold.
-  \sa setAlarmLevel()
-
-  \warning The alarm threshold has no effect, when
+   \return Alarm threshold.
+   \sa setAlarmLevel()
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 double QwtThermo::alarmLevel() const
 {
-    return d_data->alarmLevel;
-}
-
-/*!
-  Change the width of the pipe.
-
-  \param width Width of the pipe
-  \sa pipeWidth()
-*/
+    return m_data->alarmLevel;
+}
+
+/*!
+   Change the width of the pipe.
+
+   \param width Width of the pipe
+   \sa pipeWidth()
+ */
 void QwtThermo::setPipeWidth( int width )
 {
     if ( width > 0 )
     {
-        d_data->pipeWidth = width;
+        m_data->pipeWidth = width;
         layoutThermo( true );
     }
@@ -804,40 +808,40 @@
 
 /*!
-  \return Width of the pipe.
-  \sa setPipeWidth()
-*/
+   \return Width of the pipe.
+   \sa setPipeWidth()
+ */
 int QwtThermo::pipeWidth() const
 {
-    return d_data->pipeWidth;
-}
-
-/*!
-  \brief Enable or disable the alarm threshold
-  \param on true (disabled) or false (enabled)
-
-  \warning The alarm threshold has no effect, when
+    return m_data->pipeWidth;
+}
+
+/*!
+   \brief Enable or disable the alarm threshold
+   \param on true (disabled) or false (enabled)
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 void QwtThermo::setAlarmEnabled( bool on )
 {
-    d_data->alarmEnabled = on;
+    m_data->alarmEnabled = on;
     update();
 }
 
 /*!
-  \return True, when the alarm threshold is enabled.
-
-  \warning The alarm threshold has no effect, when
+   \return True, when the alarm threshold is enabled.
+
+   \warning The alarm threshold has no effect, when
            a color map has been assigned
-*/
+ */
 bool QwtThermo::alarmEnabled() const
 {
-    return d_data->alarmEnabled;
-}
-
-/*!
-  \return the minimum size hint
-  \sa minimumSizeHint()
-*/
+    return m_data->alarmEnabled;
+}
+
+/*!
+   \return the minimum size hint
+   \sa minimumSizeHint()
+ */
 QSize QwtThermo::sizeHint() const
 {
@@ -846,19 +850,19 @@
 
 /*!
-  \return Minimum size hint
-  \warning The return value depends on the font and the scale.
-  \sa sizeHint()
-*/
+   \return Minimum size hint
+   \warning The return value depends on the font and the scale.
+   \sa sizeHint()
+ */
 QSize QwtThermo::minimumSizeHint() const
 {
     int w = 0, h = 0;
 
-    if ( d_data->scalePosition != NoScale )
-    {
-        const int sdExtent = qCeil( scaleDraw()->extent( font() ) );
+    if ( m_data->scalePosition != NoScale )
+    {
+        const int sdExtent = qwtCeil( scaleDraw()->extent( font() ) );
         const int sdLength = scaleDraw()->minLength( font() );
 
         w = sdLength;
-        h = d_data->pipeWidth + sdExtent + d_data->spacing;
+        h = m_data->pipeWidth + sdExtent + m_data->spacing;
 
     }
@@ -866,18 +870,17 @@
     {
         w = 200;
-        h = d_data->pipeWidth;
-    }
-
-    if ( d_data->orientation == Qt::Vertical )
+        h = m_data->pipeWidth;
+    }
+
+    if ( m_data->orientation == Qt::Vertical )
         qSwap( w, h );
 
-    w += 2 * d_data->borderWidth;
-    h += 2 * d_data->borderWidth;
+    w += 2 * m_data->borderWidth;
+    h += 2 * m_data->borderWidth;
 
     // finally add the margins
-    int left, right, top, bottom;
-    getContentsMargins( &left, &top, &right, &bottom );
-    w += left + right;
-    h += top + bottom;
+    const QMargins m = contentsMargins();
+    w += m.left() + m.right();
+    h += m.top() + m.bottom();
 
     return QSize( w, h );
@@ -885,19 +888,19 @@
 
 /*!
-  \brief Calculate the filled rectangle of the pipe
-
-  \param pipeRect Rectangle of the pipe
-  \return Rectangle to be filled ( fill and alarm brush )
-
-  \sa pipeRect(), alarmRect()
- */
-QRect QwtThermo::fillRect( const QRect &pipeRect ) const
+   \brief Calculate the filled rectangle of the pipe
+
+   \param pipeRect Rectangle of the pipe
+   \return Rectangle to be filled ( fill and alarm brush )
+
+   \sa pipeRect(), alarmRect()
+ */
+QRect QwtThermo::fillRect( const QRect& pipeRect ) const
 {
     double origin;
-    if ( d_data->originMode == OriginMinimum )
+    if ( m_data->originMode == OriginMinimum )
     {
         origin = qMin( lowerBound(), upperBound() );
     }
-    else if ( d_data->originMode == OriginMaximum )
+    else if ( m_data->originMode == OriginMaximum )
     {
         origin = qMax( lowerBound(), upperBound() );
@@ -905,10 +908,10 @@
     else // OriginCustom
     {
-        origin = d_data->origin;
+        origin = m_data->origin;
     }
 
     const QwtScaleMap scaleMap = scaleDraw()->scaleMap();
 
-    int from = qRound( scaleMap.transform( d_data->value ) );
+    int from = qRound( scaleMap.transform( m_data->value ) );
     int to = qRound( scaleMap.transform( origin ) );
 
@@ -917,5 +920,5 @@
 
     QRect fillRect = pipeRect;
-    if ( d_data->orientation == Qt::Horizontal )
+    if ( m_data->orientation == Qt::Horizontal )
     {
         fillRect.setLeft( from );
@@ -932,16 +935,16 @@
 
 /*!
-  \brief Calculate the alarm rectangle of the pipe
-
-  \param fillRect Filled rectangle in the pipe
-  \return Rectangle to be filled with the alarm brush
-
-  \sa pipeRect(), fillRect(), alarmLevel(), alarmBrush()
- */
-QRect QwtThermo::alarmRect( const QRect &fillRect ) const
+   \brief Calculate the alarm rectangle of the pipe
+
+   \param fillRect Filled rectangle in the pipe
+   \return Rectangle to be filled with the alarm brush
+
+   \sa pipeRect(), fillRect(), alarmLevel(), alarmBrush()
+ */
+QRect QwtThermo::alarmRect( const QRect& fillRect ) const
 {
     QRect alarmRect( 0, 0, -1, -1); // something invalid
 
-    if ( !d_data->alarmEnabled )
+    if ( !m_data->alarmEnabled )
         return alarmRect;
 
@@ -949,18 +952,18 @@
 
     bool increasing;
-    if ( d_data->originMode == OriginCustom )
-    {
-        increasing = d_data->value > d_data->origin;
+    if ( m_data->originMode == OriginCustom )
+    {
+        increasing = m_data->value > m_data->origin;
     }
     else
     {
-        increasing = d_data->originMode == OriginMinimum;
+        increasing = m_data->originMode == OriginMinimum;
     }
 
     const QwtScaleMap map = scaleDraw()->scaleMap();
-    const int alarmPos = qRound( map.transform( d_data->alarmLevel ) );
-    const int valuePos = qRound( map.transform( d_data->value ) );
-
-    if ( d_data->orientation == Qt::Horizontal )
+    const int alarmPos = qRound( map.transform( m_data->alarmLevel ) );
+    const int valuePos = qRound( map.transform( m_data->value ) );
+
+    if ( m_data->orientation == Qt::Horizontal )
     {
         int v1, v2;
@@ -1004,2 +1007,4 @@
     return alarmRect;
 }
+
+#include "moc_qwt_thermo.cpp"
Index: /trunk/BNC/qwt/qwt_thermo.h
===================================================================
--- /trunk/BNC/qwt/qwt_thermo.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_thermo.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -19,30 +19,30 @@
 
 /*!
-  \brief The Thermometer Widget
+   \brief The Thermometer Widget
 
-  QwtThermo is a widget which displays a value in an interval. It supports:
-  - a horizontal or vertical layout;
-  - a range;
-  - a scale;
-  - an alarm level.
+   QwtThermo is a widget which displays a value in an interval. It supports:
+   - a horizontal or vertical layout;
+   - a range;
+   - a scale;
+   - an alarm level.
 
-  \image html sysinfo.png
+   \image html sysinfo.png
 
-  The fill colors might be calculated from an optional color map
-  If no color map has been assigned QwtThermo uses the
-  following colors/brushes from the widget palette:
+   The fill colors might be calculated from an optional color map
+   If no color map has been assigned QwtThermo uses the
+   following colors/brushes from the widget palette:
 
-  - QPalette::Base
+   - QPalette::Base
     Background of the pipe
-  - QPalette::ButtonText
+   - QPalette::ButtonText
     Fill brush below the alarm level
-  - QPalette::Highlight
+   - QPalette::Highlight
     Fill brush for the values above the alarm level
-  - QPalette::WindowText
+   - QPalette::WindowText
     For the axis of the scale
-  - QPalette::Text
+   - QPalette::Text
     For the labels of the scale
-*/
-class QWT_EXPORT QwtThermo: public QwtAbstractScale
+ */
+class QWT_EXPORT QwtThermo : public QwtAbstractScale
 {
     Q_OBJECT
@@ -63,11 +63,11 @@
     Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
     Q_PROPERTY( int pipeWidth READ pipeWidth WRITE setPipeWidth )
-    Q_PROPERTY( double value READ value WRITE setValue )
+    Q_PROPERTY( double value READ value WRITE setValue USER true )
 
-public:
+  public:
 
     /*!
-      Position of the scale
-      \sa setScalePosition(), setOrientation()
+       Position of the scale
+       \sa setScalePosition(), setOrientation()
      */
     enum ScalePosition
@@ -84,9 +84,9 @@
 
     /*!
-      Origin mode. This property specifies where the beginning of the liquid
-      is placed.
+       Origin mode. This property specifies where the beginning of the liquid
+       is placed.
 
-      \sa setOriginMode(), setOrigin()
-    */
+       \sa setOriginMode(), setOrigin()
+     */
     enum OriginMode
     {
@@ -101,5 +101,5 @@
     };
 
-    explicit QwtThermo( QWidget *parent = NULL );
+    explicit QwtThermo( QWidget* parent = NULL );
     virtual ~QwtThermo();
 
@@ -122,8 +122,8 @@
     double origin() const;
 
-    void setFillBrush( const QBrush & );
+    void setFillBrush( const QBrush& );
     QBrush fillBrush() const;
 
-    void setAlarmBrush( const QBrush & );
+    void setAlarmBrush( const QBrush& );
     QBrush alarmBrush() const;
 
@@ -134,7 +134,7 @@
     bool alarmEnabled() const;
 
-    void setColorMap( QwtColorMap * );
-    QwtColorMap *colorMap();
-    const QwtColorMap *colorMap() const;
+    void setColorMap( QwtColorMap* );
+    QwtColorMap* colorMap();
+    const QwtColorMap* colorMap() const;
 
     void setPipeWidth( int );
@@ -146,32 +146,32 @@
     double value() const;
 
-    virtual QSize sizeHint() const;
-    virtual QSize minimumSizeHint() const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
+    virtual QSize minimumSizeHint() const QWT_OVERRIDE;
 
-    void setScaleDraw( QwtScaleDraw * );
-    const QwtScaleDraw *scaleDraw() const;
+    void setScaleDraw( QwtScaleDraw* );
+    const QwtScaleDraw* scaleDraw() const;
 
-public Q_SLOTS:
+  public Q_SLOTS:
     virtual void setValue( double );
 
-protected:
-    virtual void drawLiquid( QPainter *, const QRect & ) const;
-    virtual void scaleChange();
+  protected:
+    virtual void drawLiquid( QPainter*, const QRect& ) const;
+    virtual void scaleChange() QWT_OVERRIDE;
 
-    virtual void paintEvent( QPaintEvent * );
-    virtual void resizeEvent( QResizeEvent * );
-    virtual void changeEvent( QEvent * );
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
+    virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
+    virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
 
-    QwtScaleDraw *scaleDraw();
+    QwtScaleDraw* scaleDraw();
 
     QRect pipeRect() const;
-    QRect fillRect( const QRect & ) const;
-    QRect alarmRect( const QRect & ) const;
+    QRect fillRect( const QRect& ) const;
+    QRect alarmRect( const QRect& ) const;
 
-private:
+  private:
     void layoutThermo( bool );
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_transform.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_transform.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_transform.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,10 +11,4 @@
 #include "qwt_math.h"
 
-#if QT_VERSION < 0x040601
-#define qExp(x) ::exp(x)
-#endif
-
-#if QT_VERSION >= 0x050400
-
 //! Smallest allowed value for logarithmic scales: 1.0e-150
 const double QwtLogTransform::LogMin = 1.0e-150;
@@ -22,14 +16,4 @@
 //! Largest allowed value for logarithmic scales: 1.0e150
 const double QwtLogTransform::LogMax = 1.0e150;
-
-#else
-
-//! Smallest allowed value for logarithmic scales: 1.0e-150
-QT_STATIC_CONST_IMPL double QwtLogTransform::LogMin = 1.0e-150;
-
-//! Largest allowed value for logarithmic scales: 1.0e150
-QT_STATIC_CONST_IMPL double QwtLogTransform::LogMax = 1.0e150;
-
-#endif
 
 //! Constructor
@@ -44,6 +28,6 @@
 
 /*!
-  \param value Value to be bounded
-  \return value unmodified
+   \param value Value to be bounded
+   \return value unmodified
  */
 double QwtTransform::bounded( double value ) const
@@ -64,6 +48,6 @@
 
 /*!
-  \param value Value to be transformed
-  \return value unmodified
+   \param value Value to be transformed
+   \return value unmodified
  */
 double QwtNullTransform::transform( double value ) const
@@ -73,6 +57,6 @@
 
 /*!
-  \param value Value to be transformed
-  \return value unmodified
+   \param value Value to be transformed
+   \return value unmodified
  */
 double QwtNullTransform::invTransform( double value ) const
@@ -82,5 +66,5 @@
 
 //! \return Clone of the transformation
-QwtTransform *QwtNullTransform::copy() const
+QwtTransform* QwtNullTransform::copy() const
 {
     return new QwtNullTransform();
@@ -99,24 +83,24 @@
 
 /*!
-  \param value Value to be transformed
-  \return log( value )
+   \param value Value to be transformed
+   \return log( value )
  */
 double QwtLogTransform::transform( double value ) const
 {
-    return ::log( value );
+    return std::log( value );
 }
 
 /*!
-  \param value Value to be transformed
-  \return exp( value )
+   \param value Value to be transformed
+   \return exp( value )
  */
 double QwtLogTransform::invTransform( double value ) const
 {
-    return qExp( value );
+    return std::exp( value );
 }
 
 /*!
-  \param value Value to be bounded
-  \return qBound( LogMin, value, LogMax )
+   \param value Value to be bounded
+   \return qBound( LogMin, value, LogMax )
  */
 double QwtLogTransform::bounded( double value ) const
@@ -126,5 +110,5 @@
 
 //! \return Clone of the transformation
-QwtTransform *QwtLogTransform::copy() const
+QwtTransform* QwtLogTransform::copy() const
 {
     return new QwtLogTransform();
@@ -132,10 +116,10 @@
 
 /*!
-  Constructor
-  \param exponent Exponent
-*/
+   Constructor
+   \param exponent Exponent
+ */
 QwtPowerTransform::QwtPowerTransform( double exponent ):
     QwtTransform(),
-    d_exponent( exponent )
+    m_exponent( exponent )
 {
 }
@@ -147,31 +131,31 @@
 
 /*!
-  \param value Value to be transformed
-  \return Exponentiation preserving the sign
+   \param value Value to be transformed
+   \return Exponentiation preserving the sign
  */
 double QwtPowerTransform::transform( double value ) const
 {
     if ( value < 0.0 )
-        return -qPow( -value, 1.0 / d_exponent );
+        return -std::pow( -value, 1.0 / m_exponent );
     else
-        return qPow( value, 1.0 / d_exponent );
+        return std::pow( value, 1.0 / m_exponent );
 
 }
 
 /*!
-  \param value Value to be transformed
-  \return Inverse exponentiation preserving the sign
+   \param value Value to be transformed
+   \return Inverse exponentiation preserving the sign
  */
 double QwtPowerTransform::invTransform( double value ) const
 {
     if ( value < 0.0 )
-        return -qPow( -value, d_exponent );
+        return -std::pow( -value, m_exponent );
     else
-        return qPow( value, d_exponent );
+        return std::pow( value, m_exponent );
 }
 
 //! \return Clone of the transformation
-QwtTransform *QwtPowerTransform::copy() const
+QwtTransform* QwtPowerTransform::copy() const
 {
-    return new QwtPowerTransform( d_exponent );
+    return new QwtPowerTransform( m_exponent );
 }
Index: /trunk/BNC/qwt/qwt_transform.h
===================================================================
--- /trunk/BNC/qwt/qwt_transform.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_transform.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -32,8 +32,8 @@
    - p = p1 + ( p2 - p1 ) * ( T( s ) - T( s1 ) / ( T( s2 ) - T( s1 ) );
    - s = invT ( T( s1 ) + ( T( s2 ) - T( s1 ) ) * ( p - p1 ) / ( p2 - p1 ) );
-*/
+ */
 class QWT_EXPORT QwtTransform
 {
-public:
+  public:
     QwtTransform();
     virtual ~QwtTransform();
@@ -66,5 +66,8 @@
 
     //! Virtualized copy operation
-    virtual QwtTransform *copy() const = 0;
+    virtual QwtTransform* copy() const = 0;
+
+  private:
+    Q_DISABLE_COPY(QwtTransform)
 };
 
@@ -75,14 +78,14 @@
 
  */
-class QWT_EXPORT QwtNullTransform: public QwtTransform
+class QWT_EXPORT QwtNullTransform : public QwtTransform
 {
-public:
+  public:
     QwtNullTransform();
     virtual ~QwtNullTransform();
 
-    virtual double transform( double value ) const;
-    virtual double invTransform( double value ) const;
+    virtual double transform( double value ) const QWT_OVERRIDE;
+    virtual double invTransform( double value ) const QWT_OVERRIDE;
 
-    virtual QwtTransform *copy() const;
+    virtual QwtTransform* copy() const QWT_OVERRIDE;
 };
 /*!
@@ -95,24 +98,19 @@
          for log2(), log10() or any other logarithmic scale.
  */
-class QWT_EXPORT QwtLogTransform: public QwtTransform
+class QWT_EXPORT QwtLogTransform : public QwtTransform
 {
-public:
+  public:
     QwtLogTransform();
     virtual ~QwtLogTransform();
 
-    virtual double transform( double value ) const;
-    virtual double invTransform( double value ) const;
+    virtual double transform( double value ) const QWT_OVERRIDE;
+    virtual double invTransform( double value ) const QWT_OVERRIDE;
 
-    virtual double bounded( double value ) const;
+    virtual double bounded( double value ) const QWT_OVERRIDE;
 
-    virtual QwtTransform *copy() const;
+    virtual QwtTransform* copy() const QWT_OVERRIDE;
 
-#if QT_VERSION >= 0x050400
     static const double LogMin;
     static const double LogMax;
-#else
-    QT_STATIC_CONST double LogMin;
-    QT_STATIC_CONST double LogMax;
-#endif
 };
 
@@ -125,17 +123,17 @@
    can be used for scales including negative values.
  */
-class QWT_EXPORT QwtPowerTransform: public QwtTransform
+class QWT_EXPORT QwtPowerTransform : public QwtTransform
 {
-public:
-    QwtPowerTransform( double exponent );
+  public:
+    explicit QwtPowerTransform( double exponent );
     virtual ~QwtPowerTransform();
 
-    virtual double transform( double value ) const;
-    virtual double invTransform( double value ) const;
+    virtual double transform( double value ) const QWT_OVERRIDE;
+    virtual double invTransform( double value ) const QWT_OVERRIDE;
 
-    virtual QwtTransform *copy() const;
+    virtual QwtTransform* copy() const QWT_OVERRIDE;
 
-private:
-    const double d_exponent;
+  private:
+    const double m_exponent;
 };
 
Index: /trunk/BNC/qwt/qwt_vectorfield_symbol.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_vectorfield_symbol.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_vectorfield_symbol.cpp	(revision 11158)
@@ -0,0 +1,160 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_vectorfield_symbol.h"
+
+#include <qpainter.h>
+#include <qpainterpath.h>
+
+//! Constructor
+QwtVectorFieldSymbol::QwtVectorFieldSymbol()
+{
+}
+
+//! Destructor
+QwtVectorFieldSymbol::~QwtVectorFieldSymbol()
+{
+}
+
+class QwtVectorFieldArrow::PrivateData
+{
+  public:
+    PrivateData( qreal headW, qreal tailW )
+        : headWidth( headW )
+        , tailWidth( tailW )
+        , length( headW + 4.0 )
+    {
+        /*
+            Arrow is drawn horizontally, pointing into positive x direction
+            with tip at 0,0.
+         */
+
+        path.lineTo( -headWidth, headWidth );
+        path.lineTo( -headWidth, tailWidth );
+        path.lineTo( -length, tailWidth );
+        path.lineTo( -length, -tailWidth );
+        path.lineTo( -headWidth, -tailWidth );
+        path.lineTo( -headWidth, -headWidth );
+
+        path.closeSubpath();
+    }
+
+    void setLength( qreal l )
+    {
+        length = qMax( l, headWidth );
+
+        path.setElementPositionAt( 3, -length, tailWidth );
+        path.setElementPositionAt( 4, -length, -tailWidth );
+    }
+
+    const qreal headWidth;
+    const qreal tailWidth;
+    qreal length;
+
+    QPainterPath path;
+
+};
+
+/*!
+    \brief Constructor
+
+    The length is initialized by headWidth + 4
+
+    \param headWidth Width of the triangular head
+    \param tailWidth Width of the arrow tail
+
+    \sa setLength()
+ */
+QwtVectorFieldArrow::QwtVectorFieldArrow( qreal headWidth, qreal tailWidth )
+{
+    m_data = new PrivateData( headWidth, tailWidth );
+}
+
+//! Destructor
+QwtVectorFieldArrow::~QwtVectorFieldArrow()
+{
+    delete m_data;
+}
+
+void QwtVectorFieldArrow::setLength( qreal length )
+{
+    m_data->setLength( length );
+}
+
+qreal QwtVectorFieldArrow::length() const
+{
+    return m_data->length;
+}
+
+void QwtVectorFieldArrow::paint( QPainter* painter ) const
+{
+    painter->drawPath( m_data->path );
+}
+
+class QwtVectorFieldThinArrow::PrivateData
+{
+  public:
+    PrivateData( qreal headW )
+        : headWidth( headW )
+        , length( headW + 4.0 )
+    {
+        path.lineTo( -headWidth, headWidth * 0.6 );
+        path.moveTo( 0, 0 );
+        path.lineTo( -headWidth, -headWidth * 0.6 );
+        path.moveTo( 0, 0 );
+        path.lineTo( -length, 0 );
+    }
+
+    const qreal headWidth;
+    qreal length;
+
+    QPainterPath path;
+};
+
+/*!
+    \brief Constructor
+
+    The length is initialized by headWidth + 4
+
+    \param headWidth Width of the triangular head
+    \sa setLength()
+ */
+QwtVectorFieldThinArrow::QwtVectorFieldThinArrow( qreal headWidth )
+{
+    m_data = new PrivateData( headWidth );
+}
+
+//! \brief Destructor
+QwtVectorFieldThinArrow::~QwtVectorFieldThinArrow()
+{
+    delete m_data;
+}
+
+void QwtVectorFieldThinArrow::setLength( qreal length )
+{
+    m_data->length = length;
+
+    const qreal headWidth = qMin( m_data->headWidth, length / 3.0 );
+
+    QPainterPath& path = m_data->path;
+
+    path.setElementPositionAt( 1, -headWidth, headWidth * 0.6 );
+    path.setElementPositionAt( 3, -headWidth, -headWidth * 0.6 );
+    path.setElementPositionAt( 5, -length, 0 );
+}
+
+qreal QwtVectorFieldThinArrow::length() const
+{
+    return m_data->length;
+}
+
+void QwtVectorFieldThinArrow::paint(QPainter* p) const
+{
+    p->drawPath( m_data->path );
+}
Index: /trunk/BNC/qwt/qwt_vectorfield_symbol.h
===================================================================
--- /trunk/BNC/qwt/qwt_vectorfield_symbol.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_vectorfield_symbol.h	(revision 11158)
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_VECTOR_FIELD_SYMBOL_H
+#define QWT_VECTOR_FIELD_SYMBOL_H
+
+#include "qwt_global.h"
+
+class QPainter;
+class QPainterPath;
+
+/*!
+    Defines abstract interface for arrow drawing routines.
+
+    Arrow needs to be drawn horizontally with arrow tip at coordinate 0,0.
+    arrowLength() shall return the entire length of the arrow (needed
+    to translate the arrow for tail/centered alignment).
+    setArrowLength() defines arror length in pixels (screen coordinates). It
+    can be implemented to adjust other geometric properties such as
+    the head size and width of the arrow. It is _always_ called before
+    paint().
+
+    A new arrow implementation can be set with QwtPlotVectorField::setArrowSymbol(), whereby
+    ownership is transferred to the plot field.
+ */
+class QWT_EXPORT QwtVectorFieldSymbol
+{
+  public:
+    QwtVectorFieldSymbol();
+    virtual ~QwtVectorFieldSymbol();
+
+    /*!
+        Set the length of the symbol/arrow
+        \sa length()
+     */
+    virtual void setLength( qreal length ) = 0;
+
+    /*!
+        \return length of the symbol/arrow
+        \sa setLength()
+     */
+    virtual qreal length() const = 0;
+
+    //! Draw the symbol/arrow
+    virtual void paint( QPainter* ) const = 0;
+
+  private:
+    Q_DISABLE_COPY(QwtVectorFieldSymbol)
+};
+
+/*!
+    Arrow implementation that draws a filled arrow with outline, using
+    a triangular head of constant width.
+ */
+class QWT_EXPORT QwtVectorFieldArrow : public QwtVectorFieldSymbol
+{
+  public:
+    QwtVectorFieldArrow( qreal headWidth = 6.0, qreal tailWidth = 1.0 );
+    virtual ~QwtVectorFieldArrow() QWT_OVERRIDE;
+
+    virtual void setLength( qreal length ) QWT_OVERRIDE;
+    virtual qreal length() const QWT_OVERRIDE;
+
+    virtual void paint( QPainter* ) const QWT_OVERRIDE;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+/*!
+    Arrow implementation that only used lines, with optionally a filled arrow or only
+    lines.
+ */
+class QWT_EXPORT QwtVectorFieldThinArrow : public QwtVectorFieldSymbol
+{
+  public:
+    QwtVectorFieldThinArrow( qreal headWidth = 6.0 );
+    virtual ~QwtVectorFieldThinArrow() QWT_OVERRIDE;
+
+    virtual void setLength( qreal length ) QWT_OVERRIDE;
+    virtual qreal length() const QWT_OVERRIDE;
+
+    virtual void paint( QPainter* ) const QWT_OVERRIDE;
+
+  private:
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_weeding_curve_fitter.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_weeding_curve_fitter.cpp	(revision 11158)
+++ /trunk/BNC/qwt/qwt_weeding_curve_fitter.cpp	(revision 11158)
@@ -0,0 +1,241 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#include "qwt_weeding_curve_fitter.h"
+#include "qwt_math.h"
+
+#include <qpainterpath.h>
+#include <qpolygon.h>
+#include <qstack.h>
+#include <qvector.h>
+
+class QwtWeedingCurveFitter::PrivateData
+{
+  public:
+    PrivateData()
+        : tolerance( 1.0 )
+        , chunkSize( 0 )
+    {
+    }
+
+    double tolerance;
+    uint chunkSize;
+};
+
+class QwtWeedingCurveFitter::Line
+{
+  public:
+    Line( int i1 = 0, int i2 = 0 )
+        : from( i1 )
+        , to( i2 )
+    {
+    }
+
+    int from;
+    int to;
+};
+
+/*!
+   Constructor
+
+   \param tolerance Tolerance
+   \sa setTolerance(), tolerance()
+ */
+QwtWeedingCurveFitter::QwtWeedingCurveFitter( double tolerance )
+    : QwtCurveFitter( QwtCurveFitter::Polygon )
+{
+    m_data = new PrivateData;
+    setTolerance( tolerance );
+}
+
+//! Destructor
+QwtWeedingCurveFitter::~QwtWeedingCurveFitter()
+{
+    delete m_data;
+}
+
+/*!
+   Assign the tolerance
+
+   The tolerance is the maximum distance, that is acceptable
+   between the original curve and the smoothed curve.
+
+   Increasing the tolerance will reduce the number of the
+   resulting points.
+
+   \param tolerance Tolerance
+
+   \sa tolerance()
+ */
+void QwtWeedingCurveFitter::setTolerance( double tolerance )
+{
+    m_data->tolerance = qwtMaxF( tolerance, 0.0 );
+}
+
+/*!
+   \return Tolerance
+   \sa setTolerance()
+ */
+double QwtWeedingCurveFitter::tolerance() const
+{
+    return m_data->tolerance;
+}
+
+/*!
+   Limit the number of points passed to a run of the algorithm
+
+   The runtime of the Douglas Peucker algorithm increases non linear
+   with the number of points. For a chunk size > 0 the polygon
+   is split into pieces passed to the algorithm one by one.
+
+   \param numPoints Maximum for the number of points passed to the algorithm
+
+   \sa chunkSize()
+ */
+void QwtWeedingCurveFitter::setChunkSize( uint numPoints )
+{
+    if ( numPoints > 0 )
+        numPoints = qMax( numPoints, 3U );
+
+    m_data->chunkSize = numPoints;
+}
+
+/*!
+   \return Maximum for the number of points passed to a run
+          of the algorithm - or 0, when unlimited
+   \sa setChunkSize()
+ */
+uint QwtWeedingCurveFitter::chunkSize() const
+{
+    return m_data->chunkSize;
+}
+
+/*!
+   \param points Series of data points
+   \return Curve points
+   \sa fitCurvePath()
+ */
+QPolygonF QwtWeedingCurveFitter::fitCurve( const QPolygonF& points ) const
+{
+    if ( points.isEmpty() )
+        return points;
+
+    QPolygonF fittedPoints;
+    if ( m_data->chunkSize == 0 )
+    {
+        fittedPoints = simplify( points );
+    }
+    else
+    {
+        for ( int i = 0; i < points.size(); i += m_data->chunkSize )
+        {
+            const QPolygonF p = points.mid( i, m_data->chunkSize );
+            fittedPoints += simplify( p );
+        }
+    }
+
+    return fittedPoints;
+}
+
+/*!
+   \param points Series of data points
+   \return Curve path
+   \sa fitCurve()
+ */
+QPainterPath QwtWeedingCurveFitter::fitCurvePath( const QPolygonF& points ) const
+{
+    QPainterPath path;
+    path.addPolygon( fitCurve( points ) );
+    return path;
+}
+
+QPolygonF QwtWeedingCurveFitter::simplify( const QPolygonF& points ) const
+{
+    const double toleranceSqr = m_data->tolerance * m_data->tolerance;
+
+    QStack< Line > stack;
+    stack.reserve( 500 );
+
+    const QPointF* p = points.data();
+    const int nPoints = points.size();
+
+    QVector< bool > usePoint( nPoints, false );
+
+    stack.push( Line( 0, nPoints - 1 ) );
+
+    while ( !stack.isEmpty() )
+    {
+        const Line r = stack.pop();
+
+        // initialize line segment
+        const double vecX = p[r.to].x() - p[r.from].x();
+        const double vecY = p[r.to].y() - p[r.from].y();
+
+        const double vecLength = std::sqrt( vecX * vecX + vecY * vecY );
+
+        const double unitVecX = ( vecLength != 0.0 ) ? vecX / vecLength : 0.0;
+        const double unitVecY = ( vecLength != 0.0 ) ? vecY / vecLength : 0.0;
+
+        double maxDistSqr = 0.0;
+        int nVertexIndexMaxDistance = r.from + 1;
+        for ( int i = r.from + 1; i < r.to; i++ )
+        {
+            //compare to anchor
+            const double fromVecX = p[i].x() - p[r.from].x();
+            const double fromVecY = p[i].y() - p[r.from].y();
+
+            double distToSegmentSqr;
+            if ( fromVecX * unitVecX + fromVecY * unitVecY < 0.0 )
+            {
+                distToSegmentSqr = fromVecX * fromVecX + fromVecY * fromVecY;
+            }
+            else
+            {
+                const double toVecX = p[i].x() - p[r.to].x();
+                const double toVecY = p[i].y() - p[r.to].y();
+                const double toVecLength = toVecX * toVecX + toVecY * toVecY;
+
+                const double s = toVecX * ( -unitVecX ) + toVecY * ( -unitVecY );
+                if ( s < 0.0 )
+                {
+                    distToSegmentSqr = toVecLength;
+                }
+                else
+                {
+                    distToSegmentSqr = std::fabs( toVecLength - s * s );
+                }
+            }
+
+            if ( maxDistSqr < distToSegmentSqr )
+            {
+                maxDistSqr = distToSegmentSqr;
+                nVertexIndexMaxDistance = i;
+            }
+        }
+        if ( maxDistSqr <= toleranceSqr )
+        {
+            usePoint[r.from] = true;
+            usePoint[r.to] = true;
+        }
+        else
+        {
+            stack.push( Line( r.from, nVertexIndexMaxDistance ) );
+            stack.push( Line( nVertexIndexMaxDistance, r.to ) );
+        }
+    }
+
+    QPolygonF stripped;
+    for ( int i = 0; i < nPoints; i++ )
+    {
+        if ( usePoint[i] )
+            stripped += p[i];
+    }
+
+    return stripped;
+}
Index: /trunk/BNC/qwt/qwt_weeding_curve_fitter.h
===================================================================
--- /trunk/BNC/qwt/qwt_weeding_curve_fitter.h	(revision 11158)
+++ /trunk/BNC/qwt/qwt_weeding_curve_fitter.h	(revision 11158)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * Qwt Widget Library
+ * Copyright (C) 1997   Josef Wilgen
+ * Copyright (C) 2002   Uwe Rathmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the Qwt License, Version 1.0
+ *****************************************************************************/
+
+#ifndef QWT_WEEDING_CURVE_FITTER_H
+#define QWT_WEEDING_CURVE_FITTER_H
+
+#include "qwt_curve_fitter.h"
+
+/*!
+   \brief A curve fitter implementing Douglas and Peucker algorithm
+
+   The purpose of the Douglas and Peucker algorithm is that given a 'curve'
+   composed of line segments to find a curve not too dissimilar but that
+   has fewer points. The algorithm defines 'too dissimilar' based on the
+   maximum distance (tolerance) between the original curve and the
+   smoothed curve.
+
+   The runtime of the algorithm increases non linear ( worst case O( n*n ) )
+   and might be very slow for huge polygons. To avoid performance issues
+   it might be useful to split the polygon ( setChunkSize() ) and to run the algorithm
+   for these smaller parts. The disadvantage of having no interpolation
+   at the borders is for most use cases irrelevant.
+
+   The smoothed curve consists of a subset of the points that defined the
+   original curve.
+
+   In opposite to QwtSplineCurveFitter the Douglas and Peucker algorithm reduces
+   the number of points. By adjusting the tolerance parameter according to the
+   axis scales QwtSplineCurveFitter can be used to implement different
+   level of details to speed up painting of curves of many points.
+ */
+class QWT_EXPORT QwtWeedingCurveFitter : public QwtCurveFitter
+{
+  public:
+    explicit QwtWeedingCurveFitter( double tolerance = 1.0 );
+    virtual ~QwtWeedingCurveFitter();
+
+    void setTolerance( double );
+    double tolerance() const;
+
+    void setChunkSize( uint );
+    uint chunkSize() const;
+
+    virtual QPolygonF fitCurve( const QPolygonF& ) const QWT_OVERRIDE;
+    virtual QPainterPath fitCurvePath( const QPolygonF& ) const QWT_OVERRIDE;
+
+  private:
+    virtual QPolygonF simplify( const QPolygonF& ) const;
+
+    class Line;
+
+    class PrivateData;
+    PrivateData* m_data;
+};
+
+#endif
Index: /trunk/BNC/qwt/qwt_wheel.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_wheel.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_wheel.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,4 +11,6 @@
 #include "qwt_math.h"
 #include "qwt_painter.h"
+#include "qwt.h"
+
 #include <qevent.h>
 #include <qdrawutil.h>
@@ -16,42 +18,36 @@
 #include <qstyle.h>
 #include <qstyleoption.h>
-#include <qapplication.h>
-#include <qdatetime.h>
-
-#if QT_VERSION < 0x040601
-#define qFabs(x) ::fabs(x)
-#define qFastSin(x) ::sin(x)
-#define qExp(x) ::exp(x)
-#endif
+#include <qelapsedtimer.h>
+#include <qmath.h>
 
 class QwtWheel::PrivateData
 {
-public:
-    PrivateData():
-        orientation( Qt::Horizontal ),
-        viewAngle( 175.0 ),
-        totalAngle( 360.0 ),
-        tickCount( 10 ),
-        wheelBorderWidth( 2 ),
-        borderWidth( 2 ),
-        wheelWidth( 20 ),
-        isScrolling( false ),
-        mouseOffset( 0.0 ),
-        tracking( true ),
-        pendingValueChanged( false ),
-        updateInterval( 50 ),
-        mass( 0.0 ),
-        timerId( 0 ),
-        speed( 0.0 ),
-        mouseValue( 0.0 ),
-        flyingValue( 0.0 ),
-        minimum( 0.0 ),
-        maximum( 100.0 ),
-        singleStep( 1.0 ),
-        pageStepCount( 1 ),
-        stepAlignment( true ),
-        value( 0.0 ),
-        inverted( false ),
-        wrapping( false )
+  public:
+    PrivateData()
+        : orientation( Qt::Horizontal )
+        , viewAngle( 175.0 )
+        , totalAngle( 360.0 )
+        , tickCount( 10 )
+        , wheelBorderWidth( 2 )
+        , borderWidth( 2 )
+        , wheelWidth( 20 )
+        , mouseOffset( 0.0 )
+        , updateInterval( 50 )
+        , mass( 0.0 )
+        , timerId( 0 )
+        , speed( 0.0 )
+        , mouseValue( 0.0 )
+        , flyingValue( 0.0 )
+        , minimum( 0.0 )
+        , maximum( 100.0 )
+        , singleStep( 1.0 )
+        , pageStepCount( 1 )
+        , value( 0.0 )
+        , isScrolling( false )
+        , tracking( true )
+        , stepAlignment( true )
+        , pendingValueChanged( false )
+        , inverted( false )
+        , wrapping( false )
     {
     }
@@ -65,9 +61,5 @@
     int wheelWidth;
 
-    bool isScrolling;
     double mouseOffset;
-
-    bool tracking;
-    bool pendingValueChanged; // when not tracking
 
     int updateInterval;
@@ -76,5 +68,5 @@
     // for the flying wheel effect
     int timerId;
-    QTime time;
+    QElapsedTimer timer;
     double speed;
     double mouseValue;
@@ -86,8 +78,11 @@
     double singleStep;
     int pageStepCount;
+
+    double value;
+
+    bool isScrolling;
+    bool tracking;
     bool stepAlignment;
-
-    double value;
-
+    bool pendingValueChanged; // when not tracking
     bool inverted;
     bool wrapping;
@@ -95,8 +90,8 @@
 
 //! Constructor
-QwtWheel::QwtWheel( QWidget *parent ):
+QwtWheel::QwtWheel( QWidget* parent ):
     QWidget( parent )
 {
-    d_data = new PrivateData;
+    m_data = new PrivateData;
 
     setFocusPolicy( Qt::StrongFocus );
@@ -108,53 +103,53 @@
 QwtWheel::~QwtWheel()
 {
-    delete d_data;
-}
-
-/*!
-  \brief En/Disable tracking
-
-  If tracking is enabled (the default), the wheel emits the valueChanged()
-  signal while the wheel is moving. If tracking is disabled, the wheel
-  emits the valueChanged() signal only when the wheel movement is terminated.
-
-  The wheelMoved() signal is emitted regardless id tracking is enabled or not.
-
-  \param enable On/Off
-  \sa isTracking()
+    delete m_data;
+}
+
+/*!
+   \brief En/Disable tracking
+
+   If tracking is enabled (the default), the wheel emits the valueChanged()
+   signal while the wheel is moving. If tracking is disabled, the wheel
+   emits the valueChanged() signal only when the wheel movement is terminated.
+
+   The wheelMoved() signal is emitted regardless id tracking is enabled or not.
+
+   \param enable On/Off
+   \sa isTracking()
  */
 void QwtWheel::setTracking( bool enable )
 {
-    d_data->tracking = enable;
-}
-
-/*!
-  \return True, when tracking is enabled
-  \sa setTracking(), valueChanged(), wheelMoved()
-*/
+    m_data->tracking = enable;
+}
+
+/*!
+   \return True, when tracking is enabled
+   \sa setTracking(), valueChanged(), wheelMoved()
+ */
 bool QwtWheel::isTracking() const
 {
-    return d_data->tracking;
-}
-
-/*!
-  \brief Specify the update interval when the wheel is flying
-
-  Default and minimum value is 50 ms.
-
-  \param interval Interval in milliseconds
-  \sa updateInterval(), setMass(), setTracking()
-*/
+    return m_data->tracking;
+}
+
+/*!
+   \brief Specify the update interval when the wheel is flying
+
+   Default and minimum value is 50 ms.
+
+   \param interval Interval in milliseconds
+   \sa updateInterval(), setMass(), setTracking()
+ */
 void QwtWheel::setUpdateInterval( int interval )
 {
-    d_data->updateInterval = qMax( interval, 50 );
-}
-
-/*!
-  \return Update interval when the wheel is flying
-  \sa setUpdateInterval(), mass(), isTracking()
+    m_data->updateInterval = qMax( interval, 50 );
+}
+
+/*!
+   \return Update interval when the wheel is flying
+   \sa setUpdateInterval(), mass(), isTracking()
  */
 int QwtWheel::updateInterval() const
 {
-    return d_data->updateInterval;
+    return m_data->updateInterval;
 }
 
@@ -165,18 +160,18 @@
 
    \param event Mouse event
-*/
-void QwtWheel::mousePressEvent( QMouseEvent *event )
+ */
+void QwtWheel::mousePressEvent( QMouseEvent* event )
 {
     stopFlying();
 
-    d_data->isScrolling = wheelRect().contains( event->pos() );
-
-    if ( d_data->isScrolling )
-    {
-        d_data->time.start();
-        d_data->speed = 0.0;
-        d_data->mouseValue = valueAt( event->pos() );
-        d_data->mouseOffset = d_data->mouseValue - d_data->value;
-        d_data->pendingValueChanged = false;
+    m_data->isScrolling = wheelRect().contains( event->pos() );
+
+    if ( m_data->isScrolling )
+    {
+        m_data->timer.start();
+        m_data->speed = 0.0;
+        m_data->mouseValue = valueAt( event->pos() );
+        m_data->mouseOffset = m_data->mouseValue - m_data->value;
+        m_data->pendingValueChanged = false;
 
         Q_EMIT wheelPressed();
@@ -190,15 +185,15 @@
 
    \param event Mouse event
-*/
-void QwtWheel::mouseMoveEvent( QMouseEvent *event )
-{
-    if ( !d_data->isScrolling )
+ */
+void QwtWheel::mouseMoveEvent( QMouseEvent* event )
+{
+    if ( !m_data->isScrolling )
         return;
 
     double mouseValue = valueAt( event->pos() );
 
-    if ( d_data->mass > 0.0 )
-    {
-        double ms = d_data->time.restart();
+    if ( m_data->mass > 0.0 )
+    {
+        double ms = m_data->timer.restart();
 
         // the interval when mouse move events are posted are somehow
@@ -207,25 +202,25 @@
         ms = qMax( ms, 5.0 );
 
-        d_data->speed = ( mouseValue - d_data->mouseValue ) / ms;
-    }
-
-    d_data->mouseValue = mouseValue;
-
-    double value = boundedValue( mouseValue - d_data->mouseOffset );
-    if ( d_data->stepAlignment )
+        m_data->speed = ( mouseValue - m_data->mouseValue ) / ms;
+    }
+
+    m_data->mouseValue = mouseValue;
+
+    double value = boundedValue( mouseValue - m_data->mouseOffset );
+    if ( m_data->stepAlignment )
         value = alignedValue( value );
 
-    if ( value != d_data->value )
-    {
-        d_data->value = value;
+    if ( value != m_data->value )
+    {
+        m_data->value = value;
 
         update();
 
-        Q_EMIT wheelMoved( d_data->value );
-
-        if ( d_data->tracking )
-            Q_EMIT valueChanged( d_data->value );
+        Q_EMIT wheelMoved( m_data->value );
+
+        if ( m_data->tracking )
+            Q_EMIT valueChanged( m_data->value );
         else
-            d_data->pendingValueChanged = true;
+            m_data->pendingValueChanged = true;
     }
 }
@@ -238,21 +233,21 @@
 
    \param event Mouse event
-*/
-
-void QwtWheel::mouseReleaseEvent( QMouseEvent *event )
+ */
+
+void QwtWheel::mouseReleaseEvent( QMouseEvent* event )
 {
     Q_UNUSED( event );
 
-    if ( !d_data->isScrolling )
+    if ( !m_data->isScrolling )
         return;
 
-    d_data->isScrolling = false;
+    m_data->isScrolling = false;
 
     bool startFlying = false;
 
-    if ( d_data->mass > 0.0 )
-    {
-        const int ms = d_data->time.elapsed();
-        if ( ( qFabs( d_data->speed ) > 0.0 ) && ( ms < 50 ) )
+    if ( m_data->mass > 0.0 )
+    {
+        const qint64 ms = m_data->timer.elapsed();
+        if ( ( std::fabs( m_data->speed ) > 0.0 ) && ( ms < 50 ) )
             startFlying = true;
     }
@@ -260,17 +255,17 @@
     if ( startFlying )
     {
-        d_data->flyingValue =
-            boundedValue( d_data->mouseValue - d_data->mouseOffset );
-
-        d_data->timerId = startTimer( d_data->updateInterval );
+        m_data->flyingValue =
+            boundedValue( m_data->mouseValue - m_data->mouseOffset );
+
+        m_data->timerId = startTimer( m_data->updateInterval );
     }
     else
     {
-        if ( d_data->pendingValueChanged )
-            Q_EMIT valueChanged( d_data->value );
-    }
-
-    d_data->pendingValueChanged = false;
-    d_data->mouseOffset = 0.0;
+        if ( m_data->pendingValueChanged )
+            Q_EMIT valueChanged( m_data->value );
+    }
+
+    m_data->pendingValueChanged = false;
+    m_data->mouseOffset = 0.0;
 
     Q_EMIT wheelReleased();
@@ -278,15 +273,15 @@
 
 /*!
-  \brief Qt timer event
-
-  The flying wheel effect is implemented using a timer
-
-  \param event Timer event
-
-  \sa updateInterval()
- */
-void QwtWheel::timerEvent( QTimerEvent *event )
-{
-    if ( event->timerId() != d_data->timerId )
+   \brief Qt timer event
+
+   The flying wheel effect is implemented using a timer
+
+   \param event Timer event
+
+   \sa updateInterval()
+ */
+void QwtWheel::timerEvent( QTimerEvent* event )
+{
+    if ( event->timerId() != m_data->timerId )
     {
         QWidget::timerEvent( event );
@@ -294,40 +289,51 @@
     }
 
-    d_data->speed *= qExp( -d_data->updateInterval * 0.001 / d_data->mass );
-
-    d_data->flyingValue += d_data->speed * d_data->updateInterval;
-    d_data->flyingValue = boundedValue( d_data->flyingValue );
-
-    double value = d_data->flyingValue;
-    if ( d_data->stepAlignment )
+    m_data->speed *= std::exp( -m_data->updateInterval * 0.001 / m_data->mass );
+
+    m_data->flyingValue += m_data->speed * m_data->updateInterval;
+    m_data->flyingValue = boundedValue( m_data->flyingValue );
+
+    double value = m_data->flyingValue;
+    if ( m_data->stepAlignment )
         value = alignedValue( value );
 
-    if ( qFabs( d_data->speed ) < 0.001 * d_data->singleStep )
-    {
-        // stop if d_data->speed < one step per second
+    if ( std::fabs( m_data->speed ) < 0.001 * m_data->singleStep )
+    {
+        // stop if m_data->speed < one step per second
         stopFlying();
     }
 
-    if ( value != d_data->value )
-    {
-        d_data->value = value;
+    if ( value != m_data->value )
+    {
+        m_data->value = value;
         update();
 
-        if ( d_data->tracking || d_data->timerId == 0 )
-            Q_EMIT valueChanged( d_data->value );
-    }
-}
-
-
-/*!
-  \brief Handle wheel events
-
-  In/Decrement the value
-
-  \param event Wheel event
-*/
-void QwtWheel::wheelEvent( QWheelEvent *event )
-{
-    if ( !wheelRect().contains( event->pos() ) )
+        if ( m_data->tracking || m_data->timerId == 0 )
+            Q_EMIT valueChanged( m_data->value );
+    }
+}
+
+
+/*!
+   \brief Handle wheel events
+
+   In/Decrement the value
+
+   \param event Wheel event
+ */
+void QwtWheel::wheelEvent( QWheelEvent* event )
+{
+#if QT_VERSION < 0x050e00
+    const QPoint wheelPos = event->pos();
+    const int wheelDelta = event->delta();
+#else
+    const QPoint wheelPos = event->position().toPoint();
+
+    const QPoint delta = event->angleDelta();
+    const int wheelDelta = ( qAbs( delta.x() ) > qAbs( delta.y() ) )
+        ? delta.x() : delta.y();
+#endif
+
+    if ( !wheelRect().contains( wheelPos ) )
     {
         event->ignore();
@@ -335,5 +341,5 @@
     }
 
-    if ( d_data->isScrolling )
+    if ( m_data->isScrolling )
         return;
 
@@ -342,66 +348,66 @@
     double increment = 0.0;
 
-    if ( ( event->modifiers() & Qt::ControlModifier) ||
+    if ( ( event->modifiers() & Qt::ControlModifier ) ||
         ( event->modifiers() & Qt::ShiftModifier ) )
     {
         // one page regardless of delta
-        increment = d_data->singleStep * d_data->pageStepCount;
-        if ( event->delta() < 0 )
+        increment = m_data->singleStep * m_data->pageStepCount;
+        if ( wheelDelta < 0 )
             increment = -increment;
     }
     else
     {
-        const int numSteps = event->delta() / 120;
-        increment = d_data->singleStep * numSteps;
-    }
-
-    if ( d_data->orientation == Qt::Vertical && d_data->inverted )
+        const int numSteps = wheelDelta / 120;
+        increment = m_data->singleStep * numSteps;
+    }
+
+    if ( m_data->orientation == Qt::Vertical && m_data->inverted )
         increment = -increment;
 
-    double value = boundedValue( d_data->value + increment );
-
-    if ( d_data->stepAlignment )
+    double value = boundedValue( m_data->value + increment );
+
+    if ( m_data->stepAlignment )
         value = alignedValue( value );
 
-    if ( value != d_data->value )
-    {
-        d_data->value = value;
+    if ( value != m_data->value )
+    {
+        m_data->value = value;
         update();
 
-        Q_EMIT valueChanged( d_data->value );
-        Q_EMIT wheelMoved( d_data->value );
-    }
-}
-
-/*!
-  Handle key events
-
-  - Qt::Key_Home\n
+        Q_EMIT valueChanged( m_data->value );
+        Q_EMIT wheelMoved( m_data->value );
+    }
+}
+
+/*!
+   Handle key events
+
+   - Qt::Key_Home\n
     Step to minimum()
 
-  - Qt::Key_End\n
+   - Qt::Key_End\n
     Step to maximum()
 
-  - Qt::Key_Up\n
+   - Qt::Key_Up\n
     In case of a horizontal or not inverted vertical wheel the value
     will be incremented by the step size. For an inverted vertical wheel
     the value will be decremented by the step size.
 
-  - Qt::Key_Down\n
+   - Qt::Key_Down\n
     In case of a horizontal or not inverted vertical wheel the value
     will be decremented by the step size. For an inverted vertical wheel
     the value will be incremented by the step size.
 
-  - Qt::Key_PageUp\n
+   - Qt::Key_PageUp\n
     The value will be incremented by pageStepSize() * singleStepSize().
 
-  - Qt::Key_PageDown\n
+   - Qt::Key_PageDown\n
     The value will be decremented by pageStepSize() * singleStepSize().
 
-  \param event Key event
-*/
-void QwtWheel::keyPressEvent( QKeyEvent *event )
-{
-    if ( d_data->isScrolling )
+   \param event Key event
+ */
+void QwtWheel::keyPressEvent( QKeyEvent* event )
+{
+    if ( m_data->isScrolling )
     {
         // don't interfere mouse scrolling
@@ -409,5 +415,5 @@
     }
 
-    double value = d_data->value;
+    double value = m_data->value;
     double increment = 0.0;
 
@@ -416,8 +422,8 @@
         case Qt::Key_Down:
         {
-            if ( d_data->orientation == Qt::Vertical && d_data->inverted )
-                increment = d_data->singleStep;
+            if ( m_data->orientation == Qt::Vertical && m_data->inverted )
+                increment = m_data->singleStep;
             else
-                increment = -d_data->singleStep;
+                increment = -m_data->singleStep;
 
             break;
@@ -425,8 +431,8 @@
         case Qt::Key_Up:
         {
-            if ( d_data->orientation == Qt::Vertical && d_data->inverted )
-                increment = -d_data->singleStep;
+            if ( m_data->orientation == Qt::Vertical && m_data->inverted )
+                increment = -m_data->singleStep;
             else
-                increment = d_data->singleStep;
+                increment = m_data->singleStep;
 
             break;
@@ -434,10 +440,10 @@
         case Qt::Key_Left:
         {
-            if ( d_data->orientation == Qt::Horizontal )
+            if ( m_data->orientation == Qt::Horizontal )
             {
-                if ( d_data->inverted )
-                    increment = d_data->singleStep;
+                if ( m_data->inverted )
+                    increment = m_data->singleStep;
                 else
-                    increment = -d_data->singleStep;
+                    increment = -m_data->singleStep;
             }
             break;
@@ -445,10 +451,10 @@
         case Qt::Key_Right:
         {
-            if ( d_data->orientation == Qt::Horizontal )
+            if ( m_data->orientation == Qt::Horizontal )
             {
-                if ( d_data->inverted )
-                    increment = -d_data->singleStep;
+                if ( m_data->inverted )
+                    increment = -m_data->singleStep;
                 else
-                    increment = d_data->singleStep;
+                    increment = m_data->singleStep;
             }
             break;
@@ -456,26 +462,26 @@
         case Qt::Key_PageUp:
         {
-            increment = d_data->pageStepCount * d_data->singleStep;
+            increment = m_data->pageStepCount * m_data->singleStep;
             break;
         }
         case Qt::Key_PageDown:
         {
-            increment = -d_data->pageStepCount * d_data->singleStep;
+            increment = -m_data->pageStepCount * m_data->singleStep;
             break;
         }
         case Qt::Key_Home:
         {
-            value = d_data->minimum;
+            value = m_data->minimum;
             break;
         }
         case Qt::Key_End:
         {
-            value = d_data->maximum;
+            value = m_data->maximum;
             break;
         }
         default:;
-        {
-            event->ignore();
-        }
+            {
+                event->ignore();
+            }
     }
 
@@ -485,37 +491,37 @@
     if ( increment != 0.0 )
     {
-        value = boundedValue( d_data->value + increment );
-
-        if ( d_data->stepAlignment )
+        value = boundedValue( m_data->value + increment );
+
+        if ( m_data->stepAlignment )
             value = alignedValue( value );
     }
 
-    if ( value != d_data->value )
-    {
-        d_data->value = value;
+    if ( value != m_data->value )
+    {
+        m_data->value = value;
         update();
 
-        Q_EMIT valueChanged( d_data->value );
-        Q_EMIT wheelMoved( d_data->value );
-    }
-}
-
-/*!
-  \brief Adjust the number of grooves in the wheel's surface.
-
-  The number of grooves is limited to 6 <= count <= 50.
-  Values outside this range will be clipped.
-  The default value is 10.
-
-  \param count Number of grooves per 360 degrees
-  \sa tickCount()
-*/
+        Q_EMIT valueChanged( m_data->value );
+        Q_EMIT wheelMoved( m_data->value );
+    }
+}
+
+/*!
+   \brief Adjust the number of grooves in the wheel's surface.
+
+   The number of grooves is limited to 6 <= count <= 50.
+   Values outside this range will be clipped.
+   The default value is 10.
+
+   \param count Number of grooves per 360 degrees
+   \sa tickCount()
+ */
 void QwtWheel::setTickCount( int count )
 {
     count = qBound( 6, count, 50 );
 
-    if ( count != d_data->tickCount )
-    {
-        d_data->tickCount = qBound( 6, count, 50 );
+    if ( count != m_data->tickCount )
+    {
+        m_data->tickCount = qBound( 6, count, 50 );
         update();
     }
@@ -523,29 +529,29 @@
 
 /*!
-  \return Number of grooves in the wheel's surface.
-  \sa setTickCnt()
-*/
+   \return Number of grooves in the wheel's surface.
+   \sa setTickCnt()
+ */
 int QwtWheel::tickCount() const
 {
-    return d_data->tickCount;
-}
-
-/*!
-  \brief Set the wheel border width of the wheel.
-
-  The wheel border must not be smaller than 1
-  and is limited in dependence on the wheel's size.
-  Values outside the allowed range will be clipped.
-
-  The wheel border defaults to 2.
-
-  \param borderWidth Border width
-  \sa internalBorder()
-*/
+    return m_data->tickCount;
+}
+
+/*!
+   \brief Set the wheel border width of the wheel.
+
+   The wheel border must not be smaller than 1
+   and is limited in dependence on the wheel's size.
+   Values outside the allowed range will be clipped.
+
+   The wheel border defaults to 2.
+
+   \param borderWidth Border width
+   \sa internalBorder()
+ */
 void QwtWheel::setWheelBorderWidth( int borderWidth )
 {
     const int d = qMin( width(), height() ) / 3;
     borderWidth = qMin( borderWidth, d );
-    d_data->wheelBorderWidth = qMax( borderWidth, 1 );
+    m_data->wheelBorderWidth = qMax( borderWidth, 1 );
     update();
 }
@@ -554,21 +560,21 @@
    \return Wheel border width
    \sa setWheelBorderWidth()
-*/
+ */
 int QwtWheel::wheelBorderWidth() const
 {
-    return d_data->wheelBorderWidth;
-}
-
-/*!
-  \brief Set the border width
-
-  The border defaults to 2.
-
-  \param width Border width
-  \sa borderWidth()
-*/
+    return m_data->wheelBorderWidth;
+}
+
+/*!
+   \brief Set the border width
+
+   The border defaults to 2.
+
+   \param width Border width
+   \sa borderWidth()
+ */
 void QwtWheel::setBorderWidth( int width )
 {
-    d_data->borderWidth = qMax( width, 0 );
+    m_data->borderWidth = qMax( width, 0 );
     update();
 }
@@ -577,32 +583,32 @@
    \return Border width
    \sa setBorderWidth()
-*/
+ */
 int QwtWheel::borderWidth() const
 {
-    return d_data->borderWidth;
+    return m_data->borderWidth;
 }
 
 /*!
    \return Rectangle of the wheel without the outer border
-*/
+ */
 QRect QwtWheel::wheelRect() const
 {
-    const int bw = d_data->borderWidth;
+    const int bw = m_data->borderWidth;
     return contentsRect().adjusted( bw, bw, -bw, -bw );
 }
 
 /*!
-  \brief Set the total angle which the wheel can be turned.
-
-  One full turn of the wheel corresponds to an angle of
-  360 degrees. A total angle of n*360 degrees means
-  that the wheel has to be turned n times around its axis
-  to get from the minimum value to the maximum value.
-
-  The default setting of the total angle is 360 degrees.
-
-  \param angle total angle in degrees
-  \sa totalAngle()
-*/
+   \brief Set the total angle which the wheel can be turned.
+
+   One full turn of the wheel corresponds to an angle of
+   360 degrees. A total angle of n*360 degrees means
+   that the wheel has to be turned n times around its axis
+   to get from the minimum value to the maximum value.
+
+   The default setting of the total angle is 360 degrees.
+
+   \param angle total angle in degrees
+   \sa totalAngle()
+ */
 void QwtWheel::setTotalAngle( double angle )
 {
@@ -610,28 +616,28 @@
         angle = 0.0;
 
-    d_data->totalAngle = angle;
+    m_data->totalAngle = angle;
     update();
 }
 
 /*!
-  \return Total angle which the wheel can be turned.
-  \sa setTotalAngle()
-*/
+   \return Total angle which the wheel can be turned.
+   \sa setTotalAngle()
+ */
 double QwtWheel::totalAngle() const
 {
-    return d_data->totalAngle;
-}
-
-/*!
-  \brief Set the wheel's orientation.
-
-  The default orientation is Qt::Horizontal.
-
-  \param orientation Qt::Horizontal or Qt::Vertical.
-  \sa orientation()
-*/
+    return m_data->totalAngle;
+}
+
+/*!
+   \brief Set the wheel's orientation.
+
+   The default orientation is Qt::Horizontal.
+
+   \param orientation Qt::Horizontal or Qt::Vertical.
+   \sa orientation()
+ */
 void QwtWheel::setOrientation( Qt::Orientation orientation )
 {
-    if ( d_data->orientation == orientation )
+    if ( m_data->orientation == orientation )
         return;
 
@@ -645,54 +651,54 @@
     }
 
-    d_data->orientation = orientation;
+    m_data->orientation = orientation;
     update();
 }
 
 /*!
-  \return Orientation
-  \sa setOrientation()
-*/
+   \return Orientation
+   \sa setOrientation()
+ */
 Qt::Orientation QwtWheel::orientation() const
 {
-    return d_data->orientation;
-}
-
-/*!
-  \brief Specify the visible portion of the wheel.
-
-  You may use this function for fine-tuning the appearance of
-  the wheel. The default value is 175 degrees. The value is
-  limited from 10 to 175 degrees.
-
-  \param angle Visible angle in degrees
-  \sa viewAngle(), setTotalAngle()
-*/
+    return m_data->orientation;
+}
+
+/*!
+   \brief Specify the visible portion of the wheel.
+
+   You may use this function for fine-tuning the appearance of
+   the wheel. The default value is 175 degrees. The value is
+   limited from 10 to 175 degrees.
+
+   \param angle Visible angle in degrees
+   \sa viewAngle(), setTotalAngle()
+ */
 void QwtWheel::setViewAngle( double angle )
 {
-    d_data->viewAngle = qBound( 10.0, angle, 175.0 );
+    m_data->viewAngle = qBound( 10.0, angle, 175.0 );
     update();
 }
 
 /*!
-  \return Visible portion of the wheel
-  \sa setViewAngle(), totalAngle()
-*/
+   \return Visible portion of the wheel
+   \sa setViewAngle(), totalAngle()
+ */
 double QwtWheel::viewAngle() const
 {
-    return d_data->viewAngle;
-}
-
-/*!
-  Determine the value corresponding to a specified point
-
-  \param pos Position
-  \return Value corresponding to pos
-*/
-double QwtWheel::valueAt( const QPoint &pos ) const
+    return m_data->viewAngle;
+}
+
+/*!
+   Determine the value corresponding to a specified point
+
+   \param pos Position
+   \return Value corresponding to pos
+ */
+double QwtWheel::valueAt( const QPoint& pos ) const
 {
     const QRectF rect = wheelRect();
 
     double w, dx;
-    if ( d_data->orientation == Qt::Vertical )
+    if ( m_data->orientation == Qt::Vertical )
     {
         w = rect.height();
@@ -708,5 +714,5 @@
         return 0.0;
 
-    if ( d_data->inverted )
+    if ( m_data->inverted )
     {
         dx = w - dx;
@@ -715,9 +721,9 @@
     // w pixels is an arc of viewAngle degrees,
     // so we convert change in pixels to change in angle
-    const double ang = dx * d_data->viewAngle / w;
+    const double ang = dx * m_data->viewAngle / w;
 
     // value range maps to totalAngle degrees,
     // so convert the change in angle to a change in value
-    const double val = ang * ( maximum() - minimum() ) / d_data->totalAngle;
+    const double val = ang * ( maximum() - minimum() ) / m_data->totalAngle;
 
     return val;
@@ -727,6 +733,6 @@
    \brief Qt Paint Event
    \param event Paint event
-*/
-void QwtWheel::paintEvent( QPaintEvent *event )
+ */
+void QwtWheel::paintEvent( QPaintEvent* event )
 {
     QPainter painter( this );
@@ -734,9 +740,9 @@
 
     QStyleOption opt;
-    opt.init(this);
+    opt.initFrom(this);
     style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
 
     qDrawShadePanel( &painter,
-        contentsRect(), palette(), true, d_data->borderWidth );
+        contentsRect(), palette(), true, m_data->borderWidth );
 
     drawWheelBackground( &painter, wheelRect() );
@@ -752,7 +758,7 @@
    \param painter Painter
    \param rect Geometry for the wheel
-*/
+ */
 void QwtWheel::drawWheelBackground(
-    QPainter *painter, const QRectF &rect )
+    QPainter* painter, const QRectF& rect )
 {
     painter->save();
@@ -762,5 +768,5 @@
     //  draw shaded background
     QLinearGradient gradient( rect.topLeft(),
-        ( d_data->orientation == Qt::Horizontal ) ? rect.topRight() : rect.bottomLeft() );
+        ( m_data->orientation == Qt::Horizontal ) ? rect.topRight() : rect.bottomLeft() );
     gradient.setColorAt( 0.0, pal.color( QPalette::Button ) );
     gradient.setColorAt( 0.2, pal.color( QPalette::Midlight ) );
@@ -773,11 +779,11 @@
 
     const QPen lightPen( palette().color( QPalette::Light ),
-        d_data->wheelBorderWidth, Qt::SolidLine, Qt::FlatCap );
+        m_data->wheelBorderWidth, Qt::SolidLine, Qt::FlatCap );
     const QPen darkPen( pal.color( QPalette::Dark ),
-        d_data->wheelBorderWidth, Qt::SolidLine, Qt::FlatCap );
-
-    const double bw2 = 0.5 * d_data->wheelBorderWidth;
-
-    if ( d_data->orientation == Qt::Horizontal )
+        m_data->wheelBorderWidth, Qt::SolidLine, Qt::FlatCap );
+
+    const double bw2 = 0.5 * m_data->wheelBorderWidth;
+
+    if ( m_data->orientation == Qt::Horizontal )
     {
         painter->setPen( lightPen );
@@ -808,10 +814,10 @@
    \param painter Painter
    \param rect Geometry for the wheel
-*/
-void QwtWheel::drawTicks( QPainter *painter, const QRectF &rect )
-{
-    const double range = d_data->maximum - d_data->minimum;
-
-    if ( range == 0.0 || d_data->totalAngle == 0.0 )
+ */
+void QwtWheel::drawTicks( QPainter* painter, const QRectF& rect )
+{
+    const double range = m_data->maximum - m_data->minimum;
+
+    if ( range == 0.0 || m_data->totalAngle == 0.0 )
     {
         return;
@@ -823,20 +829,20 @@
         0, Qt::SolidLine, Qt::FlatCap );
 
-    const double cnvFactor = qAbs( d_data->totalAngle / range );
-    const double halfIntv = 0.5 * d_data->viewAngle / cnvFactor;
+    const double cnvFactor = qAbs( m_data->totalAngle / range );
+    const double halfIntv = 0.5 * m_data->viewAngle / cnvFactor;
     const double loValue = value() - halfIntv;
     const double hiValue = value() + halfIntv;
-    const double tickWidth = 360.0 / double( d_data->tickCount ) / cnvFactor;
-    const double sinArc = qFastSin( d_data->viewAngle * M_PI / 360.0 );
-
-    if ( d_data->orientation == Qt::Horizontal )
+    const double tickWidth = 360.0 / double( m_data->tickCount ) / cnvFactor;
+    const double sinArc = qFastSin( m_data->viewAngle * M_PI / 360.0 );
+
+    if ( m_data->orientation == Qt::Horizontal )
     {
         const double radius = rect.width() * 0.5;
 
-        double l1 = rect.top() + d_data->wheelBorderWidth;
-        double l2 = rect.bottom() - d_data->wheelBorderWidth - 1;
+        double l1 = rect.top() + m_data->wheelBorderWidth;
+        double l2 = rect.bottom() - m_data->wheelBorderWidth - 1;
 
         // draw one point over the border if border > 1
-        if ( d_data->wheelBorderWidth > 1 )
+        if ( m_data->wheelBorderWidth > 1 )
         {
             l1--;
@@ -848,5 +854,5 @@
 
         // draw tick marks
-        for ( double tickValue = ::ceil( loValue / tickWidth ) * tickWidth;
+        for ( double tickValue = std::ceil( loValue / tickWidth ) * tickWidth;
             tickValue < hiValue; tickValue += tickWidth )
         {
@@ -857,5 +863,5 @@
 
             double tickPos;
-            if ( d_data->inverted )
+            if ( m_data->inverted )
                 tickPos = rect.left() + off;
             else
@@ -865,5 +871,5 @@
             {
                 painter->setPen( darkPen );
-                painter->drawLine( QPointF( tickPos - 1 , l1 ),
+                painter->drawLine( QPointF( tickPos - 1, l1 ),
                     QPointF( tickPos - 1,  l2 ) );
                 painter->setPen( lightPen );
@@ -877,8 +883,8 @@
         const double radius = rect.height() * 0.5;
 
-        double l1 = rect.left() + d_data->wheelBorderWidth;
-        double l2 = rect.right() - d_data->wheelBorderWidth - 1;
-
-        if ( d_data->wheelBorderWidth > 1 )
+        double l1 = rect.left() + m_data->wheelBorderWidth;
+        double l2 = rect.right() - m_data->wheelBorderWidth - 1;
+
+        if ( m_data->wheelBorderWidth > 1 )
         {
             l1--;
@@ -889,5 +895,5 @@
         const double minpos = rect.top() + 2;
 
-        for ( double tickValue = ::ceil( loValue / tickWidth ) * tickWidth;
+        for ( double tickValue = std::ceil( loValue / tickWidth ) * tickWidth;
             tickValue < hiValue; tickValue += tickWidth )
         {
@@ -899,5 +905,5 @@
             double tickPos;
 
-            if ( d_data->inverted )
+            if ( m_data->inverted )
                 tickPos = rect.bottom() - off;
             else
@@ -918,45 +924,45 @@
 
 /*!
-  \brief Set the width of the wheel
-
-  Corresponds to the wheel height for horizontal orientation,
-  and the wheel width for vertical orientation.
-
-  \param width the wheel's width
-  \sa wheelWidth()
-*/
+   \brief Set the width of the wheel
+
+   Corresponds to the wheel height for horizontal orientation,
+   and the wheel width for vertical orientation.
+
+   \param width the wheel's width
+   \sa wheelWidth()
+ */
 void QwtWheel::setWheelWidth( int width )
 {
-    d_data->wheelWidth = width;
+    m_data->wheelWidth = width;
     update();
 }
 
 /*!
-  \return Width of the wheel
-  \sa setWheelWidth()
-*/
+   \return Width of the wheel
+   \sa setWheelWidth()
+ */
 int QwtWheel::wheelWidth() const
 {
-    return d_data->wheelWidth;
-}
-
-/*!
-  \return a size hint
-*/
+    return m_data->wheelWidth;
+}
+
+/*!
+   \return a size hint
+ */
 QSize QwtWheel::sizeHint() const
 {
     const QSize hint = minimumSizeHint();
-    return hint.expandedTo( QApplication::globalStrut() );
-}
-
-/*!
-  \return Minimum size hint
-  \warning The return value is based on the wheel width.
-*/
+    return qwtExpandedToGlobalStrut( hint );
+}
+
+/*!
+   \return Minimum size hint
+   \warning The return value is based on the wheel width.
+ */
 QSize QwtWheel::minimumSizeHint() const
 {
-    QSize sz( 3 * d_data->wheelWidth + 2 * d_data->borderWidth,
-        d_data->wheelWidth + 2 * d_data->borderWidth );
-    if ( d_data->orientation != Qt::Horizontal )
+    QSize sz( 3 * m_data->wheelWidth + 2 * m_data->borderWidth,
+        m_data->wheelWidth + 2 * m_data->borderWidth );
+    if ( m_data->orientation != Qt::Horizontal )
         sz.transpose();
 
@@ -965,116 +971,116 @@
 
 /*!
-  \brief Set the step size of the counter
-
-  A value <= 0.0 disables stepping
-
-  \param stepSize Single step size
-  \sa singleStep(), setPageStepCount()
-*/
+   \brief Set the step size of the counter
+
+   A value <= 0.0 disables stepping
+
+   \param stepSize Single step size
+   \sa singleStep(), setPageStepCount()
+ */
 void QwtWheel::setSingleStep( double stepSize )
 {
-    d_data->singleStep = qMax( stepSize, 0.0 );
-}
-
-/*!
-  \return Single step size
-  \sa setSingleStep()
+    m_data->singleStep = qwtMaxF( stepSize, 0.0 );
+}
+
+/*!
+   \return Single step size
+   \sa setSingleStep()
  */
 double QwtWheel::singleStep() const
 {
-    return d_data->singleStep;
-}
-
-/*!
-  \brief En/Disable step alignment
-
-  When step alignment is enabled value changes initiated by
-  user input ( mouse, keyboard, wheel ) are aligned to
-  the multiples of the single step.
-
-  \param on On/Off
-  \sa stepAlignment(), setSingleStep()
+    return m_data->singleStep;
+}
+
+/*!
+   \brief En/Disable step alignment
+
+   When step alignment is enabled value changes initiated by
+   user input ( mouse, keyboard, wheel ) are aligned to
+   the multiples of the single step.
+
+   \param on On/Off
+   \sa stepAlignment(), setSingleStep()
  */
 void QwtWheel::setStepAlignment( bool on )
 {
-    if ( on != d_data->stepAlignment )
-    {
-        d_data->stepAlignment = on;
-    }
-}
-
-/*!
-  \return True, when the step alignment is enabled
-  \sa setStepAlignment(), singleStep()
+    if ( on != m_data->stepAlignment )
+    {
+        m_data->stepAlignment = on;
+    }
+}
+
+/*!
+   \return True, when the step alignment is enabled
+   \sa setStepAlignment(), singleStep()
  */
 bool QwtWheel::stepAlignment() const
 {
-    return d_data->stepAlignment;
-}
-
-/*!
-  \brief Set the page step count
-
-  pageStepCount is a multiplicator for the single step size
-  that typically corresponds to the user pressing PageUp or PageDown.
-
-  A value of 0 disables page stepping.
-
-  The default value is 1.
-
-  \param count Multiplicator for the single step size
-  \sa pageStepCount(), setSingleStep()
+    return m_data->stepAlignment;
+}
+
+/*!
+   \brief Set the page step count
+
+   pageStepCount is a multiplicator for the single step size
+   that typically corresponds to the user pressing PageUp or PageDown.
+
+   A value of 0 disables page stepping.
+
+   The default value is 1.
+
+   \param count Multiplicator for the single step size
+   \sa pageStepCount(), setSingleStep()
  */
 void QwtWheel::setPageStepCount( int count )
 {
-    d_data->pageStepCount = qMax( 0, count );
-}
-
-/*!
-  \return Page step count
-  \sa setPageStepCount(), singleStep()
+    m_data->pageStepCount = qMax( 0, count );
+}
+
+/*!
+   \return Page step count
+   \sa setPageStepCount(), singleStep()
  */
 int QwtWheel::pageStepCount() const
 {
-    return d_data->pageStepCount;
-}
-
-/*!
-  \brief Set the minimum and maximum values
-
-  The maximum is adjusted if necessary to ensure that the range remains valid.
-  The value might be modified to be inside of the range.
-
-  \param min Minimum value
-  \param max Maximum value
-
-  \sa minimum(), maximum()
+    return m_data->pageStepCount;
+}
+
+/*!
+   \brief Set the minimum and maximum values
+
+   The maximum is adjusted if necessary to ensure that the range remains valid.
+   The value might be modified to be inside of the range.
+
+   \param min Minimum value
+   \param max Maximum value
+
+   \sa minimum(), maximum()
  */
 void QwtWheel::setRange( double min, double max )
 {
-    max = qMax( min, max );
-
-    if ( d_data->minimum == min && d_data->maximum == max )
+    max = qwtMaxF( min, max );
+
+    if ( m_data->minimum == min && m_data->maximum == max )
         return;
 
-    d_data->minimum = min;
-    d_data->maximum = max;
-
-    if ( d_data->value < min || d_data->value > max )
-    {
-        d_data->value = qBound( min, d_data->value, max );
+    m_data->minimum = min;
+    m_data->maximum = max;
+
+    if ( m_data->value < min || m_data->value > max )
+    {
+        m_data->value = qBound( min, m_data->value, max );
 
         update();
-        Q_EMIT valueChanged( d_data->value );
-    }
-}
-/*!
-  Set the minimum value of the range
-
-  \param value Minimum value
-  \sa setRange(), setMaximum(), minimum()
-
-  \note The maximum is adjusted if necessary to ensure that the range remains valid.
-*/
+        Q_EMIT valueChanged( m_data->value );
+    }
+}
+/*!
+   Set the minimum value of the range
+
+   \param value Minimum value
+   \sa setRange(), setMaximum(), minimum()
+
+   \note The maximum is adjusted if necessary to ensure that the range remains valid.
+ */
 void QwtWheel::setMinimum( double value )
 {
@@ -1083,18 +1089,18 @@
 
 /*!
-  \return The minimum of the range
-  \sa setRange(), setMinimum(), maximum()
-*/
+   \return The minimum of the range
+   \sa setRange(), setMinimum(), maximum()
+ */
 double QwtWheel::minimum() const
 {
-    return d_data->minimum;
-}
-
-/*!
-  Set the maximum value of the range
-
-  \param value Maximum value
-  \sa setRange(), setMinimum(), maximum()
-*/
+    return m_data->minimum;
+}
+
+/*!
+   Set the maximum value of the range
+
+   \param value Maximum value
+   \sa setRange(), setMinimum(), maximum()
+ */
 void QwtWheel::setMaximum( double value )
 {
@@ -1103,61 +1109,61 @@
 
 /*!
-  \return The maximum of the range
-  \sa setRange(), setMaximum(), minimum()
-*/
+   \return The maximum of the range
+   \sa setRange(), setMaximum(), minimum()
+ */
 double QwtWheel::maximum() const
 {
-    return d_data->maximum;
-}
-
-/*!
-  \brief Set a new value without adjusting to the step raster
-
-  \param value New value
-
-  \sa value(), valueChanged()
-  \warning The value is clipped when it lies outside the range.
-*/
+    return m_data->maximum;
+}
+
+/*!
+   \brief Set a new value without adjusting to the step raster
+
+   \param value New value
+
+   \sa value(), valueChanged()
+   \warning The value is clipped when it lies outside the range.
+ */
 void QwtWheel::setValue( double value )
 {
     stopFlying();
-    d_data->isScrolling = false;
-
-    value = qBound( d_data->minimum, value, d_data->maximum );
-
-    if ( d_data->value != value )
-    {
-        d_data->value = value;
+    m_data->isScrolling = false;
+
+    value = qBound( m_data->minimum, value, m_data->maximum );
+
+    if ( m_data->value != value )
+    {
+        m_data->value = value;
 
         update();
-        Q_EMIT valueChanged( d_data->value );
-    }
-}
-
-/*!
-  \return Current value of the wheel
-  \sa setValue(), valueChanged()
+        Q_EMIT valueChanged( m_data->value );
+    }
+}
+
+/*!
+   \return Current value of the wheel
+   \sa setValue(), valueChanged()
  */
 double QwtWheel::value() const
 {
-    return d_data->value;
-}
-
-/*!
-  \brief En/Disable inverted appearance
-
-  An inverted wheel increases its values in the opposite direction.
-  The direction of an inverted horizontal wheel will be from right to left
-  an inverted vertical wheel will increase from bottom to top.
-
-  \param on En/Disable inverted appearance
-  \sa isInverted()
+    return m_data->value;
+}
+
+/*!
+   \brief En/Disable inverted appearance
+
+   An inverted wheel increases its values in the opposite direction.
+   The direction of an inverted horizontal wheel will be from right to left
+   an inverted vertical wheel will increase from bottom to top.
+
+   \param on En/Disable inverted appearance
+   \sa isInverted()
 
  */
 void QwtWheel::setInverted( bool on )
 {
-    if ( d_data->inverted != on )
-    {
-        d_data->inverted = on;
+    if ( m_data->inverted != on )
+    {
+        m_data->inverted = on;
         update();
     }
@@ -1165,74 +1171,74 @@
 
 /*!
-  \return True, when the wheel is inverted
-  \sa setInverted()
+   \return True, when the wheel is inverted
+   \sa setInverted()
  */
 bool QwtWheel::isInverted() const
 {
-    return d_data->inverted;
-}
-
-/*!
-  \brief En/Disable wrapping
-
-  If wrapping is true stepping up from maximum() value will take
-  you to the minimum() value and vice versa.
-
-  \param on En/Disable wrapping
-  \sa wrapping()
+    return m_data->inverted;
+}
+
+/*!
+   \brief En/Disable wrapping
+
+   If wrapping is true stepping up from maximum() value will take
+   you to the minimum() value and vice versa.
+
+   \param on En/Disable wrapping
+   \sa wrapping()
  */
 void QwtWheel::setWrapping( bool on )
 {
-    d_data->wrapping = on;
-}
-
-/*!
-  \return True, when wrapping is set
-  \sa setWrapping()
+    m_data->wrapping = on;
+}
+
+/*!
+   \return True, when wrapping is set
+   \sa setWrapping()
  */
 bool QwtWheel::wrapping() const
 {
-    return d_data->wrapping;
-}
-
-/*!
-  \brief Set the slider's mass for flywheel effect.
-
-  If the slider's mass is greater then 0, it will continue
-  to move after the mouse button has been released. Its speed
-  decreases with time at a rate depending on the slider's mass.
-  A large mass means that it will continue to move for a
-  long time.
-
-  Derived widgets may overload this function to make it public.
-
-  \param mass New mass in kg
-
-  \bug If the mass is smaller than 1g, it is set to zero.
+    return m_data->wrapping;
+}
+
+/*!
+   \brief Set the slider's mass for flywheel effect.
+
+   If the slider's mass is greater then 0, it will continue
+   to move after the mouse button has been released. Its speed
+   decreases with time at a rate depending on the slider's mass.
+   A large mass means that it will continue to move for a
+   long time.
+
+   Derived widgets may overload this function to make it public.
+
+   \param mass New mass in kg
+
+   \bug If the mass is smaller than 1g, it is set to zero.
        The maximal mass is limited to 100kg.
-  \sa mass()
-*/
+   \sa mass()
+ */
 void QwtWheel::setMass( double mass )
 {
     if ( mass < 0.001 )
     {
-        d_data->mass = 0.0;
+        m_data->mass = 0.0;
     }
     else
     {
-        d_data->mass = qMin( 100.0, mass );
-    }
-
-    if ( d_data->mass <= 0.0 )
+        m_data->mass = qwtMinF( 100.0, mass );
+    }
+
+    if ( m_data->mass <= 0.0 )
         stopFlying();
 }
 
 /*!
-  \return mass
-  \sa setMass()
-*/
+   \return mass
+   \sa setMass()
+ */
 double QwtWheel::mass() const
 {
-    return d_data->mass;
+    return m_data->mass;
 }
 
@@ -1240,9 +1246,9 @@
 void QwtWheel::stopFlying()
 {
-    if ( d_data->timerId != 0 )
-    {
-        killTimer( d_data->timerId );
-        d_data->timerId = 0;
-        d_data->speed = 0.0;
+    if ( m_data->timerId != 0 )
+    {
+        killTimer( m_data->timerId );
+        m_data->timerId = 0;
+        m_data->speed = 0.0;
     }
 }
@@ -1250,20 +1256,20 @@
 double QwtWheel::boundedValue( double value ) const
 {
-    const double range = d_data->maximum - d_data->minimum;
-
-    if ( d_data->wrapping && range >= 0.0 )
-    {
-        if ( value < d_data->minimum )
-        {
-            value += ::ceil( ( d_data->minimum - value ) / range ) * range;
-        }
-        else if ( value > d_data->maximum )
-        {
-            value -= ::ceil( ( value - d_data->maximum ) / range ) * range;
+    const double range = m_data->maximum - m_data->minimum;
+
+    if ( m_data->wrapping && range >= 0.0 )
+    {
+        if ( value < m_data->minimum )
+        {
+            value += std::ceil( ( m_data->minimum - value ) / range ) * range;
+        }
+        else if ( value > m_data->maximum )
+        {
+            value -= std::ceil( ( value - m_data->maximum ) / range ) * range;
         }
     }
     else
     {
-        value = qBound( d_data->minimum, value, d_data->maximum );
+        value = qBound( m_data->minimum, value, m_data->maximum );
     }
 
@@ -1273,10 +1279,10 @@
 double QwtWheel::alignedValue( double value ) const
 {
-    const double stepSize = d_data->singleStep;
+    const double stepSize = m_data->singleStep;
 
     if ( stepSize > 0.0 )
     {
-        value = d_data->minimum +
-            qRound( ( value - d_data->minimum ) / stepSize ) * stepSize;
+        value = m_data->minimum +
+            qRound( ( value - m_data->minimum ) / stepSize ) * stepSize;
 
         if ( stepSize > 1e-12 )
@@ -1287,8 +1293,8 @@
                 value = 0.0;
             }
-            else if ( qFuzzyCompare( value, d_data->maximum ) )
+            else if ( qFuzzyCompare( value, m_data->maximum ) )
             {
                 // correct rounding error at the border
-                value = d_data->maximum;
+                value = m_data->maximum;
             }
         }
@@ -1298,2 +1304,3 @@
 }
 
+#include "moc_qwt_wheel.cpp"
Index: /trunk/BNC/qwt/qwt_wheel.h
===================================================================
--- /trunk/BNC/qwt/qwt_wheel.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_wheel.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -15,22 +15,23 @@
 
 /*!
-  \brief The Wheel Widget
+   \brief The Wheel Widget
 
-  The wheel widget can be used to change values over a very large range
-  in very small steps. Using the setMass() member, it can be configured
-  as a flying wheel.
+   The wheel widget can be used to change values over a very large range
+   in very small steps. Using the setMass() member, it can be configured
+   as a flying wheel.
 
-  The default range of the wheel is [0.0, 100.0]
+   The default range of the wheel is [0.0, 100.0]
 
-  \sa The radio example.
-*/
-class QWT_EXPORT QwtWheel: public QWidget
+   \sa The radio example.
+ */
+class QWT_EXPORT QwtWheel : public QWidget
 {
     Q_OBJECT
 
     Q_PROPERTY( Qt::Orientation orientation
-                READ orientation WRITE setOrientation )
+        READ orientation WRITE setOrientation )
 
-    Q_PROPERTY( double value READ value WRITE setValue )
+    Q_PROPERTY( double value READ value WRITE setValue NOTIFY valueChanged USER true  )
+
     Q_PROPERTY( double minimum READ minimum WRITE setMinimum )
     Q_PROPERTY( double maximum READ maximum WRITE setMaximum )
@@ -54,6 +55,6 @@
     Q_PROPERTY( int wheelBorderWidth READ wheelBorderWidth WRITE setWheelBorderWidth )
 
-public:
-    explicit QwtWheel( QWidget *parent = NULL );
+  public:
+    explicit QwtWheel( QWidget* parent = NULL );
     virtual ~QwtWheel();
 
@@ -109,5 +110,5 @@
     double mass() const;
 
-public Q_SLOTS:
+  public Q_SLOTS:
     void setValue( double );
     void setTotalAngle ( double );
@@ -115,44 +116,44 @@
     void setMass( double );
 
-Q_SIGNALS:
+  Q_SIGNALS:
 
     /*!
-      \brief Notify a change of value.
+       \brief Notify a change of value.
 
-      When tracking is enabled this signal will be emitted every
-      time the value changes.
+       When tracking is enabled this signal will be emitted every
+       time the value changes.
 
-      \param value new value
-      \sa setTracking()
-    */
+       \param value new value
+       \sa setTracking()
+     */
     void valueChanged( double value );
 
     /*!
-      This signal is emitted when the user presses the
-      the wheel with the mouse
-    */
+       This signal is emitted when the user presses the
+       the wheel with the mouse
+     */
     void wheelPressed();
 
     /*!
-      This signal is emitted when the user releases the mouse
-    */
+       This signal is emitted when the user releases the mouse
+     */
     void wheelReleased();
 
     /*!
-      This signal is emitted when the user moves the
-      wheel with the mouse.
+       This signal is emitted when the user moves the
+       wheel with the mouse.
 
-      \param value new value
-    */
+       \param value new value
+     */
     void wheelMoved( double value );
 
-protected:
-    virtual void paintEvent( QPaintEvent * );
-    virtual void mousePressEvent( QMouseEvent * );
-    virtual void mouseReleaseEvent( QMouseEvent * );
-    virtual void mouseMoveEvent( QMouseEvent * );
-    virtual void keyPressEvent( QKeyEvent * );
-    virtual void wheelEvent( QWheelEvent * );
-    virtual void timerEvent( QTimerEvent * );
+  protected:
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
+    virtual void mousePressEvent( QMouseEvent* ) QWT_OVERRIDE;
+    virtual void mouseReleaseEvent( QMouseEvent* ) QWT_OVERRIDE;
+    virtual void mouseMoveEvent( QMouseEvent* ) QWT_OVERRIDE;
+    virtual void keyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
+    virtual void wheelEvent( QWheelEvent* ) QWT_OVERRIDE;
+    virtual void timerEvent( QTimerEvent* ) QWT_OVERRIDE;
 
     void stopFlying();
@@ -160,18 +161,18 @@
     QRect wheelRect() const;
 
-    virtual QSize sizeHint() const;
-    virtual QSize minimumSizeHint() const;
+    virtual QSize sizeHint() const QWT_OVERRIDE;
+    virtual QSize minimumSizeHint() const QWT_OVERRIDE;
 
-    virtual void drawTicks( QPainter *, const QRectF & );
-    virtual void drawWheelBackground( QPainter *, const QRectF & );
+    virtual void drawTicks( QPainter*, const QRectF& );
+    virtual void drawWheelBackground( QPainter*, const QRectF& );
 
-    virtual double valueAt( const QPoint & ) const;
+    virtual double valueAt( const QPoint& ) const;
 
-private:
+  private:
     double alignedValue( double ) const;
     double boundedValue( double ) const;
 
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/qwt_widget_overlay.cpp
===================================================================
--- /trunk/BNC/qwt/qwt_widget_overlay.cpp	(revision 11157)
+++ /trunk/BNC/qwt/qwt_widget_overlay.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,4 +10,5 @@
 #include "qwt_widget_overlay.h"
 #include "qwt_painter.h"
+
 #include <qpainter.h>
 #include <qpaintengine.h>
@@ -16,4 +17,6 @@
 #include <qevent.h>
 
+#include <cstdlib>
+
 static QImage::Format qwtMaskImageFormat()
 {
@@ -24,17 +27,25 @@
 }
 
-static QRegion qwtAlphaMask(
-    const QImage& image, const QVector<QRect> &rects )
+static QRegion qwtAlphaMask( const QImage& image, const QRegion& region )
 {
     const int w = image.width();
     const int h = image.height();
 
-    QRegion region;
+    QRegion mask;
     QRect rect;
 
+#if QT_VERSION >= 0x050800
+    for ( QRegion::const_iterator it = region.cbegin();
+        it != region.cend(); ++it )
+    {
+        const QRect& r = *it;
+#else
+    const QVector< QRect > rects = region.rects();
     for ( int i = 0; i < rects.size(); i++ )
     {
+        const QRect& r = rects[i];
+#endif
         int x1, x2, y1, y2;
-        rects[i].getCoords( &x1, &y1, &x2, &y2 );
+        r.getCoords( &x1, &y1, &x2, &y2 );
 
         x1 = qMax( x1, 0 );
@@ -48,6 +59,6 @@
             int rx0 = -1;
 
-            const uint *line =
-                reinterpret_cast<const uint *> ( image.scanLine( y ) ) + x1;
+            const uint* line =
+                reinterpret_cast< const uint* > ( image.scanLine( y ) ) + x1;
             for ( int x = x1; x <= x2; x++ )
             {
@@ -58,5 +69,5 @@
                     {
                         rect.setCoords( rx0, y, x - 1, y );
-                        region += rect;
+                        mask += rect;
                     }
                     else
@@ -72,19 +83,19 @@
             {
                 rect.setCoords( rx0, y, x2, y );
-                region = region.united( rect );
+                mask = mask.united( rect );
             }
         }
     }
 
-    return region;
+    return mask;
 }
 
 class QwtWidgetOverlay::PrivateData
 {
-public:
-    PrivateData():
-        maskMode( QwtWidgetOverlay::MaskHint ),
-        renderMode( QwtWidgetOverlay::AutoRenderMode ),
-        rgbaBuffer( NULL )
+  public:
+    PrivateData()
+        : maskMode( QwtWidgetOverlay::MaskHint )
+        , renderMode( QwtWidgetOverlay::AutoRenderMode )
+        , rgbaBuffer( NULL )
     {
     }
@@ -99,5 +110,5 @@
         if ( rgbaBuffer )
         {
-            ::free( rgbaBuffer );
+            std::free( rgbaBuffer );
             rgbaBuffer = NULL;
         }
@@ -106,5 +117,5 @@
     MaskMode maskMode;
     RenderMode renderMode;
-    uchar *rgbaBuffer;
+    uchar* rgbaBuffer;
 };
 
@@ -112,9 +123,9 @@
    \brief Constructor
    \param widget Parent widget, where the overlay is aligned to
-*/
-QwtWidgetOverlay::QwtWidgetOverlay( QWidget* widget ):
-    QWidget( widget )
-{
-    d_data = new PrivateData;
+ */
+QwtWidgetOverlay::QwtWidgetOverlay( QWidget* widget )
+    : QWidget( widget )
+{
+    m_data = new PrivateData;
 
     setAttribute( Qt::WA_TransparentForMouseEvents );
@@ -132,5 +143,5 @@
 QwtWidgetOverlay::~QwtWidgetOverlay()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -143,8 +154,8 @@
 void QwtWidgetOverlay::setMaskMode( MaskMode mode )
 {
-    if ( mode != d_data->maskMode )
-    {
-        d_data->maskMode = mode;
-        d_data->resetRgbaBuffer();
+    if ( mode != m_data->maskMode )
+    {
+        m_data->maskMode = mode;
+        m_data->resetRgbaBuffer();
     }
 }
@@ -156,5 +167,5 @@
 QwtWidgetOverlay::MaskMode QwtWidgetOverlay::maskMode() const
 {
-    return d_data->maskMode;
+    return m_data->maskMode;
 }
 
@@ -164,8 +175,8 @@
 
    \sa RenderMode, renderMode()
-*/
+ */
 void QwtWidgetOverlay::setRenderMode( RenderMode mode )
 {
-    d_data->renderMode = mode;
+    m_data->renderMode = mode;
 }
 
@@ -176,5 +187,5 @@
 QwtWidgetOverlay::RenderMode QwtWidgetOverlay::renderMode() const
 {
-    return d_data->renderMode;
+    return m_data->renderMode;
 }
 
@@ -190,13 +201,13 @@
 void QwtWidgetOverlay::updateMask()
 {
-    d_data->resetRgbaBuffer();
+    m_data->resetRgbaBuffer();
 
     QRegion mask;
 
-    if ( d_data->maskMode == QwtWidgetOverlay::MaskHint )
+    if ( m_data->maskMode == QwtWidgetOverlay::MaskHint )
     {
         mask = maskHint();
     }
-    else if ( d_data->maskMode == QwtWidgetOverlay::AlphaMask )
+    else if ( m_data->maskMode == QwtWidgetOverlay::AlphaMask )
     {
         // TODO: the image doesn't need to be larger than
@@ -211,7 +222,7 @@
         // QImage::fill( 0 ) or memset()
 
-        d_data->rgbaBuffer = ( uchar* )::calloc( width() * height(), 4 );
-
-        QImage image( d_data->rgbaBuffer,
+        m_data->rgbaBuffer = ( uchar* )::calloc( width() * height(), 4 );
+
+        QImage image( m_data->rgbaBuffer,
             width(), height(), qwtMaskImageFormat() );
 
@@ -220,10 +231,10 @@
         painter.end();
 
-        mask = qwtAlphaMask( image, hint.rects() );
-
-        if ( d_data->renderMode == QwtWidgetOverlay::DrawOverlay )
+        mask = qwtAlphaMask( image, hint );
+
+        if ( m_data->renderMode == QwtWidgetOverlay::DrawOverlay )
         {
             // we don't need the buffer later
-            d_data->resetRgbaBuffer();
+            m_data->resetRgbaBuffer();
         }
     }
@@ -243,21 +254,21 @@
 
 /*!
-  Paint event
-  \param event Paint event
-
-  \sa drawOverlay()
-*/
+   Paint event
+   \param event Paint event
+
+   \sa drawOverlay()
+ */
 void QwtWidgetOverlay::paintEvent( QPaintEvent* event )
 {
-    const QRegion &clipRegion = event->region();
+    const QRegion& clipRegion = event->region();
 
     QPainter painter( this );
 
     bool useRgbaBuffer = false;
-    if ( d_data->renderMode == QwtWidgetOverlay::CopyAlphaMask )
+    if ( m_data->renderMode == QwtWidgetOverlay::CopyAlphaMask )
     {
         useRgbaBuffer = true;
     }
-    else if ( d_data->renderMode == QwtWidgetOverlay::AutoRenderMode )
+    else if ( m_data->renderMode == QwtWidgetOverlay::AutoRenderMode )
     {
         if ( painter.paintEngine()->type() == QPaintEngine::Raster )
@@ -265,25 +276,36 @@
     }
 
-    if ( d_data->rgbaBuffer && useRgbaBuffer )
-    {
-        const QImage image( d_data->rgbaBuffer,
+    if ( m_data->rgbaBuffer && useRgbaBuffer )
+    {
+        const QImage image( m_data->rgbaBuffer,
             width(), height(), qwtMaskImageFormat() );
 
-        QVector<QRect> rects;
-        if ( clipRegion.rects().size() > 2000 )
+        const int rectCount = clipRegion.rectCount();
+
+        if ( rectCount > 2000 )
         {
             // the region is to complex
             painter.setClipRegion( clipRegion );
-            rects += clipRegion.boundingRect();
+
+            const QRect r = clipRegion.boundingRect();
+            painter.drawImage( r.topLeft(), image, r );
         }
         else
         {
-            rects = clipRegion.rects();
-        }
-
-        for ( int i = 0; i < rects.size(); i++ )
-        {
-            const QRect r = rects[i];
-            painter.drawImage( r.topLeft(), image, r );
+#if QT_VERSION >= 0x050800
+            for ( QRegion::const_iterator it = clipRegion.cbegin();
+                it != clipRegion.cend(); ++it )
+            {
+                const QRect& r = *it;
+                painter.drawImage( r.topLeft(), image, r );
+            }
+#else
+            const QVector< QRect > rects = clipRegion.rects();
+            for ( int i = 0; i < rects.size(); i++ )
+            {
+                const QRect& r = rects[i];
+                painter.drawImage( r.topLeft(), image, r );
+            }
+#endif
         }
     }
@@ -296,20 +318,19 @@
 
 /*!
-  Resize event
-  \param event Resize event
-*/
+   Resize event
+   \param event Resize event
+ */
 void QwtWidgetOverlay::resizeEvent( QResizeEvent* event )
 {
     Q_UNUSED( event );
 
-    d_data->resetRgbaBuffer();
-}
-
-void QwtWidgetOverlay::draw( QPainter *painter ) const
-{
-    QWidget *widget = const_cast< QWidget *>( parentWidget() );
-    if ( widget )
-    {
-        painter->setClipRect( parentWidget()->contentsRect() );
+    m_data->resetRgbaBuffer();
+}
+
+void QwtWidgetOverlay::draw( QPainter* painter ) const
+{
+    if ( QWidget* widget = parentWidget() )
+    {
+        painter->setClipRect( widget->contentsRect() );
 
         // something special for the plot canvas
@@ -324,5 +345,5 @@
                 Q_RETURN_ARG( QPainterPath, clipPath ), Q_ARG( QRect, rect() ) );
 
-            if (!clipPath.isEmpty())
+            if (!clipPath.isEmpty() )
                 painter->setClipPath( clipPath, Qt::IntersectClip );
         }
@@ -356,13 +377,13 @@
 
 /*!
-  \brief Event filter
-
-  Resize the overlay according to the size of the parent widget.
-
-  \param object Object to be filtered
-  \param event Event
-
-  \return See QObject::eventFilter()
-*/
+   \brief Event filter
+
+   Resize the overlay according to the size of the parent widget.
+
+   \param object Object to be filtered
+   \param event Event
+
+   \return See QObject::eventFilter()
+ */
 
 bool QwtWidgetOverlay::eventFilter( QObject* object, QEvent* event )
@@ -370,5 +391,5 @@
     if ( object == parent() && event->type() == QEvent::Resize )
     {
-        QResizeEvent *resizeEvent = static_cast<QResizeEvent *>( event );
+        QResizeEvent* resizeEvent = static_cast< QResizeEvent* >( event );
         resize( resizeEvent->size() );
     }
@@ -376,2 +397,4 @@
     return QObject::eventFilter( object, event );
 }
+
+#include "moc_qwt_widget_overlay.cpp"
Index: /trunk/BNC/qwt/qwt_widget_overlay.h
===================================================================
--- /trunk/BNC/qwt/qwt_widget_overlay.h	(revision 11157)
+++ /trunk/BNC/qwt/qwt_widget_overlay.h	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,7 +13,7 @@
 #include "qwt_global.h"
 #include <qwidget.h>
-#include <qregion.h>
 
 class QPainter;
+class QRegion;
 
 /*!
@@ -38,7 +38,9 @@
    \sa QwtPlotCanvas::BackingStore
  */
-class QWT_EXPORT QwtWidgetOverlay: public QWidget
+class QWT_EXPORT QwtWidgetOverlay : public QWidget
 {
-public:
+    Q_OBJECT
+
+  public:
     /*!
        \brief Mask mode
@@ -112,5 +114,5 @@
     };
 
-    QwtWidgetOverlay( QWidget* );
+    explicit QwtWidgetOverlay( QWidget* );
     virtual ~QwtWidgetOverlay();
 
@@ -121,11 +123,12 @@
     RenderMode renderMode() const;
 
+    virtual bool eventFilter( QObject*, QEvent*) QWT_OVERRIDE;
+
+  public Q_SLOTS:
     void updateOverlay();
 
-    virtual bool eventFilter( QObject *, QEvent *);
-
-protected:
-    virtual void paintEvent( QPaintEvent* event );
-    virtual void resizeEvent( QResizeEvent* event );
+  protected:
+    virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
+    virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
 
     virtual QRegion maskHint() const;
@@ -135,13 +138,13 @@
        \param painter Painter
      */
-    virtual void drawOverlay( QPainter *painter ) const = 0;
+    virtual void drawOverlay( QPainter* painter ) const = 0;
 
-private:
+  private:
     void updateMask();
-    void draw( QPainter * ) const;
+    void draw( QPainter* ) const;
 
-private:
+  private:
     class PrivateData;
-    PrivateData *d_data;
+    PrivateData* m_data;
 };
 
Index: /trunk/BNC/qwt/src.pri
===================================================================
--- /trunk/BNC/qwt/src.pri	(revision 11157)
+++ /trunk/BNC/qwt/src.pri	(revision 11158)
@@ -12,7 +12,7 @@
     qwt.h \
     qwt_abstract_scale_draw.h \
+    qwt_bezier.h \
     qwt_clipper.h \
     qwt_color_map.h \
-    qwt_compat.h \
     qwt_column_symbol.h \
     qwt_date.h \
@@ -41,4 +41,10 @@
     qwt_scale_map.h \
     qwt_spline.h \
+    qwt_spline_basis.h \
+    qwt_spline_parametrization.h \
+    qwt_spline_local.h \
+    qwt_spline_cubic.h \
+    qwt_spline_pleasing.h \
+    qwt_spline_polynomial.h \
     qwt_symbol.h \
     qwt_system_clock.h \
@@ -50,5 +56,7 @@
 
 SOURCES += \
+    qwt.cpp \
     qwt_abstract_scale_draw.cpp \
+    qwt_bezier.cpp \
     qwt_clipper.cpp \
     qwt_color_map.cpp \
@@ -77,6 +85,12 @@
     qwt_scale_draw.cpp \
     qwt_scale_map.cpp \
+    qwt_scale_engine.cpp \
     qwt_spline.cpp \
-    qwt_scale_engine.cpp \
+    qwt_spline_basis.cpp \
+    qwt_spline_parametrization.cpp \
+    qwt_spline_local.cpp \
+    qwt_spline_cubic.cpp \
+    qwt_spline_pleasing.cpp \
+    qwt_spline_polynomial.cpp \
     qwt_symbol.cpp \
     qwt_system_clock.cpp \
@@ -91,5 +105,9 @@
 
     HEADERS += \
+        qwt_axis.h \
+        qwt_axis_id.h \
         qwt_curve_fitter.h \
+        qwt_spline_curve_fitter.h \
+        qwt_weeding_curve_fitter.h \
         qwt_event_pattern.h \
         qwt_abstract_legend.h \
@@ -102,4 +120,5 @@
         qwt_plot_dict.h \
         qwt_plot_directpainter.h \
+        qwt_plot_graphicitem.h \
         qwt_plot_grid.h \
         qwt_plot_histogram.h \
@@ -121,4 +140,6 @@
         qwt_plot_seriesitem.h \
         qwt_plot_shapeitem.h \
+        qwt_plot_vectorfield.h \
+        qwt_plot_abstract_canvas.h \
         qwt_plot_canvas.h \
         qwt_plot_panner.h \
@@ -130,4 +151,5 @@
         qwt_raster_data.h \
         qwt_matrix_raster_data.h \
+        qwt_vectorfield_symbol.h \
         qwt_sampling_thread.h \
         qwt_samples.h \
@@ -139,4 +161,6 @@
     SOURCES += \
         qwt_curve_fitter.cpp \
+        qwt_spline_curve_fitter.cpp \
+        qwt_weeding_curve_fitter.cpp \
         qwt_abstract_legend.cpp \
         qwt_legend.cpp \
@@ -145,9 +169,9 @@
         qwt_plot.cpp \
         qwt_plot_renderer.cpp \
-        qwt_plot_xml.cpp \
         qwt_plot_axis.cpp \
         qwt_plot_curve.cpp \
         qwt_plot_dict.cpp \
         qwt_plot_directpainter.cpp \
+        qwt_plot_graphicitem.cpp \
         qwt_plot_grid.cpp \
         qwt_plot_histogram.cpp \
@@ -165,7 +189,9 @@
         qwt_plot_seriesitem.cpp \
         qwt_plot_shapeitem.cpp \
+        qwt_plot_vectorfield.cpp \
         qwt_plot_marker.cpp \
         qwt_plot_textlabel.cpp \
         qwt_plot_layout.cpp \
+        qwt_plot_abstract_canvas.cpp \
         qwt_plot_canvas.cpp \
         qwt_plot_panner.cpp \
@@ -178,4 +204,5 @@
         qwt_raster_data.cpp \
         qwt_matrix_raster_data.cpp \
+        qwt_vectorfield_symbol.cpp \
         qwt_sampling_thread.cpp \
         qwt_series_data.cpp \
@@ -185,9 +212,32 @@
     contains(QWT_CONFIG, QwtOpenGL) {
 
-        HEADERS += \
-            qwt_plot_glcanvas.h
-
-        SOURCES += \
-            qwt_plot_glcanvas.cpp
+        lessThan(QT_MAJOR_VERSION, 6) {
+
+            HEADERS += \
+                qwt_plot_glcanvas.h
+
+            SOURCES += \
+                qwt_plot_glcanvas.cpp
+        }
+
+        greaterThan(QT_MAJOR_VERSION, 4) {
+
+            lessThan( QT_MAJOR_VERSION, 6) {
+
+                greaterThan(QT_MINOR_VERSION, 3) {
+
+                    HEADERS += qwt_plot_opengl_canvas.h
+                    SOURCES += qwt_plot_opengl_canvas.cpp
+                }
+            }
+            else {
+                QT += openglwidgets
+
+                HEADERS += qwt_plot_opengl_canvas.h
+                SOURCES += qwt_plot_opengl_canvas.cpp
+            }
+            
+        }
+
     }
 
@@ -199,4 +249,40 @@
         SOURCES += \
             qwt_plot_svgitem.cpp
+    }
+
+    contains(QWT_CONFIG, QwtPolar) {
+
+        HEADERS += \
+            qwt_polar.h \
+            qwt_polar_canvas.h \
+            qwt_polar_curve.h \
+            qwt_polar_fitter.h \
+            qwt_polar_grid.h \
+            qwt_polar_itemdict.h \
+            qwt_polar_item.h \
+            qwt_polar_layout.h \
+            qwt_polar_magnifier.h \
+            qwt_polar_marker.h \
+            qwt_polar_panner.h \
+            qwt_polar_picker.h \
+            qwt_polar_plot.h \
+            qwt_polar_renderer.h \
+            qwt_polar_spectrogram.h
+
+        SOURCES += \
+            qwt_polar_canvas.cpp \
+            qwt_polar_curve.cpp \
+            qwt_polar_fitter.cpp \
+            qwt_polar_grid.cpp \
+            qwt_polar_item.cpp \
+            qwt_polar_itemdict.cpp \
+            qwt_polar_layout.cpp \
+            qwt_polar_magnifier.cpp \
+            qwt_polar_marker.cpp \
+            qwt_polar_panner.cpp \
+            qwt_polar_picker.cpp \
+            qwt_polar_plot.cpp \
+            qwt_polar_renderer.cpp \
+            qwt_polar_spectrogram.cpp
     }
 }
@@ -229,4 +315,17 @@
 
 contains(QWT_CONFIG, QwtOpenGL) {
+
+   greaterThan(QT_MAJOR_VERSION, 4) {
+
+        qtHaveModule(opengl) {
+            QT += opengl
+        }
+        else {
+            warning("QwtOpenGL is enabled in qwtconfig.pri, but Qt has not been built with opengl support")
+        }
+    }
+    else {
+        QT += opengl
+    }
 
     QT += opengl
Index: /trunk/BNC/src/bncmain.cpp
===================================================================
--- /trunk/BNC/src/bncmain.cpp	(revision 11157)
+++ /trunk/BNC/src/bncmain.cpp	(revision 11158)
@@ -47,4 +47,5 @@
 #include <QApplication>
 #include <QFile>
+#include <QRegularExpression>
 #include <iostream>
 #include <QNetworkProxyFactory>
@@ -100,4 +101,10 @@
 // Main Program
 /////////////////////////////////////////////////////////////////////////////
+// Command line argument matches the option pattern, e.g. "--?conf"
+////////////////////////////////////////////////////////////////////////////
+static bool isOption(const char* arg, const char* pattern) {
+  return QRegularExpression(QRegularExpression::anchoredPattern(pattern)).match(arg).hasMatch();
+}
+
 int main(int argc, char* argv[]) {
 
@@ -405,24 +412,24 @@
 
     for (int ii = 1; ii < argc; ii++) {
-        if (QRegExp("--?help").exactMatch(argv[ii])) {
+        if (isOption(argv[ii], "--?help")) {
             cout << printHelp.data();
             exit(0);
         }
-        if (QRegExp("--?nw").exactMatch(argv[ii])) {
+        if (isOption(argv[ii], "--?nw")) {
             interactive = false;
         }
-        if (QRegExp("--?version").exactMatch(argv[ii])) {
+        if (isOption(argv[ii], "--?version")) {
             cout << BNCPGMNAME << endl;
             exit(0);
         }
-        if (QRegExp("--?display").exactMatch(argv[ii])) {
+        if (isOption(argv[ii], "--?display")) {
             displaySet = true;
             strcpy(argv[ii], "-display"); // make it "-display" not "--display"
         }
         if (ii + 1 < argc) {
-            if (QRegExp("--?conf").exactMatch(argv[ii])) {
+            if (isOption(argv[ii], "--?conf")) {
                 confFileName = QString(argv[ii + 1]);
             }
-            if (QRegExp("--?file").exactMatch(argv[ii])) {
+            if (isOption(argv[ii], "--?file")) {
                 interactive = false;
                 rawFileName = QByteArray(argv[ii + 1]);
@@ -479,5 +486,5 @@
 
     for (int ii = 1; ii < argc - 2; ii++) {
-        if (QRegExp("--?key").exactMatch(argv[ii])) {
+        if (isOption(argv[ii], "--?key")) {
             QString key(argv[ii + 1]);
             QString val(argv[ii + 2]);
Index: /trunk/BNC/src/bncmap_svg.cpp
===================================================================
--- /trunk/BNC/src/bncmap_svg.cpp	(revision 11157)
+++ /trunk/BNC/src/bncmap_svg.cpp	(revision 11158)
@@ -44,4 +44,5 @@
 #include <QPushButton>
 
+#include <qwt_text.h>
 #include <qwt_symbol.h>
 #include <qwt_plot.h>
Index: /trunk/BNC/src/bncserialport.cpp
===================================================================
--- /trunk/BNC/src/bncserialport.cpp	(revision 11157)
+++ /trunk/BNC/src/bncserialport.cpp	(revision 11158)
@@ -39,4 +39,5 @@
  * -----------------------------------------------------------------------*/
 
+#include <QRegularExpression>
 #include <iostream>
 
@@ -184,5 +185,5 @@
        !_serialLonLineEdit->text().isEmpty() ) {
     mountPoints->push_back("//"
-      + _serialPortLineEdit->text().replace("/","-").replace(QRegExp("^[-]"), "") + "@"
+      + _serialPortLineEdit->text().replace("/","-").replace(QRegularExpression("^[-]"), "") + "@"
       + _serialDataBits + "-"
       + _serialParity + "-"
Index: /trunk/BNC/src/bncutils.cpp
===================================================================
--- /trunk/BNC/src/bncutils.cpp	(revision 11157)
+++ /trunk/BNC/src/bncutils.cpp	(revision 11158)
@@ -43,5 +43,5 @@
 #include <math.h>
 
-#include <QRegExp>
+#include <QRegularExpression>
 #include <QStringList>
 #include <QDateTime>
@@ -156,18 +156,23 @@
 }
 
-//
+// Replace each ${NAME} by the environment variable NAME (empty if not set);
+// BNC's own file name placeholders are kept
 ////////////////////////////////////////////////////////////////////////////
 void expandEnvVar(QString& str) {
 
-  QRegExp rx("(\\$\\{.+\\})");
-
-  if (rx.indexIn(str) != -1) {
-    QStringListIterator it(rx.capturedTexts());
-    if (it.hasNext()) {
-      QString rxStr  = it.next();
-      QString envVar = rxStr.mid(2,rxStr.length()-3);
-      str.replace(rxStr, qgetenv(envVar.toLatin1()));
-    }
-  }
+  static const QStringList placeholders = QStringList() << "GPSWD" << "V3OBS" << "V3PROD";
+
+  QString result;
+  int     last = 0;
+  QRegularExpressionMatchIterator it = QRegularExpression("\\$\\{([^}]+)\\}").globalMatch(str);
+  while (it.hasNext()) {
+    QRegularExpressionMatch match = it.next();
+    QString name = match.captured(1);
+    result += str.mid(last, match.capturedStart() - last);
+    result += placeholders.contains(name) ? match.captured(0)
+                                          : QString::fromUtf8(qgetenv(name.toLatin1()));
+    last = match.capturedEnd();
+  }
+  str = result + str.mid(last);
 }
 
Index: /trunk/BNC/src/combination/bnccomb.cpp
===================================================================
--- /trunk/BNC/src/combination/bnccomb.cpp	(revision 11157)
+++ /trunk/BNC/src/combination/bnccomb.cpp	(revision 11158)
@@ -15,4 +15,5 @@
  * -----------------------------------------------------------------------*/
 
+#include <QRegularExpression>
 #include <newmatio.h>
 #include <iomanip>
@@ -188,5 +189,5 @@
       newAC->name           = hlp[1];
       newAC->weightFactor   = hlp[2].toDouble();
-      newAC->excludeSats    = hlp[3].split(QRegExp("[ ,]"), Qt::SkipEmptyParts);
+      newAC->excludeSats    = hlp[3].split(QRegularExpression("[ ,]"), Qt::SkipEmptyParts);
       newAC->isAPC          = bool(newAC->mountPoint.mid(0,4) == "SSRA");
       newAC->attitudeSource = (hlp.size() > 4) ? hlp[4] : "Computed";
Index: /trunk/BNC/src/ephemeris.cpp
===================================================================
--- /trunk/BNC/src/ephemeris.cpp	(revision 11157)
+++ /trunk/BNC/src/ephemeris.cpp	(revision 11158)
@@ -305,5 +305,6 @@
 // Constructor
 //////////////////////////////////////////////////////////////////////////////
-t_ephGPS::t_ephGPS(double rnxVersion, const QStringList &lines, QString typeStr) {
+t_ephGPS::t_ephGPS(double rnxVersion, const QStringList &lines, QString typeStr)
+  : t_ephGPS() { // all members initialized, also those not in the record type
 
   setType(typeStr);
@@ -1862,5 +1863,6 @@
 // Constructor
 //////////////////////////////////////////////////////////////////////////////
-t_ephGal::t_ephGal(double rnxVersion, const QStringList &lines, const QString typeStr) {
+t_ephGal::t_ephGal(double rnxVersion, const QStringList &lines, const QString typeStr)
+  : t_ephGal() { // all members initialized, also those not in the record type
 
   setType(typeStr);
@@ -2325,5 +2327,6 @@
 // Constructor
 //////////////////////////////////////////////////////////////////////////////
-t_ephSBAS::t_ephSBAS(double rnxVersion, const QStringList &lines, const QString typeStr) {
+t_ephSBAS::t_ephSBAS(double rnxVersion, const QStringList &lines, const QString typeStr)
+  : t_ephSBAS() { // all members initialized, also those not in the record type
 
   setType(typeStr);
@@ -2571,5 +2574,6 @@
 // Constructor
 //////////////////////////////////////////////////////////////////////////////
-t_ephBDS::t_ephBDS(double rnxVersion, const QStringList &lines, const QString typeStr) {
+t_ephBDS::t_ephBDS(double rnxVersion, const QStringList &lines, const QString typeStr)
+  : t_ephBDS() { // all members initialized, also those not in the record type
 
   setType(typeStr);
Index: /trunk/BNC/src/map/bncmapwin.cpp
===================================================================
--- /trunk/BNC/src/map/bncmapwin.cpp	(revision 11157)
+++ /trunk/BNC/src/map/bncmapwin.cpp	(revision 11158)
@@ -49,5 +49,5 @@
   _initMap = false;
 
-  const int ww = QFontMetrics(font()).width('w');
+  const int ww = QFontMetrics(font()).horizontalAdvance('w');
 
   setWindowTitle("BNC: Map View");
Index: /trunk/BNC/src/orbComp/sp3Comp.cpp
===================================================================
--- /trunk/BNC/src/orbComp/sp3Comp.cpp	(revision 11157)
+++ /trunk/BNC/src/orbComp/sp3Comp.cpp	(revision 11158)
@@ -39,4 +39,5 @@
  * -----------------------------------------------------------------------*/
 
+#include <QRegularExpression>
 #include <iostream>
 #include <iomanip>
@@ -54,5 +55,5 @@
 
   bncSettings settings;
-  _sp3FileNames = settings.value("sp3CompFile").toString().split(QRegExp("[ ,]"), Qt::SkipEmptyParts);
+  _sp3FileNames = settings.value("sp3CompFile").toString().split(QRegularExpression("[ ,]"), Qt::SkipEmptyParts);
   for (int ii = 0; ii < _sp3FileNames.size(); ii++) {
     expandEnvVar(_sp3FileNames[ii]);
@@ -62,5 +63,5 @@
   _log         = 0;
 
-  _excludeSats = settings.value("sp3CompExclude").toString().split(QRegExp("[ ,]"), Qt::SkipEmptyParts);
+  _excludeSats = settings.value("sp3CompExclude").toString().split(QRegularExpression("[ ,]"), Qt::SkipEmptyParts);
 
   _summaryOnly = (Qt::CheckState(settings.value("sp3CompSummaryOnly").toInt()) == Qt::Checked);
Index: /trunk/BNC/src/qtfilechooser.cpp
===================================================================
--- /trunk/BNC/src/qtfilechooser.cpp	(revision 11157)
+++ /trunk/BNC/src/qtfilechooser.cpp	(revision 11158)
@@ -28,5 +28,5 @@
 
   QHBoxLayout* layout = new QHBoxLayout( this );
-  layout->setMargin(0);
+  layout->setContentsMargins(0, 0, 0, 0);
 
   _lineEdit = new QLineEdit(this);
Index: /trunk/BNC/src/rinex/graphwin.cpp
===================================================================
--- /trunk/BNC/src/rinex/graphwin.cpp	(revision 11157)
+++ /trunk/BNC/src/rinex/graphwin.cpp	(revision 11158)
@@ -41,7 +41,9 @@
 #include <qwt_scale_widget.h>
 #include <qwt_scale_engine.h>
+#include <qwt_interval.h>
 
 #include <QDir>
 #include <QFileInfo>
+#include <QPainter>
 #include <QHBoxLayout>
 #include <QVBoxLayout>
@@ -174,9 +176,11 @@
     QPainter painter;
     painter.begin(&printer);
-    double xscale = printer.pageRect().width()/double(_canvas->width());
-    double yscale = printer.pageRect().height()/double(_canvas->height());
+    QRect pageRect  = printer.pageLayout().paintRectPixels(printer.resolution());
+    QRect paperRect = printer.pageLayout().fullRectPixels(printer.resolution());
+    double xscale = pageRect.width()/double(_canvas->width());
+    double yscale = pageRect.height()/double(_canvas->height());
     double scale  = qMin(xscale, yscale);
-    painter.translate(printer.paperRect().x() + printer.pageRect().width()/2,
-                      printer.paperRect().y() + printer.pageRect().height()/2);
+    painter.translate(paperRect.x() + pageRect.width()/2,
+                      paperRect.y() + pageRect.height()/2);
     painter.scale(scale, scale);
     painter.translate(-width()/2, -height()/2);
Index: /trunk/BNC/src/rinex/polarplot.cpp
===================================================================
--- /trunk/BNC/src/rinex/polarplot.cpp	(revision 11157)
+++ /trunk/BNC/src/rinex/polarplot.cpp	(revision 11158)
@@ -31,9 +31,10 @@
                                const QPointF& pole, int from, int to) const {
   t_colorMap colorMap;
+  const t_polarData* polarData = dynamic_cast<const t_polarData*>(data());
   for (int ii = from; ii <= to; ii++) {
     QwtSymbol ss(symbol.style());
     ss.setSize(symbol.size());
-    const QwtPointPolar& point = sample(ii);
-    const QColor color = colorMap.color(_scaleInterval, point._value);
+    double value = polarData ? polarData->value(ii) : 0.0;
+    const QColor color = colorMap.color(_scaleInterval, value);
     ss.setBrush(QBrush(color));
     ss.setPen(QPen(color));
Index: /trunk/BNC/src/rinex/polarplot.h
===================================================================
--- /trunk/BNC/src/rinex/polarplot.h	(revision 11157)
+++ /trunk/BNC/src/rinex/polarplot.h	(revision 11158)
@@ -51,9 +51,9 @@
   virtual QwtPointPolar sample(size_t ii) const {
     const t_polarPoint* point = _data->at(ii);
-    QwtPointPolar qp(point->_az, point->_zen);  qp._value = point->_value;
-    return qp;
+    return QwtPointPolar(point->_az, point->_zen);
   }
+  double value(size_t ii) const {return _data->at(ii)->_value;} // symbol color
   virtual size_t size() const {return _size;}
-  virtual QRectF boundingRect() const {return d_boundingRect;}
+  virtual QRectF boundingRect() const {return cachedBoundingRect;}
  protected:
   size_t _size;
Index: /trunk/BNC/src/rinex/reqcanalyze.cpp
===================================================================
--- /trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 11157)
+++ /trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 11158)
@@ -39,4 +39,5 @@
  * -----------------------------------------------------------------------*/
 
+#include <QRegularExpression>
 #include <iostream>
 #include <iomanip>
@@ -152,5 +153,5 @@
 
   for (int ii = 0; ii < signalsOpt.size(); ii++) {
-    QStringList input = signalsOpt.at(ii).split(QRegExp("[:&]"), Qt::SkipEmptyParts);
+    QStringList input = signalsOpt.at(ii).split(QRegularExpression("[:&]"), Qt::SkipEmptyParts);
     if (input.size() > 1 && input[0].length() == 1) {
       char        system   = input[0].toLatin1().constData()[0];
Index: /trunk/BNC/src/rinex/reqcedit.cpp
===================================================================
--- /trunk/BNC/src/rinex/reqcedit.cpp	(revision 11157)
+++ /trunk/BNC/src/rinex/reqcedit.cpp	(revision 11158)
@@ -39,4 +39,5 @@
  * -----------------------------------------------------------------------*/
 
+#include <QRegularExpression>
 #include <iostream>
 #include "reqcedit.h"
@@ -412,5 +413,5 @@
   if (!newMarkerName.isEmpty()) {
     if (oldMarkerName.isEmpty() ||
-        QRegExp(oldMarkerName).exactMatch(obsFile.markerName())) {
+        QRegularExpression(QRegularExpression::anchoredPattern(oldMarkerName)).match(obsFile.markerName()).hasMatch()) {
       obsFile.setMarkerName(newMarkerName);
     }
@@ -421,5 +422,5 @@
   if (!newAntennaName.isEmpty()) {
     if (oldAntennaName.isEmpty() ||
-        QRegExp(oldAntennaName).exactMatch(obsFile.antennaName())) {
+        QRegularExpression(QRegularExpression::anchoredPattern(oldAntennaName)).match(obsFile.antennaName()).hasMatch()) {
       obsFile.setAntennaName(newAntennaName);
     }
@@ -430,5 +431,5 @@
   if (!newAntennaNumber.isEmpty()) {
     if (oldAntennaNumber.isEmpty() ||
-        QRegExp(oldAntennaNumber).exactMatch(obsFile.antennaNumber())) {
+        QRegularExpression(QRegularExpression::anchoredPattern(oldAntennaNumber)).match(obsFile.antennaNumber()).hasMatch()) {
       obsFile.setAntennaNumber(newAntennaNumber);
     }
@@ -465,5 +466,5 @@
   if (!newReceiverType.isEmpty()) {
     if (oldReceiverType.isEmpty() ||
-        QRegExp(oldReceiverType).exactMatch(obsFile.receiverType())) {
+        QRegularExpression(QRegularExpression::anchoredPattern(oldReceiverType)).match(obsFile.receiverType()).hasMatch()) {
       obsFile.setReceiverType(newReceiverType);
     }
@@ -474,5 +475,5 @@
   if (!newReceiverNumber.isEmpty()) {
     if (oldReceiverNumber.isEmpty() ||
-        QRegExp(oldReceiverNumber).exactMatch(obsFile.receiverNumber())) {
+        QRegularExpression(QRegularExpression::anchoredPattern(oldReceiverNumber)).match(obsFile.receiverNumber()).hasMatch()) {
       obsFile.setReceiverNumber(newReceiverNumber);
     }
Index: /trunk/BNC/src/rinex/rnxnavfile.cpp
===================================================================
--- /trunk/BNC/src/rinex/rnxnavfile.cpp	(revision 11157)
+++ /trunk/BNC/src/rinex/rnxnavfile.cpp	(revision 11158)
@@ -39,4 +39,5 @@
  * -----------------------------------------------------------------------*/
 
+#include <QRegularExpression>
 #include <iostream>
 #include <newmatio.h>
@@ -159,5 +160,5 @@
     }
 
-    QStringList hlp = line.split(QRegExp("\\s+"), Qt::SkipEmptyParts);
+    QStringList hlp = line.split(QRegularExpression("\\s+"), Qt::SkipEmptyParts);
     QString firstStr = hlp.at(0);
 
Index: /trunk/BNC/src/serial/qextserialbase.cpp
===================================================================
--- /trunk/BNC/src/serial/qextserialbase.cpp	(revision 11157)
+++ /trunk/BNC/src/serial/qextserialbase.cpp	(revision 11158)
@@ -10,5 +10,5 @@
 */
 #ifdef QT_THREAD_SUPPORT
-QMutex* QextSerialBase::mutex=NULL;
+QRecursiveMutex* QextSerialBase::mutex=NULL;
 unsigned long QextSerialBase::refCount=0;
 #endif
@@ -92,5 +92,5 @@
 #ifdef QT_THREAD_SUPPORT
     if (!mutex) {
-        mutex=new QMutex( QMutex::Recursive );
+        mutex=new QRecursiveMutex();
     }
     refCount++;
Index: /trunk/BNC/src/serial/qextserialbase.h
===================================================================
--- /trunk/BNC/src/serial/qextserialbase.h	(revision 11157)
+++ /trunk/BNC/src/serial/qextserialbase.h	(revision 11158)
@@ -185,5 +185,5 @@
 
 #ifdef QT_THREAD_SUPPORT
-    static QMutex* mutex;
+    static QRecursiveMutex* mutex;
     static ulong refCount;
 #endif
Index: /trunk/BNC/src/src.pri
===================================================================
--- /trunk/BNC/src/src.pri	(revision 11157)
+++ /trunk/BNC/src/src.pri	(revision 11158)
@@ -39,5 +39,6 @@
 #debug:DEFINES   += BNC_DEBUG_SSR
 #debug:DEFINES   += BNC_DEBUG_CMB
-#debug:DEFINES   += QT_DISABLE_DEPRECATED_BEFORE=0x050F00
+# Deprecated Qt APIs (up to Qt 5.15) are not available, using one is an error
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00
 
 !versionAtLeast(QT_VERSION, 5.15.0):error("Use at least Qt version 5.15.0")
@@ -46,11 +47,11 @@
 # ------------
 INCLUDEPATH += . ../newmat ./RTCM3 ./RTCM3/clock_and_orbit ./RTCM \
-               ../qwt ../qwtpolar
+               ../qwt
 
 # Additional Libraries
 # --------------------
-unix:LIBS  += -L../newmat -lnewmat -L../qwt -L../qwtpolar -lqwtpolar -lqwt
-win32:LIBS += -L../newmat/release -L../qwt/release -L../qwtpolar/release \
-              -lnewmat -lqwtpolar -lqwt
+unix:LIBS  += -L../newmat -lnewmat -L../qwt -lqwt
+win32:LIBS += -L../newmat/release -L../qwt/release \
+              -lnewmat -lqwt
 
 HEADERS = bnchelp.html bncgetthread.h ssrQc.h ssrRefSig.h bncwindow.h   bnctabledlg.h  \
