QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_legend_label.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_LABEL_H
28#define QWT_LEGEND_LABEL_H
29
30#include "qwt_global.h"
31#include "qwt_text_label.h"
32#include "qwt_legend_data.h"
33
34class QwtText;
35
43class QWT_EXPORT QwtLegendLabel : public QwtTextLabel
44{
45 Q_OBJECT
46public:
47 // Constructor for QwtLegendLabel
48 explicit QwtLegendLabel(QWidget* parent = nullptr);
49
50 // Destructor for QwtLegendLabel
51 ~QwtLegendLabel() override;
52
53 // Set the legend data
54 void setData(const QwtLegendData&);
55
56 // Return the legend data
57 const QwtLegendData& data() const;
58
59 // Set the item mode
60 void setItemMode(QwtLegendData::Mode);
61
62 // Return the item mode
63 QwtLegendData::Mode itemMode() const;
64
65 // Set the spacing between icon and text
66 void setSpacing(int spacing);
67
68 // Return the spacing
69 int spacing() const;
70
71 // Set the text label
72 virtual void setText(const QwtText&) override;
73
74 // Set the icon
75 void setIcon(const QPixmap&);
76
77 // Return the icon
78 QPixmap icon() const;
79
80 // Return the size hint
81 virtual QSize sizeHint() const override;
82
83 // Return whether the item is checked
84 bool isChecked() const;
85
86public Q_SLOTS:
87 // Set whether the item is checked
88 void setChecked(bool on);
89
90Q_SIGNALS:
94 void clicked();
95
99 void pressed();
100
104 void released();
105
110 void checked(bool);
111
112protected:
114 void setDown(bool);
115
117 bool isDown() const;
118
120 virtual void paintEvent(QPaintEvent*) override;
121
123 virtual void mousePressEvent(QMouseEvent*) override;
124
126 virtual void mouseReleaseEvent(QMouseEvent*) override;
127
129 virtual void keyPressEvent(QKeyEvent*) override;
130
132 virtual void keyReleaseEvent(QKeyEvent*) override;
133
134private:
135 QWT_DECLARE_PRIVATE(QwtLegendLabel)
136};
137
138#endif
Attributes of an entry on a legend
Definition qwt_legend_data.h:49
Mode
Mode defining how a legend entry interacts
Definition qwt_legend_data.h:55
A widget representing an item on a QwtLegend
Definition qwt_legend_label.h:44
void checked(bool)
Signal emitted when the legend item has been toggled
void released()
Signal emitted when the legend item has been released
void clicked()
Signal emitted when the legend item has been clicked
void pressed()
Signal emitted when the legend item has been pressed
A Widget which displays a QwtText
Definition qwt_text_label.h:47
virtual QSize sizeHint() const override
Return a size hint
Definition qwt_text_label.cpp:216
void setText(const QString &, QwtText::TextFormat textFormat=QwtText::AutoText)
Change the label's text, keeping all other QwtText attributes
Definition qwt_text_label.cpp:111
virtual void paintEvent(QPaintEvent *) override
Paint event handler
Definition qwt_text_label.cpp:288
A class representing a text
Definition qwt_text.h:70