1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2016 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of the documentation of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:BSD$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see https://www.qt.io/terms-conditions. For further 15 ** information use the contact form at https://www.qt.io/contact-us. 16 ** 17 ** BSD License Usage 18 ** Alternatively, you may use this file under the terms of the BSD license 19 ** as follows: 20 ** 21 ** "Redistribution and use in source and binary forms, with or without 22 ** modification, are permitted provided that the following conditions are 23 ** met: 24 ** * Redistributions of source code must retain the above copyright 25 ** notice, this list of conditions and the following disclaimer. 26 ** * Redistributions in binary form must reproduce the above copyright 27 ** notice, this list of conditions and the following disclaimer in 28 ** the documentation and/or other materials provided with the 29 ** distribution. 30 ** * Neither the name of The Qt Company Ltd nor the names of its 31 ** contributors may be used to endorse or promote products derived 32 ** from this software without specific prior written permission. 33 ** 34 ** 35 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 ** 47 ** $QT_END_LICENSE$ 48 ** 49 ****************************************************************************/ 50 51 //! [0] 52 QSize t1(10, 12); 53 t1.scale(60, 60, Qt::IgnoreAspectRatio); 54 // t1 is (60, 60) 55 56 QSize t2(10, 12); 57 t2.scale(60, 60, Qt::KeepAspectRatio); 58 // t2 is (50, 60) 59 60 QSize t3(10, 12); 61 t3.scale(60, 60, Qt::KeepAspectRatioByExpanding); 62 // t3 is (60, 72) 63 //! [0] 64 65 66 //! [1] 67 QSize size(100, 10); 68 size.rwidth() += 20; 69 70 // size becomes (120,10) 71 //! [1] 72 73 74 //! [2] 75 QSize size(100, 10); 76 size.rheight() += 5; 77 78 // size becomes (100,15) 79 //! [2] 80 81 82 //! [3] 83 QSize s( 3, 7); 84 QSize r(-1, 4); 85 s += r; 86 87 // s becomes (2,11) 88 //! [3] 89 90 91 //! [4] 92 QSize s( 3, 7); 93 QSize r(-1, 4); 94 s -= r; 95 96 // s becomes (4,3) 97 //! [4] 98 99 100 //! [5] 101 QSizeF t1(10, 12); 102 t1.scale(60, 60, Qt::IgnoreAspectRatio); 103 // t1 is (60, 60) 104 105 QSizeF t2(10, 12); 106 t2.scale(60, 60, Qt::KeepAspectRatio); 107 // t2 is (50, 60) 108 109 QSizeF t3(10, 12); 110 t3.scale(60, 60, Qt::KeepAspectRatioByExpanding); 111 // t3 is (60, 72) 112 //! [5] 113 114 115 //! [6] 116 QSizeF size(100.3, 10); 117 size.rwidth() += 20.5; 118 119 // size becomes (120.8,10) 120 //! [6] 121 122 123 //! [7] 124 QSizeF size(100, 10.2); 125 size.rheight() += 5.5; 126 127 // size becomes (100,15.7) 128 //! [7] 129 130 131 //! [8] 132 QSizeF s( 3, 7); 133 QSizeF r(-1, 4); 134 s += r; 135 136 // s becomes (2,11) 137 //! [8] 138 139 140 //! [9] 141 QSizeF s( 3, 7); 142 QSizeF r(-1, 4); 143 s -= r; 144 145 // s becomes (4,3) 146 //! [9] 147