src/gui/image/qicon.h File Reference

#include <QtCore/qglobal.h>
#include <QtCore/qsize.h>
#include <QtGui/qpixmap.h>

Include dependency graph for qicon.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  QIcon
 The QIcon class provides scalable icons in different modes and states. More...

Functions

 Q_DECLARE_TYPEINFO (QIcon, Q_MOVABLE_TYPE)
Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &, const QIcon &)
Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &, QIcon &)


Function Documentation

Q_GUI_EXPORT QDataStream& operator<< ( QDataStream ,
const QIcon  
)

Definition at line 664 of file qicon.cpp.

References QVector< T >::at(), QIcon::d, QIconPrivate::engine, QPixmapIconEngineEntry::fileName, i, QIcon::isNull(), QPixmapIconEngineEntry::mode, QIcon::pixmap(), QPixmapIconEngineEntry::pixmap, QPixmapIconEngine::pixmaps, QDataStream::Qt_4_2, s, QVector< T >::size(), QPixmapIconEngineEntry::size, and QPixmapIconEngineEntry::state.

00665 {
00666     if (s.version() >= QDataStream::Qt_4_2) {
00667         if (icon.isNull()) {
00668             s << 0;
00669         } else {
00670             QPixmapIconEngine *engine = static_cast<QPixmapIconEngine *>(icon.d->engine);
00671             int num_entries = engine->pixmaps.size();
00672             s << num_entries;
00673             for (int i=0; i < num_entries; ++i) {
00674                 s << engine->pixmaps.at(i).pixmap;
00675                 s << engine->pixmaps.at(i).fileName;
00676                 s << engine->pixmaps.at(i).size;
00677                 s << (uint) engine->pixmaps.at(i).mode;
00678                 s << (uint) engine->pixmaps.at(i).state;
00679             }
00680         }
00681     } else {
00682         s << QPixmap(icon.pixmap(22,22));
00683     }
00684     return s;
00685 }

Here is the call graph for this function:

Q_GUI_EXPORT QDataStream& operator>> ( QDataStream ,
QIcon  
) [related]

Definition at line 696 of file qicon.cpp.

References QIcon::addFile(), QIcon::addPixmap(), i, QPixmap::isNull(), QDataStream::Qt_4_2, and s.

00697 {
00698     if (s.version() >= QDataStream::Qt_4_2) {
00699         icon = QIcon();
00700         int num_entries;
00701         QPixmap pm;
00702         QString fileName;
00703         QSize sz;
00704         uint mode;
00705         uint state;
00706 
00707         s >> num_entries;
00708         for (int i=0; i < num_entries; ++i) {
00709             s >> pm;
00710             s >> fileName;
00711             s >> sz;
00712             s >> mode;
00713             s >> state;
00714             if (pm.isNull())
00715                 icon.addFile(fileName, sz, QIcon::Mode(mode), QIcon::State(state));
00716             else
00717                 icon.addPixmap(pm, QIcon::Mode(mode), QIcon::State(state));
00718         }
00719     } else {
00720         QPixmap pm;
00721         s >> pm;
00722         icon.addPixmap(pm);
00723     }
00724     return s;
00725 }

Here is the call graph for this function:

Q_DECLARE_TYPEINFO ( QIcon  ,
Q_MOVABLE_TYPE   
)


Generated on Thu Mar 15 13:18:34 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1