[190] | 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"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { 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 Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main 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 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 <<a href="qclipboard-h.html">qclipboard.h</a>></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 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 enable ) <em>(obsolete)</em></li>
|
---|
| 48 | <li class=fn>bool selectionModeEnabled () const <em>(obsolete)</em></li>
|
---|
| 49 | <li class=fn>QString <a href="#text"><b>text</b></a> ( Mode mode ) const</li>
|
---|
| 50 | <li class=fn>QString <a href="#text-2"><b>text</b></a> ( QCString & subtype, Mode mode ) const</li>
|
---|
| 51 | <li class=fn>void <a href="#setText"><b>setText</b></a> ( const QString & text, Mode mode )</li>
|
---|
| 52 | <li class=fn>QMimeSource * <a href="#data"><b>data</b></a> ( Mode mode ) const</li>
|
---|
| 53 | <li class=fn>void <a href="#setData"><b>setData</b></a> ( QMimeSource * src, Mode mode )</li>
|
---|
| 54 | <li class=fn>QImage <a href="#image"><b>image</b></a> ( Mode mode ) const</li>
|
---|
| 55 | <li class=fn>QPixmap <a href="#pixmap"><b>pixmap</b></a> ( Mode mode ) const</li>
|
---|
| 56 | <li class=fn>void <a href="#setImage"><b>setImage</b></a> ( const QImage & image, Mode mode )</li>
|
---|
| 57 | <li class=fn>void <a href="#setPixmap"><b>setPixmap</b></a> ( const QPixmap & pixmap, Mode 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 & subtype ) const</li>
|
---|
| 60 | <li class=fn>void <a href="#setText-2"><b>setText</b></a> ( const QString & 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 * 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 QImage & image )</li>
|
---|
| 66 | <li class=fn>void <a href="#setPixmap-2"><b>setPixmap</b></a> ( const QPixmap & 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 |
|
---|
| 76 | The 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
|
---|
| 81 | between applications.
|
---|
| 82 | <p> QClipboard supports the same data types that <a href="qdragobject.html">QDragObject</a> does, and
|
---|
| 83 | uses similar mechanisms. For advanced clipboard usage
|
---|
| 84 | read <a href="dnd.html">the drag-and-drop documentation</a>.
|
---|
| 85 | <p> There is a single QClipboard object in an application, and you can
|
---|
| 86 | access 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-><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-><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
|
---|
| 102 | types: <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
|
---|
| 104 | and QImages between applications. The <a href="#setData">setData</a>() function is the
|
---|
| 105 | ultimate in flexibility: it allows you to add any <a href="qmimesource.html">QMimeSource</a> into the
|
---|
| 106 | clipboard. 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
|
---|
| 115 | and clipboard. When text is selected, it is immediately available
|
---|
| 116 | as the global mouse selection. The global mouse selection may
|
---|
| 117 | later be copied to the clipboard. By convention, the middle mouse
|
---|
| 118 | button is used to paste the global mouse selection.
|
---|
| 119 | <p> <li> X11 also has the concept of ownership; if you change the
|
---|
| 120 | selection within a window, X11 will only notify the owner and the
|
---|
| 121 | previous owner of the change, i.e. it will not notify all
|
---|
| 122 | applications that the selection or clipboard data changed.
|
---|
| 123 | <p> <li> Lastly, the X11 clipboard is event driven, i.e. the clipboard
|
---|
| 124 | will not function properly if the event loop is not running.
|
---|
| 125 | Similarly, it is recommended that the contents of the clipboard
|
---|
| 126 | are stored or retrieved in direct response to user-input events,
|
---|
| 127 | e.g. mouse button or key presses and releases. You should not
|
---|
| 128 | store or retrieve the clipboard contents in response to timer or
|
---|
| 129 | non-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;
|
---|
| 135 | it only supports the global clipboard, e.g. Windows only adds text
|
---|
| 136 | to the clipboard when an explicit copy or cut is made.
|
---|
| 137 | <p> <li> Windows does not have the concept of ownership; the clipboard
|
---|
| 138 | is a fully global resource so all applications are notified of
|
---|
| 139 | changes.
|
---|
| 140 | <p> </ul>
|
---|
| 141 | <p> See the multiclip example in the <em>Qt Designer</em> examples
|
---|
| 142 | directory for an example of a multiplatform clipboard application
|
---|
| 143 | that 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
|
---|
| 150 | used 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
|
---|
| 153 | the global clipboard.
|
---|
| 154 | <li><tt>QClipboard::Selection</tt> - indicates that data should be stored and retrieved from
|
---|
| 155 | the global mouse selection.
|
---|
| 156 | </ul><p> <em>Note</em>: Support for <a href="#Mode-enum">Selection</a> is provided only on systems with a
|
---|
| 157 | global 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> mode )
|
---|
| 162 | </h3>
|
---|
| 163 | Clear the clipboard contents.
|
---|
| 164 | <p> The <em>mode</em> argument is used to control which part of the system
|
---|
| 165 | clipboard is used. If <em>mode</em> is QClipboard::Clipboard, this
|
---|
| 166 | function clears the the global clipboard contents. If <em>mode</em> is
|
---|
| 167 | QClipboard::Selection, this function clears the global mouse
|
---|
| 168 | selection 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>
|
---|
| 173 | This 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
|
---|
| 175 | a QClipboard::Mode argument. The value of the mode argument is
|
---|
| 176 | determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
|
---|
| 177 | If selectionModeEnabled() returns TRUE, the mode argument is
|
---|
| 178 | QClipboard::Selection, otherwise the mode argument is QClipboard::Clipboard.
|
---|
| 179 |
|
---|
| 180 | <h3 class=fn><a href="qmimesource.html">QMimeSource</a> * <a name="data"></a>QClipboard::data ( <a href="qclipboard.html#Mode-enum">Mode</a> mode ) const
|
---|
| 181 | </h3>
|
---|
| 182 | Returns a reference to a <a href="qmimesource.html">QMimeSource</a> representation of the current
|
---|
| 183 | clipboard data.
|
---|
| 184 | <p> The <em>mode</em> argument is used to control which part of the system
|
---|
| 185 | clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
|
---|
| 186 | data is retrieved from the global clipboard. If <em>mode</em> is
|
---|
| 187 | QClipboard::Selection, the data is retrieved from the global
|
---|
| 188 | mouse selection.
|
---|
| 189 | <p> <p>See also <a href="#setData">setData</a>().
|
---|
| 190 |
|
---|
| 191 | <h3 class=fn><a href="qmimesource.html">QMimeSource</a> * <a name="data-2"></a>QClipboard::data () const
|
---|
| 192 | </h3>
|
---|
| 193 | This 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
|
---|
| 195 | a QClipboard::Mode argument. The value of the mode argument is
|
---|
| 196 | determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
|
---|
| 197 | If selectionModeEnabled() returns TRUE, the mode argument is
|
---|
| 198 | QClipboard::Selection, otherwise the mode argument is
|
---|
| 199 | QClipboard::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> mode ) const
|
---|
| 207 | </h3>
|
---|
| 208 | Returns the clipboard image, or returns a null image if the
|
---|
| 209 | clipboard does not contain an image or if it contains an image in
|
---|
| 210 | an unsupported image format.
|
---|
| 211 | <p> The <em>mode</em> argument is used to control which part of the system
|
---|
| 212 | clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
|
---|
| 213 | image is retrieved from the global clipboard. If <em>mode</em> is
|
---|
| 214 | QClipboard::Selection, the image is retrieved from the global
|
---|
| 215 | mouse 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>
|
---|
| 220 | This 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
|
---|
| 222 | a QClipboard::Mode argument. The value of the mode argument is
|
---|
| 223 | determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
|
---|
| 224 | If selectionModeEnabled() returns TRUE, the mode argument is
|
---|
| 225 | QClipboard::Selection, otherwise the mode argument is
|
---|
| 226 | QClipboard::Clipboard.
|
---|
| 227 |
|
---|
| 228 | <h3 class=fn>bool <a name="ownsClipboard"></a>QClipboard::ownsClipboard () const
|
---|
| 229 | </h3>
|
---|
| 230 | Returns TRUE if this clipboard object owns the clipboard data;
|
---|
| 231 | otherwise returns FALSE.
|
---|
| 232 |
|
---|
| 233 | <h3 class=fn>bool <a name="ownsSelection"></a>QClipboard::ownsSelection () const
|
---|
| 234 | </h3>
|
---|
| 235 | Returns TRUE if this clipboard object owns the mouse selection
|
---|
| 236 | data; 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> mode ) const
|
---|
| 239 | </h3>
|
---|
| 240 | Returns the clipboard pixmap, or null if the clipboard does not
|
---|
| 241 | contain a pixmap. Note that this can lose information. For
|
---|
| 242 | example, if the image is 24-bit and the display is 8-bit, the
|
---|
| 243 | result is converted to 8 bits, and if the image has an alpha
|
---|
| 244 | channel, the result just has a mask.
|
---|
| 245 | <p> The <em>mode</em> argument is used to control which part of the system
|
---|
| 246 | clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
|
---|
| 247 | pixmap is retrieved from the global clipboard. If <em>mode</em> is
|
---|
| 248 | QClipboard::Selection, the pixmap is retrieved from the global
|
---|
| 249 | mouse 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>
|
---|
| 254 | This 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
|
---|
| 256 | a QClipboard::Mode argument. The value of the mode argument is
|
---|
| 257 | determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
|
---|
| 258 | If selectionModeEnabled() returns TRUE, the mode argument is
|
---|
| 259 | QClipboard::Selection, otherwise the mode argument is
|
---|
| 260 | QClipboard::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
|
---|
| 266 | applies to windowing systems that support selections, e.g. X11.
|
---|
| 267 | Windows 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
|
---|
| 272 | which 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> * src, <a href="qclipboard.html#Mode-enum">Mode</a> mode )
|
---|
| 277 | </h3>
|
---|
| 278 | Sets the clipboard data to <em>src</em>. Ownership of the data is
|
---|
| 279 | transferred to the clipboard. If you want to remove the data
|
---|
| 280 | either 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
|
---|
| 282 | clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
|
---|
| 283 | data is retrieved from the global clipboard. If <em>mode</em> is
|
---|
| 284 | QClipboard::Selection, the data is retrieved from the global
|
---|
| 285 | mouse selection.
|
---|
| 286 | <p> The <a href="qdragobject.html">QDragObject</a> subclasses are reasonable objects to put into the
|
---|
| 287 | clipboard (but do not try to call <a href="qdragobject.html#drag">QDragObject::drag</a>() on the same
|
---|
| 288 | object). Any QDragObject placed in the clipboard should have a
|
---|
| 289 | parent of 0. Do not put <a href="qdragmoveevent.html">QDragMoveEvent</a> or <a href="qdropevent.html">QDropEvent</a> subclasses in
|
---|
| 290 | the clipboard, as they do not belong to the event handler which
|
---|
| 291 | receives them.
|
---|
| 292 | <p> The <a href="#setText">setText</a>(), <a href="#setImage">setImage</a>() and <a href="#setPixmap">setPixmap</a>() functions are simpler
|
---|
| 293 | wrappers 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> * src )
|
---|
| 297 | </h3>
|
---|
| 298 | This 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
|
---|
| 300 | a QClipboard::Mode argument. The value of the mode argument is
|
---|
| 301 | determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
|
---|
| 302 | If selectionModeEnabled() returns TRUE, the mode argument is
|
---|
| 303 | QClipboard::Selection, otherwise the mode argument is
|
---|
| 304 | QClipboard::Clipboard.
|
---|
| 305 |
|
---|
| 306 | <h3 class=fn>void <a name="setImage"></a>QClipboard::setImage ( const <a href="qimage.html">QImage</a> & image, <a href="qclipboard.html#Mode-enum">Mode</a> mode )
|
---|
| 307 | </h3>
|
---|
| 308 | Copies <em>image</em> into the clipboard.
|
---|
| 309 | <p> The <em>mode</em> argument is used to control which part of the system
|
---|
| 310 | clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
|
---|
| 311 | image is stored in the global clipboard. If <em>mode</em> is
|
---|
| 312 | QClipboard::Selection, the data is stored in the global
|
---|
| 313 | mouse 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 <a href="qimage.html">QImage</a> & image )
|
---|
| 322 | </h3>
|
---|
| 323 | This 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
|
---|
| 325 | a QClipboard::Mode argument. The value of the mode argument is
|
---|
| 326 | determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
|
---|
| 327 | If selectionModeEnabled() returns TRUE, the mode argument is
|
---|
| 328 | QClipboard::Selection, otherwise the mode argument is
|
---|
| 329 | QClipboard::Clipboard.
|
---|
| 330 |
|
---|
| 331 | <h3 class=fn>void <a name="setPixmap"></a>QClipboard::setPixmap ( const <a href="qpixmap.html">QPixmap</a> & pixmap, <a href="qclipboard.html#Mode-enum">Mode</a> mode )
|
---|
| 332 | </h3>
|
---|
| 333 | Copies <em>pixmap</em> into the clipboard. Note that this is slower
|
---|
| 334 | than <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
|
---|
| 337 | clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
|
---|
| 338 | pixmap is stored in the global clipboard. If <em>mode</em> is
|
---|
| 339 | QClipboard::Selection, the pixmap is stored in the global
|
---|
| 340 | mouse 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 <a href="qpixmap.html">QPixmap</a> & pixmap )
|
---|
| 344 | </h3>
|
---|
| 345 | This 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
|
---|
| 347 | a QClipboard::Mode argument. The value of the mode argument is
|
---|
| 348 | determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
|
---|
| 349 | If selectionModeEnabled() returns TRUE, the mode argument is
|
---|
| 350 | QClipboard::Selection, otherwise the mode argument is
|
---|
| 351 | QClipboard::Clipboard.
|
---|
| 352 |
|
---|
| 353 | <h3 class=fn>void <a name="setSelectionMode"></a>QClipboard::setSelectionMode ( bool 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
|
---|
| 356 | which take a QClipboard::Mode argument.
|
---|
| 357 | <p> Sets the clipboard selection mode. If <em>enable</em> is TRUE, then
|
---|
| 358 | subsequent calls to QClipboard::setData() and other functions
|
---|
| 359 | which put data into the clipboard will put the data into the mouse
|
---|
| 360 | selection, 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 <a href="qstring.html">QString</a> & text, <a href="qclipboard.html#Mode-enum">Mode</a> mode )
|
---|
| 364 | </h3>
|
---|
| 365 | Copies <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
|
---|
| 367 | clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
|
---|
| 368 | text is stored in the global clipboard. If <em>mode</em> is
|
---|
| 369 | QClipboard::Selection, the text is stored in the global
|
---|
| 370 | mouse 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 <a href="qstring.html">QString</a> & text )
|
---|
| 375 | </h3>
|
---|
| 376 | This 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
|
---|
| 378 | a QClipboard::Mode argument. The value of the mode argument is
|
---|
| 379 | determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
|
---|
| 380 | If selectionModeEnabled() returns TRUE, the mode argument is
|
---|
| 381 | QClipboard::Selection, otherwise the mode argument is
|
---|
| 382 | QClipboard::Clipboard.
|
---|
| 383 |
|
---|
| 384 | <h3 class=fn>bool <a name="supportsSelection"></a>QClipboard::supportsSelection () const
|
---|
| 385 | </h3>
|
---|
| 386 | Returns TRUE if the clipboard supports mouse selection; otherwise
|
---|
| 387 | returns 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> mode ) const
|
---|
| 391 | </h3>
|
---|
| 392 | Returns the clipboard text as plain text, or a null string if the
|
---|
| 393 | clipboard does not contain any text.
|
---|
| 394 | <p> The <em>mode</em> argument is used to control which part of the system
|
---|
| 395 | clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
|
---|
| 396 | text is retrieved from the global clipboard. If <em>mode</em> is
|
---|
| 397 | QClipboard::Selection, the text is retrieved from the global
|
---|
| 398 | mouse 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> & subtype, <a href="qclipboard.html#Mode-enum">Mode</a> mode ) const
|
---|
| 402 | </h3>
|
---|
| 403 | This 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
|
---|
| 405 | if the clipboard does not contain any text. If <em>subtype</em> is null,
|
---|
| 406 | any subtype is acceptable, and <em>subtype</em> is set to the chosen
|
---|
| 407 | subtype.
|
---|
| 408 | <p> The <em>mode</em> argument is used to control which part of the system
|
---|
| 409 | clipboard is used. If <em>mode</em> is QClipboard::Clipboard, the
|
---|
| 410 | text is retrieved from the global clipboard. If <em>mode</em> is
|
---|
| 411 | QClipboard::Selection, the text is retrieved from the global
|
---|
| 412 | mouse 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>
|
---|
| 418 | This 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
|
---|
| 420 | a QClipboard::Mode argument. The value of the mode argument is
|
---|
| 421 | determined by the return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>().
|
---|
| 422 | If selectionModeEnabled() returns TRUE, the mode argument is
|
---|
| 423 | QClipboard::Selection, otherwise the mode argument is
|
---|
| 424 | QClipboard::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> & subtype ) const
|
---|
| 427 | </h3>
|
---|
| 428 | This 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
|
---|
| 430 | if the clipboard does not contain any text. This function uses the
|
---|
| 431 | <a href="#text">QClipboard::text</a>() function which takes a QClipboard::Mode
|
---|
| 432 | argument. The value of the mode argument is determined by the
|
---|
| 433 | return value of <a href="#selectionModeEnabled">selectionModeEnabled</a>(). If selectionModeEnabled()
|
---|
| 434 | returns TRUE, the mode argument is QClipboard::Selection,
|
---|
| 435 | otherwise the mode argument is QClipboard::Clipboard.
|
---|
| 436 |
|
---|
| 437 | <!-- eof -->
|
---|
| 438 | <hr><p>
|
---|
| 439 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 440 | Copyright © 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 © 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>
|
---|