Get rid of the last traces of QMimeSource
The class has been deprecated since Qt 4.0, but couldn't be removed as QDropEvent inherited from it. Change-Id: I9caa19b30977a319e79255900dee8b2425783f46 Reviewed-on: http://codereview.qt-project.org/5754 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This commit is contained in:
parent
95cebd34eb
commit
e9ccc40c28
@ -65,6 +65,7 @@
|
||||
#include <QCloseEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QPrintPreviewDialog>
|
||||
#include <QMimeData>
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
const QString rsrcPath = ":/images/mac";
|
||||
|
@ -18,7 +18,6 @@ HEADERS += \
|
||||
kernel/qkeysequence.h \
|
||||
kernel/qkeysequence_p.h \
|
||||
kernel/qkeymapper_p.h \
|
||||
kernel/qmime.h \
|
||||
kernel/qpalette.h \
|
||||
kernel/qsessionmanager.h \
|
||||
kernel/qwindowdefs.h \
|
||||
@ -35,7 +34,6 @@ SOURCES += \
|
||||
kernel/qkeysequence.cpp \
|
||||
kernel/qkeymapper.cpp \
|
||||
kernel/qkeymapper_qpa.cpp \
|
||||
kernel/qmime.cpp \
|
||||
kernel/qpalette.cpp \
|
||||
kernel/qguivariant.cpp \
|
||||
kernel/qscreen.cpp \
|
||||
|
@ -43,8 +43,8 @@
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
|
||||
#include "qmimedata.h"
|
||||
#include "qpixmap.h"
|
||||
#include "qclipboard_p.h"
|
||||
#include "qvariant.h"
|
||||
#include "qbuffer.h"
|
||||
#include "qimage.h"
|
||||
@ -137,8 +137,6 @@ QT_BEGIN_NAMESPACE
|
||||
\sa QApplication
|
||||
*/
|
||||
|
||||
#ifndef Q_WS_X11
|
||||
// for X11 there is a separate implementation of a constructor.
|
||||
/*!
|
||||
\internal
|
||||
|
||||
@ -154,13 +152,11 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
|
||||
QClipboard::QClipboard(QObject *parent)
|
||||
: QObject(*new QClipboardPrivate, parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
// nothing
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_WS_WIN32
|
||||
/*!
|
||||
\internal
|
||||
|
||||
@ -172,7 +168,6 @@ QClipboard::QClipboard(QObject *parent)
|
||||
QClipboard::~QClipboard()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn void QClipboard::changed(QClipboard::Mode mode)
|
||||
@ -488,45 +483,6 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)
|
||||
\sa QClipboard::Mode, supportsSelection()
|
||||
*/
|
||||
|
||||
#ifdef QT3_SUPPORT
|
||||
/*!
|
||||
\fn QMimeSource *QClipboard::data(Mode mode) const
|
||||
\compat
|
||||
|
||||
Use mimeData() instead.
|
||||
*/
|
||||
QMimeSource *QClipboard::data(Mode mode) const
|
||||
{
|
||||
Q_D(const QClipboard);
|
||||
|
||||
if (supportsMode(mode) == false)
|
||||
return 0;
|
||||
|
||||
if (d->compat_data[mode])
|
||||
return d->compat_data[mode];
|
||||
|
||||
d->wrapper[mode]->data = mimeData(mode);
|
||||
return d->wrapper[mode];
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\fn void QClipboard::setData(QMimeSource *src, Mode mode)
|
||||
\compat
|
||||
|
||||
Use setMimeData() instead.
|
||||
*/
|
||||
void QClipboard::setData(QMimeSource *source, Mode mode)
|
||||
{
|
||||
Q_D(QClipboard);
|
||||
|
||||
if (supportsMode(mode) == false)
|
||||
return;
|
||||
|
||||
d->compat_data[mode] = source;
|
||||
setMimeData(new QMimeSourceWrapper(d, mode), mode);
|
||||
}
|
||||
#endif // QT3_SUPPORT
|
||||
|
||||
/*!
|
||||
Returns true if the clipboard supports mouse selection; otherwise
|
||||
@ -611,55 +567,6 @@ void QClipboard::emitChanged(Mode mode)
|
||||
emit changed(mode);
|
||||
}
|
||||
|
||||
const char* QMimeDataWrapper::format(int n) const
|
||||
{
|
||||
if (formats.isEmpty()) {
|
||||
QStringList fmts = data->formats();
|
||||
for (int i = 0; i < fmts.size(); ++i)
|
||||
formats.append(fmts.at(i).toLatin1());
|
||||
}
|
||||
if (n < 0 || n >= formats.size())
|
||||
return 0;
|
||||
return formats.at(n).data();
|
||||
}
|
||||
|
||||
QByteArray QMimeDataWrapper::encodedData(const char *format) const
|
||||
{
|
||||
if (QLatin1String(format) != QLatin1String("application/x-qt-image")){
|
||||
return data->data(QLatin1String(format));
|
||||
} else{
|
||||
QVariant variant = data->imageData();
|
||||
QImage img = qvariant_cast<QImage>(variant);
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
img.save(&buffer, "PNG");
|
||||
return ba;
|
||||
}
|
||||
}
|
||||
|
||||
QVariant QMimeSourceWrapper::retrieveData(const QString &mimetype, QVariant::Type) const
|
||||
{
|
||||
return source->encodedData(mimetype.toLatin1());
|
||||
}
|
||||
|
||||
bool QMimeSourceWrapper::hasFormat(const QString &mimetype) const
|
||||
{
|
||||
return source->provides(mimetype.toLatin1());
|
||||
}
|
||||
|
||||
QStringList QMimeSourceWrapper::formats() const
|
||||
{
|
||||
QStringList fmts;
|
||||
int i = 0;
|
||||
const char *fmt;
|
||||
while ((fmt = source->format(i))) {
|
||||
fmts.append(QLatin1String(fmt));
|
||||
++i;
|
||||
}
|
||||
return fmts;
|
||||
}
|
||||
|
||||
#endif // QT_NO_CLIPBOARD
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -52,17 +52,13 @@ QT_MODULE(Gui)
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
|
||||
class QMimeSource;
|
||||
class QMimeData;
|
||||
class QImage;
|
||||
class QPixmap;
|
||||
|
||||
class QClipboardPrivate;
|
||||
|
||||
class Q_GUI_EXPORT QClipboard : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QClipboard)
|
||||
private:
|
||||
QClipboard(QObject *parent);
|
||||
~QClipboard();
|
||||
@ -83,10 +79,6 @@ public:
|
||||
QString text(QString& subtype, Mode mode = Clipboard) const;
|
||||
void setText(const QString &, Mode mode = Clipboard);
|
||||
|
||||
#ifdef QT3_SUPPORT
|
||||
QT3_SUPPORT QMimeSource *data(Mode mode = Clipboard) const;
|
||||
QT3_SUPPORT void setData(QMimeSource*, Mode mode = Clipboard);
|
||||
#endif
|
||||
const QMimeData *mimeData(Mode mode = Clipboard ) const;
|
||||
void setMimeData(QMimeData *data, Mode mode = Clipboard);
|
||||
|
||||
@ -112,7 +104,6 @@ protected:
|
||||
friend class QGuiApplication;
|
||||
friend class QBaseApplication;
|
||||
friend class QDragManager;
|
||||
friend class QMimeSource;
|
||||
friend class QPlatformClipboard;
|
||||
|
||||
private:
|
||||
|
@ -1,131 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QCLIPBOARD_P_H
|
||||
#define QCLIPBOARD_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include "private/qobject_p.h"
|
||||
#include "QtGui/qmime.h"
|
||||
#include "QtGui/qclipboard.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QClipboardPrivate;
|
||||
|
||||
class QMimeDataWrapper : public QMimeSource
|
||||
{
|
||||
public:
|
||||
QMimeDataWrapper() {}
|
||||
|
||||
const char* format(int n) const;
|
||||
QByteArray encodedData(const char*) const;
|
||||
|
||||
mutable QList<QByteArray> formats;
|
||||
const QMimeData *data;
|
||||
};
|
||||
|
||||
class QMimeSourceWrapper : public QMimeData
|
||||
{
|
||||
public:
|
||||
QMimeSourceWrapper(QClipboardPrivate *priv, QClipboard::Mode m);
|
||||
~QMimeSourceWrapper();
|
||||
|
||||
bool hasFormat(const QString &mimetype) const;
|
||||
QStringList formats() const;
|
||||
|
||||
protected:
|
||||
QVariant retrieveData(const QString &mimetype, QVariant::Type) const;
|
||||
private:
|
||||
QClipboardPrivate *d;
|
||||
QClipboard::Mode mode;
|
||||
QMimeSource *source;
|
||||
};
|
||||
|
||||
|
||||
class QClipboardPrivate : public QObjectPrivate
|
||||
{
|
||||
public:
|
||||
QClipboardPrivate() : QObjectPrivate() {
|
||||
for (int i = 0; i <= QClipboard::LastMode; ++i) {
|
||||
compat_data[i] = 0;
|
||||
wrapper[i] = new QMimeDataWrapper();
|
||||
}
|
||||
}
|
||||
~QClipboardPrivate() {
|
||||
for (int i = 0; i <= QClipboard::LastMode; ++i) {
|
||||
delete wrapper[i];
|
||||
delete compat_data[i];
|
||||
}
|
||||
}
|
||||
|
||||
mutable QMimeDataWrapper *wrapper[QClipboard::LastMode + 1];
|
||||
mutable QMimeSource *compat_data[QClipboard::LastMode + 1];
|
||||
};
|
||||
|
||||
inline QMimeSourceWrapper::QMimeSourceWrapper(QClipboardPrivate *priv, QClipboard::Mode m)
|
||||
: QMimeData()
|
||||
{
|
||||
d = priv;
|
||||
mode = m;
|
||||
source = d->compat_data[mode];
|
||||
}
|
||||
|
||||
inline QMimeSourceWrapper::~QMimeSourceWrapper()
|
||||
{
|
||||
if (d->compat_data[mode] == source)
|
||||
d->compat_data[mode] = 0;
|
||||
delete source;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QCLIPBOARD_P_H
|
@ -55,7 +55,7 @@
|
||||
|
||||
#include "QtCore/qobject.h"
|
||||
#include "QtCore/qmap.h"
|
||||
#include "QtGui/qmime.h"
|
||||
#include "QtCore/qmimedata.h"
|
||||
#include "QtGui/qdrag.h"
|
||||
#include "QtGui/qpixmap.h"
|
||||
#include "QtGui/qcursor.h"
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "private/qevent_p.h"
|
||||
#include "private/qkeysequence_p.h"
|
||||
#include "qdebug.h"
|
||||
#include "qmime.h"
|
||||
#include "qmimedata.h"
|
||||
#include "private/qdnd_p.h"
|
||||
#include "qevent_p.h"
|
||||
#include "qmath.h"
|
||||
@ -2304,63 +2304,6 @@ QDropEvent::~QDropEvent()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\compat
|
||||
Returns a byte array containing the drag's data, in \a format.
|
||||
|
||||
data() normally needs to get the data from the drag source, which
|
||||
is potentially very slow, so it's advisable to call this function
|
||||
only if you're sure that you will need the data in that
|
||||
particular \a format.
|
||||
|
||||
The resulting data will have a size of 0 if the format was not
|
||||
available.
|
||||
|
||||
\sa format() QByteArray::size()
|
||||
*/
|
||||
|
||||
QByteArray QDropEvent::encodedData(const char *format) const
|
||||
{
|
||||
return mdata->data(QLatin1String(format));
|
||||
}
|
||||
|
||||
/*!
|
||||
\compat
|
||||
Returns a string describing one of the available data types for
|
||||
this drag. Common examples are "text/plain" and "image/gif".
|
||||
If \a n is less than zero or greater than the number of available
|
||||
data types, format() returns 0.
|
||||
|
||||
This function is provided mainly for debugging. Most drop targets
|
||||
will use provides().
|
||||
|
||||
\sa data() provides()
|
||||
*/
|
||||
|
||||
const char* QDropEvent::format(int n) const
|
||||
{
|
||||
if (fmts.isEmpty()) {
|
||||
QStringList formats = mdata->formats();
|
||||
for (int i = 0; i < formats.size(); ++i)
|
||||
fmts.append(formats.at(i).toLatin1());
|
||||
}
|
||||
if (n < 0 || n >= fmts.size())
|
||||
return 0;
|
||||
return fmts.at(n).constData();
|
||||
}
|
||||
|
||||
/*!
|
||||
\compat
|
||||
Returns true if this event provides format \a mimeType; otherwise
|
||||
returns false.
|
||||
|
||||
\sa data()
|
||||
*/
|
||||
|
||||
bool QDropEvent::provides(const char *mimeType) const
|
||||
{
|
||||
return mdata->formats().contains(QLatin1String(mimeType));
|
||||
}
|
||||
|
||||
/*!
|
||||
If the source of the drag operation is a widget in this
|
||||
@ -2919,15 +2862,6 @@ QShowEvent::~QShowEvent()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QByteArray QDropEvent::data(const char* f) const
|
||||
|
||||
\obsolete
|
||||
|
||||
The encoded data is in \a f.
|
||||
Use QDropEvent::encodedData().
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QFileOpenEvent
|
||||
\brief The QFileOpenEvent class provides an event that will be
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtGui/qkeysequence.h>
|
||||
#include <QtCore/qcoreevent.h>
|
||||
#include <QtGui/qmime.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
#include <QtCore/qmap.h>
|
||||
#include <QtCore/qvector.h>
|
||||
@ -475,9 +474,6 @@ private:
|
||||
class QMimeData;
|
||||
|
||||
class Q_GUI_EXPORT QDropEvent : public QEvent
|
||||
// QT3_SUPPORT
|
||||
, public QMimeSource
|
||||
// END QT3_SUPPORT
|
||||
{
|
||||
public:
|
||||
QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
|
||||
@ -498,13 +494,6 @@ public:
|
||||
QObject* source() const;
|
||||
inline const QMimeData *mimeData() const { return mdata; }
|
||||
|
||||
// QT3_SUPPORT
|
||||
const char* format(int n = 0) const;
|
||||
QByteArray encodedData(const char*) const;
|
||||
bool provides(const char*) const;
|
||||
// END QT3_SUPPORT
|
||||
|
||||
|
||||
protected:
|
||||
friend class QApplication;
|
||||
QPoint p;
|
||||
@ -514,7 +503,6 @@ protected:
|
||||
Qt::DropAction drop_action;
|
||||
Qt::DropAction default_action;
|
||||
const QMimeData *mdata;
|
||||
mutable QList<QByteArray> fmts; // only used for QT3_SUPPORT
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,97 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qmime.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QMimeSource
|
||||
\brief The QMimeSource class is an abstraction of objects that
|
||||
provided formatted data of a certain MIME type.
|
||||
|
||||
\obsolete
|
||||
|
||||
The preferred approach to drag and drop is to use QDrag in
|
||||
conjunction with QMimeData. See \l{Drag and Drop} for details.
|
||||
|
||||
\sa QMimeData, QDrag
|
||||
*/
|
||||
|
||||
/*!
|
||||
Destroys the MIME source.
|
||||
*/
|
||||
QMimeSource::~QMimeSource()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn const char *QMimeSource::format(int i) const
|
||||
|
||||
Returns the (\a i - 1)-th supported MIME format, or 0.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QByteArray QMimeSource::encodedData(const char *format) const
|
||||
|
||||
Returns the encoded data of this object in the specified MIME
|
||||
\a format.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns true if the object can provide the data in format \a
|
||||
mimeType; otherwise returns false.
|
||||
|
||||
If you inherit from QMimeSource, for consistency reasons it is
|
||||
better to implement the more abstract canDecode() functions such
|
||||
as QTextDrag::canDecode() and QImageDrag::canDecode().
|
||||
*/
|
||||
bool QMimeSource::provides(const char* mimeType) const
|
||||
{
|
||||
const char* fmt;
|
||||
for (int i=0; (fmt = format(i)); i++) {
|
||||
if (!qstricmp(mimeType,fmt))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,176 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QMIME_H
|
||||
#define QMIME_H
|
||||
|
||||
#include <QtCore/qmimedata.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QT_MODULE(Gui)
|
||||
|
||||
class Q_GUI_EXPORT QMimeSource
|
||||
{
|
||||
public:
|
||||
virtual ~QMimeSource();
|
||||
virtual const char* format(int n = 0) const = 0;
|
||||
virtual bool provides(const char*) const;
|
||||
virtual QByteArray encodedData(const char*) const = 0;
|
||||
};
|
||||
|
||||
|
||||
#if defined(Q_WS_WIN)
|
||||
|
||||
QT_BEGIN_INCLUDE_NAMESPACE
|
||||
typedef struct tagFORMATETC FORMATETC;
|
||||
typedef struct tagSTGMEDIUM STGMEDIUM;
|
||||
struct IDataObject;
|
||||
|
||||
#include <QtCore/qvariant.h>
|
||||
QT_END_INCLUDE_NAMESPACE
|
||||
|
||||
/*
|
||||
Encapsulation of conversion between MIME and Windows CLIPFORMAT.
|
||||
Not need on X11, as the underlying protocol uses the MIME standard
|
||||
directly.
|
||||
*/
|
||||
|
||||
class Q_GUI_EXPORT QWindowsMime
|
||||
{
|
||||
public:
|
||||
QWindowsMime();
|
||||
virtual ~QWindowsMime();
|
||||
|
||||
// for converting from Qt
|
||||
virtual bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const = 0;
|
||||
virtual bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const = 0;
|
||||
virtual QVector<FORMATETC> formatsForMime(const QString &mimeType, const QMimeData *mimeData) const = 0;
|
||||
|
||||
// for converting to Qt
|
||||
virtual bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const = 0;
|
||||
virtual QVariant convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const = 0;
|
||||
virtual QString mimeForFormat(const FORMATETC &formatetc) const = 0;
|
||||
|
||||
static int registerMimeType(const QString &mime);
|
||||
|
||||
private:
|
||||
friend class QClipboardWatcher;
|
||||
friend class QDragManager;
|
||||
friend class QDropData;
|
||||
friend class QOleDataObject;
|
||||
|
||||
static QWindowsMime *converterToMime(const QString &mimeType, IDataObject *pDataObj);
|
||||
static QStringList allMimesForFormats(IDataObject *pDataObj);
|
||||
static QWindowsMime *converterFromMime(const FORMATETC &formatetc, const QMimeData *mimeData);
|
||||
static QVector<FORMATETC> allFormatsForMime(const QMimeData *mimeData);
|
||||
};
|
||||
|
||||
#endif
|
||||
#if defined(Q_WS_MAC)
|
||||
|
||||
/*
|
||||
Encapsulation of conversion between MIME and Mac flavor.
|
||||
Not needed on X11, as the underlying protocol uses the MIME standard
|
||||
directly.
|
||||
*/
|
||||
|
||||
class Q_GUI_EXPORT QMacMime { //Obsolete
|
||||
char type;
|
||||
public:
|
||||
enum QMacMimeType { MIME_DND=0x01, MIME_CLIP=0x02, MIME_QT_CONVERTOR=0x04, MIME_ALL=MIME_DND|MIME_CLIP };
|
||||
explicit QMacMime(char) { }
|
||||
virtual ~QMacMime() { }
|
||||
|
||||
static void initialize() { }
|
||||
|
||||
static QList<QMacMime*> all(QMacMimeType) { return QList<QMacMime*>(); }
|
||||
static QMacMime *convertor(QMacMimeType, const QString &, int) { return 0; }
|
||||
static QString flavorToMime(QMacMimeType, int) { return QString(); }
|
||||
|
||||
virtual QString convertorName()=0;
|
||||
virtual int countFlavors()=0;
|
||||
virtual int flavor(int index)=0;
|
||||
virtual bool canConvert(const QString &mime, int flav)=0;
|
||||
virtual QString mimeFor(int flav)=0;
|
||||
virtual int flavorFor(const QString &mime)=0;
|
||||
virtual QVariant convertToMime(const QString &mime, QList<QByteArray> data, int flav)=0;
|
||||
virtual QList<QByteArray> convertFromMime(const QString &mime, QVariant data, int flav)=0;
|
||||
};
|
||||
|
||||
class Q_GUI_EXPORT QMacPasteboardMime {
|
||||
char type;
|
||||
public:
|
||||
enum QMacPasteboardMimeType { MIME_DND=0x01,
|
||||
MIME_CLIP=0x02,
|
||||
MIME_QT_CONVERTOR=0x04,
|
||||
MIME_QT3_CONVERTOR=0x08,
|
||||
MIME_ALL=MIME_DND|MIME_CLIP
|
||||
};
|
||||
explicit QMacPasteboardMime(char);
|
||||
virtual ~QMacPasteboardMime();
|
||||
|
||||
static void initialize();
|
||||
|
||||
static QList<QMacPasteboardMime*> all(uchar);
|
||||
static QMacPasteboardMime *convertor(uchar, const QString &mime, QString flav);
|
||||
static QString flavorToMime(uchar, QString flav);
|
||||
|
||||
virtual QString convertorName() = 0;
|
||||
|
||||
virtual bool canConvert(const QString &mime, QString flav) = 0;
|
||||
virtual QString mimeFor(QString flav) = 0;
|
||||
virtual QString flavorFor(const QString &mime) = 0;
|
||||
virtual QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav) = 0;
|
||||
virtual QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav) = 0;
|
||||
};
|
||||
|
||||
// ### Qt 5: Add const QStringList& QMacPasteboardMime::supportedFlavours()
|
||||
Q_GUI_EXPORT void qRegisterDraggedTypes(const QStringList &types);
|
||||
#endif // Q_WS_MAC
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QMIME_H
|
@ -43,6 +43,7 @@
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include <QtCore/qmimedata.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include <qpainter.h>
|
||||
#include <qevent.h>
|
||||
#include <qdebug.h>
|
||||
#include <qmime.h>
|
||||
#include <qdrag.h>
|
||||
#include <qclipboard.h>
|
||||
#include <qtimer.h>
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include <QtGui/qabstracttextdocumentlayout.h>
|
||||
#include <QtGui/qtextdocumentfragment.h>
|
||||
#include <QtGui/qclipboard.h>
|
||||
#include <QtCore/qmimedata.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
@ -71,7 +72,6 @@ QT_MODULE(Gui)
|
||||
class QStyleSheet;
|
||||
class QTextDocument;
|
||||
class QTextControlPrivate;
|
||||
class QMimeData;
|
||||
class QAbstractScrollArea;
|
||||
class QEvent;
|
||||
class QTimerEvent;
|
||||
|
@ -810,10 +810,6 @@ QT_CLASS_LIB(QLayoutItem, QtWidgets, qlayoutitem.h)
|
||||
QT_CLASS_LIB(QSpacerItem, QtWidgets, qlayoutitem.h)
|
||||
QT_CLASS_LIB(QWidgetItem, QtWidgets, qlayoutitem.h)
|
||||
QT_CLASS_LIB(QWidgetItemV2, QtWidgets, qlayoutitem.h)
|
||||
QT_CLASS_LIB(QMimeSource, QtGui, qmime.h)
|
||||
QT_CLASS_LIB(QWindowsMime, QtGui, qmime.h)
|
||||
QT_CLASS_LIB(QMacMime, QtGui, qmime.h)
|
||||
QT_CLASS_LIB(QMacPasteboardMime, QtGui, qmime.h)
|
||||
QT_CLASS_LIB(QPalette, QtGui, qpalette.h)
|
||||
QT_CLASS_LIB(QColorGroup, QtWidgets, qpalette.h)
|
||||
QT_CLASS_LIB(QPlatformCursorImage, QtGui, qplatformcursor_qpa.h)
|
||||
|
@ -60,7 +60,7 @@
|
||||
#include "qstyle.h"
|
||||
#include "qstyleoption.h"
|
||||
#include "qvalidator.h"
|
||||
#include "qmime.h"
|
||||
#include "qmimedata.h"
|
||||
#include "qspinbox.h"
|
||||
#include "qdialogbuttonbox.h"
|
||||
#include "private/qguiplatformplugin_p.h"
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "qfilesystemmodel_p.h"
|
||||
#include "qfilesystemmodel.h"
|
||||
#include <qlocale.h>
|
||||
#include <qmime.h>
|
||||
#include <qmimedata.h>
|
||||
#include <qurl.h>
|
||||
#include <qdebug.h>
|
||||
#include <qmessagebox.h>
|
||||
|
@ -57,7 +57,7 @@
|
||||
#include "private/qabstractitemmodel_p.h"
|
||||
#include "QtWidgets/qapplication.h"
|
||||
#include "QtGui/qevent.h"
|
||||
#include "QtGui/qmime.h"
|
||||
#include "QtCore/qmimedata.h"
|
||||
#include "QtGui/qpainter.h"
|
||||
#include "QtCore/qpair.h"
|
||||
#include "QtGui/qregion.h"
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include <qfile.h>
|
||||
#include <qfilesystemmodel.h>
|
||||
#include <qurl.h>
|
||||
#include <qmime.h>
|
||||
#include <qmimedata.h>
|
||||
#include <qpair.h>
|
||||
#include <qvector.h>
|
||||
#include <qobject.h>
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include "QtCore/qbasictimer.h"
|
||||
#include "QtWidgets/qcompleter.h"
|
||||
#include "QtCore/qpointer.h"
|
||||
#include "QtCore/qmimedata.h"
|
||||
#include "QtWidgets/qlineedit.h"
|
||||
|
||||
#include "private/qwidgetlinecontrol_p.h"
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include <qpainter.h>
|
||||
#include <qevent.h>
|
||||
#include <qdebug.h>
|
||||
#include <qmime.h>
|
||||
#include <qdrag.h>
|
||||
#include <qclipboard.h>
|
||||
#include <qmenu.h>
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include <qpainter.h>
|
||||
#include <qevent.h>
|
||||
#include <qdebug.h>
|
||||
#include <qmime.h>
|
||||
#include <qdrag.h>
|
||||
#include <qclipboard.h>
|
||||
#include <qmenu.h>
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include <qpainter.h>
|
||||
#include <qevent.h>
|
||||
#include <qdebug.h>
|
||||
#include <qmime.h>
|
||||
#include <qdrag.h>
|
||||
#include <qclipboard.h>
|
||||
#include <qmenu.h>
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include <QtGui/qabstracttextdocumentlayout.h>
|
||||
#include <QtGui/qtextdocumentfragment.h>
|
||||
#include <QtGui/qclipboard.h>
|
||||
#include <QtCore/qmimedata.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
@ -74,7 +75,6 @@ class QStyleSheet;
|
||||
class QTextDocument;
|
||||
class QMenu;
|
||||
class QWidgetTextControlPrivate;
|
||||
class QMimeData;
|
||||
class QAbstractScrollArea;
|
||||
class QEvent;
|
||||
class QTimerEvent;
|
||||
|
Loading…
Reference in New Issue
Block a user