Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 1241

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qclipboard.cpp -->
  <title>QClipboard Class | Qt GUI 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QClipboard</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<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="#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-macos-users">Notes for macOS Users</a></li>
<li class="level2"><a href="#notes-for-windows-and-macos-users">Notes for Windows and macOS Users</a></li>
<li class="level2"><a href="#notes-for-universal-windows-platform-users">Notes for Universal Windows Platform Users</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QClipboard Class</h1>
<!-- $$$QClipboard-brief -->
<p>The <a href="qclipboard.html">QClipboard</a> class provides access to the window system clipboard. <a href="#details">More...</a></p>
<!-- @@@QClipboard -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QClipboard&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qobject.html">QObject</a></td></tr></table></div><ul>
<li><a href="qclipboard-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><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></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><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 &amp;<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 &amp;<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 &amp;<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-1">text</a></b>(QString &amp;<i>subtype</i>, Mode <i>mode</i> = Clipboard) const</td></tr>
</table></div>
<ul>
<li class="fn">32 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><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></div>
<ul>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QClipboard-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qclipboard.html">QClipboard</a> 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><a href="qclipboard.html">QClipboard</a> 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 <a href="qclipboard.html">QClipboard</a> object in an application, accessible as <a href="qguiapplication.html#clipboard">QGuiApplication::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="qguiapplication.html">QGuiApplication</a></span><span class="operator">::</span>clipboard();
  <span class="type"><a href="../qtcore/qstring.html">QString</a></span> originalText <span class="operator">=</span> clipboard<span class="operator">-</span><span class="operator">&gt;</span>text();
  <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
  clipboard<span class="operator">-</span><span class="operator">&gt;</span>setText(newText);

</pre>
<p><a href="qclipboard.html">QClipboard</a> 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="../qtcore/qmimedata.html">QMimeData</a> into the clipboard. There are corresponding getters for each of these, e.g&#x2e; <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="../qtwidgets/qapplication.html">QApplication</a></span><span class="operator">::</span>clipboard();
      <span class="keyword">const</span> <span class="type"><a href="../qtcore/qmimedata.html">QMimeData</a></span> <span class="operator">*</span>mimeData <span class="operator">=</span> clipboard<span class="operator">-</span><span class="operator">&gt;</span>mimeData();

      <span class="keyword">if</span> (mimeData<span class="operator">-</span><span class="operator">&gt;</span>hasImage()) {
          setPixmap(qvariant_cast<span class="operator">&lt;</span><span class="type"><a href="qpixmap.html">QPixmap</a></span><span class="operator">&gt;</span>(mimeData<span class="operator">-</span><span class="operator">&gt;</span>imageData()));
      } <span class="keyword">else</span> <span class="keyword">if</span> (mimeData<span class="operator">-</span><span class="operator">&gt;</span>hasHtml()) {
          setText(mimeData<span class="operator">-</span><span class="operator">&gt;</span>html());
          setTextFormat(<span class="type">Qt</span><span class="operator">::</span>RichText);
      } <span class="keyword">else</span> <span class="keyword">if</span> (mimeData<span class="operator">-</span><span class="operator">&gt;</span>hasText()) {
          setText(mimeData<span class="operator">-</span><span class="operator">&gt;</span>text());
          setTextFormat(<span class="type">Qt</span><span class="operator">::</span>PlainText);
      } <span class="keyword">else</span> {
          setText(tr(<span class="string">&quot;Cannot display data&quot;</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&#x2e; it will not notify all applications that the selection or clipboard data changed.</li>
<li>Lastly, the X11 clipboard is event driven, i.e&#x2e; 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&#x2e; 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 <code>x-special/gnome-copied-files</code> 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-macos-users"></a>
<h3 >Notes for macOS Users</h3>
<p>macOS 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-macos-users"></a>
<h3 >Notes for Windows and macOS Users</h3>
<ul>
<li>Windows and macOS do not support the global mouse selection; they only supports the global clipboard, i.e&#x2e; they only add text to the clipboard when an explicit copy or cut is made.</li>
<li>Windows and macOS does not have the concept of ownership; the clipboard is a fully global resource so all applications are notified of changes.</li>
</ul>
<a name="notes-for-universal-windows-platform-users"></a>
<h3 >Notes for Universal Windows Platform Users</h3>
<ul>
<li>The Universal Windows Platform only allows to query the clipboard in case the application is active and an application window has focus. Accessing the clipboard data when in background will fail due to access denial.</li>
</ul>
</div>
<p><b>See also </b><a href="qguiapplication.html">QGuiApplication</a>.</p>
<!-- @@@QClipboard -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Mode$$$Clipboard$$$Selection$$$FindBuffer$$$LastMode -->
<h3 class="fn" id="Mode-enum"><a name="Mode-enum"></a>enum QClipboard::<span class="name">Mode</span></h3>
<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>
<div class="table"><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"><code>QClipboard::Clipboard</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">indicates that data should be stored and retrieved from the global clipboard.</td></tr>
<tr><td class="topAlign"><code>QClipboard::Selection</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">indicates that data should be stored and retrieved from the global mouse selection. Support for <code>Selection</code> is provided only on systems with a global mouse selection (e.g&#x2e; X11).</td></tr>
<tr><td class="topAlign"><code>QClipboard::FindBuffer</code></td><td class="topAlign tblval"><code>2</code></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 macOS.</td></tr>
</table></div>
<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" id="changed"><a name="changed"></a><code>[signal] </code><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>)</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" id="clear"><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" id="dataChanged"><a name="dataChanged"></a><code>[signal] </code><span class="type">void</span> QClipboard::<span class="name">dataChanged</span>()</h3>
<p>This signal is emitted when the clipboard data is changed.</p>
<p>On macOS 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 -->
<!-- $$$findBufferChanged[overload1]$$$findBufferChanged -->
<h3 class="fn" id="findBufferChanged"><a name="findBufferChanged"></a><code>[signal] </code><span class="type">void</span> QClipboard::<span class="name">findBufferChanged</span>()</h3>
<p>This signal is emitted when the find buffer is changed. This only applies to macOS.</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" id="image"><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" id="mimeData"><a name="mimeData"></a>const <span class="type"><a href="../qtcore/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 pointer to a <a href="../qtcore/qmimedata.html">QMimeData</a> representation of the current clipboard data (can be NULL if the given <i>mode</i> is not supported by the platform).</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>Note: </b>The pointer returned might become invalidated when the contents of the clipboard changes; either by calling one of the setter functions or externally by the system clipboard changing.</p><p><b>See also </b><a href="qclipboard.html#setMimeData">setMimeData</a>().</p>
<!-- @@@mimeData -->
<!-- $$$ownsClipboard[overload1]$$$ownsClipboard -->
<h3 class="fn" id="ownsClipboard"><a name="ownsClipboard"></a><span class="type">bool</span> QClipboard::<span class="name">ownsClipboard</span>() const</h3>
<p>Returns <code>true</code> if this clipboard object owns the clipboard data; otherwise returns <code>false</code>.</p>
<!-- @@@ownsClipboard -->
<!-- $$$ownsFindBuffer[overload1]$$$ownsFindBuffer -->
<h3 class="fn" id="ownsFindBuffer"><a name="ownsFindBuffer"></a><span class="type">bool</span> QClipboard::<span class="name">ownsFindBuffer</span>() const</h3>
<p>Returns <code>true</code> if this clipboard object owns the find buffer data; otherwise returns <code>false</code>.</p>
<p>This function was introduced in  Qt 4.2.</p>
<!-- @@@ownsFindBuffer -->
<!-- $$$ownsSelection[overload1]$$$ownsSelection -->
<h3 class="fn" id="ownsSelection"><a name="ownsSelection"></a><span class="type">bool</span> QClipboard::<span class="name">ownsSelection</span>() const</h3>
<p>Returns <code>true</code> if this clipboard object owns the mouse selection data; otherwise returns <code>false</code>.</p>
<!-- @@@ownsSelection -->
<!-- $$$pixmap[overload1]$$$pixmapMode -->
<h3 class="fn" id="pixmap"><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" id="selectionChanged"><a name="selectionChanged"></a><code>[signal] </code><span class="type">void</span> QClipboard::<span class="name">selectionChanged</span>()</h3>
<p>This signal is emitted when the selection is changed. This only applies to windowing systems that support selections, e.g&#x2e; X11. Windows and macOS 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" id="setImage"><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> &amp;<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="../qtcore/qmimedata.html">QMimeData</a></span> <span class="operator">*</span>data <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="../qtcore/qmimedata.html">QMimeData</a></span>;
  data<span class="operator">-</span><span class="operator">&gt;</span>setImageData(image);
  clipboard<span class="operator">-</span><span class="operator">&gt;</span>setMimeData(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" id="setMimeData"><a name="setMimeData"></a><span class="type">void</span> QClipboard::<span class="name">setMimeData</span>(<span class="type"><a href="../qtcore/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" id="setPixmap"><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> &amp;<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" id="setText"><a name="setText"></a><span class="type">void</span> QClipboard::<span class="name">setText</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<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" id="supportsFindBuffer"><a name="supportsFindBuffer"></a><span class="type">bool</span> QClipboard::<span class="name">supportsFindBuffer</span>() const</h3>
<p>Returns <code>true</code> if the clipboard supports a separate search buffer; otherwise returns <code>false</code>.</p>
<!-- @@@supportsFindBuffer -->
<!-- $$$supportsSelection[overload1]$$$supportsSelection -->
<h3 class="fn" id="supportsSelection"><a name="supportsSelection"></a><span class="type">bool</span> QClipboard::<span class="name">supportsSelection</span>() const</h3>
<p>Returns <code>true</code> if the clipboard supports mouse selection; otherwise returns <code>false</code>.</p>
<!-- @@@supportsSelection -->
<!-- $$$text[overload1]$$$textMode -->
<h3 class="fn" id="text"><a name="text"></a><span class="type"><a href="../qtcore/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" id="text-1"><a name="text-1"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QClipboard::<span class="name">text</span>(<span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<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 &quot;plain&quot; and &quot;html&quot;.</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 <code>dataChanged()</code> 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>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    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.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>