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
qdebugsnippet.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4
#
include
<
QtGui
>
5
#
include
<
QtDebug
>
6
7
class
Coordinate
:
public
QObject
8
{
9
public
:
10
int
myX
,
myY
;
11
12
int
x
()
const
{
return
myX
; };
13
int
y
()
const
{
return
myY
; };
14
};
15
16
//! [0]
17
QDebug
operator
<<(QDebug debug,
const
Coordinate
&c)
18
{
19
QDebugStateSaver saver(debug);
20
debug.nospace() <<
'('
<< c
.
x
(
)
<<
", "
<< c
.
y
(
)
<<
')'
;
21
22
return
debug;
23
}
24
//! [0]
25
26
int
main
(
int
argv,
char
**args)
27
{
28
Coordinate
coordinate;
29
coordinate
.
myX
= 10;
30
coordinate
.
myY
= 44;
31
32
//! [1]
33
qDebug() <<
"Date:"
<< QDate::currentDate();
34
qDebug() <<
"Types:"
<< QString(
"String"
) << QChar(
'x'
) << QRect(0, 10, 50, 40);
35
qDebug() <<
"Custom coordinate type:"
<< coordinate;
36
//! [1]
37
}
Coordinate
Definition
qdebugsnippet.cpp:8
Coordinate::x
int x() const
Definition
qdebugsnippet.cpp:12
Coordinate::myX
int myX
Definition
qdebugsnippet.cpp:10
Coordinate::y
int y() const
Definition
qdebugsnippet.cpp:13
Coordinate::myY
int myY
Definition
qdebugsnippet.cpp:10
operator<<
QDebug operator<<(QDebug debug, const Coordinate &c)
[0]
Definition
qdebugsnippet.cpp:17
main
int main(int argc, char *argv[])
[ctor_close]
Definition
src_corelib_animation_qpropertyanimation.cpp:100
qtbase
src
corelib
doc
snippets
qdebug
qdebugsnippet.cpp
Generated on
for Qt by
1.14.0