📄 qclipboard.3qt
字号:
'\" t.TH QClipboard 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQClipboard \- Access to the window system clipboard.SH SYNOPSIS\fC#include <qclipboard.h>\fR.PPInherits QObject..PP.SS "Public Members".in +1c.ti -1c.BI "enum \fBMode\fR { Clipboard, Selection }".br.ti -1c.BI "void \fBclear\fR ( Mode mode )".br.ti -1c.BI "void clear () \fI(obsolete)\fR".br.ti -1c.BI "bool \fBsupportsSelection\fR () const".br.ti -1c.BI "bool \fBownsSelection\fR () const".br.ti -1c.BI "bool \fBownsClipboard\fR () const".br.ti -1c.BI "void setSelectionMode ( bool enable ) \fI(obsolete)\fR".br.ti -1c.BI "bool selectionModeEnabled () const \fI(obsolete)\fR".br.ti -1c.BI "QString \fBtext\fR ( Mode mode ) const".br.ti -1c.BI "QString \fBtext\fR ( QCString & subtype, Mode mode ) const".br.ti -1c.BI "void \fBsetText\fR ( const QString & text, Mode mode )".br.ti -1c.BI "QMimeSource * \fBdata\fR ( Mode mode ) const".br.ti -1c.BI "void \fBsetData\fR ( QMimeSource * src, Mode mode )".br.ti -1c.BI "QImage \fBimage\fR ( Mode mode ) const".br.ti -1c.BI "QPixmap \fBpixmap\fR ( Mode mode ) const".br.ti -1c.BI "void \fBsetImage\fR ( const QImage & image, Mode mode )".br.ti -1c.BI "void \fBsetPixmap\fR ( const QPixmap & pixmap, Mode mode )".br.ti -1c.BI "QString text () const \fI(obsolete)\fR".br.ti -1c.BI "QString text ( QCString & subtype ) const \fI(obsolete)\fR".br.ti -1c.BI "void setText ( const QString & text ) \fI(obsolete)\fR".br.ti -1c.BI "QMimeSource * data () const \fI(obsolete)\fR".br.ti -1c.BI "void setData ( QMimeSource * src ) \fI(obsolete)\fR".br.ti -1c.BI "QImage image () const \fI(obsolete)\fR".br.ti -1c.BI "QPixmap pixmap () const \fI(obsolete)\fR".br.ti -1c.BI "void setImage ( const QImage & image ) \fI(obsolete)\fR".br.ti -1c.BI "void setPixmap ( const QPixmap & pixmap ) \fI(obsolete)\fR".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBselectionChanged\fR ()".br.ti -1c.BI "void \fBdataChanged\fR ()".br.in -1c.SH DESCRIPTIONThe QClipboard class provides access to the window system clipboard..PPThe clipboard offers a simple mechanism to copy and paste data between applications..PPQClipboard supports the same data types that QDragObject does, and uses similar mechanisms. For advanced clipboard usage read the drag-and-drop documentation..PPThere is a single QClipboard object in an application, and you can access it using QApplication::clipboard()..PPExample:.PP.nf.br QClipboard *cb = QApplication::clipboard();.br QString text;.br.br // Copy text from the clipboard (paste).br text = cb->text();.br if ( text ).br qDebug( "The clipboard contains: %s", text );.br.br // Copy text into the clipboard.br cb->setText( "This text can be pasted by other programs" );.br.fi.PPQClipboard 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 setData() function is the ultimate in flexibility: it allows you to add any QMimeSource into the clipboard. There are corresponding getters for each of these, e.g. text(), image() and pixmap()..PPYou can clear the clipboard by calling clear()..PPThe underlying clipboards of the X Window system and MS Windows differ. The X Window system has a concept of selection -- when text is selected, it is immediately available as the global mouse selection; MS Windows only adds text to the clipboard when an explicit copy or cut is made. The X Window system also has a concept of ownership; if you change the selection within a window, X11 will only notify the owner and the previous owner of the change; in MS Windows the clipboard is a fully global resource so all applications are notified of changes. See the multiclip example in the \fIQt Designer\fR examples directory for an example of a multiplatform clipboard application that also demonstrates selection handling..PPSee also Environment Classes and Input/Output and Networking..SS "Member Type Documentation".SH "QClipboard::Mode".PPThis enum type is used to control which part of the system clipboard is used by QClipboard::data(), QClipboard::setData() and related functions..TP\fCQClipboard::Clipboard\fR - indicates that data should be stored and retreived from the global clipboard..TP\fCQClipboard::Selection\fR - indicates that data should be stored and retreived from the global mouse selection..PP\fINote\fR: Support for Selection is provided only on systems with a global mouse selection (e.g. X11)..PPSee also QClipboard::supportsSelection()..SH MEMBER FUNCTION DOCUMENTATION.SH "void QClipboard::clear ( Mode mode )"Clear the clipboard contents..PPThe \fImode\fR argument is used to control which part of the system clipboard is used. If \fImode\fR is QClipboard::Clipboard, this function clears the the global clipboard contents. If \fImode\fR is QClipboard::Selection, this function clears the global mouse selection contents..PPSee also QClipboard::Mode and supportsSelection()..SH "void QClipboard::clear ()"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -