blob: 33f603999594e314e9a4ccb5299285482569e1e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
#include <QtDebug>
class Coordinate : public QObject
{
public:
int myX, myY;
int x() const { return myX; };
int y() const { return myY; };
};
//! [0]
QDebug operator<<(QDebug debug, const Coordinate &c)
{
QDebugStateSaver saver(debug);
debug.nospace() << '(' << c.x() << ", " << c.y() << ')';
return debug;
}
//! [0]
int main(int argv, char **args)
{
Coordinate coordinate;
coordinate.myX = 10;
coordinate.myY = 44;
//! [1]
qDebug() << "Date:" << QDate::currentDate();
qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0, 10, 50, 40);
qDebug() << "Custom coordinate type:" << coordinate;
//! [1]
}
|