Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_legend.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_legend.h

    r4271 r8127  
    1212
    1313#include "qwt_global.h"
    14 #include <qframe.h>
    15 #include <qlist.h>
     14#include "qwt_abstract_legend.h"
     15#include <qvariant.h>
    1616
    1717class QScrollBar;
    18 class QwtLegendItemManager;
    1918
    2019/*!
     
    2322  The QwtLegend widget is a tabular arrangement of legend items. Legend
    2423  items might be any type of widget, but in general they will be
    25   a QwtLegendItem.
     24  a QwtLegendLabel.
    2625
    27   \sa QwtLegendItem, QwtLegendItemManager QwtPlot
     26  \sa QwtLegendLabel, QwtPlotItem, QwtPlot
    2827*/
    2928
    30 class QWT_EXPORT QwtLegend : public QFrame
     29class QWT_EXPORT QwtLegend : public QwtAbstractLegend
    3130{
    3231    Q_OBJECT
    3332
    3433public:
    35     /*!
    36       \brief Interaction mode for the legend items
    37 
    38        The default is QwtLegend::ReadOnlyItem.
    39 
    40        \sa setItemMode(), itemMode(), QwtLegendItem::IdentifierMode
    41            QwtLegendItem::clicked(), QwtLegendItem::checked(),
    42            QwtPlot::legendClicked(), QwtPlot::legendChecked()
    43      */
    44 
    45     enum LegendItemMode
    46     {
    47         //! The legend item is not interactive, like a label
    48         ReadOnlyItem,
    49 
    50         //! The legend item is clickable, like a push button
    51         ClickableItem,
    52 
    53         //! The legend item is checkable, like a checkable button
    54         CheckableItem
    55     };
    56 
    5734    explicit QwtLegend( QWidget *parent = NULL );
    5835    virtual ~QwtLegend();
    5936
    60     void setItemMode( LegendItemMode );
    61     LegendItemMode itemMode() const;
     37    void setMaxColumns( uint numColums );
     38    uint maxColumns() const;
     39
     40    void setDefaultItemMode( QwtLegendData::Mode );
     41    QwtLegendData::Mode defaultItemMode() const;
    6242
    6343    QWidget *contentsWidget();
    6444    const QWidget *contentsWidget() const;
    6545
    66     void insert( const QwtLegendItemManager *, QWidget * );
    67     void remove( const QwtLegendItemManager * );
     46    QWidget *legendWidget( const QVariant &  ) const;
     47    QList<QWidget *> legendWidgets( const QVariant & ) const;
    6848
    69     QWidget *find( const QwtLegendItemManager * ) const;
    70     QwtLegendItemManager *find( const QWidget * ) const;
    71 
    72     virtual QList<QWidget *> legendItems() const;
    73 
    74     void clear();
    75 
    76     bool isEmpty() const;
    77     uint itemCount() const;
     49    QVariant itemInfo( const QWidget * ) const;
    7850
    7951    virtual bool eventFilter( QObject *, QEvent * );
     
    8557    QScrollBar *verticalScrollBar() const;
    8658
     59    virtual void renderLegend( QPainter *,
     60        const QRectF &, bool fillBackground ) const;
     61
     62    virtual void renderItem( QPainter *,
     63        const QWidget *, const QRectF &, bool fillBackground ) const;
     64
     65    virtual bool isEmpty() const;
     66    virtual int scrollExtent( Qt::Orientation ) const;
     67
     68Q_SIGNALS:
     69    /*!
     70      A signal which is emitted when the user has clicked on
     71      a legend label, which is in QwtLegendData::Clickable mode.
     72
     73      \param itemInfo Info for the item item of the
     74                      selected legend item
     75      \param index Index of the legend label in the list of widgets
     76                   that are associated with the plot item
     77
     78      \note clicks are disabled as default
     79      \sa setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo()
     80     */
     81    void clicked( const QVariant &itemInfo, int index );
     82
     83    /*!
     84      A signal which is emitted when the user has clicked on
     85      a legend label, which is in QwtLegendData::Checkable mode
     86
     87      \param itemInfo Info for the item of the
     88                      selected legend label
     89      \param index Index of the legend label in the list of widgets
     90                   that are associated with the plot item
     91      \param on True when the legend label is checked
     92
     93      \note clicks are disabled as default
     94      \sa setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo()
     95     */
     96    void checked( const QVariant &itemInfo, bool on, int index );
     97
     98public Q_SLOTS:
     99    virtual void updateLegend( const QVariant &,
     100        const QList<QwtLegendData> & );
     101
     102protected Q_SLOTS:
     103    void itemClicked();
     104    void itemChecked( bool );
     105
    87106protected:
    88     virtual void layoutContents();
     107    virtual QWidget *createWidget( const QwtLegendData & ) const;
     108    virtual void updateWidget( QWidget *widget, const QwtLegendData &data );
    89109
    90110private:
     111    void updateTabOrder();
     112
    91113    class PrivateData;
    92114    PrivateData *d_data;
Note: See TracChangeset for help on using the changeset viewer.