42 #include "qplatformdefs.h" 63 #include <private/qapplication_p.h> 65 #ifndef QT_NO_DRAGANDDROP 69 #ifndef QT_NO_DRAGANDDROP 74 QString dragActionsToString(Qt::DropActions actions)
80 str +=
"IgnoreAction";
100 str +=
"TargetMoveAction";
105 QString KeyboardModifiersToString(Qt::KeyboardModifiers moderfies)
175 else if (action == Qt::MoveAction)
177 else if (action == Qt::CopyAction)
179 else if (action == Qt::LinkAction)
195 Qt::KeyboardModifiers modifiers)
const 198 qDebug(
"QDragManager::defaultAction(Qt::DropActions possibleActions)");
199 qDebug(
"keyboard modifiers : %s", KeyboardModifiersToString(modifiers).latin1());
216 if (modifiers & Qt::ControlModifier && modifiers & Qt::AltModifier)
218 else if (modifiers & Qt::AltModifier)
220 else if (modifiers & Qt::ControlModifier)
223 if (modifiers & Qt::ControlModifier && modifiers & Qt::ShiftModifier)
225 else if (modifiers & Qt::ControlModifier)
227 else if (modifiers & Qt::ShiftModifier)
229 else if (modifiers & Qt::AltModifier)
235 possibleActions =
object->d_func()->possible_actions;
238 qDebug(
"possible actions : %s", dragActionsToString(possibleActions).latin1());
242 if (!(possibleActions & defaultAction)) {
243 if (possibleActions & Qt::CopyAction)
245 else if (possibleActions & Qt::MoveAction)
247 else if (possibleActions & Qt::LinkAction)
254 qDebug(
"default action : %s", dragActionsToString(defaultAction).latin1());
266 if (!dropped &&
object) {
267 object->d_func()->target = target;
268 emit object->targetChanged(target);
288 #endif // QT_NO_DRAGANDDROP 290 #if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD)) 296 for (
int i = 0; i < imageFormats.
size(); ++i) {
304 if (pngIndex != -1 && pngIndex != 0)
305 formats.
move(pngIndex, 0);
315 for (
int i = 0; i < imageFormats.
size(); ++i) {
323 if (pngIndex != -1 && pngIndex != 0)
324 formats.
move(pngIndex, 0);
341 if (!foundFormat && mimeType ==
QLatin1String(
"application/x-qt-image")) {
343 for (
int i = 0; i < imageFormats.
size(); ++i) {
356 for (
int i = 0; i < imageFormats.
size(); ++i) {
357 if (realFormats.
contains(imageFormats.
at(i))) {
373 for (
int i = 0; i < imageFormats.
size(); ++i) {
388 if (ba.
size() == 8) {
396 qWarning(
"Qt: Invalid color format");
420 for (
int i = 0; i < imageFormats.
size(); ++i) {
421 if (!realFormats.
contains(imageFormats.
at(i)))
422 realFormats.
append(imageFormats.
at(i));
431 bool foundFormat = data->
hasFormat(mimeType);
436 for (
int i = 0; i < imageFormats.
size(); ++i) {
437 if ((foundFormat = data->
hasFormat(imageFormats.
at(i))))
470 ba = data->
data(mimeType);
477 image.
save(&buf,
"PNG");
489 #endif // QT_NO_DRAGANDDROP && QT_NO_CLIPBOARD The QVariant class acts like a union for the most common Qt data types.
The QColor class provides colors based on RGB, HSV or CMYK values.
qreal alphaF() const
Returns the alpha color component of this color.
void setData(const QString &mimetype, const QByteArray &data)
Sets the data associated with the MIME type given by mimeType to the specified data.
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageReader.
void clear()
Removes all the MIME type and data entries in the object.
#define QT_END_NAMESPACE
This macro expands to.
virtual QStringList formats() const
Returns a list of formats supported by the object.
char * data()
Returns a pointer to the data stored in the byte array.
qreal greenF() const
Returns the green color component of this color.
static QStringList imageWriteMimeFormats()
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
QVariant colorData() const
Returns a color if the data stored in the object represents a color (MIME type application/x-color); ...
Qt::DropAction defaultAction(Qt::DropActions possibleActions, Qt::KeyboardModifiers modifiers) const
The QByteArray class provides an array of bytes.
static QStringList formatsHelper(const QMimeData *data)
void setRgbF(qreal r, qreal g, qreal b, qreal a=1.0)
Sets the color channels of this color to r (red), g (green), b (blue) and a (alpha, transparency).
QString toUpper() const Q_REQUIRED_RESULT
Returns an uppercase copy of the string.
Qt::DropAction currentActionForOverrideCursor
bool save(const QString &fileName, const char *format=0, int quality=-1) const
Saves the image to the file with the given fileName, using the given image file format and quality fa...
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QMap< Qt::DropAction, QPixmap > customCursors
QByteArray toLower() const
Returns a lowercase copy of the byte array.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QApplicationPrivate * instance()
QByteArray data(const QString &mimetype) const
Returns the data stored in the object in the format described by the MIME type specified by mimeType...
The QBuffer class provides a QIODevice interface for a QByteArray.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has type() ByteArray or String (converted using QS...
bool hasFormat(const QString &mimeType) const
Returns true if the object can return data for the MIME type specified by mimeType; otherwise returns...
void move(int from, int to)
Moves the item at index position from to index position to.
Q_CORE_EXPORT void qDebug(const char *,...)
void append(const T &t)
Inserts value at the end of the list.
int indexOf(const QRegExp &rx, int from=0) const
Returns the index position of the first exact match of rx in the list, searching forward from index p...
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
QStringList formats() const
Returns a list of formats supported by the object.
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
static bool hasFormatHelper(const QString &mimeType, const QMimeData *data)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
virtual QStringList formats_sys() const =0
Type
This enum type defines the types of variable that a QVariant can contain.
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
The QMimeData class provides a container for data that records information about its MIME type...
static QByteArray renderDataHelper(const QString &mimeType, const QMimeData *data)
static bool canReadData(const QString &mimeType)
static QDragManager * self()
QVariant imageData() const
Returns a QVariant storing a QImage if the object can return an image; otherwise returns a null varia...
bool hasImage() const
Returns true if the object can return an image; otherwise returns false.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
virtual bool hasFormat(const QString &mimetype) const
Returns true if the object can return data for the MIME type specified by mimeType; otherwise returns...
QVariant retrieveData(const QString &mimeType, QVariant::Type type) const
Returns a variant with the given type containing data for the MIME type specified by mimeType...
void setCurrentTarget(QWidget *target, bool dropped=false)
static bool closingDown()
Returns true if the application objects are being destroyed; otherwise returns false.
QPixmap getPixmapCursor(Qt::CursorShape cshape)
QWidget * currentTarget()
virtual QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const
Returns a variant with the given type containing data for the MIME type specified by mimeType...
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Type type() const
Returns the storage type of the value stored in the variant.
qreal redF() const
Returns the red color component of this color.
void resize(int size)
Sets the size of the byte array to size bytes.
int size() const
Returns the number of items in the list.
bool isEmpty() const
Returns true if the map contains no items; otherwise returns false.
if(void) toggleToolbarShown
qreal blueF() const
Returns the blue color component of this color.
bool contains(const Key &key) const
Returns true if the map contains an item with key key; otherwise returns false.
T qvariant_cast(const QVariant &)
int size() const
Returns the number of bytes in this byte array.
The QPixmap class is an off-screen image representation that can be used as a paint device...
QWidget * currentDropTarget
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
QPixmap dragCursor(Qt::DropAction action) const
static QStringList imageReadMimeFormats()
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageWriter.
static void restoreOverrideCursor()
Undoes the last setOverrideCursor().
bool hasCustomDragCursors() const
virtual QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const =0
virtual bool hasFormat_sys(const QString &mimeType) const =0
QDragPrivate * dragPrivate() const
static QImage fromData(const uchar *data, int size, const char *format=0)
Constructs a QImage from the first size bytes of the given binary data.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
int xdndMimeTransferedPixmapIndex
static QDragManager * instance
Qt::DropAction defaultDropAction