Add support for baseline alignment

This is a prerequisite for baseline support in Qt Quick Layouts

Change-Id: I1f032106cd1e7248a7688b6b9ca59f062a596d49
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
This commit is contained in:
Jan Arve Saether 2013-07-12 14:45:25 +02:00 committed by The Qt Project
parent e24f75af4d
commit 229f931d6e
2 changed files with 8 additions and 2 deletions

View File

@ -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
};

View File

@ -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: