Qt 4.8
Functions | Variables
qpixmap.cpp File Reference
#include <qglobal.h>
#include "qpixmap.h"
#include "qpixmapdata_p.h"
#include "qimagepixmapcleanuphooks_p.h"
#include "qbitmap.h"
#include "qcolormap.h"
#include "qimage.h"
#include "qwidget.h"
#include "qpainter.h"
#include "qdatastream.h"
#include "qbuffer.h"
#include "qapplication.h"
#include <private/qapplication_p.h>
#include <private/qgraphicssystem_p.h>
#include <private/qwidget_p.h>
#include "qevent.h"
#include "qfile.h"
#include "qfileinfo.h"
#include "qpixmapcache.h"
#include "qdatetime.h"
#include "qimagereader.h"
#include "qimagewriter.h"
#include "qpaintengine.h"
#include "qthread.h"
#include "private/qt_mac_p.h"
#include "private/qpixmap_mac_p.h"
#include "qx11info_x11.h"
#include <private/qt_x11_p.h>
#include <private/qpixmap_x11_p.h>
#include "qpixmap_raster_p.h"
#include "private/qstylehelper_p.h"

Go to the source code of this file.

Functions

Q_GUI_EXPORT qint64 qt_pixmap_id (const QPixmap &pixmap)
 
static bool qt_pixmap_thread_test ()
 
static void sendResizeEvents (QWidget *target)
 

Variables

QApplication::Type qt_appType
 

Function Documentation

◆ qt_pixmap_id()

Q_GUI_EXPORT qint64 qt_pixmap_id ( const QPixmap pixmap)

Definition at line 94 of file qpixmap.cpp.

Referenced by QPdfEnginePrivate::addBrushPattern(), and QItemDelegate::selected().

95 {
96  return pixmap.cacheKey();
97 }
qint64 cacheKey() const
Returns a number that identifies this QPixmap.
Definition: qpixmap.cpp:1136

◆ qt_pixmap_thread_test()

static bool qt_pixmap_thread_test ( )
static

Definition at line 99 of file qpixmap.cpp.

Referenced by QPixmap::handle(), and QPixmap::QPixmap().

100 {
101  if (!qApp) {
102  qFatal("QPixmap: Must construct a QApplication before a QPaintDevice");
103  return false;
104  }
105 
106  if (qApp->thread() != QThread::currentThread()) {
107  bool fail = false;
108 #if defined (Q_WS_X11)
110  fail = true;
111 #elif defined (Q_WS_QPA)
112  if (!QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) {
113  printf("Lighthouse plugin does not support threaded pixmaps!\n");
114  fail = true;
115  }
116 #else
118  fail = true;
119 #endif
120  if (fail) {
121  qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread");
122  return false;
123  }
124  }
125  return true;
126 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
Definition: qthread.cpp:419
#define qApp
Q_CORE_EXPORT void qWarning(const char *,...)
static QString graphics_system_name
Q_CORE_EXPORT void qFatal(const char *,...)
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.

◆ sendResizeEvents()

static void sendResizeEvents ( QWidget target)
static

Definition at line 1145 of file qpixmap.cpp.

Referenced by QPixmap::grabWidget().

1146 {
1147  QResizeEvent e(target->size(), QSize());
1148  QApplication::sendEvent(target, &e);
1149 
1150  const QObjectList children = target->children();
1151  for (int i = 0; i < children.size(); ++i) {
1152  QWidget *child = static_cast<QWidget*>(children.at(i));
1153  if (child->isWidgetType() && !child->isWindow() && child->testAttribute(Qt::WA_PendingResizeEvent))
1154  sendResizeEvents(child);
1155  }
1156 }
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
static void sendResizeEvents(QWidget *target)
Definition: qpixmap.cpp:1145
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:165
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
Definition: qobject.h:146
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
const QObjectList & children() const
Returns a list of child objects.
Definition: qobject.h:197
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

Variable Documentation

◆ qt_appType

QApplication::Type qt_appType

Definition at line 163 of file qapplication.cpp.

Referenced by QPixmap::init().