##// END OF EJS Templates
moved legend offset to private side
sauimone -
r1458:1e5e1b9c40c3
parent child
Show More
@@ -32,6 +32,7
32 #define LEGENDSCROLLER_P_H
32 #define LEGENDSCROLLER_P_H
33
33
34 #include "qlegend.h"
34 #include "qlegend.h"
35 #include "qlegend_p.h"
35 #include "scroller_p.h"
36 #include "scroller_p.h"
36
37
37 QTCOMMERCIALCHART_BEGIN_NAMESPACE
38 QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -46,24 +47,21 public:
46
47
47 void setOffset(const QPointF& point)
48 void setOffset(const QPointF& point)
48 {
49 {
49 QLegend::setOffset(point);
50 d_ptr->setOffset(point.x(), point.y());
50 }
51 }
51 QPointF offset() const
52 QPointF offset() const
52 {
53 {
53 return QLegend::offset();
54 return d_ptr->offset();
54 }
55 }
55
56
56 void mousePressEvent(QGraphicsSceneMouseEvent* event){
57 void mousePressEvent(QGraphicsSceneMouseEvent* event){
57 Scroller::mousePressEvent(event);
58 Scroller::mousePressEvent(event);
58 //QLegend::mousePressEvent(event);
59 }
59 }
60 void mouseMoveEvent(QGraphicsSceneMouseEvent* event){
60 void mouseMoveEvent(QGraphicsSceneMouseEvent* event){
61 Scroller::mouseMoveEvent(event);
61 Scroller::mouseMoveEvent(event);
62 //QLegend::mouseMoveEvent(event);
63 }
62 }
64 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event){
63 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event){
65 Scroller::mouseReleaseEvent(event);
64 Scroller::mouseReleaseEvent(event);
66 //QLegend::mouseReleaseEvent(event);
67 }
65 }
68 };
66 };
69
67
@@ -303,22 +303,6 bool QLegend::isAttachedToChart()
303 }
303 }
304
304
305 /*!
305 /*!
306 Sets the legend's scrolling offset to value defined by \a point.
307 */
308 void QLegend::setOffset(const QPointF& point)
309 {
310 d_ptr->setOffset(point.x(),point.y());
311 }
312
313 /*!
314 Returns the legend's scrolling offset.
315 */
316 QPointF QLegend::offset() const
317 {
318 return QPointF(d_ptr->m_offsetX,d_ptr->m_offsetY);
319 }
320
321 /*!
322 Sets the visibility of legend background to \a visible
306 Sets the visibility of legend background to \a visible
323 */
307 */
324 void QLegend::setBackgroundVisible(bool visible)
308 void QLegend::setBackgroundVisible(bool visible)
@@ -448,6 +432,10 void QLegendPrivate::setOffset(qreal x, qreal y)
448 }
432 }
449 }
433 }
450
434
435 QPointF QLegendPrivate::offset() const
436 {
437 return QPointF(m_offsetX,m_offsetY);
438 }
451
439
452 void QLegendPrivate::updateLayout()
440 void QLegendPrivate::updateLayout()
453 {
441 {
@@ -742,6 +730,7 void QLegendPrivate::handleUpdatePieSeries()
742 handleSeriesAdded(series, 0);
730 handleSeriesAdded(series, 0);
743 }
731 }
744
732
733
745 #include "moc_qlegend.cpp"
734 #include "moc_qlegend.cpp"
746 #include "moc_qlegend_p.cpp"
735 #include "moc_qlegend_p.cpp"
747
736
@@ -80,9 +80,6 public:
80 void setBackgroundVisible(bool visible = true);
80 void setBackgroundVisible(bool visible = true);
81 bool isBackgroundVisible() const;
81 bool isBackgroundVisible() const;
82
82
83 void setOffset(const QPointF& point);
84 QPointF offset() const;
85
86 protected:
83 protected:
87 void resizeEvent(QGraphicsSceneResizeEvent *event);
84 void resizeEvent(QGraphicsSceneResizeEvent *event);
88 void hideEvent(QHideEvent *event);
85 void hideEvent(QHideEvent *event);
@@ -46,6 +46,7 public:
46 ~QLegendPrivate();
46 ~QLegendPrivate();
47
47
48 void setOffset(qreal x, qreal y);
48 void setOffset(qreal x, qreal y);
49 QPointF offset() const;
49 void updateLayout();
50 void updateLayout();
50 void updateDetachedLayout();
51 void updateDetachedLayout();
51 void attachToChart();
52 void attachToChart();
General Comments 0
You need to be logged in to leave comments. Login now