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
qqmlsourcecoordinate_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 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
4#ifndef QQMLSOURCECOORDINATE_P_H
5#define QQMLSOURCECOORDINATE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/private/qglobal_p.h>
19
20#include <limits>
21
23
24// These methods are needed because in some public methods we historically interpret -1 as the
25// invalid line or column, even though all the lines and columns are 1-based. Also, the different
26// integer ranges may turn certain large values into invalid ones on conversion.
27
28template<typename From, typename To>
30
31template<>
33{
34 return (n > 0 && n <= int(std::numeric_limits<quint16>::max())) ? quint16(n) : 0;
35}
36
37template<>
39{
40 return n > 0 ? quint32(n) : 0u;
41}
42
43// TODO: In Qt6, change behavior and make the invalid coordinate 0 for the following two methods.
44
45template<>
47{
48 return (n == 0u) ? -1 : int(n);
49}
50
51template<>
53{
54 return (n == 0u || n > quint32(std::numeric_limits<int>::max())) ? -1 : int(n);
55}
56
58
59#endif // QQMLSOURCECOORDINATE_P_H
Combined button and popup list for selecting options.
GLfloat n
int qmlConvertSourceCoordinate< quint32, int >(quint32 n)
quint32 qmlConvertSourceCoordinate< int, quint32 >(int n)
QT_BEGIN_NAMESPACE To qmlConvertSourceCoordinate(From n)
quint16 qmlConvertSourceCoordinate< int, quint16 >(int n)
int qmlConvertSourceCoordinate< quint16, int >(quint16 n)
unsigned int quint32
Definition qtypes.h:50
unsigned short quint16
Definition qtypes.h:48