From 229f931d6e0227108e44d85586c88c562500eb12 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Fri, 12 Jul 2013 14:45:25 +0200 Subject: [PATCH] Add support for baseline alignment This is a prerequisite for baseline support in Qt Quick Layouts Change-Id: I1f032106cd1e7248a7688b6b9ca59f062a596d49 Reviewed-by: Konstantin Ritt Reviewed-by: J-P Nurmi --- src/corelib/global/qnamespace.h | 9 +++++++-- src/corelib/global/qnamespace.qdoc | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 81329fd5ba..836d4a92ed 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -223,7 +223,7 @@ public: // Text formatting flags for QPainter::drawText and QLabel. // The following two enums can be combined to one integer which - // is passed as 'flags' to drawText and qt_format_text. + // is passed as 'flags' to QPainter::drawText, QFontMetrics::boundingRect and qt_format_text. enum AlignmentFlag { AlignLeft = 0x0001, @@ -238,7 +238,12 @@ public: AlignTop = 0x0020, AlignBottom = 0x0040, AlignVCenter = 0x0080, - AlignVertical_Mask = AlignTop | AlignBottom | AlignVCenter, + AlignBaseline = 0x0100, + // Note that 0x100 will clash with Qt::TextSingleLine = 0x100 due to what the comment above + // this enum declaration states. However, since Qt::AlignBaseline is only used by layouts, + // it doesn't make sense to pass Qt::AlignBaseline to QPainter::drawText(), so there + // shouldn't really be any ambiguity between the two overlapping enum values. + AlignVertical_Mask = AlignTop | AlignBottom | AlignVCenter | AlignBaseline, AlignCenter = AlignVCenter | AlignHCenter }; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 03ac8c6153..c1dde19a2e 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -67,6 +67,7 @@ \value AlignTop Aligns with the top. \value AlignBottom Aligns with the bottom. \value AlignVCenter Centers vertically in the available space. + \value AlignBaseline Aligns with the baseline. You can use only one of the horizontal flags at a time. There is one two-dimensional flag: