source: trunk/doc/html/qclipboard.html@ 208

Last change on this file since 208 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 26.0 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qclipboard.cpp:47 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QClipboard Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QClipboard Class Reference</h1>
33
34<p>The QClipboard class provides access to the window system clipboard.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qclipboard-h.html">qclipboard.h</a>&gt;</tt>
37<p>Inherits <a href="qobject.html">QObject</a>.
38<p><a href="qclipboard-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn>enum <a href="#Mode-enum"><b>Mode</b></a> { Clipboard, Selection }</li>
42<li class=fn>void <a href="#clear"><b>clear</b></a> ( Mode&nbsp;mode )</li>
43<li class=fn>void <a href="#clear-2"><b>clear</b></a> ()</li>
44<li class=fn>bool <a href="#supportsSelection"><b>supportsSelection</b></a> () const</li>
45<li class=fn>bool <a href="#ownsSelection"><b>ownsSelection</b></a> () const</li>
46<li class=fn>bool <a href="#ownsClipboard"><b>ownsClipboard</b></a> () const</li>
47<li class=fn>void setSelectionMode ( bool&nbsp;enable ) &nbsp;<em>(obsolete)</em></li>
48<li class=fn>bool selectionModeEnabled () const &nbsp;<em>(obsolete)</em></li>
49<li class=fn>QString <a href="#text"><b>text</b></a> ( Mode&nbsp;mode ) const</li>
50<li class=fn>QString <a href="#text-2"><b>text</b></a> ( QCString&nbsp;&amp;&nbsp;subtype, Mode&nbsp;mode ) const</li>
51<li class=fn>void <a href="#setText"><b>setText</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, Mode&nbsp;mode )</li>
52<li class=fn>QMimeSource * <a href="#data"><b>data</b></a> ( Mode&nbsp;mode ) const</li>
53<li class=fn>void <a href="#setData"><b>setData</b></a> ( QMimeSource&nbsp;*&nbsp;src, Mode&nbsp;mode )</li>
54<li class=fn>QImage <a href="#image"><b>image</b></a> ( Mode&nbsp;mode ) const</li>
55<li class=fn>QPixmap <a href="#pixmap"><b>pixmap</b></a> ( Mode&nbsp;mode ) const</li>
56<li class=fn>void <a href="#setImage"><b>setImage</b></a> ( const&nbsp;QImage&nbsp;&amp;&nbsp;image, Mode&nbsp;mode )</li>
57<li class=fn>void <a href="#setPixmap"><b>setPixmap</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, Mode&nbsp;mode )</li>
58<li class=fn>QString <a href="#text-3"><b>text</b></a> () const</li>
59<li class=fn>QString <a href="#text-4"><b>text</b></a> ( QCString&nbsp;&amp;&nbsp;subtype ) const</li>
60<li class=fn>void <a href="#setText-2"><b>setText</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text )</li>
61<li class=fn>QMimeSource * <a href="#data-2"><b>data</b></a> () const</li>
62<li class=fn>void <a href="#setData-2"><b>setData</b></a> ( QMimeSource&nbsp;*&nbsp;src )</li>
63<li class=fn>QImage <a href="#image-2"><b>image</b></a> () const</li>
64<li class=fn>QPixmap <a href="#pixmap-2"><b>pixmap</b></a> () const</li>
65<li class=fn>void <a href="#setImage-2"><b>setImage</b></a> ( const&nbsp;QImage&nbsp;&amp;&nbsp;image )</li>
66<li class=fn>void <a href="#setPixmap-2"><b>setPixmap</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap )</li>
67</ul>
68<h2>Signals</h2>
69<ul>
70<li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li>
71<li class=fn>void <a href="#dataChanged"><b>dataChanged</b></a> ()</li>
72</ul>
73<hr><a name="details"></a><h2>Detailed Description</h2>
74
75
76The QClipboard class provides access to the window system clipboard.
77<p>
78
79
80<p> The clipboard offers a simple mechanism to copy and paste data
81between applications.
82<p> QClipboard supports the same data types that <a href="qdragobject.html">QDragObject</a> does, and
83uses similar mechanisms. For advanced clipboard usage
84read <a href="dnd.html">the drag-and-drop documentation</a>.
85<p> There is a single QClipboard object in an application, and you can
86access it using <a href="qapplication.html#clipboard">QApplication::clipboard</a>().
87<p> Example:
88<pre>
89 QClipboard *cb = QApplication::<a href="qapplication.html#clipboard">clipboard</a>();
90
91 // Copy text from the clipboard (paste)
92 <a href="qstring.html">QString</a> text = cb-&gt;<a href="#text">text</a>(QClipboard::<a href="#Mode-enum">Clipboard</a>);
93 if ( !text.<a href="qstring.html#isNull">isNull</a>() )
94 <a href="qapplication.html#qDebug">qDebug</a>( "The clipboard contains: " + text );
95
96 // Copy text into the clipboard
97 cb-&gt;<a href="#setText">setText</a>( "This text can be pasted by other programs",
98 QClipboard::<a href="#Mode-enum">Clipboard</a> );
99 </pre>
100
101<p> QClipboard features some convenience functions to access common data
102types: <a href="#setText">setText</a>() allows the exchange of Unicode text and
103<a href="#setPixmap">setPixmap</a>() and <a href="#setImage">setImage</a>() allows the exchange of QPixmaps
104and QImages between applications. The <a href="#setData">setData</a>() function is the
105ultimate in flexibility: it allows you to add any <a href="qmimesource.html">QMimeSource</a> into the
106clipboard. There are corresponding getters for each of these, e.g.
107<a href="#text">text</a>(), <a href="#image">image</a>() and <a href="#pixmap">pixmap</a>().
108<p> You can clear the clipboard by calling <a href="#clear">clear</a>().
109<p> <h3> Platform Specific Information
110</h3>
111<a name="1"></a><p> <h4> X11
112</h4>
113<a name="1-1"></a><p> <ul>
114<p> <li> The X11 Window System has the concept of a separate selection
115and clipboard. When text is selected, it is immediately available
116as the global mouse selection. The global mouse selection may
117later be copied to the clipboard. By convention, the middle mouse
118button is used to paste the global mouse selection.
119<p> <li> X11 also has the concept of ownership; if you change the
120selection within a window, X11 will only notify the owner and the
121previous owner of the change, i.e. it will not notify all
122applications that the selection or clipboard data changed.
123<p> <li> Lastly, the X11 clipboard is event driven, i.e. the clipboard
124will not function properly if the event loop is not running.
125Similarly, it is recommended that the contents of the clipboard
126are stored or retrieved in direct response to user-input events,
127e.g. mouse button or key presses and releases. You should not
128store or retrieve the clipboard contents in response to timer or
129non-user-input events.
130<p> </ul>
131<p> <h4> Windows
132</h4>
133<a name="1-1-1"></a><p> <ul>
134<p> <li> Microsoft Windows does not support the global mouse selection;
135it only supports the global clipboard, e.g. Windows only adds text
136to the clipboard when an explicit copy or cut is made.
137<p> <li> Windows does not have the concept of ownership; the clipboard
138is a fully global resource so all applications are notified of
139changes.
140<p> </ul>
141<p> See the multiclip example in the <em>Qt Designer</em> examples
142directory for an example of a multiplatform clipboard application
143that also demonstrates selection handling.
144<p>See also <a href="environment.html">Environment Classes</a> and <a href="io.html">Input/Output and Networking</a>.
145
146<hr><h2>Member Type Documentation</h2>
147<h3 class=fn><a name="Mode-enum"></a>QClipboard::Mode</h3>
148<!-- index clipboard mode -->
149<p> This enum type is used to control which part of the system clipboard is
150used by <a href="#data">QClipboard::data</a>(), <a href="#setData">QClipboard::setData</a>() and related functions.
151<ul>
152<li><tt>QClipboard::Clipboard</tt> - indicates that data should be stored and retrieved from
153the global clipboard.
154<li><tt>QClipboard::Selection</tt> - indicates that data should be stored and retrieved from
155the global mouse selection.
156</ul><p> <em>Note</em>: Support for <a href="#Mode-enum">Selection</a> is provided only on systems with a
157global mouse selection (e.g. X11).
158<p> <p>See also <a href="#supportsSelection">QClipboard::supportsSelection</a>().
159
160<hr><h2>Member Function Documentation</h2>
161<h3 class=fn>void <a name="clear"></a>QClipboard::clear ( <a href="qclipboard.html#Mode-enum">Mode</a>&nbsp;mode )
162</h3>
163Clear the clipboard contents.
164<p> The <em>mode</em> argument is used to control which part of the system
165clipboard is used. If <em>mode</em> is QClipboard::Clipboard, this
166function clears the the global clipboard contents. If <em>mode</em> is
167QClipboard::Selection, this function clears the global mouse
168selection contents.
169<p> <p>See also <a href="#Mode-enum">QClipboard::Mode</a> and <a href="#supportsSelection">supportsSelection</a>().
170
171<h3 class=fn>void <a name="clear-2"></a>QClipboard::clear ()
172</h3>
173This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
174<p> This function uses the <a href="#clear">QClipboard::clear</a>() function which takes
175a QClipboard::Mode argument. The value of the mode argument is
176determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
177If selectionModeEnabled() returns TRUE, the mode argument is
178QClipboard::Selection, otherwise the mode argument is QClipboard::Clipboard.
179
180<h3 class=fn><a href="qmimesource.html">QMimeSource</a>&nbsp;* <a name="data"></a>QClipboard::data ( <a href="qclipboard.html#Mode-enum">Mode</a>&nbsp;mode ) const
181</h3>
182Returns a reference to a <a href="qmimesource.html">QMimeSource</a> representation of the current
183clipboard data.
184<p> The <em>mode</em> argument is used to control which part of the system
185clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
186data is retrieved from the global clipboard. If <em>mode</em> is
187QClipboard::Selection, the data is retrieved from the global
188mouse selection.
189<p> <p>See also <a href="#setData">setData</a>().
190
191<h3 class=fn><a href="qmimesource.html">QMimeSource</a>&nbsp;* <a name="data-2"></a>QClipboard::data () const
192</h3>
193This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
194<p> This function uses the <a href="#data">QClipboard::data</a>() function which takes
195a QClipboard::Mode argument. The value of the mode argument is
196determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
197If selectionModeEnabled() returns TRUE, the mode argument is
198QClipboard::Selection, otherwise the mode argument is
199QClipboard::Clipboard.
200
201<h3 class=fn>void <a name="dataChanged"></a>QClipboard::dataChanged ()<tt> [signal]</tt>
202</h3>
203
204<p> This signal is emitted when the clipboard data is changed.
205
206<h3 class=fn><a href="qimage.html">QImage</a> <a name="image"></a>QClipboard::image ( <a href="qclipboard.html#Mode-enum">Mode</a>&nbsp;mode ) const
207</h3>
208Returns the clipboard image, or returns a null image if the
209clipboard does not contain an image or if it contains an image in
210an unsupported image format.
211<p> The <em>mode</em> argument is used to control which part of the system
212clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
213image is retrieved from the global clipboard. If <em>mode</em> is
214QClipboard::Selection, the image is retrieved from the global
215mouse selection.
216<p> <p>See also <a href="#setImage">setImage</a>(), <a href="#pixmap">pixmap</a>(), <a href="#data">data</a>(), and <a href="qimage.html#isNull">QImage::isNull</a>().
217
218<h3 class=fn><a href="qimage.html">QImage</a> <a name="image-2"></a>QClipboard::image () const
219</h3>
220This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
221<p> This function uses the <a href="#image">QClipboard::image</a>() function which takes
222a QClipboard::Mode argument. The value of the mode argument is
223determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
224If selectionModeEnabled() returns TRUE, the mode argument is
225QClipboard::Selection, otherwise the mode argument is
226QClipboard::Clipboard.
227
228<h3 class=fn>bool <a name="ownsClipboard"></a>QClipboard::ownsClipboard () const
229</h3>
230Returns TRUE if this clipboard object owns the clipboard data;
231otherwise returns FALSE.
232
233<h3 class=fn>bool <a name="ownsSelection"></a>QClipboard::ownsSelection () const
234</h3>
235Returns TRUE if this clipboard object owns the mouse selection
236data; otherwise returns FALSE.
237
238<h3 class=fn><a href="qpixmap.html">QPixmap</a> <a name="pixmap"></a>QClipboard::pixmap ( <a href="qclipboard.html#Mode-enum">Mode</a>&nbsp;mode ) const
239</h3>
240Returns the clipboard pixmap, or null if the clipboard does not
241contain a pixmap. Note that this can lose information. For
242example, if the image is 24-bit and the display is 8-bit, the
243result is converted to 8 bits, and if the image has an alpha
244channel, the result just has a mask.
245<p> The <em>mode</em> argument is used to control which part of the system
246clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
247pixmap is retrieved from the global clipboard. If <em>mode</em> is
248QClipboard::Selection, the pixmap is retrieved from the global
249mouse selection.
250<p> <p>See also <a href="#setPixmap">setPixmap</a>(), <a href="#image">image</a>(), <a href="#data">data</a>(), and <a href="qpixmap.html#convertFromImage">QPixmap::convertFromImage</a>().
251
252<h3 class=fn><a href="qpixmap.html">QPixmap</a> <a name="pixmap-2"></a>QClipboard::pixmap () const
253</h3>
254This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
255<p> This function uses the <a href="#pixmap">QClipboard::pixmap</a>() function which takes
256a QClipboard::Mode argument. The value of the mode argument is
257determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
258If selectionModeEnabled() returns TRUE, the mode argument is
259QClipboard::Selection, otherwise the mode argument is
260QClipboard::Clipboard.
261
262<h3 class=fn>void <a name="selectionChanged"></a>QClipboard::selectionChanged ()<tt> [signal]</tt>
263</h3>
264
265<p> This signal is emitted when the selection is changed. This only
266applies to windowing systems that support selections, e.g. X11.
267Windows doesn't support selections.
268
269<h3 class=fn>bool <a name="selectionModeEnabled"></a>QClipboard::selectionModeEnabled () const
270</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
271<p> Use the <a href="#data">QClipboard::data</a>(), <a href="#setData">QClipboard::setData</a>() and related functions
272which take a QClipboard::Mode argument.
273<p> Returns the selection mode.
274<p> <p>See also <a href="#setSelectionMode">setSelectionMode</a>() and <a href="#supportsSelection">supportsSelection</a>().
275
276<h3 class=fn>void <a name="setData"></a>QClipboard::setData ( <a href="qmimesource.html">QMimeSource</a>&nbsp;*&nbsp;src, <a href="qclipboard.html#Mode-enum">Mode</a>&nbsp;mode )
277</h3>
278Sets the clipboard data to <em>src</em>. Ownership of the data is
279transferred to the clipboard. If you want to remove the data
280either call <a href="#clear">clear</a>() or call <a href="#setData">setData</a>() again with new data.
281<p> The <em>mode</em> argument is used to control which part of the system
282clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
283data is retrieved from the global clipboard. If <em>mode</em> is
284QClipboard::Selection, the data is retrieved from the global
285mouse selection.
286<p> The <a href="qdragobject.html">QDragObject</a> subclasses are reasonable objects to put into the
287clipboard (but do not try to call <a href="qdragobject.html#drag">QDragObject::drag</a>() on the same
288object). Any QDragObject placed in the clipboard should have a
289parent of 0. Do not put <a href="qdragmoveevent.html">QDragMoveEvent</a> or <a href="qdropevent.html">QDropEvent</a> subclasses in
290the clipboard, as they do not belong to the event handler which
291receives them.
292<p> The <a href="#setText">setText</a>(), <a href="#setImage">setImage</a>() and <a href="#setPixmap">setPixmap</a>() functions are simpler
293wrappers for setting text, image and pixmap data respectively.
294<p> <p>See also <a href="#data">data</a>().
295
296<h3 class=fn>void <a name="setData-2"></a>QClipboard::setData ( <a href="qmimesource.html">QMimeSource</a>&nbsp;*&nbsp;src )
297</h3>
298This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
299<p> This function uses the <a href="#setData">QClipboard::setData</a>() function which takes
300a QClipboard::Mode argument. The value of the mode argument is
301determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
302If selectionModeEnabled() returns TRUE, the mode argument is
303QClipboard::Selection, otherwise the mode argument is
304QClipboard::Clipboard.
305
306<h3 class=fn>void <a name="setImage"></a>QClipboard::setImage ( const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;image, <a href="qclipboard.html#Mode-enum">Mode</a>&nbsp;mode )
307</h3>
308Copies <em>image</em> into the clipboard.
309<p> The <em>mode</em> argument is used to control which part of the system
310clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
311image is stored in the global clipboard. If <em>mode</em> is
312QClipboard::Selection, the data is stored in the global
313mouse selection.
314<p> This is shorthand for:
315<pre>
316 <a href="#setData">setData</a>( new <a href="qimagedrag.html">QImageDrag</a>(image), mode )
317 </pre>
318
319<p> <p>See also <a href="#image">image</a>(), <a href="#setPixmap">setPixmap</a>(), and <a href="#setData">setData</a>().
320
321<h3 class=fn>void <a name="setImage-2"></a>QClipboard::setImage ( const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;image )
322</h3>
323This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
324<p> This function uses the <a href="#setImage">QClipboard::setImage</a>() function which takes
325a QClipboard::Mode argument. The value of the mode argument is
326determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
327If selectionModeEnabled() returns TRUE, the mode argument is
328QClipboard::Selection, otherwise the mode argument is
329QClipboard::Clipboard.
330
331<h3 class=fn>void <a name="setPixmap"></a>QClipboard::setPixmap ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, <a href="qclipboard.html#Mode-enum">Mode</a>&nbsp;mode )
332</h3>
333Copies <em>pixmap</em> into the clipboard. Note that this is slower
334than <a href="#setImage">setImage</a>() because it needs to convert the <a href="qpixmap.html">QPixmap</a> to a
335<a href="qimage.html">QImage</a> first.
336<p> The <em>mode</em> argument is used to control which part of the system
337clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
338pixmap is stored in the global clipboard. If <em>mode</em> is
339QClipboard::Selection, the pixmap is stored in the global
340mouse selection.
341<p> <p>See also <a href="#pixmap">pixmap</a>(), <a href="#setImage">setImage</a>(), and <a href="#setData">setData</a>().
342
343<h3 class=fn>void <a name="setPixmap-2"></a>QClipboard::setPixmap ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap )
344</h3>
345This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
346<p> This function uses the <a href="#setPixmap">QClipboard::setPixmap</a>() function which takes
347a QClipboard::Mode argument. The value of the mode argument is
348determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
349If selectionModeEnabled() returns TRUE, the mode argument is
350QClipboard::Selection, otherwise the mode argument is
351QClipboard::Clipboard.
352
353<h3 class=fn>void <a name="setSelectionMode"></a>QClipboard::setSelectionMode ( bool&nbsp;enable )
354</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
355<p> Use the <a href="#data">QClipboard::data</a>(), <a href="#setData">QClipboard::setData</a>() and related functions
356which take a QClipboard::Mode argument.
357<p> Sets the clipboard selection mode. If <em>enable</em> is TRUE, then
358subsequent calls to QClipboard::setData() and other functions
359which put data into the clipboard will put the data into the mouse
360selection, otherwise the data will be put into the clipboard.
361<p> <p>See also <a href="#supportsSelection">supportsSelection</a>() and <a href="#selectionModeEnabled">selectionModeEnabled</a>().
362
363<h3 class=fn>void <a name="setText"></a>QClipboard::setText ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, <a href="qclipboard.html#Mode-enum">Mode</a>&nbsp;mode )
364</h3>
365Copies <em>text</em> into the clipboard as plain text.
366<p> The <em>mode</em> argument is used to control which part of the system
367clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
368text is stored in the global clipboard. If <em>mode</em> is
369QClipboard::Selection, the text is stored in the global
370mouse selection.
371<p> <p>See also <a href="#text">text</a>() and <a href="#setData">setData</a>().
372
373<p>Example: <a href="regexptester-example.html#x2476">regexptester/regexptester.cpp</a>.
374<h3 class=fn>void <a name="setText-2"></a>QClipboard::setText ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text )
375</h3>
376This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
377<p> This function uses the <a href="#setText">QClipboard::setText</a>() function which takes
378a QClipboard::Mode argument. The value of the mode argument is
379determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
380If selectionModeEnabled() returns TRUE, the mode argument is
381QClipboard::Selection, otherwise the mode argument is
382QClipboard::Clipboard.
383
384<h3 class=fn>bool <a name="supportsSelection"></a>QClipboard::supportsSelection () const
385</h3>
386Returns TRUE if the clipboard supports mouse selection; otherwise
387returns FALSE.
388
389<p>Example: <a href="regexptester-example.html#x2477">regexptester/regexptester.cpp</a>.
390<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QClipboard::text ( <a href="qclipboard.html#Mode-enum">Mode</a>&nbsp;mode ) const
391</h3>
392Returns the clipboard text as plain text, or a null string if the
393clipboard does not contain any text.
394<p> The <em>mode</em> argument is used to control which part of the system
395clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
396text is retrieved from the global clipboard. If <em>mode</em> is
397QClipboard::Selection, the text is retrieved from the global
398mouse selection.
399<p> <p>See also <a href="#setText">setText</a>(), <a href="#data">data</a>(), and <a href="qstring.html#operator!">QString::operator!</a>().
400
401<h3 class=fn><a href="qstring.html">QString</a> <a name="text-2"></a>QClipboard::text ( <a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;subtype, <a href="qclipboard.html#Mode-enum">Mode</a>&nbsp;mode ) const
402</h3>
403This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
404<p> Returns the clipboard text in subtype <em>subtype</em>, or a null string
405if the clipboard does not contain any text. If <em>subtype</em> is null,
406any subtype is acceptable, and <em>subtype</em> is set to the chosen
407subtype.
408<p> The <em>mode</em> argument is used to control which part of the system
409clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
410text is retrieved from the global clipboard. If <em>mode</em> is
411QClipboard::Selection, the text is retrieved from the global
412mouse selection.
413<p> Common values for <em>subtype</em> are "plain" and "html".
414<p> <p>See also <a href="#setText">setText</a>(), <a href="#data">data</a>(), and <a href="qstring.html#operator!">QString::operator!</a>().
415
416<h3 class=fn><a href="qstring.html">QString</a> <a name="text-3"></a>QClipboard::text () const
417</h3>
418This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
419<p> This function uses the <a href="#text">QClipboard::text</a>() function which takes
420a QClipboard::Mode argument. The value of the mode argument is
421determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
422If selectionModeEnabled() returns TRUE, the mode argument is
423QClipboard::Selection, otherwise the mode argument is
424QClipboard::Clipboard.
425
426<h3 class=fn><a href="qstring.html">QString</a> <a name="text-4"></a>QClipboard::text ( <a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;subtype ) const
427</h3>
428This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
429<p> Returns the clipboard text in subtype <em>subtype</em>, or a null string
430if the clipboard does not contain any text. This function uses the
431<a href="#text">QClipboard::text</a>() function which takes a QClipboard::Mode
432argument. The value of the mode argument is determined by the
433return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>(). If selectionModeEnabled()
434returns TRUE, the mode argument is QClipboard::Selection,
435otherwise the mode argument is QClipboard::Clipboard.
436
437<!-- eof -->
438<hr><p>
439This file is part of the <a href="index.html">Qt toolkit</a>.
440Copyright &copy; 1995-2007
441<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
442<table width=100% cellspacing=0 border=0><tr>
443<td>Copyright &copy; 2007
444<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
445<td align=right><div align=right>Qt 3.3.8</div>
446</table></div></address></body>
447</html>
Note: See TracBrowser for help on using the repository browser.