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

#include <qwindowsurface_qws_p.h>

Inheritance diagram for QWSYellowSurface:
QWSWindowSurface 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...
 
QImage image () const
 Implement this function to return an image of the top-level window. More...
 
bool isValid () const
 Implement this function to return true if the surface is a valid surface for the given top-level window; otherwise return false. More...
 
QString key () const
 Implement this function to return a string that uniquely identifies the class of this surface. More...
 
QPaintDevicepaintDevice ()
 Implement this function to return the appropriate paint device. More...
 
QByteArray permanentState () const
 Implement this function to return the data required for creating a server-side representation of the surface. More...
 
 QWSYellowSurface (bool isClient=false)
 
void setDelay (int msec)
 
void setPermanentState (const QByteArray &data)
 Implement this function to attach a server-side surface instance to the corresponding client side instance using the given data. More...
 
 ~QWSYellowSurface ()
 
- Public Functions inherited from QWSWindowSurface
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...
 
const QRegion clipRegion () const
 Returns the region currently visible on the screen. 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...
 
bool isBuffered () const
 Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false. More...
 
bool isOpaque () const
 Returns true if the QWSWindowSurface::Opaque is set; otherwise returns false. More...
 
bool isRegionReserved () const
 Returns true if the QWSWindowSurface::RegionReserved is set; otherwise returns false. More...
 
virtual bool lock (int timeout=-1)
 
virtual bool move (const QPoint &offset)
 Move the surface with the given offset. More...
 
virtual QRegion move (const QPoint &offset, const QRegion &newClip)
 Move the surface with the given offset. More...
 
virtual QPoint painterOffset () const
 Returns the offset to be used when painting. More...
 
 QWSWindowSurface ()
 Constructs an empty surface. More...
 
 QWSWindowSurface (QWidget *widget)
 Constructs an empty surface for the given top-level widget. More...
 
virtual void releaseSurface ()
 
void setClipRegion (const QRegion &)
 Sets the region currently visible on the screen to be the given clip region. More...
 
virtual void setGeometry (const QRect &rect)
 Sets the currently allocated area to be the given rect. More...
 
virtual void setGeometry (const QRect &rect, const QRegion &mask)
 
virtual void setTransientState (const QByteArray &state)
 
SurfaceFlags surfaceFlags () const
 Returns the surface flags describing the contents of this surface. More...
 
virtual QByteArray transientState () const
 
virtual void unlock ()
 
int winId () const
 
 ~QWSWindowSurface ()
 
- Public Functions inherited from QWindowSurface
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 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...
 
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

int delay
 
QImage img
 
QSize surfaceSize
 

Additional Inherited Members

- Public Types inherited from QWSWindowSurface
enum  SurfaceFlag { RegionReserved = 0x1, Buffered = 0x2, Opaque = 0x4 }
 This enum is used to describe the window surface's contents. More...
 
- Public Types inherited from QWindowSurface
enum  WindowSurfaceFeature { PartialUpdates = 0x00000001, PreservedContents = 0x00000002, StaticContents = 0x00000004, AllFeatures = 0xffffffff }
 
- Protected Functions inherited from QWSWindowSurface
void setSurfaceFlags (SurfaceFlags type)
 Sets the surface flags describing the contents of this surface, to be the given flags. More...
 
void setWinId (int id)
 
- Protected Functions inherited from QWindowSurface
bool hasStaticContents () const
 

Detailed Description

Definition at line 269 of file qwindowsurface_qws_p.h.

Constructors and Destructors

◆ QWSYellowSurface()

QWSYellowSurface::QWSYellowSurface ( bool  isClient = false)

Definition at line 1290 of file qwindowsurface_qws.cpp.

1291  : QWSWindowSurface(), delay(10)
1292 {
1293  if (isClient) {
1294  setWinId(QWidget::qwsDisplay()->takeId());
1296  QLatin1String("Debug flush paint"),
1297  QLatin1String("Silly yellow thing"));
1298  QWidget::qwsDisplay()->setAltitude(winId(), 1, true);
1299  }
1301 }
void nameRegion(int winId, const QString &n, const QString &c)
void setAltitude(int winId, int altitude, bool fixed=false)
static QWSDisplay * qwsDisplay()
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void setSurfaceFlags(SurfaceFlags type)
Sets the surface flags describing the contents of this surface, to be the given flags.
QWSWindowSurface()
Constructs an empty surface.

◆ ~QWSYellowSurface()

QWSYellowSurface::~QWSYellowSurface ( )

Definition at line 1303 of file qwindowsurface_qws.cpp.

1304 {
1305 }

Functions

◆ flush()

void QWSYellowSurface::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.

Reimplemented from QWSWindowSurface.

Definition at line 1329 of file qwindowsurface_qws.cpp.

Referenced by flushUpdate(), and QWidgetBackingStore::showYellowThing().

1331 {
1332  Q_UNUSED(offset);
1333 
1335  QRegion rgn = region;
1336 
1337  if (widget)
1338  rgn.translate(widget->mapToGlobal(QPoint(0, 0)));
1339 
1340  surfaceSize = region.boundingRect().size();
1341 
1342  const int id = winId();
1343  display->requestRegion(id, key(), permanentState(), rgn);
1344  display->setAltitude(id, 1, true);
1345  display->repaintRegion(id, 0, false, rgn);
1346 
1347  ::usleep(500 * delay);
1348  display->requestRegion(id, key(), permanentState(), QRegion());
1349  ::usleep(500 * delay);
1350 }
The QWSDisplay class provides a display for QWS; it is an internal class.
void setAltitude(int winId, int altitude, bool fixed=false)
static QWSDisplay * qwsDisplay()
void repaintRegion(int winId, int windowFlags, bool opaque, QRegion)
QString key() const
Implement this function to return a string that uniquely identifies the class of this surface...
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
void requestRegion(int winId, const QString &surfacekey, const QByteArray &surfaceData, const QRegion &region)
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
QByteArray permanentState() const
Implement this function to return the data required for creating a server-side representation of the ...
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
Definition: qregion.cpp:4116
#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
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.

◆ image()

QImage QWSYellowSurface::image ( ) const
inlinevirtual

Implement this function to return an image of the top-level window.

See also
geometry()

Implements QWSWindowSurface.

Definition at line 287 of file qwindowsurface_qws_p.h.

287 { return img; }

◆ isValid()

bool QWSYellowSurface::isValid ( ) const
inlinevirtual

Implement this function to return true if the surface is a valid surface for the given top-level window; otherwise return false.

Since
4.3
See also
window(), key()

Implements QWSWindowSurface.

Definition at line 277 of file qwindowsurface_qws_p.h.

277 { return true; }

◆ key()

QString QWSYellowSurface::key ( ) const
inlinevirtual

Implement this function to return a string that uniquely identifies the class of this surface.

See also
window(), isValid()

Implements QWSWindowSurface.

Definition at line 281 of file qwindowsurface_qws_p.h.

Referenced by flush().

281 { return QLatin1String("Yellow"); }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString

◆ paintDevice()

QPaintDevice* QWSYellowSurface::paintDevice ( )
inlinevirtual

Implement this function to return the appropriate paint device.

Implements QWSWindowSurface.

Definition at line 286 of file qwindowsurface_qws_p.h.

286 { return &img; }

◆ permanentState()

QByteArray QWSYellowSurface::permanentState ( ) const
virtual

Implement this function to return the data required for creating a server-side representation of the surface.

Since
4.3
See also
attach()

Reimplemented from QWSWindowSurface.

Definition at line 1307 of file qwindowsurface_qws.cpp.

Referenced by flush().

1308 {
1309  QByteArray array(2 * sizeof(int), Qt::Uninitialized);
1310 
1311  int *ptr = reinterpret_cast<int*>(array.data());
1312  ptr[0] = surfaceSize.width();
1313  ptr[1] = surfaceSize.height();
1314 
1315  return array;
1316 }
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
int width() const
Returns the width.
Definition: qsize.h:126
const T * ptr(const T &t)
int height() const
Returns the height.
Definition: qsize.h:129

◆ setDelay()

void QWSYellowSurface::setDelay ( int  msec)
inline

Definition at line 275 of file qwindowsurface_qws_p.h.

Referenced by flushUpdate(), and QWidgetBackingStore::showYellowThing().

275 { delay = msec; }

◆ setPermanentState()

void QWSYellowSurface::setPermanentState ( const QByteArray data)
virtual

Implement this function to attach a server-side surface instance to the corresponding client side instance using the given data.

Since
4.3

Return true if successful; otherwise return false.

See also
data()

Reimplemented from QWSWindowSurface.

Definition at line 1318 of file qwindowsurface_qws.cpp.

1319 {
1320  const int *ptr = reinterpret_cast<const int*>(data.constData());
1321 
1322  const int width = ptr[0];
1323  const int height = ptr[1];
1324 
1325  img = QImage(width, height, QImage::Format_ARGB32);
1326  img.fill(qRgba(255,255,31,127));
1327 }
void fill(uint pixel)
Fills the entire image with the given pixelValue.
Definition: qimage.cpp:2032
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
Definition: qrgb.h:72
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
const T * ptr(const T &t)
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

Properties

◆ delay

int QWSYellowSurface::delay
private

Definition at line 290 of file qwindowsurface_qws_p.h.

Referenced by flush().

◆ img

QImage QWSYellowSurface::img
private

Definition at line 292 of file qwindowsurface_qws_p.h.

◆ surfaceSize

QSize QWSYellowSurface::surfaceSize
private

Definition at line 291 of file qwindowsurface_qws_p.h.

Referenced by flush(), and permanentState().


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