diff options
Diffstat (limited to 'src/gui/doc/src/coordsys.qdoc')
-rw-r--r-- | src/gui/doc/src/coordsys.qdoc | 69 |
1 files changed, 27 insertions, 42 deletions
diff --git a/src/gui/doc/src/coordsys.qdoc b/src/gui/doc/src/coordsys.qdoc index ed413b500f..087916635b 100644 --- a/src/gui/doc/src/coordsys.qdoc +++ b/src/gui/doc/src/coordsys.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page coordsys.html @@ -111,7 +87,7 @@ \endtable When rendering with a pen with an even number of pixels, the - pixels will be rendered symetrically around the mathematical + pixels will be rendered symmetrically around the mathematical defined points, while rendering with a pen with an odd number of pixels, the spare pixel will be rendered to the right and below the mathematical point as in the one pixel case. See the QRectF @@ -119,7 +95,7 @@ \table \header - \li {3,1} QRectF + \li {2,1} QRectF \row \li \inlineimage qrect-diagram-zero.png \li \inlineimage qrectf-diagram-one.png @@ -160,7 +136,7 @@ \section2 Anti-aliased Painting If you set QPainter's \l {QPainter::Antialiasing}{anti-aliasing} - render hint, the pixels will be rendered symetrically on both + render hint, the pixels will be rendered symmetrically on both sides of the mathematically defined points: \table @@ -237,11 +213,11 @@ \row \li {2,1} - \snippet analogclock/main.cpp 1 + \snippet ../widgets/widgets/analogclock/analogclock.cpp 9 We translate the coordinate system so that point (0, 0) is in the widget's center, instead of being at the top-left corner. We also - scale the system by \c side / 100, where \c side is either the + scale the system by \c side / 200, where \c side is either the widget's width or the height, whichever is shortest. We want the clock to be square, even if the device isn't. @@ -251,7 +227,7 @@ See also the \l {Window-Viewport Conversion} section. - \snippet analogclock/main.cpp 2 + \snippet ../widgets/widgets/analogclock/analogclock.cpp 18 We draw the clock's hour hand by rotating the coordinate system and calling QPainter::drawConvexPolygon(). Thank's to the @@ -259,26 +235,35 @@ The polygon is specified as an array of alternating \e x, \e y values, stored in the \c hourHand static variable (defined at the - beginning of the function), which corresponds to the four points - (2, 0), (0, 2), (-2, 0), and (0, -25). + beginning of the function), which corresponds to the three points + (7, 8), (-7, 8), (0, -40). The calls to QPainter::save() and QPainter::restore() surrounding the code guarantees that the code that follows won't be disturbed by the transformations we've used. - \snippet analogclock/main.cpp 3 + \snippet ../widgets/widgets/analogclock/analogclock.cpp 21 + + After that, we draw the hour markers for the clock face, which + consists of twelve short lines at 30-degree intervals. When that + loop is done, the painter has been rotated a full circle back to + its original state, so we don't need to save and restore the state. + + \snippet ../widgets/widgets/analogclock/analogclock.cpp 24 We do the same for the clock's minute hand, which is defined by - the four points (1, 0), (0, 1), (-1, 0), and (0, -40). These + the three points (7, 8), (-7, 8), (0, -70). These coordinates specify a hand that is thinner and longer than the minute hand. - \snippet analogclock/main.cpp 4 + \snippet ../widgets/widgets/analogclock/analogclock.cpp 27 - Finally, we draw the clock face, which consists of twelve short - lines at 30-degree intervals. At the end of that, the painter is - rotated in a way which isn't very useful, but we're done with - painting so that doesn't matter. + Finally, we draw the minute markers for the clock face, which + consists of sixty short lines at 6-degree intervals. We skip every + fifth minute marker because we don't want to draw over the hour + markers. At the end of that, the painter is rotated in a way which + isn't very useful, but we're done with painting so that doesn't + matter. \endtable For more information about the transformation matrix, see the @@ -446,5 +431,5 @@ \endtable \endomit - \sa {Analog Clock Window Example} + \sa {Analog Clock} */ |