File: qclipboard.html

package info (click to toggle)
qt-embedded 2.3.2-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 68,608 kB
  • ctags: 45,998
  • sloc: cpp: 276,654; ansic: 71,987; makefile: 29,074; sh: 12,305; yacc: 2,465; python: 1,863; perl: 481; lex: 480; xml: 68; lisp: 15
file content (158 lines) | stat: -rw-r--r-- 9,833 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QClipboard Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">

<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>

<h1 align=center>QClipboard Class Reference</h1><br clear="all">
<p>
The QClipboard class provides access to the window system clipboard.
<a href="#details">More...</a>
<p>
<code>#include &lt;<a href="qclipboard-h.html">qclipboard.h</a>&gt;</code>
<p>
Inherits <a href="qobject.html">QObject</a>.
<p><a href="qclipboard-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn">void<a href="#33d563"><b>clear</b></a>()</div>
<li><div class="fn">QMimeSource*<a href="#4f0aa4"><b>data</b></a>()const</div>
<li><div class="fn">void<a href="#727d20"><b>setData</b></a>(QMimeSource*)</div>
<li><div class="fn">QString<a href="#6bfcea"><b>text</b></a>()const</div>
<li><div class="fn">QString<a href="#855ef1"><b>text</b></a>(QCString&amp;subtype)const</div>
<li><div class="fn">void<a href="#fded53"><b>setText</b></a>(constQString&amp;)</div>
<li><div class="fn">QImage<a href="#807a8f"><b>image</b></a>()const</div>
<li><div class="fn">QPixmap<a href="#905cbc"><b>pixmap</b></a>()const</div>
<li><div class="fn">void<a href="#4f7997"><b>setImage</b></a>(constQImage&amp;)</div>
<li><div class="fn">void<a href="#6c3b77"><b>setPixmap</b></a>(constQPixmap&amp;)</div>
</ul>
<h2>Signals</h2>
<ul>
<li><div class="fn">void<a href="#03f543"><b>dataChanged</b></a>()</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">virtualvoid<b>connectNotify</b>(constchar*)(internal)</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QClipboard class provides access to the window system clipboard.
<p>
The clipboard offers a simple mechanism to copy and paste data between
applications.
<p>QClipboard supports the same data types that <a href="qdragobject.html">QDragObject</a> does, and uses
similar mechanisms. For advanced clipboard usage, you should read
<a href="dnd.html">the drag-and-drop documentation</a>.
<p>There is only one QClipboard object in an application, and you
can gain access to it using <a href="qapplication.html#1c95b5">QApplication::clipboard</a>().
<p>Example:
<pre>    <a href="qclipboard.html">QClipboard</a> *cb = QApplication::clipboard();
    <a href="qstring.html">QString</a> text;

    // Copy text from the clipboard (paste)
    text = cb-&gt;<a href="#6bfcea">text</a>();
    if ( text )
        <a href="qapplication.html#72e78c">qDebug</a>( "The clipboard contains: %s", text );

    // Copy text into the clipboard
    cb-&gt;<a href="#fded53">setText</a>( "This text can be pasted by other programs" );
</pre>
<p>QClipboard features some convenience functions to access common data
types: The methods <a href="#fded53">setText</a>() allows exchanging unicode text easily
over the clipboard, while <a href="#6c3b77">setPixmap</a>() <a href="#4f7997">setImage</a>() allows to exchange
<a href="qpixmap.html">QPixmap</a> and <a href="qimage.html">QImage</a> between applications.  <a href="#727d20">setData</a>() is the ultimate
in flexibility:  It allows you to add any <a href="qmimesource.html">QMimeSource</a> onto the
clipboard.  (There are corresponding getters for each of these,
e.g. <a href="#6bfcea">text</a>().)
<p>You can clear the clipboard by calling the method <a href="#33d563">clear</a>().

<hr><h2>Member Function Documentation</h2>
<h3 class="fn">void<a name="33d563"></a>QClipboard::clear()</h3>
<p>Clears the clipboard contents.
<h3 class="fn"><a href="qmimesource.html">QMimeSource</a>*<a name="4f0aa4"></a>QClipboard::data()const</h3>
<p>Returns a reference to a <a href="qmimesource.html">QMimeSource</a> representation of the current
clipboard data.
<h3 class="fn">void<a name="03f543"></a>QClipboard::dataChanged() <code>[signal]</code></h3>
<p>This signal is emitted when the clipboard data is changed.
<h3 class="fn">bool<a name="77c9d0"></a>QClipboard::event(<a href="qevent.html">QEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qobject.html#c67adb">QObject.</a>
<h3 class="fn"><a href="qimage.html">QImage</a><a name="807a8f"></a>QClipboard::image()const</h3>
<p>Returns the clipboard image, or a null image if the clipboard does
not contain an image, or if it contains an image in an unsupported
image format.
<p>See also  <a href="#4f7997">setImage</a>(), <a href="#905cbc">pixmap</a>(), <a href="#4f0aa4">data</a>() and <a href="qimage.html#2f0bdd">QImage::isNull</a>().
<h3 class="fn"><a href="qpixmap.html">QPixmap</a><a name="905cbc"></a>QClipboard::pixmap()const</h3>
<p>Returns the clipboard pixmap, or null if the clipboard does not
contain any pixmap. Note that this can lose information - for
example, if the image is 24-bit and the display 8-bit the result is
converted to 8 bits, and if the image has an alpha channel the
result just has a mask.
<p>See also  <a href="#6c3b77">setPixmap</a>(), <a href="#807a8f">image</a>(), <a href="#4f0aa4">data</a>() and <a href="qpixmap.html#00951a">QPixmap::convertFromImage</a>().
<h3 class="fn">void<a name="727d20"></a>QClipboard::setData(<a href="qmimesource.html">QMimeSource</a>*src)</h3>
<p>Sets the clipboard data.  Ownership of the data is transferred to
the clipboard - the only ways to remove this data is to set
something else, or to call <a href="#33d563">clear</a>().  The <a href="qdragobject.html">QDragObject</a> subclasses are
reasonable things to put on the clipboard (but do not try to call
<a href="qdragobject.html#61c2fe">QDragObject::drag</a>() on the same object).  Any QDragObject placed in
the clipboard should have a parent of 0.  Do not put <a href="qdragmoveevent.html">QDragMoveEvent</a>
or <a href="qdropevent.html">QDropEvent</a> subclasses on the clipboard, as they do not belong to
the event handler which receives them.
<p>The <a href="#fded53">setText</a>() and <a href="#6c3b77">setPixmap</a>() functions are simpler wrappers for this.
<h3 class="fn">void<a name="4f7997"></a>QClipboard::setImage(const<a href="qimage.html">QImage</a>&amp;image)</h3>
<p>Copies <em>image</em> into the clipboard.
<p>This is shorthand for:
<pre>    setData(new QImageDrag(image))
</pre>
<p>See also  <a href="#807a8f">image</a>(), <a href="#6c3b77">setPixmap</a>() and <a href="#727d20">setData</a>().
<h3 class="fn">void<a name="6c3b77"></a>QClipboard::setPixmap(const<a href="qpixmap.html">QPixmap</a>&amp;pixmap)</h3>
<p>Copies <em>pixmap</em> into the clipboard.  Note that this is slower than
<a href="#4f7997">setImage</a>() - it needs to convert the <a href="qpixmap.html">QPixmap</a> to a <a href="qimage.html">QImage</a> first.
<p>See also  <a href="#905cbc">pixmap</a>(), <a href="#4f7997">setImage</a>() and <a href="#727d20">setData</a>().
<h3 class="fn">void<a name="fded53"></a>QClipboard::setText(const<a href="qstring.html">QString</a>&amp;text)</h3>
<p>Copies <em>text</em> into the clipboard.
<p>See also  <a href="#6bfcea">text</a>() and <a href="#727d20">setData</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="6bfcea"></a>QClipboard::text()const</h3>
<p>Returns the clipboard as plain text, or a null string
if the clipboard does not contain any text.
<p>See also  <a href="#fded53">setText</a>(), <a href="#4f0aa4">data</a>() and QString::operator!().
<h3 class="fn"><a href="qstring.html">QString</a><a name="855ef1"></a>QClipboard::text(<a href="qcstring.html">QCString</a>&amp;subtype)const</h3>
<p>Returns the clipboard text in subtype <em>subtype,</em>
or a null string if the clipboard does not contain any text.
If <em>subtype</em> is null, any subtype is acceptable, and <em>subtype</em>
is set to the chosen subtype.
<p>Common values for <em>subtype</em> are "plain" and "html".
<p>See also  <a href="#fded53">setText</a>(), <a href="#4f0aa4">data</a>() and QString::operator!().
<h3 class="fn">void<a name="f2b301"></a>QClipboard::connectNotify(constchar*) <code>[virtualprotected]</code></h3>
<p>For internal use only.
<p>Reimplemented from <a href="qobject.html#ceafe5">QObject.</a>
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright &copy; 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright  2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>