QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_LEGEND_DATA_H
28#define QWT_LEGEND_DATA_H
29
30#include "qwt_global.h"
31
32#include <qvariant.h>
33#include <qmap.h>
34
35class QwtText;
36class QwtGraphic;
37
48class QWT_EXPORT QwtLegendData
49{
50public:
54 enum Mode
55 {
60
65
69 Checkable
70 };
71
75 enum Role
76 {
81
86
91
95 UserRole = 32
96 };
97
98 // Constructor
100 // Copy constructor
102 // Move constructor
103 QwtLegendData(QwtLegendData&&) noexcept = default;
104 // Destructor
105 ~QwtLegendData();
106 // Copy assignment
107 QwtLegendData& operator=(const QwtLegendData&);
108 // Move assignment
109 QwtLegendData& operator=(QwtLegendData&&) noexcept = default;
110
111 // Set all values
112 void setValues(const QMap< int, QVariant >&);
113 // Return all values
114 const QMap< int, QVariant >& values() const;
115
116 // Set a value for a specific role
117 void setValue(int role, const QVariant&);
118 // Return the value for a specific role
119 QVariant value(int role) const;
120
121 // Check if a value exists for a specific role
122 bool hasRole(int role) const;
123 // Check if the legend data is valid
124 bool isValid() const;
125
126 // Return the icon
127 QwtGraphic icon() const;
128 // Return the title
129 QwtText title() const;
130 // Return the mode
131 Mode mode() const;
132
133private:
134 QMap< int, QVariant > m_map;
135};
136
137#endif
Definition qwt_raster_data.h:40
A paint device for scalable graphics
Definition qwt_graphic.h:85
Attributes of an entry on a legend
Definition qwt_legend_data.h:49
Role
Identifier how to interpret a QVariant
Definition qwt_legend_data.h:76
@ ModeRole
The value is a Mode
Definition qwt_legend_data.h:80
@ TitleRole
The value is a title
Definition qwt_legend_data.h:85
@ IconRole
The value is an icon
Definition qwt_legend_data.h:90
Mode
Mode defining how a legend entry interacts
Definition qwt_legend_data.h:55
@ Clickable
The legend item is clickable, like a push button
Definition qwt_legend_data.h:64
@ ReadOnly
The legend item is not interactive, like a label
Definition qwt_legend_data.h:59
QwtLegendData(const QwtLegendData &)
Copy constructor
A class representing a text
Definition qwt_text.h:70