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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qclipboard.cpp -->
<title>Qt 4.8: QClipboard Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QClipboard</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#notes-for-x11-users">Notes for X11 Users</a></li>
<li class="level2"><a href="#notes-for-mac-os-x-users">Notes for Mac OS X Users</a></li>
<li class="level2"><a href="#notes-for-windows-and-mac-os-x-users">Notes for Windows and Mac OS X Users</a></li>
</ul>
</div>
<h1 class="title">QClipboard Class Reference</h1>
<!-- $$$QClipboard-brief -->
<p>The QClipboard class provides access to the window system clipboard. <a href="#details">More...</a></p>
<!-- @@@QClipboard -->
<pre class="cpp"> <span class="preprocessor">#include <QClipboard></span></pre><p><b>Inherits: </b><a href="qobject.html">QObject</a>.</p>
<ul>
<li><a href="qclipboard-members.html">List of all members, including inherited members</a></li>
<li><a href="qclipboard-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#Mode-enum">Mode</a></b> { Clipboard, Selection, FindBuffer }</td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#clear">clear</a></b> ( Mode <i>mode</i> = Clipboard )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QImage </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#image">image</a></b> ( Mode <i>mode</i> = Clipboard ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QMimeData * </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#mimeData">mimeData</a></b> ( Mode <i>mode</i> = Clipboard ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#ownsClipboard">ownsClipboard</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#ownsFindBuffer">ownsFindBuffer</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#ownsSelection">ownsSelection</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPixmap </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#pixmap">pixmap</a></b> ( Mode <i>mode</i> = Clipboard ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#setImage">setImage</a></b> ( const QImage & <i>image</i>, Mode <i>mode</i> = Clipboard )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#setMimeData">setMimeData</a></b> ( QMimeData * <i>src</i>, Mode <i>mode</i> = Clipboard )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#setPixmap">setPixmap</a></b> ( const QPixmap & <i>pixmap</i>, Mode <i>mode</i> = Clipboard )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#setText">setText</a></b> ( const QString & <i>text</i>, Mode <i>mode</i> = Clipboard )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#supportsFindBuffer">supportsFindBuffer</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#supportsSelection">supportsSelection</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#text">text</a></b> ( Mode <i>mode</i> = Clipboard ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#text-2">text</a></b> ( QString & <i>subtype</i>, Mode <i>mode</i> = Clipboard ) const</td></tr>
</table>
<ul>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#changed">changed</a></b> ( QClipboard::Mode <i>mode</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#dataChanged">dataChanged</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#findBufferChanged">findBufferChanged</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#selectionChanged">selectionChanged</a></b> ()</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qclipboard.html#event">event</a></b> ( QEvent * <i>e</i> )</td></tr>
</table>
<ul>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QClipboard-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QClipboard class provides access to the window system clipboard.</p>
<p>The clipboard offers a simple mechanism to copy and paste data between applications.</p>
<p>QClipboard supports the same data types that <a href="qdrag.html">QDrag</a> does, and uses similar mechanisms. For advanced clipboard usage read <a href="dnd.html">Drag and Drop</a>.</p>
<p>There is a single QClipboard object in an application, accessible as <a href="qapplication.html#clipboard">QApplication::clipboard</a>().</p>
<p>Example:</p>
<pre class="cpp"> <span class="type">QClipboard</span> <span class="operator">*</span>clipboard <span class="operator">=</span> <span class="type"><a href="qapplication.html">QApplication</a></span><span class="operator">::</span>clipboard();
<span class="type"><a href="qstring.html">QString</a></span> originalText <span class="operator">=</span> clipboard<span class="operator">-</span><span class="operator">></span><a href="qclipboard.html#text">text</a>();
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
clipboard<span class="operator">-</span><span class="operator">></span><a href="qclipboard.html#setText">setText</a>(newText);</pre>
<p>QClipboard features some convenience functions to access common data types: <a href="qclipboard.html#setText">setText</a>() allows the exchange of Unicode text and <a href="qclipboard.html#setPixmap">setPixmap</a>() and <a href="qclipboard.html#setImage">setImage</a>() allows the exchange of QPixmaps and QImages between applications. The <a href="qclipboard.html#setMimeData">setMimeData</a>() function is the ultimate in flexibility: it allows you to add any <a href="qmimedata.html">QMimeData</a> into the clipboard. There are corresponding getters for each of these, e.g. <a href="qclipboard.html#text">text</a>(), <a href="qclipboard.html#image">image</a>() and <a href="qclipboard.html#pixmap">pixmap</a>(). You can clear the clipboard by calling <a href="qclipboard.html#clear">clear</a>().</p>
<p>A typical example of the use of these functions follows:</p>
<pre class="cpp"> <span class="type">void</span> DropArea<span class="operator">::</span>paste()
{
<span class="keyword">const</span> <span class="type">QClipboard</span> <span class="operator">*</span>clipboard <span class="operator">=</span> <span class="type"><a href="qapplication.html">QApplication</a></span><span class="operator">::</span>clipboard();
<span class="keyword">const</span> <span class="type"><a href="qmimedata.html">QMimeData</a></span> <span class="operator">*</span>mimeData <span class="operator">=</span> clipboard<span class="operator">-</span><span class="operator">></span>mimeData();
<span class="keyword">if</span> (mimeData<span class="operator">-</span><span class="operator">></span>hasImage()) {
setPixmap(qvariant_cast<span class="operator"><</span><span class="type"><a href="qpixmap.html">QPixmap</a></span><span class="operator">></span>(mimeData<span class="operator">-</span><span class="operator">></span>imageData()));
} <span class="keyword">else</span> <span class="keyword">if</span> (mimeData<span class="operator">-</span><span class="operator">></span>hasHtml()) {
setText(mimeData<span class="operator">-</span><span class="operator">></span>html());
setTextFormat(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>RichText);
} <span class="keyword">else</span> <span class="keyword">if</span> (mimeData<span class="operator">-</span><span class="operator">></span>hasText()) {
setText(mimeData<span class="operator">-</span><span class="operator">></span>text());
setTextFormat(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>PlainText);
} <span class="keyword">else</span> {
setText(tr(<span class="string">"Cannot display data"</span>));
}</pre>
<a name="notes-for-x11-users"></a>
<h3>Notes for X11 Users</h3>
<ul>
<li>The X11 Window System has the concept of a separate selection and clipboard. When text is selected, it is immediately available as the global mouse selection. The global mouse selection may later be copied to the clipboard. By convention, the middle mouse button is used to paste the global mouse selection.</li>
<li>X11 also has the concept of ownership; if you change the selection within a window, X11 will only notify the owner and the previous owner of the change, i.e. it will not notify all applications that the selection or clipboard data changed.</li>
<li>Lastly, the X11 clipboard is event driven, i.e. the clipboard will not function properly if the event loop is not running. Similarly, it is recommended that the contents of the clipboard are stored or retrieved in direct response to user-input events, e.g. mouse button or key presses and releases. You should not store or retrieve the clipboard contents in response to timer or non-user-input events.</li>
<li>Since there is no standard way to copy and paste files between applications on X11, various MIME types and conventions are currently in use. For instance, Nautilus expects files to be supplied with a <tt>x-special/gnome-copied-files</tt> MIME type with data beginning with the cut/copy action, a newline character, and the URL of the file.</li>
</ul>
<a name="notes-for-mac-os-x-users"></a>
<h3>Notes for Mac OS X Users</h3>
<p>Mac OS X supports a separate find buffer that holds the current search string in Find operations. This find clipboard can be accessed by specifying the <a href="qclipboard.html#Mode-enum">FindBuffer</a> mode.</p>
<a name="notes-for-windows-and-mac-os-x-users"></a>
<h3>Notes for Windows and Mac OS X Users</h3>
<ul>
<li>Windows and Mac OS X do not support the global mouse selection; they only supports the global clipboard, i.e. they only add text to the clipboard when an explicit copy or cut is made.</li>
<li>Windows and Mac OS X does not have the concept of ownership; the clipboard is a fully global resource so all applications are notified of changes.</li>
</ul>
</div>
<p><b>See also </b><a href="qapplication.html">QApplication</a>.</p>
<!-- @@@QClipboard -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Mode$$$Clipboard$$$Selection$$$FindBuffer$$$LastMode -->
<h3 class="fn"><a name="Mode-enum"></a>enum QClipboard::<span class="name">Mode</span></h3>
<a name="clipboard-mode"></a><p>This enum type is used to control which part of the system clipboard is used by <a href="qclipboard.html#mimeData">QClipboard::mimeData</a>(), <a href="qclipboard.html#setMimeData">QClipboard::setMimeData</a>() and related functions.</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QClipboard::Clipboard</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">indicates that data should be stored and retrieved from the global clipboard.</td></tr>
<tr><td class="topAlign"><tt>QClipboard::Selection</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">indicates that data should be stored and retrieved from the global mouse selection. Support for <tt>Selection</tt> is provided only on systems with a global mouse selection (e.g. X11).</td></tr>
<tr><td class="topAlign"><tt>QClipboard::FindBuffer</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">indicates that data should be stored and retrieved from the Find buffer. This mode is used for holding search strings on Mac OS X.</td></tr>
</table>
<p><b>See also </b><a href="qclipboard.html#supportsSelection">QClipboard::supportsSelection</a>().</p>
<!-- @@@Mode -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$changed[overload1]$$$changedQClipboard::Mode -->
<h3 class="fn"><a name="changed"></a><span class="type">void</span> QClipboard::<span class="name">changed</span> ( <span class="type"><a href="qclipboard.html#Mode-enum">QClipboard::Mode</a></span> <i>mode</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted when the data for the given clipboard <i>mode</i> is changed.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qclipboard.html#dataChanged">dataChanged</a>(), <a href="qclipboard.html#selectionChanged">selectionChanged</a>(), and <a href="qclipboard.html#findBufferChanged">findBufferChanged</a>().</p>
<!-- @@@changed -->
<!-- $$$clear[overload1]$$$clearMode -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> QClipboard::<span class="name">clear</span> ( <span class="type"><a href="qclipboard.html#Mode-enum">Mode</a></span> <i>mode</i> = Clipboard )</h3>
<p>Clear the clipboard contents.</p>
<p>The <i>mode</i> argument is used to control which part of the system clipboard is used. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Clipboard</a>, this function clears the global clipboard contents. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Selection</a>, this function clears the global mouse selection contents. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::FindBuffer</a>, this function clears the search string buffer.</p>
<p><b>See also </b><a href="qclipboard.html#Mode-enum">QClipboard::Mode</a> and <a href="qclipboard.html#supportsSelection">supportsSelection</a>().</p>
<!-- @@@clear -->
<!-- $$$dataChanged[overload1]$$$dataChanged -->
<h3 class="fn"><a name="dataChanged"></a><span class="type">void</span> QClipboard::<span class="name">dataChanged</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted when the clipboard data is changed.</p>
<p>On Mac OS X and with Qt version 4.3 or higher, clipboard changes made by other applications will only be detected when the application is activated.</p>
<p><b>See also </b><a href="qclipboard.html#findBufferChanged">findBufferChanged</a>(), <a href="qclipboard.html#selectionChanged">selectionChanged</a>(), and <a href="qclipboard.html#changed">changed</a>().</p>
<!-- @@@dataChanged -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn"><a name="event"></a><span class="type">bool</span> QClipboard::<span class="name">event</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p>
<!-- @@@event -->
<!-- $$$findBufferChanged[overload1]$$$findBufferChanged -->
<h3 class="fn"><a name="findBufferChanged"></a><span class="type">void</span> QClipboard::<span class="name">findBufferChanged</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted when the find buffer is changed. This only applies to Mac OS X.</p>
<p>With Qt version 4.3 or higher, clipboard changes made by other applications will only be detected when the application is activated.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qclipboard.html#dataChanged">dataChanged</a>(), <a href="qclipboard.html#selectionChanged">selectionChanged</a>(), and <a href="qclipboard.html#changed">changed</a>().</p>
<!-- @@@findBufferChanged -->
<!-- $$$image[overload1]$$$imageMode -->
<h3 class="fn"><a name="image"></a><span class="type"><a href="qimage.html">QImage</a></span> QClipboard::<span class="name">image</span> ( <span class="type"><a href="qclipboard.html#Mode-enum">Mode</a></span> <i>mode</i> = Clipboard ) const</h3>
<p>Returns the clipboard image, or returns a null image if the clipboard does not contain an image or if it contains an image in an unsupported image format.</p>
<p>The <i>mode</i> argument is used to control which part of the system clipboard is used. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Clipboard</a>, the image is retrieved from the global clipboard. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Selection</a>, the image is retrieved from the global mouse selection.</p>
<p><b>See also </b><a href="qclipboard.html#setImage">setImage</a>(), <a href="qclipboard.html#pixmap">pixmap</a>(), <a href="qclipboard.html#mimeData">mimeData</a>(), and <a href="qimage.html#isNull">QImage::isNull</a>().</p>
<!-- @@@image -->
<!-- $$$mimeData[overload1]$$$mimeDataMode -->
<h3 class="fn"><a name="mimeData"></a>const <span class="type"><a href="qmimedata.html">QMimeData</a></span> * QClipboard::<span class="name">mimeData</span> ( <span class="type"><a href="qclipboard.html#Mode-enum">Mode</a></span> <i>mode</i> = Clipboard ) const</h3>
<p>Returns a reference to a <a href="qmimedata.html">QMimeData</a> representation of the current clipboard data.</p>
<p>The <i>mode</i> argument is used to control which part of the system clipboard is used. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Clipboard</a>, the data is retrieved from the global clipboard. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Selection</a>, the data is retrieved from the global mouse selection. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::FindBuffer</a>, the data is retrieved from the search string buffer.</p>
<p>The <a href="qclipboard.html#text">text</a>(), <a href="qclipboard.html#image">image</a>(), and <a href="qclipboard.html#pixmap">pixmap</a>() functions are simpler wrappers for retrieving text, image, and pixmap data.</p>
<p><b>See also </b><a href="qclipboard.html#setMimeData">setMimeData</a>().</p>
<!-- @@@mimeData -->
<!-- $$$ownsClipboard[overload1]$$$ownsClipboard -->
<h3 class="fn"><a name="ownsClipboard"></a><span class="type">bool</span> QClipboard::<span class="name">ownsClipboard</span> () const</h3>
<p>Returns true if this clipboard object owns the clipboard data; otherwise returns false.</p>
<!-- @@@ownsClipboard -->
<!-- $$$ownsFindBuffer[overload1]$$$ownsFindBuffer -->
<h3 class="fn"><a name="ownsFindBuffer"></a><span class="type">bool</span> QClipboard::<span class="name">ownsFindBuffer</span> () const</h3>
<p>Returns true if this clipboard object owns the find buffer data; otherwise returns false.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@ownsFindBuffer -->
<!-- $$$ownsSelection[overload1]$$$ownsSelection -->
<h3 class="fn"><a name="ownsSelection"></a><span class="type">bool</span> QClipboard::<span class="name">ownsSelection</span> () const</h3>
<p>Returns true if this clipboard object owns the mouse selection data; otherwise returns false.</p>
<!-- @@@ownsSelection -->
<!-- $$$pixmap[overload1]$$$pixmapMode -->
<h3 class="fn"><a name="pixmap"></a><span class="type"><a href="qpixmap.html">QPixmap</a></span> QClipboard::<span class="name">pixmap</span> ( <span class="type"><a href="qclipboard.html#Mode-enum">Mode</a></span> <i>mode</i> = Clipboard ) const</h3>
<p>Returns the clipboard pixmap, or null if the clipboard does not contain a pixmap. Note that this can lose information. For example, if the image is 24-bit and the display is 8-bit, the result is converted to 8 bits, and if the image has an alpha channel, the result just has a mask.</p>
<p>The <i>mode</i> argument is used to control which part of the system clipboard is used. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Clipboard</a>, the pixmap is retrieved from the global clipboard. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Selection</a>, the pixmap is retrieved from the global mouse selection.</p>
<p><b>See also </b><a href="qclipboard.html#setPixmap">setPixmap</a>(), <a href="qclipboard.html#image">image</a>(), <a href="qclipboard.html#mimeData">mimeData</a>(), and <a href="qpixmap.html#convertFromImage">QPixmap::convertFromImage</a>().</p>
<!-- @@@pixmap -->
<!-- $$$selectionChanged[overload1]$$$selectionChanged -->
<h3 class="fn"><a name="selectionChanged"></a><span class="type">void</span> QClipboard::<span class="name">selectionChanged</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted when the selection is changed. This only applies to windowing systems that support selections, e.g. X11. Windows and Mac OS X don't support selections.</p>
<p><b>See also </b><a href="qclipboard.html#dataChanged">dataChanged</a>(), <a href="qclipboard.html#findBufferChanged">findBufferChanged</a>(), and <a href="qclipboard.html#changed">changed</a>().</p>
<!-- @@@selectionChanged -->
<!-- $$$setImage[overload1]$$$setImageconstQImage&Mode -->
<h3 class="fn"><a name="setImage"></a><span class="type">void</span> QClipboard::<span class="name">setImage</span> ( const <span class="type"><a href="qimage.html">QImage</a></span> & <i>image</i>, <span class="type"><a href="qclipboard.html#Mode-enum">Mode</a></span> <i>mode</i> = Clipboard )</h3>
<p>Copies the <i>image</i> into the clipboard.</p>
<p>The <i>mode</i> argument is used to control which part of the system clipboard is used. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Clipboard</a>, the image is stored in the global clipboard. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Selection</a>, the data is stored in the global mouse selection.</p>
<p>This is shorthand for:</p>
<pre class="cpp"> <span class="type"><a href="qmimedata.html">QMimeData</a></span> <span class="operator">*</span>data <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qmimedata.html">QMimeData</a></span>;
data<span class="operator">-</span><span class="operator">></span>setImageData(image);
clipboard<span class="operator">-</span><span class="operator">></span><a href="qclipboard.html#setMimeData">setMimeData</a>(data<span class="operator">,</span> mode);</pre>
<p><b>See also </b><a href="qclipboard.html#image">image</a>(), <a href="qclipboard.html#setPixmap">setPixmap</a>(), and <a href="qclipboard.html#setMimeData">setMimeData</a>().</p>
<!-- @@@setImage -->
<!-- $$$setMimeData[overload1]$$$setMimeDataQMimeData*Mode -->
<h3 class="fn"><a name="setMimeData"></a><span class="type">void</span> QClipboard::<span class="name">setMimeData</span> ( <span class="type"><a href="qmimedata.html">QMimeData</a></span> * <i>src</i>, <span class="type"><a href="qclipboard.html#Mode-enum">Mode</a></span> <i>mode</i> = Clipboard )</h3>
<p>Sets the clipboard data to <i>src</i>. Ownership of the data is transferred to the clipboard. If you want to remove the data either call <a href="qclipboard.html#clear">clear</a>() or call setMimeData() again with new data.</p>
<p>The <i>mode</i> argument is used to control which part of the system clipboard is used. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Clipboard</a>, the data is stored in the global clipboard. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Selection</a>, the data is stored in the global mouse selection. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::FindBuffer</a>, the data is stored in the search string buffer.</p>
<p>The <a href="qclipboard.html#setText">setText</a>(), <a href="qclipboard.html#setImage">setImage</a>() and <a href="qclipboard.html#setPixmap">setPixmap</a>() functions are simpler wrappers for setting text, image and pixmap data respectively.</p>
<p><b>See also </b><a href="qclipboard.html#mimeData">mimeData</a>().</p>
<!-- @@@setMimeData -->
<!-- $$$setPixmap[overload1]$$$setPixmapconstQPixmap&Mode -->
<h3 class="fn"><a name="setPixmap"></a><span class="type">void</span> QClipboard::<span class="name">setPixmap</span> ( const <span class="type"><a href="qpixmap.html">QPixmap</a></span> & <i>pixmap</i>, <span class="type"><a href="qclipboard.html#Mode-enum">Mode</a></span> <i>mode</i> = Clipboard )</h3>
<p>Copies <i>pixmap</i> into the clipboard. Note that this is slower than <a href="qclipboard.html#setImage">setImage</a>() because it needs to convert the <a href="qpixmap.html">QPixmap</a> to a <a href="qimage.html">QImage</a> first.</p>
<p>The <i>mode</i> argument is used to control which part of the system clipboard is used. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Clipboard</a>, the pixmap is stored in the global clipboard. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Selection</a>, the pixmap is stored in the global mouse selection.</p>
<p><b>See also </b><a href="qclipboard.html#pixmap">pixmap</a>(), <a href="qclipboard.html#setImage">setImage</a>(), and <a href="qclipboard.html#setMimeData">setMimeData</a>().</p>
<!-- @@@setPixmap -->
<!-- $$$setText[overload1]$$$setTextconstQString&Mode -->
<h3 class="fn"><a name="setText"></a><span class="type">void</span> QClipboard::<span class="name">setText</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i>, <span class="type"><a href="qclipboard.html#Mode-enum">Mode</a></span> <i>mode</i> = Clipboard )</h3>
<p>Copies <i>text</i> into the clipboard as plain text.</p>
<p>The <i>mode</i> argument is used to control which part of the system clipboard is used. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Clipboard</a>, the text is stored in the global clipboard. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Selection</a>, the text is stored in the global mouse selection. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::FindBuffer</a>, the text is stored in the search string buffer.</p>
<p><b>See also </b><a href="qclipboard.html#text">text</a>() and <a href="qclipboard.html#setMimeData">setMimeData</a>().</p>
<!-- @@@setText -->
<!-- $$$supportsFindBuffer[overload1]$$$supportsFindBuffer -->
<h3 class="fn"><a name="supportsFindBuffer"></a><span class="type">bool</span> QClipboard::<span class="name">supportsFindBuffer</span> () const</h3>
<p>Returns true if the clipboard supports a separate search buffer; otherwise returns false.</p>
<!-- @@@supportsFindBuffer -->
<!-- $$$supportsSelection[overload1]$$$supportsSelection -->
<h3 class="fn"><a name="supportsSelection"></a><span class="type">bool</span> QClipboard::<span class="name">supportsSelection</span> () const</h3>
<p>Returns true if the clipboard supports mouse selection; otherwise returns false.</p>
<!-- @@@supportsSelection -->
<!-- $$$text[overload1]$$$textMode -->
<h3 class="fn"><a name="text"></a><span class="type"><a href="qstring.html">QString</a></span> QClipboard::<span class="name">text</span> ( <span class="type"><a href="qclipboard.html#Mode-enum">Mode</a></span> <i>mode</i> = Clipboard ) const</h3>
<p>Returns the clipboard text as plain text, or an empty string if the clipboard does not contain any text.</p>
<p>The <i>mode</i> argument is used to control which part of the system clipboard is used. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Clipboard</a>, the text is retrieved from the global clipboard. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Selection</a>, the text is retrieved from the global mouse selection. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::FindBuffer</a>, the text is retrieved from the search string buffer.</p>
<p><b>See also </b><a href="qclipboard.html#setText">setText</a>() and <a href="qclipboard.html#mimeData">mimeData</a>().</p>
<!-- @@@text -->
<!-- $$$text$$$textQString&Mode -->
<h3 class="fn"><a name="text-2"></a><span class="type"><a href="qstring.html">QString</a></span> QClipboard::<span class="name">text</span> ( <span class="type"><a href="qstring.html">QString</a></span> & <i>subtype</i>, <span class="type"><a href="qclipboard.html#Mode-enum">Mode</a></span> <i>mode</i> = Clipboard ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns the clipboard text in subtype <i>subtype</i>, or an empty string if the clipboard does not contain any text. If <i>subtype</i> is null, any subtype is acceptable, and <i>subtype</i> is set to the chosen subtype.</p>
<p>The <i>mode</i> argument is used to control which part of the system clipboard is used. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Clipboard</a>, the text is retrieved from the global clipboard. If <i>mode</i> is <a href="qclipboard.html#Mode-enum">QClipboard::Selection</a>, the text is retrieved from the global mouse selection.</p>
<p>Common values for <i>subtype</i> are "plain" and "html".</p>
<p>Note that calling this function repeatedly, for instance from a key event handler, may be slow. In such cases, you should use the <tt>dataChanged()</tt> signal instead.</p>
<p><b>See also </b><a href="qclipboard.html#setText">setText</a>() and <a href="qclipboard.html#mimeData">mimeData</a>().</p>
<!-- @@@text -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|