Make it possible to fetch data for a said format
This commit is contained in:
parent
f517765bd0
commit
6b86584dd0
@ -54,11 +54,18 @@ QClipboard::Mode Clipboard::mode() const
|
||||
return m_mode;
|
||||
}
|
||||
|
||||
QVariant Clipboard::content() const
|
||||
QVariant Clipboard::contentFormat(const QString &format) const
|
||||
{
|
||||
const QMimeData* data = m_clipboard->mimeData(m_mode);
|
||||
|
||||
return data->data(data->formats().first());
|
||||
QByteArray variant = data->data(format.isEmpty() ? data->formats().first(): format);
|
||||
|
||||
return variant;
|
||||
}
|
||||
|
||||
QVariant Clipboard::content() const
|
||||
{
|
||||
return contentFormat(m_clipboard->mimeData(m_mode)->formats().first());
|
||||
}
|
||||
|
||||
void Clipboard::setContent(const QVariant &content)
|
||||
|
@ -50,6 +50,7 @@ class Clipboard : public QObject
|
||||
QClipboard::Mode mode() const;
|
||||
void setMode(QClipboard::Mode mode);
|
||||
|
||||
Q_SCRIPTABLE QVariant contentFormat(const QString &format) const;
|
||||
QVariant content() const;
|
||||
void setContent(const QVariant &content);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user