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
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
5
6#include <QGuiApplication>
7#include <QScreen>
8
10
11bool QVideoOutputOrientationHandler::m_isRecording = false;
12
14 : QObject(parent)
15 , m_currentOrientation(0)
16{
18 if (!screen)
19 return;
20
22 &QVideoOutputOrientationHandler::screenOrientationChanged);
23
24 screenOrientationChanged(screen->orientation());
25}
26
28{
29 return m_currentOrientation;
30}
31
32void QVideoOutputOrientationHandler::screenOrientationChanged(Qt::ScreenOrientation orientation)
33{
34 if (m_isRecording)
35 return;
36
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 emit orientationChanged(m_currentOrientation);
48}
49
51
52#include "moc_qvideooutputorientationhandler_p.cpp"
QScreen * primaryScreen
the primary (or default) screen of the application.
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const
Convenience function to compute the angle of rotation to get from rotation a to rotation b.
Definition qscreen.cpp:519
Qt::ScreenOrientation nativeOrientation
the native screen orientation
Definition qscreen.h:63
Qt::ScreenOrientation orientation
the screen orientation
Definition qscreen.h:62
void orientationChanged(Qt::ScreenOrientation orientation)
This signal is emitted when the orientation of the screen changes with orientation as an argument.
void orientationChanged(int angle)
QVideoOutputOrientationHandler(QObject *parent=nullptr)
Combined button and popup list for selecting options.
ScreenOrientation
Definition qnamespace.h:271
GLfloat angle
QScreen * screen
[1]
Definition main.cpp:29
#define emit