Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_plot_item.h


Ignore:
Timestamp:
May 10, 2017, 3:20:54 PM (7 years ago)
Author:
stoecker
Message:

update qwt and qwtpolar, many QT5 fixes (unfinished)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_plot_item.h

    r4271 r8127  
    1212
    1313#include "qwt_global.h"
    14 #include "qwt_legend_itemmanager.h"
    1514#include "qwt_text.h"
     15#include "qwt_legend_data.h"
     16#include "qwt_graphic.h"
    1617#include <qrect.h>
    17 
    18 class QString;
     18#include <qlist.h>
     19#include <qmetatype.h>
     20
    1921class QPainter;
    20 class QWidget;
    21 class QwtPlot;
    22 class QwtLegend;
    2322class QwtScaleMap;
    2423class QwtScaleDiv;
     24class QwtPlot;
    2525
    2626/*!
     
    5151
    5252  Depending on the QwtPlotItem::ItemAttribute flags, an item is included
    53   into autoscaling or has an entry on the legnd.
     53  into autoscaling or has an entry on the legend.
    5454
    5555  Before misusing the existing item classes it might be better to
     
    6262*/
    6363
    64 class QWT_EXPORT QwtPlotItem: public QwtLegendItemManager
     64class QWT_EXPORT QwtPlotItem
    6565{
    6666public:
     
    7373    enum RttiValues
    7474    {
     75        //! Unspecific value, that can be used, when it doesn't matter
    7576        Rtti_PlotItem = 0,
    7677
     78        //! For QwtPlotGrid
    7779        Rtti_PlotGrid,
     80
     81        //! For QwtPlotScaleItem
    7882        Rtti_PlotScale,
     83
     84        //! For QwtPlotLegendItem
     85        Rtti_PlotLegend,
     86
     87        //! For QwtPlotMarker
    7988        Rtti_PlotMarker,
     89
     90        //! For QwtPlotCurve
    8091        Rtti_PlotCurve,
     92
     93        //! For QwtPlotSpectroCurve
    8194        Rtti_PlotSpectroCurve,
     95
     96        //! For QwtPlotIntervalCurve
    8297        Rtti_PlotIntervalCurve,
     98
     99        //! For QwtPlotHistogram
    83100        Rtti_PlotHistogram,
     101
     102        //! For QwtPlotSpectrogram
    84103        Rtti_PlotSpectrogram,
     104
     105        //! For QwtPlotSvgItem
    85106        Rtti_PlotSVG,
    86107
     108        //! For QwtPlotTradingCurve
     109        Rtti_PlotTradingCurve,
     110
     111        //! For QwtPlotBarChart
     112        Rtti_PlotBarChart,
     113
     114        //! For QwtPlotMultiBarChart
     115        Rtti_PlotMultiBarChart,
     116
     117        //! For QwtPlotShapeItem
     118        Rtti_PlotShape,
     119
     120        //! For QwtPlotTextLabel
     121        Rtti_PlotTextLabel,
     122
     123        //! For QwtPlotZoneItem
     124        Rtti_PlotZone,
     125
     126        /*!
     127           Values >= Rtti_PlotUserItem are reserved for plot items
     128           not implemented in the Qwt library.
     129         */
    87130        Rtti_PlotUserItem = 1000
    88131    };
    89132
    90133    /*!
    91        Plot Item Attributes
    92        \sa setItemAttribute(), testItemAttribute()
     134       \brief Plot Item Attributes
     135
     136       Various aspects of a plot widget depend on the attributes of
     137       the attached plot items. If and how a single plot item
     138       participates in these updates depends on its attributes.
     139       
     140       \sa setItemAttribute(), testItemAttribute(), ItemInterest
    93141     */
    94142    enum ItemAttribute
     
    98146
    99147        /*!
    100          The boundingRect() of the item is included in the
    101          autoscaling calculation.
    102          */
    103         AutoScale = 0x02
     148           The boundingRect() of the item is included in the
     149           autoscaling calculation as long as its width or height
     150           is >= 0.0.
     151         */
     152        AutoScale = 0x02,
     153
     154        /*!
     155           The item needs extra space to display something outside
     156           its bounding rectangle.
     157           \sa getCanvasMarginHint()
     158         */
     159        Margins = 0x04
    104160    };
    105161
    106162    //! Plot Item Attributes
    107163    typedef QFlags<ItemAttribute> ItemAttributes;
     164
     165    /*!
     166       \brief Plot Item Interests
     167
     168       Plot items might depend on the situation of the corresponding
     169       plot widget. By enabling an interest the plot item will be
     170       notified, when the corresponding attribute of the plot widgets
     171       has changed.
     172
     173       \sa setItemAttribute(), testItemAttribute(), ItemInterest
     174     */
     175    enum ItemInterest
     176    {
     177        /*!
     178           The item is interested in updates of the scales
     179           \sa updateScaleDiv()
     180         */
     181        ScaleInterest = 0x01,
     182
     183        /*!
     184           The item is interested in updates of the legend ( of other items )
     185           This flag is intended for items, that want to implement a legend
     186           for displaying entries of other plot item.
     187
     188           \note If the plot item wants to be represented on a legend
     189                 enable QwtPlotItem::Legend instead.
     190
     191           \sa updateLegend()
     192         */
     193        LegendInterest = 0x02
     194    };
     195
     196    //! Plot Item Interests
     197    typedef QFlags<ItemInterest> ItemInterests;
    108198
    109199    //! Render hints
     
    111201    {
    112202        //! Enable antialiasing
    113         RenderAntialiased = 1
     203        RenderAntialiased = 0x1
    114204    };
    115205
     
    134224    bool testItemAttribute( ItemAttribute ) const;
    135225
     226    void setItemInterest( ItemInterest, bool on = true );
     227    bool testItemInterest( ItemInterest ) const;
     228
    136229    void setRenderHint( RenderHint, bool on = true );
    137230    bool testRenderHint( RenderHint ) const;
     231
     232    void setRenderThreadCount( uint numThreads );
     233    uint renderThreadCount() const;
     234
     235    void setLegendIconSize( const QSize & );
     236    QSize legendIconSize() const;
    138237
    139238    double z() const;
     
    154253
    155254    virtual void itemChanged();
     255    virtual void legendChanged();
    156256
    157257    /*!
     
    169269    virtual QRectF boundingRect() const;
    170270
    171     virtual void updateLegend( QwtLegend * ) const;
     271    virtual void getCanvasMarginHint(
     272        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
     273        const QRectF &canvasSize,
     274        double &left, double &top, double &right, double &bottom) const;
     275
    172276    virtual void updateScaleDiv(
    173277        const QwtScaleDiv&, const QwtScaleDiv& );
    174278
    175     virtual QWidget *legendItem() const;
     279    virtual void updateLegend( const QwtPlotItem *,
     280        const QList<QwtLegendData> & );
    176281
    177282    QRectF scaleRect( const QwtScaleMap &, const QwtScaleMap & ) const;
    178283    QRectF paintRect( const QwtScaleMap &, const QwtScaleMap & ) const;
     284
     285    virtual QList<QwtLegendData> legendData() const;
     286
     287    virtual QwtGraphic legendIcon( int index, const QSizeF  & ) const;
     288
     289protected:
     290    QwtGraphic defaultIcon( const QBrush &, const QSizeF & ) const;
    179291
    180292private:
     
    188300
    189301Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::ItemAttributes )
     302Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::ItemInterests )
    190303Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::RenderHints )
    191304
     305Q_DECLARE_METATYPE( QwtPlotItem * )
     306
    192307#endif
Note: See TracChangeset for help on using the changeset viewer.