File: qwt__plot_8cpp-source.html

package info (click to toggle)
libqwt 4.2.0-4.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 9,832 kB
  • ctags: 5,512
  • sloc: cpp: 22,973; ansic: 244; makefile: 66
file content (842 lines) | stat: -rw-r--r-- 57,414 bytes parent folder | download | duplicates (5)
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
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Qwt User&apos;s Guide: qwt_plot.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.8 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>qwt_plot.cpp</h1><pre class="fragment"><div>00001 <span class="comment">/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************</span>
00002 <span class="comment"> * Qwt Widget Library</span>
00003 <span class="comment"> * Copyright (C) 1997   Josef Wilgen</span>
00004 <span class="comment"> * Copyright (C) 2002   Uwe Rathmann</span>
00005 <span class="comment"> *</span>
00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
00007 <span class="comment"> * modify it under the terms of the Qwt License, Version 1.0</span>
00008 <span class="comment"> *****************************************************************************/</span>
00009 
00010 <span class="comment">// vim: expandtab</span>
00011 
00012 <span class="preprocessor">#include &lt;qlabel.h&gt;</span>
00013 <span class="preprocessor">#include &lt;qpainter.h&gt;</span>
00014 <span class="preprocessor">#include &lt;qfocusdata.h&gt;</span>
00015 <span class="preprocessor">#include &lt;qevent.h&gt;</span>
00016 <span class="preprocessor">#include "qwt_plot.h"</span>
00017 <span class="preprocessor">#include "qwt_plot_layout.h"</span>
00018 <span class="preprocessor">#include "qwt_plot_dict.h"</span>
00019 <span class="preprocessor">#include "qwt_rect.h"</span>
00020 <span class="preprocessor">#include "qwt_scale.h"</span>
00021 <span class="preprocessor">#include "qwt_scale.h"</span>
00022 <span class="preprocessor">#include "qwt_legend.h"</span>
00023 <span class="preprocessor">#include "qwt_dyngrid_layout.h"</span>
00024 <span class="preprocessor">#include "qwt_plot_canvas.h"</span>
00025 <span class="preprocessor">#include "<a class="code" href="qwt__math_8h.html">qwt_math.h</a>"</span>
00026 <span class="preprocessor">#include "qwt_paint_buffer.h"</span>
00027 
<a name="l00034"></a><a class="code" href="class_qwt_plot.html#a0">00034</a> <a class="code" href="class_qwt_plot.html#a0">QwtPlot::QwtPlot</a>(QWidget *parent, <span class="keyword">const</span> <span class="keywordtype">char</span> *name) :
00035     QFrame(parent, name, Qt::WRepaintNoErase|Qt::WResizeNoErase)
00036 {
00037     initPlot();
00038 }
00039 
00040 
<a name="l00047"></a><a class="code" href="class_qwt_plot.html#a1">00047</a> <a class="code" href="class_qwt_plot.html#a0">QwtPlot::QwtPlot</a>(<span class="keyword">const</span> QString &amp;title, QWidget *parent, <span class="keyword">const</span> <span class="keywordtype">char</span> *name) :
00048     QFrame(parent, name, Qt::WRepaintNoErase|Qt::WResizeNoErase)
00049 {
00050     initPlot(title);
00051 }
00052 
<a name="l00054"></a><a class="code" href="class_qwt_plot.html#a2">00054</a> <a class="code" href="class_qwt_plot.html#a2">QwtPlot::~QwtPlot</a>()
00055 {
00056     <span class="keyword">delete</span> d_layout;
00057     <span class="keyword">delete</span> d_curves;
00058     <span class="keyword">delete</span> d_markers;
00059     <span class="keyword">delete</span> d_grid;
00060 }
00061 
00066 <span class="keywordtype">void</span> QwtPlot::initPlot(<span class="keyword">const</span> QString &amp;title)
00067 {
00068     d_layout = <span class="keyword">new</span> <a class="code" href="class_qwt_plot_layout.html">QwtPlotLayout</a>;
00069 
00070     d_curves = <span class="keyword">new</span> QwtCurveDict;
00071     d_markers = <span class="keyword">new</span> QwtMarkerDict;
00072 
00073     d_autoReplot = FALSE;
00074 
00075     d_lblTitle = <span class="keyword">new</span> QLabel(title, <span class="keyword">this</span>);
00076     d_lblTitle-&gt;setFont(QFont(fontInfo().family(), 14, QFont::Bold));
00077     d_lblTitle-&gt;setAlignment(Qt::AlignCenter|Qt::WordBreak|Qt::ExpandTabs);
00078 
00079     d_legend = <span class="keyword">new</span> <a class="code" href="class_qwt_legend.html">QwtLegend</a>(<span class="keyword">this</span>);
00080     d_autoLegend = FALSE;
00081 
00082     d_scale[yLeft] = <span class="keyword">new</span> <a class="code" href="class_qwt_scale.html">QwtScale</a>(QwtScale::Left, <span class="keyword">this</span>, <span class="stringliteral">"yLeft"</span>);
00083     d_scale[yRight] = <span class="keyword">new</span> <a class="code" href="class_qwt_scale.html">QwtScale</a>(QwtScale::Right, <span class="keyword">this</span>, <span class="stringliteral">"yRight"</span>);
00084     d_scale[xTop] = <span class="keyword">new</span> <a class="code" href="class_qwt_scale.html">QwtScale</a>(QwtScale::Top, <span class="keyword">this</span>, <span class="stringliteral">"xTop"</span>);
00085     d_scale[xBottom] = <span class="keyword">new</span> <a class="code" href="class_qwt_scale.html">QwtScale</a>(QwtScale::Bottom, <span class="keyword">this</span>, <span class="stringliteral">"xBottom"</span>);
00086 
00087     initAxes();
00088 
00089     d_grid = <span class="keyword">new</span> <a class="code" href="class_qwt_plot_grid.html">QwtPlotGrid</a>(<span class="keyword">this</span>);
00090     d_grid-&gt;<a class="code" href="class_qwt_grid.html#a15">setPen</a>(QPen(Qt::black, 0, Qt::DotLine));
00091     d_grid-&gt;<a class="code" href="class_qwt_grid.html#a7">enableXMin</a>(FALSE);
00092     d_grid-&gt;<a class="code" href="class_qwt_grid.html#a9">enableYMin</a>(FALSE);
00093     d_grid-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a1">setAxis</a>(xBottom, yLeft);
00094 
00095     d_canvas = <span class="keyword">new</span> <a class="code" href="class_qwt_plot_canvas.html">QwtPlotCanvas</a>(<span class="keyword">this</span>);
00096     d_canvas-&gt;setFrameStyle(QFrame::Panel|QFrame::Sunken);
00097     d_canvas-&gt;setLineWidth(2);
00098     d_canvas-&gt;setMidLineWidth(0);
00099 
00100 <span class="preprocessor">#ifndef QWT_NO_COMPAT</span>
00101 <span class="preprocessor"></span>    connect(d_canvas, SIGNAL(mousePressed(<span class="keyword">const</span> QMouseEvent &amp;)),
00102         <span class="keyword">this</span>, SIGNAL(<a class="code" href="class_qwt_plot.html#l0">plotMousePressed</a>(<span class="keyword">const</span> QMouseEvent &amp;)));
00103     connect(d_canvas, SIGNAL(mouseMoved(<span class="keyword">const</span> QMouseEvent &amp;)),
00104         <span class="keyword">this</span>, SIGNAL(<a class="code" href="class_qwt_plot.html#l2">plotMouseMoved</a>(<span class="keyword">const</span> QMouseEvent &amp;)));
00105     connect(d_canvas, SIGNAL(mouseReleased(<span class="keyword">const</span> QMouseEvent &amp;)),
00106         <span class="keyword">this</span>, SIGNAL(<a class="code" href="class_qwt_plot.html#l1">plotMouseReleased</a>(<span class="keyword">const</span> QMouseEvent &amp;)));
00107 <span class="preprocessor">#endif</span>
00108 <span class="preprocessor"></span>
00109     <a class="code" href="class_qwt_plot.html#b4">updateTabOrder</a>();
00110 
00111     QSizePolicy sp;
00112     sp.setHorData( QSizePolicy::MinimumExpanding );
00113     sp.setVerData( QSizePolicy::MinimumExpanding );
00114     setSizePolicy(sp);
00115 }
00116 
00118 <span class="keywordtype">void</span> QwtPlot::initAxes()
00119 {
00120     <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot.html#a109">axis</a>;
00121 
00122     QFont fscl(fontInfo().family(), 10);
00123     QFont fttl(fontInfo().family(), 12, QFont::Bold);
00124 
00125     <span class="keywordflow">for</span>(axis = 0; axis &lt; axisCnt; axis++)
00126     {
00127         d_scale[axis]-&gt;setFont(fscl);
00128         d_scale[axis]-&gt;<a class="code" href="class_qwt_scale.html#a7">setTitleFont</a>(fttl);
00129         d_scale[axis]-&gt;<a class="code" href="class_qwt_scale.html#a15">setBaselineDist</a>(2);
00130     }
00131 
00132     d_axisEnabled[yLeft] = TRUE;
00133     d_axisEnabled[yRight] = FALSE;
00134     d_axisEnabled[xBottom] = TRUE;
00135     d_axisEnabled[xTop] = FALSE;
00136 
00137     <span class="keywordflow">for</span> (axis=0; axis &lt; axisCnt; axis++)
00138     {
00139         d_as[axis].<a class="code" href="class_qwt_auto_scale.html#a21">adjust</a>(0.0,1000.0,TRUE);
00140         d_scale[axis]-&gt;<a class="code" href="class_qwt_scale.html#a19">setScaleDiv</a>(d_as[axis].scaleDiv());
00141     }
00142 }
00143 
<a name="l00147"></a><a class="code" href="class_qwt_plot.html#a175">00147</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot.html#a175">QwtPlot::event</a>(QEvent *e)
00148 {
00149     <span class="keywordtype">bool</span> ok = QFrame::event(e);
00150     <span class="keywordflow">switch</span>(e-&gt;type())
00151     {
00152 <span class="preprocessor">#if 0</span>
00153 <span class="preprocessor"></span>        <span class="keywordflow">case</span> QEvent::ChildInserted:
00154         <span class="keywordflow">case</span> QEvent::ChildRemoved:
00155 <span class="preprocessor">#endif</span>
00156 <span class="preprocessor"></span>        <span class="keywordflow">case</span> QEvent::LayoutHint:
00157             <a class="code" href="class_qwt_plot.html#b6">updateLayout</a>();
00158             <span class="keywordflow">break</span>;
00159         <span class="keywordflow">default</span>:;
00160     }
00161     <span class="keywordflow">return</span> ok;
00162 }
00163 
<a name="l00168"></a><a class="code" href="class_qwt_plot.html#b0">00168</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#b0">QwtPlot::autoRefresh</a>()
00169 {
00170     <span class="keywordflow">if</span> (d_autoReplot)
00171         <a class="code" href="class_qwt_plot.html#i5">replot</a>();
00172 }
00173 
<a name="l00188"></a><a class="code" href="class_qwt_plot.html#a11">00188</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a11">QwtPlot::setAutoReplot</a>(<span class="keywordtype">bool</span> tf)
00189 {
00190     d_autoReplot = tf;
00191 }
00192 
<a name="l00196"></a><a class="code" href="class_qwt_plot.html#a12">00196</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot.html#a12">QwtPlot::autoReplot</a>()<span class="keyword"> const</span>
00197 <span class="keyword"></span>{
00198     <span class="keywordflow">return</span> d_autoReplot; 
00199 }
00200 
<a name="l00205"></a><a class="code" href="class_qwt_plot.html#a25">00205</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a25">QwtPlot::setTitle</a>(<span class="keyword">const</span> QString &amp;t)
00206 {
00207     d_lblTitle-&gt;setText(t);
00208 }
00209 
<a name="l00214"></a><a class="code" href="class_qwt_plot.html#a26">00214</a> QString <a class="code" href="class_qwt_plot.html#a26">QwtPlot::title</a>()<span class="keyword"> const</span>
00215 <span class="keyword"></span>{
00216     <span class="keywordflow">return</span> d_lblTitle-&gt;text();
00217 }
00218 
00219 
<a name="l00224"></a><a class="code" href="class_qwt_plot.html#a27">00224</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a27">QwtPlot::setTitleFont</a>(<span class="keyword">const</span> QFont &amp;f)
00225 {
00226     d_lblTitle-&gt;setFont(f);
00227 }
00228 
<a name="l00232"></a><a class="code" href="class_qwt_plot.html#a28">00232</a> QFont <a class="code" href="class_qwt_plot.html#a28">QwtPlot::titleFont</a>()<span class="keyword"> const</span>
00233 <span class="keyword"></span>{
00234     <span class="keywordflow">return</span> d_lblTitle-&gt;font();
00235 }
00236 
<a name="l00240"></a><a class="code" href="class_qwt_plot.html#a21">00240</a> QwtPlotLayout *<a class="code" href="class_qwt_plot.html#a21">QwtPlot::plotLayout</a>()
00241 {
00242     <span class="keywordflow">return</span> d_layout;
00243 }
00244 
<a name="l00248"></a><a class="code" href="class_qwt_plot.html#a22">00248</a> <span class="keyword">const</span> QwtPlotLayout *<a class="code" href="class_qwt_plot.html#a21">QwtPlot::plotLayout</a>()<span class="keyword"> const</span>
00249 <span class="keyword"></span>{
00250     <span class="keywordflow">return</span> d_layout;
00251 }
00252 
<a name="l00256"></a><a class="code" href="class_qwt_plot.html#a29">00256</a> QLabel *<a class="code" href="class_qwt_plot.html#a29">QwtPlot::titleLabel</a>()
00257 {
00258     <span class="keywordflow">return</span> d_lblTitle;
00259 }
00260 
<a name="l00264"></a><a class="code" href="class_qwt_plot.html#a30">00264</a> <span class="keyword">const</span> QLabel *<a class="code" href="class_qwt_plot.html#a29">QwtPlot::titleLabel</a>()<span class="keyword"> const</span>
00265 <span class="keyword"></span>{
00266     <span class="keywordflow">return</span> d_lblTitle;
00267 }
00268 
<a name="l00273"></a><a class="code" href="class_qwt_plot.html#a170">00273</a> <a class="code" href="class_qwt_legend.html">QwtLegend</a> *<a class="code" href="class_qwt_plot.html#a170">QwtPlot::legend</a>()
00274 { 
00275     <span class="keywordflow">return</span> d_legend;
00276 }   
00277 
<a name="l00282"></a><a class="code" href="class_qwt_plot.html#a171">00282</a> <span class="keyword">const</span> <a class="code" href="class_qwt_legend.html">QwtLegend</a> *<a class="code" href="class_qwt_plot.html#a170">QwtPlot::legend</a>()<span class="keyword"> const</span>
00283 <span class="keyword"></span>{ 
00284     <span class="keywordflow">return</span> d_legend;
00285 }   
00286 
00287 
<a name="l00291"></a><a class="code" href="class_qwt_plot.html#a31">00291</a> <a class="code" href="class_qwt_plot_canvas.html">QwtPlotCanvas</a> *<a class="code" href="class_qwt_plot.html#a31">QwtPlot::canvas</a>()
00292 { 
00293     <span class="keywordflow">return</span> d_canvas;
00294 }   
00295 
<a name="l00299"></a><a class="code" href="class_qwt_plot.html#a32">00299</a> <span class="keyword">const</span> <a class="code" href="class_qwt_plot_canvas.html">QwtPlotCanvas</a> *<a class="code" href="class_qwt_plot.html#a31">QwtPlot::canvas</a>()<span class="keyword"> const</span>
00300 <span class="keyword"></span>{ 
00301     <span class="keywordflow">return</span> d_canvas;
00302 }
00303 
<a name="l00309"></a><a class="code" href="class_qwt_plot.html#a173">00309</a> QSize <a class="code" href="class_qwt_plot.html#a173">QwtPlot::sizeHint</a>()<span class="keyword"> const</span>
00310 <span class="keyword"></span>{
00311     <span class="keywordtype">int</span> dw = 0;
00312     <span class="keywordtype">int</span> dh = 0;
00313     <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> axis = 0; axis &lt; axisCnt; axis++ )
00314     {
00315         <span class="keywordflow">if</span> ( d_axisEnabled[axis] )
00316         {   
00317             <span class="keyword">const</span> <span class="keywordtype">int</span> niceDist = 40;
00318             <span class="keyword">const</span> <a class="code" href="class_qwt_scale.html">QwtScale</a> *scale = d_scale[axis];
00319             <span class="keyword">const</span> <span class="keywordtype">int</span> majCnt = scale-&gt;<a class="code" href="class_qwt_scale.html#a21">scaleDraw</a>()-&gt;<a class="code" href="class_qwt_scale_draw.html#a17">scaleDiv</a>().<a class="code" href="class_qwt_scale_div.html#a6">majCnt</a>();
00320 
00321             <span class="keywordflow">if</span> ( axis == yLeft || axis == yRight )
00322             {
00323                 <span class="keywordtype">int</span> hDiff = (majCnt - 1) * niceDist 
00324                     - scale-&gt;<a class="code" href="class_qwt_scale.html#a27">minimumSizeHint</a>().height();
00325                 <span class="keywordflow">if</span> ( hDiff &gt; dh )
00326                     dh = hDiff;
00327             }
00328             <span class="keywordflow">else</span>
00329             {
00330                 <span class="keywordtype">int</span> wDiff = (majCnt - 1) * niceDist 
00331                     - scale-&gt;<a class="code" href="class_qwt_scale.html#a27">minimumSizeHint</a>().width();
00332                 <span class="keywordflow">if</span> ( wDiff &gt; dw )
00333                     dw = wDiff;
00334             }
00335         }
00336     }
00337     <span class="keywordflow">return</span> <a class="code" href="class_qwt_plot.html#a174">minimumSizeHint</a>() + QSize(dw, dh);
00338 }
00339 
<a name="l00343"></a><a class="code" href="class_qwt_plot.html#a174">00343</a> QSize <a class="code" href="class_qwt_plot.html#a174">QwtPlot::minimumSizeHint</a>()<span class="keyword"> const</span>
00344 <span class="keyword"></span>{
00345     QSize hint = d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a17">minimumSizeHint</a>(<span class="keyword">this</span>);
00346     hint += QSize(2 * frameWidth(), 2 * frameWidth());
00347 
00348     <span class="keywordflow">return</span> hint;
00349 }
00350 
<a name="l00352"></a><a class="code" href="class_qwt_plot.html#b7">00352</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#b7">QwtPlot::resizeEvent</a>(QResizeEvent *e)
00353 {
00354     QFrame::resizeEvent(e);
00355     <a class="code" href="class_qwt_plot.html#b6">updateLayout</a>();
00356 }
00357 
<a name="l00368"></a><a class="code" href="class_qwt_plot.html#i5">00368</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#i5">QwtPlot::replot</a>()
00369 {
00370     <span class="keywordtype">bool</span> doAutoReplot = <a class="code" href="class_qwt_plot.html#a12">autoReplot</a>();
00371     <a class="code" href="class_qwt_plot.html#a11">setAutoReplot</a>(FALSE);
00372 
00373     <a class="code" href="class_qwt_plot.html#b5">updateAxes</a>();
00374 
00375     d_canvas-&gt;<a class="code" href="class_qwt_plot_canvas.html#a5">invalidateCache</a>();
00376     d_canvas-&gt;repaint(d_canvas-&gt;contentsRect(), FALSE);
00377 
00378     <a class="code" href="class_qwt_plot.html#a11">setAutoReplot</a>(doAutoReplot);
00379 }
00380 
<a name="l00385"></a><a class="code" href="class_qwt_plot.html#b6">00385</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#b6">QwtPlot::updateLayout</a>()
00386 {
00387     d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a18">activate</a>(<span class="keyword">this</span>, contentsRect());
00388 
00389     <span class="comment">//</span>
00390     <span class="comment">// resize and show the visible widgets</span>
00391     <span class="comment">//</span>
00392     <span class="keywordflow">if</span> (!d_lblTitle-&gt;text().isEmpty())
00393     {
00394         d_lblTitle-&gt;setGeometry(d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a20">titleRect</a>());
00395         <span class="keywordflow">if</span> (!d_lblTitle-&gt;isVisible())
00396             d_lblTitle-&gt;show();
00397     }
00398     <span class="keywordflow">else</span>
00399         d_lblTitle-&gt;hide();
00400 
00401     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> axis = 0; axis &lt; axisCnt; axis++ )
00402     {
00403         <span class="keywordflow">if</span> (d_axisEnabled[axis])
00404         {
00405             d_scale[axis]-&gt;setGeometry(d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a22">scaleRect</a>(axis));
00406 
00407             <span class="keywordflow">if</span> ( axis == xBottom || axis == xTop )
00408             {
00409                 QRegion r(d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a22">scaleRect</a>(axis));
00410                 <span class="keywordflow">if</span> ( d_axisEnabled[yLeft] )
00411                     r = r.subtract(QRegion(d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a22">scaleRect</a>(yLeft)));
00412                 <span class="keywordflow">if</span> ( d_axisEnabled[yRight] )
00413                     r = r.subtract(QRegion(d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a22">scaleRect</a>(yRight)));
00414                 r.translate(-d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a22">scaleRect</a>(axis).x(), 
00415                     -d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a22">scaleRect</a>(axis).y());
00416 
00417                 d_scale[axis]-&gt;setMask(r);
00418             }
00419             <span class="keywordflow">if</span> (!d_scale[axis]-&gt;isVisible())
00420                 d_scale[axis]-&gt;show();
00421         }
00422         <span class="keywordflow">else</span>
00423             d_scale[axis]-&gt;hide();
00424     }
00425 
00426     <span class="keywordflow">if</span> (d_legend-&gt;<a class="code" href="class_qwt_legend.html#a16">itemCount</a>() &gt; 0)
00427     {
00428         d_legend-&gt;setGeometry(d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a21">legendRect</a>());
00429         d_legend-&gt;show();
00430     }
00431     <span class="keywordflow">else</span>
00432         d_legend-&gt;hide();
00433 
00434     d_canvas-&gt;setGeometry(d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a23">canvasRect</a>());
00435 }
00436 
<a name="l00438"></a><a class="code" href="class_qwt_plot.html#b5">00438</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#b5">QwtPlot::updateAxes</a>()
00439 {
00440     <span class="keywordtype">int</span> i;
00441     <span class="keywordtype">bool</span> resetDone[axisCnt];
00442     <span class="keywordflow">for</span> (i = 0; i &lt; axisCnt; i++)
00443         resetDone[i] = FALSE;
00444 
00445     <span class="comment">//</span>
00446     <span class="comment">//  Adjust autoscalers</span>
00447     <span class="comment">//</span>
00448 
00449     QwtPlotCurveIterator itc = <a class="code" href="class_qwt_plot.html#a37">curveIterator</a>();
00450     <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code" href="class_qwt_plot_curve.html">QwtPlotCurve</a> *c = itc.toFirst(); c != 0; c = ++itc )
00451     {
00452         <span class="keyword">const</span> <span class="keywordtype">int</span> xAxis = c-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a3">xAxis</a>();
00453         <span class="keyword">const</span> <span class="keywordtype">int</span> yAxis = c-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a5">yAxis</a>();
00454 
00455         <span class="keywordflow">if</span> ( d_as[xAxis].<a class="code" href="class_qwt_auto_scale.html#a3">autoScale</a>() || d_as[yAxis].<a class="code" href="class_qwt_auto_scale.html#a3">autoScale</a>() )
00456         {
00457             <span class="keyword">const</span> <a class="code" href="class_qwt_double_rect.html">QwtDoubleRect</a> rect = c-&gt;<a class="code" href="class_qwt_curve.html#a12">boundingRect</a>();
00458             <span class="keywordflow">if</span> ( rect.<a class="code" href="class_qwt_double_rect.html#a5">isValid</a>() )
00459             {
00460                 <span class="keywordflow">if</span> ( d_as[xAxis].<a class="code" href="class_qwt_auto_scale.html#a3">autoScale</a>() )
00461                 {
00462                     <span class="keywordflow">if</span> ( !resetDone[xAxis] )
00463                     {
00464                         d_as[xAxis].<a class="code" href="class_qwt_auto_scale.html#a25">reset</a>();
00465                         resetDone[xAxis] = TRUE;
00466                     }
00467                     d_as[xAxis].<a class="code" href="class_qwt_auto_scale.html#a21">adjust</a>(rect.<a class="code" href="class_qwt_double_rect.html#a7">x1</a>(), rect.<a class="code" href="class_qwt_double_rect.html#a8">x2</a>());
00468                 }
00469 
00470                 <span class="keywordflow">if</span> ( d_as[yAxis].<a class="code" href="class_qwt_auto_scale.html#a3">autoScale</a>() )
00471                 {
00472                     <span class="keywordflow">if</span> ( !resetDone[yAxis] )
00473                     {
00474                         d_as[yAxis].<a class="code" href="class_qwt_auto_scale.html#a25">reset</a>();
00475                         resetDone[yAxis] = TRUE;
00476                     }
00477                     d_as[yAxis].<a class="code" href="class_qwt_auto_scale.html#a21">adjust</a>(rect.<a class="code" href="class_qwt_double_rect.html#a9">y1</a>(), rect.<a class="code" href="class_qwt_double_rect.html#a10">y2</a>());
00478                 }
00479             }
00480         }
00481     }
00482 
00483     <span class="comment">//</span>
00484     <span class="comment">// Adjust scales</span>
00485     <span class="comment">//</span>
00486     <span class="keywordflow">for</span> (i = 0; i &lt; axisCnt; i++)
00487     {
00488         d_scale[i]-&gt;<a class="code" href="class_qwt_scale.html#a19">setScaleDiv</a>(d_as[i].scaleDiv());
00489 
00490         <span class="keywordtype">int</span> startDist, endDist;
00491         d_scale[i]-&gt;<a class="code" href="class_qwt_scale.html#a14">minBorderDist</a>(startDist, endDist);
00492         d_scale[i]-&gt;<a class="code" href="class_qwt_scale.html#a11">setBorderDist</a>(startDist, endDist);
00493     }
00494 
00495     d_grid-&gt;<a class="code" href="class_qwt_grid.html#a11">setXDiv</a>(d_as[d_grid-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a3">xAxis</a>()].scaleDiv());
00496     d_grid-&gt;<a class="code" href="class_qwt_grid.html#a13">setYDiv</a>(d_as[d_grid-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a5">yAxis</a>()].scaleDiv());
00497 }
00498 
00500 
<a name="l00501"></a><a class="code" href="class_qwt_plot.html#b4">00501</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#b4">QwtPlot::updateTabOrder</a>()
00502 {
00503     <span class="comment">// Depending on the position of the legend the </span>
00504     <span class="comment">// tab order will be changed that the canvas is</span>
00505     <span class="comment">// next to the last legend item, or directly before</span>
00506     <span class="comment">// the first one. The following code seems much too</span>
00507     <span class="comment">// complicated but is there a better implementation ?</span>
00508 
00509     <span class="keywordflow">if</span> ( d_canvas-&gt;focusPolicy() == QWidget::NoFocus || focusData() == NULL )
00510         <span class="keywordflow">return</span>;
00511 
00512     <span class="comment">// move the cursor to the canvas</span>
00513 
00514     <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; focusData()-&gt;count(); i++ )
00515     {
00516         <span class="keywordflow">if</span> ( focusData()-&gt;next() == d_canvas )
00517             <span class="keywordflow">break</span>;
00518     }
00519 
00520     <span class="keyword">const</span> <span class="keywordtype">bool</span> canvasFirst = d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a12">legendPosition</a>() == QwtPlot::Bottom ||
00521         d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a12">legendPosition</a>() == QwtPlot::Right;
00522 
00523     <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> j = 0; j &lt; focusData()-&gt;count(); j++ )
00524     {
00525         QWidget *w = canvasFirst ? focusData()-&gt;next() : focusData()-&gt;prev();
00526 
00527         <span class="keywordflow">if</span> ( w-&gt;focusPolicy() != QWidget::NoFocus 
00528             &amp;&amp; w-&gt;parent() &amp;&amp; w-&gt;parent() == d_legend-&gt;<a class="code" href="class_qwt_legend.html#a6">contentsWidget</a>() )
00529         {
00530             <span class="keywordflow">if</span> ( canvasFirst )
00531             {
00532                 <span class="keywordflow">do</span> <span class="comment">// go back to last non legend item</span>
00533                 {
00534                     w = focusData()-&gt;prev(); <span class="comment">// before the first legend item</span>
00535                 } <span class="keywordflow">while</span> ( w-&gt;focusPolicy() == QWidget::NoFocus );
00536             }
00537 
00538             <span class="keywordflow">if</span> ( w != d_canvas )
00539                 setTabOrder(w, d_canvas);
00540             <span class="keywordflow">break</span>;
00541         }
00542     }
00543 }
00544 
00546 <span class="comment">// \sa QFrame::drawContents</span>
00547 
<a name="l00548"></a><a class="code" href="class_qwt_plot.html#b3">00548</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#b3">QwtPlot::drawContents</a>( QPainter * )
00549 {
00550     <span class="comment">// We must erase the region that is not</span>
00551     <span class="comment">// occupied by our children</span>
00552     QRegion cr( contentsRect() );
00553     cr = cr.subtract( childrenRegion() );
00554     erase( cr );
00555 }
00556 
<a name="l00567"></a><a class="code" href="class_qwt_plot.html#b1">00567</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#b1">QwtPlot::drawCanvas</a>(QPainter *painter)
00568 {
00569     QwtArray&lt;QwtDiMap&gt; map(axisCnt);
00570     <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> axis = 0; axis &lt; axisCnt; axis++ )
00571         map[axis] = <a class="code" href="class_qwt_plot.html#a39">canvasMap</a>(axis);
00572 
00573     <a class="code" href="class_qwt_plot.html#b2">drawCanvasItems</a>(painter, 
00574         d_canvas-&gt;contentsRect(), map, <a class="code" href="class_qwt_plot_print_filter.html">QwtPlotPrintFilter</a>());
00575 }
00576 
<a name="l00585"></a><a class="code" href="class_qwt_plot.html#b2">00585</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#b2">QwtPlot::drawCanvasItems</a>(QPainter *painter, <span class="keyword">const</span> QRect &amp;rect, 
00586         <span class="keyword">const</span> QwtArray&lt;QwtDiMap&gt; &amp;map, <span class="keyword">const</span> <a class="code" href="class_qwt_plot_print_filter.html">QwtPlotPrintFilter</a> &amp;pfilter)<span class="keyword"> const</span>
00587 <span class="keyword"></span>{
00588     <span class="comment">//</span>
00589     <span class="comment">// draw grid</span>
00590     <span class="comment">//</span>
00591     <span class="keywordflow">if</span> ( pfilter.<a class="code" href="class_qwt_plot_print_filter.html#a5">options</a>() &amp; QwtPlotPrintFilter::PrintGrid )
00592     {
00593         <span class="keywordflow">if</span> ( d_grid-&gt;<a class="code" href="class_qwt_plot_item.html#a6">enabled</a>() )
00594         {
00595             d_grid-&gt;<a class="code" href="class_qwt_grid.html#a2">draw</a>(painter, rect, 
00596                 map[d_grid-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a3">xAxis</a>()], map[d_grid-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a5">yAxis</a>()]);
00597         }
00598     }
00599 
00600     <span class="comment">//</span>
00601     <span class="comment">//  draw curves</span>
00602     <span class="comment">//</span>
00603     QwtPlotCurveIterator itc = <a class="code" href="class_qwt_plot.html#a37">curveIterator</a>();
00604     <span class="keywordflow">for</span> (<a class="code" href="class_qwt_plot_curve.html">QwtPlotCurve</a> *<a class="code" href="class_qwt_plot.html#a44">curve</a> = itc.toFirst(); curve != 0; curve = ++itc )
00605     {
00606         <span class="keywordflow">if</span> ( curve-&gt;<a class="code" href="class_qwt_plot_item.html#a6">enabled</a>() )
00607         {
00608             curve-&gt;<a class="code" href="class_qwt_curve.html#a33">draw</a>(painter, 
00609                 map[curve-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a3">xAxis</a>()], map[curve-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a5">yAxis</a>()]);
00610         }
00611     }
00612 
00613     <span class="comment">//</span>
00614     <span class="comment">// draw markers</span>
00615     <span class="comment">//</span>
00616     QwtPlotMarkerIterator itm = <a class="code" href="class_qwt_plot.html#a38">markerIterator</a>();
00617     <span class="keywordflow">for</span> (<a class="code" href="class_qwt_plot_marker.html">QwtPlotMarker</a> *<a class="code" href="class_qwt_plot.html#a129">marker</a> = itm.toFirst(); marker != 0; marker = ++itm )
00618     {
00619         <span class="keywordflow">if</span> ( marker-&gt;<a class="code" href="class_qwt_plot_item.html#a6">enabled</a>() )
00620         {
00621             marker-&gt;<a class="code" href="class_qwt_marker.html#a21">draw</a>(painter,
00622                 map[marker-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a3">xAxis</a>()].transform(marker-&gt;<a class="code" href="class_qwt_plot_marker.html#a1">xValue</a>()),
00623                 map[marker-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a5">yAxis</a>()].transform(marker-&gt;<a class="code" href="class_qwt_plot_marker.html#a2">yValue</a>()),
00624                 rect);
00625         }
00626     }
00627 }
00628 
<a name="l00641"></a><a class="code" href="class_qwt_plot.html#a74">00641</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a74">QwtPlot::drawCurve</a>(<span class="keywordtype">long</span> key, <span class="keywordtype">int</span> from, <span class="keywordtype">int</span> to)
00642 {
00643     <a class="code" href="class_qwt_plot_curve.html">QwtPlotCurve</a> *<a class="code" href="class_qwt_plot.html#a44">curve</a> = d_curves-&gt;find(key);
00644     <span class="keywordflow">if</span> ( !curve )
00645         <span class="keywordflow">return</span>;
00646 
00647     QPainter p(<a class="code" href="class_qwt_plot.html#a31">canvas</a>());
00648 
00649     p.setClipping(TRUE);
00650     p.setClipRect(<a class="code" href="class_qwt_plot.html#a31">canvas</a>()-&gt;contentsRect());
00651 
00652     curve-&gt;<a class="code" href="class_qwt_curve.html#a33">draw</a>(&amp;p,
00653         <a class="code" href="class_qwt_plot.html#a39">canvasMap</a>(curve-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a3">xAxis</a>()), <a class="code" href="class_qwt_plot.html#a39">canvasMap</a>(curve-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a5">yAxis</a>()),
00654         from, to);
00655 
00656     <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_plot.html#a31">canvas</a>()-&gt;<a class="code" href="class_qwt_plot_canvas.html#a3">cacheMode</a>() &amp;&amp; <a class="code" href="class_qwt_plot.html#a31">canvas</a>()-&gt;<a class="code" href="class_qwt_plot_canvas.html#a4">cache</a>())
00657     {
00658         QPainter cachePainter(<a class="code" href="class_qwt_plot.html#a31">canvas</a>()-&gt;cache());
00659         cachePainter.translate(-<a class="code" href="class_qwt_plot.html#a31">canvas</a>()-&gt;contentsRect().x(),
00660             -<a class="code" href="class_qwt_plot.html#a31">canvas</a>()-&gt;contentsRect().y());
00661 
00662         curve-&gt;<a class="code" href="class_qwt_curve.html#a33">draw</a>(&amp;cachePainter,
00663             <a class="code" href="class_qwt_plot.html#a39">canvasMap</a>(curve-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a3">xAxis</a>()), <a class="code" href="class_qwt_plot.html#a39">canvasMap</a>(curve-&gt;<a class="code" href="class_qwt_plot_mapped_item.html#a5">yAxis</a>()),
00664             from, to);
00665     }
00666 }
00667 
<a name="l00675"></a><a class="code" href="class_qwt_plot.html#a39">00675</a> <a class="code" href="class_qwt_di_map.html">QwtDiMap</a> <a class="code" href="class_qwt_plot.html#a39">QwtPlot::canvasMap</a>(<span class="keywordtype">int</span> axis)<span class="keyword"> const</span>
00676 <span class="keyword"></span>{
00677     <a class="code" href="class_qwt_di_map.html">QwtDiMap</a> map;
00678     <span class="keywordflow">if</span> ( !d_canvas )
00679         <span class="keywordflow">return</span> map;
00680 
00681     <span class="keyword">const</span> <a class="code" href="class_qwt_scale_div.html">QwtScaleDiv</a> &amp;sd = d_as[axis].<a class="code" href="class_qwt_auto_scale.html#a20">scaleDiv</a>();
00682     map.<a class="code" href="class_qwt_di_map.html#a6">setDblRange</a>(sd.<a class="code" href="class_qwt_scale_div.html#a3">lBound</a>(), sd.<a class="code" href="class_qwt_scale_div.html#a4">hBound</a>(), sd.<a class="code" href="class_qwt_scale_div.html#a7">logScale</a>());
00683 
00684     <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_plot.html#a97">axisEnabled</a>(axis) )
00685     {
00686         <span class="keyword">const</span> <a class="code" href="class_qwt_scale.html">QwtScale</a> *s = d_scale[axis];
00687         <span class="keywordflow">if</span> ( axis == yLeft || axis == yRight )
00688         {
00689             <span class="keywordtype">int</span> y = s-&gt;y() + s-&gt;<a class="code" href="class_qwt_scale.html#a12">startBorderDist</a>() - d_canvas-&gt;y();
00690             <span class="keywordtype">int</span> h = s-&gt;height() - s-&gt;<a class="code" href="class_qwt_scale.html#a12">startBorderDist</a>() - s-&gt;<a class="code" href="class_qwt_scale.html#a13">endBorderDist</a>();
00691             map.<a class="code" href="class_qwt_di_map.html#a5">setIntRange</a>(y + h - 1, y);
00692         }
00693         <span class="keywordflow">else</span>
00694         {
00695             <span class="keywordtype">int</span> x = s-&gt;x() + s-&gt;<a class="code" href="class_qwt_scale.html#a12">startBorderDist</a>() - d_canvas-&gt;x();
00696             <span class="keywordtype">int</span> w = s-&gt;width() - s-&gt;<a class="code" href="class_qwt_scale.html#a12">startBorderDist</a>() - s-&gt;<a class="code" href="class_qwt_scale.html#a13">endBorderDist</a>();
00697             map.<a class="code" href="class_qwt_di_map.html#a5">setIntRange</a>(x, x + w - 1);
00698         }
00699     }
00700     <span class="keywordflow">else</span>
00701     {
00702         <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot.html#a24">margin</a> = <a class="code" href="class_qwt_plot.html#a21">plotLayout</a>()-&gt;<a class="code" href="class_qwt_plot_layout.html#a5">canvasMargin</a>(axis);
00703 
00704         <span class="keyword">const</span> QRect &amp;canvasRect = d_canvas-&gt;contentsRect();
00705         <span class="keywordflow">if</span> ( axis == yLeft || axis == yRight )
00706         {
00707             map.<a class="code" href="class_qwt_di_map.html#a5">setIntRange</a>(canvasRect.bottom() - margin, 
00708                 canvasRect.top() + margin);
00709         }
00710         <span class="keywordflow">else</span>
00711         {
00712             map.<a class="code" href="class_qwt_di_map.html#a5">setIntRange</a>(canvasRect.left() + margin, 
00713                 canvasRect.right() - margin);
00714         }
00715     }
00716     <span class="keywordflow">return</span> map;
00717 }
00718 
<a name="l00726"></a><a class="code" href="class_qwt_plot.html#a23">00726</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a23">QwtPlot::setMargin</a>(<span class="keywordtype">int</span> margin)
00727 {
00728     <span class="keywordflow">if</span> ( margin &lt; 0 )
00729         margin = 0;
00730 
00731     <span class="keywordflow">if</span> ( margin != d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a3">margin</a>() )
00732     {
00733         d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a2">setMargin</a>(margin);
00734         <a class="code" href="class_qwt_plot.html#b6">updateLayout</a>();
00735     }
00736 }
00737 
<a name="l00742"></a><a class="code" href="class_qwt_plot.html#a24">00742</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot.html#a24">QwtPlot::margin</a>()<span class="keyword"> const</span>
00743 <span class="keyword"></span>{
00744     <span class="keywordflow">return</span> d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a3">margin</a>();
00745 }
00746 
<a name="l00755"></a><a class="code" href="class_qwt_plot.html#a33">00755</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a33">QwtPlot::setCanvasBackground</a>(<span class="keyword">const</span> QColor &amp;c)
00756 {
00757     QPalette p = d_canvas-&gt;palette();
00758 
00759     <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; QPalette::NColorGroups; i++ )
00760         p.setColor((QPalette::ColorGroup)i, QColorGroup::Background, c);
00761 
00762     <a class="code" href="class_qwt_plot.html#a31">canvas</a>()-&gt;setPalette(p);
00763 }
00764 
<a name="l00771"></a><a class="code" href="class_qwt_plot.html#a34">00771</a> <span class="keyword">const</span> QColor &amp; <a class="code" href="class_qwt_plot.html#a34">QwtPlot::canvasBackground</a>()<span class="keyword"> const</span>
00772 <span class="keyword"></span>{
00773     <span class="keywordflow">return</span> <a class="code" href="class_qwt_plot.html#a31">canvas</a>()-&gt;palette().color(
00774         QPalette::Normal, QColorGroup::Background);
00775 }
00776 
<a name="l00783"></a><a class="code" href="class_qwt_plot.html#a35">00783</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a35">QwtPlot::setCanvasLineWidth</a>(<span class="keywordtype">int</span> w)
00784 {
00785     <a class="code" href="class_qwt_plot.html#a31">canvas</a>()-&gt;setLineWidth(w);
00786 }
00787  
<a name="l00793"></a><a class="code" href="class_qwt_plot.html#a36">00793</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot.html#a36">QwtPlot::canvasLineWidth</a>()<span class="keyword"> const</span>
00794 <span class="keyword"></span>{ 
00795     <span class="keywordflow">return</span> <a class="code" href="class_qwt_plot.html#a31">canvas</a>()-&gt;lineWidth();
00796 }
00797 
00798 <span class="preprocessor">#ifndef QWT_NO_COMPAT</span>
00799 <span class="preprocessor"></span>
<a name="l00814"></a><a class="code" href="class_qwt_plot.html#a15">00814</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a15">QwtPlot::enableOutline</a>(<span class="keywordtype">bool</span> tf)
00815 {
00816     d_canvas-&gt;<a class="code" href="class_qwt_plot_canvas.html#a6">enableOutline</a>(tf);
00817 }
00818 
<a name="l00852"></a><a class="code" href="class_qwt_plot.html#a17">00852</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a17">QwtPlot::setOutlineStyle</a>(Qwt::Shape os)
00853 {
00854     d_canvas-&gt;<a class="code" href="class_qwt_plot_canvas.html#a10">setOutlineStyle</a>(os);
00855 }
00856 
<a name="l00865"></a><a class="code" href="class_qwt_plot.html#a19">00865</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a19">QwtPlot::setOutlinePen</a>(<span class="keyword">const</span> QPen &amp;pn)
00866 {
00867     d_canvas-&gt;<a class="code" href="class_qwt_plot_canvas.html#a8">setOutlinePen</a>(pn);
00868 }
00869 
<a name="l00876"></a><a class="code" href="class_qwt_plot.html#a16">00876</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot.html#a16">QwtPlot::outlineEnabled</a>()<span class="keyword"> const</span>
00877 <span class="keyword"></span>{
00878      <span class="keywordflow">return</span> d_canvas-&gt;<a class="code" href="class_qwt_plot_canvas.html#a7">outlineEnabled</a>();
00879 }
00880 
<a name="l00887"></a><a class="code" href="class_qwt_plot.html#a20">00887</a> <span class="keyword">const</span> QPen &amp; <a class="code" href="class_qwt_plot.html#a20">QwtPlot::outlinePen</a>()<span class="keyword"> const</span>
00888 <span class="keyword"></span>{
00889     <span class="keywordflow">return</span> d_canvas-&gt;<a class="code" href="class_qwt_plot_canvas.html#a9">outlinePen</a>();
00890 }
00891 
<a name="l00900"></a><a class="code" href="class_qwt_plot.html#a18">00900</a> Qwt::Shape <a class="code" href="class_qwt_plot.html#a18">QwtPlot::outlineStyle</a>()<span class="keyword"> const</span>
00901 <span class="keyword"></span>{
00902     <span class="keywordflow">return</span> d_canvas-&gt;<a class="code" href="class_qwt_plot_canvas.html#a11">outlineStyle</a>();
00903 }
00904 
00905 <span class="preprocessor">#endif // ! QWT_NO_COMPAT</span>
00906 <span class="preprocessor"></span>
<a name="l00911"></a><a class="code" href="class_qwt_plot.html#f0">00911</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot.html#f0">QwtPlot::axisValid</a>(<span class="keywordtype">int</span> axis)
00912 {
00913     <span class="keywordflow">return</span> ((axis &gt;= QwtPlot::yLeft) &amp;&amp; (axis &lt; QwtPlot::axisCnt));
00914 }
00915 
<a name="l00921"></a><a class="code" href="class_qwt_plot.html#j0">00921</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#j0">QwtPlot::lgdClicked</a>()
00922 {
00923     <span class="keywordflow">if</span> ( sender()-&gt;isWidgetType() )
00924     {
00925         <span class="keywordtype">long</span> key = d_legend-&gt;<a class="code" href="class_qwt_legend.html#a13">key</a>((QWidget *)sender());
00926         <span class="keywordflow">if</span> ( key &gt;= 0 )
00927             emit <a class="code" href="class_qwt_plot.html#l3">legendClicked</a>(key);
00928     }
00929 }
00930 
<a name="l00932"></a><a class="code" href="class_qwt_plot.html#i0">00932</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#i0">QwtPlot::clear</a>()
00933 {
00934     d_legend-&gt;<a class="code" href="class_qwt_legend.html#a14">clear</a>();
00935     d_curves-&gt;clear();
00936     d_markers-&gt;clear();
00937 }
00938 
00939 
<a name="l00941"></a><a class="code" href="class_qwt_plot.html#i2">00941</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#i2">QwtPlot::removeCurves</a>()
00942 {
00943     d_curves-&gt;clear();
00944     d_legend-&gt;<a class="code" href="class_qwt_legend.html#a14">clear</a>();
00945     <a class="code" href="class_qwt_plot.html#b0">autoRefresh</a>();
00946 }
00947 
<a name="l00949"></a><a class="code" href="class_qwt_plot.html#i4">00949</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#i4">QwtPlot::removeMarkers</a>()
00950 {
00951     d_markers-&gt;clear();
00952     <a class="code" href="class_qwt_plot.html#b0">autoRefresh</a>();
00953 }
00954 
<a name="l00965"></a><a class="code" href="class_qwt_plot.html#a157">00965</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a157">QwtPlot::setAutoLegend</a>(<span class="keywordtype">bool</span> tf)
00966 {
00967     d_autoLegend = tf;
00968 }
00969 
<a name="l00973"></a><a class="code" href="class_qwt_plot.html#a158">00973</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot.html#a158">QwtPlot::autoLegend</a>()<span class="keyword"> const</span>
00974 <span class="keyword"></span>{
00975     <span class="keywordflow">return</span> d_autoLegend;
00976 }
00977 
00978 
<a name="l00988"></a><a class="code" href="class_qwt_plot.html#a159">00988</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a159">QwtPlot::enableLegend</a>(<span class="keywordtype">bool</span> enable, <span class="keywordtype">long</span> curveKey)
00989 {
00990     <span class="keywordtype">bool</span> isUpdateEnabled = d_legend-&gt;isUpdatesEnabled();
00991     d_legend-&gt;setUpdatesEnabled(FALSE);
00992 
00993     <span class="keywordflow">if</span> ( curveKey &lt; 0 ) <span class="comment">// legends for all curves</span>
00994     {
00995         <span class="keywordflow">if</span> ( enable )
00996         {
00997             <span class="keywordflow">if</span> ( d_legend-&gt;<a class="code" href="class_qwt_legend.html#a16">itemCount</a>() &lt; d_curves-&gt;count() )
00998             {
00999                 <span class="comment">// not all curves have a legend</span>
01000 
01001                 d_legend-&gt;<a class="code" href="class_qwt_legend.html#a14">clear</a>();
01002 
01003                 QwtPlotCurveIterator itc = <a class="code" href="class_qwt_plot.html#a37">curveIterator</a>();
01004                 <span class="keywordflow">for</span> ( <span class="keyword">const</span> <a class="code" href="class_qwt_plot_curve.html">QwtPlotCurve</a> *<a class="code" href="class_qwt_plot.html#a44">curve</a> = itc.toFirst();
01005                     curve != 0; curve = ++itc )
01006                 {
01007                     <a class="code" href="class_qwt_plot.html#b8">insertLegendItem</a>(itc.currentKey());
01008                 }
01009             }
01010         }
01011         <span class="keywordflow">else</span>
01012         {
01013             d_legend-&gt;<a class="code" href="class_qwt_legend.html#a14">clear</a>();
01014         }
01015     }
01016     <span class="keywordflow">else</span>
01017     {
01018         QWidget *legendItem = d_legend-&gt;<a class="code" href="class_qwt_legend.html#a9">findItem</a>(curveKey);
01019         <span class="keywordflow">if</span> ( enable )
01020         {
01021             <span class="keywordflow">if</span> ( d_curves-&gt;find(curveKey) &amp;&amp; !legendItem )
01022                 <a class="code" href="class_qwt_plot.html#b8">insertLegendItem</a>(curveKey);
01023         }
01024         <span class="keywordflow">else</span>
01025             <span class="keyword">delete</span> legendItem;
01026     }
01027 
01028     d_legend-&gt;setUpdatesEnabled(isUpdateEnabled);
01029     <a class="code" href="class_qwt_plot.html#b6">updateLayout</a>();
01030 }
01031 
<a name="l01037"></a><a class="code" href="class_qwt_plot.html#a160">01037</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_plot.html#a160">QwtPlot::legendEnabled</a>(<span class="keywordtype">long</span> curveKey)<span class="keyword"> const</span>
01038 <span class="keyword"></span>{
01039     <span class="keywordflow">return</span> d_legend-&gt;<a class="code" href="class_qwt_legend.html#a9">findItem</a>(curveKey) != 0;
01040 }
01041 
<a name="l01060"></a><a class="code" href="class_qwt_plot.html#a161">01060</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a161">QwtPlot::setLegendPosition</a>(QwtPlot::Position pos, <span class="keywordtype">double</span> ratio)
01061 {
01062     <span class="keywordflow">if</span> (pos != d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a12">legendPosition</a>())
01063     {
01064         d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a10">setLegendPosition</a>(pos, ratio);
01065 
01066         QLayout *l = d_legend-&gt;<a class="code" href="class_qwt_legend.html#a6">contentsWidget</a>()-&gt;layout();
01067         <span class="keywordflow">if</span> ( l &amp;&amp; l-&gt;inherits(<span class="stringliteral">"QwtDynGridLayout"</span>) )
01068         {
01069             <a class="code" href="class_qwt_dyn_grid_layout.html">QwtDynGridLayout</a> *tl = (<a class="code" href="class_qwt_dyn_grid_layout.html">QwtDynGridLayout</a> *)l;
01070             <span class="keywordflow">if</span> ( d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a12">legendPosition</a>() == QwtPlot::Top ||
01071                 d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a12">legendPosition</a>() == QwtPlot::Bottom )
01072             {
01073                 tl-&gt;<a class="code" href="class_qwt_dyn_grid_layout.html#a5">setMaxCols</a>(0); <span class="comment">// unlimited</span>
01074             }
01075             <span class="keywordflow">else</span>
01076                 tl-&gt;<a class="code" href="class_qwt_dyn_grid_layout.html#a5">setMaxCols</a>(1); <span class="comment">// 1 column: align vertical</span>
01077         }
01078 
01079         <a class="code" href="class_qwt_plot.html#b6">updateLayout</a>();
01080         <a class="code" href="class_qwt_plot.html#b4">updateTabOrder</a>();
01081     }
01082 }
01083 
<a name="l01096"></a><a class="code" href="class_qwt_plot.html#a162">01096</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a161">QwtPlot::setLegendPosition</a>(QwtPlot::Position pos)
01097 {
01098     <a class="code" href="class_qwt_plot.html#a161">setLegendPosition</a>(pos, 0.0);
01099 }
01100 
<a name="l01105"></a><a class="code" href="class_qwt_plot.html#a163">01105</a> <a class="code" href="class_qwt_plot.html#w10">QwtPlot::Position</a> <a class="code" href="class_qwt_plot.html#a163">QwtPlot::legendPosition</a>()<span class="keyword"> const</span>
01106 <span class="keyword"></span>{
01107     <span class="keywordflow">return</span> d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a12">legendPosition</a>();
01108 }
01109 
01110 <span class="preprocessor">#ifndef QWT_NO_COMPAT</span>
01111 <span class="preprocessor"></span>
<a name="l01131"></a><a class="code" href="class_qwt_plot.html#a164">01131</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a164">QwtPlot::setLegendPos</a>(<span class="keywordtype">int</span> pos, <span class="keywordtype">double</span> ratio)
01132 {
01133     <a class="code" href="class_qwt_plot.html#a161">setLegendPosition</a>(<a class="code" href="class_qwt_plot.html#w10">QwtPlot::Position</a>(pos), ratio);
01134 }
01135 
<a name="l01141"></a><a class="code" href="class_qwt_plot.html#a165">01141</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot.html#a165">QwtPlot::legendPos</a>()<span class="keyword"> const</span>
01142 <span class="keyword"></span>{
01143     <span class="keywordflow">return</span> d_layout-&gt;<a class="code" href="class_qwt_plot_layout.html#a12">legendPosition</a>();
01144 }
01145 
01146 <span class="preprocessor">#endif // !QWT_NO_COMPAT</span>
01147 <span class="preprocessor"></span>
<a name="l01152"></a><a class="code" href="class_qwt_plot.html#a166">01152</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a166">QwtPlot::setLegendFont</a>(<span class="keyword">const</span> QFont &amp;f)
01153 {
01154     d_legend-&gt;setFont(f);
01155     <span class="keywordflow">if</span> (d_legend-&gt;isVisible())
01156         <a class="code" href="class_qwt_plot.html#b6">updateLayout</a>();
01157 }
01158 
<a name="l01163"></a><a class="code" href="class_qwt_plot.html#a168">01163</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a168">QwtPlot::setLegendFrameStyle</a>(<span class="keywordtype">int</span> st)
01164 {
01165     d_legend-&gt;setFrameStyle(st);
01166     <a class="code" href="class_qwt_plot.html#b6">updateLayout</a>();
01167 }
01168 
<a name="l01172"></a><a class="code" href="class_qwt_plot.html#a169">01172</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot.html#a169">QwtPlot::legendFrameStyle</a>()<span class="keyword"> const</span>
01173 <span class="keyword"></span>{
01174     <span class="keywordflow">return</span> d_legend-&gt;frameStyle();
01175 }
01176 
<a name="l01180"></a><a class="code" href="class_qwt_plot.html#a167">01180</a> <span class="keyword">const</span> QFont <a class="code" href="class_qwt_plot.html#a167">QwtPlot::legendFont</a>()<span class="keyword"> const</span>
01181 <span class="keyword"></span>{
01182     <span class="keywordflow">return</span> d_legend-&gt;font();
01183 }
01184 
<a name="l01191"></a><a class="code" href="class_qwt_plot.html#a172">01191</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#a172">QwtPlot::setLegendDisplayPolicy</a>(
01192     QwtLegend::LegendDisplayPolicy policy, <span class="keywordtype">int</span> mode)
01193 {
01194     d_legend-&gt;<a class="code" href="class_qwt_legend.html#a3">setDisplayPolicy</a>(policy, mode);
01195     
01196     <span class="keywordflow">for</span> (QwtPlotCurveIterator iter=<a class="code" href="class_qwt_plot.html#a37">curveIterator</a>(); iter.current(); ++iter)
01197         <a class="code" href="class_qwt_plot.html#b9">updateLegendItem</a>(iter.currentKey());
01198 }
01199 
01200 <span class="comment">// Local Variables:</span>
01201 <span class="comment">// mode: C++</span>
01202 <span class="comment">// c-file-style: "stroustrup"</span>
01203 <span class="comment">// indent-tabs-mode: nil</span>
01204 <span class="comment">// End:</span>
</div></pre><hr size="1"><address style="align: right;"><small>Generated on Tue Nov 16 21:12:20 2004 for Qwt User's Guide by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address>
</body>
</html>