Qwt User's Guide  6.2.0
qwt_legend_data.h
1 /******************************************************************************
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 
15 #include <qvariant.h>
16 #include <qmap.h>
17 
18 class QwtText;
19 class QwtGraphic;
20 
36 class QWT_EXPORT QwtLegendData
37 {
38  public:
40  enum Mode
41  {
44 
47 
49  Checkable
50  };
51 
53  enum Role
54  {
55  // The value is a Mode
56  ModeRole,
57 
58  // The value is a title
59  TitleRole,
60 
61  // The value is an icon
62  IconRole,
63 
64  // Values < UserRole are reserved for internal use
65  UserRole = 32
66  };
67 
68  QwtLegendData();
69  ~QwtLegendData();
70 
71  void setValues( const QMap< int, QVariant >& );
72  const QMap< int, QVariant >& values() const;
73 
74  void setValue( int role, const QVariant& );
75  QVariant value( int role ) const;
76 
77  bool hasRole( int role ) const;
78  bool isValid() const;
79 
80  QwtGraphic icon() const;
81  QwtText title() const;
82  Mode mode() const;
83 
84  private:
86 };
87 
88 #endif
A paint device for scalable graphics.
Definition: qwt_graphic.h:76
Attributes of an entry on a legend.
Role
Identifier how to interpret a QVariant.
Mode
Mode defining how a legend entry interacts.
@ Clickable
The legend item is clickable, like a push button.
@ ReadOnly
The legend item is not interactive, like a label.
A class representing a text.
Definition: qwt_text.h:52