Qt 4.8
Classes | Public Functions | Public Variables | List of all members
QWSRegionCommand Struct Reference

#include <qwscommand_qws_p.h>

Inheritance diagram for QWSRegionCommand:
QWSCommand QWSProtocolItem

Classes

struct  SimpleData
 

Public Functions

 QWSRegionCommand ()
 
void setData (const char *d, int len, bool allocateMem=true)
 
void setData (int id, const QString &key, const QByteArray &data, const QRegion &reg)
 
- Public Functions inherited from QWSCommand
 QWSCommand (int t, int len, char *ptr)
 
- Public Functions inherited from QWSProtocolItem
void copyFrom (const QWSProtocolItem *item)
 
 QWSProtocolItem (int t, int len, char *ptr)
 
bool read (QIODevice *s)
 
void write (QIODevice *s)
 
virtual ~QWSProtocolItem ()
 

Public Variables

QRegion region
 
struct QWSRegionCommand::SimpleData simpleData
 
QByteArray surfaceData
 
QString surfaceKey
 
- Public Variables inherited from QWSProtocolItem
int bytesRead
 
bool deleteRaw
 
char * rawDataPtr
 
int rawLen
 
char * simpleDataPtr
 
int simpleLen
 
int type
 

Additional Inherited Members

- Public Types inherited from QWSCommand
enum  Type {
  Unknown = 0, Create, Shutdown, Region,
  RegionMove, RegionDestroy, SetProperty, AddProperty,
  RemoveProperty, GetProperty, SetSelectionOwner, ConvertSelection,
  RequestFocus, ChangeAltitude, SetOpacity, DefineCursor,
  SelectCursor, PositionCursor, GrabMouse, PlaySound,
  QCopRegisterChannel, QCopSend, RegionName, Identify,
  GrabKeyboard, RepaintRegion, IMMouse, IMUpdate,
  IMResponse, Embed, Font, ScreenTransform
}
 
- Static Public Functions inherited from QWSCommand
static QWSCommandfactory (int type)
 

Detailed Description

Definition at line 248 of file qwscommand_qws_p.h.

Constructors and Destructors

◆ QWSRegionCommand()

QWSRegionCommand::QWSRegionCommand ( )
inline

Definition at line 250 of file qwscommand_qws_p.h.

250  :
252  reinterpret_cast<char*>(&simpleData)) {}
struct QWSRegionCommand::SimpleData simpleData
QWSCommand(int t, int len, char *ptr)

Functions

◆ setData() [1/2]

void QWSRegionCommand::setData ( const char *  d,
int  len,
bool  allocateMem = true 
)
inlinevirtual

Reimplemented from QWSProtocolItem.

Definition at line 254 of file qwscommand_qws_p.h.

Referenced by QWSDisplay::requestRegion().

254  {
255  QWSCommand::setData(d, len, allocateMem);
256 
257  if( simpleData.nrectangles * int(sizeof(QRect)) + simpleData.surfacekeylength * int(sizeof(QChar)) + simpleData.surfacedatalength * int(sizeof(char)) > len )
258  {
259  qWarning( "region command - rectangle count %d - surface key length %d - region data size %d - buffer size %d - buffer overrun!",
261  }
262  else
263  {
264  char *ptr = rawDataPtr;
265 
266  region.setRects(reinterpret_cast<QRect*>(ptr), simpleData.nrectangles);
267  ptr += simpleData.nrectangles * sizeof(QRect);
268 
269  surfaceKey = QString(reinterpret_cast<QChar*>(ptr),
271  ptr += simpleData.surfacekeylength * sizeof(QChar);
272 
274  }
275  }
double d
Definition: qnumeric_p.h:62
virtual void setData(const char *data, int len, bool allocateMem=true)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QByteArray surfaceData
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
Q_CORE_EXPORT void qWarning(const char *,...)
const T * ptr(const T &t)
void setRects(const QRect *rect, int num)
Sets the region using the array of rectangles specified by rects and number.
Definition: qregion.cpp:4424
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
struct QWSRegionCommand::SimpleData simpleData

◆ setData() [2/2]

void QWSRegionCommand::setData ( int  id,
const QString key,
const QByteArray data,
const QRegion reg 
)
inline

Definition at line 277 of file qwscommand_qws_p.h.

279  {
280  surfaceKey = key;
281  surfaceData = data;
282  region = reg;
283 
284  const QVector<QRect> rects = reg.rects();
285 
286  simpleData.windowid = id;
289  simpleData.nrectangles = rects.count();
290 
292  buffer.append(reinterpret_cast<const char*>(rects.constData()),
293  rects.count() * sizeof(QRect));
294  buffer.append(reinterpret_cast<const char*>(key.constData()),
295  key.size() * sizeof(QChar));
296  buffer.append(data, data.size());
297 
298  QWSCommand::setData(buffer.constData(), buffer.size(), true);
299  }
const T * constData() const
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
virtual void setData(const char *data, int len, bool allocateMem=true)
QByteArray surfaceData
void append(const T &t)
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
static const char * data(const QByteArray &arr)
int key
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402
const T * constData() const
Returns a const pointer to the data stored in the vector.
Definition: qvector.h:154
const QChar * constData() const
Returns a pointer to the data stored in the QString.
Definition: qstring.h:712
struct QWSRegionCommand::SimpleData simpleData
int size() const

Properties

◆ region

QRegion QWSRegionCommand::region

Definition at line 315 of file qwscommand_qws_p.h.

Referenced by QWSServerPrivate::invokeRegion().

◆ simpleData

struct QWSRegionCommand::SimpleData QWSRegionCommand::simpleData

◆ surfaceData

QByteArray QWSRegionCommand::surfaceData

Definition at line 314 of file qwscommand_qws_p.h.

Referenced by QWSServerPrivate::invokeRegion().

◆ surfaceKey

QString QWSRegionCommand::surfaceKey

Definition at line 313 of file qwscommand_qws_p.h.

Referenced by QWSServerPrivate::invokeRegion().


The documentation for this struct was generated from the following file: