@@ -516,8 +516,11 bool QAbstractAxis::isVisible() const | |||
|
516 | 516 | */ |
|
517 | 517 | void QAbstractAxis::setVisible(bool visible) |
|
518 | 518 | { |
|
519 |
d_ptr->m_visible=visible |
|
|
520 | emit d_ptr->updated(); | |
|
519 | if(d_ptr->m_visible!=visible){ | |
|
520 | d_ptr->m_visible=visible; | |
|
521 | emit visibleChanged(visible); | |
|
522 | emit d_ptr->updated(); | |
|
523 | } | |
|
521 | 524 | } |
|
522 | 525 | |
|
523 | 526 | |
@@ -555,7 +558,7 void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) | |||
|
555 | 558 | |
|
556 | 559 | QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis* q): |
|
557 | 560 | q_ptr(q), |
|
558 |
m_visible( |
|
|
561 | m_visible(false), | |
|
559 | 562 | m_axisVisible(true), |
|
560 | 563 | m_gridLineVisible(true), |
|
561 | 564 | m_labelsVisible(true), |
@@ -93,9 +93,14 void ChartPresenter::handleAxisAdded(QAbstractAxis* axis,Domain* domain) | |||
|
93 | 93 | } |
|
94 | 94 | |
|
95 | 95 | QObject::connect(this,SIGNAL(geometryChanged(QRectF)),item,SLOT(handleGeometryChanged(QRectF))); |
|
96 | QObject::connect(axis,SIGNAL(visibleChanged(bool)),this,SLOT(handleAxisVisibleChanged(bool))); | |
|
96 | 97 | //initialize |
|
97 | 98 | if(m_rect.isValid()) item->handleGeometryChanged(m_rect); |
|
99 | //reload visiblity | |
|
98 | 100 | m_axisItems.insert(axis, item); |
|
101 | if(axis->isVisible()) axis->hide(); | |
|
102 | axis->show(); | |
|
103 | ||
|
99 | 104 | } |
|
100 | 105 | |
|
101 | 106 | void ChartPresenter::handleAxisRemoved(QAbstractAxis* axis) |
@@ -138,6 +143,27 void ChartPresenter::handleSeriesRemoved(QAbstractSeries* series) | |||
|
138 | 143 | item->deleteLater(); |
|
139 | 144 | } |
|
140 | 145 | |
|
146 | ||
|
147 | void ChartPresenter::handleAxisVisibleChanged(bool visible) | |
|
148 | { | |
|
149 | QAbstractAxis* axis = static_cast<QAbstractAxis*> (sender()); | |
|
150 | Q_ASSERT(axis); | |
|
151 | if(visible){ | |
|
152 | ||
|
153 | QMapIterator<QAbstractAxis*, ChartAxis*> i(m_axisItems); | |
|
154 | ||
|
155 | while (i.hasNext()) { | |
|
156 | i.next(); | |
|
157 | if(i.key()==axis) { | |
|
158 | continue; | |
|
159 | } | |
|
160 | if(i.key()->d_ptr->m_orientation==axis->d_ptr->m_orientation) { | |
|
161 | i.key()->setVisible(false); | |
|
162 | } | |
|
163 | } | |
|
164 | } | |
|
165 | } | |
|
166 | ||
|
141 | 167 | void ChartPresenter::setTheme(QChart::ChartTheme theme,bool force) |
|
142 | 168 | { |
|
143 | 169 | if(m_chartTheme && m_chartTheme->id() == theme) return; |
@@ -143,6 +143,7 public Q_SLOTS: | |||
|
143 | 143 | void handleSeriesRemoved(QAbstractSeries* series); |
|
144 | 144 | void handleAxisAdded(QAbstractAxis* axis,Domain* domain); |
|
145 | 145 | void handleAxisRemoved(QAbstractAxis* axis); |
|
146 | void handleAxisVisibleChanged(bool visible); | |
|
146 | 147 | |
|
147 | 148 | private Q_SLOTS: |
|
148 | 149 | void handleAnimationFinished(); |
General Comments 0
You need to be logged in to leave comments.
Login now