@@ -484,6 +484,13 void ChartPresenter::updateLayout() | |||||
484 | } |
|
484 | } | |
485 | } |
|
485 | } | |
486 |
|
486 | |||
|
487 | if(m_rect.width()<2*(m_chartMargins.top()+m_chartMargins.bottom()) || m_rect.height()< 2*(m_chartMargins.top() + m_chartMargins.bottom())) | |||
|
488 | { | |||
|
489 | m_chart->setMinimumSize(2*(m_chartMargins.top()+m_chartMargins.bottom()),2*(m_chartMargins.top() + m_chartMargins.bottom())); | |||
|
490 | return; | |||
|
491 | } | |||
|
492 | ||||
|
493 | ||||
487 | // recalculate title position |
|
494 | // recalculate title position | |
488 | if (m_titleItem) { |
|
495 | if (m_titleItem) { | |
489 | QPointF center = m_rect.center() -m_titleItem->boundingRect().center(); |
|
496 | QPointF center = m_rect.center() -m_titleItem->boundingRect().center(); | |
@@ -495,6 +502,7 void ChartPresenter::updateLayout() | |||||
495 | m_backgroundItem->setRect(m_rect.adjusted(m_marginTiny,m_marginTiny, -m_marginTiny, -m_marginTiny)); |
|
502 | m_backgroundItem->setRect(m_rect.adjusted(m_marginTiny,m_marginTiny, -m_marginTiny, -m_marginTiny)); | |
496 | } |
|
503 | } | |
497 |
|
504 | |||
|
505 | ||||
498 | QRectF chartRect = m_rect.adjusted(m_chartMargins.left(),m_chartMargins.top(),-m_chartMargins.right(),-m_chartMargins.bottom()); |
|
506 | QRectF chartRect = m_rect.adjusted(m_chartMargins.left(),m_chartMargins.top(),-m_chartMargins.right(),-m_chartMargins.bottom()); | |
499 |
|
507 | |||
500 | legend->setGeometry(m_rect.adjusted(m_legendMargins.left(),m_legendMargins.top(),-m_legendMargins.right(),-m_legendMargins.bottom())); |
|
508 | legend->setGeometry(m_rect.adjusted(m_legendMargins.left(),m_legendMargins.top(),-m_legendMargins.right(),-m_legendMargins.bottom())); |
@@ -224,6 +224,7 void QChartView::resizeEvent(QResizeEvent *event) | |||||
224 | { |
|
224 | { | |
225 | QGraphicsView::resizeEvent(event); |
|
225 | QGraphicsView::resizeEvent(event); | |
226 | d_ptr->m_chart->resize(size()); |
|
226 | d_ptr->m_chart->resize(size()); | |
|
227 | setMinimumSize(d_ptr->m_chart->minimumSize().toSize()); | |||
227 | setSceneRect(d_ptr->m_chart->geometry()); |
|
228 | setSceneRect(d_ptr->m_chart->geometry()); | |
228 | } |
|
229 | } | |
229 |
|
230 |
General Comments 0
You need to be logged in to leave comments.
Login now