1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3
<title>Qwt User's Guide: qwt_plot_print.cpp Source File</title>
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
5
<link href="tabs.css" rel="stylesheet" type="text/css">
7
<!-- Generated by Doxygen 1.5.0 -->
10
<li><a href="index.html"><span>Main Page</span></a></li>
11
<li><a href="classes.html"><span>Classes</span></a></li>
12
<li id="current"><a href="files.html"><span>Files</span></a></li>
13
<li><a href="pages.html"><span>Related Pages</span></a></li>
17
<li><a href="files.html"><span>File List</span></a></li>
18
<li><a href="globals.html"><span>File Members</span></a></li>
20
<h1>qwt_plot_print.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************</span>
21
<a name="l00002"></a>00002 <span class="comment"> * Qwt Widget Library</span>
22
<a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 1997 Josef Wilgen</span>
23
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002 Uwe Rathmann</span>
24
<a name="l00005"></a>00005 <span class="comment"> *</span>
25
<a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
26
<a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of the Qwt License, Version 1.0</span>
27
<a name="l00008"></a>00008 <span class="comment"> *****************************************************************************/</span>
28
<a name="l00009"></a>00009
29
<a name="l00010"></a>00010 <span class="comment">// vim: expandtab</span>
30
<a name="l00011"></a>00011
31
<a name="l00012"></a>00012 <span class="preprocessor">#include <qpainter.h></span>
32
<a name="l00013"></a>00013 <span class="preprocessor">#if QT_VERSION < 0x040000</span>
33
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#include <qpaintdevicemetrics.h></span>
34
<a name="l00015"></a>00015 <span class="preprocessor">#else</span>
35
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#include <qpaintengine.h></span>
36
<a name="l00017"></a>00017 <span class="preprocessor">#endif</span>
37
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#include "qwt_painter.h"</span>
38
<a name="l00019"></a>00019 <span class="preprocessor">#include "qwt_legend_item.h"</span>
39
<a name="l00020"></a>00020 <span class="preprocessor">#include "qwt_plot.h"</span>
40
<a name="l00021"></a>00021 <span class="preprocessor">#include "qwt_plot_canvas.h"</span>
41
<a name="l00022"></a>00022 <span class="preprocessor">#include "qwt_plot_layout.h"</span>
42
<a name="l00023"></a>00023 <span class="preprocessor">#include "qwt_legend.h"</span>
43
<a name="l00024"></a>00024 <span class="preprocessor">#include "qwt_dyngrid_layout.h"</span>
44
<a name="l00025"></a>00025 <span class="preprocessor">#include "qwt_scale_widget.h"</span>
45
<a name="l00026"></a>00026 <span class="preprocessor">#include "qwt_scale_engine.h"</span>
46
<a name="l00027"></a>00027 <span class="preprocessor">#include "qwt_text.h"</span>
47
<a name="l00028"></a>00028 <span class="preprocessor">#include "qwt_text_label.h"</span>
48
<a name="l00029"></a>00029 <span class="preprocessor">#include "qwt_math.h"</span>
49
<a name="l00030"></a>00030
50
<a name="l00043"></a><a class="code" href="class_qwt_plot.html#d6270719d1ca5ac5952ab5e7fec3f84a">00043</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#d6270719d1ca5ac5952ab5e7fec3f84a">QwtPlot::print</a>(QPaintDevice &paintDev,
51
<a name="l00044"></a>00044 <span class="keyword">const</span> <a class="code" href="class_qwt_plot_print_filter.html">QwtPlotPrintFilter</a> &pfilter)<span class="keyword"> const</span>
52
<a name="l00045"></a>00045 <span class="keyword"></span>{
53
<a name="l00046"></a>00046 <span class="preprocessor">#if QT_VERSION < 0x040000</span>
54
<a name="l00047"></a>00047 <span class="preprocessor"></span> QPaintDeviceMetrics mpr(&paintDev);
55
<a name="l00048"></a>00048 <span class="keywordtype">int</span> w = mpr.width();
56
<a name="l00049"></a>00049 <span class="keywordtype">int</span> h = mpr.height();
57
<a name="l00050"></a>00050 <span class="preprocessor">#else</span>
58
<a name="l00051"></a>00051 <span class="preprocessor"></span> <span class="keywordtype">int</span> w = paintDev.width();
59
<a name="l00052"></a>00052 <span class="keywordtype">int</span> h = paintDev.height();
60
<a name="l00053"></a>00053 <span class="preprocessor">#endif</span>
61
<a name="l00054"></a>00054 <span class="preprocessor"></span>
62
<a name="l00055"></a>00055 QRect rect(0, 0, w, h);
63
<a name="l00056"></a>00056 <span class="keywordtype">double</span> aspect = double(rect.width())/<span class="keywordtype">double</span>(rect.height());
64
<a name="l00057"></a>00057 <span class="keywordflow">if</span> ((aspect < 1.0))
65
<a name="l00058"></a>00058 rect.setHeight(<span class="keywordtype">int</span>(aspect*rect.width()));
66
<a name="l00059"></a>00059
67
<a name="l00060"></a>00060 QPainter p(&paintDev);
68
<a name="l00061"></a>00061 <a class="code" href="class_qwt_plot.html#d6270719d1ca5ac5952ab5e7fec3f84a">print</a>(&p, rect, pfilter);
69
<a name="l00062"></a>00062 }
70
<a name="l00063"></a>00063
71
<a name="l00073"></a><a class="code" href="class_qwt_plot.html#034ba0fb75a71f0a3000636bf1c2388b">00073</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#d6270719d1ca5ac5952ab5e7fec3f84a">QwtPlot::print</a>(QPainter *painter, <span class="keyword">const</span> QRect &plotRect,
72
<a name="l00074"></a>00074 <span class="keyword">const</span> <a class="code" href="class_qwt_plot_print_filter.html">QwtPlotPrintFilter</a> &pfilter)<span class="keyword"> const</span>
73
<a name="l00075"></a>00075 <span class="keyword"></span>{
74
<a name="l00076"></a>00076 <span class="keywordtype">int</span> axisId;
75
<a name="l00077"></a>00077
76
<a name="l00078"></a>00078 <span class="keywordflow">if</span> ( painter == 0 || !painter->isActive() ||
77
<a name="l00079"></a>00079 !plotRect.isValid() || size().isNull() )
78
<a name="l00080"></a>00080 <span class="keywordflow">return</span>;
79
<a name="l00081"></a>00081
80
<a name="l00082"></a>00082 painter->save();
81
<a name="l00083"></a>00083 <span class="preprocessor">#if 1</span>
82
<a name="l00084"></a>00084 <span class="preprocessor"></span> <span class="comment">/*</span>
83
<a name="l00085"></a>00085 <span class="comment"> PDF: In Qt4 ( <= 4.3.2 ) the scales are painted in gray instead of</span>
84
<a name="l00086"></a>00086 <span class="comment"> black. See http://trolltech.com/developer/task-tracker/index_html?id=184671&method=entry</span>
85
<a name="l00087"></a>00087 <span class="comment"> The dummy lines below work around the problem.</span>
86
<a name="l00088"></a>00088 <span class="comment"> */</span>
87
<a name="l00089"></a>00089 <span class="keyword">const</span> QPen pen = painter->pen();
88
<a name="l00090"></a>00090 painter->setPen(QPen(Qt::black, 1));
89
<a name="l00091"></a>00091 painter->setPen(pen);
90
<a name="l00092"></a>00092 <span class="preprocessor">#endif</span>
91
<a name="l00093"></a>00093 <span class="preprocessor"></span>
92
<a name="l00094"></a>00094 <span class="comment">// All paint operations need to be scaled according to</span>
93
<a name="l00095"></a>00095 <span class="comment">// the paint device metrics. </span>
94
<a name="l00096"></a>00096
95
<a name="l00097"></a>00097 <a class="code" href="class_qwt_painter.html#952553514abb7ab83c4a43602c899777">QwtPainter::setMetricsMap</a>(<span class="keyword">this</span>, painter->device());
96
<a name="l00098"></a>00098 <span class="keyword">const</span> <a class="code" href="class_qwt_metrics_map.html">QwtMetricsMap</a> &metricsMap = <a class="code" href="class_qwt_painter.html#3de95bfc83c9beee537404b41749bad5">QwtPainter::metricsMap</a>();
97
<a name="l00099"></a>00099
98
<a name="l00100"></a>00100 <span class="comment">// It is almost impossible to integrate into the Qt layout</span>
99
<a name="l00101"></a>00101 <span class="comment">// framework, when using different fonts for printing</span>
100
<a name="l00102"></a>00102 <span class="comment">// and screen. To avoid writing different and Qt unconform</span>
101
<a name="l00103"></a>00103 <span class="comment">// layout engines we change the widget attributes, print and </span>
102
<a name="l00104"></a>00104 <span class="comment">// reset the widget attributes again. This way we produce a lot of</span>
103
<a name="l00105"></a>00105 <span class="comment">// useless layout events ...</span>
104
<a name="l00106"></a>00106
105
<a name="l00107"></a>00107 pfilter.<a class="code" href="class_qwt_plot_print_filter.html#6bebb12041b92937a58039a7fe911400">apply</a>((<a class="code" href="class_qwt_plot.html">QwtPlot</a> *)<span class="keyword">this</span>);
106
<a name="l00108"></a>00108
107
<a name="l00109"></a>00109 <span class="keywordtype">int</span> baseLineDists[QwtPlot::axisCnt];
108
<a name="l00110"></a>00110 <span class="keywordflow">if</span> ( pfilter.<a class="code" href="class_qwt_plot_print_filter.html#32a2f1df034b8ca130054f1ae034dad0">options</a>() & QwtPlotPrintFilter::PrintFrameWithScales )
109
<a name="l00111"></a>00111 {
110
<a name="l00112"></a>00112 <span class="keywordflow">for</span> (axisId = 0; axisId < QwtPlot::axisCnt; axisId++ )
111
<a name="l00113"></a>00113 {
112
<a name="l00114"></a>00114 <a class="code" href="class_qwt_scale_widget.html">QwtScaleWidget</a> *scaleWidget = (<a class="code" href="class_qwt_scale_widget.html">QwtScaleWidget</a> *)<a class="code" href="class_qwt_plot.html#8436c30175884d7643d68fd0dd236cd8">axisWidget</a>(axisId);
113
<a name="l00115"></a>00115 <span class="keywordflow">if</span> ( scaleWidget )
114
<a name="l00116"></a>00116 {
115
<a name="l00117"></a>00117 baseLineDists[axisId] = scaleWidget-><a class="code" href="class_qwt_scale_widget.html#c43b364e0f0bfb0895f66e5bb21d665d">margin</a>();
116
<a name="l00118"></a>00118 scaleWidget->setMargin(0);
117
<a name="l00119"></a>00119 }
118
<a name="l00120"></a>00120 }
119
<a name="l00121"></a>00121 }
120
<a name="l00122"></a>00122 <span class="comment">// Calculate the layout for the print.</span>
121
<a name="l00123"></a>00123
122
<a name="l00124"></a>00124 <span class="keywordtype">int</span> layoutOptions = QwtPlotLayout::IgnoreScrollbars
123
<a name="l00125"></a>00125 | QwtPlotLayout::IgnoreFrames;
124
<a name="l00126"></a>00126 <span class="keywordflow">if</span> ( !(pfilter.<a class="code" href="class_qwt_plot_print_filter.html#32a2f1df034b8ca130054f1ae034dad0">options</a>() & QwtPlotPrintFilter::PrintMargin) )
125
<a name="l00127"></a>00127 layoutOptions |= QwtPlotLayout::IgnoreMargin;
126
<a name="l00128"></a>00128 <span class="keywordflow">if</span> ( !(pfilter.<a class="code" href="class_qwt_plot_print_filter.html#32a2f1df034b8ca130054f1ae034dad0">options</a>() & QwtPlotPrintFilter::PrintLegend) )
127
<a name="l00129"></a>00129 layoutOptions |= QwtPlotLayout::IgnoreLegend;
128
<a name="l00130"></a>00130
129
<a name="l00131"></a>00131 ((<a class="code" href="class_qwt_plot.html">QwtPlot</a> *)<span class="keyword">this</span>)->plotLayout()->activate(<span class="keyword">this</span>,
130
<a name="l00132"></a>00132 <a class="code" href="class_qwt_painter.html#3de95bfc83c9beee537404b41749bad5">QwtPainter::metricsMap</a>().deviceToLayout(plotRect),
131
<a name="l00133"></a>00133 layoutOptions);
132
<a name="l00134"></a>00134
133
<a name="l00135"></a>00135 <span class="keywordflow">if</span> ((pfilter.<a class="code" href="class_qwt_plot_print_filter.html#32a2f1df034b8ca130054f1ae034dad0">options</a>() & QwtPlotPrintFilter::PrintTitle)
134
<a name="l00136"></a>00136 && (!<a class="code" href="class_qwt_plot.html#c39356b86ed70ebf256a8ae964910206">titleLabel</a>()->text().isEmpty()))
135
<a name="l00137"></a>00137 {
136
<a name="l00138"></a>00138 <a class="code" href="class_qwt_plot.html#37a3264b7e3bc692f35474a82a6ab28b">printTitle</a>(painter, <a class="code" href="class_qwt_plot.html#9156b14a6f67f6279a16fea063ce1d14">plotLayout</a>()->titleRect());
137
<a name="l00139"></a>00139 }
138
<a name="l00140"></a>00140
139
<a name="l00141"></a>00141 <span class="keywordflow">if</span> ( (pfilter.<a class="code" href="class_qwt_plot_print_filter.html#32a2f1df034b8ca130054f1ae034dad0">options</a>() & QwtPlotPrintFilter::PrintLegend)
140
<a name="l00142"></a>00142 && <a class="code" href="class_qwt_plot.html#ab1f2cf0e567e09a4c4bce3181c03ba0">legend</a>() && !<a class="code" href="class_qwt_plot.html#ab1f2cf0e567e09a4c4bce3181c03ba0">legend</a>()-><a class="code" href="class_qwt_legend.html#ced18eb9dc01af9f89da7e52491a9ee1">isEmpty</a>() )
141
<a name="l00143"></a>00143 {
142
<a name="l00144"></a>00144 <a class="code" href="class_qwt_plot.html#4a082258f60aef10b3bcdab1574d2ae2">printLegend</a>(painter, <a class="code" href="class_qwt_plot.html#9156b14a6f67f6279a16fea063ce1d14">plotLayout</a>()->legendRect());
143
<a name="l00145"></a>00145 }
144
<a name="l00146"></a>00146
145
<a name="l00147"></a>00147 <span class="keywordflow">for</span> ( axisId = 0; axisId < QwtPlot::axisCnt; axisId++ )
146
<a name="l00148"></a>00148 {
147
<a name="l00149"></a>00149 <a class="code" href="class_qwt_scale_widget.html">QwtScaleWidget</a> *scaleWidget = (<a class="code" href="class_qwt_scale_widget.html">QwtScaleWidget</a> *)<a class="code" href="class_qwt_plot.html#8436c30175884d7643d68fd0dd236cd8">axisWidget</a>(axisId);
148
<a name="l00150"></a>00150 <span class="keywordflow">if</span> (scaleWidget)
149
<a name="l00151"></a>00151 {
150
<a name="l00152"></a>00152 <span class="keywordtype">int</span> baseDist = scaleWidget-><a class="code" href="class_qwt_scale_widget.html#c43b364e0f0bfb0895f66e5bb21d665d">margin</a>();
151
<a name="l00153"></a>00153
152
<a name="l00154"></a>00154 <span class="keywordtype">int</span> startDist, endDist;
153
<a name="l00155"></a>00155 scaleWidget->getBorderDistHint(startDist, endDist);
154
<a name="l00156"></a>00156
155
<a name="l00157"></a>00157 <a class="code" href="class_qwt_plot.html#d881d5918384f5a0f112c2faa68ab031">printScale</a>(painter, axisId, startDist, endDist,
156
<a name="l00158"></a>00158 baseDist, <a class="code" href="class_qwt_plot.html#9156b14a6f67f6279a16fea063ce1d14">plotLayout</a>()->scaleRect(axisId));
157
<a name="l00159"></a>00159 }
158
<a name="l00160"></a>00160 }
159
<a name="l00161"></a>00161
160
<a name="l00162"></a>00162 QRect canvasRect = <a class="code" href="class_qwt_plot.html#9156b14a6f67f6279a16fea063ce1d14">plotLayout</a>()-><a class="code" href="class_qwt_plot_layout.html#4a9dbf29dd65a72296f9870f8cc7f157">canvasRect</a>();
161
<a name="l00163"></a>00163
162
<a name="l00164"></a>00164 <span class="comment">/* </span>
163
<a name="l00165"></a>00165 <span class="comment"> The border of the bounding rect needs to ba scaled to</span>
164
<a name="l00166"></a>00166 <span class="comment"> layout coordinates, so that it is aligned to the axes </span>
165
<a name="l00167"></a>00167 <span class="comment"> */</span>
166
<a name="l00168"></a>00168 QRect boundingRect( canvasRect.left() - 1, canvasRect.top() - 1,
167
<a name="l00169"></a>00169 canvasRect.width() + 2, canvasRect.height() + 2);
168
<a name="l00170"></a>00170 boundingRect = metricsMap.layoutToDevice(boundingRect);
169
<a name="l00171"></a>00171 boundingRect.setWidth(boundingRect.width() - 1);
170
<a name="l00172"></a>00172 boundingRect.setHeight(boundingRect.height() - 1);
171
<a name="l00173"></a>00173
172
<a name="l00174"></a>00174 canvasRect = metricsMap.layoutToDevice(canvasRect);
173
<a name="l00175"></a>00175
174
<a name="l00176"></a>00176 <span class="comment">// When using QwtPainter all sizes where computed in pixel</span>
175
<a name="l00177"></a>00177 <span class="comment">// coordinates and scaled by QwtPainter later. This limits</span>
176
<a name="l00178"></a>00178 <span class="comment">// the precision to screen resolution. A better solution</span>
177
<a name="l00179"></a>00179 <span class="comment">// is to scale the maps and print in unlimited resolution.</span>
178
<a name="l00180"></a>00180
179
<a name="l00181"></a>00181 <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> map[axisCnt];
180
<a name="l00182"></a>00182 <span class="keywordflow">for</span> (axisId = 0; axisId < axisCnt; axisId++)
181
<a name="l00183"></a>00183 {
182
<a name="l00184"></a>00184 map[axisId].setTransformation(<a class="code" href="class_qwt_plot.html#619b65bb95090ab5a528e33a5014ae4f">axisScaleEngine</a>(axisId)->transformation());
183
<a name="l00185"></a>00185
184
<a name="l00186"></a>00186 <span class="keyword">const</span> <a class="code" href="class_qwt_scale_div.html">QwtScaleDiv</a> &scaleDiv = *<a class="code" href="class_qwt_plot.html#029086e7b26fcfeff5430d25a4df4f3e">axisScaleDiv</a>(axisId);
185
<a name="l00187"></a>00187 map[axisId].<a class="code" href="class_qwt_scale_map.html#aa33bc8e1aed7aa17d345053194e7094">setScaleInterval</a>(scaleDiv.<a class="code" href="class_qwt_scale_div.html#df5e9211cd42a3efc1a3cdf836dc741a">lBound</a>(), scaleDiv.<a class="code" href="class_qwt_scale_div.html#8c6238cf9e8f406e9633fcede305e33c">hBound</a>());
186
<a name="l00188"></a>00188
187
<a name="l00189"></a>00189 <span class="keywordtype">double</span> from, to;
188
<a name="l00190"></a>00190 <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_plot.html#a6d08ba153cb46662692611b5c38bbe0">axisEnabled</a>(axisId) )
189
<a name="l00191"></a>00191 {
190
<a name="l00192"></a>00192 <span class="keyword">const</span> <span class="keywordtype">int</span> sDist = <a class="code" href="class_qwt_plot.html#8436c30175884d7643d68fd0dd236cd8">axisWidget</a>(axisId)-><a class="code" href="class_qwt_scale_widget.html#000a9be0eede5f43c938963ebba62305">startBorderDist</a>();
191
<a name="l00193"></a>00193 <span class="keyword">const</span> <span class="keywordtype">int</span> eDist = <a class="code" href="class_qwt_plot.html#8436c30175884d7643d68fd0dd236cd8">axisWidget</a>(axisId)-><a class="code" href="class_qwt_scale_widget.html#76a5e92a7b138238a8e0b7288842f9c8">endBorderDist</a>();
192
<a name="l00194"></a>00194 <span class="keyword">const</span> QRect &scaleRect = <a class="code" href="class_qwt_plot.html#9156b14a6f67f6279a16fea063ce1d14">plotLayout</a>()-><a class="code" href="class_qwt_plot_layout.html#350bb42101aa3a1a76ebd3eac70b9c42">scaleRect</a>(axisId);
193
<a name="l00195"></a>00195
194
<a name="l00196"></a>00196 <span class="keywordflow">if</span> ( axisId == xTop || axisId == xBottom )
195
<a name="l00197"></a>00197 {
196
<a name="l00198"></a>00198 from = metricsMap.layoutToDeviceX(scaleRect.left() + sDist);
197
<a name="l00199"></a>00199 to = metricsMap.layoutToDeviceX(scaleRect.right() + 1 - eDist);
198
<a name="l00200"></a>00200 }
199
<a name="l00201"></a>00201 <span class="keywordflow">else</span>
200
<a name="l00202"></a>00202 {
201
<a name="l00203"></a>00203 from = metricsMap.layoutToDeviceY(scaleRect.bottom() + 1 - eDist );
202
<a name="l00204"></a>00204 to = metricsMap.layoutToDeviceY(scaleRect.top() + sDist);
203
<a name="l00205"></a>00205 }
204
<a name="l00206"></a>00206 }
205
<a name="l00207"></a>00207 <span class="keywordflow">else</span>
206
<a name="l00208"></a>00208 {
207
<a name="l00209"></a>00209 <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot.html#a1cd0fa079f2057df3ddb33355bf9536">margin</a> = <a class="code" href="class_qwt_plot.html#9156b14a6f67f6279a16fea063ce1d14">plotLayout</a>()-><a class="code" href="class_qwt_plot_layout.html#1cf0064eb5a13e05c6db530c9269728d">canvasMargin</a>(axisId);
208
<a name="l00210"></a>00210 <span class="keywordflow">if</span> ( axisId == yLeft || axisId == yRight )
209
<a name="l00211"></a>00211 {
210
<a name="l00212"></a>00212 from = metricsMap.layoutToDeviceX(canvasRect.bottom() - margin);
211
<a name="l00213"></a>00213 to = metricsMap.layoutToDeviceX(canvasRect.top() + margin);
212
<a name="l00214"></a>00214 }
213
<a name="l00215"></a>00215 <span class="keywordflow">else</span>
214
<a name="l00216"></a>00216 {
215
<a name="l00217"></a>00217 from = metricsMap.layoutToDeviceY(canvasRect.left() + margin);
216
<a name="l00218"></a>00218 to = metricsMap.layoutToDeviceY(canvasRect.right() - margin);
217
<a name="l00219"></a>00219 }
218
<a name="l00220"></a>00220 }
219
<a name="l00221"></a>00221 map[axisId].<a class="code" href="class_qwt_scale_map.html#1679ba72903986ff546c4c197e4680c0">setPaintXInterval</a>(from, to);
220
<a name="l00222"></a>00222 }
221
<a name="l00223"></a>00223
222
<a name="l00224"></a>00224 <span class="comment">// The canvas maps are already scaled. </span>
223
<a name="l00225"></a>00225 <a class="code" href="class_qwt_painter.html#952553514abb7ab83c4a43602c899777">QwtPainter::setMetricsMap</a>(painter->device(), painter->device());
224
<a name="l00226"></a>00226 <a class="code" href="class_qwt_plot.html#d42514cf3728466a720d2a1290f13a53">printCanvas</a>(painter, boundingRect, canvasRect, map, pfilter);
225
<a name="l00227"></a>00227 <a class="code" href="class_qwt_painter.html#0a20214cff4c8edd4c3caa0ad3a2112f">QwtPainter::resetMetricsMap</a>();
226
<a name="l00228"></a>00228
227
<a name="l00229"></a>00229 ((<a class="code" href="class_qwt_plot.html">QwtPlot</a> *)<span class="keyword">this</span>)->plotLayout()->invalidate();
228
<a name="l00230"></a>00230
229
<a name="l00231"></a>00231 <span class="comment">// reset all widgets with their original attributes.</span>
230
<a name="l00232"></a>00232 <span class="keywordflow">if</span> ( pfilter.<a class="code" href="class_qwt_plot_print_filter.html#32a2f1df034b8ca130054f1ae034dad0">options</a>() & QwtPlotPrintFilter::PrintFrameWithScales )
231
<a name="l00233"></a>00233 {
232
<a name="l00234"></a>00234 <span class="comment">// restore the previous base line dists</span>
233
<a name="l00235"></a>00235
234
<a name="l00236"></a>00236 <span class="keywordflow">for</span> (axisId = 0; axisId < QwtPlot::axisCnt; axisId++ )
235
<a name="l00237"></a>00237 {
236
<a name="l00238"></a>00238 <a class="code" href="class_qwt_scale_widget.html">QwtScaleWidget</a> *scaleWidget = (<a class="code" href="class_qwt_scale_widget.html">QwtScaleWidget</a> *)<a class="code" href="class_qwt_plot.html#8436c30175884d7643d68fd0dd236cd8">axisWidget</a>(axisId);
237
<a name="l00239"></a>00239 <span class="keywordflow">if</span> ( scaleWidget )
238
<a name="l00240"></a>00240 scaleWidget-><a class="code" href="class_qwt_scale_widget.html#36d92ef63d996fe1fd58a46431924ab6">setMargin</a>(baseLineDists[axisId]);
239
<a name="l00241"></a>00241 }
240
<a name="l00242"></a>00242 }
241
<a name="l00243"></a>00243
242
<a name="l00244"></a>00244 pfilter.<a class="code" href="class_qwt_plot_print_filter.html#5acdc8e766abfafd1956bae143a0fe00">reset</a>((<a class="code" href="class_qwt_plot.html">QwtPlot</a> *)<span class="keyword">this</span>);
243
<a name="l00245"></a>00245
244
<a name="l00246"></a>00246 painter->restore();
245
<a name="l00247"></a>00247 }
246
<a name="l00248"></a>00248
247
<a name="l00256"></a><a class="code" href="class_qwt_plot.html#37a3264b7e3bc692f35474a82a6ab28b">00256</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#37a3264b7e3bc692f35474a82a6ab28b">QwtPlot::printTitle</a>(QPainter *painter, <span class="keyword">const</span> QRect &rect)<span class="keyword"> const</span>
248
<a name="l00257"></a>00257 <span class="keyword"></span>{
249
<a name="l00258"></a>00258 painter->setFont(<a class="code" href="class_qwt_plot.html#c39356b86ed70ebf256a8ae964910206">titleLabel</a>()->font());
250
<a name="l00259"></a>00259
251
<a name="l00260"></a>00260 <span class="keyword">const</span> QColor color =
252
<a name="l00261"></a>00261 <span class="preprocessor">#if QT_VERSION < 0x040000</span>
253
<a name="l00262"></a>00262 <span class="preprocessor"></span> <a class="code" href="class_qwt_plot.html#c39356b86ed70ebf256a8ae964910206">titleLabel</a>()->palette().color(
254
<a name="l00263"></a>00263 QPalette::Active, QColorGroup::Text);
255
<a name="l00264"></a>00264 <span class="preprocessor">#else</span>
256
<a name="l00265"></a>00265 <span class="preprocessor"></span> <a class="code" href="class_qwt_plot.html#c39356b86ed70ebf256a8ae964910206">titleLabel</a>()->palette().color(
257
<a name="l00266"></a>00266 QPalette::Active, QPalette::Text);
258
<a name="l00267"></a>00267 <span class="preprocessor">#endif</span>
259
<a name="l00268"></a>00268 <span class="preprocessor"></span>
260
<a name="l00269"></a>00269 painter->setPen(color);
261
<a name="l00270"></a>00270 <a class="code" href="class_qwt_plot.html#c39356b86ed70ebf256a8ae964910206">titleLabel</a>()-><a class="code" href="class_qwt_text_label.html#65113573cdf1fe4098a324453e11fe4e">text</a>().<a class="code" href="class_qwt_text.html#f3109303b3e0fea0ee21879666c3c870">draw</a>(painter, rect);
262
<a name="l00271"></a>00271 }
263
<a name="l00272"></a>00272
264
<a name="l00280"></a><a class="code" href="class_qwt_plot.html#4a082258f60aef10b3bcdab1574d2ae2">00280</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#4a082258f60aef10b3bcdab1574d2ae2">QwtPlot::printLegend</a>(QPainter *painter, <span class="keyword">const</span> QRect &rect)<span class="keyword"> const</span>
265
<a name="l00281"></a>00281 <span class="keyword"></span>{
266
<a name="l00282"></a>00282 <span class="keywordflow">if</span> ( !<a class="code" href="class_qwt_plot.html#ab1f2cf0e567e09a4c4bce3181c03ba0">legend</a>() || <a class="code" href="class_qwt_plot.html#ab1f2cf0e567e09a4c4bce3181c03ba0">legend</a>()->isEmpty() )
267
<a name="l00283"></a>00283 <span class="keywordflow">return</span>;
268
<a name="l00284"></a>00284
269
<a name="l00285"></a>00285 QLayout *l = <a class="code" href="class_qwt_plot.html#ab1f2cf0e567e09a4c4bce3181c03ba0">legend</a>()-><a class="code" href="class_qwt_legend.html#a52edeceb553ae703516c984f34d7ab7">contentsWidget</a>()->layout();
270
<a name="l00286"></a>00286 <span class="keywordflow">if</span> ( l == 0 || !l->inherits(<span class="stringliteral">"QwtDynGridLayout"</span>) )
271
<a name="l00287"></a>00287 <span class="keywordflow">return</span>;
272
<a name="l00288"></a>00288
273
<a name="l00289"></a>00289 <a class="code" href="class_qwt_dyn_grid_layout.html">QwtDynGridLayout</a> *legendLayout = (<a class="code" href="class_qwt_dyn_grid_layout.html">QwtDynGridLayout</a> *)l;
274
<a name="l00290"></a>00290
275
<a name="l00291"></a>00291 uint numCols = legendLayout-><a class="code" href="class_qwt_dyn_grid_layout.html#27f533700d504f931753cec818d2ebdd">columnsForWidth</a>(rect.width());
276
<a name="l00292"></a>00292 <span class="preprocessor">#if QT_VERSION < 0x040000</span>
277
<a name="l00293"></a>00293 <span class="preprocessor"></span> QValueList<QRect> itemRects =
278
<a name="l00294"></a>00294 legendLayout-><a class="code" href="class_qwt_dyn_grid_layout.html#25b469e49d37e430a94f3ecb28ee8d80">layoutItems</a>(rect, numCols);
279
<a name="l00295"></a>00295 <span class="preprocessor">#else</span>
280
<a name="l00296"></a>00296 <span class="preprocessor"></span> QList<QRect> itemRects =
281
<a name="l00297"></a>00297 legendLayout-><a class="code" href="class_qwt_dyn_grid_layout.html#25b469e49d37e430a94f3ecb28ee8d80">layoutItems</a>(rect, numCols);
282
<a name="l00298"></a>00298 <span class="preprocessor">#endif</span>
283
<a name="l00299"></a>00299 <span class="preprocessor"></span>
284
<a name="l00300"></a>00300 <span class="keywordtype">int</span> index = 0;
285
<a name="l00301"></a>00301
286
<a name="l00302"></a>00302 <span class="preprocessor">#if QT_VERSION < 0x040000</span>
287
<a name="l00303"></a>00303 <span class="preprocessor"></span> QLayoutIterator layoutIterator = legendLayout->iterator();
288
<a name="l00304"></a>00304 <span class="keywordflow">for</span> ( QLayoutItem *item = layoutIterator.current();
289
<a name="l00305"></a>00305 item != 0; item = ++layoutIterator)
290
<a name="l00306"></a>00306 {
291
<a name="l00307"></a>00307 #<span class="keywordflow">else</span>
292
<a name="l00308"></a>00308 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < legendLayout-><a class="code" href="class_qwt_dyn_grid_layout.html#709b5884f18502b8b421015372d0a9d2">count</a>(); i++ )
293
<a name="l00309"></a>00309 {
294
<a name="l00310"></a>00310 QLayoutItem *item = legendLayout-><a class="code" href="class_qwt_dyn_grid_layout.html#959736cf9f01da694f399ca4aa574f6d">itemAt</a>(i);
295
<a name="l00311"></a>00311 <span class="preprocessor">#endif</span>
296
<a name="l00312"></a>00312 <span class="preprocessor"></span> QWidget *w = item->widget();
297
<a name="l00313"></a>00313 <span class="keywordflow">if</span> ( w )
298
<a name="l00314"></a>00314 {
299
<a name="l00315"></a>00315 painter->save();
300
<a name="l00316"></a>00316 painter->setClipping(<span class="keyword">true</span>);
301
<a name="l00317"></a>00317 <a class="code" href="class_qwt_painter.html#7a3b7e59fd56236dd99c5b1772e1a768">QwtPainter::setClipRect</a>(painter, itemRects[index]);
302
<a name="l00318"></a>00318
303
<a name="l00319"></a>00319 <a class="code" href="class_qwt_plot.html#9790ac102d566d744b9cfe9bb5e52a67">printLegendItem</a>(painter, w, itemRects[index]);
304
<a name="l00320"></a>00320
305
<a name="l00321"></a>00321 index++;
306
<a name="l00322"></a>00322 painter->restore();
307
<a name="l00323"></a>00323 }
308
<a name="l00324"></a>00324 }
309
<a name="l00325"></a>00325 }
310
<a name="l00326"></a>00326
311
<a name="l00335"></a><a class="code" href="class_qwt_plot.html#9790ac102d566d744b9cfe9bb5e52a67">00335</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#9790ac102d566d744b9cfe9bb5e52a67">QwtPlot::printLegendItem</a>(QPainter *painter,
312
<a name="l00336"></a>00336 <span class="keyword">const</span> QWidget *w, <span class="keyword">const</span> QRect &rect)<span class="keyword"> const</span>
313
<a name="l00337"></a>00337 <span class="keyword"></span>{
314
<a name="l00338"></a>00338 <span class="keywordflow">if</span> ( w->inherits(<span class="stringliteral">"QwtLegendItem"</span>) )
315
<a name="l00339"></a>00339 {
316
<a name="l00340"></a>00340 <a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a> *item = (<a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a> *)w;
317
<a name="l00341"></a>00341
318
<a name="l00342"></a>00342 painter->setFont(item->font());
319
<a name="l00343"></a>00343 item->drawItem(painter, rect);
320
<a name="l00344"></a>00344 }
321
<a name="l00345"></a>00345 }
322
<a name="l00346"></a>00346
323
<a name="l00359"></a><a class="code" href="class_qwt_plot.html#d881d5918384f5a0f112c2faa68ab031">00359</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#d881d5918384f5a0f112c2faa68ab031">QwtPlot::printScale</a>(QPainter *painter,
324
<a name="l00360"></a>00360 <span class="keywordtype">int</span> axisId, <span class="keywordtype">int</span> startDist, <span class="keywordtype">int</span> endDist, <span class="keywordtype">int</span> baseDist,
325
<a name="l00361"></a>00361 <span class="keyword">const</span> QRect &rect)<span class="keyword"> const</span>
326
<a name="l00362"></a>00362 <span class="keyword"></span>{
327
<a name="l00363"></a>00363 <span class="keywordflow">if</span> (!<a class="code" href="class_qwt_plot.html#a6d08ba153cb46662692611b5c38bbe0">axisEnabled</a>(axisId))
328
<a name="l00364"></a>00364 <span class="keywordflow">return</span>;
329
<a name="l00365"></a>00365
330
<a name="l00366"></a>00366 <span class="keyword">const</span> <a class="code" href="class_qwt_scale_widget.html">QwtScaleWidget</a> *scaleWidget = <a class="code" href="class_qwt_plot.html#8436c30175884d7643d68fd0dd236cd8">axisWidget</a>(axisId);
331
<a name="l00367"></a>00367 <span class="keywordflow">if</span> ( scaleWidget-><a class="code" href="class_qwt_scale_widget.html#5ab49692bc9ec77ef84de6e36b12f741">isColorBarEnabled</a>()
332
<a name="l00368"></a>00368 && scaleWidget-><a class="code" href="class_qwt_scale_widget.html#c55593292fe598a6a5738d7f0b67a1ec">colorBarWidth</a>() > 0)
333
<a name="l00369"></a>00369 {
334
<a name="l00370"></a>00370 <span class="keyword">const</span> <a class="code" href="class_qwt_metrics_map.html">QwtMetricsMap</a> map = <a class="code" href="class_qwt_painter.html#3de95bfc83c9beee537404b41749bad5">QwtPainter::metricsMap</a>();
335
<a name="l00371"></a>00371
336
<a name="l00372"></a>00372 QRect r = map.<a class="code" href="class_qwt_metrics_map.html#1ca11de58fd61315957ff62adea5af76">layoutToScreen</a>(rect);
337
<a name="l00373"></a>00373 r.setWidth(r.width() - 1);
338
<a name="l00374"></a>00374 r.setHeight(r.height() - 1);
339
<a name="l00375"></a>00375
340
<a name="l00376"></a>00376 scaleWidget-><a class="code" href="class_qwt_scale_widget.html#ca65f7a3e5f316c050a6b94d165fd418">drawColorBar</a>(painter, scaleWidget-><a class="code" href="class_qwt_scale_widget.html#4c82dfd348421f5a07088cd6663bdbf8">colorBarRect</a>(r));
341
<a name="l00377"></a>00377
342
<a name="l00378"></a>00378 <span class="keyword">const</span> <span class="keywordtype">int</span> off = scaleWidget-><a class="code" href="class_qwt_scale_widget.html#c55593292fe598a6a5738d7f0b67a1ec">colorBarWidth</a>() + scaleWidget-><a class="code" href="class_qwt_scale_widget.html#963c187b435d2ba0216c502f87b726ca">spacing</a>();
343
<a name="l00379"></a>00379 <span class="keywordflow">if</span> ( scaleWidget-><a class="code" href="class_qwt_scale_widget.html#2f6d30104f89c45d4d18f060ebabb8b9">scaleDraw</a>()-><a class="code" href="class_qwt_scale_draw.html#ba3a8530871137eb5f977e1eb3fe4975">orientation</a>() == Qt::Horizontal )
344
<a name="l00380"></a>00380 baseDist += map.screenToLayoutY(off);
345
<a name="l00381"></a>00381 <span class="keywordflow">else</span>
346
<a name="l00382"></a>00382 baseDist += map.screenToLayoutX(off);
347
<a name="l00383"></a>00383 }
348
<a name="l00384"></a>00384
349
<a name="l00385"></a>00385 <a class="code" href="class_qwt_scale_draw.html#cd7ceeeac592ef08530788580b461c66">QwtScaleDraw::Alignment</a> align;
350
<a name="l00386"></a>00386 <span class="keywordtype">int</span> x, y, w;
351
<a name="l00387"></a>00387
352
<a name="l00388"></a>00388 <span class="keywordflow">switch</span>(axisId)
353
<a name="l00389"></a>00389 {
354
<a name="l00390"></a>00390 <span class="keywordflow">case</span> yLeft:
355
<a name="l00391"></a>00391 {
356
<a name="l00392"></a>00392 x = rect.right() - baseDist;
357
<a name="l00393"></a>00393 y = rect.y() + startDist;
358
<a name="l00394"></a>00394 w = rect.height() - startDist - endDist;
359
<a name="l00395"></a>00395 align = QwtScaleDraw::LeftScale;
360
<a name="l00396"></a>00396 <span class="keywordflow">break</span>;
361
<a name="l00397"></a>00397 }
362
<a name="l00398"></a>00398 <span class="keywordflow">case</span> yRight:
363
<a name="l00399"></a>00399 {
364
<a name="l00400"></a>00400 x = rect.left() + baseDist;
365
<a name="l00401"></a>00401 y = rect.y() + startDist;
366
<a name="l00402"></a>00402 w = rect.height() - startDist - endDist;
367
<a name="l00403"></a>00403 align = QwtScaleDraw::RightScale;
368
<a name="l00404"></a>00404 <span class="keywordflow">break</span>;
369
<a name="l00405"></a>00405 }
370
<a name="l00406"></a>00406 <span class="keywordflow">case</span> xTop:
371
<a name="l00407"></a>00407 {
372
<a name="l00408"></a>00408 x = rect.left() + startDist;
373
<a name="l00409"></a>00409 y = rect.bottom() - baseDist;
374
<a name="l00410"></a>00410 w = rect.width() - startDist - endDist;
375
<a name="l00411"></a>00411 align = QwtScaleDraw::TopScale;
376
<a name="l00412"></a>00412 <span class="keywordflow">break</span>;
377
<a name="l00413"></a>00413 }
378
<a name="l00414"></a>00414 <span class="keywordflow">case</span> xBottom:
379
<a name="l00415"></a>00415 {
380
<a name="l00416"></a>00416 x = rect.left() + startDist;
381
<a name="l00417"></a>00417 y = rect.top() + baseDist;
382
<a name="l00418"></a>00418 w = rect.width() - startDist - endDist;
383
<a name="l00419"></a>00419 align = QwtScaleDraw::BottomScale;
384
<a name="l00420"></a>00420 <span class="keywordflow">break</span>;
385
<a name="l00421"></a>00421 }
386
<a name="l00422"></a>00422 <span class="keywordflow">default</span>:
387
<a name="l00423"></a>00423 <span class="keywordflow">return</span>;
388
<a name="l00424"></a>00424 }
389
<a name="l00425"></a>00425
390
<a name="l00426"></a>00426 scaleWidget-><a class="code" href="class_qwt_scale_widget.html#4fa8029213578d64ea07c4ad792f2832">drawTitle</a>(painter, align, rect);
391
<a name="l00427"></a>00427
392
<a name="l00428"></a>00428 painter->save();
393
<a name="l00429"></a>00429 painter->setFont(scaleWidget->font());
394
<a name="l00430"></a>00430
395
<a name="l00431"></a>00431 QPen pen = painter->pen();
396
<a name="l00432"></a>00432 pen.setWidth(scaleWidget-><a class="code" href="class_qwt_scale_widget.html#3e98f58419715bd7c7330ac1a2f1f66a">penWidth</a>());
397
<a name="l00433"></a>00433 painter->setPen(pen);
398
<a name="l00434"></a>00434
399
<a name="l00435"></a>00435 <a class="code" href="class_qwt_scale_draw.html">QwtScaleDraw</a> *sd = (<a class="code" href="class_qwt_scale_draw.html">QwtScaleDraw</a> *)scaleWidget-><a class="code" href="class_qwt_scale_widget.html#2f6d30104f89c45d4d18f060ebabb8b9">scaleDraw</a>();
400
<a name="l00436"></a>00436 <span class="keyword">const</span> QPoint sdPos = sd-><a class="code" href="class_qwt_scale_draw.html#9ed4b23c5b2652ac78d7278b32f9dfed">pos</a>();
401
<a name="l00437"></a>00437 <span class="keyword">const</span> <span class="keywordtype">int</span> sdLength = sd-><a class="code" href="class_qwt_scale_draw.html#6114863d3146c8ea021068865d0c4d82">length</a>();
402
<a name="l00438"></a>00438
403
<a name="l00439"></a>00439 sd-><a class="code" href="class_qwt_scale_draw.html#d301aed0c797c10f0104976d1a62ff69">move</a>(x, y);
404
<a name="l00440"></a>00440 sd-><a class="code" href="class_qwt_scale_draw.html#2094e09579671d0a8e4b14a636eba6ef">setLength</a>(w);
405
<a name="l00441"></a>00441
406
<a name="l00442"></a>00442 <span class="preprocessor">#if QT_VERSION < 0x040000</span>
407
<a name="l00443"></a>00443 <span class="preprocessor"></span> sd-><a class="code" href="class_qwt_abstract_scale_draw.html#c4442d7480db1288971e7eac15142467">draw</a>(painter, scaleWidget->palette().active());
408
<a name="l00444"></a>00444 <span class="preprocessor">#else</span>
409
<a name="l00445"></a>00445 <span class="preprocessor"></span> QPalette palette = scaleWidget->palette();
410
<a name="l00446"></a>00446 palette.setCurrentColorGroup(QPalette::Active);
411
<a name="l00447"></a>00447 sd-><a class="code" href="class_qwt_abstract_scale_draw.html#c4442d7480db1288971e7eac15142467">draw</a>(painter, palette);
412
<a name="l00448"></a>00448 <span class="preprocessor">#endif</span>
413
<a name="l00449"></a>00449 <span class="preprocessor"></span> <span class="comment">// reset previous values</span>
414
<a name="l00450"></a>00450 sd-><a class="code" href="class_qwt_scale_draw.html#d301aed0c797c10f0104976d1a62ff69">move</a>(sdPos);
415
<a name="l00451"></a>00451 sd-><a class="code" href="class_qwt_scale_draw.html#2094e09579671d0a8e4b14a636eba6ef">setLength</a>(sdLength);
416
<a name="l00452"></a>00452
417
<a name="l00453"></a>00453 painter->restore();
418
<a name="l00454"></a>00454 }
419
<a name="l00455"></a>00455
420
<a name="l00467"></a><a class="code" href="class_qwt_plot.html#d42514cf3728466a720d2a1290f13a53">00467</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot.html#d42514cf3728466a720d2a1290f13a53">QwtPlot::printCanvas</a>(QPainter *painter,
421
<a name="l00468"></a>00468 <span class="keyword">const</span> QRect &boundingRect, <span class="keyword">const</span> QRect &canvasRect,
422
<a name="l00469"></a>00469 <span class="keyword">const</span> <a class="code" href="class_qwt_scale_map.html">QwtScaleMap</a> map[axisCnt], <span class="keyword">const</span> <a class="code" href="class_qwt_plot_print_filter.html">QwtPlotPrintFilter</a> &pfilter)<span class="keyword"> const</span>
423
<a name="l00470"></a>00470 <span class="keyword"></span>{
424
<a name="l00471"></a>00471 <span class="keywordflow">if</span> ( pfilter.<a class="code" href="class_qwt_plot_print_filter.html#32a2f1df034b8ca130054f1ae034dad0">options</a>() & QwtPlotPrintFilter::PrintBackground )
425
<a name="l00472"></a>00472 {
426
<a name="l00473"></a>00473 QBrush bgBrush;
427
<a name="l00474"></a>00474 <span class="preprocessor">#if QT_VERSION >= 0x040000</span>
428
<a name="l00475"></a>00475 <span class="preprocessor"></span> bgBrush = <a class="code" href="class_qwt_plot.html#afcc82150034fbeb393ceb9f54ba2f1a">canvas</a>()->palette().brush(backgroundRole());
429
<a name="l00476"></a>00476 <span class="preprocessor">#else</span>
430
<a name="l00477"></a>00477 <span class="preprocessor"></span> QColorGroup::ColorRole role =
431
<a name="l00478"></a>00478 QPalette::backgroundRoleFromMode( backgroundMode() );
432
<a name="l00479"></a>00479 bgBrush = <a class="code" href="class_qwt_plot.html#afcc82150034fbeb393ceb9f54ba2f1a">canvas</a>()->colorGroup().brush( role );
433
<a name="l00480"></a>00480 <span class="preprocessor">#endif</span>
434
<a name="l00481"></a>00481 <span class="preprocessor"></span> QRect r = boundingRect;
435
<a name="l00482"></a>00482 <span class="keywordflow">if</span> ( !(pfilter.<a class="code" href="class_qwt_plot_print_filter.html#32a2f1df034b8ca130054f1ae034dad0">options</a>() & QwtPlotPrintFilter::PrintFrameWithScales) )
436
<a name="l00483"></a>00483 {
437
<a name="l00484"></a>00484 r = canvasRect;
438
<a name="l00485"></a>00485 <span class="preprocessor">#if QT_VERSION >= 0x040000</span>
439
<a name="l00486"></a>00486 <span class="preprocessor"></span> <span class="comment">// Unfortunately the paint engines do no always the same</span>
440
<a name="l00487"></a>00487 <span class="keywordflow">switch</span>(painter->paintEngine()->type() )
441
<a name="l00488"></a>00488 {
442
<a name="l00489"></a>00489 <span class="keywordflow">case</span> QPaintEngine::Raster:
443
<a name="l00490"></a>00490 <span class="keywordflow">case</span> QPaintEngine::X11:
444
<a name="l00491"></a>00491 <span class="keywordflow">break</span>;
445
<a name="l00492"></a>00492 <span class="keywordflow">default</span>:
446
<a name="l00493"></a>00493 r.setWidth(r.width() - 1);
447
<a name="l00494"></a>00494 r.setHeight(r.height() - 1);
448
<a name="l00495"></a>00495 <span class="keywordflow">break</span>;
449
<a name="l00496"></a>00496 }
450
<a name="l00497"></a>00497 <span class="preprocessor">#else</span>
451
<a name="l00498"></a>00498 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( painter->device()->isExtDev() )
452
<a name="l00499"></a>00499 {
453
<a name="l00500"></a>00500 r.setWidth(r.width() - 1);
454
<a name="l00501"></a>00501 r.setHeight(r.height() - 1);
455
<a name="l00502"></a>00502 }
456
<a name="l00503"></a>00503 <span class="preprocessor">#endif</span>
457
<a name="l00504"></a>00504 <span class="preprocessor"></span> }
458
<a name="l00505"></a>00505
459
<a name="l00506"></a>00506 <a class="code" href="class_qwt_painter.html#1c9f9151299412bcefeee103bc4abe27">QwtPainter::fillRect</a>(painter, r, bgBrush);
460
<a name="l00507"></a>00507 }
461
<a name="l00508"></a>00508
462
<a name="l00509"></a>00509 <span class="keywordflow">if</span> ( pfilter.<a class="code" href="class_qwt_plot_print_filter.html#32a2f1df034b8ca130054f1ae034dad0">options</a>() & QwtPlotPrintFilter::PrintFrameWithScales )
463
<a name="l00510"></a>00510 {
464
<a name="l00511"></a>00511 painter->save();
465
<a name="l00512"></a>00512 painter->setPen(QPen(Qt::black));
466
<a name="l00513"></a>00513 painter->setBrush(QBrush(Qt::NoBrush));
467
<a name="l00514"></a>00514 <a class="code" href="class_qwt_painter.html#9d606b6a681b9e1d0e0823c8a169ac7e">QwtPainter::drawRect</a>(painter, boundingRect);
468
<a name="l00515"></a>00515 painter->restore();
469
<a name="l00516"></a>00516 }
470
<a name="l00517"></a>00517
471
<a name="l00518"></a>00518 painter->setClipping(<span class="keyword">true</span>);
472
<a name="l00519"></a>00519 <a class="code" href="class_qwt_painter.html#7a3b7e59fd56236dd99c5b1772e1a768">QwtPainter::setClipRect</a>(painter, canvasRect);
473
<a name="l00520"></a>00520
474
<a name="l00521"></a>00521 <a class="code" href="class_qwt_plot.html#e36e68025f4f8b460d690ea7c7a04d9e">drawItems</a>(painter, canvasRect, map, pfilter);
475
<a name="l00522"></a>00522 }
476
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sat May 24 18:47:40 2008 for Qwt User's Guide by
477
<a href="http://www.doxygen.org/index.html">
478
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.0 </small></address>