! Sets how QCustomPlot processes mouse click-and-drag interactions by the user. If \a mode is \ref QCP::srmNone, the mouse drag is forwarded to the underlying objects. For example, QCPAxisRect may process a mouse drag by dragging axis ranges, see \ref QCPAxisRect::setRangeDrag. If \a mode is not \ref QCP::srmNone, the current selection rect (\ref selectionRect) becomes activated and all
| 13229 | \see setInteractions, setSelectionRect, QCPSelectionRect |
| 13230 | */ |
| 13231 | void QCustomPlot::setSelectionRectMode(QCP::SelectionRectMode mode) |
| 13232 | { |
| 13233 | if (mSelectionRect) |
| 13234 | { |
| 13235 | if (mode == QCP::srmNone) |
| 13236 | mSelectionRect->cancel(); // when switching to none, we immediately want to abort a potentially active selection rect |
| 13237 | |
| 13238 | // disconnect old connections: |
| 13239 | if (mSelectionRectMode == QCP::srmSelect) |
| 13240 | disconnect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectSelection(QRect,QMouseEvent*))); |
| 13241 | else if (mSelectionRectMode == QCP::srmZoom) |
| 13242 | disconnect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectZoom(QRect,QMouseEvent*))); |
| 13243 | |
| 13244 | // establish new ones: |
| 13245 | if (mode == QCP::srmSelect) |
| 13246 | connect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectSelection(QRect,QMouseEvent*))); |
| 13247 | else if (mode == QCP::srmZoom) |
| 13248 | connect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectZoom(QRect,QMouseEvent*))); |
| 13249 | } |
| 13250 | |
| 13251 | mSelectionRectMode = mode; |
| 13252 | } |
| 13253 | |
| 13254 | /*! |
| 13255 | Sets the \ref QCPSelectionRect instance that QCustomPlot will use if \a mode is not \ref |