Qt logo

QClipboard Class Reference


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

#include <qclipboard.h>

Inherits QObject.

List of all member functions.

Public Members

Signals

Protected Members


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 these formats (a format is identified by a string):

The "PIXMAP" format is not implemented in this version of Qt.

Only a single QClipboard object may exist in an application. This is because QClipboard is a shared window system resource. It is not possible to create a QClipboard object the standard C++ way (the constructor and destructor are private member functions, but accessible to QApplication since it is a friend class). Call QApplication::clipboard() to access the clipboard.

Example:

    QClipboard *cb = QApplication::clipboard();
    const char *text;

    // Copy text from the clipboard (paste)
    text = cb->text();
    if ( text )
        debug( "The clipboard contains: %s", text );

    // Copy text into the clipboard
    cb->setText( "This text can be pasted by other programs" );

Member Function Documentation

void QClipboard::clear ()

Clears the clipboard contents.

void QClipboard::connectNotify ( const char * ) [virtual protected]

For internal use only.

Reimplemented from QObject.

void * QClipboard::data ( const char * format ) const

Returns a pointer to the clipboard data, where format is the clipboard format.

We recommend that you use text() or pixmap() instead.

void QClipboard::dataChanged () [signal]

This signal is emitted when the clipboard data is changed.

bool QClipboard::event ( QEvent * e ) [virtual protected]

Handles clipboard events (very platform-specific).

Reimplemented from QObject.

QPixmap * QClipboard::pixmap () const

Returns the clipboard pixmap, or null if the clipboard does not contains any pixmap.

See also: setText().

void QClipboard::setData ( const char * format, void * data )

Copies text into the clipboard, where format is the clipboard format string and data is the data to be copied.

We recommend that you use setText() or setPixmap() instead.

void QClipboard::setPixmap ( const QPixmap & pixmap )

Copies pixmap into the clipboard.

See also: pixmap().

void QClipboard::setText ( const char * text )

Copies text into the clipboard.

See also: text().

const char * QClipboard::text () const

Returns the clipboard text, or null if the clipboard does not contains any text.

See also: setText().


Search the documentation, FAQ, qt-interest archive and more (uses www.troll.no):


This file is part of the Qt toolkit, copyright © 1995-98 Troll Tech, all rights reserved.

It was generated from the following files:


Copyright İ 1998 Troll TechTrademarks
Qt version 1.42