QwtPlotLegendItem.3
14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
.TH "QwtPlotLegendItem" 3 "Sat Jan 26 2013" "Version 6.1-rc3" "Qwt User's Guide" \" -*- nroff -*-
.ad l
.nh
.SH NAME
QwtPlotLegendItem \-
.PP
A class which draws a legend inside the plot canvas\&.
.SH SYNOPSIS
.br
.PP
.PP
\fC#include <qwt_plot_legenditem\&.h>\fP
.PP
Inherits \fBQwtPlotItem\fP\&.
.SS "Public Types"
.in +1c
.ti -1c
.RI "enum \fBBackgroundMode\fP { \fBLegendBackground\fP, \fBItemBackground\fP }"
.br
.RI "\fIBackground mode\&. \fP"
.in -1c
.SS "Public Member Functions"
.in +1c
.ti -1c
.RI "\fBQwtPlotLegendItem\fP ()"
.br
.RI "\fIConstructor\&. \fP"
.ti -1c
.RI "virtual \fB~QwtPlotLegendItem\fP ()"
.br
.RI "\fIDestructor\&. \fP"
.ti -1c
.RI "virtual int \fBrtti\fP () const "
.br
.ti -1c
.RI "void \fBsetAlignment\fP (Qt::Alignment)"
.br
.RI "\fISet the alignmnet\&. \fP"
.ti -1c
.RI "Qt::Alignment \fBalignment\fP () const "
.br
.ti -1c
.RI "void \fBsetMaxColumns\fP (uint)"
.br
.RI "\fILimit the number of columns\&. \fP"
.ti -1c
.RI "uint \fBmaxColumns\fP () const "
.br
.ti -1c
.RI "void \fBsetMargin\fP (int)"
.br
.RI "\fISet the margin around legend items\&. \fP"
.ti -1c
.RI "int \fBmargin\fP () const "
.br
.ti -1c
.RI "void \fBsetSpacing\fP (int)"
.br
.RI "\fISet the spacing between the legend items\&. \fP"
.ti -1c
.RI "int \fBspacing\fP () const "
.br
.ti -1c
.RI "void \fBsetItemMargin\fP (int)"
.br
.ti -1c
.RI "int \fBitemMargin\fP () const "
.br
.ti -1c
.RI "void \fBsetItemSpacing\fP (int)"
.br
.ti -1c
.RI "int \fBitemSpacing\fP () const "
.br
.ti -1c
.RI "void \fBsetFont\fP (const QFont &)"
.br
.ti -1c
.RI "QFont \fBfont\fP () const "
.br
.ti -1c
.RI "void \fBsetBorderDistance\fP (int numPixels)"
.br
.RI "\fISet the margin between the legend and the canvas border\&. \fP"
.ti -1c
.RI "int \fBborderDistance\fP () const "
.br
.ti -1c
.RI "void \fBsetBorderRadius\fP (double)"
.br
.ti -1c
.RI "double \fBborderRadius\fP () const "
.br
.ti -1c
.RI "void \fBsetBorderPen\fP (const QPen &)"
.br
.ti -1c
.RI "QPen \fBborderPen\fP () const "
.br
.ti -1c
.RI "void \fBsetBackgroundBrush\fP (const QBrush &)"
.br
.RI "\fISet the background brush\&. \fP"
.ti -1c
.RI "QBrush \fBbackgroundBrush\fP () const "
.br
.ti -1c
.RI "void \fBsetBackgroundMode\fP (\fBBackgroundMode\fP)"
.br
.RI "\fISet the background mode\&. \fP"
.ti -1c
.RI "\fBBackgroundMode\fP \fBbackgroundMode\fP () const "
.br
.ti -1c
.RI "void \fBsetTextPen\fP (const QPen &)"
.br
.RI "\fISet the pen for drawing text labels\&. \fP"
.ti -1c
.RI "QPen \fBtextPen\fP () const "
.br
.ti -1c
.RI "virtual void \fBdraw\fP (QPainter *p, const \fBQwtScaleMap\fP &xMap, const \fBQwtScaleMap\fP &yMap, const QRectF &rect) const "
.br
.ti -1c
.RI "void \fBclearLegend\fP ()"
.br
.RI "\fIRemove all items from the legend\&. \fP"
.ti -1c
.RI "virtual void \fBupdateLegend\fP (const \fBQwtPlotItem\fP *, const QList< \fBQwtLegendData\fP > &)"
.br
.ti -1c
.RI "QRect \fBgeometry\fP (const QRectF &canvasRect) const "
.br
.ti -1c
.RI "virtual QSize \fBminimumSize\fP (const \fBQwtLegendData\fP &) const "
.br
.ti -1c
.RI "virtual int \fBheightForWidth\fP (const \fBQwtLegendData\fP &, int w) const "
.br
.ti -1c
.RI "QList< const \fBQwtPlotItem\fP * > \fBplotItems\fP () const "
.br
.ti -1c
.RI "QList< QRect > \fBlegendGeometries\fP (const \fBQwtPlotItem\fP *) const "
.br
.in -1c
.SS "Protected Member Functions"
.in +1c
.ti -1c
.RI "virtual void \fBdrawLegendData\fP (QPainter *painter, const \fBQwtPlotItem\fP *, const \fBQwtLegendData\fP &, const QRectF &) const "
.br
.ti -1c
.RI "virtual void \fBdrawBackground\fP (QPainter *, const QRectF &rect) const "
.br
.in -1c
.SH "Detailed Description"
.PP
A class which draws a legend inside the plot canvas\&.
\fBQwtPlotLegendItem\fP can be used to draw a inside the plot canvas\&. It can be used together with a \fBQwtLegend\fP or instead of it to have more space for the plot canvas\&.
.PP
In opposite to \fBQwtLegend\fP the legend item is not interactive\&. To identify mouse clicks on a legend item an event filter needs to be installed catching mouse events ob the plot canvas\&. The geometries of the legend items are available using \fBlegendGeometries()\fP\&.
.PP
The legend item is aligned to plot canvas according to its \fBalignment()\fP flags\&. It might have a background for the complete legend ( usually semi transparent ) or for each legend item\&.
.PP
\fBNote:\fP
.RS 4
An external \fBQwtLegend\fP with a transparent background on top the plot canvas might be another option with a similar effect\&.
.RE
.PP
.SH "Member Enumeration Documentation"
.PP
.SS "enum \fBQwtPlotLegendItem::BackgroundMode\fP"
.PP
Background mode\&. Depending on the mode the complete legend or each item might have an background\&.
.PP
The default setting is LegendBackground\&.
.PP
\fBSee Also:\fP
.RS 4
\fBsetBackgroundMode()\fP, \fBsetBackgroundBrush()\fP, \fBdrawBackground()\fP
.RE
.PP
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fILegendBackground \fP\fP
The legend has a background\&.
.TP
\fB\fIItemBackground \fP\fP
Each item has a background\&.
.SH "Member Function Documentation"
.PP
.SS "Qt::Alignment QwtPlotLegendItem::alignment () const"
\fBReturns:\fP
.RS 4
Alignment flags
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetAlignment()\fP
.RE
.PP
.SS "QBrush QwtPlotLegendItem::backgroundBrush () const"
\fBReturns:\fP
.RS 4
Brush is used to fill the background
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetBackgroundBrush()\fP, \fBbackgroundMode()\fP, \fBdrawBackground()\fP
.RE
.PP
.SS "\fBQwtPlotLegendItem::BackgroundMode\fP QwtPlotLegendItem::backgroundMode () const"
\fBReturns:\fP
.RS 4
backgroundMode
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetBackgroundMode()\fP, \fBbackgroundBrush()\fP, \fBdrawBackground()\fP
.RE
.PP
.SS "int QwtPlotLegendItem::borderDistance () const"
\fBReturns:\fP
.RS 4
Margin between the legend and the canvas border
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBmargin()\fP
.RE
.PP
.SS "QPen QwtPlotLegendItem::borderPen () const"
\fBReturns:\fP
.RS 4
Pen for drawing the border
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetBorderPen()\fP, \fBbackgroundBrush()\fP
.RE
.PP
.SS "double QwtPlotLegendItem::borderRadius () const"
\fBReturns:\fP
.RS 4
Radius of the border
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetBorderRadius()\fP, \fBsetBorderPen()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::draw (QPainter *painter, const \fBQwtScaleMap\fP &xMap, const \fBQwtScaleMap\fP &yMap, const QRectF &canvasRect) const\fC [virtual]\fP"
Draw the legend
.PP
\fBParameters:\fP
.RS 4
\fIpainter\fP Painter
.br
\fIxMap\fP x Scale Map
.br
\fIyMap\fP y Scale Map
.br
\fIcanvasRect\fP Contents rectangle of the canvas in painter coordinates
.RE
.PP
.PP
Implements \fBQwtPlotItem\fP\&.
.SS "void QwtPlotLegendItem::drawBackground (QPainter *painter, const QRectF &rect) const\fC [protected]\fP, \fC [virtual]\fP"
Draw a rounded rect
.PP
\fBParameters:\fP
.RS 4
\fIpainter\fP Painter
.br
\fIrect\fP Bounding rectangle
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetBorderRadius()\fP, \fBsetBorderPen()\fP, \fBsetBackgroundBrush()\fP, \fBsetBackgroundMode()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::drawLegendData (QPainter *painter, const \fBQwtPlotItem\fP *plotItem, const \fBQwtLegendData\fP &data, const QRectF &rect) const\fC [protected]\fP, \fC [virtual]\fP"
Draw an entry on the legend
.PP
\fBParameters:\fP
.RS 4
\fIpainter\fP Qt Painter
.br
\fIplotItem\fP Plot item, represented by the entry
.br
\fIdata\fP Attributes of the legend entry
.br
\fIrect\fP Bounding rectangle for the entry
.RE
.PP
.SS "QFont QwtPlotLegendItem::font () const"
\fBReturns:\fP
.RS 4
Font used for drawing the text label
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetFont()\fP
.RE
.PP
.SS "QRect QwtPlotLegendItem::geometry (const QRectF &canvasRect) const"
Calculate the geometry of the legend on the canvas
.PP
\fBParameters:\fP
.RS 4
\fIcanvasRect\fP Geometry of the canvas
.RE
.PP
\fBReturns:\fP
.RS 4
Geometry of the legend
.RE
.PP
.SS "int QwtPlotLegendItem::heightForWidth (const \fBQwtLegendData\fP &data, intwidth) const\fC [virtual]\fP"
\fBReturns:\fP
.RS 4
The preferred height, for a width\&.
.RE
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP Attributes of the legend entry
.br
\fIwidth\fP Width
.RE
.PP
.SS "int QwtPlotLegendItem::itemMargin () const"
\fBReturns:\fP
.RS 4
Margin around each item
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetItemMargin()\fP, \fBitemSpacing()\fP, \fBmargin()\fP, \fBspacing()\fP
.RE
.PP
.SS "int QwtPlotLegendItem::itemSpacing () const"
\fBReturns:\fP
.RS 4
Spacing inside of each item
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetItemSpacing()\fP, \fBitemMargin()\fP, \fBmargin()\fP, \fBspacing()\fP
.RE
.PP
.SS "QList< QRect > QwtPlotLegendItem::legendGeometries (const \fBQwtPlotItem\fP *plotItem) const"
\fBReturns:\fP
.RS 4
Geometries of the items of a plot item
.RE
.PP
\fBNote:\fP
.RS 4
Usually a plot item has only one entry on the legend
.RE
.PP
.SS "int QwtPlotLegendItem::margin () const"
\fBReturns:\fP
.RS 4
Margin around the legend items
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetMargin()\fP, \fBspacing()\fP, \fBitemMargin()\fP, \fBitemSpacing()\fP
.RE
.PP
.SS "uint QwtPlotLegendItem::maxColumns () const"
\fBReturns:\fP
.RS 4
Maximum number of columns
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBmaxColumns()\fP, \fBQwtDynGridLayout::maxColumns()\fP
.RE
.PP
.SS "QSize QwtPlotLegendItem::minimumSize (const \fBQwtLegendData\fP &data) const\fC [virtual]\fP"
Minimum size hint needed to display an entry
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP Attributes of the legend entry
.RE
.PP
\fBReturns:\fP
.RS 4
Minimum size
.RE
.PP
.SS "QList< const \fBQwtPlotItem\fP * > QwtPlotLegendItem::plotItems () const"
\fBReturns:\fP
.RS 4
All plot items with an entry on the legend
.RE
.PP
\fBNote:\fP
.RS 4
A plot item might have more than one entry on the legend
.RE
.PP
.SS "int QwtPlotLegendItem::rtti () const\fC [virtual]\fP"
\fBReturns:\fP
.RS 4
\fBQwtPlotItem::Rtti_PlotLegend\fP
.RE
.PP
.PP
Reimplemented from \fBQwtPlotItem\fP\&.
.SS "void QwtPlotLegendItem::setAlignment (Qt::Alignmentalignment)"
.PP
Set the alignmnet\&. Alignment means the position of the legend relative to the geometry of the plot canvas\&.
.PP
\fBParameters:\fP
.RS 4
\fIalignment\fP Alignment flags
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBalignment()\fP, \fBsetMaxColumns()\fP
.RE
.PP
\fBNote:\fP
.RS 4
To align a legend with many items horizontally the number of columns need to be limited
.RE
.PP
.SS "void QwtPlotLegendItem::setBackgroundBrush (const QBrush &brush)"
.PP
Set the background brush\&. The brush is used to fill the background
.PP
\fBParameters:\fP
.RS 4
\fIbrush\fP Brush
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBbackgroundBrush()\fP, \fBsetBackgroundMode()\fP, \fBdrawBackground()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::setBackgroundMode (\fBBackgroundMode\fPmode)"
.PP
Set the background mode\&. Depending on the mode the complete legend or each item might have an background\&.
.PP
The default setting is LegendBackground\&.
.PP
\fBSee Also:\fP
.RS 4
\fBbackgroundMode()\fP, \fBsetBackgroundBrush()\fP, \fBdrawBackground()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::setBorderDistance (intdistance)"
.PP
Set the margin between the legend and the canvas border\&. The default setting for the margin is 10 pixels\&.
.PP
\fBParameters:\fP
.RS 4
\fIdistance\fP Margin in pixels
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetMargin()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::setBorderPen (const QPen &pen)"
Set the pen for drawing the border
.PP
\fBParameters:\fP
.RS 4
\fIpen\fP Border pen
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBborderPen()\fP, \fBsetBackgroundBrush()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::setBorderRadius (doubleradius)"
Set the radius for the border
.PP
\fBParameters:\fP
.RS 4
\fIradius\fP A value <= 0 defines a rectangular border
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBborderRadius()\fP, \fBsetBorderPen()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::setFont (const QFont &font)"
Change the font used for drawing the text label
.PP
\fBParameters:\fP
.RS 4
\fIfont\fP Legend font
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBfont()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::setItemMargin (intmargin)"
Set the margin around each item
.PP
\fBParameters:\fP
.RS 4
\fImargin\fP Margin
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBitemMargin()\fP, \fBsetItemSpacing()\fP, \fBsetMargin()\fP, \fBsetSpacing()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::setItemSpacing (intspacing)"
Set the spacing inside of each item
.PP
\fBParameters:\fP
.RS 4
\fIspacing\fP Spacing
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBitemSpacing()\fP, \fBsetItemMargin()\fP, \fBsetMargin()\fP, \fBsetSpacing()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::setMargin (intmargin)"
.PP
Set the margin around legend items\&. The default setting for the margin is 0\&.
.PP
\fBParameters:\fP
.RS 4
\fImargin\fP Margin in pixels
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBmargin()\fP, \fBsetSpacing()\fP, \fBsetItemMargin()\fP, \fBsetItemSpacing\fP
.RE
.PP
.SS "void QwtPlotLegendItem::setMaxColumns (uintmaxColumns)"
.PP
Limit the number of columns\&. When aligning the legend horizontally ( Qt::AlignLeft, Qt::AlignRight ) the number of columns needs to be limited to avoid, that the width of the legend grows with an increasing number of entries\&.
.PP
\fBParameters:\fP
.RS 4
\fImaxColumns\fP Maximum number of columns\&. 0 means unlimited\&.
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBmaxColumns()\fP, \fBQwtDynGridLayout::setMaxColumns()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::setSpacing (intspacing)"
.PP
Set the spacing between the legend items\&. \fBParameters:\fP
.RS 4
\fIspacing\fP Spacing in pixels
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBspacing()\fP, \fBsetMargin()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::setTextPen (const QPen &pen)"
.PP
Set the pen for drawing text labels\&. \fBParameters:\fP
.RS 4
\fIpen\fP Text pen
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBtextPen()\fP, \fBsetFont()\fP
.RE
.PP
.SS "int QwtPlotLegendItem::spacing () const"
\fBReturns:\fP
.RS 4
Spacing between the legend items
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetSpacing()\fP, \fBmargin()\fP, \fBitemSpacing()\fP, \fBitemMargin()\fP
.RE
.PP
.SS "QPen QwtPlotLegendItem::textPen () const"
\fBReturns:\fP
.RS 4
Pen for drawing text labels
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetTextPen()\fP, \fBfont()\fP
.RE
.PP
.SS "void QwtPlotLegendItem::updateLegend (const \fBQwtPlotItem\fP *plotItem, const QList< \fBQwtLegendData\fP > &data)\fC [virtual]\fP"
Update the legend items according to modifications of a plot item
.PP
\fBParameters:\fP
.RS 4
\fIplotItem\fP Plot item
.br
\fIdata\fP Attributes of the legend entries
.RE
.PP
.PP
Reimplemented from \fBQwtPlotItem\fP\&.
.SH "Author"
.PP
Generated automatically by Doxygen for Qwt User's Guide from the source code\&.