Logo    
KDWinUtils
Helper library for MFC to Qt migration
Loading...
Searching...
No Matches
ksize.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** This file is part of KDWinutils, KDAB's MFC to Qt migration tool.
4**
5** Copyright (C) 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6** All rights reserved.
7**
8** This file is intended solely for use by the migration tools and services
9** provided by Klarälvdalens Datakonsult AB.
10**
11** Any other use or distribution of this software that is not otherwise agreed
12** upon in writing and signed by an authorized representative of Klarälvdalens
13** Datakonsult AB, KDAB (USA) LLC, KDAB (Deutschland) GmbH & Co. K.G.,
14** KDAB (France) SAS, KDAB (UK), Ltd., or any future subsidiary of Klarälvdalens
15** Datakonsult AB is hereby prohibited.
16**
17** Contact info@kdab.com if any conditions stated above are unclear to you.
18**
19****************************************************************************/
20
21#pragma once
22
24
25#include <QSize>
26
27#ifdef KDWINUTILS_WITHMFC
28#include <atltypes.h>
29#endif
30
32
33class KPoint;
34
43{
44public:
45 int cx = 0;
46 int cy = 0;
47
49 explicit KSize(int cx, int cy);
50 /* implicit */ KSize(const KPoint &cp);
51
52 // QSize specific methods
53 /* implicit */ KSize(const QSize &qs);
54 KSize &operator=(const QSize &size);
55 QSize toQSize() const;
56 /* implicit */ operator QSize() const;
57
58#ifdef KDWINUTILS_WITHMFC
59 // CPoint specific methods, available only on Windows with MFC set
60 explicit KSize(const CSize &cs);
61 KSize &operator=(const CSize &cs);
62 CSize toCSize() const;
63 /* implicit */ operator CSize() const;
64#endif // KDWINUTILS_WITHMFC
65
66 // MFC API from here on
68
69 void operator+=(const KSize &other);
71 void operator-=(const KSize &other);
72};
73
76KDWINUTILS_EXPORT bool operator==(const KSize &lhs, const KSize &rhs) noexcept;
79KDWINUTILS_EXPORT bool operator!=(const KSize &lhs, const KSize &rhs) noexcept;
80
84
94
The KPoint class defines a point in the plane using integer precision.
Definition kpoint.h:43
KSize operator-(const KPoint &lhs, const KPoint &rhs)
Subtracts two points and returns a size.
The KSize class defines the size of a two-dimensional object using integer point precision.
Definition ksize.h:43
bool operator!=(const KSize &lhs, const KSize &rhs) noexcept
Checks for inequality between 2 sizes.
CSize toCSize() const
KSize & operator=(const QSize &size)
KSize operator+(const KSize &lhs, const KSize &rhs)
Adds two sizes.
QSize toQSize() const
KSize & operator=(const CSize &cs)
KSize(int cx, int cy)
void operator-=(const KSize &other)
Subtracts a KSize from the current KSize.
KSize operator-(const KSize &lhs, const KSize &rhs)
Subtracts two sizes.
void operator+=(const KSize &other)
Adds a KSize to the current KSize.
bool operator==(const KSize &lhs, const KSize &rhs) noexcept
Checks for equality between 2 sizes.
KSize(const KPoint &cp)
KSize(const QSize &qs)
KSize operator-(const KSize &size)
Returns the negation of a KSize.
KSize(const CSize &cs)
#define KDWINUTILS_EXPORT
Definition kdwinutils_export.h:31
#define KDWINUTILS_BEGIN_NAMESPACE
Definition kdwinutils_global.h:27
#define KDWINUTILS_END_NAMESPACE
Definition kdwinutils_global.h:28