Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickioscursorflashtimer.cpp
Go to the documentation of this file.
1
// Copyright (C) 2022 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
// Qt-Security score:significant reason:default
4
5
#
include
"qquickioscursorflashtimer_p.h"
6
#
include
<
QtGui
/
qguiapplication
.
h
>
7
#
include
<
QtGui
/
qstylehints
.
h
>
8
9
QT_BEGIN_NAMESPACE
10
11
QQuickIOSCursorFlashTimer::QQuickIOSCursorFlashTimer(
QObject
*
parent
)
12
:
QObject
(
parent
)
13
{
14
}
15
16
bool
QQuickIOSCursorFlashTimer::visible()
const
17
{
18
return
m_visible;
19
}
20
21
void
QQuickIOSCursorFlashTimer::setVisible(
bool
visible)
22
{
23
if
(m_visible == visible)
24
return
;
25
m_visible = visible;
26
emit visibleChanged();
27
}
28
29
int
QQuickIOSCursorFlashTimer::cursorPosition()
const
30
{
31
return
m_cursorPosition;
32
}
33
34
void
QQuickIOSCursorFlashTimer::setCursorPosition(
int
cursorPosition)
35
{
36
if
(m_cursorPosition == cursorPosition)
37
return
;
38
m_cursorPosition = cursorPosition;
39
emit cursorPositionChanged();
40
start();
41
}
42
43
bool
QQuickIOSCursorFlashTimer::running()
const
44
{
45
return
m_running;
46
}
47
48
void
QQuickIOSCursorFlashTimer::setRunning(
bool
running)
49
{
50
if
(running == m_running)
51
return
;
52
m_running = running;
53
emit runningChanged(m_running);
54
if
(!running) {
55
stop();
56
setVisible(
false
);
57
}
else
{
58
start();
59
}
60
}
61
62
void
QQuickIOSCursorFlashTimer::start()
63
{
64
stop();
65
m_timer = startTimer(QGuiApplication::styleHints()->cursorFlashTime() / 2);
66
}
67
68
void
QQuickIOSCursorFlashTimer::stop()
69
{
70
killTimer(m_timer);
71
m_timer = 0;
72
}
73
74
void
QQuickIOSCursorFlashTimer::timerEvent(QTimerEvent *event)
75
{
76
if
(event->timerId() == m_timer)
77
setVisible(!visible());
78
}
79
80
QT_END_NAMESPACE
QObjectData::parent
QObject * parent
Definition
qobject.h:73
QObject
\inmodule QtCore
Definition
qobject.h:105
QPlatformGraphicsBufferHelper
\inmodule QtGui
qtdeclarative
src
quickcontrols
ios
impl
qquickioscursorflashtimer.cpp
Generated on
for Qt by
1.14.0