QWT API (English) 7.0.1
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
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
52class QWT_EXPORT QwtLegendLabel : public QwtTextLabel
53{
54 Q_OBJECT
55 public:
56 // Constructor for QwtLegendLabel
57 explicit QwtLegendLabel( QWidget* parent = 0 );
58
59 // Destructor for QwtLegendLabel
60 virtual ~QwtLegendLabel();
61
62 // Set the legend data
63 void setData( const QwtLegendData& );
64
65 // Return the legend data
66 const QwtLegendData& data() const;
67
68 // Set the item mode
69 void setItemMode( QwtLegendData::Mode );
70
71 // Return the item mode
72 QwtLegendData::Mode itemMode() const;
73
74 // Set the spacing between icon and text
75 void setSpacing( int spacing );
76
77 // Return the spacing
78 int spacing() const;
79
80 // Set the text label
81 virtual void setText( const QwtText& ) override;
82
83 // Set the icon
84 void setIcon( const QPixmap& );
85
86 // Return the icon
87 QPixmap icon() const;
88
89 // Return the size hint
90 virtual QSize sizeHint() const override;
91
92 // Return whether the item is checked
93 bool isChecked() const;
94
95 public Q_SLOTS:
96 // Set whether the item is checked
97 void setChecked( bool on );
98
99 Q_SIGNALS:
108 void clicked();
109
118 void pressed();
119
128 void released();
129
140 void checked( bool );
141
142 protected:
144 void setDown( bool );
145
147 bool isDown() const;
148
150 virtual void paintEvent( QPaintEvent* ) override;
151
153 virtual void mousePressEvent( QMouseEvent* ) override;
154
156 virtual void mouseReleaseEvent( QMouseEvent* ) override;
157
159 virtual void keyPressEvent( QKeyEvent* ) override;
160
162 virtual void keyReleaseEvent( QKeyEvent* ) override;
163
164 private:
165 class PrivateData;
166 PrivateData* m_data;
167};
168
169#endif
Attributes of an entry on a legend.
Definition qwt_legend_data.h:60
Mode
Mode defining how a legend entry interacts .
Definition qwt_legend_data.h:71
A widget representing an item on a QwtLegend.
Definition qwt_legend_label.h:53
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:55
virtual QSize sizeHint() const override
Return a size hint.
Definition qwt_text_label.cpp:302
void setText(const QString &, QwtText::TextFormat textFormat=QwtText::AutoText)
Change the label's text, keeping all other QwtText attributes.
Definition qwt_text_label.cpp:150
virtual void paintEvent(QPaintEvent *) override
Paint event handler.
Definition qwt_text_label.cpp:394
A class representing a text.
Definition qwt_text.h:93