diff options
author | Titta Heikkala <titta.heikkala@digia.com> | 2013-12-27 09:15:44 +0200 |
---|---|---|
committer | Titta Heikkala <titta.heikkala@digia.com> | 2013-12-30 09:56:19 +0200 |
commit | e045f46957d963e2e6d637dd3d0ed1a5222bc293 (patch) | |
tree | 102de53c90f2e9649a046a913534b66f831e1e0f | |
parent | 3a0cfadefc42cc727ce50b00ff2b3b38f4cb32c5 (diff) |
Fix signle legend truncation
When there's just one legend item visible on a chart it needs to be
truncated also.
Task-number: QTRD-2747
Change-Id: Iae8d9c38ad3a0591c6dc224d743bdb581926420b
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
-rw-r--r-- | src/legend/legendlayout.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/legend/legendlayout.cpp b/src/legend/legendlayout.cpp index c76cda52..eec41bf7 100644 --- a/src/legend/legendlayout.cpp +++ b/src/legend/legendlayout.cpp @@ -158,7 +158,7 @@ void LegendLayout::setAttachedGeometry(const QRectF &rect) // If the items would occupy more space than is available, start truncating them // from the longest one. qreal availableGeometry = geometry.width() - right - left * 2 - itemMargins; - if (markerItemsWidth >= availableGeometry && legendWidthList.count() > 1) { + if (markerItemsWidth >= availableGeometry) { bool truncated(false); int count = legendWidthList.count(); for (int i = 1; i < count; i++) { @@ -193,7 +193,8 @@ void LegendLayout::setAttachedGeometry(const QRectF &rect) if (truncated) break; } - // Items are of same width and all of them need to be truncated. + // Items are of same width and all of them need to be truncated + // or there is just one item that is truncated. while (markerItemsWidth >= availableGeometry) { for (int i = 0; i < count; i++) { legendWidthList.at(i)->width--; |