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

#include <qwindowsurface_qws_p.h>

Inheritance diagram for QWSOnScreenSurface:
QWSMemorySurface QWSWindowSurface QWindowSurface

Public Functions

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...
 
QPoint painterOffset () const
 Returns the offset to be used when painting. More...
 
QByteArray permanentState () const
 Implement this function to return the data required for creating a server-side representation of the surface. More...
 
 QWSOnScreenSurface ()
 
 QWSOnScreenSurface (QWidget *widget)
 
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...
 
 ~QWSOnScreenSurface ()
 
- Public Functions inherited from QWSMemorySurface
void beginPaint (const QRegion &rgn)
 This function is called before painting onto the surface begins, with the region in which the painting will occur. More...
 
QImage image () const
 Implement this function to return an image of the top-level window. More...
 
bool lock (int timeout=-1)
 
QPaintDevicepaintDevice ()
 Implement this function to return the appropriate paint device. More...
 
 QWSMemorySurface ()
 
 QWSMemorySurface (QWidget *widget)
 
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 unlock ()
 
 ~QWSMemorySurface ()
 
- Public Functions inherited from QWSWindowSurface
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...
 
virtual void flush (QWidget *widget, const QRegion &region, const QPoint &offset)
 Flushes the given region from the specified widget onto the screen. 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 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...
 
 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
 
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...
 
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...
 

Private Functions

void attachToScreen (const QScreen *screen)
 

Properties

const QScreenscreen
 

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 QWSMemorySurface
QImage::Format preferredImageFormat (const QWidget *widget) const
 
void setLock (int lockId)
 
- 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
 
- Protected Variables inherited from QWSMemorySurface
QImage img
 
QWSLockmemlock
 
QMutex threadLock
 

Detailed Description

Definition at line 246 of file qwindowsurface_qws_p.h.

Constructors and Destructors

◆ QWSOnScreenSurface() [1/2]

QWSOnScreenSurface::QWSOnScreenSurface ( )

Definition at line 1225 of file qwindowsurface_qws.cpp.

1226  : QWSMemorySurface()
1227 {
1229 }
void setSurfaceFlags(SurfaceFlags type)
Sets the surface flags describing the contents of this surface, to be the given flags.

◆ QWSOnScreenSurface() [2/2]

QWSOnScreenSurface::QWSOnScreenSurface ( QWidget widget)

Definition at line 1218 of file qwindowsurface_qws.cpp.

1219  : QWSMemorySurface(w)
1220 {
1223 }
static QScreen * getScreen(const QWidget *w)
void attachToScreen(const QScreen *screen)
void setSurfaceFlags(SurfaceFlags type)
Sets the surface flags describing the contents of this surface, to be the given flags.

◆ ~QWSOnScreenSurface()

QWSOnScreenSurface::~QWSOnScreenSurface ( )

Definition at line 1247 of file qwindowsurface_qws.cpp.

1248 {
1249 }

Functions

◆ attachToScreen()

void QWSOnScreenSurface::attachToScreen ( const QScreen screen)
private

Definition at line 1231 of file qwindowsurface_qws.cpp.

Referenced by QWSOnScreenSurface(), and setPermanentState().

1232 {
1233  screen = s;
1234  uchar *base = screen->base();
1235  QImage::Format format = screen->pixelFormat();
1236 
1237  if (format == QImage::Format_Invalid || format == QImage::Format_Indexed8) {
1238  //### currently we have no paint engine for indexed image formats
1239  qFatal("QWSOnScreenSurface::attachToScreen(): screen depth %d "
1240  "not implemented", screen->depth());
1241  return;
1242  }
1243  QWSMemorySurface::img = QImage(base, screen->width(), screen->height(),
1244  screen->linestep(), format );
1245 }
Format
The following image formats are available in Qt.
Definition: qimage.h:91
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
static const uint base
Definition: qurl.cpp:268
unsigned char uchar
Definition: qglobal.h:994
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
int linestep() const
Returns the length of each scanline of the framebuffer in bytes.
Definition: qscreen_qws.h:232
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
uchar * base() const
Returns a pointer to the beginning of the framebuffer.
Definition: qscreen_qws.h:235
Q_CORE_EXPORT void qFatal(const char *,...)
QImage::Format pixelFormat() const
Returns the pixel format of the screen, or QImage::Format_Invalid if the pixel format is not a suppor...
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
Definition: qscreen_qws.h:229

◆ isValid()

bool QWSOnScreenSurface::isValid ( ) const
virtual

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()

Reimplemented from QWSMemorySurface.

Definition at line 1256 of file qwindowsurface_qws.cpp.

1257 {
1258  const QWidget *win = window();
1259  if (screen != getScreen(win))
1260  return false;
1261  if (img.isNull())
1262  return false;
1263  return QScreen::isWidgetPaintOnScreen(win);
1264 }
static QScreen * getScreen(const QWidget *w)
bool isNull() const
Returns true if it is a null image, otherwise returns false.
Definition: qimage.cpp:1542
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
static bool isWidgetPaintOnScreen(const QWidget *w)
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

◆ key()

QString QWSOnScreenSurface::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 256 of file qwindowsurface_qws_p.h.

256 { return QLatin1String("OnScreen"); }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString

◆ painterOffset()

QPoint QWSOnScreenSurface::painterOffset ( ) const
virtual

Returns the offset to be used when painting.

See also
paintDevice()

Reimplemented from QWSMemorySurface.

Definition at line 1251 of file qwindowsurface_qws.cpp.

1252 {
1254 }
QRect geometry() const
Returns the currently allocated area on the screen.
virtual QPoint painterOffset() const
Returns the offset to be used when painting.
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ permanentState()

QByteArray QWSOnScreenSurface::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 1266 of file qwindowsurface_qws.cpp.

1267 {
1268  QByteArray array(sizeof(int), Qt::Uninitialized);
1269 
1270  int *ptr = reinterpret_cast<int*>(array.data());
1271  ptr[0] = QApplication::desktop()->screenNumber(window());
1272  return array;
1273 }
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
const T * ptr(const T &t)
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
int screenNumber(const QWidget *widget=0) const
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

◆ setPermanentState()

void QWSOnScreenSurface::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 1275 of file qwindowsurface_qws.cpp.

1276 {
1277  const int *ptr = reinterpret_cast<const int*>(data.constData());
1278  const int screenNo = ptr[0];
1279 
1281  if (screenNo > 0)
1282  screen = qt_screen->subScreens().at(screenNo);
1283  attachToScreen(screen);
1284 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
void attachToScreen(const QScreen *screen)
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
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
virtual QList< QScreen * > subScreens() const
Definition: qscreen_qws.h:283
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191

Properties

◆ screen

const QScreen* QWSOnScreenSurface::screen
private

Definition at line 264 of file qwindowsurface_qws_p.h.

Referenced by attachToScreen(), isValid(), and setPermanentState().


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