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
qhaikucursor.cpp
Go to the documentation of this file.
1
// Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com>
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 "
qhaikucursor.h
"
5
6
#include "
qhaikurasterwindow.h
"
7
8
#include <Cursor.h>
9
10
QHaikuCursor::QHaikuCursor
()
11
{
12
m_cursorIds.
insert
(
Qt::ArrowCursor
, B_CURSOR_ID_SYSTEM_DEFAULT);
13
m_cursorIds.
insert
(
Qt::UpArrowCursor
, B_CURSOR_ID_RESIZE_NORTH);
14
m_cursorIds.
insert
(
Qt::CrossCursor
, B_CURSOR_ID_CROSS_HAIR);
15
m_cursorIds.
insert
(
Qt::WaitCursor
, B_CURSOR_ID_PROGRESS);
16
m_cursorIds.
insert
(
Qt::IBeamCursor
, B_CURSOR_ID_I_BEAM);
17
m_cursorIds.
insert
(
Qt::SizeVerCursor
, B_CURSOR_ID_RESIZE_NORTH_SOUTH);
18
m_cursorIds.
insert
(
Qt::SizeHorCursor
, B_CURSOR_ID_RESIZE_EAST_WEST);
19
m_cursorIds.
insert
(
Qt::SizeBDiagCursor
, B_CURSOR_ID_RESIZE_NORTH_EAST_SOUTH_WEST);
20
m_cursorIds.
insert
(
Qt::SizeFDiagCursor
, B_CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST);
21
m_cursorIds.
insert
(
Qt::SizeAllCursor
, B_CURSOR_ID_MOVE);
22
m_cursorIds.
insert
(
Qt::BlankCursor
, B_CURSOR_ID_NO_CURSOR);
23
m_cursorIds.
insert
(
Qt::SplitVCursor
, B_CURSOR_ID_RESIZE_NORTH_SOUTH);
24
m_cursorIds.
insert
(
Qt::SplitHCursor
, B_CURSOR_ID_RESIZE_EAST_WEST);
25
m_cursorIds.
insert
(
Qt::PointingHandCursor
, B_CURSOR_ID_FOLLOW_LINK);
26
m_cursorIds.
insert
(
Qt::ForbiddenCursor
, B_CURSOR_ID_NOT_ALLOWED);
27
m_cursorIds.
insert
(
Qt::OpenHandCursor
, B_CURSOR_ID_GRAB);
28
m_cursorIds.
insert
(
Qt::ClosedHandCursor
, B_CURSOR_ID_GRABBING);
29
m_cursorIds.
insert
(
Qt::WhatsThisCursor
, B_CURSOR_ID_HELP);
30
m_cursorIds.
insert
(
Qt::BusyCursor
, B_CURSOR_ID_PROGRESS);
31
}
32
33
#ifndef QT_NO_CURSOR
34
void
QHaikuCursor::changeCursor
(
QCursor
*windowCursor,
QWindow
*
window
)
35
{
36
if
(!
window
)
37
return
;
38
39
BWindow *haikuWindow =
reinterpret_cast<
BWindow*
>
(
window
->winId());
40
41
// We expect that every BWindow has exactly one BView as child,
42
// so we can use CurrentFocus to retrieve it and call SetViewCursor
43
// to change the cursor for the whole window.
44
if
(!windowCursor) {
45
BView *
view
= haikuWindow->CurrentFocus();
46
if
(
view
) {
47
view
->SetViewCursor(B_CURSOR_SYSTEM_DEFAULT);
48
}
49
}
else
{
50
const
Qt::CursorShape
shape = windowCursor->shape();
51
if
(!m_cursors.
contains
(shape))
52
m_cursors.
insert
(shape,
new
BCursor(m_cursorIds.
value
(shape)));
53
54
BView *
view
= haikuWindow->CurrentFocus();
55
if
(
view
) {
56
view
->LockLooper();
57
view
->SetViewCursor(m_cursors.
value
(shape));
58
view
->UnlockLooper();
59
}
60
}
61
}
62
#endif
QCursor
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition
qcursor.h:45
QHaikuCursor::changeCursor
void changeCursor(QCursor *windowCursor, QWindow *window) override
This method is called by Qt whenever the cursor graphic should be changed.
Definition
qhaikucursor.cpp:34
QHaikuCursor::QHaikuCursor
QHaikuCursor()
Definition
qhaikucursor.cpp:10
QHash::contains
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
Definition
qhash.h:1007
QHash::value
T value(const Key &key) const noexcept
Definition
qhash.h:1054
QHash::insert
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition
qhash.h:1303
QWindow
\inmodule QtGui
Definition
qwindow.h:63
Qt::CursorShape
CursorShape
Definition
qnamespace.h:1155
Qt::BlankCursor
@ BlankCursor
Definition
qnamespace.h:1166
Qt::CrossCursor
@ CrossCursor
Definition
qnamespace.h:1158
Qt::PointingHandCursor
@ PointingHandCursor
Definition
qnamespace.h:1169
Qt::SizeHorCursor
@ SizeHorCursor
Definition
qnamespace.h:1162
Qt::SizeAllCursor
@ SizeAllCursor
Definition
qnamespace.h:1165
Qt::WaitCursor
@ WaitCursor
Definition
qnamespace.h:1159
Qt::SizeVerCursor
@ SizeVerCursor
Definition
qnamespace.h:1161
Qt::OpenHandCursor
@ OpenHandCursor
Definition
qnamespace.h:1173
Qt::SizeFDiagCursor
@ SizeFDiagCursor
Definition
qnamespace.h:1164
Qt::WhatsThisCursor
@ WhatsThisCursor
Definition
qnamespace.h:1171
Qt::ArrowCursor
@ ArrowCursor
Definition
qnamespace.h:1156
Qt::SplitVCursor
@ SplitVCursor
Definition
qnamespace.h:1167
Qt::UpArrowCursor
@ UpArrowCursor
Definition
qnamespace.h:1157
Qt::ClosedHandCursor
@ ClosedHandCursor
Definition
qnamespace.h:1174
Qt::IBeamCursor
@ IBeamCursor
Definition
qnamespace.h:1160
Qt::SizeBDiagCursor
@ SizeBDiagCursor
Definition
qnamespace.h:1163
Qt::ForbiddenCursor
@ ForbiddenCursor
Definition
qnamespace.h:1170
Qt::BusyCursor
@ BusyCursor
Definition
qnamespace.h:1172
Qt::SplitHCursor
@ SplitHCursor
Definition
qnamespace.h:1168
qhaikucursor.h
qhaikurasterwindow.h
window
aWidget window() -> setWindowTitle("New Window Title")
[2]
view
QQuickView * view
[0]
Definition
src_plugins_platforms_qnx_qqnxwindow.cpp:5
qtbase
src
plugins
platforms
haiku
qhaikucursor.cpp
Generated by
1.10.0