From a3b2eac380bcd7d787e8fcc92a27bd7ed4f80b55 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 16 Jan 2020 11:18:21 +0100 Subject: QColor: add casts to ushort Silence lossy conversion warnings on MSVC. Task-number: QTBUG-80997 Change-Id: I0e5778b9f20b599de6fc8894c4b98fbc1b1510b9 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qcolor.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index f0d7dd23ad..0189f4e5f1 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -72,10 +72,10 @@ public: QColor(Qt::GlobalColor color) noexcept; Q_DECL_CONSTEXPR QColor(int r, int g, int b, int a = 255) noexcept : cspec(isRgbaValid(r, g, b, a) ? Rgb : Invalid), - ct(cspec == Rgb ? a * 0x0101 : 0, - cspec == Rgb ? r * 0x0101 : 0, - cspec == Rgb ? g * 0x0101 : 0, - cspec == Rgb ? b * 0x0101 : 0, + ct(ushort(cspec == Rgb ? a * 0x0101 : 0), + ushort(cspec == Rgb ? r * 0x0101 : 0), + ushort(cspec == Rgb ? g * 0x0101 : 0), + ushort(cspec == Rgb ? b * 0x0101 : 0), 0) {} QColor(QRgb rgb) noexcept; QColor(QRgba64 rgba64) noexcept; -- cgit v1.2.3 From 28f95d4688c28f8c06aa103012c6a00e197db12c Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 15 Jan 2020 14:38:14 +0100 Subject: Doc: Fix qdoc compilation errors qtbase Task-number: QTBUG-79824 Change-Id: I5a39525e3e735415ba96e2d585c5de754deb15de Reviewed-by: Venugopal Shivashankar --- src/gui/doc/qtgui.qdocconf | 1 + src/gui/kernel/qwindow.cpp | 1 - src/gui/painting/qbackingstore.cpp | 2 -- src/gui/painting/qpainter.cpp | 3 +-- src/gui/rhi/qrhimetal.mm | 2 +- 5 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src/gui') diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf index 76dd6d7ea1..d149caf069 100644 --- a/src/gui/doc/qtgui.qdocconf +++ b/src/gui/doc/qtgui.qdocconf @@ -41,6 +41,7 @@ depends += \ qtwidgets \ qtdoc \ qmake \ + qtcmake \ qttestlib headerdirs += .. diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index f701755500..0a4277c118 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2690,7 +2690,6 @@ QOpenGLContext *QWindowPrivate::shareContext() const platform dependent and untested. \sa setParent() - \sa setTransientParent() */ QWindow *QWindow::fromWinId(WId id) { diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index b0393aff95..0a49269c36 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -220,8 +220,6 @@ static bool isRasterSurface(QWindow *window) to the backingstore's top level window. You should call this function after ending painting with endPaint(). - - \sa QWindow::transientParent() */ void QBackingStore::flush(const QRegion ®ion, QWindow *window, const QPoint &offset) { diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 3ce54c20be..75e7dc49fd 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1404,8 +1404,7 @@ void QPainterPrivate::updateState(QPainterState *newState) cases where expensive operations are ok to use, for instance when the result is cached in a QPixmap. - \sa QPaintDevice, QPaintEngine, {Qt SVG}, {Basic Drawing Example}, - {Drawing Utility Functions} + \sa QPaintDevice, QPaintEngine, {Qt SVG}, {Basic Drawing Example}, {}{Drawing Utility Functions} */ /*! diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index 3ecc56d147..83fec31081 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -129,7 +129,7 @@ QT_BEGIN_NAMESPACE recording a frame, that is, between a \l{QRhi::beginFrame()}{beginFrame()} - \l{QRhi::endFrame()}{endFrame()} or \l{QRhi::beginOffscreenFrame()}{beginOffscreenFrame()} - - \l{QRhi::endOffsrceenFrame()}{endOffscreenFrame()} pair. + \l{QRhi::endOffscreenFrame()}{endOffsrceenFrame()} pair. \note The command encoder is only valid while recording a pass, that is, between \l{QRhiCommandBuffer::beginPass()} - -- cgit v1.2.3 From 9c172af7d5d8696a692fb2e040be11eae99a4b0c Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Mon, 23 Jul 2018 10:01:23 +0200 Subject: Doc: Update text that refers to deprecated member function width() * Add see also links from the deprecated function to the replacement. * Change introduction text to reflect new function name rather than the old and deprecated width(). * Change see also and inline references to width(), so that they now refer to horizontalAdvance(). Task-number: QTBUG-65141 Change-Id: Iadfbc517e5df96e32058516f8795bd210cc4c5e4 Reviewed-by: Nico Vertriest Reviewed-by: Venugopal Shivashankar --- src/gui/text/qfontmetrics.cpp | 70 +++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 33 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index d3e4f11e8c..b7a3066f3a 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -106,12 +106,12 @@ extern void qt_format_text(const QFont& font, const QRectF &_r, These are by necessity slow, and we recommend avoiding them if possible. - For each character, you can get its width(), leftBearing() and - rightBearing() and find out whether it is in the font using + For each character, you can get its horizontalAdvance(), leftBearing(), + and rightBearing(), and find out whether it is in the font using inFont(). You can also treat the character as a string, and use the string functions on it. - The string functions include width(), to return the width of a + The string functions include horizontalAdvance(), to return the width of a string in pixels (or points, for a printer), boundingRect(), to return a rectangle large enough to contain the rendered string, and size(), to return the size of that rectangle. @@ -464,9 +464,9 @@ bool QFontMetrics::inFontUcs4(uint ucs4) const value is negative if the pixels of the character extend to the left of the logical origin. - See width() for a graphical description of this metric. + See horizontalAdvance() for a graphical description of this metric. - \sa rightBearing(), minLeftBearing(), width() + \sa rightBearing(), minLeftBearing(), horizontalAdvance() */ int QFontMetrics::leftBearing(QChar ch) const { @@ -495,11 +495,11 @@ int QFontMetrics::leftBearing(QChar ch) const The right bearing is the left-ward distance of the right-most pixel of the character from the logical origin of a subsequent character. This value is negative if the pixels of the character - extend to the right of the width() of the character. + extend to the right of the horizontalAdvance() of the character. - See width() for a graphical description of this metric. + See horizontalAdvance() for a graphical description of this metric. - \sa leftBearing(), minRightBearing(), width() + \sa leftBearing(), minRightBearing(), horizontalAdvance() */ int QFontMetrics::rightBearing(QChar ch) const { @@ -535,7 +535,7 @@ int QFontMetrics::rightBearing(QChar ch) const \deprecated in Qt 5.11. Use horizontalAdvance() instead. - \sa boundingRect() + \sa boundingRect(), horizontalAdvance() */ int QFontMetrics::width(const QString &text, int len) const { @@ -601,7 +601,7 @@ int QFontMetrics::width(const QString &text, int len, int flags) const processing strings cannot be taken into account. When implementing an interactive text control, use QTextLayout instead. - \sa boundingRect() + \sa boundingRect(), horizontalAdvance() */ int QFontMetrics::width(QChar ch) const { @@ -751,7 +751,8 @@ int QFontMetrics::charWidth(const QString &text, int pos) const Note that the bounding rectangle may extend to the left of (0, 0), e.g. for italicized fonts, and that the width of the returned - rectangle might be different than what the width() method returns. + rectangle might be different than what the horizontalAdvance() method + returns. If you want to know the advance width of the string (to lay out a set of strings next to each other), use horizontalAdvance() instead. @@ -762,7 +763,8 @@ int QFontMetrics::charWidth(const QString &text, int pos) const The height of the bounding rectangle is at least as large as the value returned by height(). - \sa width(), height(), QPainter::boundingRect(), tightBoundingRect() + \sa horizontalAdvance(), height(), QPainter::boundingRect(), + tightBoundingRect() */ QRect QFontMetrics::boundingRect(const QString &text) const { @@ -790,7 +792,7 @@ QRect QFontMetrics::boundingRect(const QString &text) const \warning The width of the returned rectangle is not the advance width of the character. Use boundingRect(const QString &) or horizontalAdvance() instead. - \sa width() + \sa horizontalAdvance() */ QRect QFontMetrics::boundingRect(QChar ch) const { @@ -864,7 +866,7 @@ QRect QFontMetrics::boundingRect(QChar ch) const fontHeight() and lineSpacing() are used to calculate the height, rather than individual character heights. - \sa width(), QPainter::boundingRect(), Qt::Alignment + \sa horizontalAdvance(), QPainter::boundingRect(), Qt::Alignment */ QRect QFontMetrics::boundingRect(const QRect &rect, int flags, const QString &text, int tabStops, int *tabArray) const @@ -920,7 +922,8 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA Note that the bounding rectangle may extend to the left of (0, 0), e.g. for italicized fonts, and that the width of the returned - rectangle might be different than what the width() method returns. + rectangle might be different than what the horizontalAdvance() method + returns. If you want to know the advance width of the string (to lay out a set of strings next to each other), use horizontalAdvance() instead. @@ -930,7 +933,7 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA \warning Calling this method is very slow on Windows. - \sa width(), height(), boundingRect() + \sa horizontalAdvance(), height(), boundingRect() */ QRect QFontMetrics::tightBoundingRect(const QString &text) const { @@ -1079,12 +1082,12 @@ qreal QFontMetrics::fontDpi() const These are by necessity slow, and we recommend avoiding them if possible. - For each character, you can get its width(), leftBearing() and - rightBearing() and find out whether it is in the font using + For each character, you can get its horizontalAdvance(), leftBearing(), and + rightBearing(), and find out whether it is in the font using inFont(). You can also treat the character as a string, and use the string functions on it. - The string functions include width(), to return the width of a + The string functions include horizontalAdvance(), to return the width of a string in pixels (or points, for a printer), boundingRect(), to return a rectangle large enough to contain the rendered string, and size(), to return the size of that rectangle. @@ -1434,9 +1437,9 @@ bool QFontMetricsF::inFontUcs4(uint ucs4) const value is negative if the pixels of the character extend to the left of the logical origin. - See width() for a graphical description of this metric. + See horizontalAdvance() for a graphical description of this metric. - \sa rightBearing(), minLeftBearing(), width() + \sa rightBearing(), minLeftBearing(), horizontalAdvance() */ qreal QFontMetricsF::leftBearing(QChar ch) const { @@ -1465,11 +1468,11 @@ qreal QFontMetricsF::leftBearing(QChar ch) const The right bearing is the left-ward distance of the right-most pixel of the character from the logical origin of a subsequent character. This value is negative if the pixels of the character - extend to the right of the width() of the character. + extend to the right of the horizontalAdvance() of the character. - See width() for a graphical description of this metric. + See horizontalAdvance() for a graphical description of this metric. - \sa leftBearing(), minRightBearing(), width() + \sa leftBearing(), minRightBearing(), horizontalAdvance() */ qreal QFontMetricsF::rightBearing(QChar ch) const { @@ -1504,7 +1507,7 @@ qreal QFontMetricsF::rightBearing(QChar ch) const \deprecated in Qt 5.11. Use horizontalAdvance() instead. - \sa boundingRect() + \sa boundingRect(), horizontalAdvance() */ qreal QFontMetricsF::width(const QString &text) const { @@ -1535,7 +1538,7 @@ qreal QFontMetricsF::width(const QString &text) const processing strings cannot be taken into account. When implementing an interactive text control, use QTextLayout instead. - \sa boundingRect() + \sa boundingRect(), horizontalAdvance() */ qreal QFontMetricsF::width(QChar ch) const { @@ -1581,7 +1584,7 @@ qreal QFontMetricsF::horizontalAdvance(const QString &text, int length) const ch. Some of the metrics are described in the image to the right. The - central dark rectangles cover the logical width() of each + central dark rectangles cover the logical horizontalAdvance() of each character. The outer pale rectangles cover the leftBearing() and rightBearing() of each character. Notice that the bearings of "f" in this particular font are both negative, while the bearings of @@ -1632,7 +1635,7 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const Note that the bounding rectangle may extend to the left of (0, 0), e.g. for italicized fonts, and that the width of the returned - rectangle might be different than what the width() method returns. + rectangle might be different than what the horizontalAdvance() method returns. If you want to know the advance width of the string (to lay out a set of strings next to each other), use horizontalAdvance() instead. @@ -1643,7 +1646,7 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const The height of the bounding rectangle is at least as large as the value returned height(). - \sa width(), height(), QPainter::boundingRect() + \sa horizontalAdvance(), height(), QPainter::boundingRect() */ QRectF QFontMetricsF::boundingRect(const QString &text) const { @@ -1669,7 +1672,7 @@ QRectF QFontMetricsF::boundingRect(const QString &text) const Note that the rectangle usually extends both above and below the base line. - \sa width() + \sa horizontalAdvance() */ QRectF QFontMetricsF::boundingRect(QChar ch) const { @@ -1746,7 +1749,7 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const fontHeight() and lineSpacing() are used to calculate the height, rather than individual character heights. - \sa width(), QPainter::boundingRect(), Qt::Alignment + \sa horizontalAdvance(), QPainter::boundingRect(), Qt::Alignment */ QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString& text, int tabStops, int *tabArray) const @@ -1805,7 +1808,8 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta Note that the bounding rectangle may extend to the left of (0, 0), e.g. for italicized fonts, and that the width of the returned - rectangle might be different than what the width() method returns. + rectangle might be different than what the horizontalAdvance() method + returns. If you want to know the advance width of the string (to lay out a set of strings next to each other), use horizontalAdvance() instead. @@ -1815,7 +1819,7 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta \warning Calling this method is very slow on Windows. - \sa width(), height(), boundingRect() + \sa horizontalAdvance(), height(), boundingRect() */ QRectF QFontMetricsF::tightBoundingRect(const QString &text) const { -- cgit v1.2.3