@@ -11,8 +11,7 void ChartWidget::mousePressEvent(QMouseEvent *event) | |||||
11 | { |
|
11 | { | |
12 | if(event->button()!=Qt::LeftButton) return; |
|
12 | if(event->button()!=Qt::LeftButton) return; | |
13 |
|
13 | |||
14 |
int margin = |
|
14 | int margin = 25; | |
15 |
|
||||
16 | QRect rect(margin,margin,width()-2*margin,height()-2*margin); |
|
15 | QRect rect(margin,margin,width()-2*margin,height()-2*margin); | |
17 |
|
16 | |||
18 | m_origin = event->pos(); |
|
17 | m_origin = event->pos(); |
@@ -16,19 +16,9 DeclarativeChart::ChartTheme DeclarativeChart::theme() | |||||
16 |
|
16 | |||
17 | void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) |
|
17 | void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) | |
18 | { |
|
18 | { | |
19 | qDebug() << "geometryChanged " << this << " old geometry: " << oldGeometry; |
|
|||
20 | if (newGeometry.isValid()) { |
|
19 | if (newGeometry.isValid()) { | |
21 | if (newGeometry.width() > 0 && newGeometry.height() > 0) { |
|
20 | if (newGeometry.width() > 0 && newGeometry.height() > 0) { | |
22 | // TODO: setting margin should not be needed to make axis visible? |
|
|||
23 | const int margin = 30; |
|
|||
24 | if (m_chart->margin() == 0 |
|
|||
25 | && newGeometry.width() > (margin * 2) |
|
|||
26 | && newGeometry.height() > (margin * 2)) { |
|
|||
27 | m_chart->setMargin(margin); |
|
|||
28 |
|
|
21 | m_chart->resize(newGeometry.width(), newGeometry.height()); | |
29 | } else { |
|
|||
30 | m_chart->resize(newGeometry.width(), newGeometry.height()); |
|
|||
31 | } |
|
|||
32 | } |
|
22 | } | |
33 | } |
|
23 | } | |
34 | } |
|
24 | } |
General Comments 0
You need to be logged in to leave comments.
Login now