##// END OF EJS Templates
Fix Chart build when QT_NO_RUBBERBAND is defined...
Titta Heikkala -
r2623:e4fe606cdd4c
parent child
Show More
@@ -107,6 +107,7 void QChartView::setChart(QChart *chart)
107 107 */
108 108 void QChartView::setRubberBand(const RubberBands &rubberBand)
109 109 {
110 #ifndef QT_NO_RUBBERBAND
110 111 d_ptr->m_rubberBandFlags = rubberBand;
111 112
112 113 if (!d_ptr->m_rubberBandFlags) {
@@ -119,6 +120,10 void QChartView::setRubberBand(const RubberBands &rubberBand)
119 120 d_ptr->m_rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
120 121 d_ptr->m_rubberBand->setEnabled(true);
121 122 }
123 #else
124 Q_UNUSED(rubberBand);
125 qWarning("Unable to set rubber band because Qt is configured without it.");
126 #endif
122 127 }
123 128
124 129 /*!
@@ -135,6 +140,7 QChartView::RubberBands QChartView::rubberBand() const
135 140 */
136 141 void QChartView::mousePressEvent(QMouseEvent *event)
137 142 {
143 #ifndef QT_NO_RUBBERBAND
138 144 QRectF plotArea = d_ptr->m_chart->plotArea();
139 145 if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isEnabled()
140 146 && event->button() == Qt::LeftButton && plotArea.contains(event->pos())) {
@@ -143,8 +149,11 void QChartView::mousePressEvent(QMouseEvent *event)
143 149 d_ptr->m_rubberBand->show();
144 150 event->accept();
145 151 } else {
152 #endif
146 153 QGraphicsView::mousePressEvent(event);
154 #ifndef QT_NO_RUBBERBAND
147 155 }
156 #endif
148 157 }
149 158
150 159 /*!
@@ -153,6 +162,7 void QChartView::mousePressEvent(QMouseEvent *event)
153 162 */
154 163 void QChartView::mouseMoveEvent(QMouseEvent *event)
155 164 {
165 #ifndef QT_NO_RUBBERBAND
156 166 if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
157 167 QRect rect = d_ptr->m_chart->plotArea().toRect();
158 168 int width = event->pos().x() - d_ptr->m_rubberBandOrigin.x();
@@ -167,8 +177,11 void QChartView::mouseMoveEvent(QMouseEvent *event)
167 177 }
168 178 d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin.x(), d_ptr->m_rubberBandOrigin.y(), width, height).normalized());
169 179 } else {
180 #endif
170 181 QGraphicsView::mouseMoveEvent(event);
182 #ifndef QT_NO_RUBBERBAND
171 183 }
184 #endif
172 185 }
173 186
174 187 /*!
@@ -178,6 +191,7 void QChartView::mouseMoveEvent(QMouseEvent *event)
178 191 */
179 192 void QChartView::mouseReleaseEvent(QMouseEvent *event)
180 193 {
194 #ifndef QT_NO_RUBBERBAND
181 195 if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
182 196 if (event->button() == Qt::LeftButton) {
183 197 d_ptr->m_rubberBand->hide();
@@ -217,8 +231,11 void QChartView::mouseReleaseEvent(QMouseEvent *event)
217 231 event->accept();
218 232 }
219 233 } else {
234 #endif
220 235 QGraphicsView::mouseReleaseEvent(event);
236 #ifndef QT_NO_RUBBERBAND
221 237 }
238 #endif
222 239 }
223 240
224 241 /*!
@@ -236,7 +253,9 QChartViewPrivate::QChartViewPrivate(QChartView *q, QChart *chart)
236 253 : q_ptr(q),
237 254 m_scene(new QGraphicsScene(q)),
238 255 m_chart(chart),
256 #ifndef QT_NO_RUBBERBAND
239 257 m_rubberBand(0),
258 #endif
240 259 m_rubberBandFlags(QChartView::NoRubberBand)
241 260 {
242 261 q_ptr->setFrameShape(QFrame::NoFrame);
@@ -55,7 +55,9 public:
55 55 QGraphicsScene *m_scene;
56 56 QChart *m_chart;
57 57 QPoint m_rubberBandOrigin;
58 #ifndef QT_NO_RUBBERBAND
58 59 QRubberBand *m_rubberBand;
60 #endif
59 61 QChartView::RubberBands m_rubberBandFlags;
60 62 };
61 63
General Comments 0
You need to be logged in to leave comments. Login now