##// END OF EJS Templates
added roundness to legend background
sauimone -
r1453:f60a3095bd58
parent child
Show More
@@ -155,6 +155,7 void MainWidget::detachLegend()
155
155
156 m_chart->legend()->setBackgroundVisible(true);
156 m_chart->legend()->setBackgroundVisible(true);
157 m_chart->legend()->setBrush(QBrush(QColor(128,128,128,128)));
157 m_chart->legend()->setBrush(QBrush(QColor(128,128,128,128)));
158 m_chart->legend()->setPen(QPen(QColor(192,192,192,192)));
158 //![2]
159 //![2]
159
160
160 showLegendSpinbox();
161 showLegendSpinbox();
@@ -183,7 +183,7 void QLegend::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
183 painter->setOpacity(opacity());
183 painter->setOpacity(opacity());
184 painter->setPen(d_ptr->m_pen);
184 painter->setPen(d_ptr->m_pen);
185 painter->setBrush(d_ptr->m_brush);
185 painter->setBrush(d_ptr->m_brush);
186 painter->drawRect(boundingRect());
186 painter->drawRoundRect(rect(),d_ptr->roundness(rect().width()),d_ptr->roundness(rect().height()));
187 }
187 }
188
188
189 /*!
189 /*!
@@ -395,6 +395,7 QLegendPrivate::QLegendPrivate(ChartPresenter* presenter, QChart *chart, QLegend
395 m_minHeight(0),
395 m_minHeight(0),
396 m_width(0),
396 m_width(0),
397 m_height(0),
397 m_height(0),
398 m_diameter(5),
398 m_attachedToChart(true),
399 m_attachedToChart(true),
399 m_backgroundVisible(false)
400 m_backgroundVisible(false)
400 {
401 {
@@ -678,6 +679,11 void QLegendPrivate::attachToChart()
678 q_ptr->setParent(m_chart);
679 q_ptr->setParent(m_chart);
679 }
680 }
680
681
682 int QLegendPrivate::roundness(qreal size)
683 {
684 return 100*m_diameter/int(size);
685 }
686
681 void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series, Domain *domain)
687 void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series, Domain *domain)
682 {
688 {
683 Q_UNUSED(domain)
689 Q_UNUSED(domain)
@@ -49,6 +49,7 public:
49 void updateLayout();
49 void updateLayout();
50 void updateDetachedLayout();
50 void updateDetachedLayout();
51 void attachToChart();
51 void attachToChart();
52 int roundness(qreal size);
52
53
53 public Q_SLOTS:
54 public Q_SLOTS:
54 void handleSeriesAdded(QAbstractSeries *series, Domain *domain);
55 void handleSeriesAdded(QAbstractSeries *series, Domain *domain);
@@ -75,6 +76,7 private:
75 qreal m_minHeight;
76 qreal m_minHeight;
76 qreal m_width;
77 qreal m_width;
77 qreal m_height;
78 qreal m_height;
79 qreal m_diameter;
78 bool m_attachedToChart;
80 bool m_attachedToChart;
79 bool m_backgroundVisible;
81 bool m_backgroundVisible;
80
82
General Comments 0
You need to be logged in to leave comments. Login now