Qwt User's Guide 6.1.4

qwt_legend_data.h
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
35 class QWT_EXPORT QwtLegendData
36 {
37 public:
39 enum Mode
40 {
42 ReadOnly,
43
45 Clickable,
46
48 Checkable
49 };
50
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
83 private:
84 QMap<int, QVariant> d_map;
85 };
86
87 #endif
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtLegendData::ReadOnly
The legend item is not interactive, like a label.
Definition: qwt_legend_data.h:42
QwtLegendData::Clickable
The legend item is clickable, like a push button.
Definition: qwt_legend_data.h:45
QwtLegendData::Role
Role
Identifier how to interprete a QVariant.
Definition: qwt_legend_data.h:52
QwtLegendData
Attributes of an entry on a legend.
Definition: qwt_legend_data.h:35
QwtLegendData::Mode
Mode
Mode defining how a legend entry interacts.
Definition: qwt_legend_data.h:39
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:74