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

The QVFbScreen class implements a screen driver for the virtual framebuffer. More...

#include <qscreenvfb_qws.h>

Inheritance diagram for QVFbScreen:
QPlatformScreen QScreen QObject

Public Functions

virtual void blank (bool)
 Prevents the screen driver form displaying any content on the screen. More...
 
virtual bool connect (const QString &displaySpec)
 Reimplemented Function More...
 
int depth () const
 Reimplement in subclass to return current depth of the screen. More...
 
virtual void disconnect ()
 Reimplemented Function More...
 
QImage::Format format () const
 Reimplement in subclass to return the image format which corresponds to the screen format. More...
 
QRect geometry () const
 Reimplement in subclass to return the pixel geometry of the screen. More...
 
virtual bool initDevice ()
 Reimplemented Function More...
 
QSize physicalSize () const
 Reimplement this function in subclass to return the physical size of the screen. More...
 
 QVFbScreen (int id)
 
 QVFbScreen (int display_id)
 Constructs a QVNCScreen object. More...
 
virtual void restore ()
 Reimplemented Function More...
 
virtual void save ()
 Reimplemented Function More...
 
QImagescreenImage ()
 
void setDirty (const QRect &rect)
 Marks the given rectangle as dirty. More...
 
virtual void setDirty (const QRect &r)
 Reimplemented Function More...
 
virtual void setMode (int nw, int nh, int nd)
 Reimplemented Function More...
 
virtual void shutdownDevice ()
 Reimplemented Function More...
 
 ~QVFbScreen ()
 
virtual ~QVFbScreen ()
 Destroys this QVFbScreen object. More...
 
- Public Functions inherited from QPlatformScreen
virtual QRect availableGeometry () const
 Reimplement in subclass to return the pixel geometry of the available space This normally is the desktop screen minus the task manager, global menubar etc. More...
 
virtual QWidgettopLevelAt (const QPoint &point) const
 Return the given top level widget for a given position. More...
 
virtual ~QPlatformScreen ()
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 
- Public Functions inherited from QScreen
virtual int alloc (unsigned int, unsigned int, unsigned int)
 Returns the index in the screen's palette which is the closest match to the given RGB value (red, green, blue). More...
 
ucharbase () const
 Returns a pointer to the beginning of the framebuffer. More...
 
virtual void blit (const QImage &img, const QPoint &topLeft, const QRegion &region)
 Copies the given region in the given image to the point specified by topLeft using device coordinates. More...
 
void blit (QWSWindow *bs, const QRegion &clip)
 
virtual ucharcache (int)
 
ClassId classId () const
 Returns the class identifier for the screen object. More...
 
QRgbclut ()
 Returns a pointer to the screen's color lookup table (i. More...
 
int colorCount ()
 Returns the number of entries in the screen's color lookup table (i. More...
 
virtual QWSWindowSurfacecreateSurface (QWidget *widget) const
 Creates and returns a new window surface for the given widget. More...
 
virtual QWSWindowSurfacecreateSurface (const QString &key) const
 Creates and returns a new window surface matching the given key. More...
 
int depth () const
 Returns the depth of the framebuffer, in bits per pixel. More...
 
int deviceHeight () const
 Returns the full height of the framebuffer device in pixels. More...
 
int deviceWidth () const
 Returns the physical width of the framebuffer device in pixels. More...
 
virtual void exposeRegion (QRegion r, int changing)
 This function is called by the Qt for Embedded Linux server whenever a screen update is required. More...
 
QGraphicsSystemgraphicsSystem () const
 
virtual void haltUpdates ()
 
int height () const
 Returns the logical height of the framebuffer in pixels. More...
 
virtual bool isInterlaced () const
 Returns true if the display is interlaced (i. More...
 
virtual bool isTransformed () const
 Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false. More...
 
int linestep () const
 Returns the length of each scanline of the framebuffer in bytes. More...
 
virtual QSize mapFromDevice (const QSize &) const
 Maps the given size from the framebuffer coordinate system to the coordinate space used by the application. More...
 
virtual QPoint mapFromDevice (const QPoint &, const QSize &) const
 Maps the given point from the framebuffer coordinate system to the coordinate space used by the application, passing the device's screenSize as argument. More...
 
virtual QRect mapFromDevice (const QRect &, const QSize &) const
 Maps the given rectangle from the framebuffer coordinate system to the coordinate space used by the application, passing the device's screenSize as argument. More...
 
virtual QImage mapFromDevice (const QImage &) const
 Maps the given image from the framebuffer coordinate system to the coordinate space used by the application. More...
 
virtual QRegion mapFromDevice (const QRegion &, const QSize &) const
 Maps the given region from the framebuffer coordinate system to the coordinate space used by the application, passing the device's screenSize as argument. More...
 
virtual QSize mapToDevice (const QSize &) const
 Maps the given size from the coordinate space used by the application to the framebuffer coordinate system. More...
 
virtual QPoint mapToDevice (const QPoint &, const QSize &) const
 Maps the given point from the coordinate space used by the application to the framebuffer coordinate system, passing the device's screenSize as argument. More...
 
virtual QRect mapToDevice (const QRect &, const QSize &) const
 Maps the given rectangle from the coordinate space used by the application to the framebuffer coordinate system, passing the device's screenSize as argument. More...
 
virtual QImage mapToDevice (const QImage &) const
 Maps the given image from the coordinate space used by the application to the framebuffer coordinate system. More...
 
virtual QRegion mapToDevice (const QRegion &, const QSize &) const
 Maps the given region from the coordinate space used by the application to the framebuffer coordinate system, passing the device's screenSize as argument. More...
 
virtual int memoryNeeded (const QString &)
 
QT_DEPRECATED int numCols ()
 
QPoint offset () const
 Returns the logical offset of the screen, i. More...
 
virtual bool onCard (const unsigned char *) const
 Returns true if the specified buffer is within the graphics card's memory; otherwise returns false (i.e. More...
 
virtual bool onCard (const unsigned char *, ulong &out_offset) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.If the specified buffer is within the graphics card's memory, this function stores the offset from the start of graphics card memory (in bytes), in the location specified by the offset parameter. More...
 
int physicalHeight () const
 Returns the physical height of the screen in millimeters. More...
 
int physicalWidth () const
 Returns the physical width of the screen in millimeters. More...
 
QImage::Format pixelFormat () const
 Returns the pixel format of the screen, or QImage::Format_Invalid if the pixel format is not a supported image format. More...
 
PixelType pixelType () const
 Returns the pixel storage format of the screen. More...
 
QPixmapDataFactorypixmapDataFactory () const
 
virtual int pixmapDepth () const
 Returns the preferred depth for pixmaps, in bits per pixel. More...
 
virtual int pixmapLinestepAlignment ()
 Returns the value (in bits) to which individual scanlines of pixmaps held in the graphics card's memory, should be aligned. More...
 
virtual int pixmapOffsetAlignment ()
 Returns the value (in bits) to which the start address of pixmaps held in the graphics card's memory, should be aligned. More...
 
 QScreen (int display_id, ClassId classId)
 Constructs a new screen driver. More...
 
 QScreen (int display_id)
 Constructs a new screen driver. More...
 
virtual QRegion region () const
 Returns the region covered by this screen driver. More...
 
virtual void resumeUpdates ()
 
int screenSize () const
 Returns the size of the screen in bytes. More...
 
virtual void set (unsigned int, unsigned int, unsigned int, unsigned int)
 
void setOffset (const QPoint &p)
 
virtual int sharedRamSize (void *)
 
virtual void solidFill (const QColor &color, const QRegion &region)
 Fills the given region of the screen with the specified color. More...
 
int subScreenIndexAt (const QPoint &p) const
 Returns the index of the subscreen at the given position; returns -1 if no screen is found. More...
 
virtual QList< QScreen * > subScreens () const
 
virtual bool supportsDepth (int) const
 Returns true if the screen supports the specified color depth; otherwise returns false. More...
 
int totalSize () const
 Returns the size of the available graphics card memory (including the screen) in bytes. More...
 
virtual int transformOrientation () const
 Returns the current rotation as an integer value. More...
 
virtual void uncache (uchar *)
 
int width () const
 Returns the logical width of the framebuffer in pixels. More...
 
virtual ~QScreen ()
 Destroys this screen driver. More...
 

Properties

QVFbScreenPrivated_ptr
 

Additional Inherited Members

- Public Types inherited from QScreen
enum  ClassId {
  LinuxFBClass, TransformedClass, VNCClass, MultiClass,
  VFbClass, DirectFBClass, SvgalibClass, ProxyClass,
  GLClass, IntfbClass, CustomClass = 1024
}
 This enum defines the class identifiers for the known screen subclasses. More...
 
enum  PixelType { NormalPixel, BGRPixel }
 This enum describes the pixel storage format of the screen, i. More...
 
- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Static Public Functions inherited from QPlatformScreen
static QPlatformScreenplatformScreenForWidget (const QWidget *widget)
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Functions inherited from QScreen
static QScreeninstance ()
 Returns a pointer to the application's QScreen instance. More...
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Functions inherited from QScreen
void setGraphicsSystem (QGraphicsSystem *system)
 
void setPixelFormat (QImage::Format format)
 Sets the screen's pixel format to format. More...
 
void setPixmapDataFactory (QPixmapDataFactory *factory)
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Protected Variables inherited from QScreen
int d
 the pixel depth More...
 
uchardata
 points to the first visible pixel in the frame buffer. More...
 
int dh
 the device height More...
 
int displayId
 
int dw
 the device width More...
 
QPoolEntryentries
 
int * entryp
 
bool grayscale
 the gray scale screen mode flag More...
 
int h
 the logical height of the screen. More...
 
unsigned int * lowest
 
int lstep
 the number of bytes representing a line in the frame buffer. More...
 
int mapsize
 the total number of bytes in the frame buffer More...
 
int physHeight
 the physical height of the screen in millimeters. More...
 
int physWidth
 the physical width of the screen in millimeters. More...
 
PixelType pixeltype
 set to BGRPixel More...
 
QRgb screenclut [256]
 the color table More...
 
int screencols
 the number of entries in the color table More...
 
int size
 the number of bytes in the visible region of the frame buffer More...
 
int w
 the logical width of the screen. More...
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 
- Static Protected Variables inherited from QScreen
static ClearCacheFunc clearCacheFunc = 0
 

Detailed Description

The QVFbScreen class implements a screen driver for the virtual framebuffer.

Warning
This function is not part of the public interface.

Note that this class is only available in Qt for Embedded Linux. Custom screen drivers can be added by subclassing the QScreenDriverPlugin class, using the QScreenDriverFactory class to dynamically load the driver into the application, but there should only be one screen object per application.

The Qt for Embedded Linux platform provides a The Virtual Framebuffer{virtual framebuffer} for development and debugging; the virtual framebuffer allows Qt for Embedded Linux applications to be developed on a desktop machine, without switching between consoles and X11.

See also
QScreen, QScreenDriverPlugin, {Running Applications}

Definition at line 58 of file qscreenvfb_qws.h.

Constructors and Destructors

◆ QVFbScreen() [1/2]

QVFbScreen::QVFbScreen ( int  displayId)
explicit

Constructs a QVNCScreen object.

The displayId argument identifies the Qt for Embedded Linux server to connect to.

Definition at line 181 of file qscreenvfb_qws.cpp.

Referenced by QVFbScreenPrivate::disconnect().

182  : QScreen(display_id, VFbClass), d_ptr(new QVFbScreenPrivate)
183 {
184  d_ptr->shmrgn = 0;
185  d_ptr->hdr = 0;
186  data = 0;
187 }
QVFbScreenPrivate * d_ptr
uchar * data
points to the first visible pixel in the frame buffer.
Definition: qscreen_qws.h:311
unsigned char * shmrgn
QScreen(int display_id, ClassId classId)
Constructs a new screen driver.

◆ ~QVFbScreen() [1/2]

QVFbScreen::~QVFbScreen ( )
virtual

Destroys this QVFbScreen object.

Definition at line 192 of file qscreenvfb_qws.cpp.

Referenced by QVFbScreenPrivate::disconnect().

193 {
194  delete d_ptr;
195 }
QVFbScreenPrivate * d_ptr

◆ QVFbScreen() [2/2]

QVFbScreen::QVFbScreen ( int  id)

◆ ~QVFbScreen() [2/2]

QVFbScreen::~QVFbScreen ( )

Functions

◆ blank()

void QVFbScreen::blank ( bool  on)
virtual

Prevents the screen driver form displaying any content on the screen.

Note that the default implementation does nothing.

Reimplement this function to prevent the screen driver from displaying any contents on the screen if on is true; otherwise the contents is expected to be shown.

See also
blit()

Reimplemented from QScreen.

Definition at line 443 of file qscreenvfb_qws.cpp.

444 {
445  d_ptr->blank = on;
446  setBrightness(connected->d_ptr->brightness);
447 }
QVFbScreenPrivate * d_ptr
static QVFbScreen * connected

◆ connect()

bool QVFbScreen::connect ( const QString displaySpec)
virtual

Reimplemented Function

Implements QScreen.

Definition at line 199 of file qscreenvfb_qws.cpp.

200 {
201  QStringList displayArgs = displaySpec.split(QLatin1Char(':'));
202  if (displayArgs.contains(QLatin1String("Gray")))
203  grayscale = true;
204 
205  key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLocal8Bit(), 'b');
206 
207  if (key == -1)
208  return false;
209 
210 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
211 #ifndef QT_QWS_FRAMEBUFFER_LITTLE_ENDIAN
212  if (displayArgs.contains(QLatin1String("littleendian")))
213 #endif
215 #endif
216 
217  int shmId = shmget(key, 0, 0);
218  if (shmId != -1)
219  d_ptr->shmrgn = (unsigned char *)shmat(shmId, 0, 0);
220  else
221  return false;
222 
223  if ((long)d_ptr->shmrgn == -1 || d_ptr->shmrgn == 0) {
224  qDebug("No shmrgn %ld", (long)d_ptr->shmrgn);
225  return false;
226  }
227 
230 
231  dw = w = d_ptr->hdr->width;
232  dh = h = d_ptr->hdr->height;
233  d = d_ptr->hdr->depth;
234 
235  switch (d) {
236  case 1:
238  break;
239  case 8:
241  break;
242  case 12:
244  break;
245  case 15:
247  break;
248  case 16:
250  break;
251  case 18:
253  break;
254  case 24:
256  break;
257  case 32:
259  break;
260  }
261 
262  lstep = d_ptr->hdr->linestep;
263 
264  // Handle display physical size spec.
265  int dimIdxW = -1;
266  int dimIdxH = -1;
267  for (int i = 0; i < displayArgs.size(); ++i) {
268  if (displayArgs.at(i).startsWith(QLatin1String("mmWidth"))) {
269  dimIdxW = i;
270  break;
271  }
272  }
273  for (int i = 0; i < displayArgs.size(); ++i) {
274  if (displayArgs.at(i).startsWith(QLatin1String("mmHeight"))) {
275  dimIdxH = i;
276  break;
277  }
278  }
279  if (dimIdxW >= 0) {
280  bool ok;
281  int pos = 7;
282  if (displayArgs.at(dimIdxW).at(pos) == QLatin1Char('='))
283  ++pos;
284  int pw = displayArgs.at(dimIdxW).mid(pos).toInt(&ok);
285  if (ok) {
286  physWidth = pw;
287  if (dimIdxH < 0)
289  }
290  }
291  if (dimIdxH >= 0) {
292  bool ok;
293  int pos = 8;
294  if (displayArgs.at(dimIdxH).at(pos) == QLatin1Char('='))
295  ++pos;
296  int ph = displayArgs.at(dimIdxH).mid(pos).toInt(&ok);
297  if (ok) {
298  physHeight = ph;
299  if (dimIdxW < 0)
301  }
302  }
303  if (dimIdxW < 0 && dimIdxH < 0) {
304  const int dpi = 72;
305  physWidth = qRound(dw * 25.4 / dpi);
306  physHeight = qRound(dh * 25.4 / dpi);
307  }
308 
309  qDebug("Connected to VFB server %s: %d x %d x %d %dx%dmm (%dx%ddpi)", displaySpec.toLatin1().data(),
310  w, h, d, physWidth, physHeight, qRound(dw*25.4/physWidth), qRound(dh*25.4/physHeight) );
311 
312  size = lstep * h;
313  mapsize = size;
315  memcpy(screenclut, d_ptr->hdr->clut, sizeof(QRgb) * screencols);
316 
317  connected = this;
318 
319  if (qgetenv("QT_QVFB_BGR").toInt())
321 
322  return true;
323 }
int screencols
the number of entries in the color table
Definition: qscreen_qws.h:309
int linestep
Definition: qvfbhdr.h:94
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
unsigned int QRgb
Definition: qrgb.h:53
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
int d
the pixel depth
Definition: qscreen_qws.h:327
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition: qstring.cpp:6090
QRgb screenclut[256]
the color table
Definition: qscreen_qws.h:308
QVFbScreenPrivate * d_ptr
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int physHeight
the physical height of the screen in millimeters.
Definition: qscreen_qws.h:340
int size
the number of bytes in the visible region of the frame buffer
Definition: qscreen_qws.h:334
PixelType pixeltype
set to BGRPixel
Definition: qscreen_qws.h:328
int physWidth
the physical width of the screen in millimeters.
Definition: qscreen_qws.h:339
void setPixelFormat(QImage::Format format)
Sets the screen&#39;s pixel format to format.
Q_CORE_EXPORT void qDebug(const char *,...)
uchar * data
points to the first visible pixel in the frame buffer.
Definition: qscreen_qws.h:311
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
int w
the logical width of the screen.
Definition: qscreen_qws.h:324
static int toInt(const QByteArray &str)
Definition: generator.cpp:167
unsigned char * shmrgn
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
Definition: qstringlist.h:172
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
int displayId
Definition: qscreen_qws.h:337
int width
Definition: qvfbhdr.h:91
#define QT_VFB_MOUSE_PIPE(DISPLAY)
Definition: qvfbhdr.h:76
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
int dw
the device width
Definition: qscreen_qws.h:331
int dh
the device height
Definition: qscreen_qws.h:332
int dataoffset
Definition: qvfbhdr.h:95
void setFrameBufferLittleEndian(bool littleEndian)
int key
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
bool grayscale
the gray scale screen mode flag
Definition: qscreen_qws.h:329
int height
Definition: qvfbhdr.h:92
int lstep
the number of bytes representing a line in the frame buffer.
Definition: qscreen_qws.h:325
static QVFbScreen * connected
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
Definition: qstring.cpp:6526
QRgb clut[256]
Definition: qvfbhdr.h:99
int h
the logical height of the screen.
Definition: qscreen_qws.h:326
int mapsize
the total number of bytes in the frame buffer
Definition: qscreen_qws.h:335
int depth
Definition: qvfbhdr.h:93
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
int numcols
Definition: qvfbhdr.h:98

◆ depth()

int QVFbScreen::depth ( ) const
virtual

Reimplement in subclass to return current depth of the screen.

Implements QPlatformScreen.

Definition at line 384 of file qvfbintegration.cpp.

385 {
386  return d_ptr->depth();
387 }
QVFbScreenPrivate * d_ptr

◆ disconnect()

void QVFbScreen::disconnect ( )
virtual

Reimplemented Function

Implements QScreen.

Definition at line 325 of file qscreenvfb_qws.cpp.

326 {
327  connected = 0;
328  if ((long)d_ptr->shmrgn != -1 && d_ptr->shmrgn) {
329  if (qApp->type() == QApplication::GuiServer && d_ptr->hdr->dataoffset >= (int)sizeof(QVFbHeader)) {
330  d_ptr->hdr->serverVersion = 0;
331  }
332  shmdt((char*)d_ptr->shmrgn);
333  }
334 }
QVFbScreenPrivate * d_ptr
#define qApp
unsigned char * shmrgn
int serverVersion
Definition: qvfbhdr.h:101
int dataoffset
Definition: qvfbhdr.h:95
static QVFbScreen * connected

◆ format()

QImage::Format QVFbScreen::format ( ) const
virtual

Reimplement in subclass to return the image format which corresponds to the screen format.

Implements QPlatformScreen.

Definition at line 389 of file qvfbintegration.cpp.

390 {
391  return d_ptr->format();
392 }
QVFbScreenPrivate * d_ptr
QImage::Format format() const

◆ geometry()

QRect QVFbScreen::geometry ( ) const
virtual

Reimplement in subclass to return the pixel geometry of the screen.

Implements QPlatformScreen.

Definition at line 379 of file qvfbintegration.cpp.

379  {
380  return QRect(QPoint(), d_ptr->screenSize());
381 }
QVFbScreenPrivate * d_ptr
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ initDevice()

bool QVFbScreen::initDevice ( )
virtual

Reimplemented Function

Implements QScreen.

Definition at line 336 of file qscreenvfb_qws.cpp.

337 {
338 #ifndef QT_NO_QWS_MOUSE_QVFB
339  const QString mouseDev = QT_VFB_MOUSE_PIPE(displayId);
340  d_ptr->mouse = new QVFbMouseHandler(QLatin1String("QVFbMouse"), mouseDev);
341  qwsServer->setDefaultMouse("None");
342  if (d_ptr->mouse)
343  d_ptr->mouse->setScreen(this);
344 #endif
345 
346 #if !defined(QT_NO_QWS_KBD_QVFB) && !defined(QT_NO_QWS_KEYBOARD)
347  const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId);
348  d_ptr->keyboard = new QVFbKeyboardHandler(keyboardDev);
349  qwsServer->setDefaultKeyboard("None");
350 #endif
351 
352  if (d_ptr->hdr->dataoffset >= (int)sizeof(QVFbHeader))
354 
355  if(d==8) {
356  screencols=256;
357  if (grayscale) {
358  // Build grayscale palette
359  for(int loopc=0;loopc<256;loopc++) {
360  screenclut[loopc]=qRgb(loopc,loopc,loopc);
361  }
362  } else {
363  // 6x6x6 216 color cube
364  int idx = 0;
365  for(int ir = 0x0; ir <= 0xff; ir+=0x33) {
366  for(int ig = 0x0; ig <= 0xff; ig+=0x33) {
367  for(int ib = 0x0; ib <= 0xff; ib+=0x33) {
368  screenclut[idx]=qRgb(ir, ig, ib);
369  idx++;
370  }
371  }
372  }
373  screencols=idx;
374  }
375  memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols);
377  } else if (d == 4) {
378  int val = 0;
379  for (int idx = 0; idx < 16; idx++, val += 17) {
380  screenclut[idx] = qRgb(val, val, val);
381  }
382  screencols = 16;
383  memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols);
385  } else if (d == 1) {
386  screencols = 2;
387  screenclut[1] = qRgb(0xff, 0xff, 0xff);
388  screenclut[0] = qRgb(0, 0, 0);
389  memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols);
391  }
392 
393 #ifndef QT_NO_QWS_CURSOR
395 #endif
396  return true;
397 }
int screencols
the number of entries in the color table
Definition: qscreen_qws.h:309
unsigned int QRgb
Definition: qrgb.h:53
int d
the pixel depth
Definition: qscreen_qws.h:327
QWSMouseHandler * mouse
static void setDefaultMouse(const char *)
Sets the mouse driver that will be used if the QWS_MOUSE_PROTO environment variable is not defined...
QRgb screenclut[256]
the color table
Definition: qscreen_qws.h:308
QVFbScreenPrivate * d_ptr
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
static void initSoftwareCursor()
Initializes the screen cursor.
QWSKeyboardHandler * keyboard
#define QT_VFB_KEYBOARD_PIPE(DISPLAY)
Definition: qvfbhdr.h:78
int displayId
Definition: qscreen_qws.h:337
static void setDefaultKeyboard(const char *)
Sets the keyboard driver that will be used if the QWS_KEYBOARD environment variable is not defined...
#define QT_VFB_MOUSE_PIPE(DISPLAY)
Definition: qvfbhdr.h:76
int serverVersion
Definition: qvfbhdr.h:101
int dataoffset
Definition: qvfbhdr.h:95
Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)
Definition: qrgb.h:69
bool grayscale
the gray scale screen mode flag
Definition: qscreen_qws.h:329
QRgb clut[256]
Definition: qvfbhdr.h:99
QWSServer Q_GUI_EXPORT * qwsServer
void setScreen(const QScreen *screen)
Sets the screen for this mouse driver to be the given screen.
Definition: qmouse_qws.cpp:264
#define QT_VERSION
This macro expands a numeric value of the form 0xMMNNPP (MM = major, NN = minor, PP = patch) that spe...
Definition: qglobal.h:51
int numcols
Definition: qvfbhdr.h:98

◆ physicalSize()

QSize QVFbScreen::physicalSize ( ) const
virtual

Reimplement this function in subclass to return the physical size of the screen.

This function is used by QFont to convert point sizes to pixel sizes.

The default implementation takes the pixel size of the screen, considers a resolution of 100 dots per inch, and returns the calculated physical size. A device with a screen that has different resolutions will need to be supported by a suitable reimplementation of this function.

Reimplemented from QPlatformScreen.

Definition at line 394 of file qvfbintegration.cpp.

394  {
395  return (d_ptr->screenSize()*254)/720;
396 }
QVFbScreenPrivate * d_ptr

◆ restore()

void QVFbScreen::restore ( )
virtual

Reimplemented Function

Reimplemented from QScreen.

Definition at line 416 of file qscreenvfb_qws.cpp.

417 {
418 }

◆ save()

void QVFbScreen::save ( )
virtual

Reimplemented Function

Reimplemented from QScreen.

Definition at line 410 of file qscreenvfb_qws.cpp.

411 {
412  // nothing to do.
413 }

◆ screenImage()

QImage * QVFbScreen::screenImage ( )

Definition at line 408 of file qvfbintegration.cpp.

Referenced by QVFbWindowSurface::paintDevice().

409 {
410  return d_ptr->screenImage();
411 }
QVFbScreenPrivate * d_ptr

◆ setDirty() [1/2]

void QVFbScreen::setDirty ( const QRect rectangle)
virtual

Marks the given rectangle as dirty.

Note that the default implementation does nothing; reimplement this function to indicate that the given rectangle has been altered.

Reimplemented from QScreen.

◆ setDirty() [2/2]

void QVFbScreen::setDirty ( const QRect r)
virtual

Reimplemented Function

Reimplemented from QScreen.

Definition at line 419 of file qscreenvfb_qws.cpp.

Referenced by QVFbScreenPrivate::disconnect(), QVFbWindowSurface::flush(), and setDirty().

420 {
421  const QRect r = rect.translated(-offset());
422  d_ptr->hdr->dirty = true;
423  d_ptr->hdr->update = d_ptr->hdr->update.united(r);
424 }
QRect united(const QRect &other) const
Returns the bounding rectangle of this rectangle and the given rectangle.
Definition: qrect.h:491
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
QVFbScreenPrivate * d_ptr
QRect update
Definition: qvfbhdr.h:96
bool dirty
Definition: qvfbhdr.h:97
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QPoint offset() const
Returns the logical offset of the screen, i.

◆ setMode()

void QVFbScreen::setMode ( int  nw,
int  nh,
int  nd 
)
virtual

Reimplemented Function

Implements QScreen.

Definition at line 403 of file qscreenvfb_qws.cpp.

404 {
405 }

◆ shutdownDevice()

void QVFbScreen::shutdownDevice ( )
virtual

Reimplemented Function

Reimplemented from QScreen.

Definition at line 399 of file qscreenvfb_qws.cpp.

400 {
401 }

Properties

◆ d_ptr

QVFbScreenPrivate * QVFbScreen::d_ptr
private

Definition at line 77 of file qscreenvfb_qws.h.

Referenced by blank(), connect(), disconnect(), initDevice(), QVFbScreen(), setDirty(), and ~QVFbScreen().


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