
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux.More...
| Header: | #include <QDirectPainter> |
| Inherits: | QObject |
| enum | SurfaceFlag { NonReserved, Reserved, ReservedSynchronous } |
| QDirectPainter(QObject * parent = 0, SurfaceFlag flag = NonReserved) | |
| ~QDirectPainter() | |
| QRegion | allocatedRegion() const |
| void | endPainting() |
| void | endPainting(const QRegion & region) |
| void | flush(const QRegion & region) |
| QRect | geometry() const |
| void | lower() |
| void | raise() |
| virtual void | regionChanged(const QRegion & newRegion) |
| QRegion | requestedRegion() const |
| void | setGeometry(const QRect & rectangle) |
| void | setRegion(const QRegion & region) |
| void | startPainting(bool lockDisplay = true) |
| WId | winId() const |
| uchar * | frameBuffer() |
| int | linestep() |
| void | lock() |
| int | screenDepth() |
| int | screenHeight() |
| int | screenWidth() |
| void | unlock() |
TheQDirectPainter class provides direct access to the underlying hardware in Qt for Embedded Linux.
Note that this class is only available inQt 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 theQDirectPainter 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.
By instantiating aQDirectPainter object using the defaultQDirectPainter::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 theallocatedRegion() function, while therequestedRegion() function returns the originally reserved region.
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 theQDirectPainter::Reserved surface flag to the constructor. After the reserved region is reported throughregionChanged(), the allocated region will not change, unlesssetRegion() is called.
IfQDirectPainter::ReservedSynchronous is passed to the constructor, calls tosetRegion() will block until the region is reserved, meaning thatallocatedRegion() will be available immediately. Note that in the current versionsetRegion() will cause the application event loop to be entered, potentially causing reentrancy issues.
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 theQDirectPainter::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 staticQScreen::instance() function. Then useQScreen'ssubScreenIndexAt() andsubScreens() functions to access the correct subscreen, and the subscreen'sbase() 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 thelock() andunlock() functions. Note that callinglock() will prevent all other applications from working untilunlock() is called.
In addition,QDirectPainter provides several functions returning information about the framebuffer: thelinestep() function returns the length (in bytes) of each scanline of the framebuffer while thescreenDepth(),screenWidth() andscreenHeight() function return the screen metrics.
See alsoQScreen,QWSEmbedWidget, andQt for Embedded Linux Architecture.
This enum describes the behavior of the region reserved by thisQDirectPainter object.
| Constant | Value | Description |
|---|---|---|
QDirectPainter::NonReserved | 0 | The allocated region may change, e.g., if a window with a higher focus requests parts of the same region. See alsoDynamic Allocation. |
QDirectPainter::Reserved | 1 | The allocated region will never change. See alsoStatic Allocation. |
QDirectPainter::ReservedSynchronous | 3 | The allocated region will never change and each function that changes the allocated region will be blocking. |
See alsoallocatedRegion().
Constructs aQDirectPainter object with the givenparent and surfaceflag.
Destroys thisQDirectPainter object, releasing the reserved region.
See alsoallocatedRegion().
Returns the currently reserved region.
Note that if theQDirectPainter::Reserved flag is set, the region returned by this function will always be equivalent to the region returned by therequestedRegion() function. Otherwise they might differ (seeDynamic Allocation for details).
This function was introduced in Qt 4.2.
See alsorequestedRegion() andgeometry().
Call this function when you are done updating the screen. It will notify the hardware, if necessary, that your painting operations have ended.
This function was introduced in Qt 4.2.
This is an overloaded function.
This function will automatically callflush() to flush theregion to the display before notifying the hardware, if necessary, that painting operations have ended.
This function was introduced in Qt 4.3.
Flushes theregion onto the screen.
This function was introduced in Qt 4.3.
[static]uchar * QDirectPainter::frameBuffer()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 staticQScreen::instance() function. Then useQScreen'ssubScreenIndexAt() andsubScreens() functions to access the correct subscreen, and the subscreen'sbase() function to retrieve a pointer to the framebuffer.
See alsorequestedRegion(),allocatedRegion(), andlinestep().
Returns the bounding rectangle of the requested region.
This function was introduced in Qt 4.2.
See alsosetGeometry() andrequestedRegion().
[static]int QDirectPainter::linestep()Returns the length (in bytes) of each scanline of the framebuffer.
See alsoframeBuffer().
[static]void QDirectPainter::lock()Locks access to the framebuffer.
Note that calling this function will prevent all other applications from updating the display untilunlock() is called.
See alsounlock().
Lowers the reserved region to the bottom of the widget stack.
After this call the reserved region will be visually behind (and therefore obscured by) any overlapping widgets.
This function was introduced in Qt 4.2.
See alsoraise() andrequestedRegion().
Raises the reserved region to the top of the widget stack.
After this call the reserved region will be visually in front of any overlapping widgets.
This function was introduced in Qt 4.2.
See alsolower() andrequestedRegion().
[virtual]void QDirectPainter::regionChanged(constQRegion & newRegion)This function is called when the allocated region changes.
This function is not called for region changes that happen while thestartPainting() 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 callstartPainting() before updating the display and then useallocatedRegion() to retrieve the correct region.
This function was introduced in Qt 4.2.
See alsoallocatedRegion(),startPainting(), andDynamic Allocation.
Returns the region requested by thisQDirectPainter.
Note that if theQDirectPainter::Reserved flag is set, the region returned by this function will always be equivalent to the region returned by theallocatedRegion() function. Otherwise they might differ (seeDynamic Allocation for details).
This function was introduced in Qt 4.2.
See alsogeometry(),setRegion(), andallocatedRegion().
[static]int QDirectPainter::screenDepth()Returns the bit depth of the display.
See alsoscreenHeight() andscreenWidth().
[static]int QDirectPainter::screenHeight()Returns the height of the display in pixels.
See alsoscreenWidth() andscreenDepth().
[static]int QDirectPainter::screenWidth()Returns the width of the display in pixels.
See alsoscreenHeight() andscreenDepth().
Request to reserve the givenrectangle of the framebuffer.
Note that the actually allocated region might differ from the requested one, e.g., if the given region overlaps with the region of anotherQDirectPainter object.
This function was introduced in Qt 4.2.
See alsogeometry(),allocatedRegion(), andsetRegion().
Requests to reserve the givenregion of the framebuffer.
Note that the actually allocated region might differ from the requested one, e.g., if the given region overlaps with the region of anotherQDirectPainter object.
This function was introduced in Qt 4.2.
See alsoregion(),requestedRegion(),allocatedRegion(), andDynamic Allocation.
Call this function before you start updating the pixels in the allocated region. The hardware will be notified, if necessary, that you are about to start painting operations.
SetlockDisplay if you want startPainting() andendPainting() tolock() andunlock() the display automatically.
Note that for aNonReserved direct painter, you must callallocatedRegion() after calling this function, since the allocated region is only guaranteed to be correct after this function has returned.
TheregionChanged() function will not be called between startPainting() andendPainting().
This function was introduced in Qt 4.2.
See alsoendPainting() andflush().
[static]void QDirectPainter::unlock()Unlocks the lock on the framebuffer (set using thelock() function), allowing other applications to access the screen.
See alsolock().
Returns the window system identifier of the widget.
This function was introduced in Qt 4.2.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.