~l3on/ubuntu/oneiric/qwt/fix-921430

« back to all changes in this revision

Viewing changes to qwt-5.0.2/doc/html/qwt__legend__item_8cpp-source.html

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2007-10-05 15:20:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071005152041-qmybqh4fj9jejyo2
Tags: 5.0.2-2
* Handle nostrip build option. (Closes: #437877)
* Build libqwt5-doc package in binary-indep target. (Closes: #443110)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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&apos;s Guide: qwt_legend_item.cpp Source File</title>
 
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
 
5
<link href="tabs.css" rel="stylesheet" type="text/css">
 
6
</head><body>
 
7
<!-- Generated by Doxygen 1.4.6 -->
 
8
<div class="tabs">
 
9
  <ul>
 
10
    <li><a href="index.html"><span>Main&nbsp;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&nbsp;Pages</span></a></li>
 
14
  </ul></div>
 
15
<h1>qwt_legend_item.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************</span>
 
16
<a name="l00002"></a>00002 <span class="comment"> * Qwt Widget Library</span>
 
17
<a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 1997   Josef Wilgen</span>
 
18
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002   Uwe Rathmann</span>
 
19
<a name="l00005"></a>00005 <span class="comment"> * </span>
 
20
<a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
 
21
<a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of the Qwt License, Version 1.0</span>
 
22
<a name="l00008"></a>00008 <span class="comment"> *****************************************************************************/</span>
 
23
<a name="l00009"></a>00009 
 
24
<a name="l00010"></a>00010 <span class="comment">// vim: expandtab</span>
 
25
<a name="l00011"></a>00011 
 
26
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;qpainter.h&gt;</span>
 
27
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;qdrawutil.h&gt;</span>
 
28
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;qstyle.h&gt;</span>
 
29
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;qpen.h&gt;</span>
 
30
<a name="l00016"></a>00016 <span class="preprocessor">#if QT_VERSION &gt;= 0x040000</span>
 
31
<a name="l00017"></a>00017 <span class="preprocessor"></span><span class="preprocessor">#include &lt;qevent.h&gt;</span>
 
32
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;qstyleoption.h&gt;</span>
 
33
<a name="l00019"></a>00019 <span class="preprocessor">#endif</span>
 
34
<a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#include "qwt_math.h"</span>
 
35
<a name="l00021"></a>00021 <span class="preprocessor">#include "qwt_painter.h"</span>
 
36
<a name="l00022"></a>00022 <span class="preprocessor">#include "qwt_symbol.h"</span>
 
37
<a name="l00023"></a>00023 <span class="preprocessor">#include "qwt_legend_item.h"</span>
 
38
<a name="l00024"></a>00024 
 
39
<a name="l00025"></a>00025 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> ButtonFrame = 2;
 
40
<a name="l00026"></a>00026 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> Margin = 2;
 
41
<a name="l00027"></a>00027 
 
42
<a name="l00028"></a>00028 <span class="keyword">static</span> QSize buttonShift(<span class="keyword">const</span> <a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a> *w)
 
43
<a name="l00029"></a>00029 {
 
44
<a name="l00030"></a>00030 <span class="preprocessor">#if QT_VERSION &lt; 0x040000</span>
 
45
<a name="l00031"></a>00031 <span class="preprocessor"></span>    <span class="keyword">const</span> <span class="keywordtype">int</span> ph = w-&gt;style().pixelMetric(
 
46
<a name="l00032"></a>00032         QStyle::PM_ButtonShiftHorizontal, w);
 
47
<a name="l00033"></a>00033     <span class="keyword">const</span> <span class="keywordtype">int</span> pv = w-&gt;style().pixelMetric(
 
48
<a name="l00034"></a>00034         QStyle::PM_ButtonShiftVertical, w);
 
49
<a name="l00035"></a>00035 <span class="preprocessor">#else</span>
 
50
<a name="l00036"></a>00036 <span class="preprocessor"></span>    QStyleOption option;
 
51
<a name="l00037"></a>00037     option.<a class="code" href="class_qwt_legend_item.html#38a315635d2b08b57af0d58e2136ed70">init</a>(w);
 
52
<a name="l00038"></a>00038 
 
53
<a name="l00039"></a>00039     <span class="keyword">const</span> <span class="keywordtype">int</span> ph = w-&gt;style()-&gt;pixelMetric(
 
54
<a name="l00040"></a>00040         QStyle::PM_ButtonShiftHorizontal, &amp;option, w);
 
55
<a name="l00041"></a>00041     <span class="keyword">const</span> <span class="keywordtype">int</span> pv = w-&gt;style()-&gt;pixelMetric(
 
56
<a name="l00042"></a>00042         QStyle::PM_ButtonShiftVertical, &amp;option, w);
 
57
<a name="l00043"></a>00043 <span class="preprocessor">#endif</span>
 
58
<a name="l00044"></a>00044 <span class="preprocessor"></span>    <span class="keywordflow">return</span> QSize(ph, pv);
 
59
<a name="l00045"></a>00045 }
 
60
<a name="l00046"></a>00046 
 
61
<a name="l00047"></a>00047 <span class="keyword">class </span>QwtLegendItem::PrivateData
 
62
<a name="l00048"></a>00048 {
 
63
<a name="l00049"></a>00049 <span class="keyword">public</span>:
 
64
<a name="l00050"></a>00050     PrivateData():
 
65
<a name="l00051"></a>00051         <a class="code" href="class_qwt_legend_item.html#2574e634e54eb7afff34ca24752c3f9b">itemMode</a>(<a class="code" href="class_qwt_legend.html">QwtLegend</a>::ReadOnlyItem),
 
66
<a name="l00052"></a>00052         <a class="code" href="class_qwt_legend_item.html#d88e70289e552d67f881d0435fae1098">isDown</a>(false),
 
67
<a name="l00053"></a>00053         <a class="code" href="class_qwt_legend_item.html#3326305e42b8904e55bf0c358b69267a">identifierWidth</a>(8),
 
68
<a name="l00054"></a>00054         <a class="code" href="class_qwt_legend_item.html#53cd8956bab00b09be587da0bb7ca42b">identifierMode</a>(<a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a>::ShowLine | <a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a>::ShowText),
 
69
<a name="l00055"></a>00055         <a class="code" href="class_qwt_legend_item.html#3ca8da18f186d02388b99d9de79f40b5">curvePen</a>(Qt::NoPen),
 
70
<a name="l00056"></a>00056         <a class="code" href="class_qwt_legend_item.html#dc59d1683f3bb11a795098776e76c0bc">spacing</a>(Margin)
 
71
<a name="l00057"></a>00057     {
 
72
<a name="l00058"></a>00058     }
 
73
<a name="l00059"></a>00059 
 
74
<a name="l00060"></a>00060     <a class="code" href="class_qwt_legend.html#b216dd2dba9ebf6cb0ed2dd621a652e0">QwtLegend::LegendItemMode</a> <a class="code" href="class_qwt_legend_item.html#2574e634e54eb7afff34ca24752c3f9b">itemMode</a>;
 
75
<a name="l00061"></a>00061     <span class="keywordtype">bool</span> <a class="code" href="class_qwt_legend_item.html#d88e70289e552d67f881d0435fae1098">isDown</a>;
 
76
<a name="l00062"></a>00062 
 
77
<a name="l00063"></a>00063     <span class="keywordtype">int</span> <a class="code" href="class_qwt_legend_item.html#3326305e42b8904e55bf0c358b69267a">identifierWidth</a>;
 
78
<a name="l00064"></a>00064     <span class="keywordtype">int</span> <a class="code" href="class_qwt_legend_item.html#53cd8956bab00b09be587da0bb7ca42b">identifierMode</a>;
 
79
<a name="l00065"></a>00065     <a class="code" href="class_qwt_symbol.html">QwtSymbol</a> <a class="code" href="class_qwt_legend_item.html#18ea9b789197ce0d6eedae02d27f5a55">symbol</a>;
 
80
<a name="l00066"></a>00066     QPen <a class="code" href="class_qwt_legend_item.html#3ca8da18f186d02388b99d9de79f40b5">curvePen</a>;
 
81
<a name="l00067"></a>00067 
 
82
<a name="l00068"></a>00068     <span class="keywordtype">int</span> <a class="code" href="class_qwt_legend_item.html#dc59d1683f3bb11a795098776e76c0bc">spacing</a>;
 
83
<a name="l00069"></a>00069 };
 
84
<a name="l00070"></a>00070 
 
85
<a name="l00074"></a><a class="code" href="class_qwt_legend_item.html#46f61a0eaaf24a3a78d498db3fc8c457">00074</a> <a class="code" href="class_qwt_legend_item.html#46f61a0eaaf24a3a78d498db3fc8c457">QwtLegendItem::QwtLegendItem</a>(QWidget *parent):
 
86
<a name="l00075"></a>00075     <a class="code" href="class_qwt_text_label.html">QwtTextLabel</a>(parent)
 
87
<a name="l00076"></a>00076 {
 
88
<a name="l00077"></a>00077     d_data = <span class="keyword">new</span> PrivateData;
 
89
<a name="l00078"></a>00078     init(<a class="code" href="class_qwt_text.html">QwtText</a>());
 
90
<a name="l00079"></a>00079 }
 
91
<a name="l00080"></a>00080 
 
92
<a name="l00087"></a><a class="code" href="class_qwt_legend_item.html#e806668ed7ddd57ea4ce88fc6ea960aa">00087</a> <a class="code" href="class_qwt_legend_item.html#46f61a0eaaf24a3a78d498db3fc8c457">QwtLegendItem::QwtLegendItem</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_symbol.html">QwtSymbol</a> &amp;symbol, 
 
93
<a name="l00088"></a>00088         <span class="keyword">const</span> QPen &amp;curvePen, <span class="keyword">const</span> <a class="code" href="class_qwt_text.html">QwtText</a> &amp;text, 
 
94
<a name="l00089"></a>00089         QWidget *parent):
 
95
<a name="l00090"></a>00090     <a class="code" href="class_qwt_text_label.html">QwtTextLabel</a>(parent)
 
96
<a name="l00091"></a>00091 {
 
97
<a name="l00092"></a>00092     d_data = <span class="keyword">new</span> PrivateData;
 
98
<a name="l00093"></a>00093 
 
99
<a name="l00094"></a>00094     d_data-&gt;symbol = <a class="code" href="class_qwt_legend_item.html#18ea9b789197ce0d6eedae02d27f5a55">symbol</a>;
 
100
<a name="l00095"></a>00095     d_data-&gt;curvePen = curvePen;
 
101
<a name="l00096"></a>00096 
 
102
<a name="l00097"></a>00097     init(<a class="code" href="class_qwt_text_label.html#6ff4f9a87e11594740f312c8522f933e">text</a>);
 
103
<a name="l00098"></a>00098 }
 
104
<a name="l00099"></a>00099 
 
105
<a name="l00100"></a>00100 <span class="keywordtype">void</span> QwtLegendItem::init(<span class="keyword">const</span> <a class="code" href="class_qwt_text.html">QwtText</a> &amp;text)
 
106
<a name="l00101"></a>00101 {
 
107
<a name="l00102"></a>00102     <a class="code" href="class_qwt_text_label.html#833d27574b72bbc135f2972c72382eba">setMargin</a>(Margin);
 
108
<a name="l00103"></a>00103     <a class="code" href="class_qwt_text_label.html#ad25ab34c219f8d97ec7c39d064ed4a0">setIndent</a>(<a class="code" href="class_qwt_text_label.html#b754bebe50bc0e713cde9ba58bf6c3c8">margin</a>() + d_data-&gt;identifierWidth + 2 * d_data-&gt;spacing);
 
109
<a name="l00104"></a>00104     <a class="code" href="class_qwt_legend_item.html#8420c4d8cd73945a25697109df5c2f0e">setText</a>(<a class="code" href="class_qwt_text_label.html#6ff4f9a87e11594740f312c8522f933e">text</a>);
 
110
<a name="l00105"></a>00105 }
 
111
<a name="l00106"></a>00106 
 
112
<a name="l00108"></a><a class="code" href="class_qwt_legend_item.html#8c98d47b26d4ad3af98bffc7107f6fc9">00108</a> <a class="code" href="class_qwt_legend_item.html#8c98d47b26d4ad3af98bffc7107f6fc9">QwtLegendItem::~QwtLegendItem</a>()
 
113
<a name="l00109"></a>00109 {
 
114
<a name="l00110"></a>00110     <span class="keyword">delete</span> d_data;
 
115
<a name="l00111"></a>00111     d_data = NULL;
 
116
<a name="l00112"></a>00112 }
 
117
<a name="l00113"></a>00113 
 
118
<a name="l00120"></a><a class="code" href="class_qwt_legend_item.html#8420c4d8cd73945a25697109df5c2f0e">00120</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#8420c4d8cd73945a25697109df5c2f0e">QwtLegendItem::setText</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_text.html">QwtText</a> &amp;text)
 
119
<a name="l00121"></a>00121 {
 
120
<a name="l00122"></a>00122     <span class="keyword">const</span> <span class="keywordtype">int</span> flags = Qt::AlignLeft | Qt::AlignVCenter
 
121
<a name="l00123"></a>00123 <span class="preprocessor">#if QT_VERSION &lt; 0x040000</span>
 
122
<a name="l00124"></a>00124 <span class="preprocessor"></span>        | Qt::WordBreak | Qt::ExpandTabs;
 
123
<a name="l00125"></a>00125 <span class="preprocessor">#else</span>
 
124
<a name="l00126"></a>00126 <span class="preprocessor"></span>        | Qt::TextExpandTabs | Qt::TextWordWrap;
 
125
<a name="l00127"></a>00127 <span class="preprocessor">#endif</span>
 
126
<a name="l00128"></a>00128 <span class="preprocessor"></span>
 
127
<a name="l00129"></a>00129     <a class="code" href="class_qwt_text.html">QwtText</a> txt = <a class="code" href="class_qwt_text_label.html#6ff4f9a87e11594740f312c8522f933e">text</a>;
 
128
<a name="l00130"></a>00130     txt.<a class="code" href="class_qwt_text.html#2e71d427de766455323794f27d369a5d">setRenderFlags</a>(flags);
 
129
<a name="l00131"></a>00131 
 
130
<a name="l00132"></a>00132     <a class="code" href="class_qwt_text_label.html#b300b9a0a6392e180f2caff41ba2b9b8">QwtTextLabel::setText</a>(txt);
 
131
<a name="l00133"></a>00133 }
 
132
<a name="l00134"></a>00134 
 
133
<a name="l00142"></a><a class="code" href="class_qwt_legend_item.html#e6487dbe8f2c72512887df8bcb648d53">00142</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#e6487dbe8f2c72512887df8bcb648d53">QwtLegendItem::setItemMode</a>(<a class="code" href="class_qwt_legend.html#b216dd2dba9ebf6cb0ed2dd621a652e0">QwtLegend::LegendItemMode</a> mode) 
 
134
<a name="l00143"></a>00143 { 
 
135
<a name="l00144"></a>00144     d_data-&gt;itemMode = mode; 
 
136
<a name="l00145"></a>00145     d_data-&gt;isDown = <span class="keyword">false</span>; 
 
137
<a name="l00146"></a>00146 
 
138
<a name="l00147"></a>00147 <span class="preprocessor">#if QT_VERSION &gt;= 0x040000</span>
 
139
<a name="l00148"></a>00148 <span class="preprocessor"></span>    <span class="keyword">using namespace </span>Qt;
 
140
<a name="l00149"></a>00149 <span class="preprocessor">#endif</span>
 
141
<a name="l00150"></a>00150 <span class="preprocessor"></span>    setFocusPolicy(mode != QwtLegend::ReadOnlyItem ? TabFocus : NoFocus);
 
142
<a name="l00151"></a>00151     <a class="code" href="class_qwt_text_label.html#833d27574b72bbc135f2972c72382eba">setMargin</a>(ButtonFrame + Margin);
 
143
<a name="l00152"></a>00152 
 
144
<a name="l00153"></a>00153     updateGeometry();
 
145
<a name="l00154"></a>00154 }
 
146
<a name="l00155"></a>00155 
 
147
<a name="l00161"></a><a class="code" href="class_qwt_legend_item.html#2574e634e54eb7afff34ca24752c3f9b">00161</a> <a class="code" href="class_qwt_legend.html#b216dd2dba9ebf6cb0ed2dd621a652e0">QwtLegend::LegendItemMode</a> <a class="code" href="class_qwt_legend_item.html#2574e634e54eb7afff34ca24752c3f9b">QwtLegendItem::itemMode</a>()<span class="keyword"> const </span>
 
148
<a name="l00162"></a>00162 <span class="keyword"></span>{ 
 
149
<a name="l00163"></a>00163     <span class="keywordflow">return</span> d_data-&gt;itemMode; 
 
150
<a name="l00164"></a>00164 }
 
151
<a name="l00165"></a>00165 
 
152
<a name="l00173"></a><a class="code" href="class_qwt_legend_item.html#cbd7bb723c868b26bc91cfbc54ade719">00173</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#cbd7bb723c868b26bc91cfbc54ade719">QwtLegendItem::setIdentifierMode</a>(<span class="keywordtype">int</span> mode)
 
153
<a name="l00174"></a>00174 {
 
154
<a name="l00175"></a>00175     <span class="keywordflow">if</span> ( mode != d_data-&gt;identifierMode )
 
155
<a name="l00176"></a>00176     {
 
156
<a name="l00177"></a>00177         d_data-&gt;identifierMode = mode;
 
157
<a name="l00178"></a>00178         update();
 
158
<a name="l00179"></a>00179     }
 
159
<a name="l00180"></a>00180 }
 
160
<a name="l00181"></a>00181 
 
161
<a name="l00186"></a><a class="code" href="class_qwt_legend_item.html#53cd8956bab00b09be587da0bb7ca42b">00186</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_legend_item.html#53cd8956bab00b09be587da0bb7ca42b">QwtLegendItem::identifierMode</a>()<span class="keyword"> const </span>
 
162
<a name="l00187"></a>00187 <span class="keyword"></span>{ 
 
163
<a name="l00188"></a>00188     <span class="keywordflow">return</span> d_data-&gt;identifierMode; 
 
164
<a name="l00189"></a>00189 }
 
165
<a name="l00190"></a>00190 
 
166
<a name="l00199"></a><a class="code" href="class_qwt_legend_item.html#c435a0541a9c2a5938a879f44a4fc8f5">00199</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#c435a0541a9c2a5938a879f44a4fc8f5">QwtLegendItem::setIdentfierWidth</a>(<span class="keywordtype">int</span> width)
 
167
<a name="l00200"></a>00200 {
 
168
<a name="l00201"></a>00201     width = qwtMax(width, 0);
 
169
<a name="l00202"></a>00202     <span class="keywordflow">if</span> ( width != d_data-&gt;identifierWidth )
 
170
<a name="l00203"></a>00203     {
 
171
<a name="l00204"></a>00204         d_data-&gt;identifierWidth = width;
 
172
<a name="l00205"></a>00205         <a class="code" href="class_qwt_text_label.html#ad25ab34c219f8d97ec7c39d064ed4a0">setIndent</a>(<a class="code" href="class_qwt_text_label.html#b754bebe50bc0e713cde9ba58bf6c3c8">margin</a>() + d_data-&gt;identifierWidth 
 
173
<a name="l00206"></a>00206             + 2 * d_data-&gt;spacing);
 
174
<a name="l00207"></a>00207     }
 
175
<a name="l00208"></a>00208 }
 
176
<a name="l00214"></a><a class="code" href="class_qwt_legend_item.html#3326305e42b8904e55bf0c358b69267a">00214</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_legend_item.html#3326305e42b8904e55bf0c358b69267a">QwtLegendItem::identifierWidth</a>()<span class="keyword"> const</span>
 
177
<a name="l00215"></a>00215 <span class="keyword"></span>{
 
178
<a name="l00216"></a>00216     <span class="keywordflow">return</span> d_data-&gt;identifierWidth;
 
179
<a name="l00217"></a>00217 }
 
180
<a name="l00218"></a>00218 
 
181
<a name="l00224"></a><a class="code" href="class_qwt_legend_item.html#4ff8a83f130d56bf5932c6a35384d85f">00224</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#4ff8a83f130d56bf5932c6a35384d85f">QwtLegendItem::setSpacing</a>(<span class="keywordtype">int</span> spacing)
 
182
<a name="l00225"></a>00225 {
 
183
<a name="l00226"></a>00226     spacing = qwtMax(spacing, 0);
 
184
<a name="l00227"></a>00227     <span class="keywordflow">if</span> ( spacing != d_data-&gt;spacing )
 
185
<a name="l00228"></a>00228     {
 
186
<a name="l00229"></a>00229         d_data-&gt;spacing = spacing;
 
187
<a name="l00230"></a>00230         <a class="code" href="class_qwt_text_label.html#ad25ab34c219f8d97ec7c39d064ed4a0">setIndent</a>(<a class="code" href="class_qwt_text_label.html#b754bebe50bc0e713cde9ba58bf6c3c8">margin</a>() + d_data-&gt;identifierWidth 
 
188
<a name="l00231"></a>00231             + 2 * d_data-&gt;spacing);
 
189
<a name="l00232"></a>00232     }
 
190
<a name="l00233"></a>00233 }
 
191
<a name="l00234"></a>00234 
 
192
<a name="l00239"></a><a class="code" href="class_qwt_legend_item.html#dc59d1683f3bb11a795098776e76c0bc">00239</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_legend_item.html#dc59d1683f3bb11a795098776e76c0bc">QwtLegendItem::spacing</a>()<span class="keyword"> const</span>
 
193
<a name="l00240"></a>00240 <span class="keyword"></span>{
 
194
<a name="l00241"></a>00241     <span class="keywordflow">return</span> d_data-&gt;spacing;
 
195
<a name="l00242"></a>00242 }
 
196
<a name="l00243"></a>00243 
 
197
<a name="l00250"></a><a class="code" href="class_qwt_legend_item.html#12029c7394b76b7431593630ce6ee386">00250</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#12029c7394b76b7431593630ce6ee386">QwtLegendItem::setSymbol</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_symbol.html">QwtSymbol</a> &amp;symbol) 
 
198
<a name="l00251"></a>00251 {
 
199
<a name="l00252"></a>00252     <span class="keywordflow">if</span> ( <a class="code" href="class_qwt_legend_item.html#18ea9b789197ce0d6eedae02d27f5a55">symbol</a> != d_data-&gt;symbol )
 
200
<a name="l00253"></a>00253     {
 
201
<a name="l00254"></a>00254         d_data-&gt;symbol = <a class="code" href="class_qwt_legend_item.html#18ea9b789197ce0d6eedae02d27f5a55">symbol</a>;
 
202
<a name="l00255"></a>00255         update();
 
203
<a name="l00256"></a>00256     }
 
204
<a name="l00257"></a>00257 }
 
205
<a name="l00258"></a>00258     
 
206
<a name="l00263"></a><a class="code" href="class_qwt_legend_item.html#18ea9b789197ce0d6eedae02d27f5a55">00263</a> <span class="keyword">const</span> <a class="code" href="class_qwt_symbol.html">QwtSymbol</a>&amp; <a class="code" href="class_qwt_legend_item.html#18ea9b789197ce0d6eedae02d27f5a55">QwtLegendItem::symbol</a>()<span class="keyword"> const </span>
 
207
<a name="l00264"></a>00264 <span class="keyword"></span>{ 
 
208
<a name="l00265"></a>00265     <span class="keywordflow">return</span> d_data-&gt;symbol; 
 
209
<a name="l00266"></a>00266 }
 
210
<a name="l00267"></a>00267     
 
211
<a name="l00268"></a>00268 
 
212
<a name="l00275"></a><a class="code" href="class_qwt_legend_item.html#97803f16937bf1a392b7675fd7c9b503">00275</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#97803f16937bf1a392b7675fd7c9b503">QwtLegendItem::setCurvePen</a>(<span class="keyword">const</span> QPen &amp;pen) 
 
213
<a name="l00276"></a>00276 {
 
214
<a name="l00277"></a>00277     <span class="keywordflow">if</span> ( pen != d_data-&gt;curvePen )
 
215
<a name="l00278"></a>00278     {
 
216
<a name="l00279"></a>00279         d_data-&gt;curvePen = pen;
 
217
<a name="l00280"></a>00280         update();
 
218
<a name="l00281"></a>00281     }
 
219
<a name="l00282"></a>00282 }
 
220
<a name="l00283"></a>00283 
 
221
<a name="l00288"></a><a class="code" href="class_qwt_legend_item.html#3ca8da18f186d02388b99d9de79f40b5">00288</a> <span class="keyword">const</span> QPen&amp; <a class="code" href="class_qwt_legend_item.html#3ca8da18f186d02388b99d9de79f40b5">QwtLegendItem::curvePen</a>()<span class="keyword"> const </span>
 
222
<a name="l00289"></a>00289 <span class="keyword"></span>{ 
 
223
<a name="l00290"></a>00290     <span class="keywordflow">return</span> d_data-&gt;curvePen; 
 
224
<a name="l00291"></a>00291 }
 
225
<a name="l00292"></a>00292 
 
226
<a name="l00298"></a><a class="code" href="class_qwt_legend_item.html#9cd64e5c5c04621e4684c3d75d3eadff">00298</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#9cd64e5c5c04621e4684c3d75d3eadff">QwtLegendItem::drawIdentifier</a>(
 
227
<a name="l00299"></a>00299     QPainter *painter, <span class="keyword">const</span> QRect &amp;rect)<span class="keyword"> const</span>
 
228
<a name="l00300"></a>00300 <span class="keyword"></span>{
 
229
<a name="l00301"></a>00301     <span class="keywordflow">if</span> ( rect.isEmpty() )
 
230
<a name="l00302"></a>00302         <span class="keywordflow">return</span>;
 
231
<a name="l00303"></a>00303 
 
232
<a name="l00304"></a>00304     <span class="keywordflow">if</span> ( (d_data-&gt;identifierMode &amp; ShowLine ) &amp;&amp; (d_data-&gt;curvePen.style() != Qt::NoPen) )
 
233
<a name="l00305"></a>00305     {
 
234
<a name="l00306"></a>00306         painter-&gt;save();
 
235
<a name="l00307"></a>00307         painter-&gt;setPen(d_data-&gt;curvePen);
 
236
<a name="l00308"></a>00308         <a class="code" href="class_qwt_painter.html#f809f23704df7e05f51222daa296ca80">QwtPainter::drawLine</a>(painter, rect.left(), rect.center().y(), 
 
237
<a name="l00309"></a>00309             rect.right(), rect.center().y());
 
238
<a name="l00310"></a>00310         painter-&gt;restore();
 
239
<a name="l00311"></a>00311     }
 
240
<a name="l00312"></a>00312 
 
241
<a name="l00313"></a>00313     <span class="keywordflow">if</span> ( (d_data-&gt;identifierMode &amp; ShowSymbol) 
 
242
<a name="l00314"></a>00314         &amp;&amp; (d_data-&gt;symbol.style() != QwtSymbol::NoSymbol) )
 
243
<a name="l00315"></a>00315     {
 
244
<a name="l00316"></a>00316         QSize symbolSize = 
 
245
<a name="l00317"></a>00317             <a class="code" href="class_qwt_painter.html#3de95bfc83c9beee537404b41749bad5">QwtPainter::metricsMap</a>().<a class="code" href="class_qwt_metrics_map.html#3b2300920bf39300b0b5c969e296f5e1">screenToLayout</a>(d_data-&gt;symbol.size());
 
246
<a name="l00318"></a>00318 
 
247
<a name="l00319"></a>00319         <span class="comment">// scale the symbol size down if it doesn't fit into rect.</span>
 
248
<a name="l00320"></a>00320 
 
249
<a name="l00321"></a>00321         <span class="keywordflow">if</span> ( rect.width() &lt; symbolSize.width() )
 
250
<a name="l00322"></a>00322         {
 
251
<a name="l00323"></a>00323             <span class="keyword">const</span> <span class="keywordtype">double</span> ratio = 
 
252
<a name="l00324"></a>00324                 <span class="keywordtype">double</span>(symbolSize.width()) / <span class="keywordtype">double</span>(rect.width());
 
253
<a name="l00325"></a>00325             symbolSize.setWidth(rect.width());
 
254
<a name="l00326"></a>00326             symbolSize.setHeight(qRound(symbolSize.height() / ratio));
 
255
<a name="l00327"></a>00327         }
 
256
<a name="l00328"></a>00328         <span class="keywordflow">if</span> ( rect.height() &lt; symbolSize.height() )
 
257
<a name="l00329"></a>00329         {
 
258
<a name="l00330"></a>00330             <span class="keyword">const</span> <span class="keywordtype">double</span> ratio = 
 
259
<a name="l00331"></a>00331                 <span class="keywordtype">double</span>(symbolSize.width()) / <span class="keywordtype">double</span>(rect.width());
 
260
<a name="l00332"></a>00332             symbolSize.setHeight(rect.height());
 
261
<a name="l00333"></a>00333             symbolSize.setWidth(qRound(symbolSize.width() / ratio));
 
262
<a name="l00334"></a>00334         }
 
263
<a name="l00335"></a>00335 
 
264
<a name="l00336"></a>00336         QRect symbolRect;
 
265
<a name="l00337"></a>00337         symbolRect.setSize(symbolSize);
 
266
<a name="l00338"></a>00338         symbolRect.moveCenter(rect.center());
 
267
<a name="l00339"></a>00339 
 
268
<a name="l00340"></a>00340         painter-&gt;save();
 
269
<a name="l00341"></a>00341         painter-&gt;setBrush(d_data-&gt;symbol.brush());
 
270
<a name="l00342"></a>00342         painter-&gt;setPen(d_data-&gt;symbol.pen());
 
271
<a name="l00343"></a>00343         d_data-&gt;symbol.draw(painter, symbolRect);
 
272
<a name="l00344"></a>00344         painter-&gt;restore();
 
273
<a name="l00345"></a>00345     }
 
274
<a name="l00346"></a>00346 }
 
275
<a name="l00347"></a>00347 
 
276
<a name="l00354"></a><a class="code" href="class_qwt_legend_item.html#817a72727cfb906e25005962c369126a">00354</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#817a72727cfb906e25005962c369126a">QwtLegendItem::drawItem</a>(QPainter *painter, <span class="keyword">const</span> QRect &amp;rect)<span class="keyword"> const</span>
 
277
<a name="l00355"></a>00355 <span class="keyword"></span>{
 
278
<a name="l00356"></a>00356     painter-&gt;save();
 
279
<a name="l00357"></a>00357 
 
280
<a name="l00358"></a>00358     <span class="keyword">const</span> <a class="code" href="class_qwt_metrics_map.html">QwtMetricsMap</a> &amp;map = <a class="code" href="class_qwt_painter.html#3de95bfc83c9beee537404b41749bad5">QwtPainter::metricsMap</a>();
 
281
<a name="l00359"></a>00359 
 
282
<a name="l00360"></a>00360     <span class="keyword">const</span> <span class="keywordtype">int</span> m = map.<a class="code" href="class_qwt_metrics_map.html#e1cce24cb234af56b3e52bfad1d153ac">screenToLayoutX</a>(<a class="code" href="class_qwt_text_label.html#b754bebe50bc0e713cde9ba58bf6c3c8">margin</a>());
 
283
<a name="l00361"></a>00361     <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="class_qwt_legend_item.html#dc59d1683f3bb11a795098776e76c0bc">spacing</a> = map.<a class="code" href="class_qwt_metrics_map.html#e1cce24cb234af56b3e52bfad1d153ac">screenToLayoutX</a>(d_data-&gt;spacing);
 
284
<a name="l00362"></a>00362     <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="class_qwt_legend_item.html#3326305e42b8904e55bf0c358b69267a">identifierWidth</a> = map.<a class="code" href="class_qwt_metrics_map.html#e1cce24cb234af56b3e52bfad1d153ac">screenToLayoutX</a>(d_data-&gt;identifierWidth);
 
285
<a name="l00363"></a>00363 
 
286
<a name="l00364"></a>00364     <span class="keyword">const</span> QRect identifierRect(rect.x() + m, rect.y(), 
 
287
<a name="l00365"></a>00365         identifierWidth, rect.height());
 
288
<a name="l00366"></a>00366     <a class="code" href="class_qwt_legend_item.html#9cd64e5c5c04621e4684c3d75d3eadff">drawIdentifier</a>(painter, identifierRect);
 
289
<a name="l00367"></a>00367 
 
290
<a name="l00368"></a>00368     <span class="comment">// Label</span>
 
291
<a name="l00369"></a>00369 
 
292
<a name="l00370"></a>00370     QRect titleRect = rect;
 
293
<a name="l00371"></a>00371     titleRect.setX(identifierRect.right() + 2 * spacing);
 
294
<a name="l00372"></a>00372      
 
295
<a name="l00373"></a>00373     <a class="code" href="class_qwt_text_label.html#6ff4f9a87e11594740f312c8522f933e">text</a>().<a class="code" href="class_qwt_text.html#3907eb112ff2259adbaad4c433178354">draw</a>(painter, titleRect);
 
296
<a name="l00374"></a>00374 
 
297
<a name="l00375"></a>00375     painter-&gt;restore();
 
298
<a name="l00376"></a>00376 }
 
299
<a name="l00377"></a>00377 
 
300
<a name="l00378"></a><a class="code" href="class_qwt_legend_item.html#c154aa6b045d78f8134bbfab19a9729b">00378</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#c154aa6b045d78f8134bbfab19a9729b">QwtLegendItem::paintEvent</a>(QPaintEvent *e)
 
301
<a name="l00379"></a>00379 {
 
302
<a name="l00380"></a>00380     <span class="keyword">const</span> QRect cr = contentsRect();
 
303
<a name="l00381"></a>00381 
 
304
<a name="l00382"></a>00382     QPainter painter(<span class="keyword">this</span>);
 
305
<a name="l00383"></a>00383     painter.setClipRegion(e-&gt;region());
 
306
<a name="l00384"></a>00384 
 
307
<a name="l00385"></a>00385     <span class="keywordflow">if</span> ( d_data-&gt;isDown )
 
308
<a name="l00386"></a>00386     {
 
309
<a name="l00387"></a>00387         qDrawWinButton(&amp;painter, 0, 0, width(), height(), 
 
310
<a name="l00388"></a>00388 #<span class="keywordflow">if</span> QT_VERSION &lt; 0x040000
 
311
<a name="l00389"></a>00389             colorGroup(), 
 
312
<a name="l00390"></a>00390 #<span class="keywordflow">else</span>
 
313
<a name="l00391"></a>00391             palette(),
 
314
<a name="l00392"></a>00392 #endif
 
315
<a name="l00393"></a>00393             <span class="keyword">true</span>);
 
316
<a name="l00394"></a>00394     }
 
317
<a name="l00395"></a>00395 
 
318
<a name="l00396"></a>00396     painter.save();
 
319
<a name="l00397"></a>00397 
 
320
<a name="l00398"></a>00398     <span class="keywordflow">if</span> ( d_data-&gt;isDown )
 
321
<a name="l00399"></a>00399     {
 
322
<a name="l00400"></a>00400         <span class="keyword">const</span> QSize shiftSize = buttonShift(<span class="keyword">this</span>);
 
323
<a name="l00401"></a>00401         painter.translate(shiftSize.width(), shiftSize.height());
 
324
<a name="l00402"></a>00402     }
 
325
<a name="l00403"></a>00403 
 
326
<a name="l00404"></a>00404     painter.setClipRect(cr);
 
327
<a name="l00405"></a>00405 
 
328
<a name="l00406"></a>00406     <a class="code" href="class_qwt_text_label.html#b1d6c248f451517a32c626372670ab51">drawContents</a>(&amp;painter);
 
329
<a name="l00407"></a>00407 
 
330
<a name="l00408"></a>00408     QRect rect = cr;
 
331
<a name="l00409"></a>00409     rect.setX(rect.x() + <a class="code" href="class_qwt_text_label.html#b754bebe50bc0e713cde9ba58bf6c3c8">margin</a>());
 
332
<a name="l00410"></a>00410     <span class="keywordflow">if</span> ( d_data-&gt;itemMode != QwtLegend::ReadOnlyItem )
 
333
<a name="l00411"></a>00411         rect.setX(rect.x() + ButtonFrame);
 
334
<a name="l00412"></a>00412 
 
335
<a name="l00413"></a>00413     rect.setWidth(d_data-&gt;identifierWidth);
 
336
<a name="l00414"></a>00414 
 
337
<a name="l00415"></a>00415     <a class="code" href="class_qwt_legend_item.html#9cd64e5c5c04621e4684c3d75d3eadff">drawIdentifier</a>(&amp;painter, rect);
 
338
<a name="l00416"></a>00416 
 
339
<a name="l00417"></a>00417     painter.restore();
 
340
<a name="l00418"></a>00418 }
 
341
<a name="l00419"></a>00419 
 
342
<a name="l00420"></a><a class="code" href="class_qwt_legend_item.html#af54f5473fc174aac5cb5cdcfdcc7292">00420</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#af54f5473fc174aac5cb5cdcfdcc7292">QwtLegendItem::mousePressEvent</a>(QMouseEvent *e)
 
343
<a name="l00421"></a>00421 {
 
344
<a name="l00422"></a>00422     <span class="keywordflow">if</span> ( e-&gt;button() != Qt::LeftButton )
 
345
<a name="l00423"></a>00423         <span class="keywordflow">return</span>;
 
346
<a name="l00424"></a>00424 
 
347
<a name="l00425"></a>00425     <span class="keywordflow">switch</span>(d_data-&gt;itemMode)
 
348
<a name="l00426"></a>00426     {
 
349
<a name="l00427"></a>00427         <span class="keywordflow">case</span> QwtLegend::ClickableItem:
 
350
<a name="l00428"></a>00428         {
 
351
<a name="l00429"></a>00429             <a class="code" href="class_qwt_legend_item.html#1c871e735a96cc86f95b4dffe2339f85">setDown</a>(<span class="keyword">true</span>);
 
352
<a name="l00430"></a>00430             <span class="keywordflow">break</span>;
 
353
<a name="l00431"></a>00431         }
 
354
<a name="l00432"></a>00432         <span class="keywordflow">case</span> QwtLegend::CheckableItem:
 
355
<a name="l00433"></a>00433         {
 
356
<a name="l00434"></a>00434             <a class="code" href="class_qwt_legend_item.html#1c871e735a96cc86f95b4dffe2339f85">setDown</a>(!<a class="code" href="class_qwt_legend_item.html#d88e70289e552d67f881d0435fae1098">isDown</a>());
 
357
<a name="l00435"></a>00435             <span class="keywordflow">break</span>;
 
358
<a name="l00436"></a>00436         }
 
359
<a name="l00437"></a>00437         <span class="keywordflow">default</span>:;
 
360
<a name="l00438"></a>00438     }
 
361
<a name="l00439"></a>00439 }
 
362
<a name="l00440"></a>00440 
 
363
<a name="l00441"></a><a class="code" href="class_qwt_legend_item.html#37950b4dd9de4dfe74c05eee572c16a2">00441</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#37950b4dd9de4dfe74c05eee572c16a2">QwtLegendItem::mouseReleaseEvent</a>(QMouseEvent *e)
 
364
<a name="l00442"></a>00442 {
 
365
<a name="l00443"></a>00443     <span class="keywordflow">if</span> ( !e-&gt;button() == Qt::LeftButton )
 
366
<a name="l00444"></a>00444         <span class="keywordflow">return</span>;
 
367
<a name="l00445"></a>00445 
 
368
<a name="l00446"></a>00446     <span class="keywordflow">if</span> ( d_data-&gt;itemMode == QwtLegend::ClickableItem )
 
369
<a name="l00447"></a>00447         <a class="code" href="class_qwt_legend_item.html#1c871e735a96cc86f95b4dffe2339f85">setDown</a>(<span class="keyword">false</span>);
 
370
<a name="l00448"></a>00448 }
 
371
<a name="l00449"></a>00449 
 
372
<a name="l00450"></a><a class="code" href="class_qwt_legend_item.html#9b6a6527d2b867a912a21ef3358eb63f">00450</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#9b6a6527d2b867a912a21ef3358eb63f">QwtLegendItem::keyPressEvent</a>(QKeyEvent *e)
 
373
<a name="l00451"></a>00451 {
 
374
<a name="l00452"></a>00452     <span class="keywordflow">if</span> ( e-&gt;key() != Qt::Key_Space || e-&gt;isAutoRepeat() )
 
375
<a name="l00453"></a>00453         <span class="keywordflow">return</span>;
 
376
<a name="l00454"></a>00454 
 
377
<a name="l00455"></a>00455     <span class="keywordflow">switch</span>(d_data-&gt;itemMode)
 
378
<a name="l00456"></a>00456     {
 
379
<a name="l00457"></a>00457         <span class="keywordflow">case</span> QwtLegend::ClickableItem:
 
380
<a name="l00458"></a>00458         {
 
381
<a name="l00459"></a>00459             <a class="code" href="class_qwt_legend_item.html#1c871e735a96cc86f95b4dffe2339f85">setDown</a>(<span class="keyword">true</span>);
 
382
<a name="l00460"></a>00460             <span class="keywordflow">break</span>;
 
383
<a name="l00461"></a>00461         }
 
384
<a name="l00462"></a>00462         <span class="keywordflow">case</span> QwtLegend::CheckableItem:
 
385
<a name="l00463"></a>00463         {
 
386
<a name="l00464"></a>00464             <a class="code" href="class_qwt_legend_item.html#1c871e735a96cc86f95b4dffe2339f85">setDown</a>(!<a class="code" href="class_qwt_legend_item.html#d88e70289e552d67f881d0435fae1098">isDown</a>());
 
387
<a name="l00465"></a>00465             <span class="keywordflow">break</span>;
 
388
<a name="l00466"></a>00466         }
 
389
<a name="l00467"></a>00467         <span class="keywordflow">default</span>:;
 
390
<a name="l00468"></a>00468     }
 
391
<a name="l00469"></a>00469 }
 
392
<a name="l00470"></a>00470 
 
393
<a name="l00471"></a><a class="code" href="class_qwt_legend_item.html#0b31f4435914a8cd0491ea8aab45041f">00471</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#0b31f4435914a8cd0491ea8aab45041f">QwtLegendItem::keyReleaseEvent</a>(QKeyEvent *e)
 
394
<a name="l00472"></a>00472 {
 
395
<a name="l00473"></a>00473     <span class="keywordflow">if</span> ( e-&gt;key() != Qt::Key_Space || e-&gt;isAutoRepeat() )
 
396
<a name="l00474"></a>00474         <span class="keywordflow">return</span>;
 
397
<a name="l00475"></a>00475 
 
398
<a name="l00476"></a>00476     <span class="keywordflow">if</span> ( d_data-&gt;itemMode == QwtLegend::ClickableItem )
 
399
<a name="l00477"></a>00477         <a class="code" href="class_qwt_legend_item.html#1c871e735a96cc86f95b4dffe2339f85">setDown</a>(<span class="keyword">false</span>);
 
400
<a name="l00478"></a>00478 }
 
401
<a name="l00479"></a>00479 
 
402
<a name="l00480"></a><a class="code" href="class_qwt_legend_item.html#f7a194ea464d2c405479dd8be1bd1e1b">00480</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#f7a194ea464d2c405479dd8be1bd1e1b">QwtLegendItem::setChecked</a>(<span class="keywordtype">bool</span> on)
 
403
<a name="l00481"></a>00481 {
 
404
<a name="l00482"></a>00482     <span class="keywordflow">if</span> ( d_data-&gt;itemMode == QwtLegend::CheckableItem )
 
405
<a name="l00483"></a>00483     {
 
406
<a name="l00484"></a>00484         <span class="keyword">const</span> <span class="keywordtype">bool</span> isBlocked = signalsBlocked();
 
407
<a name="l00485"></a>00485         blockSignals(<span class="keyword">true</span>);
 
408
<a name="l00486"></a>00486 
 
409
<a name="l00487"></a>00487         <a class="code" href="class_qwt_legend_item.html#1c871e735a96cc86f95b4dffe2339f85">setDown</a>(on);
 
410
<a name="l00488"></a>00488 
 
411
<a name="l00489"></a>00489         blockSignals(isBlocked);
 
412
<a name="l00490"></a>00490     }
 
413
<a name="l00491"></a>00491 }
 
414
<a name="l00492"></a>00492 
 
415
<a name="l00493"></a><a class="code" href="class_qwt_legend_item.html#89c9b96ad3dc37f31ec92779a3899d23">00493</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_legend_item.html#89c9b96ad3dc37f31ec92779a3899d23">QwtLegendItem::isChecked</a>()<span class="keyword"> const</span>
 
416
<a name="l00494"></a>00494 <span class="keyword"></span>{
 
417
<a name="l00495"></a>00495     <span class="keywordflow">return</span> d_data-&gt;itemMode == QwtLegend::CheckableItem &amp;&amp; <a class="code" href="class_qwt_legend_item.html#d88e70289e552d67f881d0435fae1098">isDown</a>();
 
418
<a name="l00496"></a>00496 }
 
419
<a name="l00497"></a>00497 
 
420
<a name="l00498"></a><a class="code" href="class_qwt_legend_item.html#1c871e735a96cc86f95b4dffe2339f85">00498</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#1c871e735a96cc86f95b4dffe2339f85">QwtLegendItem::setDown</a>(<span class="keywordtype">bool</span> down)
 
421
<a name="l00499"></a>00499 {
 
422
<a name="l00500"></a>00500     <span class="keywordflow">if</span> ( down == d_data-&gt;isDown )
 
423
<a name="l00501"></a>00501         <span class="keywordflow">return</span>;
 
424
<a name="l00502"></a>00502 
 
425
<a name="l00503"></a>00503     d_data-&gt;isDown = down;
 
426
<a name="l00504"></a>00504     update();
 
427
<a name="l00505"></a>00505 
 
428
<a name="l00506"></a>00506     <span class="keywordflow">if</span> ( d_data-&gt;itemMode == QwtLegend::ClickableItem )
 
429
<a name="l00507"></a>00507     {
 
430
<a name="l00508"></a>00508         <span class="keywordflow">if</span> ( d_data-&gt;isDown )
 
431
<a name="l00509"></a>00509             emit <a class="code" href="class_qwt_legend_item.html#7cc6a0390cc0aaea2feb8a324139410c">pressed</a>();
 
432
<a name="l00510"></a>00510         <span class="keywordflow">else</span>
 
433
<a name="l00511"></a>00511         {
 
434
<a name="l00512"></a>00512             emit <a class="code" href="class_qwt_legend_item.html#7286b8900294659d0850ac588aafaa97">released</a>();
 
435
<a name="l00513"></a>00513             emit <a class="code" href="class_qwt_legend_item.html#28c4837ec402725c87ecee6de558c956">clicked</a>();
 
436
<a name="l00514"></a>00514         }
 
437
<a name="l00515"></a>00515     }
 
438
<a name="l00516"></a>00516 
 
439
<a name="l00517"></a>00517     <span class="keywordflow">if</span> ( d_data-&gt;itemMode == QwtLegend::CheckableItem )
 
440
<a name="l00518"></a>00518         emit <a class="code" href="class_qwt_legend_item.html#95fe5b1ec7fcfaa86fd9ec49a3bf23aa">checked</a>(d_data-&gt;isDown);
 
441
<a name="l00519"></a>00519 }
 
442
<a name="l00520"></a>00520 
 
443
<a name="l00521"></a><a class="code" href="class_qwt_legend_item.html#d88e70289e552d67f881d0435fae1098">00521</a> <span class="keywordtype">bool</span> <a class="code" href="class_qwt_legend_item.html#d88e70289e552d67f881d0435fae1098">QwtLegendItem::isDown</a>()<span class="keyword"> const</span>
 
444
<a name="l00522"></a>00522 <span class="keyword"></span>{
 
445
<a name="l00523"></a>00523     <span class="keywordflow">return</span> d_data-&gt;isDown;
 
446
<a name="l00524"></a>00524 }
 
447
<a name="l00525"></a>00525 
 
448
<a name="l00526"></a><a class="code" href="class_qwt_legend_item.html#6248ff72fbbdf1997a590fb0a2d7088f">00526</a> QSize <a class="code" href="class_qwt_legend_item.html#6248ff72fbbdf1997a590fb0a2d7088f">QwtLegendItem::sizeHint</a>()<span class="keyword"> const</span>
 
449
<a name="l00527"></a>00527 <span class="keyword"></span>{
 
450
<a name="l00528"></a>00528     QSize sz = <a class="code" href="class_qwt_text_label.html#0217bc022e6f3b2f22819c84d5867ae7">QwtTextLabel::sizeHint</a>();
 
451
<a name="l00529"></a>00529     <span class="keywordflow">if</span> ( d_data-&gt;itemMode != QwtLegend::ReadOnlyItem )
 
452
<a name="l00530"></a>00530         sz += buttonShift(<span class="keyword">this</span>);
 
453
<a name="l00531"></a>00531 
 
454
<a name="l00532"></a>00532     <span class="keywordflow">return</span> sz;
 
455
<a name="l00533"></a>00533 }
 
456
<a name="l00534"></a>00534 
 
457
<a name="l00535"></a><a class="code" href="class_qwt_legend_item.html#fa466fbb3689353107872c6e133b5ddf">00535</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#fa466fbb3689353107872c6e133b5ddf">QwtLegendItem::drawText</a>(QPainter *painter, <span class="keyword">const</span> QRect &amp;rect)
 
458
<a name="l00536"></a>00536 {
 
459
<a name="l00537"></a>00537     <a class="code" href="class_qwt_text_label.html#88491c6677985ca048a3ebc095940df3">QwtTextLabel::drawText</a>(painter, rect);
 
460
<a name="l00538"></a>00538 }
 
461
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Jun 11 07:41:38 2007 for Qwt User's Guide by&nbsp;
 
462
<a href="http://www.doxygen.org/index.html">
 
463
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>
 
464
</body>
 
465
</html>