Qt 4.8
Public Functions | Properties | List of all members
QMinimalWindowSurface Class Reference

#include <qminimalwindowsurface.h>

Inheritance diagram for QMinimalWindowSurface:
QWindowSurface

Public Functions

void flush (QWidget *widget, const QRegion &region, const QPoint &offset)
 Flushes the given region from the specified widget onto the screen. More...
 
QPaintDevicepaintDevice ()
 Implement this function to return the appropriate paint device. More...
 
 QMinimalWindowSurface (QWidget *window)
 
void resize (const QSize &size)
 
 ~QMinimalWindowSurface ()
 
- Public Functions inherited from QWindowSurface
virtual void beginPaint (const QRegion &)
 This function is called before painting onto the surface begins, with the region in which the painting will occur. More...
 
virtual QImagebuffer (const QWidget *widget)
 Returns a QImage pointer which represents the actual buffer the widget is drawn into or 0 if this is unavailable. More...
 
virtual void endPaint (const QRegion &)
 This function is called after painting onto the surface has ended, with the region in which the painting was performed. More...
 
virtual WindowSurfaceFeatures features () const
 
QRect geometry () const
 Returns the currently allocated area on the screen. More...
 
virtual QPixmap grabWidget (const QWidget *widget, const QRect &rectangle=QRect()) const
 Returns a QPixmap generated from the part of the backing store corresponding to widget. More...
 
bool hasFeature (WindowSurfaceFeature feature) const
 
virtual QPoint offset (const QWidget *widget) const
 Returns the offset of widget in the coordinates of this window surface. More...
 
 QWindowSurface (QWidget *window, bool setDefaultSurface=true)
 Constructs an empty surface for the given top-level window. More...
 
QRect rect (const QWidget *widget) const
 Returns the rectangle for widget in the coordinates of this window surface. More...
 
virtual bool scroll (const QRegion &area, int dx, int dy)
 Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative. More...
 
virtual void setGeometry (const QRect &rect)
 Sets the currently allocated area to be the given rect. More...
 
void setStaticContents (const QRegion &region)
 
QRegion staticContents () const
 
QWidgetwindow () const
 Returns a pointer to the top-level window associated with this surface. More...
 
virtual ~QWindowSurface ()
 Destroys this surface. More...
 

Properties

QImage mImage
 

Additional Inherited Members

- Public Types inherited from QWindowSurface
enum  WindowSurfaceFeature { PartialUpdates = 0x00000001, PreservedContents = 0x00000002, StaticContents = 0x00000004, AllFeatures = 0xffffffff }
 
- Protected Functions inherited from QWindowSurface
bool hasStaticContents () const
 

Detailed Description

Definition at line 51 of file qminimalwindowsurface.h.

Constructors and Destructors

◆ QMinimalWindowSurface()

QMinimalWindowSurface::QMinimalWindowSurface ( QWidget window)

Definition at line 49 of file qminimalwindowsurface.cpp.

50  : QWindowSurface(window)
51 {
52  //qDebug() << "QMinimalWindowSurface::QMinimalWindowSurface:" << (long)this;
53 }
QWindowSurface(QWidget *window, bool setDefaultSurface=true)
Constructs an empty surface for the given top-level window.

◆ ~QMinimalWindowSurface()

QMinimalWindowSurface::~QMinimalWindowSurface ( )

Definition at line 55 of file qminimalwindowsurface.cpp.

56 {
57 }

Functions

◆ flush()

void QMinimalWindowSurface::flush ( QWidget widget,
const QRegion region,
const QPoint offset 
)
virtual

Flushes the given region from the specified widget onto the screen.

Note that the offset parameter is currently unused.

Implements QWindowSurface.

Definition at line 65 of file qminimalwindowsurface.cpp.

66 {
67  Q_UNUSED(widget);
68  Q_UNUSED(region);
69  Q_UNUSED(offset);
70 
71  static int c = 0;
72  QString filename = QString("output%1.png").arg(c++, 4, 10, QLatin1Char('0'));
73  qDebug() << "QMinimalWindowSurface::flush() saving contents to" << filename.toLocal8Bit().constData();
74  mImage.save(filename);
75 }
unsigned char c[8]
Definition: qnumeric_p.h:62
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...
Definition: qimage.cpp:5346
The QString class provides a Unicode character string.
Definition: qstring.h:83
Q_CORE_EXPORT void qDebug(const char *,...)
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4049
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ paintDevice()

QPaintDevice * QMinimalWindowSurface::paintDevice ( )
virtual

Implement this function to return the appropriate paint device.

Implements QWindowSurface.

Definition at line 59 of file qminimalwindowsurface.cpp.

60 {
61  //qDebug() << "QMinimalWindowSurface::paintDevice";
62  return &mImage;
63 }

◆ resize()

void QMinimalWindowSurface::resize ( const QSize size)

Definition at line 77 of file qminimalwindowsurface.cpp.

78 {
79  //qDebug() << "QMinimalWindowSurface::setGeometry:" << (long)this << rect;
80  QWindowSurface::resize(size);
81  QImage::Format format = QApplicationPrivate::platformIntegration()->screens().first()->format();
82  if (mImage.size() != size)
83  mImage = QImage(size, format);
84 }
Format
The following image formats are available in Qt.
Definition: qimage.h:91
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QSize size() const
Returns the size of the image, i.
Definition: qimage.cpp:1587

Properties

◆ mImage

QImage QMinimalWindowSurface::mImage
private

Definition at line 62 of file qminimalwindowsurface.h.

Referenced by flush(), paintDevice(), and resize().


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