source: ntrip/trunk/BNC/qwt/qwt_legend_data.h@ 8330

Last change on this file since 8330 was 8127, checked in by stoecker, 8 years ago

update qwt and qwtpolar, many QT5 fixes (unfinished)

File size: 2.1 KB
Line 
1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#ifndef QWT_LEGEND_DATA_H
11#define QWT_LEGEND_DATA_H
12
13#include "qwt_global.h"
14#include "qwt_text.h"
15#include "qwt_graphic.h"
16#include <qvariant.h>
17#include <qpixmap.h>
18#include <qmap.h>
19
20/*!
21 \brief Attributes of an entry on a legend
22
23 QwtLegendData is an abstract container ( like QAbstractModel )
24 to exchange attributes, that are only known between to
25 the plot item and the legend.
26
27 By overloading QwtPlotItem::legendData() any other set of attributes
28 could be used, that can be handled by a modified ( or completely
29 different ) implementation of a legend.
30
31 \sa QwtLegend, QwtPlotLegendItem
32 \note The stockchart example implements a legend as a tree
33 with checkable items
34 */
35class QWT_EXPORT QwtLegendData
36{
37public:
38 //! Mode defining how a legend entry interacts
39 enum Mode
40 {
41 //! The legend item is not interactive, like a label
42 ReadOnly,
43
44 //! The legend item is clickable, like a push button
45 Clickable,
46
47 //! The legend item is checkable, like a checkable button
48 Checkable
49 };
50
51 //! Identifier how to interprete a QVariant
52 enum Role
53 {
54 // The value is a Mode
55 ModeRole,
56
57 // The value is a title
58 TitleRole,
59
60 // The value is an icon
61 IconRole,
62
63 // Values < UserRole are reserved for internal use
64 UserRole = 32
65 };
66
67 QwtLegendData();
68 ~QwtLegendData();
69
70 void setValues( const QMap<int, QVariant> & );
71 const QMap<int, QVariant> &values() const;
72
73 void setValue( int role, const QVariant & );
74 QVariant value( int role ) const;
75
76 bool hasRole( int role ) const;
77 bool isValid() const;
78
79 QwtGraphic icon() const;
80 QwtText title() const;
81 Mode mode() const;
82
83private:
84 QMap<int, QVariant> d_map;
85};
86
87#endif
Note: See TracBrowser for help on using the repository browser.