| 12
 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 <<a href="qclipboard-h.html">qclipboard.h</a>></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="#9088ae"><b>clear</b></a>()</div>
<li><div class="fn">QMimeSource*<a href="#c99eef"><b>data</b></a>()const</div>
<li><div class="fn">void<a href="#77a717"><b>setData</b></a>(QMimeSource*)</div>
<li><div class="fn">QString<a href="#c55d73"><b>text</b></a>()const</div>
<li><div class="fn">QString<a href="#7380b3"><b>text</b></a>(QCString&subtype)const</div>
<li><div class="fn">void<a href="#f6fc41"><b>setText</b></a>(constQString&)</div>
<li><div class="fn">QImage<a href="#5d6810"><b>image</b></a>()const</div>
<li><div class="fn">QPixmap<a href="#54ee2d"><b>pixmap</b></a>()const</div>
<li><div class="fn">void<a href="#ede7fd"><b>setImage</b></a>(constQImage&)</div>
<li><div class="fn">void<a href="#5e49c3"><b>setPixmap</b></a>(constQPixmap&)</div>
</ul>
<h2>Signals</h2>
<ul>
<li><div class="fn">void<a href="#5ad39c"><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#12a5ae">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-><a href="#7380b3">text</a>();
    if ( text )
        <a href="qapplication.html#3db6b2">qDebug</a>( "The clipboard contains: %s", text );
    // Copy text into the clipboard
    cb-><a href="#f6fc41">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="#f6fc41">setText</a>() allows exchanging unicode text easily
over the clipboard, while <a href="#5e49c3">setPixmap</a>() <a href="#ede7fd">setImage</a>() allows to exchange
<a href="qpixmap.html">QPixmap</a> and <a href="qimage.html">QImage</a> between applications.  <a href="#77a717">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="#7380b3">text</a>().)
<p>You can clear the clipboard by calling the method <a href="#9088ae">clear</a>().
<hr><h2>Member Function Documentation</h2>
<h3 class="fn">void<a name="9088ae"></a>QClipboard::clear()</h3>
<p>Clears the clipboard contents.
<h3 class="fn"><a href="qmimesource.html">QMimeSource</a>*<a name="c99eef"></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="5ad39c"></a>QClipboard::dataChanged() <code>[signal]</code></h3>
<p>This signal is emitted when the clipboard data is changed.
<h3 class="fn">bool<a name="54df16"></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#c8b023">QObject.</a>
<h3 class="fn"><a href="qimage.html">QImage</a><a name="5d6810"></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="#ede7fd">setImage</a>(), <a href="#54ee2d">pixmap</a>(), <a href="#c99eef">data</a>() and <a href="qimage.html#762534">QImage::isNull</a>().
<h3 class="fn"><a href="qpixmap.html">QPixmap</a><a name="54ee2d"></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="#5e49c3">setPixmap</a>(), <a href="#5d6810">image</a>(), <a href="#c99eef">data</a>() and <a href="qpixmap.html#f34554">QPixmap::convertFromImage</a>().
<h3 class="fn">void<a name="77a717"></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="#9088ae">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#5655f5">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="#f6fc41">setText</a>() and <a href="#5e49c3">setPixmap</a>() functions are simpler wrappers for this.
<h3 class="fn">void<a name="ede7fd"></a>QClipboard::setImage(const<a href="qimage.html">QImage</a>&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="#5d6810">image</a>(), <a href="#5e49c3">setPixmap</a>() and <a href="#77a717">setData</a>().
<h3 class="fn">void<a name="5e49c3"></a>QClipboard::setPixmap(const<a href="qpixmap.html">QPixmap</a>&pixmap)</h3>
<p>Copies <em>pixmap</em> into the clipboard.  Note that this is slower than
<a href="#ede7fd">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="#54ee2d">pixmap</a>(), <a href="#ede7fd">setImage</a>() and <a href="#77a717">setData</a>().
<h3 class="fn">void<a name="f6fc41"></a>QClipboard::setText(const<a href="qstring.html">QString</a>&text)</h3>
<p>Copies <em>text</em> into the clipboard.
<p>See also  <a href="#7380b3">text</a>() and <a href="#77a717">setData</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="c55d73"></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="#f6fc41">setText</a>(), <a href="#c99eef">data</a>() and QString::operator!().
<h3 class="fn"><a href="qstring.html">QString</a><a name="7380b3"></a>QClipboard::text(<a href="qcstring.html">QCString</a>&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="#f6fc41">setText</a>(), <a href="#c99eef">data</a>() and QString::operator!().
<h3 class="fn">void<a name="8fafb1"></a>QClipboard::connectNotify(constchar*) <code>[virtualprotected]</code></h3>
<p>For internal use only.
<p>Reimplemented from <a href="qobject.html#5ff2b9">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.1"><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 © 1995-2000
<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  2000 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.1</div>
</table></div></address></body></html>
 |