Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdirectfbcursor.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qdirectfbcursor.h"
6
8
10 : m_screen(screen)
11{
12#ifndef QT_NO_CURSOR
13 m_image.reset(new QPlatformCursorImage(0, 0, 0, 0, 0, 0));
14#endif
15}
16
17#ifndef QT_NO_CURSOR
19{
20 int xSpot;
21 int ySpot;
23
24 const Qt::CursorShape newShape = cursor ? cursor->shape() : Qt::ArrowCursor;
25 if (newShape != Qt::BitmapCursor) {
26 m_image->set(newShape);
27 xSpot = m_image->hotspot().x();
28 ySpot = m_image->hotspot().y();
29 QImage *i = m_image->image();
31 } else {
32 QPoint point = cursor->hotSpot();
33 xSpot = point.x();
34 ySpot = point.y();
35 map = cursor->pixmap();
36 }
37
38 DFBResult res;
39 IDirectFBDisplayLayer *layer = toDfbLayer(m_screen);
40 IDirectFBSurface* surface(QDirectFbConvenience::dfbSurfaceForPlatformPixmap(map.handle()));
41
42 res = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
43 if (res != DFB_OK) {
44 DirectFBError("Failed to set DLSCL_ADMINISTRATIVE", res);
45 return;
46 }
47
48 layer->SetCursorShape(layer, surface, xSpot, ySpot);
49 layer->SetCooperativeLevel(layer, DLSCL_SHARED);
50}
51#endif
52
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition qcursor.h:45
QPixmap pixmap() const
Returns the cursor pixmap.
Definition qcursor.cpp:584
Qt::CursorShape shape() const
Returns the cursor shape identifier.
Definition qcursor.cpp:498
QPoint hotSpot() const
Returns the cursor hot spot, or (0, 0) if it is one of the standard cursors.
Definition qcursor.cpp:595
QDirectFBCursor(QPlatformScreen *screen)
void changeCursor(QCursor *cursor, QWindow *window) override
This method is called by Qt whenever the cursor graphic should be changed.
static IDirectFBSurface * dfbSurfaceForPlatformPixmap(QPlatformPixmap *)
\inmodule QtGui
Definition qimage.h:37
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
Definition qpixmap.cpp:1437
The QPlatformCursorImage class provides a set of graphics intended to be used as cursors.
QPoint hotspot() const
Return the cursor's hotspot.
void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
Sets the cursor image to the graphic represented by the combination of data and mask,...
QImage * image()
Return the cursor graphic as a pointer to a QImage.
The QPlatformScreen class provides an abstraction for visual displays.
\inmodule QtCore\reentrant
Definition qpoint.h:25
constexpr int x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:130
constexpr int y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:135
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
\inmodule QtGui
Definition qwindow.h:63
QMap< QString, QString > map
[6]
QCursor cursor
Combined button and popup list for selecting options.
CursorShape
@ BitmapCursor
@ ArrowCursor
IDirectFBDisplayLayer * toDfbLayer(QPlatformScreen *screen)
EGLOutputLayerEXT layer
GLuint res
QScreen * screen
[1]
Definition main.cpp:29