From ca92a163f6a4edc2ce807bc8c4b5e1f26de24151 2012-12-07 15:39:09 From: Michal Klocek Date: 2012-12-07 15:39:09 Subject: [PATCH] minAxisLayout increased by 1 --- diff --git a/src/axis/valueaxis/chartvalueaxisx.cpp b/src/axis/valueaxis/chartvalueaxisx.cpp index 10b67ce..26f41b6 100644 --- a/src/axis/valueaxis/chartvalueaxisx.cpp +++ b/src/axis/valueaxis/chartvalueaxisx.cpp @@ -99,7 +99,9 @@ QSizeF ChartValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c switch (which) { case Qt::MinimumSize: { if(!ticksList.empty()) { - width = qMax(fn.boundingRect(ticksList.last()).width(),fn.boundingRect(ticksList.first()).width()); + foreach(QString label,ticksList) { + width = qMax(qreal(fn.boundingRect(label).width()),width); + } } height = fn.height() + labelPadding(); width = qMax(width,base.width()); diff --git a/src/chartlayout.cpp b/src/chartlayout.cpp index a326f45..6c9bbcb 100644 --- a/src/chartlayout.cpp +++ b/src/chartlayout.cpp @@ -169,8 +169,8 @@ QRectF ChartLayout::calculateAxisGeometry(const QRectF &geometry, const QList0) right.setWidth(qMin(right.width(),hratio*rightCount)); - qreal minHeight = qMax(minLeft.height(),minRight.height()); - qreal minWidth = qMax(minTop.width(),minBottom.width()); + qreal minHeight = qMax(minLeft.height(),minRight.height()) + 1; + qreal minWidth = qMax(minTop.width(),minBottom.width()) + 1; QRectF chartRect = geometry.adjusted(qMax(left.width(),minWidth/2), qMax(top.height(), minHeight/2),-qMax(right.width(),minWidth/2),-qMax(bottom.height(),minHeight/2));