@@ -63,7 +63,6 void ChartPresenter::handleAxisAdded(QAbstractAxis *axis, Domain *domain) | |||||
63 | item->setAnimation(new AxisAnimation(item)); |
|
63 | item->setAnimation(new AxisAnimation(item)); | |
64 |
|
64 | |||
65 | QObject::connect(domain, SIGNAL(updated()), item, SLOT(handleDomainUpdated())); |
|
65 | QObject::connect(domain, SIGNAL(updated()), item, SLOT(handleDomainUpdated())); | |
66 | QObject::connect(axis, SIGNAL(visibleChanged(bool)), this, SLOT(handleAxisVisibleChanged(bool))); |
|
|||
67 |
|
66 | |||
68 | //initialize |
|
67 | //initialize | |
69 | domain->emitUpdated(); |
|
68 | domain->emitUpdated(); | |
@@ -72,7 +71,6 void ChartPresenter::handleAxisAdded(QAbstractAxis *axis, Domain *domain) | |||||
72 | axis->d_ptr->emitUpdated(); |
|
71 | axis->d_ptr->emitUpdated(); | |
73 |
|
72 | |||
74 | m_axisItems.insert(axis, item); |
|
73 | m_axisItems.insert(axis, item); | |
75 | selectVisibleAxis(); |
|
|||
76 | m_layout->invalidate(); |
|
74 | m_layout->invalidate(); | |
77 | } |
|
75 | } | |
78 |
|
76 | |||
@@ -80,11 +78,11 void ChartPresenter::handleAxisRemoved(QAbstractAxis *axis) | |||||
80 | { |
|
78 | { | |
81 | ChartAxis *item = m_axisItems.take(axis); |
|
79 | ChartAxis *item = m_axisItems.take(axis); | |
82 | Q_ASSERT(item); |
|
80 | Q_ASSERT(item); | |
83 | selectVisibleAxis(); |
|
|||
84 | item->hide(); |
|
81 | item->hide(); | |
85 | item->disconnect(); |
|
82 | item->disconnect(); | |
86 | QObject::disconnect(this, 0, item, 0); |
|
83 | QObject::disconnect(this, 0, item, 0); | |
87 | item->deleteLater(); |
|
84 | item->deleteLater(); | |
|
85 | m_layout->invalidate(); | |||
88 | } |
|
86 | } | |
89 |
|
87 | |||
90 |
|
88 | |||
@@ -109,54 +107,6 void ChartPresenter::handleSeriesRemoved(QAbstractSeries *series) | |||||
109 | item->deleteLater(); |
|
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 | void ChartPresenter::setTheme(QChart::ChartTheme theme, bool force) |
|
110 | void ChartPresenter::setTheme(QChart::ChartTheme theme, bool force) | |
161 | { |
|
111 | { | |
162 | if (m_chartTheme && m_chartTheme->id() == theme) |
|
112 | if (m_chartTheme && m_chartTheme->id() == theme) |
@@ -136,14 +136,12 public: | |||||
136 | private: |
|
136 | private: | |
137 | void createBackgroundItem(); |
|
137 | void createBackgroundItem(); | |
138 | void createTitleItem(); |
|
138 | void createTitleItem(); | |
139 | void selectVisibleAxis(); |
|
|||
140 |
|
139 | |||
141 | public Q_SLOTS: |
|
140 | public Q_SLOTS: | |
142 | void handleSeriesAdded(QAbstractSeries *series, Domain *domain); |
|
141 | void handleSeriesAdded(QAbstractSeries *series, Domain *domain); | |
143 | void handleSeriesRemoved(QAbstractSeries *series); |
|
142 | void handleSeriesRemoved(QAbstractSeries *series); | |
144 | void handleAxisAdded(QAbstractAxis *axis, Domain *domain); |
|
143 | void handleAxisAdded(QAbstractAxis *axis, Domain *domain); | |
145 | void handleAxisRemoved(QAbstractAxis *axis); |
|
144 | void handleAxisRemoved(QAbstractAxis *axis); | |
146 | void handleAxisVisibleChanged(bool visible); |
|
|||
147 |
|
145 | |||
148 | private Q_SLOTS: |
|
146 | private Q_SLOTS: | |
149 | void handleAnimationFinished(); |
|
147 | void handleAnimationFinished(); |
General Comments 0
You need to be logged in to leave comments.
Login now