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

#include <qscreenvnc_p.h>

Inheritance diagram for QVNCClientCursor:
QProxyScreenCursor QScreenCursor

Public Functions

 QVNCClientCursor (QVNCServer *s)
 
void set (const QImage &image, int hotx, int hoty)
 Reimplemented Function More...
 
void write () const
 
 ~QVNCClientCursor ()
 
- Public Functions inherited from QProxyScreenCursor
void hide ()
 Reimplemented Function More...
 
void move (int x, int y)
 Reimplemented Function More...
 
 QProxyScreenCursor ()
 Constructs a proxy screen cursor. More...
 
QScreenCursorscreenCursor () const
 Returns the real screen cursor used by the proxy screen cursor. More...
 
void setScreenCursor (QScreenCursor *cursor)
 Sets the real screen cursor to be used for the proxy screen cursor to the cursor specified. More...
 
void show ()
 Reimplemented Function More...
 
 ~QProxyScreenCursor ()
 Destroys the proxy screen cursor. More...
 
- Public Functions inherited from QScreenCursor
QRect boundingRect () const
 Returns the cursor's bounding rectangle. More...
 
QImage image () const
 Returns the cursor's image. More...
 
bool isAccelerated () const
 Returns true if the cursor is accelerated; otherwise false. More...
 
bool isVisible () const
 Returns true if the cursor is visible; otherwise false. More...
 
 QScreenCursor ()
 Constructs a screen cursor. More...
 
bool supportsAlphaCursor () const
 
virtual ~QScreenCursor ()
 Destroys the screen cursor. More...
 

Properties

QVNCServerserver
 

Additional Inherited Members

- Static Public Functions inherited from QScreenCursor
static bool enabled ()
 
static void initSoftwareCursor ()
 Initializes the screen cursor. More...
 
static QScreenCursorinstance ()
 
- Protected Variables inherited from QScreenCursor
QImage cursor
 
uint enable: 1
 
QPoint hotspot
 
uint hwaccel: 1
 
QPoint pos
 
QSize size
 
uint supportsAlpha: 1
 

Detailed Description

Definition at line 86 of file qscreenvnc_p.h.

Constructors and Destructors

◆ QVNCClientCursor()

QVNCClientCursor::QVNCClientCursor ( QVNCServer s)

Definition at line 133 of file qscreenvnc_qws.cpp.

134  : server(s)
135 {
137  Q_ASSERT(hwaccel);
138  qt_screencursor = this; // hw: XXX
139 
140  set(image(), hotspot.x(), hotspot.y());
141 }
void setScreenCursor(QScreenCursor *cursor)
Sets the real screen cursor to be used for the proxy screen cursor to the cursor specified.
QPoint hotspot
Definition: qscreen_qws.h:163
QVNCServer * server
Definition: qscreenvnc_p.h:96
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QImage image() const
Returns the cursor&#39;s image.
Definition: qscreen_qws.h:151
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
Q_GUI_EXPORT QScreenCursor * qt_screencursor
Definition: qscreen_qws.cpp:67

◆ ~QVNCClientCursor()

QVNCClientCursor::~QVNCClientCursor ( )

Definition at line 143 of file qscreenvnc_qws.cpp.

144 {
146 }
QScreenCursor * screenCursor() const
Returns the real screen cursor used by the proxy screen cursor.
Q_GUI_EXPORT QScreenCursor * qt_screencursor
Definition: qscreen_qws.cpp:67

Functions

◆ set()

void QVNCClientCursor::set ( const QImage image,
int  hotx,
int  hoty 
)
virtual

Reimplemented Function

Reimplemented from QProxyScreenCursor.

Definition at line 148 of file qscreenvnc_qws.cpp.

149 {
150  QScreenCursor::set(image, hotx, hoty);
152 }
QVNCServer * server
Definition: qscreenvnc_p.h:96
void setDirtyCursor()
Definition: qscreenvnc_p.h:440
virtual void set(const QImage &image, int hotx, int hoty)
Sets the cursor&#39;s image to be the given image.

◆ write()

void QVNCClientCursor::write ( ) const

Definition at line 154 of file qscreenvnc_qws.cpp.

155 {
156  QTcpSocket *socket = server->clientSocket();
157 
158  // FramebufferUpdate header
159  {
160  const quint16 tmp[6] = { htons(0),
161  htons(1),
162  htons(hotspot.x()), htons(hotspot.y()),
163  htons(cursor.width()),
164  htons(cursor.height()) };
165  socket->write((char*)tmp, sizeof(tmp));
166 
167  const quint32 encoding = htonl(-239);
168  socket->write((char*)(&encoding), sizeof(encoding));
169  }
170 
171  if (cursor.isNull())
172  return;
173 
174  // write pixels
177  const int n = server->clientBytesPerPixel() * img.width();
178  char *buffer = new char[n];
179  for (int i = 0; i < img.height(); ++i) {
180  server->convertPixels(buffer, (const char*)img.scanLine(i), img.width());
181  socket->write(buffer, n);
182  }
183  delete[] buffer;
184 
185  // write mask
187  Q_ASSERT(bitmap.depth() == 1);
188  Q_ASSERT(bitmap.size() == img.size());
189  const int width = (bitmap.width() + 7) / 8;
190  for (int i = 0; i < bitmap.height(); ++i)
191  socket->write((const char*)bitmap.scanLine(i), width);
192 }
void convertPixels(char *dst, const char *src, int count) const
bool isNull() const
Returns true if it is a null image, otherwise returns false.
Definition: qimage.cpp:1542
QPoint hotspot
Definition: qscreen_qws.h:163
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
Definition: qimage.cpp:6495
QVNCServer * server
Definition: qscreenvnc_p.h:96
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QVNCScreen * screen() const
Definition: qscreenvnc_p.h:461
unsigned short quint16
Definition: qglobal.h:936
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QImage createAlphaMask(Qt::ImageConversionFlags flags=Qt::AutoColor) const
Builds and returns a 1-bpp mask from the alpha buffer in this image.
Definition: qimage.cpp:4720
The QTcpSocket class provides a TCP socket.
Definition: qtcpsocket.h:56
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
QSize size() const
Returns the size of the image, i.
Definition: qimage.cpp:1587
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
Definition: qimage.cpp:3966
QTcpSocket * clientSocket() const
Definition: qscreenvnc_p.h:463
QImage::Format pixelFormat() const
Returns the pixel format of the screen, or QImage::Format_Invalid if the pixel format is not a suppor...
unsigned int quint32
Definition: qglobal.h:938
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
Definition: qiodevice.cpp:1342
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
Definition: qimage.cpp:1886
int clientBytesPerPixel() const
Definition: qscreenvnc_p.h:457

Properties

◆ server

QVNCServer* QVNCClientCursor::server
private

Definition at line 96 of file qscreenvnc_p.h.

Referenced by set(), and write().


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