@@ -155,6 +155,7 void MainWidget::detachLegend() | |||
|
155 | 155 | |
|
156 | 156 | m_chart->legend()->setBackgroundVisible(true); |
|
157 | 157 | m_chart->legend()->setBrush(QBrush(QColor(128,128,128,128))); |
|
158 | m_chart->legend()->setPen(QPen(QColor(192,192,192,192))); | |
|
158 | 159 | //![2] |
|
159 | 160 | |
|
160 | 161 | showLegendSpinbox(); |
@@ -183,7 +183,7 void QLegend::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q | |||
|
183 | 183 | painter->setOpacity(opacity()); |
|
184 | 184 | painter->setPen(d_ptr->m_pen); |
|
185 | 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 | 395 | m_minHeight(0), |
|
396 | 396 | m_width(0), |
|
397 | 397 | m_height(0), |
|
398 | m_diameter(5), | |
|
398 | 399 | m_attachedToChart(true), |
|
399 | 400 | m_backgroundVisible(false) |
|
400 | 401 | { |
@@ -678,6 +679,11 void QLegendPrivate::attachToChart() | |||
|
678 | 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 | 687 | void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series, Domain *domain) |
|
682 | 688 | { |
|
683 | 689 | Q_UNUSED(domain) |
@@ -49,6 +49,7 public: | |||
|
49 | 49 | void updateLayout(); |
|
50 | 50 | void updateDetachedLayout(); |
|
51 | 51 | void attachToChart(); |
|
52 | int roundness(qreal size); | |
|
52 | 53 | |
|
53 | 54 | public Q_SLOTS: |
|
54 | 55 | void handleSeriesAdded(QAbstractSeries *series, Domain *domain); |
@@ -75,6 +76,7 private: | |||
|
75 | 76 | qreal m_minHeight; |
|
76 | 77 | qreal m_width; |
|
77 | 78 | qreal m_height; |
|
79 | qreal m_diameter; | |
|
78 | 80 | bool m_attachedToChart; |
|
79 | 81 | bool m_backgroundVisible; |
|
80 | 82 |
General Comments 0
You need to be logged in to leave comments.
Login now