Home · Overviews · Examples 

QClipboard Class Reference
[com.trolltech.qt.gui module]

The QClipboard class provides access to the window system clipboard. More...

Inherits QObject.


Detailed Description

The QClipboard class provides access to the window system clipboard.

The clipboard offers a simple mechanism to copy and paste data between applications.

QClipboard supports the same data types that QDrag does, and uses similar mechanisms. For advanced clipboard usage read Drag and Drop.

There is a single QClipboard object in an application, accessible as QApplication::clipboard().

Example:

    QClipboard *clipboard = QApplication::clipboard();
    QString originalText = clipboard->text();
    ...
    clipboard->setText(newText);

QClipboard features some convenience functions to access common data types: setText allows the exchange of Unicode text and setPixmap and setImage allows the exchange of QPixmaps and QImages between applications. The setMimeData function is the ultimate in flexibility: it allows you to add any QMimeData into the clipboard. There are corresponding getters for each of these, e.g. text, image and pixmap. You can clear the clipboard by calling clear.

Notes for X11 Users

Notes for Mac OS X Users

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 FindBuffer mode.

Notes for Windows and Mac OS X Users

See also QApplication.


Copyright © 2007 Trolltech Trademarks
Qt Jambi 4.3.2_01