diff options
author | Sebastian Geerken <devnull@localhost> | 2016-05-29 14:54:25 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2016-05-29 14:54:25 +0200 |
commit | 0af7f4a7e24725573c03933fa9abfec3aaabf640 (patch) | |
tree | 032965d34069af3c00963a04d5d88f4505a85c4e /dw/textblock.cc | |
parent | a55d0b2cb386a4a2bc7ec38b56e06aaf37b00956 (diff) |
Fix position for sizeRequest in Textblock widget (comments).
Diffstat (limited to 'dw/textblock.cc')
-rw-r--r-- | dw/textblock.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc index d18fae88..262b8872 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -2280,6 +2280,13 @@ bool Textblock::calcSizeOfWidgetInFlow (int wordIndex, Widget *widget, int lastWord = lines->empty () ? -1 : lines->getLastRef()->lastWord; assert (wordIndex > lastWord); + // The position passed to sizeRequest must be equivalent to the position + // passed later to sizeAllocate. This is more complicated for widgets + // which are centered or aligned to the right: here, we have to know the + // width to calculate the horizontal position. Both are calculated in an + // iterative way; initially, the left border is used (like for other, + // simpler alignments). + // Since the child widget will regard floats, we do not have to include // floats when calculating left and right border. int leftBorder = boxOffsetX () + leftInnerPadding @@ -2314,7 +2321,7 @@ bool Textblock::calcSizeOfWidgetInFlow (int wordIndex, Widget *widget, switch(widget->getStyle()->textAlign) { case core::style::TEXT_ALIGN_LEFT: case core::style::TEXT_ALIGN_STRING: // see comment in alignLine() - case core::style::TEXT_ALIGN_JUSTIFY: + case core::style::TEXT_ALIGN_JUSTIFY: // equivalent for only 1 word default: // compiler happiness xRel = leftBorder; break; |