Qt 4.8
Functions
qdnd.cpp File Reference
#include "qplatformdefs.h"
#include "qbitmap.h"
#include "qdrag.h"
#include "qpixmap.h"
#include "qevent.h"
#include "qfile.h"
#include "qtextcodec.h"
#include "qapplication.h"
#include "qpoint.h"
#include "qwidget.h"
#include "qbuffer.h"
#include "qimage.h"
#include "qregexp.h"
#include "qdir.h"
#include "qdnd_p.h"
#include "qimagereader.h"
#include "qimagewriter.h"
#include "qdebug.h"
#include <ctype.h>
#include <private/qapplication_p.h>

Go to the source code of this file.

Functions

static QStringList imageReadMimeFormats ()
 
static QStringList imageWriteMimeFormats ()
 

Function Documentation

◆ imageReadMimeFormats()

static QStringList imageReadMimeFormats ( )
static

Definition at line 292 of file qdnd.cpp.

Referenced by QInternalMimeData::canReadData(), QInternalMimeData::formats(), QInternalMimeData::hasFormat(), and QInternalMimeData::retrieveData().

293 {
294  QStringList formats;
296  for (int i = 0; i < imageFormats.size(); ++i) {
297  QString format = QLatin1String("image/");
298  format += QString::fromLatin1(imageFormats.at(i).toLower());
299  formats.append(format);
300  }
301 
302  //put png at the front because it is best
303  int pngIndex = formats.indexOf(QLatin1String("image/png"));
304  if (pngIndex != -1 && pngIndex != 0)
305  formats.move(pngIndex, 0);
306 
307  return formats;
308 }
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageReader.
QByteArray toLower() const
Returns a lowercase copy of the byte array.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
void move(int from, int to)
Moves the item at index position from to index position to.
Definition: qlist.h:628
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
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...
Definition: qstringlist.h:195
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ imageWriteMimeFormats()

static QStringList imageWriteMimeFormats ( )
static

Definition at line 311 of file qdnd.cpp.

Referenced by QInternalMimeData::formatsHelper(), and QInternalMimeData::hasFormatHelper().

312 {
313  QStringList formats;
315  for (int i = 0; i < imageFormats.size(); ++i) {
316  QString format = QLatin1String("image/");
317  format += QString::fromLatin1(imageFormats.at(i).toLower());
318  formats.append(format);
319  }
320 
321  //put png at the front because it is best
322  int pngIndex = formats.indexOf(QLatin1String("image/png"));
323  if (pngIndex != -1 && pngIndex != 0)
324  formats.move(pngIndex, 0);
325 
326  return formats;
327 }
QByteArray toLower() const
Returns a lowercase copy of the byte array.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
void move(int from, int to)
Moves the item at index position from to index position to.
Definition: qlist.h:628
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
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...
Definition: qstringlist.h:195
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageWriter.