@@ -180,7 +180,17 void QChartView::mouseReleaseEvent(QMouseEvent *event) | |||
|
180 | 180 | if (d_ptr->m_rubberBand) { |
|
181 | 181 | if (event->button() == Qt::LeftButton && d_ptr->m_rubberBand->isVisible()) { |
|
182 | 182 | d_ptr->m_rubberBand->hide(); |
|
183 | QRect rect = d_ptr->m_rubberBand->geometry(); | |
|
183 | QRectF rect = d_ptr->m_rubberBand->geometry(); | |
|
184 | // Since plotArea uses QRectF and rubberband uses QRect, we can't just blindly use | |
|
185 | // rubberband's dimensions for vertical and horizontal rubberbands, where one | |
|
186 | // dimension must match the corresponding plotArea dimension exactly. | |
|
187 | if (d_ptr->m_rubberBandFlags == VerticalRubberBand) { | |
|
188 | rect.setX(d_ptr->m_chart->plotArea().x()); | |
|
189 | rect.setWidth(d_ptr->m_chart->plotArea().width()); | |
|
190 | } else if (d_ptr->m_rubberBandFlags == HorizonalRubberBand) { | |
|
191 | rect.setY(d_ptr->m_chart->plotArea().y()); | |
|
192 | rect.setHeight(d_ptr->m_chart->plotArea().height()); | |
|
193 | } | |
|
184 | 194 | d_ptr->m_chart->zoomIn(rect); |
|
185 | 195 | event->accept(); |
|
186 | 196 | } |
General Comments 0
You need to be logged in to leave comments.
Login now