Qt 4.8
Public Functions | Public Variables | List of all members
QImageReaderPrivate Class Reference

Public Functions

void getText ()
 
bool initHandler ()
 
 QImageReaderPrivate (QImageReader *qq)
 
 ~QImageReaderPrivate ()
 

Public Variables

bool autoDetectImageFormat
 
QRect clipRect
 
bool deleteDevice
 
QIODevicedevice
 
QString errorString
 
QByteArray format
 
QImageIOHandlerhandler
 
bool ignoresFormatAndExtension
 
QImageReader::ImageReaderError imageReaderError
 
QImageReaderq
 
int quality
 
QRect scaledClipRect
 
QSize scaledSize
 
QMap< QString, QStringtext
 

Detailed Description

Definition at line 527 of file qimagereader.cpp.

Constructors and Destructors

◆ QImageReaderPrivate()

QImageReaderPrivate::QImageReaderPrivate ( QImageReader qq)
Warning
This function is not part of the public interface.

Definition at line 560 of file qimagereader.cpp.

562 {
563  device = 0;
564  deleteDevice = false;
565  handler = 0;
566  quality = -1;
568 
569  q = qq;
570 }
QImageReader::ImageReaderError imageReaderError
QImageReader * q
QImageIOHandler * handler

◆ ~QImageReaderPrivate()

QImageReaderPrivate::~QImageReaderPrivate ( )
Warning
This function is not part of the public interface.

Definition at line 575 of file qimagereader.cpp.

576 {
577  if (deleteDevice)
578  delete device;
579  delete handler;
580 }
QImageIOHandler * handler

Functions

◆ getText()

void QImageReaderPrivate::getText ( )
Warning
This function is not part of the public interface.

Definition at line 635 of file qimagereader.cpp.

Referenced by QImageReader::text(), and QImageReader::textKeys().

636 {
638  return;
640  QLatin1String("\n\n"))) {
641  int index = pair.indexOf(QLatin1Char(':'));
642  if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
643  text.insert(QLatin1String("Description"), pair.simplified());
644  } else {
645  QString key = pair.left(index);
646  text.insert(key, pair.mid(index + 2).simplified());
647  }
648  }
649 }
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
QMap< QString, QString > text
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
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...
Definition: qstring.cpp:3706
QString simplified() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end, and that has each sequence o...
Definition: qstring.cpp:4415
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
Definition: qmap.h:559
int key
bool isEmpty() const
Returns true if the map contains no items; otherwise returns false.
Definition: qmap.h:203
QImageIOHandler * handler
quint16 index
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
Definition: qstring.cpp:6526
virtual QVariant option(ImageOption option) const
Returns the value assigned to option as a QVariant.
virtual bool supportsOption(ImageOption option) const
Returns true if the QImageIOHandler supports the option option; otherwise returns false...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ initHandler()

bool QImageReaderPrivate::initHandler ( )
Warning
This function is not part of the public interface.

Definition at line 585 of file qimagereader.cpp.

Referenced by QImageReader::backgroundColor(), QImageReader::canRead(), QImageReader::currentImageNumber(), QImageReader::currentImageRect(), QImageReader::format(), getText(), QImageReader::imageCount(), QImageReader::imageFormat(), QImageReader::jumpToImage(), QImageReader::jumpToNextImage(), QImageReader::loopCount(), QImageReader::nextImageDelay(), QImageReader::read(), QImageReader::setBackgroundColor(), QImageReader::size(), QImageReader::supportsAnimation(), and QImageReader::supportsOption().

586 {
587  // check some preconditions
588  if (!device || (!deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly))) {
591  return false;
592  }
593 
594  // probe the file extension
597  if (!format.isEmpty()) {
598  // Try the most probable extension first
599  int currentFormatIndex = extensions.indexOf(format.toLower());
600  if (currentFormatIndex > 0)
601  extensions.swap(0, currentFormatIndex);
602  }
603 
604  int currentExtension = 0;
605 
606  QFile *file = static_cast<QFile *>(device);
607  QString fileName = file->fileName();
608 
609  do {
610  file->setFileName(fileName + QLatin1Char('.')
611  + QString::fromLatin1(extensions.at(currentExtension++).constData()));
612  file->open(QIODevice::ReadOnly);
613  } while (!file->isOpen() && currentExtension < extensions.size());
614 
615  if (!device->isOpen()) {
618  file->setFileName(fileName); // restore the old file name
619  return false;
620  }
621  }
622 
623  // assign a handler
626  errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Unsupported image format"));
627  return false;
628  }
629  return true;
630 }
QString fileName() const
Returns the name set by setFileName() or to the QFile constructors.
Definition: qfile.cpp:470
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageReader.
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
Definition: qfile.cpp:1064
#define QT_TRANSLATE_NOOP(scope, x)
Marks the string literal sourceText for dynamic translation in the given context; i...
Definition: qglobal.h:2487
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
QImageReader::ImageReaderError imageReaderError
Q_GUI_EXPORT QString extensions()
Definition: qegl.cpp:785
bool isOpen() const
Returns true if the device is open; otherwise returns false.
Definition: qiodevice.cpp:530
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QImageReader class provides a format independent interface for reading images from files or other...
Definition: qimagereader.h:62
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
The QFile class provides an interface for reading from and writing to files.
Definition: qfile.h:65
static QImageIOHandler * createReadHandlerHelper(QIODevice *device, const QByteArray &format, bool autoDetectImageFormat, bool ignoresFormatAndExtension)
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
QImageIOHandler * handler
virtual bool open(OpenMode mode)
Opens the device and sets its OpenMode to mode.
Definition: qiodevice.cpp:570
static QString fileName(const QString &fileUrl)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
void swap(QList< T > &other)
Swaps list other with this list.
Definition: qlist.h:129
void setFileName(const QString &name)
Sets the name of the file.
Definition: qfile.cpp:494

Properties

◆ autoDetectImageFormat

bool QImageReaderPrivate::autoDetectImageFormat

◆ clipRect

QRect QImageReaderPrivate::clipRect

◆ deleteDevice

bool QImageReaderPrivate::deleteDevice

◆ device

QIODevice* QImageReaderPrivate::device

◆ errorString

QString QImageReaderPrivate::errorString

Definition at line 552 of file qimagereader.cpp.

Referenced by QImageReader::errorString(), initHandler(), and QImageReader::read().

◆ format

QByteArray QImageReaderPrivate::format

◆ handler

QImageIOHandler* QImageReaderPrivate::handler

◆ ignoresFormatAndExtension

bool QImageReaderPrivate::ignoresFormatAndExtension

◆ imageReaderError

QImageReader::ImageReaderError QImageReaderPrivate::imageReaderError

◆ q

QImageReader* QImageReaderPrivate::q

Definition at line 554 of file qimagereader.cpp.

Referenced by QImageReaderPrivate().

◆ quality

int QImageReaderPrivate::quality

◆ scaledClipRect

QRect QImageReaderPrivate::scaledClipRect

◆ scaledSize

QSize QImageReaderPrivate::scaledSize

◆ text

QMap<QString, QString> QImageReaderPrivate::text

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