KWin
|
The KwinQuickView class provides a convenient API for exporting QtQuick scenes as buffers that can be composited in any other fashion. More...
#include <offscreenquickview.h>
Public Types | |
enum class | ExportMode { Texture , Image } |
Signals | |
void | repaintNeeded () |
void | geometryChanged (const QRect &oldGeometry, const QRect &newGeometry) |
void | renderRequested () |
void | sceneChanged () |
Public Member Functions | |
void | releaseResources () |
void | updateTouchState (Qt::TouchPointState state, qint32 id, const QPointF &pos) |
OffscreenQuickView (ExportMode exportMode=ExportMode::Texture, bool alpha=true) | |
~OffscreenQuickView () | |
QSize | size () const |
void | setGeometry (const QRect &rect) |
QRect | geometry () const |
void | setOpacity (qreal opacity) |
qreal | opacity () const |
bool | hasAlphaChannel () const |
void | update () |
QQuickItem * | contentItem () const |
QQuickWindow * | window () const |
void | setVisible (bool visible) |
Marks the window as visible/invisible This can be used to release resources used by the window The default is true. | |
bool | isVisible () const |
void | show () |
void | hide () |
bool | automaticRepaint () const |
void | setAutomaticRepaint (bool set) |
GLTexture * | bufferAsTexture () |
QImage | bufferAsImage () const |
void | forwardMouseEvent (QEvent *mouseEvent) |
void | forwardKeyEvent (QKeyEvent *keyEvent) |
bool | forwardTouchDown (qint32 id, const QPointF &pos, std::chrono::microseconds time) |
bool | forwardTouchMotion (qint32 id, const QPointF &pos, std::chrono::microseconds time) |
bool | forwardTouchUp (qint32 id, std::chrono::microseconds time) |
Public Attributes | |
std::unique_ptr< QQuickWindow > | m_view |
std::unique_ptr< QQuickRenderControl > | m_renderControl |
std::unique_ptr< QOffscreenSurface > | m_offscreenSurface |
std::unique_ptr< QOpenGLContext > | m_glcontext |
std::unique_ptr< QOpenGLFramebufferObject > | m_fbo |
std::unique_ptr< QTimer > | m_repaintTimer |
QImage | m_image |
std::unique_ptr< GLTexture > | m_textureExport |
bool | m_useBlit = false |
bool | m_visible = true |
bool | m_hasAlphaChannel = true |
bool | m_automaticRepaint = true |
QList< QEventPoint > | touchPoints |
QPointingDevice * | touchDevice |
ulong | lastMousePressTime = 0 |
Qt::MouseButton | lastMousePressButton = Qt::NoButton |
The KwinQuickView class provides a convenient API for exporting QtQuick scenes as buffers that can be composited in any other fashion.
Contents can be fetched as a GL Texture or as a QImage If data is to be fetched as an image, it should be specified upfront as blitting is performed when we update our FBO to keep kwin's render loop as fast as possible.
Definition at line 37 of file offscreenquickview.cpp.
|
strong |
Enumerator | |
---|---|
Texture | The contents will be available as a texture in the shared contexts. Image will be blank |
Image | The contents will be blit during the update into a QImage buffer. |
Definition at line 50 of file offscreenquickview.h.
|
explicit |
Construct a new KWinQuickView explicitly stating an export mode. alpha indicates whether the view is translucent or not.
Definition at line 78 of file offscreenquickview.cpp.
KWin::OffscreenQuickView::~OffscreenQuickView | ( | ) |
Note that this may change the current GL Context
Definition at line 152 of file offscreenquickview.cpp.
bool KWin::OffscreenQuickView::automaticRepaint | ( | ) | const |
Definition at line 166 of file offscreenquickview.cpp.
QImage KWin::OffscreenQuickView::bufferAsImage | ( | ) | const |
Returns the current output of the scene graph
Definition at line 442 of file offscreenquickview.cpp.
GLTexture * KWin::OffscreenQuickView::bufferAsTexture | ( | ) |
Returns the current output of the scene graph
Definition at line 427 of file offscreenquickview.cpp.
QQuickItem * KWin::OffscreenQuickView::contentItem | ( | ) | const |
The invisble root item of the window
Definition at line 385 of file offscreenquickview.cpp.
void KWin::OffscreenQuickView::forwardKeyEvent | ( | QKeyEvent * | keyEvent | ) |
Inject a key event into the window. If it is handled the event will be accepted
Definition at line 321 of file offscreenquickview.cpp.
void KWin::OffscreenQuickView::forwardMouseEvent | ( | QEvent * | mouseEvent | ) |
Inject any mouse event into the QQuickWindow. Local co-ordinates are transformed If it is handled the event will be accepted
Definition at line 264 of file offscreenquickview.cpp.
bool KWin::OffscreenQuickView::forwardTouchDown | ( | qint32 | id, |
const QPointF & | pos, | ||
std::chrono::microseconds | time ) |
Definition at line 329 of file offscreenquickview.cpp.
bool KWin::OffscreenQuickView::forwardTouchMotion | ( | qint32 | id, |
const QPointF & | pos, | ||
std::chrono::microseconds | time ) |
Definition at line 341 of file offscreenquickview.cpp.
bool KWin::OffscreenQuickView::forwardTouchUp | ( | qint32 | id, |
std::chrono::microseconds | time ) |
Definition at line 353 of file offscreenquickview.cpp.
QRect KWin::OffscreenQuickView::geometry | ( | ) | const |
Definition at line 365 of file offscreenquickview.cpp.
|
signal |
bool KWin::OffscreenQuickView::hasAlphaChannel | ( | ) | const |
Definition at line 380 of file offscreenquickview.cpp.
void KWin::OffscreenQuickView::hide | ( | ) |
Definition at line 422 of file offscreenquickview.cpp.
bool KWin::OffscreenQuickView::isVisible | ( | ) | const |
Definition at line 412 of file offscreenquickview.cpp.
qreal KWin::OffscreenQuickView::opacity | ( | ) | const |
Definition at line 375 of file offscreenquickview.cpp.
void KWin::OffscreenQuickView::releaseResources | ( | ) |
|
signal |
|
signal |
The frame buffer has changed, contents need re-rendering on screen
|
signal |
void KWin::OffscreenQuickView::setAutomaticRepaint | ( | bool | set | ) |
Definition at line 171 of file offscreenquickview.cpp.
void KWin::OffscreenQuickView::setGeometry | ( | const QRect & | rect | ) |
The geometry of the current view This may be out of sync with the current buffer size if an update is pending
Definition at line 452 of file offscreenquickview.cpp.
void KWin::OffscreenQuickView::setOpacity | ( | qreal | opacity | ) |
Definition at line 370 of file offscreenquickview.cpp.
void KWin::OffscreenQuickView::setVisible | ( | bool | visible | ) |
Marks the window as visible/invisible This can be used to release resources used by the window The default is true.
Definition at line 395 of file offscreenquickview.cpp.
void KWin::OffscreenQuickView::show | ( | ) |
Definition at line 417 of file offscreenquickview.cpp.
QSize KWin::OffscreenQuickView::size | ( | ) | const |
Definition at line 447 of file offscreenquickview.cpp.
void KWin::OffscreenQuickView::update | ( | ) |
Render the current scene graph into the FBO. This is typically done automatically when the scene changes albeit deffered by a timer
It can be manually invoked to update the contents immediately. Note this will change the GL context
Definition at line 199 of file offscreenquickview.cpp.
void KWin::OffscreenQuickView::updateTouchState | ( | Qt::TouchPointState | state, |
qint32 | id, | ||
const QPointF & | pos ) |
QQuickWindow * KWin::OffscreenQuickView::window | ( | ) | const |
Definition at line 390 of file offscreenquickview.cpp.
Qt::MouseButton KWin::OffscreenQuickView::lastMousePressButton = Qt::NoButton |
Definition at line 60 of file offscreenquickview.cpp.
ulong KWin::OffscreenQuickView::lastMousePressTime = 0 |
Definition at line 59 of file offscreenquickview.cpp.
bool KWin::OffscreenQuickView::m_automaticRepaint = true |
Definition at line 54 of file offscreenquickview.cpp.
std::unique_ptr<QOpenGLFramebufferObject> KWin::OffscreenQuickView::m_fbo |
Definition at line 44 of file offscreenquickview.cpp.
std::unique_ptr<QOpenGLContext> KWin::OffscreenQuickView::m_glcontext |
Definition at line 43 of file offscreenquickview.cpp.
bool KWin::OffscreenQuickView::m_hasAlphaChannel = true |
Definition at line 53 of file offscreenquickview.cpp.
QImage KWin::OffscreenQuickView::m_image |
Definition at line 47 of file offscreenquickview.cpp.
std::unique_ptr<QOffscreenSurface> KWin::OffscreenQuickView::m_offscreenSurface |
Definition at line 42 of file offscreenquickview.cpp.
std::unique_ptr<QQuickRenderControl> KWin::OffscreenQuickView::m_renderControl |
Definition at line 41 of file offscreenquickview.cpp.
std::unique_ptr<QTimer> KWin::OffscreenQuickView::m_repaintTimer |
Definition at line 46 of file offscreenquickview.cpp.
std::unique_ptr<GLTexture> KWin::OffscreenQuickView::m_textureExport |
Definition at line 48 of file offscreenquickview.cpp.
bool KWin::OffscreenQuickView::m_useBlit = false |
Definition at line 51 of file offscreenquickview.cpp.
std::unique_ptr<QQuickWindow> KWin::OffscreenQuickView::m_view |
Definition at line 40 of file offscreenquickview.cpp.
bool KWin::OffscreenQuickView::m_visible = true |
Definition at line 52 of file offscreenquickview.cpp.
QPointingDevice* KWin::OffscreenQuickView::touchDevice |
Definition at line 57 of file offscreenquickview.cpp.
QList<QEventPoint> KWin::OffscreenQuickView::touchPoints |
Definition at line 56 of file offscreenquickview.cpp.