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
qwaylandoutputmode.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
7
8/*!
9 \class QWaylandOutputMode
10 \inmodule QtWaylandCompositor
11 \since 5.8
12 \brief The QWaylandOutputMode class holds the resolution and refresh rate of an output.
13
14 QWaylandOutputMode holds the resolution and refresh rate of an output.
15 Resolution is expressed in pixels and refresh rate is measured in mHz.
16
17 \sa QWaylandOutput
18*/
19
20QWaylandOutputMode::QWaylandOutputMode()
21 : d(new QWaylandOutputModePrivate)
22{
23}
24
25QWaylandOutputMode::QWaylandOutputMode(const QSize &size, int refreshRate)
26 : d(new QWaylandOutputModePrivate)
27{
28 d->size = size;
29 d->refreshRate = refreshRate;
30}
31
32QWaylandOutputMode::QWaylandOutputMode(const QWaylandOutputMode &other)
33 : d(new QWaylandOutputModePrivate)
34{
35 d->size = other.size();
36 d->refreshRate = other.refreshRate();
37}
38
39QWaylandOutputMode::~QWaylandOutputMode()
40{
41 delete d;
42}
43
44QWaylandOutputMode &QWaylandOutputMode::operator=(const QWaylandOutputMode &other)
45{
46 d->size = other.size();
47 d->refreshRate = other.refreshRate();
48 return *this;
49}
50
51/*!
52 Returns \c true if this mode is equal to \a other,
53 otherwise returns \c false.
54*/
55bool QWaylandOutputMode::operator==(const QWaylandOutputMode &other) const
56{
57 return size() == other.size() && refreshRate() == other.refreshRate();
58}
59
60/*!
61 Returns \c true if this mode is not equal to \a other,
62 otherwise returns \c false.
63*/
64bool QWaylandOutputMode::operator!=(const QWaylandOutputMode &other) const
65{
66 return size() != other.size() || refreshRate() != other.refreshRate();
67}
68
69/*!
70 Returns whether this mode contains a valid resolution and refresh rate.
71*/
72bool QWaylandOutputMode::isValid() const
73{
74 return !d->size.isEmpty() && d->refreshRate > 0;
75}
76
77/*!
78 Returns the resolution in pixels.
79*/
80QSize QWaylandOutputMode::size() const
81{
82 return d->size;
83}
84
85/*!
86 Returns the refresh rate in mHz.
87*/
88int QWaylandOutputMode::refreshRate() const
89{
90 return d->refreshRate;
91}
92
93/*!
94 * \internal
95 */
96void QWaylandOutputMode::setSize(const QSize &size)
97{
98 d->size = size;
99}