Qt 4.8
Classes | Public Functions | Properties | List of all members
QBBClipboard Class Reference

#include <qbbclipboard.h>

Inheritance diagram for QBBClipboard:
QPlatformClipboard

Classes

class  MimeData
 

Public Functions

virtual QMimeDatamimeData (QClipboard::Mode mode=QClipboard::Clipboard)
 
 QBBClipboard ()
 
virtual void setMimeData (QMimeData *data, QClipboard::Mode mode=QClipboard::Clipboard)
 
virtual ~QBBClipboard ()
 
- Public Functions inherited from QPlatformClipboard
void emitChanged (QClipboard::Mode mode)
 
virtual bool supportsMode (QClipboard::Mode mode) const
 
virtual ~QPlatformClipboard ()
 

Properties

MimeDatam_mimeData
 

Detailed Description

Definition at line 50 of file qbbclipboard.h.

Constructors and Destructors

◆ QBBClipboard()

QBBClipboard::QBBClipboard ( )

Definition at line 178 of file qbbclipboard.cpp.

179  : m_mimeData(new MimeData(this))
180 {
181 }
MimeData * m_mimeData
Definition: qbbclipboard.h:59

◆ ~QBBClipboard()

QBBClipboard::~QBBClipboard ( )
virtual

Definition at line 183 of file qbbclipboard.cpp.

184 {
185  delete m_mimeData;
186 }
MimeData * m_mimeData
Definition: qbbclipboard.h:59

Functions

◆ mimeData()

QMimeData * QBBClipboard::mimeData ( QClipboard::Mode  mode = QClipboard::Clipboard)
virtual

Reimplemented from QPlatformClipboard.

Definition at line 228 of file qbbclipboard.cpp.

229 {
230  if (mode != QClipboard::Clipboard)
231  return 0;
232 
233  if (m_mimeData->userMimeData())
234  return m_mimeData->userMimeData();
235 
236  m_mimeData->clear();
237 
238  return m_mimeData;
239 }
void clear()
Removes all the MIME type and data entries in the object.
Definition: qmimedata.cpp:613
QMimeData * userMimeData()
MimeData * m_mimeData
Definition: qbbclipboard.h:59

◆ setMimeData()

void QBBClipboard::setMimeData ( QMimeData data,
QClipboard::Mode  mode = QClipboard::Clipboard 
)
virtual

Reimplemented from QPlatformClipboard.

Definition at line 188 of file qbbclipboard.cpp.

189 {
190  if (mode != QClipboard::Clipboard)
191  return;
192 
193  if (m_mimeData == data)
194  return;
195 
197  return;
198 
199  empty_clipboard();
200 
201  m_mimeData->clear();
203 
204  if (data == 0)
205  return;
206 
207  const QStringList formats = data->formats();
208 #if defined(QBBCLIPBOARD_DEBUG)
209  qDebug() << Q_FUNC_INFO << "formats=" << formats;
210 #endif
211 
212  Q_FOREACH (const QString &format, formats) {
213  const QByteArray buf = data->data(format);
214 
215  if (buf.isEmpty())
216  continue;
217 
218  int ret = set_clipboard_data(format.toUtf8().data(), buf.size(), buf.data());
219 #if defined(QBBCLIPBOARD_DEBUG)
220  qDebug() << "QBB: set " << format << "to clipboard, size=" << buf.size() << ";ret=" << ret;
221 #endif
222  if (ret)
223  m_mimeData->addFormatToCheck(format);
224  }
225 
226 }
void setUserMimeData(QMimeData *userMimeData)
void clear()
Removes all the MIME type and data entries in the object.
Definition: qmimedata.cpp:613
virtual QStringList formats() const
Returns a list of formats supported by the object.
Definition: qmimedata.cpp:579
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
Definition: qstring.cpp:4074
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QByteArray data(const QString &mimetype) const
Returns the data stored in the object in the format described by the MIME type specified by mimeType...
Definition: qmimedata.cpp:524
The QString class provides a Unicode character string.
Definition: qstring.h:83
Q_CORE_EXPORT void qDebug(const char *,...)
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
static const char * data(const QByteArray &arr)
QMimeData * userMimeData()
MimeData * m_mimeData
Definition: qbbclipboard.h:59
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402
#define Q_FOREACH(variable, container)
Same as foreach(variable, container).
Definition: qglobal.h:2435
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
void addFormatToCheck(const QString &format)
#define Q_FUNC_INFO
Definition: qglobal.h:1871

Properties

◆ m_mimeData

MimeData* QBBClipboard::m_mimeData
private

Definition at line 59 of file qbbclipboard.h.

Referenced by mimeData(), setMimeData(), and ~QBBClipboard().


The documentation for this class was generated from the following files: