Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qvideooutputorientationhandler.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 Research In Motion
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
"qvideooutputorientationhandler_p.h"
5
6
#
include
<
QGuiApplication
>
7
#
include
<
QScreen
>
8
9
QT_BEGIN_NAMESPACE
10
11
bool
QVideoOutputOrientationHandler::m_isRecording =
false
;
12
13
QVideoOutputOrientationHandler::QVideoOutputOrientationHandler(QObject *parent)
14
: QObject(parent)
15
, m_currentOrientation(0)
16
{
17
QScreen *screen = QGuiApplication::primaryScreen();
18
if
(!screen)
19
return
;
20
21
connect(screen, &QScreen::orientationChanged,
this
,
22
&QVideoOutputOrientationHandler::screenOrientationChanged);
23
24
screenOrientationChanged(screen->orientation());
25
}
26
27
int
QVideoOutputOrientationHandler::currentOrientation()
const
28
{
29
return
m_currentOrientation;
30
}
31
32
void
QVideoOutputOrientationHandler::screenOrientationChanged(Qt::ScreenOrientation orientation)
33
{
34
if
(m_isRecording)
35
return
;
36
37
const
QScreen *screen = QGuiApplication::primaryScreen();
38
if
(!screen)
39
return
;
40
41
const
int
angle = (360 - screen->angleBetween(screen->nativeOrientation(), orientation)) % 360;
42
43
if
(angle == m_currentOrientation)
44
return
;
45
46
m_currentOrientation = angle;
47
Q_EMIT orientationChanged(m_currentOrientation);
48
}
49
50
QT_END_NAMESPACE
51
52
#
include
"moc_qvideooutputorientationhandler_p.cpp"
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtmultimedia
src
multimedia
video
qvideooutputorientationhandler.cpp
Generated on
for Qt by
1.18.0