Qt 4.8
Public Types | Public Functions | Static Public Functions | Friends | List of all members
QDirectPainter Class Reference

The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux. More...

#include <qdirectpainter_qws.h>

Inheritance diagram for QDirectPainter:
QObject

Public Types

enum  SurfaceFlag { NonReserved = 0, Reserved = 1, ReservedSynchronous = 3 }
 This enum describes the behavior of the region reserved by this QDirectPainter object. More...
 

Public Functions

QRegion allocatedRegion () const
 Returns the currently reserved region. More...
 
void endPainting ()
 Call this function when you are done updating the screen. More...
 
void endPainting (const QRegion &region)
 This function will automatically call flush() to flush the region to the display before notifying the hardware, if necessary, that painting operations have ended. More...
 
void flush (const QRegion &region)
 Flushes the region onto the screen. More...
 
QRect geometry () const
 Returns the bounding rectangle of the requested region. More...
 
void lower ()
 Lowers the reserved region to the bottom of the widget stack. More...
 
 QDirectPainter (QObject *parentObject=0, SurfaceFlag flag=NonReserved)
 Constructs a QDirectPainter object with the given parent and surface flag. More...
 
void raise ()
 Raises the reserved region to the top of the widget stack. More...
 
virtual void regionChanged (const QRegion &exposedRegion)
 This function is called when the allocated region changes. More...
 
QRegion requestedRegion () const
 Returns the region requested by this QDirectPainter. More...
 
void setGeometry (const QRect &)
 Request to reserve the given rectangle of the framebuffer. More...
 
void setRegion (const QRegion &)
 Requests to reserve the given region of the framebuffer. More...
 
void startPainting (bool lockDisplay=true)
 Call this function before you start updating the pixels in the allocated region. More...
 
WId winId () const
 Returns the window system identifier of the widget. More...
 
 ~QDirectPainter ()
 Destroys this QDirectPainter object, releasing the reserved region. More...
 
- 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...
 

Static Public Functions

static ucharframeBuffer ()
 Returns a pointer to the beginning of the display memory. More...
 
static int linestep ()
 Returns the length (in bytes) of each scanline of the framebuffer. More...
 
static void lock ()
 Locks access to the framebuffer. More...
 
static QRegion region ()
 Use QDirectPainter::allocatedRegion() instead. More...
 
static QRegion reservedRegion ()
 Returns the reserved region. More...
 
static QRegion reserveRegion (const QRegion &)
 Attempts to reserve the region and returns the region that is actually reserved. More...
 
static int screenDepth ()
 Returns the bit depth of the display. More...
 
static int screenHeight ()
 Returns the height of the display in pixels. More...
 
static int screenWidth ()
 Returns the width of the display in pixels. More...
 
static void unlock ()
 Unlocks the lock on the framebuffer (set using the lock() function), allowing other applications to access the screen. More...
 
- 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)
 

Friends

void qt_directpainter_embedevent (QDirectPainter *, const QWSEmbedEvent *)
 
void qt_directpainter_region (QDirectPainter *dp, const QRegion &alloc, int type)
 

Additional Inherited Members

- 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 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 Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux.

Note that this class is only available in Qt for Embedded Linux.

QDirectPainter allows a client application to reserve a region of the framebuffer and render directly onto the screen. There are two ways of using the QDirectPainter class: You can either reserve a region using the provided static functions, or you can instantiate an object and make use of its more dynamic API.

Dynamic Allocation

By instantiating a QDirectPainter object using the default QDirectPainter::NonReserved surface flag, the client application only gets some control over the reserved region, i.e., it can still render directly onto the screen but the allocated region may change (for example, if a window with a higher focus requests parts of the same region). The currently allocated region can be retrieved using the allocatedRegion() function, while the requestedRegion() function returns the originally reserved region.

Static Allocation

Using the static approach, the client application gets complete control over the reserved region, i.e., the affected region will never be modified by the screen driver.

To create a static region, pass the QDirectPainter::Reserved surface flag to the constructor. After the reserved region is reported through regionChanged(), the allocated region will not change, unless setRegion() is called.

If QDirectPainter::ReservedSynchronous is passed to the constructor, calls to setRegion() will block until the region is reserved, meaning that allocatedRegion() will be available immediately. Note that in the current version setRegion() will cause the application event loop to be entered, potentially causing reentrancy issues.

Rendering

To draw on a given region, the application must first get hold of a pointer to the framebuffer. In most cases, this pointer can be retrieved using the QDirectPainter::frameBuffer() function. But note that if the current screen has subscreens, you must query the screen driver instead to identify the correct subscreen. A pointer to the current screen driver can always be retrieved using the static QScreen::instance() function. Then use QScreen's QScreen::subScreenIndexAt() and QScreen::subScreens() functions to access the correct subscreen, and the subscreen's QScreen::base() function to retrieve a pointer to the framebuffer.

Depending on the hardware, it might be necessary to lock the framebuffer for exclusive use while writing to it. This is possible using the lock() and unlock() functions. Note that calling lock() will prevent all other applications from working until unlock() is called.

In addition, QDirectPainter provides several functions returning information about the framebuffer: the linestep() function returns the length (in bytes) of each scanline of the framebuffer while the screenDepth(), screenWidth() and screenHeight() function return the screen metrics.

See also
QScreen, QWSEmbedWidget, {Qt for Embedded Linux Architecture}

Definition at line 58 of file qdirectpainter_qws.h.

Enumerations

◆ SurfaceFlag

This enum describes the behavior of the region reserved by this QDirectPainter object.

  • NonReserved The allocated region may change, e.g., if a window with a higher focus requests parts of the same region. See also Dynamic Allocation.
  • Reserved The allocated region will never change. See also Static Allocation.
  • ReservedSynchronous The allocated region will never change and each function that changes the allocated region will be blocking.
See also
allocatedRegion()
Enumerator
NonReserved 
Reserved 
ReservedSynchronous 

Definition at line 63 of file qdirectpainter_qws.h.

Constructors and Destructors

◆ QDirectPainter()

QDirectPainter::QDirectPainter ( QObject parentObject = 0,
SurfaceFlag  flag = NonReserved 
)
explicit

Constructs a QDirectPainter object with the given parent and surface flag.

Definition at line 262 of file qdirectpainter_qws.cpp.

Referenced by reserveRegion().

264 {
266  d->surface = new QWSDirectPainterSurface(true, flag);
267 
268  if (flag != NonReserved)
269  d->surface->setReserved();
270 
271  QApplicationPrivate *ad = qApp->d_func();
272  if (!ad->directPainters)
274  ad->directPainters->insert(d->surface->windowId(), this);
275 }
double d
Definition: qnumeric_p.h:62
The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux...
#define Q_D(Class)
Definition: qglobal.h:2482
#define qApp
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
Definition: qmap.h:559
Q_INVOKABLE QObject(QObject *parent=0)
Constructs an object with parent object parent.
Definition: qobject.cpp:753
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QMap< WId, QDirectPainter * > * directPainters
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67

◆ ~QDirectPainter()

QDirectPainter::~QDirectPainter ( )

Destroys this QDirectPainter object, releasing the reserved region.

See also
allocatedRegion()

Definition at line 282 of file qdirectpainter_qws.cpp.

283 {
284  /* should not be necessary
285  if (this == QDirectPainterPrivate::staticPainter)
286  QDirectPainterPrivate::staticPainter = 0;
287  */
288 }

Functions

◆ allocatedRegion()

QRegion QDirectPainter::allocatedRegion ( ) const

Returns the currently reserved region.

Since
4.2

Note that if the QDirectPainter::Reserved flag is set, the region returned by this function will always be equivalent to the region returned by the requestedRegion() function. Otherwise they might differ (see Dynamic Allocation for details).

See also
requestedRegion(), geometry()

Definition at line 391 of file qdirectpainter_qws.cpp.

Referenced by reservedRegion(), and reserveRegion().

392 {
393  Q_D(const QDirectPainter);
394  const QScreen *screen = d->surface->screen();
395  if (screen->isTransformed()) {
396  const QSize screenSize(screen->width(), screen->height());
397  return screen->mapToDevice(d->surface->region(), screenSize);
398  } else {
399  return d->surface->region();
400  }
401 }
double d
Definition: qnumeric_p.h:62
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux...
#define Q_D(Class)
Definition: qglobal.h:2482
virtual QSize mapToDevice(const QSize &) const
Maps the given size from the coordinate space used by the application to the framebuffer coordinate s...
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ endPainting() [1/2]

void QDirectPainter::endPainting ( )

Call this function when you are done updating the screen.

Since
4.2

It will notify the hardware, if necessary, that your painting operations have ended.

Definition at line 489 of file qdirectpainter_qws.cpp.

Referenced by endPainting().

490 {
492 
493  const QScreen *screen = d->surface->screen();
494  if (screen->isTransformed()) {
495  const QSize devSize(screen->deviceWidth(), screen->deviceHeight());
496  const QRegion r = screen->mapFromDevice(d->surface->region(), devSize);
497  d->surface->endPaint(r);
498  } else {
499  d->surface->endPaint(d->surface->region());
500  }
501 }
double d
Definition: qnumeric_p.h:62
int deviceWidth() const
Returns the physical width of the framebuffer device in pixels.
Definition: qscreen_qws.h:233
virtual QSize mapFromDevice(const QSize &) const
Maps the given size from the framebuffer coordinate system to the coordinate space used by the applic...
The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux...
#define Q_D(Class)
Definition: qglobal.h:2482
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
int deviceHeight() const
Returns the full height of the framebuffer device in pixels.
Definition: qscreen_qws.h:234
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ endPainting() [2/2]

void QDirectPainter::endPainting ( const QRegion region)

This function will automatically call flush() to flush the region to the display before notifying the hardware, if necessary, that painting operations have ended.

Since
4.3 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 514 of file qdirectpainter_qws.cpp.

515 {
516  endPainting();
517  flush(region);
518 }
void endPainting()
Call this function when you are done updating the screen.
void flush(const QRegion &region)
Flushes the region onto the screen.

◆ flush()

void QDirectPainter::flush ( const QRegion region)

Flushes the region onto the screen.

Since
4.3

Definition at line 528 of file qdirectpainter_qws.cpp.

Referenced by endPainting().

529 {
531 
532  const QScreen *screen = d->surface->screen();
533  if (screen->isTransformed()) {
534  const QSize devSize(screen->deviceWidth(), screen->deviceHeight());
535  const QRegion r = screen->mapFromDevice(region, devSize);
536  d->surface->flush(0, r, QPoint());
537  } else {
538  d->surface->flush(0, region, QPoint());
539  }
540 }
double d
Definition: qnumeric_p.h:62
int deviceWidth() const
Returns the physical width of the framebuffer device in pixels.
Definition: qscreen_qws.h:233
virtual QSize mapFromDevice(const QSize &) const
Maps the given size from the framebuffer coordinate system to the coordinate space used by the applic...
The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux...
#define Q_D(Class)
Definition: qglobal.h:2482
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
int deviceHeight() const
Returns the full height of the framebuffer device in pixels.
Definition: qscreen_qws.h:234
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ frameBuffer()

uchar * QDirectPainter::frameBuffer ( )
static

Returns a pointer to the beginning of the display memory.

Note that it is the application's responsibility to limit itself to modifying only the reserved region.

Do not use this pointer if the current screen has subscreens, query the screen driver instead: A pointer to the current screen driver can always be retrieved using the static QScreen::instance() function. Then use QScreen's QScreen::subScreenIndexAt() and QScreen::subScreens() functions to access the correct subscreen, and the subscreen's QScreen::base() function to retrieve a pointer to the framebuffer.

See also
requestedRegion(), allocatedRegion(), linestep()

Definition at line 624 of file qdirectpainter_qws.cpp.

625 {
626  QScreen *screen = getPrimaryScreen();
627  if (!screen)
628  return 0;
629  return screen->base();
630 }
static QScreen * getPrimaryScreen()
uchar * base() const
Returns a pointer to the beginning of the framebuffer.
Definition: qscreen_qws.h:235
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191

◆ geometry()

QRect QDirectPainter::geometry ( ) const

Returns the bounding rectangle of the requested region.

Since
4.2
See also
setGeometry(), requestedRegion()

Definition at line 320 of file qdirectpainter_qws.cpp.

321 {
322  Q_D(const QDirectPainter);
323  return d->requested_region.boundingRect();
324 }
double d
Definition: qnumeric_p.h:62
The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux...
#define Q_D(Class)
Definition: qglobal.h:2482

◆ linestep()

int QDirectPainter::linestep ( )
static

Returns the length (in bytes) of each scanline of the framebuffer.

See also
frameBuffer()

Definition at line 696 of file qdirectpainter_qws.cpp.

697 {
698  QScreen *screen = getPrimaryScreen();
699  if (!screen)
700  return 0;
701  return screen->linestep();
702 }
static QScreen * getPrimaryScreen()
int linestep() const
Returns the length of each scanline of the framebuffer in bytes.
Definition: qscreen_qws.h:232
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191

◆ lock()

void QDirectPainter::lock ( )
static

Locks access to the framebuffer.

Note that calling this function will prevent all other applications from updating the display until unlock() is called.

See also
unlock()

Definition at line 713 of file qdirectpainter_qws.cpp.

714 {
715  QWSDisplay::grab(true);
716 }
static void grab()

◆ lower()

void QDirectPainter::lower ( )

Lowers the reserved region to the bottom of the widget stack.

Since
4.2

After this call the reserved region will be visually behind (and therefore obscured by) any overlapping widgets.

See also
raise(), requestedRegion()

Definition at line 573 of file qdirectpainter_qws.cpp.

574 {
576 }
void setAltitude(int winId, int altitude, bool fixed=false)
WId winId() const
Returns the window system identifier of the widget.
static QWSDisplay * qwsDisplay()

◆ raise()

void QDirectPainter::raise ( )

Raises the reserved region to the top of the widget stack.

Since
4.2

After this call the reserved region will be visually in front of any overlapping widgets.

See also
lower(), requestedRegion()

Definition at line 555 of file qdirectpainter_qws.cpp.

556 {
558 }
void setAltitude(int winId, int altitude, bool fixed=false)
WId winId() const
Returns the window system identifier of the widget.
static QWSDisplay * qwsDisplay()

◆ region()

QRegion QDirectPainter::region ( )
inlinestatic

Use QDirectPainter::allocatedRegion() instead.

Definition at line 91 of file qdirectpainter_qws.h.

Referenced by setRegion().

91 { return reservedRegion(); }
static QRegion reservedRegion()
Returns the reserved region.

◆ regionChanged()

void QDirectPainter::regionChanged ( const QRegion newRegion)
virtual

This function is called when the allocated region changes.

Since
4.2

This function is not called for region changes that happen while the startPainting() function is executing.

Note that the given region, newRegion, is not guaranteed to be correct at the time you access the display. To prevent reentrancy problems you should always call startPainting() before updating the display and then use allocatedRegion() to retrieve the correct region.

See also
allocatedRegion(), startPainting(), {Dynamic Allocation}

Definition at line 436 of file qdirectpainter_qws.cpp.

Referenced by qt_directpainter_region().

437 {
438  Q_UNUSED(region);
439 }
static QRegion region()
Use QDirectPainter::allocatedRegion() instead.
#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

◆ requestedRegion()

QRegion QDirectPainter::requestedRegion ( ) const

Returns the region requested by this QDirectPainter.

Since
4.2

Note that if the QDirectPainter::Reserved flag is set, the region returned by this function will always be equivalent to the region returned by the allocatedRegion() function. Otherwise they might differ (see Dynamic Allocation for details).

See also
geometry(), setRegion(), allocatedRegion()

Definition at line 370 of file qdirectpainter_qws.cpp.

371 {
372  Q_D(const QDirectPainter);
373  return d->requested_region;
374 }
double d
Definition: qnumeric_p.h:62
The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux...
#define Q_D(Class)
Definition: qglobal.h:2482

◆ reservedRegion()

QRegion QDirectPainter::reservedRegion ( )
static

Returns the reserved region.

Since
4.2
See also
reserveRegion(), frameBuffer()

Use allocatedRegion() instead.

Definition at line 646 of file qdirectpainter_qws.cpp.

647 {
650 }
QRegion allocatedRegion() const
Returns the currently reserved region.
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static QDirectPainter * staticPainter

◆ reserveRegion()

QRegion QDirectPainter::reserveRegion ( const QRegion region)
static

Attempts to reserve the region and returns the region that is actually reserved.

This function also releases the previously reserved region if any. If not released explicitly, the region will be released on application exit.

See also
allocatedRegion(), {Static Allocation}

Construct a QDirectPainter using QDirectPainter::ReservedSynchronous instead.

Definition at line 598 of file qdirectpainter_qws.cpp.

599 {
602 
604  dp->setRegion(reg);
605 
606  return dp->allocatedRegion();
607 }
QRegion allocatedRegion() const
Returns the currently reserved region.
The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux...
#define qApp
QDirectPainter(QObject *parentObject=0, SurfaceFlag flag=NonReserved)
Constructs a QDirectPainter object with the given parent and surface flag.
void setRegion(const QRegion &)
Requests to reserve the given region of the framebuffer.
static QDirectPainter * staticPainter

◆ screenDepth()

int QDirectPainter::screenDepth ( )
static

Returns the bit depth of the display.

See also
screenHeight(), screenWidth()

Definition at line 657 of file qdirectpainter_qws.cpp.

658 {
659  QScreen *screen = getPrimaryScreen();
660  if (!screen)
661  return 0;
662  return screen->depth();
663 }
static QScreen * getPrimaryScreen()
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
Definition: qscreen_qws.h:229

◆ screenHeight()

int QDirectPainter::screenHeight ( )
static

Returns the height of the display in pixels.

See also
screenWidth(), screenDepth()

Definition at line 683 of file qdirectpainter_qws.cpp.

684 {
685  QScreen *screen = getPrimaryScreen();
686  if (!screen)
687  return 0;
688  return screen->deviceHeight();
689 }
static QScreen * getPrimaryScreen()
int deviceHeight() const
Returns the full height of the framebuffer device in pixels.
Definition: qscreen_qws.h:234
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191

◆ screenWidth()

int QDirectPainter::screenWidth ( )
static

Returns the width of the display in pixels.

See also
screenHeight(), screenDepth()

Definition at line 670 of file qdirectpainter_qws.cpp.

671 {
672  QScreen *screen = getPrimaryScreen();
673  if (!screen)
674  return 0;
675  return screen->deviceWidth();
676 }
int deviceWidth() const
Returns the physical width of the framebuffer device in pixels.
Definition: qscreen_qws.h:233
static QScreen * getPrimaryScreen()
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191

◆ setGeometry()

void QDirectPainter::setGeometry ( const QRect rectangle)

Request to reserve the given rectangle of the framebuffer.

Since
4.2

Note that the actually allocated region might differ from the requested one, e.g., if the given region overlaps with the region of another QDirectPainter object.

See also
geometry(), allocatedRegion(), setRegion()

Definition at line 305 of file qdirectpainter_qws.cpp.

306 {
307  setRegion(rect);
308 }
void setRegion(const QRegion &)
Requests to reserve the given region of the framebuffer.

◆ setRegion()

void QDirectPainter::setRegion ( const QRegion region)

Requests to reserve the given region of the framebuffer.

Since
4.2

Note that the actually allocated region might differ from the requested one, e.g., if the given region overlaps with the region of another QDirectPainter object.

See also
requestedRegion(), allocatedRegion(), {Dynamic Allocation}

Definition at line 340 of file qdirectpainter_qws.cpp.

Referenced by qt_directpainter_embedevent(), reserveRegion(), and setGeometry().

341 {
343  d->requested_region = region;
344 
345  const QScreen *screen = d->surface->screen();
346  if (screen->isTransformed()) {
347  const QSize devSize(screen->deviceWidth(), screen->deviceHeight());
348  const QRegion r = screen->mapFromDevice(region, devSize);
349  d->surface->setRegion(r);
350  } else {
351  d->surface->setRegion(region);
352  }
353 }
double d
Definition: qnumeric_p.h:62
int deviceWidth() const
Returns the physical width of the framebuffer device in pixels.
Definition: qscreen_qws.h:233
virtual QSize mapFromDevice(const QSize &) const
Maps the given size from the framebuffer coordinate system to the coordinate space used by the applic...
The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux...
#define Q_D(Class)
Definition: qglobal.h:2482
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
int deviceHeight() const
Returns the full height of the framebuffer device in pixels.
Definition: qscreen_qws.h:234
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
static QRegion region()
Use QDirectPainter::allocatedRegion() instead.
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ startPainting()

void QDirectPainter::startPainting ( bool  lockDisplay = true)

Call this function before you start updating the pixels in the allocated region.

Since
4.2

The hardware will be notified, if necessary, that you are about to start painting operations.

Set lockDisplay if you want startPainting() and endPainting() to lock() and unlock() the display automatically.

Note that for a NonReserved direct painter, you must call allocatedRegion() after calling this function, since the allocated region is only guaranteed to be correct after this function has returned.

The regionChanged() function will not be called between startPainting() and endPainting().

See also
endPainting(), flush()

Definition at line 464 of file qdirectpainter_qws.cpp.

465 {
467  d->surface->setLocking(lockDisplay);
468 
469  const QScreen *screen = d->surface->screen();
470  if (screen->isTransformed()) {
471  const QSize devSize(screen->deviceWidth(), screen->deviceHeight());
472  const QRegion r = screen->mapFromDevice(d->surface->region(), devSize);
473  d->surface->beginPaint(r);
474  } else {
475  d->surface->beginPaint(d->surface->region());
476  }
477 }
double d
Definition: qnumeric_p.h:62
int deviceWidth() const
Returns the physical width of the framebuffer device in pixels.
Definition: qscreen_qws.h:233
virtual QSize mapFromDevice(const QSize &) const
Maps the given size from the framebuffer coordinate system to the coordinate space used by the applic...
The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux...
#define Q_D(Class)
Definition: qglobal.h:2482
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
int deviceHeight() const
Returns the full height of the framebuffer device in pixels.
Definition: qscreen_qws.h:234
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ unlock()

void QDirectPainter::unlock ( )
static

Unlocks the lock on the framebuffer (set using the lock() function), allowing other applications to access the screen.

See also
lock()

Definition at line 723 of file qdirectpainter_qws.cpp.

724 {
726 }
static void ungrab()

◆ winId()

WId QDirectPainter::winId ( ) const

Returns the window system identifier of the widget.

Since
4.2

Definition at line 411 of file qdirectpainter_qws.cpp.

Referenced by lower(), and raise().

412 {
413  Q_D(const QDirectPainter);
414  return d->surface->windowId();
415 }
double d
Definition: qnumeric_p.h:62
The QDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux...
#define Q_D(Class)
Definition: qglobal.h:2482

Friends and Related Functions

◆ qt_directpainter_embedevent

void qt_directpainter_embedevent ( QDirectPainter ,
const QWSEmbedEvent  
)
friend

Definition at line 244 of file qdirectpainter_qws.cpp.

245 {
246  if (event->type | QWSEmbedEvent::Region) {
247  QScreen *screen = dp->d_func()->surface->screen();
248  QRegion r = event->region;
249  if (screen->isTransformed()) {
250  const QSize screenSize(screen->width(), screen->height());
251  r = screen->mapToDevice(r, screenSize);
252  }
253  dp->setRegion(r);
254  }
255 }
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
virtual QSize mapToDevice(const QSize &) const
Maps the given size from the coordinate space used by the application to the framebuffer coordinate s...
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
void setRegion(const QRegion &)
Requests to reserve the given region of the framebuffer.
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ qt_directpainter_region

void qt_directpainter_region ( QDirectPainter dp,
const QRegion alloc,
int  type 
)
friend

Definition at line 223 of file qdirectpainter_qws.cpp.

224 {
225  QDirectPainterPrivate *d = dp->d_func();
226 
227  QRegion r = alloc;
228  QScreen *screen = d->surface->screen();
229  if (screen->isTransformed()) {
230  const QSize screenSize(screen->width(), screen->height());
231  r = screen->mapToDevice(r, screenSize);
232  }
234  d->surface->setClipRegion(alloc);
235  d->seenRegion = true;
237  if (!d->surface->flushingRegionEvents) // recursion guard
238  dp->regionChanged(r);
239  }
240  }
241 }
QWSDirectPainterSurface * surface
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
virtual QSize mapToDevice(const QSize &) const
Maps the given size from the coordinate space used by the application to the framebuffer coordinate s...
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
virtual void regionChanged(const QRegion &exposedRegion)
This function is called when the allocated region changes.
void setClipRegion(const QRegion &)
Sets the region currently visible on the screen to be the given clip region.
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static QDirectPainter * staticPainter

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