@@ -63,7 +63,6 void ChartPresenter::handleAxisAdded(QAbstractAxis *axis, Domain *domain) | |||
|
63 | 63 | item->setAnimation(new AxisAnimation(item)); |
|
64 | 64 | |
|
65 | 65 | QObject::connect(domain, SIGNAL(updated()), item, SLOT(handleDomainUpdated())); |
|
66 | QObject::connect(axis, SIGNAL(visibleChanged(bool)), this, SLOT(handleAxisVisibleChanged(bool))); | |
|
67 | 66 | |
|
68 | 67 | //initialize |
|
69 | 68 | domain->emitUpdated(); |
@@ -72,7 +71,6 void ChartPresenter::handleAxisAdded(QAbstractAxis *axis, Domain *domain) | |||
|
72 | 71 | axis->d_ptr->emitUpdated(); |
|
73 | 72 | |
|
74 | 73 | m_axisItems.insert(axis, item); |
|
75 | selectVisibleAxis(); | |
|
76 | 74 | m_layout->invalidate(); |
|
77 | 75 | } |
|
78 | 76 | |
@@ -80,11 +78,11 void ChartPresenter::handleAxisRemoved(QAbstractAxis *axis) | |||
|
80 | 78 | { |
|
81 | 79 | ChartAxis *item = m_axisItems.take(axis); |
|
82 | 80 | Q_ASSERT(item); |
|
83 | selectVisibleAxis(); | |
|
84 | 81 | item->hide(); |
|
85 | 82 | item->disconnect(); |
|
86 | 83 | QObject::disconnect(this, 0, item, 0); |
|
87 | 84 | item->deleteLater(); |
|
85 | m_layout->invalidate(); | |
|
88 | 86 | } |
|
89 | 87 | |
|
90 | 88 | |
@@ -109,54 +107,6 void ChartPresenter::handleSeriesRemoved(QAbstractSeries *series) | |||
|
109 | 107 | item->deleteLater(); |
|
110 | 108 | } |
|
111 | 109 | |
|
112 | void ChartPresenter::selectVisibleAxis() | |
|
113 | { | |
|
114 | QMapIterator<QAbstractAxis *, ChartAxis *> i(m_axisItems); | |
|
115 | ||
|
116 | while (i.hasNext()) { | |
|
117 | i.next(); | |
|
118 | // i.key()->hide(); | |
|
119 | i.key()->show(); | |
|
120 | } | |
|
121 | ||
|
122 | // i.toFront(); | |
|
123 | ||
|
124 | // bool axisX=false; | |
|
125 | // bool axisY=false; | |
|
126 | ||
|
127 | // while (i.hasNext()) { | |
|
128 | // i.next(); | |
|
129 | // if(i.key()->orientation()==Qt::Vertical && !axisY) { | |
|
130 | // axisY=true; | |
|
131 | // i.key()->show(); | |
|
132 | // } | |
|
133 | // if(i.key()->orientation()==Qt::Horizontal && !axisX) { | |
|
134 | // axisX=true; | |
|
135 | // i.key()->show(); | |
|
136 | // } | |
|
137 | ||
|
138 | // } | |
|
139 | } | |
|
140 | ||
|
141 | ||
|
142 | void ChartPresenter::handleAxisVisibleChanged(bool visible) | |
|
143 | { | |
|
144 | QAbstractAxis *axis = static_cast<QAbstractAxis *>(sender()); | |
|
145 | Q_ASSERT(axis); | |
|
146 | if (visible) { | |
|
147 | ||
|
148 | QMapIterator<QAbstractAxis *, ChartAxis *> i(m_axisItems); | |
|
149 | ||
|
150 | while (i.hasNext()) { | |
|
151 | i.next(); | |
|
152 | if (i.key() == axis) | |
|
153 | continue; | |
|
154 | if (i.key()->orientation() == axis->orientation()) | |
|
155 | i.key()->setVisible(false); | |
|
156 | } | |
|
157 | } | |
|
158 | } | |
|
159 | ||
|
160 | 110 | void ChartPresenter::setTheme(QChart::ChartTheme theme, bool force) |
|
161 | 111 | { |
|
162 | 112 | if (m_chartTheme && m_chartTheme->id() == theme) |
@@ -136,14 +136,12 public: | |||
|
136 | 136 | private: |
|
137 | 137 | void createBackgroundItem(); |
|
138 | 138 | void createTitleItem(); |
|
139 | void selectVisibleAxis(); | |
|
140 | 139 | |
|
141 | 140 | public Q_SLOTS: |
|
142 | 141 | void handleSeriesAdded(QAbstractSeries *series, Domain *domain); |
|
143 | 142 | void handleSeriesRemoved(QAbstractSeries *series); |
|
144 | 143 | void handleAxisAdded(QAbstractAxis *axis, Domain *domain); |
|
145 | 144 | void handleAxisRemoved(QAbstractAxis *axis); |
|
146 | void handleAxisVisibleChanged(bool visible); | |
|
147 | 145 | |
|
148 | 146 | private Q_SLOTS: |
|
149 | 147 | void handleAnimationFinished(); |
General Comments 0
You need to be logged in to leave comments.
Login now